harness: add wally command-code

Merged
SI
2d ago
+1036-8

Adds wally command-code -m <model>, which opens Command Code (npm command-code, https://commandcode.ai/docs) against a local or hosted RunAnywhere model.

Command Code reads custom providers only from ~/.commandcode/providers.json. Nothing moves that file, and it reloads live. So a launch merges a runanywhere-wally provider into the person's file and takes it out when the tool exits. If the file is untouched, the original bytes go back. If they edited it during the session, only our provider is removed. The file names $WALLY_COMMAND_CODE_API_KEY and never holds the key. A lock in ~/.commandcode/ keeps it to one run at a time.

If the person isn't signed in to Command Code, the child gets a placeholder COMMAND_CODE_API_KEY plus CMD_LOCAL_ONLY=1. That gets past its login screen without the placeholder ever reaching Command Code's backend. Local models always run local-only. --skip-onboarding --no-auto-update are passed, and -t is left to the person. Command Code's own subcommands (-- status, -- login) run untouched. -- acp is wired, and the editor picks the model there.

Tested:

  • 18 new unit tests, plus golden cases for the new command line
  • fmt, clippy -D warnings, test ledger, agents-sync, ctest 6/6
  • cloud e2e: wally command-code -m glm-5.3-flash -- -p "..." --output-format json returned PONG with no login prompt
  • an existing providers.json comes back byte-identical
  • a second concurrent run is refused

Not tested: ACP and Ctrl-C end to end, and a local model run. Traffic isn't attributed via X-RA-Harness yet, because the contract's Harness enum needs command_code added in InferenceInfra first.


Summary by cubic

Adds wally command-code -m <model>, which launches Command Code (npm command-code) against a local or hosted RunAnywhere model.

Because Command Code reads custom providers only from ~/.commandcode/providers.json, the launch merges a runanywhere-wally provider into that file and takes it out when the tool exits. The file is written atomically (staged beside it and renamed into place) and only when its bytes are unchanged, so Command Code never reads a torn or overwritten merge; if the file changed in between, the merge is re-planned from what is there now. On exit, the original bytes go back if the file was untouched, or only our provider comes out if it was edited mid-session. A lock in ~/.commandcode/ keeps it to one run at a time, and the file references the key via $WALLY_COMMAND_CODE_API_KEY instead of holding it.

For people without a Command Code sign-in, a placeholder COMMAND_CODE_API_KEY plus CMD_LOCAL_ONLY=1 gets past the login screen without reaching Command Code's backend; local models always run local-only. --skip-onboarding --no-auto-update are passed and -t is left to the person. Command Code's own subcommands (-- status, -- login) run untouched, while -- acp gets the wired provider.

Notes

  • Adds 18 unit tests plus golden cases for the new command-line help and updated command lists.
  • Not yet tested end-to-end: ACP mode, Ctrl-C behavior, and a local model run.
  • Traffic isn't attributed via X-RA-Harness yet; the Harness enum in InferenceInfra needs command_code added first.

Summary by CodeRabbit

  • New Features
    • Added the command-code coding tool for launching Command Code with a selected model.
    • Supports local and hosted models, configurable reasoning levels, authentication, and passthrough arguments.
    • Preserves existing provider configuration and safely manages Command Code settings during execution.
    • Added platform-specific installation support through npm.
  • Documentation
    • Added guidance for configuration, authentication, onboarding, subcommands, and resumed sessions.
  • Tests
    • Added coverage for routing, model metadata, authentication, locking, installation, and configuration cleanup.