Skip to content

feat: implement localpi runtime launcher#5

Open
dutifulbob wants to merge 7 commits into
mainfrom
feat/localpi-runtime
Open

feat: implement localpi runtime launcher#5
dutifulbob wants to merge 7 commits into
mainfrom
feat/localpi-runtime

Conversation

@dutifulbob

Copy link
Copy Markdown
Member

Opened on behalf of Onur Solmaz (osolmaz).

Summary

Localpi was still mostly the old localagent wrapper.
This changes it into the local Pi launcher we wanted: llama-server by default, LM Studio as an explicit alternate runtime, default Pi tools, tool approval, token status, and no final-schema machinery.
It also installs the renamed localpi binary and keeps schema-constrained classifier output in caller tools such as localpager-agent.

What Changed

The public CLI now matches the renamed project.
The runtime layer now decides whether to manage llama-server, talk to LM Studio, or use a custom OpenAI-compatible endpoint.

  • Renamed package metadata and binary from localagent to localpi.
  • Removed --final-schema, --schema, the generated final_json extension, structured-output tests, and the example schema.
  • Added model alias resolution with built-in Gemma aliases plus LOCALPI_MODELS_FILE overrides.
  • Added managed llama-server start/reuse/status/stop support with pid and metadata under localpi state.
  • Added explicit lmstudio and openai-compatible runtimes.
  • Added generated Pi extensions for tool approval and token status.
  • Added default tools: read,bash,edit,write,grep,find,ls.
  • Updated README, runtime spec, structured-output note, and implementation plan.

Testing

I tested both the normal project checks and the actual local runtime path.
The smoke prompt reused the already-running Gemma 12B llama-server on port 18194; LM Studio reported no loaded models.

  • npm run check
  • node dist/src/cli/main.js --help
  • node dist/src/cli/main.js --list
  • node dist/src/cli/main.js --status
  • node dist/src/cli/main.js --model gemma-12b -p "Reply with exactly: ok"
  • node dist/src/cli/main.js --final-schema schema.json
  • npm link
  • localpi --list
  • localpi --model gemma-12b -p "Reply with exactly: ok"

Risks

The main behavior change is intentional: localagent is no longer shipped by this package, and schema output is no longer part of localpi.
Older external workspace wrappers that still call localagent --final-schema need to move to localpager-agent if they are still used.

  • localpi --stop only stops localpi-owned llama-server processes. It will not kill an unrelated server already running on the same port.
  • LM Studio runtime support was checked through code and unit tests, but I did not load a model into LM Studio for smoke testing to avoid double-loading large models.

@dutifulbob

Copy link
Copy Markdown
Member Author

Implemented the localpi runtime launcher end to end and pushed the final fixes through 0fe0727.\n\nValidation:\n- npm run check passes locally: format, lint, typecheck, 25 tests, build.\n- CI test job passes: https://github.com/dutifuldev/localpi/actions/runs/27062904972/job/79878669417\n- Smoke tested the built CLI against the already-running llama-server on 18194: node dist/src/cli/main.js --model auto -p 'Reply with exactly: ok' returned ok.\n- Confirmed LM Studio has no loaded models with lms ps before the smoke.\n- Confirmed removed schema mode fails cleanly: --final-schema exits with localpi's migration error.\n\nReview loop:\n- codex review found no P0/P1 issues.\n- Follow-up P2 findings around managed llama-server reuse, process ownership, model-id resolution, and LM Studio port warnings were fixed and covered by tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants