Repository navigation
feat(daemon): add Command Code as a model provider - #30
Open
rodrigovzq wants to merge 2 commits into
Open
rodrigovzq wants to merge 2 commits into
rodrigovzq wants to merge 2 commits into
Conversation
Alan-TheGentleman
requested changes
Oct 10, 2026
Alan-TheGentleman
left a comment
Contributor
There was a problem hiding this comment.
Thanks for this, Rodrigo. It's carefully done and the tests are solid. Three changes before we can merge it:
- Protect the extension. The engine loads
command-code.tswith-e, but its path isn't in the guard'sprotectedPathsthe way the approval guard's own file is. Since it's code the engine runs, please add it there so the agent's file tools can't rewrite it. - Drop the edits to
odd/tasks/gentle-dot.md. That file is the maintainer's log, and your S34/T35/L118 now collide with entries we've already added. Please keep the PR to code, tests, and docs. - List the models from the gateway instead of a fixed catalog (75 + 10 today, with
refreshModelsempty). A hardcoded list goes stale as soon as Command Code adds or removes one. If the gateway exposes a models endpoint, use it with a small fallback.
Happy to review again once these are in.
Author
|
Thanks for the review, Alan. All three are in (
Verified: |
Two providers behind one Command Code key and gateway: - commandcode: OpenAI chat-completions, 75 models. - commandcode-anthropic: Anthropic messages, 10 Claude models. The daemon registers both in its ModelRuntime (Accounts sign-in and the model picker) and loads the same module into the engine with -e, like the approval guard; runtime-build.ts copies it into the installed app. Sign-in keeps the key in the assistant's own auth.json (0600), or reads COMMANDCODE_API_KEY. The base URLs differ by design: the OpenAI SDK appends /chat/completions and the Anthropic SDK /v1/messages, so both reach /provider/v1/... . Spec: odd/tasks/gentle-dot.md S34/T35/L118.
…gateway Addresses the review on the Command Code provider: - Both engine extensions (approval guard and Command Code) are now protected paths, so the agent's file tools cannot rewrite them. extensionPaths replaces the single guardPath option. - The catalog is read from the gateway's GET /provider/v1/models and filtered by supported_endpoints (/chat/completions for commandcode, /messages for commandcode-anthropic); the static list stays as the offline fallback. - Drops the odd/tasks/gentle-dot.md edits: that log belongs to the maintainers. pnpm typecheck, pnpm test 679 passed / 5 skipped, biome clean.
rodrigovzq
force-pushed
the
feat/command-code-provider
branch
from
October 13, 2026 16:51
b7e946f to
1393931
Compare
Author
|
@Alan-TheGentleman all three items are in ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Command Code as a model provider, from the setup already used in OpenCode. Two providers share one API key and one gateway (
https://api.commandcode.ai/provider/v1):commandcode— OpenAI chat-completions API, 75 models (GPT, DeepSeek, Kimi, GLM, MiniMax, MiMo, Qwen, Gemini, Grok, …).commandcode-anthropic— Anthropic messages API, 10 Claude models.Sign in once in Accounts (the key stays in the assistant's own
auth.json, 0600, or is read fromCOMMANDCODE_API_KEY); the models then appear in the picker grouped by provider.How
packages/daemon/src/extensions/command-code.ts(new): two native Pi providers + the catalog. Self-contained, so the engine can load it with-e.packages/daemon/src/auth.ts: registers both in the daemon'sModelRuntime, so Accounts lists them.packages/daemon/src/daemon.tsandruntime-build.ts: pass-e …/command-code.tsto the engine (like the approval guard) and copy the file into the installed runtime./chat/completions(base…/provider/v1), the Anthropic SDK appends/v1/messages(base…/provider); both reach/provider/v1/….Tests
packages/daemon/test/command-code.test.ts(new): catalog ids/api/base URLs, both providers offered for API-key sign-in, login stores the key 0600 and a fresh runtime sees it, logout clears it.runtime-build.test.ts/connectors-gateway.test.ts: updated for the copied extension and the engine-eargument.pnpm typecheck,pnpm test(676 passed / 5 skipped) andbiome checkare green.Notes
Offline runtime; a real sign-in and a live stream are not verified here. Spec:
odd/tasks/gentle-dot.mdS34/T35/L118.