@maiaos/cli 0.1.0-canary.6 → 0.1.0-canary.61

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 (266) hide show
  1. package/README.md +8 -7
  2. package/dist/agents/client.d.ts +47 -27
  3. package/dist/agents/client.js +10 -3
  4. package/dist/agents/commands.d.ts +1 -0
  5. package/dist/agents/commands.js +24 -2
  6. package/dist/agents/index.d.ts +1 -1
  7. package/dist/agents/index.js +1 -1
  8. package/dist/agents/input.js +6 -0
  9. package/dist/agents/output/format.js +11 -0
  10. package/dist/agents/tree/tree.js +13 -1
  11. package/dist/bin/maia.cdx.json +19 -19
  12. package/dist/bin/maia.mjs +1 -1
  13. package/dist/cli/cli.d.ts +8 -2
  14. package/dist/cli/cli.js +29 -6
  15. package/dist/cli/index.d.ts +1 -1
  16. package/dist/cli/index.js +1 -1
  17. package/dist/command-line/context.d.ts +4 -2
  18. package/dist/command-line/emit/index.d.ts +4 -0
  19. package/dist/command-line/emit/index.js +4 -0
  20. package/dist/command-line/{output.d.ts → emit/output.d.ts} +2 -2
  21. package/dist/command-line/{rows.d.ts → emit/rows.d.ts} +2 -0
  22. package/dist/command-line/{rows.js → emit/rows.js} +8 -0
  23. package/dist/command-line/index.d.ts +5 -5
  24. package/dist/command-line/index.js +5 -5
  25. package/dist/command-line/input/arguments.d.ts +10 -0
  26. package/dist/command-line/input/arguments.js +30 -10
  27. package/dist/command-line/input/index.d.ts +2 -1
  28. package/dist/command-line/input/index.js +2 -1
  29. package/dist/command-line/input/manager-options.d.ts +10 -0
  30. package/dist/command-line/input/manager-options.js +38 -0
  31. package/dist/command-line/two-phase/index.d.ts +2 -0
  32. package/dist/command-line/two-phase/index.js +2 -0
  33. package/dist/command-line/{two-phase.d.ts → two-phase/two-phase.d.ts} +12 -12
  34. package/dist/command-line/{two-phase.js → two-phase/two-phase.js} +2 -2
  35. package/dist/command-receipt/command.js +1 -1
  36. package/dist/command-tree/tree.d.ts +1 -1
  37. package/dist/command-tree/tree.js +6 -1
  38. package/dist/connection/input.js +2 -2
  39. package/dist/connection/system.js +3 -2
  40. package/dist/connection/tree/tree.js +5 -5
  41. package/dist/events/commands.js +65 -0
  42. package/dist/events/index.js +2 -0
  43. package/dist/events/tree/index.js +2 -0
  44. package/dist/events/tree/tree.js +17 -0
  45. package/dist/import/batch.js +196 -0
  46. package/dist/import/client.d.ts +3 -3
  47. package/dist/import/client.js +1 -1
  48. package/dist/import/commands.d.ts +1 -0
  49. package/dist/import/commands.js +82 -8
  50. package/dist/import/index.d.ts +1 -1
  51. package/dist/import/index.js +1 -1
  52. package/dist/import/input.js +38 -3
  53. package/dist/import/manifest.js +107 -0
  54. package/dist/import/output.js +46 -2
  55. package/dist/local-node/client.d.ts +1 -0
  56. package/dist/local-node/client.js +1 -0
  57. package/dist/local-node/index.d.ts +2 -1
  58. package/dist/local-node/index.js +2 -1
  59. package/dist/local-node/wait.d.ts +10 -0
  60. package/dist/local-node/wait.js +17 -0
  61. package/dist/login/gateway.js +2 -2
  62. package/dist/login/vendor-input.js +2 -2
  63. package/dist/mcp/calls.js +6 -1
  64. package/dist/mcp/routing.js +1 -0
  65. package/dist/project-guard/client.d.ts +12 -0
  66. package/dist/project-guard/input.js +15 -1
  67. package/dist/project-guard/output/format.js +5 -0
  68. package/dist/project-workspace/tree/tree.js +1 -1
  69. package/dist/reference/resolve.js +9 -2
  70. package/dist/remote-node/connector.js +8 -1
  71. package/dist/run-ledger/client.d.ts +2 -0
  72. package/dist/session/agent-permission.d.ts +2 -2
  73. package/dist/session/approval/client.d.ts +5 -2
  74. package/dist/session/approval/client.js +2 -2
  75. package/dist/session/approval/commands.d.ts +1 -0
  76. package/dist/session/approval/commands.js +97 -17
  77. package/dist/session/approval/index.d.ts +1 -1
  78. package/dist/session/approval/index.js +1 -1
  79. package/dist/session/client.d.ts +14 -3
  80. package/dist/session/client.js +17 -2
  81. package/dist/session/coding-client.d.ts +2 -0
  82. package/dist/session/coding-client.js +1 -2
  83. package/dist/session/coding-commands.js +24 -7
  84. package/dist/session/commands.d.ts +1 -0
  85. package/dist/session/commands.js +131 -18
  86. package/dist/session/create-tasks.js +10 -2
  87. package/dist/session/index.d.ts +1 -1
  88. package/dist/session/index.js +1 -1
  89. package/dist/session/output/human.js +32 -5
  90. package/dist/session/output/index.js +1 -1
  91. package/dist/session/output/tasks.js +51 -7
  92. package/dist/session/tree/tree.js +52 -19
  93. package/dist/session/turn/client.js +7 -9
  94. package/dist/session/turn/commands.js +67 -20
  95. package/dist/session/turn/output.d.ts +6 -0
  96. package/dist/session/turn/output.js +12 -2
  97. package/dist/status/client.d.ts +14 -3
  98. package/dist/status/command.js +3 -1
  99. package/dist/status/doctor.d.ts +5 -1
  100. package/dist/status/doctor.js +10 -4
  101. package/dist/status/output/compact.d.ts +3 -0
  102. package/dist/status/output/compact.js +17 -7
  103. package/dist/status/output/human.js +15 -0
  104. package/dist/terminal/control-commands.js +26 -9
  105. package/dist/terminal/keys.js +62 -0
  106. package/dist/terminal/output/compact-list.js +3 -0
  107. package/dist/terminal/output/human.js +2 -2
  108. package/dist/terminal/tree/tree.js +1 -1
  109. package/dist/webhooks/client.d.ts +156 -0
  110. package/dist/webhooks/client.js +8 -0
  111. package/dist/webhooks/commands.d.ts +17 -0
  112. package/dist/webhooks/commands.js +76 -0
  113. package/dist/webhooks/index.d.ts +3 -0
  114. package/dist/webhooks/index.js +3 -0
  115. package/dist/webhooks/input.js +125 -0
  116. package/dist/webhooks/output/format.js +75 -0
  117. package/dist/webhooks/output/index.js +2 -0
  118. package/dist/webhooks/tree/index.js +2 -0
  119. package/dist/webhooks/tree/tree.js +49 -0
  120. package/guidance/maia-cli/SKILL.md +1 -1
  121. package/guidance/maia-node/SKILL.md +54 -0
  122. package/guidance/maia-orchestration/SKILL.md +1 -2
  123. package/guidance/maia-sessions/SKILL.md +69 -0
  124. package/package.json +5 -5
  125. package/dist/address-space/address-space.d.ts +0 -38
  126. package/dist/address-space/index.d.ts +0 -2
  127. package/dist/agents/input.d.ts +0 -130
  128. package/dist/agents/output/format.d.ts +0 -8
  129. package/dist/agents/output/index.d.ts +0 -2
  130. package/dist/agents/tree/index.d.ts +0 -2
  131. package/dist/agents/tree/tree.d.ts +0 -3
  132. package/dist/bootstrap/exit.d.ts +0 -14
  133. package/dist/bootstrap/exit.js +0 -42
  134. package/dist/bootstrap/index.d.ts +0 -3
  135. package/dist/bootstrap/index.js +0 -3
  136. package/dist/bootstrap/process.d.ts +0 -5
  137. package/dist/bootstrap/process.js +0 -23
  138. package/dist/bootstrap/run.d.ts +0 -25
  139. package/dist/bootstrap/run.js +0 -95
  140. package/dist/bootstrap/stdio.d.ts +0 -4
  141. package/dist/bootstrap/stdio.js +0 -9
  142. package/dist/cli/environment.d.ts +0 -8
  143. package/dist/cli/services.d.ts +0 -4
  144. package/dist/command-line/input/stdin-stream.d.ts +0 -4
  145. package/dist/command-line/json-decoder.d.ts +0 -3
  146. package/dist/command-receipt/command.d.ts +0 -4
  147. package/dist/command-receipt/compact-list.d.ts +0 -20
  148. package/dist/command-receipt/index.d.ts +0 -3
  149. package/dist/command-tree/completion.d.ts +0 -6
  150. package/dist/command-tree/local.d.ts +0 -3
  151. package/dist/command-tree/row.js +0 -2
  152. package/dist/connection/access/format.d.ts +0 -8
  153. package/dist/connection/access/input.d.ts +0 -53
  154. package/dist/connection/input.d.ts +0 -50
  155. package/dist/connection/signin.d.ts +0 -4
  156. package/dist/connection/tree/index.d.ts +0 -2
  157. package/dist/connection/tree/tree.d.ts +0 -3
  158. package/dist/container/output/format.d.ts +0 -11
  159. package/dist/container/output/index.d.ts +0 -2
  160. package/dist/context/client.d.ts +0 -7
  161. package/dist/context/commands.d.ts +0 -3
  162. package/dist/context/index.d.ts +0 -3
  163. package/dist/dashboard/cockpit-client.d.ts +0 -6
  164. package/dist/dashboard/cockpit-client.js +0 -27
  165. package/dist/dashboard/cockpits.d.ts +0 -29
  166. package/dist/dashboard/cockpits.js +0 -65
  167. package/dist/dashboard/dashboard.d.ts +0 -7
  168. package/dist/dashboard/draw.d.ts +0 -15
  169. package/dist/dashboard/frame.d.ts +0 -4
  170. package/dist/dashboard/index.d.ts +0 -2
  171. package/dist/dashboard/modes.d.ts +0 -5
  172. package/dist/dashboard/node-connection.d.ts +0 -15
  173. package/dist/dashboard/node-connection.js +0 -51
  174. package/dist/dashboard/pi-tui.d.ts +0 -6
  175. package/dist/dashboard/status-bar.d.ts +0 -4
  176. package/dist/dashboard/terminal.d.ts +0 -53
  177. package/dist/dashboard/tree-model.d.ts +0 -28
  178. package/dist/dashboard/tree.d.ts +0 -10
  179. package/dist/development/cli.d.ts +0 -3
  180. package/dist/development/cli.js +0 -44
  181. package/dist/execution/tree/index.d.ts +0 -2
  182. package/dist/execution/tree/tree.d.ts +0 -3
  183. package/dist/hold/output/format.d.ts +0 -11
  184. package/dist/hold/output/index.d.ts +0 -2
  185. package/dist/hold/tree/index.d.ts +0 -2
  186. package/dist/hold/tree/tree.d.ts +0 -3
  187. package/dist/import/input.d.ts +0 -16
  188. package/dist/import/output.d.ts +0 -6
  189. package/dist/integration/output.d.ts +0 -22
  190. package/dist/login/failure.d.ts +0 -3
  191. package/dist/login/gateway.d.ts +0 -12
  192. package/dist/login/menu.d.ts +0 -4
  193. package/dist/login/output/format.d.ts +0 -16
  194. package/dist/login/output/index.d.ts +0 -2
  195. package/dist/login/vendor-account.d.ts +0 -95
  196. package/dist/login/vendor-input.d.ts +0 -14
  197. package/dist/mcp/calls.d.ts +0 -8
  198. package/dist/orchestration/output/compact-aggregate.d.ts +0 -121
  199. package/dist/orchestration/output/compact-run-list.d.ts +0 -20
  200. package/dist/orchestration/output/human.d.ts +0 -80
  201. package/dist/orchestration/output/index.d.ts +0 -4
  202. package/dist/orchestration/tree/index.d.ts +0 -2
  203. package/dist/orchestration/tree/tree.d.ts +0 -3
  204. package/dist/port-lease/input.d.ts +0 -65
  205. package/dist/port-lease/output/format.d.ts +0 -11
  206. package/dist/port-lease/output/index.d.ts +0 -2
  207. package/dist/presentation/output/format.d.ts +0 -11
  208. package/dist/presentation/output/index.d.ts +0 -3
  209. package/dist/project-guard/input.d.ts +0 -18
  210. package/dist/project-guard/output/format.d.ts +0 -11
  211. package/dist/project-guard/output/index.d.ts +0 -2
  212. package/dist/project-workspace/output/human.d.ts +0 -139
  213. package/dist/project-workspace/output/index.d.ts +0 -3
  214. package/dist/project-workspace/output/metadata.d.ts +0 -11
  215. package/dist/project-workspace/tree/index.d.ts +0 -2
  216. package/dist/project-workspace/tree/tree.d.ts +0 -3
  217. package/dist/provider/client.d.ts +0 -6
  218. package/dist/provider/commands.d.ts +0 -3
  219. package/dist/provider/index.d.ts +0 -3
  220. package/dist/reference/commands.d.ts +0 -3
  221. package/dist/reference/index.d.ts +0 -3
  222. package/dist/reference/resolve.d.ts +0 -31
  223. package/dist/reference/tree/index.d.ts +0 -2
  224. package/dist/reference/tree/tree.d.ts +0 -3
  225. package/dist/remote-node/reachability.d.ts +0 -64
  226. package/dist/remote-node/text.d.ts +0 -10
  227. package/dist/remote-node/tree/index.d.ts +0 -2
  228. package/dist/remote-node/tree/tree.d.ts +0 -3
  229. package/dist/routine/input.d.ts +0 -28
  230. package/dist/routine/output/format.d.ts +0 -23
  231. package/dist/routine/output/index.d.ts +0 -2
  232. package/dist/routine/tree/index.d.ts +0 -2
  233. package/dist/routine/tree/tree.d.ts +0 -3
  234. package/dist/run-ledger/input.d.ts +0 -42
  235. package/dist/run-ledger/output/format.d.ts +0 -11
  236. package/dist/run-ledger/output/index.d.ts +0 -2
  237. package/dist/session/approval/output/format.d.ts +0 -23
  238. package/dist/session/approval/output/index.d.ts +0 -2
  239. package/dist/session/attach-render.d.ts +0 -16
  240. package/dist/session/create-tasks.d.ts +0 -20
  241. package/dist/session/interaction/input.d.ts +0 -15
  242. package/dist/session/interaction/output/format.d.ts +0 -11
  243. package/dist/session/interaction/output/index.d.ts +0 -2
  244. package/dist/session/output/diff.d.ts +0 -3
  245. package/dist/session/output/failure.d.ts +0 -11
  246. package/dist/session/output/human.d.ts +0 -112
  247. package/dist/session/output/index.d.ts +0 -6
  248. package/dist/session/output/observe.d.ts +0 -4
  249. package/dist/session/output/tasks.d.ts +0 -34
  250. package/dist/session/task-file.d.ts +0 -5
  251. package/dist/session/tree/index.d.ts +0 -2
  252. package/dist/session/tree/tree.d.ts +0 -3
  253. package/dist/team-workspace/ceremony.d.ts +0 -19
  254. package/dist/team-workspace/confirmation.d.ts +0 -4
  255. package/dist/team-workspace/dependencies.js +0 -2
  256. package/dist/team-workspace/output.d.ts +0 -15
  257. package/dist/terminal/arguments.d.ts +0 -13
  258. package/dist/terminal/output/compact-list.d.ts +0 -148
  259. package/dist/terminal/output/human.d.ts +0 -42
  260. package/dist/terminal/output/index.d.ts +0 -3
  261. package/dist/terminal/tree/index.d.ts +0 -2
  262. package/dist/terminal/tree/tree.d.ts +0 -3
  263. /package/dist/command-line/{json-decoder.js → emit/json-decoder.js} +0 -0
  264. /package/dist/command-line/{json.d.ts → emit/json.d.ts} +0 -0
  265. /package/dist/command-line/{json.js → emit/json.js} +0 -0
  266. /package/dist/command-line/{output.js → emit/output.js} +0 -0
@@ -0,0 +1,49 @@
1
+ const webhooks = () => import("../index.js");
2
+ export const WEBHOOKS_TREE = {
3
+ groups: [["webhooks", "Signed outbound webhooks for Node events."]],
4
+ leaves: [
5
+ [
6
+ "webhooks list [--limit <1..100>] [--after <cursor>]",
7
+ 1,
8
+ "webhooks.list",
9
+ "List webhooks.",
10
+ { run: [webhooks, "runWebhooksList"] },
11
+ ],
12
+ [
13
+ "webhooks deliveries [--webhook <webhook-id>] [--failed] [--limit <1..100>] [--after <cursor>]",
14
+ 1,
15
+ "webhooks.deliveries",
16
+ "List webhook deliveries; --failed lists parked and denied ones.",
17
+ { run: [webhooks, "runWebhooksDeliveries"] },
18
+ ],
19
+ [
20
+ "webhooks add (--url <http-url> --secret-env <VARIABLE> --event <kind>... [--label <key=value>...] [--project <project-id>] [--node-id <node-id>] [--allow-private] [--command-id <id>] [--dry-run] | --confirm-stdin)",
21
+ 1,
22
+ ["webhooks.change.preview", "webhooks.change.confirm"],
23
+ "Add a webhook after a preview.",
24
+ { kind: "two-phase", run: [webhooks, "runWebhooksAdd"] },
25
+ ],
26
+ [
27
+ "webhooks test (<webhook-id> --expected-revision <revision> [--command-id <id>] [--dry-run] | --confirm-stdin)",
28
+ 1,
29
+ ["webhooks.change.preview", "webhooks.change.confirm"],
30
+ "Send a test event to a webhook after a preview.",
31
+ { kind: "two-phase", run: [webhooks, "runWebhooksTest"] },
32
+ ],
33
+ [
34
+ "webhooks remove (<webhook-id> --expected-revision <revision> [--command-id <id>] [--dry-run] | --confirm-stdin)",
35
+ 1,
36
+ ["webhooks.change.preview", "webhooks.change.confirm"],
37
+ "Remove a webhook and its deliveries after a preview.",
38
+ { kind: "two-phase", run: [webhooks, "runWebhooksRemove"] },
39
+ ],
40
+ [
41
+ "webhooks redeliver (<delivery-id> --expected-revision <revision> [--command-id <id>] [--dry-run] | --confirm-stdin)",
42
+ 1,
43
+ ["webhooks.change.preview", "webhooks.change.confirm"],
44
+ "Send a delivery again after a preview.",
45
+ { kind: "two-phase", run: [webhooks, "runWebhooksRedeliver"] },
46
+ ],
47
+ ],
48
+ };
49
+ //# sourceMappingURL=tree.js.map
@@ -11,7 +11,7 @@ description: >
11
11
  ## Goal
12
12
 
13
13
  Use the installed `maia` binary as the public client. Treat `maia help --json`
14
- and `maia help <family> --json` as the command allowlist.
14
+ and `maia help session --json` (or any other family) as the command allowlist.
15
15
 
16
16
  ## Main rules
17
17
 
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: maia-node
3
+ description: >
4
+ Check a Maia Node's health and reach local or remote Nodes with --node and
5
+ --profile through the public CLI. Use when an agent must find which Node a
6
+ command ran on, see whether a Node is ready, or register another Node.
7
+ ---
8
+
9
+ # Maia Node
10
+
11
+ A Node is the one place Maia keeps state and runs work. The CLI is a client of
12
+ it. Confirm each command on `maia help node --json` before use.
13
+
14
+ ## Rules
15
+
16
+ 1. Pass `--json` and read results from stdout and errors from stderr.
17
+ 2. `--node <name>` sends a Node-backed command to a registered remote Node.
18
+ `--node local` names this machine. `--profile <name>` picks a local profile.
19
+ A flag beats `MAIA_NODE` and `MAIA_PROFILE`, which beat the default.
20
+ 3. A command that manages this machine's Nodes, such as `maia node list`,
21
+ refuses `--node`.
22
+ 4. An id belongs to one Node. A missing id (`resource_not_found`, exit 66) on
23
+ the selected Node does not prove it is absent everywhere; check the Node
24
+ selection and retry with the `--node` that holds it.
25
+ 5. Exit code 69 means the Node is unavailable. Report it; do not start a Node
26
+ unless the caller asked for it.
27
+
28
+ ## Implemented
29
+
30
+ ```sh
31
+ maia --json status
32
+ maia --json node status
33
+ maia --json --node local node status
34
+ ```
35
+
36
+ `node monitor` prints a one-time loopback URL for the admin monitor.
37
+
38
+ ## Source candidates (release-disabled)
39
+
40
+ ```sh
41
+ maia --json node list
42
+ maia --json node register <host> --name <name> --dry-run
43
+ maia --json node remove <node> --dry-run
44
+ ```
45
+
46
+ `node register`, `node install` and `node remove` preview with `--dry-run`.
47
+ Confirm the preview only on the caller's request, from stdin with
48
+ `--confirm-stdin`.
49
+
50
+ ## Do not
51
+
52
+ - Do not copy a Node's credentials or tokens into a prompt, a file or a log.
53
+ - Do not expose a Node beyond loopback or its tailnet.
54
+ - Do not remove a Node with `--purge` unless the caller named that.
@@ -5,7 +5,7 @@ description: >
5
5
  public CLI: create, list, show, task list and show, inbox check and ack,
6
6
  questions, and dispatch show or settle-terminal. Use when an external agent
7
7
  is the explicit Run coordinator. Do not treat these commands as
8
- release-enabled, worker assignment, or Orca equivalence.
8
+ release-enabled or worker assignment.
9
9
  ---
10
10
 
11
11
  # Maia orchestration
@@ -51,4 +51,3 @@ caller-selected outcome. `settle-terminal` only records the Terminal's exact
51
51
  unavailable failure. Do not teach Skill install/sync or extra runtime probes.
52
52
 
53
53
  A compact CLI projection is not a protocol change. The SDK remains lossless.
54
- No Orca command is equivalent.
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: maia-sessions
3
+ description: >
4
+ Create, list, inspect and follow Maia Sessions through the public CLI, on
5
+ this machine or on a named Node with --node. Use when an agent needs to start
6
+ or watch coding work, read a Session's state, or recover after a retry.
7
+ ---
8
+
9
+ # Maia Sessions
10
+
11
+ A Session is one unit of coding work on a Maia Node. Maia Node owns its state;
12
+ the CLI only reads and requests changes. Confirm each command on
13
+ `maia help session --json` before use.
14
+
15
+ ## Rules
16
+
17
+ 1. Pass `--json`. A result, or a merged list with `ok: false`, is on stdout:
18
+ check `ok`, `error` and each `result.result.nodes[].error` before calling a
19
+ list complete. A plain refusal is JSON on stderr with empty stdout.
20
+ 2. Use exact ids. Never infer a Project, Workspace or Session from the working
21
+ folder or a previous answer.
22
+ 3. Add `--node <name>` to reach a remote Node. `--node local` names this
23
+ machine. See the maia-node Skill.
24
+ 4. A mutation names itself with `--command-id <id>`. After exit code 76
25
+ (outcome unknown), run `maia receipt show <command-id>` before any retry,
26
+ and retry with the same id.
27
+ 5. A change to an existing Session carries its current
28
+ `--expected-revision <revision>`. Exit code 75 also covers a full or held
29
+ Node and guard limits, so read `error.code` first. For `revision_conflict`
30
+ or `storage_conflict`, read the Session again and retry at its current
31
+ revision only if it is idle and the change still applies; else observe or
32
+ report. For `saturated`, `held` or `guard_*`, wait or report; never raise a
33
+ guard.
34
+
35
+ ## Implemented
36
+
37
+ ```sh
38
+ maia --json session list --project <project-id>
39
+ maia --json session show <session-id>
40
+ maia --json session create --workspace <workspace-id>
41
+ maia --json session events list --session <session-id>
42
+ maia --json session observe <session-id>
43
+ ```
44
+
45
+ `session list --all` lists Sessions of every Project. Without `--node` it also
46
+ merges the registered remote Nodes, and each row names its Node. A page cursor
47
+ (`--after`) pages one Node, so pass `--node <name>` with it. `--attention`
48
+ filters to Sessions that need attention.
49
+
50
+ ## Source candidates (release-disabled)
51
+
52
+ These work from a source build only. Use them when the caller accepts that.
53
+
54
+ ```sh
55
+ maia --json session start <session-id> --expected-revision <revision> --wait
56
+ maia --json session wait <session-id> --until running --timeout 5m
57
+ maia --json session turn queue <session-id>
58
+ maia --json session approval list --session <session-id>
59
+ ```
60
+
61
+ Send prompt text on stdin with `--prompt-stdin`, never on the command line.
62
+ Exit code 74 means a wait reached its deadline.
63
+
64
+ ## Do not
65
+
66
+ - `session observe` is one snapshot and exits 0. To watch a Session, re-run it
67
+ at a sensible pace; `session wait` is release-disabled.
68
+ - Do not read a worker's files or terminal to learn its state; read the Session.
69
+ - Do not delete or retire a Session unless the caller asked for it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiaos/cli",
3
- "version": "0.1.0-canary.6",
3
+ "version": "0.1.0-canary.61",
4
4
  "description": "The maia CLI and MCP server: start, drive, observe and stop swarms of Claude Code and Codex agents from a terminal, a script or another agent.",
5
5
  "keywords": [
6
6
  "maia",
@@ -64,13 +64,13 @@
64
64
  "dependencies": {
65
65
  "@earendil-works/pi-tui": "1.0.0",
66
66
  "@effect/platform-node-shared": "4.0.0",
67
- "@maiaos/agent": "0.1.0-canary.6",
68
- "@maiaos/client-core": "0.1.0-canary.6",
69
- "@maiaos/sdk": "0.1.0-canary.6",
67
+ "@maiaos/agent": "0.1.0-canary.61",
68
+ "@maiaos/client-core": "0.1.0-canary.61",
69
+ "@maiaos/sdk": "0.1.0-canary.61",
70
70
  "effect": "4.0.0"
71
71
  },
72
72
  "scripts": {
73
- "build": "node -e \"require('node:fs').rmSync('dist',{force:true,recursive:true})\" && tsc --project tsconfig.build.json && node scripts/build-executable.mjs",
73
+ "build": "node -e \"require('node:fs').rmSync('dist',{force:true,recursive:true})\" && tsc --project tsconfig.build.json && node scripts/build-executable.mjs && node scripts/prune-library.mjs",
74
74
  "lint": "eslint src scripts --max-warnings 0 --cache --cache-location node_modules/.cache/eslint/ --cache-strategy content",
75
75
  "test": "node -e \"require('node:fs').rmSync('.test-dist',{force:true,recursive:true})\" && tsc --project tsconfig.test.json && node --import ../../scripts/lib/test-environment.mjs --test --test-concurrency=2 --enable-source-maps \".test-dist/**/*.test.js\"",
76
76
  "typecheck": "tsc --project tsconfig.json --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/typecheck.tsbuildinfo && tsc --project scripts/tsconfig.json --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/scripts.tsbuildinfo"
@@ -1,38 +0,0 @@
1
- import type { RouteKind } from "@maiaos/client-core/cockpit";
2
- import { type CliCommandOutput, type CliDependencies, type CliTable, type CommandContext, type CommandEffect } from "../command-line/index.js";
3
- import { type LeafRoute } from "../command-tree/index.js";
4
- import { type HeldId, type ListedNode, type NodeAnswer } from "../fleet/index.js";
5
- import type { CliNodeEffect, CliNodeResult } from "../local-node/index.js";
6
- export declare const onHolder: (context: CommandContext, held: HeldId, run: (bound: CommandContext) => CommandEffect) => CommandEffect;
7
- type InputRoute = {
8
- readonly idOf: (input: object) => unknown;
9
- readonly kind: RouteKind;
10
- };
11
- export declare const onInputHolder: (context: CommandContext, { idOf, kind }: InputRoute, run: (bound: CommandContext) => CommandEffect) => CommandEffect;
12
- export type RoutedLeaf = {
13
- readonly argument: LeafRoute;
14
- readonly tokens: readonly string[];
15
- readonly usage: string;
16
- };
17
- export declare const routeLeaf: (context: CommandContext, { argument, tokens, usage }: RoutedLeaf, run: (bound: CommandContext) => CommandEffect) => CommandEffect;
18
- export declare const nodeLines: (nodes: readonly ListedNode[]) => string;
19
- export declare const formatMerged: <TItem extends {
20
- readonly node: string;
21
- }>({ items, nodes, }: {
22
- readonly items: readonly TItem[];
23
- readonly nodes: readonly ListedNode[];
24
- }, row: (item: TItem) => string, { empty, headers }: CliTable) => string;
25
- export declare const writeMerged: <TResult extends CliCommandOutput & {
26
- readonly result: {
27
- readonly nodes: readonly ListedNode[];
28
- };
29
- }>(context: CommandContext, output: TResult, text: (output: TResult) => string) => number;
30
- type ListSpec<TList> = {
31
- readonly merged: (answers: readonly NodeAnswer<TList>[]) => number;
32
- readonly paged: boolean;
33
- readonly read: (dependencies: CliDependencies) => CliNodeEffect<TList>;
34
- readonly sole: (result: CliNodeResult<TList>) => number;
35
- };
36
- export declare const listEach: <TList>(context: CommandContext, { merged, paged, read, sole }: ListSpec<TList>) => CommandEffect;
37
- export {};
38
- //# sourceMappingURL=address-space.d.ts.map
@@ -1,2 +0,0 @@
1
- export { formatMerged, listEach, nodeLines, onHolder, onInputHolder, type RoutedLeaf, routeLeaf, writeMerged, } from "./address-space.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,130 +0,0 @@
1
- import { type AgentsListParameters, type AgentsShowParameters } from "@maiaos/sdk";
2
- import * as Effect from "effect/Effect";
3
- import { type ParsedOptions } from "../command-line/index.js";
4
- export declare const AGENT_OPTIONS: {
5
- readonly create: Set<string>;
6
- readonly disable: Set<string>;
7
- readonly list: Set<string>;
8
- readonly revise: Set<string>;
9
- readonly show: Set<string>;
10
- };
11
- export declare const readAgentsList: (tokens: readonly string[]) => AgentsListParameters;
12
- export declare const readAgentsShow: (tokens: readonly string[]) => AgentsShowParameters;
13
- export declare const readCreateChange: (parsed: ParsedOptions) => Effect.Effect<{
14
- change: {
15
- readonly kind: "create";
16
- readonly projectId: string;
17
- readonly spec: {
18
- readonly accountableActorId: string;
19
- readonly connectionId?: string | undefined;
20
- readonly effort?: "high" | "low" | "max" | "medium" | "ultra" | "xhigh" | undefined;
21
- readonly harness: "claude-code" | "codex-cli" | "maia-agent" | "pi";
22
- readonly homeSessionId?: string | undefined;
23
- readonly instruction: string;
24
- readonly managerAgentId?: string | undefined;
25
- readonly model?: string | undefined;
26
- readonly name: string;
27
- readonly placement: "local";
28
- };
29
- } | {
30
- readonly agentId: string;
31
- readonly expectedRevision: string;
32
- readonly kind: "revise";
33
- readonly spec: {
34
- readonly accountableActorId: string;
35
- readonly connectionId?: string | undefined;
36
- readonly effort?: "high" | "low" | "max" | "medium" | "ultra" | "xhigh" | undefined;
37
- readonly harness: "claude-code" | "codex-cli" | "maia-agent" | "pi";
38
- readonly homeSessionId?: string | undefined;
39
- readonly instruction: string;
40
- readonly managerAgentId?: string | undefined;
41
- readonly model?: string | undefined;
42
- readonly name: string;
43
- readonly placement: "local";
44
- };
45
- } | {
46
- readonly agentId: string;
47
- readonly expectedRevision: string;
48
- readonly kind: "disable";
49
- };
50
- commandId: string;
51
- }, never, import("effect/Crypto").Crypto>;
52
- export declare const readReviseChange: (parsed: ParsedOptions) => Effect.Effect<{
53
- change: {
54
- readonly kind: "create";
55
- readonly projectId: string;
56
- readonly spec: {
57
- readonly accountableActorId: string;
58
- readonly connectionId?: string | undefined;
59
- readonly effort?: "high" | "low" | "max" | "medium" | "ultra" | "xhigh" | undefined;
60
- readonly harness: "claude-code" | "codex-cli" | "maia-agent" | "pi";
61
- readonly homeSessionId?: string | undefined;
62
- readonly instruction: string;
63
- readonly managerAgentId?: string | undefined;
64
- readonly model?: string | undefined;
65
- readonly name: string;
66
- readonly placement: "local";
67
- };
68
- } | {
69
- readonly agentId: string;
70
- readonly expectedRevision: string;
71
- readonly kind: "revise";
72
- readonly spec: {
73
- readonly accountableActorId: string;
74
- readonly connectionId?: string | undefined;
75
- readonly effort?: "high" | "low" | "max" | "medium" | "ultra" | "xhigh" | undefined;
76
- readonly harness: "claude-code" | "codex-cli" | "maia-agent" | "pi";
77
- readonly homeSessionId?: string | undefined;
78
- readonly instruction: string;
79
- readonly managerAgentId?: string | undefined;
80
- readonly model?: string | undefined;
81
- readonly name: string;
82
- readonly placement: "local";
83
- };
84
- } | {
85
- readonly agentId: string;
86
- readonly expectedRevision: string;
87
- readonly kind: "disable";
88
- };
89
- commandId: string;
90
- }, never, import("effect/Crypto").Crypto>;
91
- export declare const readDisableChange: (parsed: ParsedOptions) => Effect.Effect<{
92
- change: {
93
- readonly kind: "create";
94
- readonly projectId: string;
95
- readonly spec: {
96
- readonly accountableActorId: string;
97
- readonly connectionId?: string | undefined;
98
- readonly effort?: "high" | "low" | "max" | "medium" | "ultra" | "xhigh" | undefined;
99
- readonly harness: "claude-code" | "codex-cli" | "maia-agent" | "pi";
100
- readonly homeSessionId?: string | undefined;
101
- readonly instruction: string;
102
- readonly managerAgentId?: string | undefined;
103
- readonly model?: string | undefined;
104
- readonly name: string;
105
- readonly placement: "local";
106
- };
107
- } | {
108
- readonly agentId: string;
109
- readonly expectedRevision: string;
110
- readonly kind: "revise";
111
- readonly spec: {
112
- readonly accountableActorId: string;
113
- readonly connectionId?: string | undefined;
114
- readonly effort?: "high" | "low" | "max" | "medium" | "ultra" | "xhigh" | undefined;
115
- readonly harness: "claude-code" | "codex-cli" | "maia-agent" | "pi";
116
- readonly homeSessionId?: string | undefined;
117
- readonly instruction: string;
118
- readonly managerAgentId?: string | undefined;
119
- readonly model?: string | undefined;
120
- readonly name: string;
121
- readonly placement: "local";
122
- };
123
- } | {
124
- readonly agentId: string;
125
- readonly expectedRevision: string;
126
- readonly kind: "disable";
127
- };
128
- commandId: string;
129
- }, never, import("effect/Crypto").Crypto>;
130
- //# sourceMappingURL=input.d.ts.map
@@ -1,8 +0,0 @@
1
- import type { AgentsChangeConfirmResult, AgentsChangePreviewResult, AgentsListResult, AgentsShowResult } from "@maiaos/sdk";
2
- export type AgentsResult = AgentsChangeConfirmResult | AgentsChangePreviewResult | AgentsListResult | AgentsShowResult;
3
- export type CliAgentsResult = {
4
- readonly command: AgentsResult["method"];
5
- readonly result: AgentsResult;
6
- };
7
- export declare const formatAgentsResult: ({ result }: CliAgentsResult) => string;
8
- //# sourceMappingURL=format.d.ts.map
@@ -1,2 +0,0 @@
1
- export { type AgentsResult, type CliAgentsResult, formatAgentsResult, } from "./format.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +0,0 @@
1
- export { AGENTS_TREE } from "./tree.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +0,0 @@
1
- import type { TreeFragment } from "../../command-tree/index.js";
2
- export declare const AGENTS_TREE: TreeFragment;
3
- //# sourceMappingURL=tree.d.ts.map
@@ -1,14 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- type Output = {
3
- readonly on: (event: "close" | "error", listener: () => void) => unknown;
4
- readonly writableLength: number;
5
- readonly write: (chunk: string, callback?: () => void) => unknown;
6
- };
7
- type ExitingProcess = {
8
- readonly exit: (code: number) => void;
9
- readonly stderr: Output;
10
- readonly stdout: Output;
11
- };
12
- export declare const exitAfterOutput: (program: Effect.Effect<number>, host: ExitingProcess) => Effect.Effect<void>;
13
- export {};
14
- //# sourceMappingURL=exit.d.ts.map
@@ -1,42 +0,0 @@
1
- import * as Cause from "effect/Cause";
2
- import * as Deferred from "effect/Deferred";
3
- import * as Effect from "effect/Effect";
4
- import * as Exit from "effect/Exit";
5
- import * as Fiber from "effect/Fiber";
6
- const EXIT_INTERRUPTED = 130;
7
- const watch = (output) => Effect.gen(function* () {
8
- const ended = yield* Deferred.make();
9
- const end = () => {
10
- Deferred.doneUnsafe(ended, Effect.succeed(true));
11
- };
12
- output.on("error", end);
13
- output.on("close", end);
14
- const flushed = Effect.callback((resume) => {
15
- if (output.writableLength === 0) {
16
- resume(Effect.succeed(true));
17
- return;
18
- }
19
- output.write("", () => {
20
- resume(Effect.succeed(true));
21
- });
22
- });
23
- return Effect.raceFirst(Deferred.await(ended), flushed);
24
- });
25
- const exitCode = (exit, stderr) => {
26
- if (Exit.isSuccess(exit))
27
- return exit.value;
28
- if (Cause.hasInterruptsOnly(exit.cause))
29
- return EXIT_INTERRUPTED;
30
- stderr.write(`${Cause.pretty(exit.cause)}\n`);
31
- return 1;
32
- };
33
- export const exitAfterOutput = (program, host) => Effect.gen(function* () {
34
- const drains = [yield* watch(host.stdout), yield* watch(host.stderr)];
35
- const running = yield* Effect.forkChild(program, {
36
- startImmediately: true,
37
- });
38
- const code = exitCode(yield* Fiber.await(running), host.stderr);
39
- yield* Effect.all(drains, { concurrency: "unbounded", discard: true });
40
- host.exit(code);
41
- });
42
- //# sourceMappingURL=exit.js.map
@@ -1,3 +0,0 @@
1
- export { processIo, runProcessMain } from "./process.js";
2
- export { runMaiaBootstrap } from "./run.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +0,0 @@
1
- export { processIo, runProcessMain } from "./process.js";
2
- export { runMaiaBootstrap } from "./run.js";
3
- //# sourceMappingURL=index.js.map
@@ -1,5 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- import type { CliIo } from "../command-line/index.js";
3
- export declare const processIo: () => CliIo;
4
- export declare const runProcessMain: (program: Effect.Effect<number>) => void;
5
- //# sourceMappingURL=process.d.ts.map
@@ -1,23 +0,0 @@
1
- import process from "node:process";
2
- import * as Effect from "effect/Effect";
3
- import { constVoid } from "effect/Function";
4
- import * as Runtime from "effect/Runtime";
5
- import { promptLine, terminalIsInteractive, } from "../command-line/input/index.js";
6
- import { exitAfterOutput } from "./exit.js";
7
- const readProcessStdin = (request) => Effect.promise(() => import("./stdio.js")).pipe(Effect.flatMap((stdio) => stdio.readStdin(request)));
8
- export const processIo = () => ({
9
- interactive: terminalIsInteractive(),
10
- prompt: promptLine,
11
- stderr(text) {
12
- process.stderr.write(text);
13
- },
14
- stdin: readProcessStdin,
15
- stdout(text) {
16
- process.stdout.write(text);
17
- },
18
- });
19
- const runMain = Runtime.makeRunMain(constVoid);
20
- export const runProcessMain = (program) => {
21
- runMain(exitAfterOutput(program, process), { disableErrorReporting: true });
22
- };
23
- //# sourceMappingURL=process.js.map
@@ -1,25 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- import type { CliIo } from "../command-line/index.js";
3
- type AgentModule = {
4
- readonly runMaiaAgent?: (arguments_: readonly string[], options: {
5
- readonly io: Pick<CliIo, "stderr" | "stdout">;
6
- }) => Promise<number>;
7
- };
8
- type ProductCliModule = {
9
- readonly runCli?: (arguments_: readonly string[], version: string, io: CliIo) => Effect.Effect<number>;
10
- };
11
- export type MaiaBootstrapDependencies = {
12
- readonly loadAgent: () => Promise<AgentModule>;
13
- readonly loadProductCli: () => Promise<ProductCliModule>;
14
- };
15
- type MaiaBootstrapInput = {
16
- readonly arguments_: readonly string[];
17
- readonly currentNodeVersion: string;
18
- readonly expectedNodeVersion: string;
19
- readonly io: CliIo;
20
- readonly version: string;
21
- };
22
- export declare const isAgentInvocation: (arguments_: readonly string[]) => boolean;
23
- export declare const runMaiaBootstrap: (input: MaiaBootstrapInput, dependencies: MaiaBootstrapDependencies) => Effect.Effect<number>;
24
- export {};
25
- //# sourceMappingURL=run.d.ts.map
@@ -1,95 +0,0 @@
1
- import * as Cause from "effect/Cause";
2
- import * as Effect from "effect/Effect";
3
- const EXIT_SOFTWARE = 70;
4
- const EXIT_UNAVAILABLE = 69;
5
- const isDoctor = (arguments_) => !arguments_.includes("-h") &&
6
- !arguments_.includes("--help") &&
7
- arguments_.find((token) => !token.startsWith("-")) === "doctor";
8
- export const isAgentInvocation = (arguments_) => arguments_[0] === "agent";
9
- const reportBootstrapFailure = (subject, io) => {
10
- io.stderr(`Maia ${subject} could not start; run 'maia doctor'.\n`);
11
- return EXIT_SOFTWARE;
12
- };
13
- const load = (loader) => Effect.tryPromise({ catch: (error) => error, try: loader });
14
- const probe = (loader, passes) => load(loader).pipe(Effect.map(passes), Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause) ? Effect.interrupt : Effect.succeed(false)));
15
- const probePayloads = (dependencies) => Effect.all([
16
- probe(dependencies.loadProductCli, (module) => typeof module.runCli === "function"),
17
- probe(dependencies.loadAgent, (module) => typeof module.runMaiaAgent === "function"),
18
- ]).pipe(Effect.map(([cliPayload, agent]) => ({ agent, cliPayload })));
19
- const formatInstallation = (checks) => `Maia doctor failed\n${checks
20
- .map((check) => ` ${check.code}: ${check.ok ? "ok" : "failed; next: reinstall Maia"}`)
21
- .join("\n")}\n`;
22
- const writeInstallationFailure = (output) => {
23
- const { arguments_, checks, input } = output;
24
- const result = {
25
- checks: checks.map((check) => check.ok ? check : { ...check, next: "reinstall Maia" }),
26
- command: "doctor",
27
- ok: false,
28
- version: input.version,
29
- };
30
- input.io.stdout(arguments_.includes("--json")
31
- ? `${JSON.stringify({ ok: true, result })}\n`
32
- : formatInstallation(checks));
33
- return EXIT_SOFTWARE;
34
- };
35
- const runDoctor = (input, dependencies) => Effect.flatMap(probePayloads(dependencies), (payloads) => {
36
- const checks = [
37
- { code: "bootstrap", ok: true },
38
- {
39
- code: "node_runtime",
40
- ok: input.currentNodeVersion === input.expectedNodeVersion,
41
- },
42
- { code: "cli_payload", ok: payloads.cliPayload },
43
- { code: "agent", ok: payloads.agent },
44
- ];
45
- return checks.every((check) => check.ok)
46
- ? runProductCli(input, dependencies)
47
- : Effect.succeed(writeInstallationFailure({
48
- arguments_: input.arguments_,
49
- checks,
50
- input,
51
- }));
52
- });
53
- const requireSupportedNode = (input) => {
54
- if (input.currentNodeVersion === input.expectedNodeVersion)
55
- return undefined;
56
- input.io.stderr(`Maia CLI requires Node ${input.expectedNodeVersion}; received ${input.currentNodeVersion}.\n`);
57
- return EXIT_UNAVAILABLE;
58
- };
59
- const missingEntry = Effect.fail(new Error("The payload lacks its entry."));
60
- const runPayload = ({ input, loader, run, subject, }) => load(loader).pipe(Effect.flatMap(run), Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause)
61
- ? Effect.interrupt
62
- : Effect.sync(() => reportBootstrapFailure(subject, input.io))));
63
- const runAgent = (input, dependencies) => runPayload({
64
- input,
65
- loader: dependencies.loadAgent,
66
- run: (module) => {
67
- const runMaiaAgent = module.runMaiaAgent;
68
- return typeof runMaiaAgent === "function"
69
- ? Effect.tryPromise({
70
- catch: (error) => error,
71
- try: () => runMaiaAgent(input.arguments_.slice(1), { io: input.io }),
72
- })
73
- : missingEntry;
74
- },
75
- subject: "Agent",
76
- });
77
- const runProductCli = (input, dependencies) => runPayload({
78
- input,
79
- loader: dependencies.loadProductCli,
80
- run: (module) => typeof module.runCli === "function"
81
- ? module.runCli(input.arguments_, input.version, input.io)
82
- : missingEntry,
83
- subject: "CLI",
84
- });
85
- export const runMaiaBootstrap = (input, dependencies) => Effect.suspend(() => {
86
- if (isDoctor(input.arguments_))
87
- return runDoctor(input, dependencies);
88
- const unsupportedNode = requireSupportedNode(input);
89
- if (unsupportedNode !== undefined)
90
- return Effect.succeed(unsupportedNode);
91
- return isAgentInvocation(input.arguments_)
92
- ? runAgent(input, dependencies)
93
- : runProductCli(input, dependencies);
94
- });
95
- //# sourceMappingURL=run.js.map
@@ -1,4 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- import { type BoundedStdinRequest } from "../command-line/input/index.js";
3
- export declare const readStdin: (request: BoundedStdinRequest) => Effect.Effect<string, import("../command-line/input/arguments.js").CliArgumentError, never>;
4
- //# sourceMappingURL=stdio.d.ts.map