Skip to content

feat(cli): docker-style agent verbs + daemon-connect helper#38

Open
Codename-11 wants to merge 1 commit into
feature/v3-foundationfrom
feature/cli-daemon-verbs
Open

feat(cli): docker-style agent verbs + daemon-connect helper#38
Codename-11 wants to merge 1 commit into
feature/v3-foundationfrom
feature/cli-daemon-verbs

Conversation

@Codename-11
Copy link
Copy Markdown
Owner

Summary

Adds four top-level verbs that talk to the v3 daemon through the
@axiom-labs/arc-client SDK, plus a shared connect helper:

  • arc ls / arc ls --all / arc ls --json — list agents known to the daemon
  • arc attach <id> — stream terminal bytes (producer lands in Unit 2)
  • arc send <id> <text> — forward a message to a running agent
  • arc stop <id> — stop a running agent

packages/cli/src/daemon-client.ts exposes connectDaemon(), withDaemonClient(), and a tiny hasErrorCode() helper. The helper reads the shared root token from ~/.arc/auth.json, probes /health, and auto-starts the daemon (daemon start --foreground detached) if it's not already running, forwarding process.execArgv so the TS loader survives into dev-mode children.

The write-path verbs (attach/send/stop) currently get code: "unimplemented" from the daemon — Unit 2 owns agent.run/stop/send/attach wiring. Each verb detects that and prints a friendly hint + exits 1, so this PR is mergeable ahead of Unit 2.

Test plan

  • npx tsc --noEmit passes
  • npx vitest run tests/cli-daemon-verbs.test.ts — 5 tests pass (ls empty, ls --json empty, attach/send/stop on bogus id each print an error and exit 1)
  • E2E recipe: spin daemon on an ephemeral port, run each verb against it, clean daemon stop at the end
  • Once Unit 2 lands, arc attach/send/stop start exercising real lifecycle paths

Adds `arc ls`, `arc attach`, `arc send`, `arc stop` top-level verbs that
talk to the v3 daemon via the `@axiom-labs/arc-client` SDK, plus a shared
`connectDaemon()` helper that auto-starts the daemon and reads the root
token from `~/.arc/auth.json`. The write-path verbs (attach/send/stop)
print a friendly hint when the daemon returns `unimplemented`, since
Unit 2 owns the corresponding lifecycle wiring.

- `packages/cli/src/daemon-client.ts` — `connectDaemon`, `withDaemonClient`,
  `hasErrorCode` helpers; auto-start forwards `process.execArgv` so the
  TS loader survives into the detached child during dev.
- `packages/cli/src/commands/{ls,attach,send,stop-agent}.ts` — new verbs.
- `packages/cli/src/cli.ts` — register the four verbs; drop `ls` as an
  alias for `list` so the new command reaches `handleLs`.
- `tests/cli-daemon-verbs.test.ts` — in-process daemon + handlers,
  asserts empty `ls`, `ls --json`, and friendly errors on bogus ids.
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.

1 participant