@mutagent/cli 0.1.341 → 0.1.342

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +125 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -366,6 +366,131 @@ mutagent feedback send "the CLI crashed on init" \
366
366
 
367
367
  ---
368
368
 
369
+ ## Command surface
370
+
371
+ The `mutagent helix` and `mutagent agent` trees as the CLI registers them, and the API each verb
372
+ calls. Line anchors are to origin/main `0b4f9ce11` (17 Sep 2026); paths are repository-relative.
373
+ For how each cloud verb maps to the local `helix` binary, see
374
+ [docs/helix-surface-map.md](docs/helix-surface-map.md). That map was read from `4488d23b0`
375
+ (12 Sep 2026) and predates the launch route, the reference-addressed session verbs and managed
376
+ agents; where it and this section disagree, this section follows the source.
377
+
378
+ ```mermaid
379
+ flowchart LR
380
+ ROOT["mutagent"] --> HX["helix"]
381
+ ROOT --> AG["agent"]
382
+
383
+ HX --> HXRUN["helix -p or --mode json or --mode rpc<br/>classic arm, --prime selects the prime arm"]
384
+ HX --> HXAGENT["helix agent"]
385
+ HX --> HXSESSION["helix session"]
386
+ HX --> HXMODELS["helix models"]
387
+ HX --> HXDOCTOR["helix doctor"]
388
+ HX --> HXSMOKE["helix smoke"]
389
+ HX --> HXVERSION["helix version"]
390
+ HX --> HXUPDATE["helix update<br/>always refused"]
391
+
392
+ HXAGENT --> HXAGENTDEF["definition: positional, --prompt, --file, --name"]
393
+ HXAGENT --> HXAGENTSLUG["@slug, @slug:vN, @slug:latest<br/>managed agent"]
394
+
395
+ HXSESSION --> SLS["ls"]
396
+ HXSESSION --> SATTACH["attach"]
397
+ HXSESSION --> SSEND["send"]
398
+ HXSESSION --> SSIGNAL["signal"]
399
+ HXSESSION --> SCLOSE["close-input"]
400
+ HXSESSION --> SCHECKPOINT["checkpoint"]
401
+ HXSESSION --> SCHECKPOINTS["checkpoints"]
402
+ HXSESSION --> SRESTORE["restore"]
403
+ HXSESSION --> SSTART["start<br/>internal, sandbox id"]
404
+
405
+ HXMODELS --> MDEFAULT["default"]
406
+
407
+ AG --> ACHECK["check<br/>local"]
408
+ AG --> APACK["pack<br/>local"]
409
+ AG --> ARUN["run<br/>local Helix binary"]
410
+ AG --> ADEPLOY["deploy"]
411
+ AG --> AACTIVATE["activate"]
412
+ AG --> ALIST["list"]
413
+ AG --> AINSPECT["inspect"]
414
+ AG --> ARETIRE["retire"]
415
+ ```
416
+
417
+ Registration: `mutagent-cli/src/bin/cli.ts:243` (`helix`) and `:252` (`agent`);
418
+ `mutagent-cli/src/commands/helix/index.ts:81-87` attaches `agent`, `session`, `models`, `doctor`,
419
+ `smoke`, `version` and `update`; `mutagent-cli/src/commands/helix/session-commands.ts:55-63`
420
+ attaches the session verbs; `mutagent-cli/src/commands/agent/index.ts:32-108` declares the
421
+ `agent` verbs.
422
+
423
+ ### Credentials
424
+
425
+ The two trees authenticate differently.
426
+
427
+ - **`mutagent helix …`** goes through `requestJson` (`mutagent-cli/src/lib/sandbox-api.ts:606`).
428
+ Each request carries `Authorization: Bearer <operator token>` and `x-workspace-id`
429
+ (`sandbox-api.ts:391`, `:490-495`). The operator token is minted from the platform API key by
430
+ `POST /api/sandbox/token` (`mutagent-cli/src/lib/sandbox-token.ts:259-260`) and cached; a 401
431
+ drops the cached token and mints once more (`sandbox-api.ts:462-467`).
432
+ - **`mutagent agent …`** (the remote verbs) goes through the generated SDK client
433
+ `sdk.helixAgentDeployments` with the platform API key and an `x-workspace-id` header, and no
434
+ token exchange (`mutagent-cli/src/lib/agent/sdk.ts:61`, `:107-112`). The server mounts these
435
+ routes under `/api/helix-agent` (`mutagent/src/modules/helix-agent/deployment/module.ts:47`).
436
+
437
+ ### `mutagent helix` verbs
438
+
439
+ `<ref>` is a session reference (`hs1_…`). `SESSIONS` is `/api/sandbox/helix/sessions`
440
+ (`mutagent-cli/src/lib/helix-session-api.ts:40`).
441
+
442
+ | Verb | API call | CLI source |
443
+ |---|---|---|
444
+ | `helix [argv…]` (classic arm; `--prime` = prime arm) | `POST SESSIONS` (launch), then the attach loop below | `commands/helix/index.ts:65-79` → `commands/helix/run-cloud.ts:44-48` → `lib/helix-session-api.ts:117-118` |
445
+ | `helix … --sandbox <id>` (internal) | `POST /api/sandbox/:id/session`, then the attach loop | `commands/helix/run-cloud.ts:42-43` → `lib/sandbox-api.ts:741-749` |
446
+ | attach loop after a launch | `GET SESSIONS/<ref>/stream[?since=]`; stdin lines `POST SESSIONS/<ref>/input`; stdin EOF `POST SESSIONS/<ref>/close-input`; Ctrl-C `POST SESSIONS/<ref>/signal` `{signal: SIGINT}` | `commands/helix/run-cloud.ts:107-118`; `lib/helix-session-api.ts:121-144` |
447
+ | `helix --version`, `-v` | `GET /api/sandbox/presets` (the preset description, not a live probe) | `commands/helix/index.ts:67-69` → `commands/helix/doctor.ts:280-306` → `lib/sandbox-catalog.ts:34` |
448
+ | `helix agent <definition> …` | `POST SESSIONS` with `arm: agent` (or `POST /api/sandbox/:id/session` with `--sandbox`), then the attach loop | `commands/helix/agent.ts:114-140` → `commands/helix/run-cloud.ts:20-62` |
449
+ | `helix agent @slug[:vN\|:latest]` | `POST SESSIONS` with body `agent: {slug, revision?}`, `mode` when `-p` or `--rpc` is given, `args: ["-p", task]`; prints the receipt `{reference, sandboxId, agent, mode}` on stderr; then the attach loop | `commands/helix/agent.ts:99-111` → `commands/helix/managed-agent.ts:54-90` → `commands/helix/run-cloud.ts:76-105` |
450
+ | `helix session ls` | `GET SESSIONS[?limit=&cursor=]` | `commands/helix/session-commands.ts:280` → `lib/helix-session-api.ts:76-84` |
451
+ | `helix session ls <sandbox-id>` (internal) | `GET /api/sandbox/:id/sessions` | `commands/helix/session-commands.ts:261-262` → `lib/sandbox-api.ts:805-806` |
452
+ | `helix session attach <ref>` | `GET SESSIONS/<ref>/stream[?since=]` | `commands/helix/session-commands.ts:347-356` → `lib/helix-session-api.ts:140-144` |
453
+ | `helix session send <ref>` | `POST SESSIONS/<ref>/input` `{line}` | `commands/helix/send.ts:107` → `lib/helix-session-api.ts:121-125` |
454
+ | `helix session send <id> --session <sid>` (internal) | `POST /api/sandbox/:id/input` `{sessionId, line}` | `commands/helix/send.ts:125` → `lib/sandbox-api.ts:707-708` |
455
+ | `helix session signal <ref>` | `POST SESSIONS/<ref>/signal` `{signal}` (default `SIGINT`) | `commands/helix/signal.ts:100` → `lib/helix-session-api.ts:134-138` |
456
+ | `helix session signal <id> --session <sid>` (internal) | `POST /api/sandbox/:id/signal` `{sessionId, signal}` | `commands/helix/signal.ts:118` → `lib/sandbox-api.ts:726-727` |
457
+ | `helix session close-input <ref>` | `POST SESSIONS/<ref>/close-input` | `commands/helix/reference-commands.ts:91` → `lib/helix-session-api.ts:128-132` |
458
+ | `helix session checkpoint <ref>` | `POST SESSIONS/<ref>/checkpoint` | `commands/helix/session-commands.ts:398` → `lib/helix-session-api.ts:86-90` |
459
+ | `helix session checkpoint <id> --session <sid>` (internal) | `POST /api/sandbox/:id/checkpoint` | `commands/helix/session-commands.ts:407` → `lib/sandbox-checkpoints.ts:140-141` |
460
+ | `helix session checkpoints <ref>` | `GET SESSIONS/<ref>/checkpoints` | `commands/helix/reference-commands.ts:39` → `lib/helix-session-api.ts:93-95` |
461
+ | `helix session restore <ref>` | `POST SESSIONS/<ref>/restore` `{snapshotId?, onWorkspaceDrift?, partial?}`; retried when the answer is 409 `sandbox_stopping` | `commands/helix/restore-command.ts:85-95` → `lib/helix-session-api.ts:98-108`, `lib/sandbox-stopping-retry.ts:21-27` |
462
+ | `helix session start <sandbox-id>` (internal) | `POST /api/sandbox/:id/session` `{mode, args?, cwd?, environment?}` | `commands/helix/session-commands.ts:139-150` → `lib/sandbox-api.ts:741-749` |
463
+ | `helix models` | `GET /api/sandbox/helix/defaults` | `commands/helix/models.ts:85` → `lib/sandbox-api.ts:780-781` |
464
+ | `helix models default <ids…>`, `--clear` | `PUT /api/sandbox/helix/defaults` `{models}` (`--clear` sends `[]`) | `commands/helix/models.ts:138` → `lib/sandbox-api.ts:785-787` |
465
+ | `helix doctor`, `helix smoke` | `POST /api/sandbox/run` (fresh preset box, torn down after), or `POST /api/sandbox/:id/exec` with `--sandbox` | `commands/helix/doctor.ts:135`, `:179`, `:308-327` → `lib/sandbox-api.ts:692-693`, `:753-754` |
466
+ | `helix version` | `GET /api/sandbox/presets` | `commands/helix/doctor.ts:263-268`, `:301-302` → `lib/sandbox-catalog.ts:34` |
467
+ | `helix update` | `GET /api/sandbox/presets` to name the pinned version, then exit 2 | `commands/helix/doctor.ts:210-220` |
468
+
469
+ All source paths in this table are under `mutagent-cli/src/`.
470
+
471
+ ### `mutagent agent` verbs
472
+
473
+ | Verb | API call | CLI source |
474
+ |---|---|---|
475
+ | `agent check <agent.md>` | local, no API: compile and validate the folder | `commands/agent/index.ts:32-36` → `lib/agent/local.ts:44-47` |
476
+ | `agent pack <agent.md> --output <archive>` | local, no API: write the package archive | `commands/agent/index.ts:37-43` → `lib/agent/local.ts:48-60` |
477
+ | `agent run <agent.md> <task…>` | local, no API: runs the package with the local Helix binary; a slug argument is refused before any work | `commands/agent/index.ts:44-55` → `lib/agent/local.ts:61-75` |
478
+ | `agent deploy <agent.md> [--env] [--no-activate] [--idempotency-key]` | compiles locally, then `GET /api/helix-agent/capabilities`, then `POST /api/helix-agent/agents/{slug}/deployments` `{archiveBase64, archiveDigest, artifactDigest, archiveSize, environment?, activate, idempotencyKey}` | `commands/agent/index.ts:56-66` → `lib/agent/service.ts:15-18` → `lib/agent/remote.ts:35-74` → `lib/agent/sdk.ts:64-67`, `:81-87` |
479
+ | `agent activate <slug> --revision vN [--env] [--idempotency-key]` | `POST /api/helix-agent/agents/{slug}/activate` `{revision, environment?, idempotencyKey}` | `commands/agent/index.ts:67-78` → `lib/agent/remote.ts:105-118` → `lib/agent/sdk.ts:88-91` |
480
+ | `agent list [--limit] [--cursor] [--include-archived]` | `GET /api/helix-agent/agents` | `commands/agent/index.ts:79-88` → `lib/agent/remote.ts:76-92` → `lib/agent/sdk.ts:68-71` |
481
+ | `agent inspect <slug> [--env] [--limit] [--cursor]` | `GET /api/helix-agent/agents/{slug}` (revisions, slots, sessions; `--env` filters on the client) | `commands/agent/index.ts:89-102` → `lib/agent/remote.ts:94-103` → `lib/agent/sdk.ts:72-80` |
482
+ | `agent inspect --operation <id>` | `GET /api/helix-agent/operations/{operationId}` | `lib/agent/remote.ts:95` → `lib/agent/sdk.ts:93` |
483
+ | `agent retire <slug> [--env]` | `POST /api/helix-agent/agents/{slug}/retire` `{environment?}` | `commands/agent/index.ts:103-108` → `lib/agent/remote.ts:120-126` → `lib/agent/sdk.ts:92` |
484
+
485
+ All source paths in this table are under `mutagent-cli/src/`. The route paths are the generated SDK's
486
+ (`mutagent-sdk/src/funcs/helix-agent-deployments-*.ts`) and match the server routes in
487
+ `mutagent/src/modules/helix-agent/deployment/routes.ts:69-173`.
488
+
489
+ Running a deployed agent is not an `agent` verb: it is `mutagent helix agent @slug`, which uses the
490
+ same launch route as every cloud run (row above).
491
+
492
+ ---
493
+
369
494
  ## AI-First Usage
370
495
 
371
496
  Every command supports `--json` for machine-readable output with `_directive`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutagent/cli",
3
- "version": "0.1.341",
3
+ "version": "0.1.342",
4
4
  "description": "Bun-native CLI for the MutagenT AI platform - auth, provider config, and lifecycle-tool installer for AI-native workflows",
5
5
  "type": "module",
6
6
  "bin": {