@maiaos/cli 0.1.0-canary.2 → 0.1.0-canary.21
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.
- package/README.md +38 -265
- package/dist/address-space/address-space.d.ts +38 -0
- package/dist/address-space/address-space.js +130 -0
- package/dist/address-space/index.d.ts +2 -0
- package/dist/address-space/index.js +2 -0
- package/dist/agents/client.d.ts +171 -0
- package/dist/agents/client.js +8 -0
- package/dist/agents/commands.d.ts +7 -0
- package/dist/agents/commands.js +65 -0
- package/dist/agents/index.d.ts +3 -0
- package/dist/agents/index.js +3 -0
- package/dist/agents/input.d.ts +130 -0
- package/dist/agents/input.js +99 -0
- package/dist/agents/output/format.d.ts +8 -0
- package/dist/agents/output/format.js +47 -0
- package/dist/agents/output/index.d.ts +2 -0
- package/dist/agents/output/index.js +2 -0
- package/dist/agents/tree/index.d.ts +2 -0
- package/dist/agents/tree/index.js +2 -0
- package/dist/agents/tree/tree.d.ts +3 -0
- package/dist/agents/tree/tree.js +43 -0
- package/dist/bin/maia.cdx.json +37 -14
- package/dist/bin/maia.mjs +1 -1
- package/dist/bootstrap/exit.d.ts +14 -0
- package/dist/bootstrap/exit.js +42 -0
- package/dist/bootstrap/process.js +4 -26
- package/dist/bootstrap/run.js +5 -2
- package/dist/cli/cli.d.ts +2 -1
- package/dist/cli/cli.js +81 -16
- package/dist/command-line/context.d.ts +14 -4
- package/dist/command-line/context.js +1 -1
- package/dist/command-line/index.d.ts +6 -6
- package/dist/command-line/index.js +6 -5
- package/dist/command-line/input/arguments.d.ts +7 -0
- package/dist/command-line/input/arguments.js +22 -10
- package/dist/command-line/input/index.d.ts +2 -2
- package/dist/command-line/input/index.js +2 -2
- package/dist/command-line/input/stdin.d.ts +1 -0
- package/dist/command-line/input/stdin.js +1 -0
- package/dist/command-line/json.d.ts +1 -0
- package/dist/command-line/json.js +23 -0
- package/dist/command-line/output.d.ts +8 -1
- package/dist/command-line/output.js +33 -14
- package/dist/command-line/rows.d.ts +2 -0
- package/dist/command-line/rows.js +10 -1
- package/dist/command-line/two-phase.d.ts +5 -0
- package/dist/command-line/two-phase.js +33 -8
- package/dist/command-tree/help.d.ts +1 -1
- package/dist/command-tree/help.js +1 -0
- package/dist/command-tree/index.d.ts +2 -2
- package/dist/command-tree/index.js +1 -1
- package/dist/command-tree/local.js +12 -0
- package/dist/command-tree/placeholder.d.ts +1 -0
- package/dist/command-tree/placeholder.js +1 -0
- package/dist/command-tree/row.d.ts +2 -0
- package/dist/command-tree/tree.d.ts +3 -2
- package/dist/command-tree/tree.js +18 -2
- package/dist/connection/access/client.d.ts +13 -0
- package/dist/connection/access/client.js +19 -0
- package/dist/connection/access/commands.d.ts +6 -0
- package/dist/connection/access/commands.js +60 -0
- package/dist/connection/access/format.d.ts +8 -0
- package/dist/connection/access/format.js +61 -0
- package/dist/connection/access/index.d.ts +3 -0
- package/dist/connection/access/index.js +3 -0
- package/dist/connection/access/input.d.ts +53 -0
- package/dist/connection/access/input.js +83 -0
- package/dist/connection/client.d.ts +99 -1
- package/dist/connection/client.js +9 -1
- package/dist/connection/index.d.ts +2 -1
- package/dist/connection/index.js +2 -1
- package/dist/connection/system.d.ts +1 -0
- package/dist/connection/system.js +109 -5
- package/dist/connection/tree/tree.js +59 -8
- package/dist/container/output/format.js +1 -2
- package/dist/dashboard/cockpit-client.d.ts +6 -0
- package/dist/dashboard/cockpit-client.js +27 -0
- package/dist/dashboard/cockpits.d.ts +29 -0
- package/dist/dashboard/cockpits.js +65 -0
- package/dist/dashboard/dashboard.d.ts +7 -0
- package/dist/dashboard/dashboard.js +47 -0
- package/dist/dashboard/draw.d.ts +15 -0
- package/dist/dashboard/draw.js +30 -0
- package/dist/dashboard/frame.d.ts +4 -0
- package/dist/dashboard/frame.js +15 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.js +2 -0
- package/dist/dashboard/modes.d.ts +5 -0
- package/dist/dashboard/modes.js +16 -0
- package/dist/dashboard/node-connection.d.ts +15 -0
- package/dist/dashboard/node-connection.js +51 -0
- package/dist/dashboard/pi-tui.d.ts +6 -0
- package/dist/dashboard/pi-tui.js +35 -0
- package/dist/dashboard/status-bar.d.ts +4 -0
- package/dist/dashboard/status-bar.js +60 -0
- package/dist/dashboard/terminal.d.ts +53 -0
- package/dist/dashboard/terminal.js +165 -0
- package/dist/dashboard/tree-model.d.ts +28 -0
- package/dist/dashboard/tree-model.js +97 -0
- package/dist/dashboard/tree.d.ts +10 -0
- package/dist/dashboard/tree.js +76 -0
- package/dist/fleet/fleet.d.ts +70 -0
- package/dist/fleet/fleet.js +91 -0
- package/dist/fleet/index.d.ts +2 -0
- package/dist/fleet/index.js +2 -0
- package/dist/hold/output/format.js +1 -5
- package/dist/hold/tree/tree.js +1 -0
- package/dist/import/commands.js +3 -4
- package/dist/import/output.js +1 -4
- package/dist/local-node/client.d.ts +9 -4
- package/dist/local-node/client.js +21 -9
- package/dist/local-node/index.d.ts +2 -1
- package/dist/local-node/index.js +2 -1
- package/dist/local-node/wait.d.ts +10 -0
- package/dist/local-node/wait.js +17 -0
- package/dist/login/commands.js +2 -1
- package/dist/mcp/calls.d.ts +1 -0
- package/dist/mcp/calls.js +37 -3
- package/dist/mcp/commands.d.ts +5 -2
- package/dist/mcp/commands.js +30 -4
- package/dist/mcp/routing.d.ts +24 -0
- package/dist/mcp/routing.js +188 -0
- package/dist/mcp/server.d.ts +13 -4
- package/dist/mcp/server.js +35 -12
- package/dist/presentation/output/format.js +4 -3
- package/dist/project-guard/commands.js +11 -2
- package/dist/project-workspace/commands.js +16 -6
- package/dist/project-workspace/output/human.d.ts +13 -0
- package/dist/project-workspace/output/human.js +17 -5
- package/dist/project-workspace/output/index.d.ts +1 -1
- package/dist/project-workspace/output/index.js +1 -1
- package/dist/project-workspace/output/metadata.js +1 -1
- package/dist/project-workspace/tree/tree.js +27 -12
- package/dist/reference/commands.js +4 -2
- package/dist/reference/index.d.ts +1 -1
- package/dist/reference/index.js +1 -1
- package/dist/reference/resolve.d.ts +2 -0
- package/dist/reference/resolve.js +28 -18
- package/dist/remote-node/client.d.ts +89 -9
- package/dist/remote-node/client.js +6 -1
- package/dist/remote-node/commands.d.ts +9 -0
- package/dist/remote-node/commands.js +96 -18
- package/dist/remote-node/connector.d.ts +12 -4
- package/dist/remote-node/connector.js +54 -26
- package/dist/remote-node/index.d.ts +2 -2
- package/dist/remote-node/index.js +2 -2
- package/dist/remote-node/reachability.d.ts +43 -1
- package/dist/remote-node/reachability.js +13 -3
- package/dist/remote-node/text.d.ts +2 -1
- package/dist/remote-node/text.js +74 -27
- package/dist/remote-node/tree/tree.js +21 -1
- package/dist/routine/client.d.ts +398 -0
- package/dist/routine/client.js +28 -0
- package/dist/routine/commands.d.ts +9 -0
- package/dist/routine/commands.js +109 -0
- package/dist/routine/index.d.ts +3 -0
- package/dist/routine/index.js +3 -0
- package/dist/routine/input.d.ts +28 -0
- package/dist/routine/input.js +44 -0
- package/dist/routine/output/format.d.ts +23 -0
- package/dist/routine/output/format.js +83 -0
- package/dist/routine/output/index.d.ts +2 -0
- package/dist/routine/output/index.js +2 -0
- package/dist/routine/tree/index.d.ts +2 -0
- package/dist/routine/tree/index.js +2 -0
- package/dist/routine/tree/tree.d.ts +3 -0
- package/dist/routine/tree/tree.js +70 -0
- package/dist/session/agent-permission.d.ts +2 -2
- package/dist/session/approval/commands.js +31 -9
- package/dist/session/approval/output/format.d.ts +11 -0
- package/dist/session/approval/output/format.js +8 -0
- package/dist/session/approval/output/index.d.ts +1 -1
- package/dist/session/approval/output/index.js +1 -1
- package/dist/session/attach-client.d.ts +1 -1
- package/dist/session/attach-client.js +12 -3
- package/dist/session/attach-render.js +15 -7
- package/dist/session/attach.js +17 -3
- package/dist/session/client.d.ts +12 -3
- package/dist/session/client.js +18 -17
- package/dist/session/commands.d.ts +1 -0
- package/dist/session/commands.js +120 -13
- package/dist/session/create-tasks.js +29 -11
- package/dist/session/index.d.ts +2 -2
- package/dist/session/index.js +2 -1
- package/dist/session/interaction/output/format.js +2 -1
- package/dist/session/output/diff.js +3 -10
- package/dist/session/output/failure.js +3 -10
- package/dist/session/output/human.d.ts +1 -0
- package/dist/session/output/human.js +21 -10
- package/dist/session/output/index.d.ts +2 -2
- package/dist/session/output/index.js +2 -2
- package/dist/session/output/tasks.d.ts +16 -1
- package/dist/session/output/tasks.js +41 -27
- package/dist/session/tree/tree.js +67 -8
- package/dist/session/turn/client.d.ts +4 -1
- package/dist/session/turn/client.js +22 -11
- package/dist/session/turn/commands.d.ts +2 -0
- package/dist/session/turn/commands.js +39 -11
- package/dist/session/turn/index.d.ts +3 -3
- package/dist/session/turn/index.js +1 -1
- package/dist/session/turn/output.d.ts +7 -2
- package/dist/session/turn/output.js +36 -13
- package/dist/status/client.d.ts +7 -2
- package/dist/status/command.js +3 -1
- package/dist/status/doctor.d.ts +5 -1
- package/dist/status/doctor.js +10 -4
- package/dist/status/output/compact.d.ts +1 -0
- package/dist/status/output/compact.js +3 -0
- package/dist/status/output/human.d.ts +1 -1
- package/dist/status/output/human.js +71 -14
- package/dist/team-workspace/ceremony.d.ts +19 -0
- package/dist/team-workspace/ceremony.js +141 -0
- package/dist/team-workspace/client.d.ts +58 -0
- package/dist/team-workspace/client.js +6 -0
- package/dist/team-workspace/commands.d.ts +3 -0
- package/dist/team-workspace/commands.js +85 -0
- package/dist/team-workspace/confirmation.d.ts +4 -0
- package/dist/team-workspace/confirmation.js +8 -0
- package/dist/team-workspace/dependencies.d.ts +8 -0
- package/dist/team-workspace/dependencies.js +2 -0
- package/dist/team-workspace/index.d.ts +6 -0
- package/dist/team-workspace/index.js +5 -0
- package/dist/team-workspace/launcher.d.ts +17 -0
- package/dist/team-workspace/launcher.js +30 -0
- package/dist/team-workspace/output.d.ts +15 -0
- package/dist/team-workspace/output.js +28 -0
- package/dist/team-workspace/terminal.d.ts +9 -0
- package/dist/team-workspace/terminal.js +46 -0
- package/dist/terminal/client.d.ts +4 -0
- package/dist/terminal/client.js +3 -0
- package/dist/terminal/commands.js +37 -25
- package/dist/terminal/control-commands.js +26 -9
- package/dist/terminal/keys.d.ts +12 -0
- package/dist/terminal/keys.js +62 -0
- package/dist/terminal/output/compact-list.d.ts +1 -0
- package/dist/terminal/output/compact-list.js +1 -0
- package/dist/terminal/output/human.d.ts +2 -19
- package/dist/terminal/output/human.js +6 -6
- package/dist/terminal/tree/tree.js +16 -16
- package/guidance/maia-orchestration/SKILL.md +1 -2
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -1,287 +1,60 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@maiaos/cli)
|
|
1
|
+
# @maiaos/cli
|
|
4
2
|
|
|
5
3
|
The `maia` command-line tool and MCP server for Maia OS: start, drive, observe
|
|
6
4
|
and stop swarms of AI coding agents (Claude Code and Codex workers) from a
|
|
7
|
-
terminal, a script
|
|
8
|
-
|
|
9
|
-
The CLI is the reference Maia client and the first complete one. Every
|
|
10
|
-
Node-facing command goes through [`@maiaos/sdk`](../../packages/sdk/README.md)
|
|
11
|
-
to Maia Node; `--json` prints one bounded JSON result built for LLMs and
|
|
12
|
-
scripts. `maia mcp` serves the same operations as MCP tools, and `maia agent`
|
|
13
|
-
runs Maia's own coding agent.
|
|
14
|
-
|
|
15
|
-
## Install
|
|
16
|
-
|
|
17
|
-
From a source checkout (see the [quick start](../../README.md#quick-start)):
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
pnpm dev:cli # installs ~/.local/bin/maia for this checkout
|
|
21
|
-
pnpm maia help # or run this checkout's CLI without installing
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Each call runs the checkout around your working directory, so a dev worktree
|
|
25
|
-
runs its own build against its own Node. Pre-release builds:
|
|
26
|
-
`@maiaos/cli@nightly` and `@maiaos/cli@canary`; no stable release exists.
|
|
27
|
-
|
|
28
|
-
## Example
|
|
29
|
-
|
|
30
|
-
```sh
|
|
31
|
-
maia status
|
|
32
|
-
maia --json project list
|
|
33
|
-
maia --json session create --workspace <workspace-id> --executor codex-cli --command-id create-1
|
|
34
|
-
maia --json session start <session-id> --expected-revision 1 --command-id start-1 --wait
|
|
35
|
-
printf '%s' "Explain the build" |
|
|
36
|
-
maia --json session turn send --session <session-id> --prompt-stdin --expected-revision <revision> --command-id send-1
|
|
37
|
-
maia --json session turn wait <turn-id> --timeout 10m
|
|
38
|
-
maia --json session turn show <turn-id> --include-content
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
`session create --message <text>` creates, starts and sends the first turn in
|
|
42
|
-
one command, and `maia doctor` checks the installation, the Node and the
|
|
43
|
-
accounts, naming the next command for each failure.
|
|
44
|
-
|
|
45
|
-
A coding Session writes in a worktree of its own from a base ref; review and
|
|
46
|
-
retire it with `diff` and `archive`
|
|
47
|
-
([coding Sessions](../../docs/maia-swarm/external-executors.md#coding-sessions)):
|
|
48
|
-
|
|
49
|
-
```sh
|
|
50
|
-
maia --json session create --workspace <workspace-id> --executor claude-code --base main --command-id code-1
|
|
51
|
-
maia session diff <session-id> --stat
|
|
52
|
-
maia --json session archive <session-id> --expected-revision <revision> --command-id archive-1
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Commands
|
|
56
|
-
|
|
57
|
-
`maia help` lists the root commands by section, and `-h` or `--help` works on
|
|
58
|
-
every command (`maia session start --help`). `maia help --json` describes
|
|
59
|
-
every command, with its availability (implemented or source candidate),
|
|
60
|
-
example and operation, plus the [agent contract](../../docs/reference/cli.md#agent-contract);
|
|
61
|
-
`maia <command> --help --json` adds typed arguments. Each command is authored
|
|
62
|
-
once, as a leaf of a command-tree fragment in its feature's `tree/` scope;
|
|
63
|
-
`src/command-tree/` holds the grammar, help and suggestions.
|
|
64
|
-
|
|
65
|
-
Paths are scope-first: a noun, then a verb (`session turn send`,
|
|
66
|
-
`connection capacity set`). The ID a command is about is positional; the ID of
|
|
67
|
-
a parent or related resource is a flag (`--session`, `--workspace`, `--run`).
|
|
68
|
-
An unknown or retired path prints `Did you mean 'maia ...'?` and runs nothing.
|
|
69
|
-
Any resource argument takes an ID, an ID prefix or a unique name or Session
|
|
70
|
-
title; the CLI asks the Node to resolve it and sends the exact ID. A missing
|
|
71
|
-
required `--project` or `--workspace` comes from the current folder, then the
|
|
72
|
-
selected Workspace ([references and defaults](../../docs/reference/cli.md#references-and-defaults)).
|
|
73
|
-
List commands print plain header tables.
|
|
74
|
-
|
|
75
|
-
| Family | What it does |
|
|
76
|
-
| ------------------------------------------ | ------------------------------------------------------------------------------------------------- |
|
|
77
|
-
| `status`, `node status`, `node monitor` | Node readiness and health (`status` is a shortcut); a one-time loopback URL for the admin monitor |
|
|
78
|
-
| `setup`, `login`, `connection` | Use installed vendor CLIs, sign in worker accounts and model providers, usage, capacity |
|
|
79
|
-
| `integration`, `provider` | Approve vendor executables; model-provider pools |
|
|
80
|
-
| `project`, `workspace`, `container` | Register repositories, Project guards, Workspaces and containers |
|
|
81
|
-
| `session` | Create, rename, start, observe, stop, resume, diff and archive workers; adopt, message, approve |
|
|
82
|
-
| `session turn` | Send, show, wait for and interrupt turns |
|
|
83
|
-
| `session approval`, `session interaction` | What workers wait on a person for; record-only questions to a person |
|
|
84
|
-
| `receipt` | Look up the outcome of any mutation by command ID |
|
|
85
|
-
| `port` | Advisory loopback port leases for Sessions sharing one machine |
|
|
86
|
-
| `hold` | Emergency holds on exact Projects and accounts; release them |
|
|
87
|
-
| `run`, `terminal`, `context` | Runs and the Run ledger, terminals, context |
|
|
88
|
-
| `execution` | Execution environments, worktrees, placements and relocation |
|
|
89
|
-
| `import` | Find Claude Code and Codex sessions to adopt |
|
|
90
|
-
| `presentation` | Read-only view specifications |
|
|
91
|
-
| `reference` | The exact ID of a name, ID prefix or title, or the current folder's Project or Workspace |
|
|
92
|
-
| `agent` | Maia's interactive coding agent on the official Pi SDK |
|
|
93
|
-
| `mcp` | Coordinator or worker MCP server over stdio |
|
|
94
|
-
| `node install`, `node list`, `node remove` | Remote Nodes over SSH; `--node <name>` routes any command to one |
|
|
95
|
-
| `doctor`, `version`, `completion` | Installation, Node and account check; version; shell completion (`bash`, `zsh`, `fish`) |
|
|
96
|
-
|
|
97
|
-
Global options may go anywhere before `--`:
|
|
98
|
-
`maia [--json] [--profile <name>] [--node <name>] [--no-input] <command>`;
|
|
99
|
-
everything after `--` belongs to the command, `--json` included. `--profile`
|
|
100
|
-
selects a local Node runtime profile, not a configuration profile.
|
|
101
|
-
`MAIA_PROFILE`, `MAIA_NODE` and `MAIA_NO_INPUT` stand in for `--profile`,
|
|
102
|
-
`--node` and `--no-input` on the commands that take them; a flag wins.
|
|
103
|
-
`--timeout` and `--stall-after` take durations such as `30s`, `10m` or `1h`;
|
|
104
|
-
lists show 20 items per page unless their usage shows another range. `maia version --json` reports the
|
|
105
|
-
version, the protocol and, in a build made with `MAIA_CLI_BUILD_COMMIT`, the
|
|
106
|
-
commit. `-v` is not an option; use `--version` or `maia version`.
|
|
107
|
-
`maia completion <bash|zsh|fish>` prints a completion script generated from
|
|
108
|
-
the command tree.
|
|
109
|
-
|
|
110
|
-
## Output and exit codes
|
|
111
|
-
|
|
112
|
-
A JSON result is `{ "ok": true, "result": { "command", "result" } }` on stdout
|
|
113
|
-
or `{ "ok": false, "error": { "code", "message", "retryable" } }` on stderr;
|
|
114
|
-
a usage error adds the command's `usage` lines and a `hint`.
|
|
5
|
+
terminal, a script or another agent.
|
|
115
6
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
| 64 | Invalid usage |
|
|
120
|
-
| 66 | Unknown ID |
|
|
121
|
-
| 69 | Node unavailable |
|
|
122
|
-
| 70 | Other failure, a waited turn that failed, or a failed `doctor` check |
|
|
123
|
-
| 74 | Deadline reached (for example `session turn wait`) |
|
|
124
|
-
| 75 | Retry later: revision changed, full, limited, held |
|
|
125
|
-
| 76 | Outcome unknown: check `maia receipt show` |
|
|
126
|
-
| 77 | Not permitted |
|
|
7
|
+
> **Pre-release.** npm carries only `canary` builds (nightlies are historical; none are built since D-185), which are
|
|
8
|
+
> not release-qualified. No stable release exists
|
|
9
|
+
> ([D-132](https://github.com/vllnt/maia/blob/main/docs/decisions.md#d-132)).
|
|
127
10
|
|
|
128
|
-
|
|
129
|
-
the same command ID; the Node replays the first result instead of acting twice.
|
|
130
|
-
A person-facing prompt appears only at a terminal, without `--json` and
|
|
131
|
-
`--no-input`; otherwise the command exits 64 and names its flags.
|
|
11
|
+
## Requirements
|
|
132
12
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
`setup`, `node install`, `node remove`) previews and asks y/N; one that reads
|
|
137
|
-
its request from `--input-stdin` never prompts, so it needs `--dry-run` or
|
|
138
|
-
`--confirm-stdin`:
|
|
13
|
+
- Node.js 24.22.1.
|
|
14
|
+
- A running [Maia Node](https://github.com/vllnt/maia/blob/main/services/node/README.md).
|
|
15
|
+
- Claude Code or the Codex CLI, for workers.
|
|
139
16
|
|
|
140
|
-
|
|
141
|
-
maia --json hold place --input-stdin --dry-run < in.json | maia hold place --confirm-stdin
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Sign-in
|
|
145
|
-
|
|
146
|
-
```sh
|
|
147
|
-
maia connection detect # the installed claude and codex as the Node sees them
|
|
148
|
-
maia setup [--max-sessions 4] # use them as they are: system-default accounts
|
|
149
|
-
maia login # list worker accounts and model providers
|
|
150
|
-
maia login claude # add or re-sign a Claude Code account
|
|
151
|
-
maia login codex [--name codex-2] [--device-code]
|
|
152
|
-
maia login vercel-ai-gateway # a model provider from Pi's catalog
|
|
153
|
-
maia connection usage show codex-1 [--refresh]
|
|
154
|
-
printf %s "$AI_GATEWAY_API_KEY" | maia login gateway --name vercel \
|
|
155
|
-
--base-url https://ai-gateway.vercel.sh --api-key-stdin
|
|
156
|
-
maia connection models list --connection vercel
|
|
157
|
-
maia session create --workspace <workspace-id> --connection vercel \
|
|
158
|
-
--executor claude-code --model anthropic/claude-sonnet-4.5
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
`maia login claude` and `maia login codex` run the vendor's own sign-in for a
|
|
162
|
-
Maia-managed account root; Maia never reads or stores that credential. Model
|
|
163
|
-
providers store one credential per provider in Maia's `auth.json`. On a server,
|
|
164
|
-
Codex signs in with a device code and Claude Code with a link and a pasted
|
|
165
|
-
code. A person approves vendor executables with `maia integration plan
|
|
166
|
-
<codex|claude-code>` and `maia integration apply <codex|claude-code> --plan
|
|
167
|
-
<plan-id>`. `maia connection capacity set` changes an account's session cap. A gateway Connection lets
|
|
168
|
-
Claude Code and Codex Sessions use an AI gateway's models with its API key,
|
|
169
|
-
which the CLI reads from stdin and never prints; a subscription proxy can
|
|
170
|
-
breach provider terms, so prefer an API-key gateway.
|
|
171
|
-
|
|
172
|
-
## Coordinator MCP server
|
|
173
|
-
|
|
174
|
-
`maia mcp` serves 43 coordinator tools over stdio (MCP protocol 2025-06-18),
|
|
175
|
-
such as `session_create`, `turn_send`, `turn_wait`, `port_lease_acquire`,
|
|
176
|
-
`reference_resolve` and `receipt_get`. Their input schemas are generated from `@maiaos/protocol`, so
|
|
177
|
-
they never drift from the JSON commands. Accounts, integrations, confirmations
|
|
178
|
-
and answers are not exposed; the only human-only operation exposed is
|
|
179
|
-
`turn.send`, which the coordinator sends as the operator's client. The
|
|
180
|
-
[`maia` plugin](../../plugins/maia) registers this server and ships the
|
|
181
|
-
`maia-orchestration` Skill for Claude Code and Codex
|
|
182
|
-
([setup](../../README.md#4-drive-maia-from-claude-code-or-codex)). An invalid
|
|
183
|
-
argument names the failing field in the error message.
|
|
184
|
-
|
|
185
|
-
## Worker Sessions, roles and guards (source candidate)
|
|
186
|
-
|
|
187
|
-
A Codex or Claude Code Session that Maia launches gets its own credential in
|
|
188
|
-
`MAIA_SESSION_CREDENTIAL` and the Node's loopback origin in `MAIA_NODE_ORIGIN`,
|
|
189
|
-
never the operator's bearer. With that credential, `maia` and `maia mcp` act
|
|
190
|
-
as the Session within its role: a `worker` reads its context, Node status and
|
|
191
|
-
its Project's Session list and manages its own port leases; an `orchestrator` may also read its Project's
|
|
192
|
-
guards and create child Sessions. Anything else fails with `role_denied`
|
|
193
|
-
(exit 77). Without a valid `MAIA_NODE_ORIGIN` the command fails closed; it
|
|
194
|
-
never falls back to the operator's profile. With a Session credential,
|
|
195
|
-
`maia session list --all` still lists only that Session's Project; naming a
|
|
196
|
-
different Project fails with `role_denied`. Human and external-coordinator
|
|
197
|
-
lists remain unchanged.
|
|
198
|
-
|
|
199
|
-
Coding workers receive a launch-configured `maia_worker` MCP server running
|
|
200
|
-
`maia mcp --worker`. The vendor starts it outside its tool sandbox; the
|
|
201
|
-
sandbox keeps its existing filesystem and network limits. `--worker` requires
|
|
202
|
-
the Session environment even when both variables are missing. Plain `maia mcp`
|
|
203
|
-
also selects worker tools when either variable is present. Only Project-scoped `session_list`, `context_show`,
|
|
204
|
-
`node_status` and the four `port_lease_*` tools are exposed. Node authentication
|
|
205
|
-
checks expiry and revocation on every call.
|
|
17
|
+
## Install
|
|
206
18
|
|
|
207
19
|
```sh
|
|
208
|
-
|
|
209
|
-
maia project guard show <project-id>
|
|
210
|
-
maia --json project guard set <project-id> --expected-revision 0 \
|
|
211
|
-
--max-depth 2 --max-live-children 4 --max-messages-per-minute 60 \
|
|
212
|
-
--max-leases-per-session 8 --dry-run |
|
|
213
|
-
maia project guard set --confirm-stdin
|
|
20
|
+
pnpm add -g @maiaos/cli@canary
|
|
214
21
|
```
|
|
215
22
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
guards when a Session creates a child, sends a message or leases a port. A
|
|
220
|
-
full guard exits 75; the depth guard exits 70 until a person raises it.
|
|
23
|
+
From a source checkout, `pnpm dev:cli` installs `maia` for that checkout and
|
|
24
|
+
`pnpm maia <args>` runs it without installing. See the
|
|
25
|
+
[quick start](https://github.com/vllnt/maia#quick-start).
|
|
221
26
|
|
|
222
|
-
##
|
|
27
|
+
## Usage
|
|
223
28
|
|
|
224
29
|
```sh
|
|
225
|
-
#
|
|
226
|
-
maia --json
|
|
227
|
-
maia
|
|
228
|
-
|
|
229
|
-
maia --json hold release --input-stdin --dry-run < release.json | maia hold release --confirm-stdin
|
|
30
|
+
maia status # the Node reports ready
|
|
31
|
+
maia --json project list
|
|
32
|
+
maia --json project register . --name app --command-id project-1
|
|
33
|
+
maia --json session create --project <project-id> --executor codex-cli --base HEAD --message 'Fix the build' --command-id create-1
|
|
230
34
|
```
|
|
231
35
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
or release a hold.
|
|
238
|
-
|
|
239
|
-
## External questions and recorded answers (source candidate)
|
|
36
|
+
`--json` prints one bounded JSON result for scripts and LLMs. A mutation takes
|
|
37
|
+
a command ID you choose; retry with the same one and the Node replays the first
|
|
38
|
+
result instead of acting twice. `maia help` lists every command, `maia help
|
|
39
|
+
--json` describes them, and `maia doctor` checks the installation, the Node and
|
|
40
|
+
the accounts.
|
|
240
41
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
maia --json session interaction list --session <session-id> --project <project-id> --status pending --limit 8
|
|
244
|
-
maia --json session interaction respond --input-stdin
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
A question or selection is attached to an idle Session and answered by a
|
|
248
|
-
person. Answers are recorded data, never approval to act. Inputs are strict
|
|
249
|
-
JSON on stdin; reuse the same command ID after an uncertain result and
|
|
250
|
-
reconcile with `maia receipt show`. See the
|
|
251
|
-
[interaction contract](../../packages/protocol/src/interaction/README.md).
|
|
42
|
+
`maia mcp` serves the same operations as MCP tools over stdio, and `maia agent`
|
|
43
|
+
runs Maia's own coding agent.
|
|
252
44
|
|
|
253
45
|
## Status
|
|
254
46
|
|
|
255
|
-
Source
|
|
256
|
-
`maia
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
[team Workspaces and Control Nodes](
|
|
261
|
-
|
|
262
|
-
## Development
|
|
263
|
-
|
|
264
|
-
```sh
|
|
265
|
-
pnpm --filter @maiaos/cli build
|
|
266
|
-
pnpm --filter @maiaos/cli lint
|
|
267
|
-
pnpm --filter @maiaos/cli typecheck
|
|
268
|
-
pnpm --filter @maiaos/cli test
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
The release entry is a standalone, tree-shaken executable with a 355 KiB hard
|
|
272
|
-
ceiling; `src/bin/maia.test.ts` locks the packed contents and size. The
|
|
273
|
-
package's library entry exports `makeCli` and `runCli`, which return an Effect
|
|
274
|
-
of the exit code ([D-068](../../docs/decisions.md#d-068)); the `maia` binary
|
|
275
|
-
runs that Effect on one runtime per process.
|
|
276
|
-
|
|
277
|
-
## Documentation
|
|
278
|
-
|
|
279
|
-
- [CLI reference](../../docs/reference/cli.md): the complete target grammar and
|
|
280
|
-
JSON contracts
|
|
281
|
-
- [Normative contracts](../../docs/reference/contracts.md)
|
|
282
|
-
- [`maia agent`](../../packages/agent/README.md) and
|
|
283
|
-
[Maia Node](../../services/node/README.md)
|
|
47
|
+
**Source candidate.** Every Node-facing command goes through
|
|
48
|
+
[`@maiaos/sdk`](https://github.com/vllnt/maia/blob/main/packages/sdk/README.md),
|
|
49
|
+
and many command families are release-disabled; `maia help --json` reports
|
|
50
|
+
each command's availability. The first-owner bootstrap of a Node
|
|
51
|
+
(`maia node bootstrap`) is a source candidate and release-disabled; see
|
|
52
|
+
[team Workspaces and Control Nodes](https://github.com/vllnt/maia/blob/main/docs/team-workspaces-and-control-nodes.md).
|
|
284
53
|
|
|
285
|
-
##
|
|
54
|
+
## Links
|
|
286
55
|
|
|
287
|
-
|
|
56
|
+
- [CLI reference](https://github.com/vllnt/maia/blob/main/docs/reference/cli.md):
|
|
57
|
+
grammar, JSON output and exit codes
|
|
58
|
+
- [Normative contracts](https://github.com/vllnt/maia/blob/main/docs/reference/contracts.md)
|
|
59
|
+
- [Security policy](https://github.com/vllnt/maia/blob/main/SECURITY.md)
|
|
60
|
+
- [Repository](https://github.com/vllnt/maia)
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Result from "effect/Result";
|
|
3
|
+
import { cell, CliArgumentError, exitCodeOf, formatRows, LOCAL_NODE, peekStdin, reportError, writeSuccess, } from "../command-line/index.js";
|
|
4
|
+
import { ROUTE_ARGUMENT } from "../command-tree/index.js";
|
|
5
|
+
import { askEach, failureOf, fleetNodes, holderIn, refused, routes, } from "../fleet/index.js";
|
|
6
|
+
import { argumentValue } from "../reference/index.js";
|
|
7
|
+
const addressSpace = (context) => {
|
|
8
|
+
const { bindNode, dependencies, node } = context;
|
|
9
|
+
return fleetNodes({
|
|
10
|
+
bind: bindNode &&
|
|
11
|
+
((name) => ({ ...context, dependencies: bindNode(name), node: name })),
|
|
12
|
+
chosen: node !== undefined,
|
|
13
|
+
listRemoteNodes: dependencies.listRemoteNodes,
|
|
14
|
+
local: { node: node ?? LOCAL_NODE, reach: context },
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const readEach = (context, read, paged) => Effect.flatMap(addressSpace(context), (space) => {
|
|
18
|
+
if (!space.ok)
|
|
19
|
+
return Effect.succeed(space);
|
|
20
|
+
if (paged && space.value.length > 1)
|
|
21
|
+
return Effect.succeed(refused("invalid_argument", "A cursor pages one Node: pass '--node <name>' with '--after'."));
|
|
22
|
+
return Effect.map(askEach(space.value, (bound) => read(bound.dependencies)), (value) => ({ ok: true, value }));
|
|
23
|
+
});
|
|
24
|
+
const LOCAL_NAMES = "Names and prefixes resolve on this machine's Node; pass --node <name> or use an exact ID.";
|
|
25
|
+
const onAddressedNode = (context, run) => Effect.flatMap(addressSpace(context), (space) => run(space.ok && space.value.length > 1
|
|
26
|
+
? { ...context, notFoundHint: LOCAL_NAMES }
|
|
27
|
+
: context));
|
|
28
|
+
const PROBES = {
|
|
29
|
+
approval: (dependencies, approvalId) => dependencies.showApproval?.({ approvalId }) ??
|
|
30
|
+
Effect.die(new Error("Missing approval client.")),
|
|
31
|
+
command: (dependencies, id) => dependencies.getReceipt(id),
|
|
32
|
+
project: (dependencies, id) => dependencies.showProject(id),
|
|
33
|
+
routine: (dependencies, routineId) => dependencies.showRoutine?.({ routineId }) ??
|
|
34
|
+
Effect.die(new Error("Missing routine client.")),
|
|
35
|
+
session: (dependencies, id) => dependencies.showSession(id),
|
|
36
|
+
terminal: (dependencies, id) => dependencies.showTerminal(id),
|
|
37
|
+
turn: (dependencies, id) => dependencies.showTurn(id),
|
|
38
|
+
workspace: (dependencies, id) => dependencies.showWorkspace(id),
|
|
39
|
+
};
|
|
40
|
+
const isRouteKind = (word) => Object.hasOwn(PROBES, word);
|
|
41
|
+
const CHOOSE_NODE = "pass --node <name>";
|
|
42
|
+
const findHolder = (context, nodes, held) => Effect.map(holderIn(nodes, held, {
|
|
43
|
+
choose: CHOOSE_NODE,
|
|
44
|
+
probe: (bound) => PROBES[held.kind](bound.dependencies, held.id),
|
|
45
|
+
}), (holder) => Result.isSuccess(holder)
|
|
46
|
+
? holder.success
|
|
47
|
+
: reportError(holder.failure.error, {
|
|
48
|
+
...context,
|
|
49
|
+
nodes: holder.failure.holdings,
|
|
50
|
+
}));
|
|
51
|
+
export const onHolder = (context, held, run) => Effect.gen(function* () {
|
|
52
|
+
if (!routes(held))
|
|
53
|
+
return yield* onAddressedNode(context, run);
|
|
54
|
+
const space = yield* addressSpace(context);
|
|
55
|
+
if (!space.ok)
|
|
56
|
+
return reportError(space.error, context);
|
|
57
|
+
const [only, ...others] = space.value;
|
|
58
|
+
if (only !== undefined && others.length === 0)
|
|
59
|
+
return yield* run(only.reach);
|
|
60
|
+
const holder = yield* findHolder(context, space.value, held);
|
|
61
|
+
if (typeof holder === "number")
|
|
62
|
+
return holder;
|
|
63
|
+
if (!context.json)
|
|
64
|
+
context.io.stderr(`node: ${holder.node} (holds ${held.id})\n`);
|
|
65
|
+
const resolution = {
|
|
66
|
+
argument: "--node",
|
|
67
|
+
id: holder.node,
|
|
68
|
+
kind: "node",
|
|
69
|
+
match: "id",
|
|
70
|
+
reference: held.id,
|
|
71
|
+
};
|
|
72
|
+
return yield* run({
|
|
73
|
+
...holder.reach,
|
|
74
|
+
node: holder.node,
|
|
75
|
+
resolved: [...(holder.reach.resolved ?? []), resolution],
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
export const onInputHolder = (context, { idOf, kind }, run) => context.node !== undefined || context.bindNode === undefined
|
|
79
|
+
? run(context)
|
|
80
|
+
: Effect.flatMap(peekStdin(context), ({ context: replayed, input }) => {
|
|
81
|
+
const id = typeof input === "object" && input !== null ? idOf(input) : undefined;
|
|
82
|
+
return typeof id === "string"
|
|
83
|
+
? onHolder(replayed, { id, kind }, run)
|
|
84
|
+
: run(replayed);
|
|
85
|
+
});
|
|
86
|
+
export const routeLeaf = (context, { argument, tokens, usage }, run) => {
|
|
87
|
+
const names = [argument].flat();
|
|
88
|
+
const kinds = names.map((name) => ROUTE_ARGUMENT.exec(name)?.[1] ?? "");
|
|
89
|
+
if (!kinds.every(isRouteKind))
|
|
90
|
+
return Effect.die(new Error(`No route kind for ${names.join(" or ")}.`));
|
|
91
|
+
return Effect.flatMap(Effect.forEach(names, (name) => argumentValue(usage, tokens, name)), (values) => {
|
|
92
|
+
if (values.filter((value) => value !== undefined).length > 1)
|
|
93
|
+
return Effect.fail(new CliArgumentError(`Give one of ${names.join(" or ")}.`));
|
|
94
|
+
const index = values.findIndex((value) => value !== undefined);
|
|
95
|
+
const [id, kind] = [values[index], kinds[index]];
|
|
96
|
+
return id === undefined || kind === undefined
|
|
97
|
+
? run(context)
|
|
98
|
+
: onHolder(context, { id, kind }, run);
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
export const nodeLines = (nodes) => nodes
|
|
102
|
+
.map(({ error, nextCursor, node }) => {
|
|
103
|
+
if (error !== undefined)
|
|
104
|
+
return `error: ${node}: ${cell(error.message)}\n`;
|
|
105
|
+
return nextCursor === undefined
|
|
106
|
+
? ""
|
|
107
|
+
: `next: --node ${node} --after ${nextCursor}\n`;
|
|
108
|
+
})
|
|
109
|
+
.join("");
|
|
110
|
+
export const formatMerged = ({ items, nodes, }, row, { empty, headers }) => `${formatRows(items, (item) => `${item.node}\t${row(item)}`, {
|
|
111
|
+
empty,
|
|
112
|
+
headers: ["NODE", ...headers],
|
|
113
|
+
})}${nodeLines(nodes)}`;
|
|
114
|
+
export const writeMerged = (context, output, text) => {
|
|
115
|
+
const failed = failureOf(output.result.nodes);
|
|
116
|
+
writeSuccess(output, {
|
|
117
|
+
...context,
|
|
118
|
+
...(failed === undefined ? { ok: true } : { error: failed, ok: false }),
|
|
119
|
+
}, text);
|
|
120
|
+
return failed === undefined ? 0 : exitCodeOf(failed);
|
|
121
|
+
};
|
|
122
|
+
export const listEach = (context, { merged, paged, read, sole }) => Effect.map(readEach(context, read, paged), (answers) => {
|
|
123
|
+
if (!answers.ok)
|
|
124
|
+
return reportError(answers.error, context);
|
|
125
|
+
const [only, ...others] = answers.value;
|
|
126
|
+
return only !== undefined && others.length === 0
|
|
127
|
+
? sole(only.result)
|
|
128
|
+
: merged(answers.value);
|
|
129
|
+
});
|
|
130
|
+
//# sourceMappingURL=address-space.js.map
|