@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.
- package/README.md +8 -7
- package/dist/agents/client.d.ts +47 -27
- package/dist/agents/client.js +10 -3
- package/dist/agents/commands.d.ts +1 -0
- package/dist/agents/commands.js +24 -2
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.js +1 -1
- package/dist/agents/input.js +6 -0
- package/dist/agents/output/format.js +11 -0
- package/dist/agents/tree/tree.js +13 -1
- package/dist/bin/maia.cdx.json +19 -19
- package/dist/bin/maia.mjs +1 -1
- package/dist/cli/cli.d.ts +8 -2
- package/dist/cli/cli.js +29 -6
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/command-line/context.d.ts +4 -2
- package/dist/command-line/emit/index.d.ts +4 -0
- package/dist/command-line/emit/index.js +4 -0
- package/dist/command-line/{output.d.ts → emit/output.d.ts} +2 -2
- package/dist/command-line/{rows.d.ts → emit/rows.d.ts} +2 -0
- package/dist/command-line/{rows.js → emit/rows.js} +8 -0
- package/dist/command-line/index.d.ts +5 -5
- package/dist/command-line/index.js +5 -5
- package/dist/command-line/input/arguments.d.ts +10 -0
- package/dist/command-line/input/arguments.js +30 -10
- package/dist/command-line/input/index.d.ts +2 -1
- package/dist/command-line/input/index.js +2 -1
- package/dist/command-line/input/manager-options.d.ts +10 -0
- package/dist/command-line/input/manager-options.js +38 -0
- package/dist/command-line/two-phase/index.d.ts +2 -0
- package/dist/command-line/two-phase/index.js +2 -0
- package/dist/command-line/{two-phase.d.ts → two-phase/two-phase.d.ts} +12 -12
- package/dist/command-line/{two-phase.js → two-phase/two-phase.js} +2 -2
- package/dist/command-receipt/command.js +1 -1
- package/dist/command-tree/tree.d.ts +1 -1
- package/dist/command-tree/tree.js +6 -1
- package/dist/connection/input.js +2 -2
- package/dist/connection/system.js +3 -2
- package/dist/connection/tree/tree.js +5 -5
- package/dist/events/commands.js +65 -0
- package/dist/events/index.js +2 -0
- package/dist/events/tree/index.js +2 -0
- package/dist/events/tree/tree.js +17 -0
- package/dist/import/batch.js +196 -0
- package/dist/import/client.d.ts +3 -3
- package/dist/import/client.js +1 -1
- package/dist/import/commands.d.ts +1 -0
- package/dist/import/commands.js +82 -8
- package/dist/import/index.d.ts +1 -1
- package/dist/import/index.js +1 -1
- package/dist/import/input.js +38 -3
- package/dist/import/manifest.js +107 -0
- package/dist/import/output.js +46 -2
- package/dist/local-node/client.d.ts +1 -0
- package/dist/local-node/client.js +1 -0
- 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/gateway.js +2 -2
- package/dist/login/vendor-input.js +2 -2
- package/dist/mcp/calls.js +6 -1
- package/dist/mcp/routing.js +1 -0
- package/dist/project-guard/client.d.ts +12 -0
- package/dist/project-guard/input.js +15 -1
- package/dist/project-guard/output/format.js +5 -0
- package/dist/project-workspace/tree/tree.js +1 -1
- package/dist/reference/resolve.js +9 -2
- package/dist/remote-node/connector.js +8 -1
- package/dist/run-ledger/client.d.ts +2 -0
- package/dist/session/agent-permission.d.ts +2 -2
- package/dist/session/approval/client.d.ts +5 -2
- package/dist/session/approval/client.js +2 -2
- package/dist/session/approval/commands.d.ts +1 -0
- package/dist/session/approval/commands.js +97 -17
- package/dist/session/approval/index.d.ts +1 -1
- package/dist/session/approval/index.js +1 -1
- package/dist/session/client.d.ts +14 -3
- package/dist/session/client.js +17 -2
- package/dist/session/coding-client.d.ts +2 -0
- package/dist/session/coding-client.js +1 -2
- package/dist/session/coding-commands.js +24 -7
- package/dist/session/commands.d.ts +1 -0
- package/dist/session/commands.js +131 -18
- package/dist/session/create-tasks.js +10 -2
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.js +1 -1
- package/dist/session/output/human.js +32 -5
- package/dist/session/output/index.js +1 -1
- package/dist/session/output/tasks.js +51 -7
- package/dist/session/tree/tree.js +52 -19
- package/dist/session/turn/client.js +7 -9
- package/dist/session/turn/commands.js +67 -20
- package/dist/session/turn/output.d.ts +6 -0
- package/dist/session/turn/output.js +12 -2
- package/dist/status/client.d.ts +14 -3
- 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 +3 -0
- package/dist/status/output/compact.js +17 -7
- package/dist/status/output/human.js +15 -0
- package/dist/terminal/control-commands.js +26 -9
- package/dist/terminal/keys.js +62 -0
- package/dist/terminal/output/compact-list.js +3 -0
- package/dist/terminal/output/human.js +2 -2
- package/dist/terminal/tree/tree.js +1 -1
- package/dist/webhooks/client.d.ts +156 -0
- package/dist/webhooks/client.js +8 -0
- package/dist/webhooks/commands.d.ts +17 -0
- package/dist/webhooks/commands.js +76 -0
- package/dist/webhooks/index.d.ts +3 -0
- package/dist/webhooks/index.js +3 -0
- package/dist/webhooks/input.js +125 -0
- package/dist/webhooks/output/format.js +75 -0
- package/dist/webhooks/output/index.js +2 -0
- package/dist/webhooks/tree/index.js +2 -0
- package/dist/webhooks/tree/tree.js +49 -0
- package/guidance/maia-cli/SKILL.md +1 -1
- package/guidance/maia-node/SKILL.md +54 -0
- package/guidance/maia-orchestration/SKILL.md +1 -2
- package/guidance/maia-sessions/SKILL.md +69 -0
- package/package.json +5 -5
- package/dist/address-space/address-space.d.ts +0 -38
- package/dist/address-space/index.d.ts +0 -2
- package/dist/agents/input.d.ts +0 -130
- package/dist/agents/output/format.d.ts +0 -8
- package/dist/agents/output/index.d.ts +0 -2
- package/dist/agents/tree/index.d.ts +0 -2
- package/dist/agents/tree/tree.d.ts +0 -3
- package/dist/bootstrap/exit.d.ts +0 -14
- package/dist/bootstrap/exit.js +0 -42
- package/dist/bootstrap/index.d.ts +0 -3
- package/dist/bootstrap/index.js +0 -3
- package/dist/bootstrap/process.d.ts +0 -5
- package/dist/bootstrap/process.js +0 -23
- package/dist/bootstrap/run.d.ts +0 -25
- package/dist/bootstrap/run.js +0 -95
- package/dist/bootstrap/stdio.d.ts +0 -4
- package/dist/bootstrap/stdio.js +0 -9
- package/dist/cli/environment.d.ts +0 -8
- package/dist/cli/services.d.ts +0 -4
- package/dist/command-line/input/stdin-stream.d.ts +0 -4
- package/dist/command-line/json-decoder.d.ts +0 -3
- package/dist/command-receipt/command.d.ts +0 -4
- package/dist/command-receipt/compact-list.d.ts +0 -20
- package/dist/command-receipt/index.d.ts +0 -3
- package/dist/command-tree/completion.d.ts +0 -6
- package/dist/command-tree/local.d.ts +0 -3
- package/dist/command-tree/row.js +0 -2
- package/dist/connection/access/format.d.ts +0 -8
- package/dist/connection/access/input.d.ts +0 -53
- package/dist/connection/input.d.ts +0 -50
- package/dist/connection/signin.d.ts +0 -4
- package/dist/connection/tree/index.d.ts +0 -2
- package/dist/connection/tree/tree.d.ts +0 -3
- package/dist/container/output/format.d.ts +0 -11
- package/dist/container/output/index.d.ts +0 -2
- package/dist/context/client.d.ts +0 -7
- package/dist/context/commands.d.ts +0 -3
- package/dist/context/index.d.ts +0 -3
- package/dist/dashboard/cockpit-client.d.ts +0 -6
- package/dist/dashboard/cockpit-client.js +0 -27
- package/dist/dashboard/cockpits.d.ts +0 -29
- package/dist/dashboard/cockpits.js +0 -65
- package/dist/dashboard/dashboard.d.ts +0 -7
- package/dist/dashboard/draw.d.ts +0 -15
- package/dist/dashboard/frame.d.ts +0 -4
- package/dist/dashboard/index.d.ts +0 -2
- package/dist/dashboard/modes.d.ts +0 -5
- package/dist/dashboard/node-connection.d.ts +0 -15
- package/dist/dashboard/node-connection.js +0 -51
- package/dist/dashboard/pi-tui.d.ts +0 -6
- package/dist/dashboard/status-bar.d.ts +0 -4
- package/dist/dashboard/terminal.d.ts +0 -53
- package/dist/dashboard/tree-model.d.ts +0 -28
- package/dist/dashboard/tree.d.ts +0 -10
- package/dist/development/cli.d.ts +0 -3
- package/dist/development/cli.js +0 -44
- package/dist/execution/tree/index.d.ts +0 -2
- package/dist/execution/tree/tree.d.ts +0 -3
- package/dist/hold/output/format.d.ts +0 -11
- package/dist/hold/output/index.d.ts +0 -2
- package/dist/hold/tree/index.d.ts +0 -2
- package/dist/hold/tree/tree.d.ts +0 -3
- package/dist/import/input.d.ts +0 -16
- package/dist/import/output.d.ts +0 -6
- package/dist/integration/output.d.ts +0 -22
- package/dist/login/failure.d.ts +0 -3
- package/dist/login/gateway.d.ts +0 -12
- package/dist/login/menu.d.ts +0 -4
- package/dist/login/output/format.d.ts +0 -16
- package/dist/login/output/index.d.ts +0 -2
- package/dist/login/vendor-account.d.ts +0 -95
- package/dist/login/vendor-input.d.ts +0 -14
- package/dist/mcp/calls.d.ts +0 -8
- package/dist/orchestration/output/compact-aggregate.d.ts +0 -121
- package/dist/orchestration/output/compact-run-list.d.ts +0 -20
- package/dist/orchestration/output/human.d.ts +0 -80
- package/dist/orchestration/output/index.d.ts +0 -4
- package/dist/orchestration/tree/index.d.ts +0 -2
- package/dist/orchestration/tree/tree.d.ts +0 -3
- package/dist/port-lease/input.d.ts +0 -65
- package/dist/port-lease/output/format.d.ts +0 -11
- package/dist/port-lease/output/index.d.ts +0 -2
- package/dist/presentation/output/format.d.ts +0 -11
- package/dist/presentation/output/index.d.ts +0 -3
- package/dist/project-guard/input.d.ts +0 -18
- package/dist/project-guard/output/format.d.ts +0 -11
- package/dist/project-guard/output/index.d.ts +0 -2
- package/dist/project-workspace/output/human.d.ts +0 -139
- package/dist/project-workspace/output/index.d.ts +0 -3
- package/dist/project-workspace/output/metadata.d.ts +0 -11
- package/dist/project-workspace/tree/index.d.ts +0 -2
- package/dist/project-workspace/tree/tree.d.ts +0 -3
- package/dist/provider/client.d.ts +0 -6
- package/dist/provider/commands.d.ts +0 -3
- package/dist/provider/index.d.ts +0 -3
- package/dist/reference/commands.d.ts +0 -3
- package/dist/reference/index.d.ts +0 -3
- package/dist/reference/resolve.d.ts +0 -31
- package/dist/reference/tree/index.d.ts +0 -2
- package/dist/reference/tree/tree.d.ts +0 -3
- package/dist/remote-node/reachability.d.ts +0 -64
- package/dist/remote-node/text.d.ts +0 -10
- package/dist/remote-node/tree/index.d.ts +0 -2
- package/dist/remote-node/tree/tree.d.ts +0 -3
- package/dist/routine/input.d.ts +0 -28
- package/dist/routine/output/format.d.ts +0 -23
- package/dist/routine/output/index.d.ts +0 -2
- package/dist/routine/tree/index.d.ts +0 -2
- package/dist/routine/tree/tree.d.ts +0 -3
- package/dist/run-ledger/input.d.ts +0 -42
- package/dist/run-ledger/output/format.d.ts +0 -11
- package/dist/run-ledger/output/index.d.ts +0 -2
- package/dist/session/approval/output/format.d.ts +0 -23
- package/dist/session/approval/output/index.d.ts +0 -2
- package/dist/session/attach-render.d.ts +0 -16
- package/dist/session/create-tasks.d.ts +0 -20
- package/dist/session/interaction/input.d.ts +0 -15
- package/dist/session/interaction/output/format.d.ts +0 -11
- package/dist/session/interaction/output/index.d.ts +0 -2
- package/dist/session/output/diff.d.ts +0 -3
- package/dist/session/output/failure.d.ts +0 -11
- package/dist/session/output/human.d.ts +0 -112
- package/dist/session/output/index.d.ts +0 -6
- package/dist/session/output/observe.d.ts +0 -4
- package/dist/session/output/tasks.d.ts +0 -34
- package/dist/session/task-file.d.ts +0 -5
- package/dist/session/tree/index.d.ts +0 -2
- package/dist/session/tree/tree.d.ts +0 -3
- package/dist/team-workspace/ceremony.d.ts +0 -19
- package/dist/team-workspace/confirmation.d.ts +0 -4
- package/dist/team-workspace/dependencies.js +0 -2
- package/dist/team-workspace/output.d.ts +0 -15
- package/dist/terminal/arguments.d.ts +0 -13
- package/dist/terminal/output/compact-list.d.ts +0 -148
- package/dist/terminal/output/human.d.ts +0 -42
- package/dist/terminal/output/index.d.ts +0 -3
- package/dist/terminal/tree/index.d.ts +0 -2
- package/dist/terminal/tree/tree.d.ts +0 -3
- /package/dist/command-line/{json-decoder.js → emit/json-decoder.js} +0 -0
- /package/dist/command-line/{json.d.ts → emit/json.d.ts} +0 -0
- /package/dist/command-line/{json.js → emit/json.js} +0 -0
- /package/dist/command-line/{output.js → emit/output.js} +0 -0
|
@@ -18,7 +18,7 @@ export const SESSION_TREE = {
|
|
|
18
18
|
],
|
|
19
19
|
leaves: [
|
|
20
20
|
[
|
|
21
|
-
"session create (--workspace <workspace-id> | --project <project-id>) [--command-id <id>] [--role <worker|orchestrator>] [--connection <connection-id> [--executor <codex-cli|claude-code>] [--model <id>] | --executor <codex-cli|claude-code> | --agent <agent-id> | --agent-definition <key> --agent-definition-version <version> --agent-definition-digest <sha256>] [--effort <low|medium|high|xhigh|max|ultra>] [--base <branch-tag-or-commit>] [--title <text>] [--message <text> | --prompt-stdin | --from-file <path>]",
|
|
21
|
+
"session create (--workspace <workspace-id> | --project <project-id>) [--command-id <id>] [--role <worker|orchestrator>] [--connection <connection-id> [--executor <codex-cli|claude-code>] [--model <id>] | --executor <codex-cli|claude-code> | --agent <agent-id> | --agent-definition <key> --agent-definition-version <version> --agent-definition-digest <sha256>] [--effort <low|medium|high|xhigh|max|ultra>] [--base <branch-tag-or-commit> | --host-authority [--permission <mode>]] [--cwd <path>] [--title <text> | --name <text>] [--label <key=value>...] [--message <text> | --prompt-stdin | --from-file <path>]",
|
|
22
22
|
0,
|
|
23
23
|
"session.create",
|
|
24
24
|
"Create a Session, optionally starting it with a first message.",
|
|
@@ -29,7 +29,7 @@ export const SESSION_TREE = {
|
|
|
29
29
|
},
|
|
30
30
|
],
|
|
31
31
|
[
|
|
32
|
-
"session list (--project <project-id> | --all) [--state <state>[,<state>...]] [--attention] [--limit <1..100>] [--after <cursor>]",
|
|
32
|
+
"session list (--project <project-id> | --all) [--state <state>[,<state>...]] [--label <key=value>...] [--attention] [--settled [--idle-for <duration>]] [--limit <1..100>] [--after <cursor>]",
|
|
33
33
|
0,
|
|
34
34
|
"session.list",
|
|
35
35
|
"List Sessions of a Project, or all of them.",
|
|
@@ -50,11 +50,22 @@ export const SESSION_TREE = {
|
|
|
50
50
|
run: [session, "runSessionShow"],
|
|
51
51
|
},
|
|
52
52
|
],
|
|
53
|
+
[
|
|
54
|
+
"session wait <session-id> [--until <state>[,<state>...]] [--activity <activity>[,<activity>...]] [--timeout <duration>]",
|
|
55
|
+
1,
|
|
56
|
+
"session.wait",
|
|
57
|
+
"Wait for a state or activity; exits 74 on timeout.",
|
|
58
|
+
{
|
|
59
|
+
example: "maia --json session wait session_1 --activity idle,waiting_approval,stopped --timeout 10m",
|
|
60
|
+
route: "<session-id>",
|
|
61
|
+
run: [session, "runSessionWait"],
|
|
62
|
+
},
|
|
63
|
+
],
|
|
53
64
|
[
|
|
54
65
|
"session rename <session-id> --title <text> --expected-revision <revision> [--command-id <id>]",
|
|
55
66
|
1,
|
|
56
67
|
"session.rename",
|
|
57
|
-
"Rename a Session
|
|
68
|
+
"Rename a Session.",
|
|
58
69
|
{
|
|
59
70
|
example: "maia --json session rename session_1 --title 'Fix the build' --expected-revision 2",
|
|
60
71
|
route: "<session-id>",
|
|
@@ -91,7 +102,7 @@ export const SESSION_TREE = {
|
|
|
91
102
|
{ route: "<session-id>", run: [session, "runSessionResume"] },
|
|
92
103
|
],
|
|
93
104
|
[
|
|
94
|
-
"session archive <session-id> --expected-revision <revision> [--command-id <id>]",
|
|
105
|
+
"session archive <session-id> --expected-revision <revision> [--summary <text>] [--transcript <path>] [--command-id <id>]",
|
|
95
106
|
1,
|
|
96
107
|
"session.archive",
|
|
97
108
|
"Archive a Session and retire its worktree.",
|
|
@@ -105,7 +116,7 @@ export const SESSION_TREE = {
|
|
|
105
116
|
"session diff <session-id> [--stat]",
|
|
106
117
|
1,
|
|
107
118
|
"session.diff",
|
|
108
|
-
"Show
|
|
119
|
+
"Show a coding Session's changes.",
|
|
109
120
|
{
|
|
110
121
|
example: "maia session diff session_1 --stat",
|
|
111
122
|
route: "<session-id>",
|
|
@@ -126,7 +137,7 @@ export const SESSION_TREE = {
|
|
|
126
137
|
"session attach <session-id> [--after <epoch>:<sequence>] [--no-follow]",
|
|
127
138
|
1,
|
|
128
139
|
"session.attach",
|
|
129
|
-
"Follow
|
|
140
|
+
"Follow its live items.",
|
|
130
141
|
{
|
|
131
142
|
example: "maia session attach session_1",
|
|
132
143
|
route: "<session-id>",
|
|
@@ -151,16 +162,27 @@ export const SESSION_TREE = {
|
|
|
151
162
|
},
|
|
152
163
|
],
|
|
153
164
|
[
|
|
154
|
-
"session adopt (<claude|codex>:<native-id> --workspace <workspace-id> [--attest-ended] [--command-id <id>] [--dry-run] | --confirm-stdin)",
|
|
165
|
+
"session adopt (<claude|codex>:<native-id> --workspace <workspace-id> [--attest-ended] [--host-authority [--permission <mode>]] [--role <worker|orchestrator>] [--label <key=value>...] [--title <title>] [--command-id <id>] [--dry-run] | --confirm-stdin)",
|
|
155
166
|
1,
|
|
156
167
|
["session.adopt.preview", "session.adopt.confirm"],
|
|
157
|
-
"Adopt a Claude
|
|
168
|
+
"Adopt a Claude or Codex session after a preview.",
|
|
158
169
|
{
|
|
159
170
|
example: "maia --json session adopt codex:019a --workspace workspace_1 --dry-run",
|
|
160
171
|
kind: "two-phase",
|
|
161
172
|
run: [discovery, "runAdopt"],
|
|
162
173
|
},
|
|
163
174
|
],
|
|
175
|
+
[
|
|
176
|
+
"session import (--from <file> [--dry-run] | --confirm-stdin)",
|
|
177
|
+
1,
|
|
178
|
+
["session.adopt.preview", "session.adopt.confirm"],
|
|
179
|
+
"Adopt the sessions a file lists after one preview.",
|
|
180
|
+
{
|
|
181
|
+
example: "maia --json session import --from sessions.json --dry-run",
|
|
182
|
+
kind: "composite",
|
|
183
|
+
run: [discovery, "runImport"],
|
|
184
|
+
},
|
|
185
|
+
],
|
|
164
186
|
[
|
|
165
187
|
"session agent-permission set (--input-stdin --dry-run | --confirm-stdin)",
|
|
166
188
|
1,
|
|
@@ -190,12 +212,12 @@ export const SESSION_TREE = {
|
|
|
190
212
|
{ run: [session, "runSessionInboxAck"] },
|
|
191
213
|
],
|
|
192
214
|
[
|
|
193
|
-
"session turn send --session <session-id> --prompt-stdin --expected-revision <revision> [--command-id <id>]",
|
|
215
|
+
"session turn send --session <session-id> --prompt-stdin --expected-revision <revision> [--wait] [--command-id <id>]",
|
|
194
216
|
1,
|
|
195
217
|
"turn.send",
|
|
196
|
-
"Send a turn from stdin; it queues
|
|
218
|
+
"Send a turn from stdin; it queues. --wait returns once it is done.",
|
|
197
219
|
{
|
|
198
|
-
example: "printf %s 'Explain the build' | maia --json session turn send --session session_1 --prompt-stdin --expected-revision 2 --command-id send-1",
|
|
220
|
+
example: "printf %s 'Explain the build' | maia --json session turn send --session session_1 --prompt-stdin --expected-revision 2 --wait --command-id send-1",
|
|
199
221
|
route: "--session",
|
|
200
222
|
run: [turn, "runTurnSend"],
|
|
201
223
|
},
|
|
@@ -223,13 +245,13 @@ export const SESSION_TREE = {
|
|
|
223
245
|
},
|
|
224
246
|
],
|
|
225
247
|
[
|
|
226
|
-
"session turn show <turn-id> [--include-content]",
|
|
248
|
+
"session turn show (<turn-id> | --session <session-id> --latest) [--include-content]",
|
|
227
249
|
1,
|
|
228
250
|
"turn.show",
|
|
229
|
-
"Show
|
|
251
|
+
"Show a turn or a Session's latest turn; --include-content adds its text.",
|
|
230
252
|
{
|
|
231
|
-
example: "maia --json session turn show
|
|
232
|
-
route: "<turn-id>",
|
|
253
|
+
example: "maia --json session turn show --session session_1 --latest --include-content",
|
|
254
|
+
route: ["<turn-id>", "--session"],
|
|
233
255
|
run: [turn, "runTurnShow"],
|
|
234
256
|
},
|
|
235
257
|
],
|
|
@@ -274,7 +296,7 @@ export const SESSION_TREE = {
|
|
|
274
296
|
{ route: "<approval-id>", run: [approval, "runApprovalShow"] },
|
|
275
297
|
],
|
|
276
298
|
[
|
|
277
|
-
"session approval approve <approval-id> [--for-session] [--command-id <id>]",
|
|
299
|
+
"session approval approve <approval-id> [--for-session] [--as-coordinator] [--command-id <id>]",
|
|
278
300
|
1,
|
|
279
301
|
"approval.respond",
|
|
280
302
|
"Approve a worker's request.",
|
|
@@ -286,7 +308,7 @@ export const SESSION_TREE = {
|
|
|
286
308
|
},
|
|
287
309
|
],
|
|
288
310
|
[
|
|
289
|
-
"session approval deny <approval-id> [--reason <text>] [--command-id <id>]",
|
|
311
|
+
"session approval deny <approval-id> [--reason <text>] [--as-coordinator] [--command-id <id>]",
|
|
290
312
|
1,
|
|
291
313
|
"approval.respond",
|
|
292
314
|
"Deny a worker's request.",
|
|
@@ -297,7 +319,7 @@ export const SESSION_TREE = {
|
|
|
297
319
|
},
|
|
298
320
|
],
|
|
299
321
|
[
|
|
300
|
-
"session approval answer <approval-id> (--text <answer> | --option <option-id>) [--command-id <id>]",
|
|
322
|
+
"session approval answer <approval-id> (--text <answer> | --option <option-id>) [--as-coordinator] [--command-id <id>]",
|
|
301
323
|
1,
|
|
302
324
|
"approval.respond",
|
|
303
325
|
"Answer a worker's question.",
|
|
@@ -307,6 +329,17 @@ export const SESSION_TREE = {
|
|
|
307
329
|
run: [approval, "runApprovalAnswer"],
|
|
308
330
|
},
|
|
309
331
|
],
|
|
332
|
+
[
|
|
333
|
+
"session answer <session-id> <answer> --prompt <approval-id> [--as-coordinator] [--command-id <id>]",
|
|
334
|
+
1,
|
|
335
|
+
"approval.respond",
|
|
336
|
+
"Answer a Session's prompt.",
|
|
337
|
+
{
|
|
338
|
+
kind: "discriminant",
|
|
339
|
+
route: "<session-id>",
|
|
340
|
+
run: [approval, "runSessionAnswer"],
|
|
341
|
+
},
|
|
342
|
+
],
|
|
310
343
|
[
|
|
311
344
|
"session interaction create --input-stdin",
|
|
312
345
|
1,
|
|
@@ -343,7 +376,7 @@ export const SESSION_TREE = {
|
|
|
343
376
|
{ run: [interaction, "runInteractionCancel"] },
|
|
344
377
|
],
|
|
345
378
|
[
|
|
346
|
-
"import scan [--source claude,codex] [--since <days>d] [--root <path>] [--include-content] [--limit <1..100>] [--after <cursor>]",
|
|
379
|
+
"import scan [--source claude,codex] [--since <days>d] [--root <path>] [--running] [--adopted | --not-adopted] [--include-content] [--limit <1..100>] [--after <cursor>]",
|
|
347
380
|
1,
|
|
348
381
|
"discovery.sessions.list",
|
|
349
382
|
"Find Claude Code and Codex sessions to adopt.",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MAX_TURN_WAIT_MILLISECONDS, turnCancelParametersSchema, turnInterruptParametersSchema, turnQueueListParametersSchema, turnSendParametersSchema, turnShowParametersSchema, turnWaitParametersSchema, } from "@maiaos/sdk";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import { commandIdentifier, } from "../../local-node/index.js";
|
|
3
|
+
import { commandIdentifier, repeatBoundedWait, } from "../../local-node/index.js";
|
|
4
4
|
export const makeTurnClient = (node) => {
|
|
5
5
|
const interruptTurn = (input) => {
|
|
6
6
|
return Effect.flatMap(commandIdentifier(input.commandId), (commandId) => {
|
|
@@ -29,17 +29,15 @@ export const makeTurnClient = (node) => {
|
|
|
29
29
|
};
|
|
30
30
|
const showTurn = (turnId) => node.runValidatedNodeOperation({ turnId }, turnShowParametersSchema, (client, parameters, options) => client.showTurn(parameters, options));
|
|
31
31
|
const waitTurnsOnce = (parameters) => node.runValidatedNodeOperation(parameters, turnWaitParametersSchema, (client, validated, options) => client.waitTurns(validated, options));
|
|
32
|
-
const waitWithin = (input) =>
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const waitWithin = (input) => repeatBoundedWait({
|
|
33
|
+
maxRequestMilliseconds: MAX_TURN_WAIT_MILLISECONDS,
|
|
34
|
+
once: (waitMilliseconds) => waitTurnsOnce({
|
|
35
35
|
mode: input.mode,
|
|
36
36
|
turnIds: input.turnIds,
|
|
37
37
|
waitMilliseconds,
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return result;
|
|
42
|
-
return yield* waitWithin({ ...input, timeoutMilliseconds: remaining });
|
|
38
|
+
}),
|
|
39
|
+
satisfied: (value) => value.satisfied,
|
|
40
|
+
timeoutMilliseconds: input.timeoutMilliseconds,
|
|
43
41
|
});
|
|
44
42
|
return {
|
|
45
43
|
cancelTurn,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MAX_TURN_INPUT_BYTES, MAX_TURN_WAIT_IDS, } from "@maiaos/sdk";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
|
-
import { CliArgumentError, parseOptions,
|
|
4
|
-
import { formatTurnMutation, formatTurnQueue, formatTurnShow, formatTurnWait, turnWaitExitCode, } from "./output.js";
|
|
3
|
+
import { CliArgumentError, parseOptions, readExpectedRevision, readRevisionOption, readWaitTimeoutSeconds, reportError, requirePositionals, writeNodeResult, writeSuccess, } from "../../command-line/index.js";
|
|
4
|
+
import { formatTurnMutation, formatTurnQueue, formatTurnSend, formatTurnShow, formatTurnWait, turnWaitExitCode, } from "./output.js";
|
|
5
5
|
const utf8 = new TextEncoder();
|
|
6
6
|
const summarizeTurnMutation = (result) => ({
|
|
7
7
|
delivery: result.delivery,
|
|
@@ -11,8 +11,9 @@ const summarizeTurnMutation = (result) => ({
|
|
|
11
11
|
state: result.turn.state,
|
|
12
12
|
turnId: result.turn.id,
|
|
13
13
|
});
|
|
14
|
+
const SEND_WAIT_MILLISECONDS = 24 * 60 * 60 * 1000;
|
|
14
15
|
const parseTurnSendArguments = (tokens) => {
|
|
15
|
-
const parsed = parseOptions(tokens, new Set(["--command-id", "--expected-revision", "--session"]), new Set(["--prompt-stdin"]));
|
|
16
|
+
const parsed = parseOptions(tokens, new Set(["--command-id", "--expected-revision", "--session"]), new Set(["--prompt-stdin", "--wait"]));
|
|
16
17
|
requirePositionals(parsed.positionals, 0);
|
|
17
18
|
const sessionId = parsed.options.get("--session");
|
|
18
19
|
if (sessionId === undefined) {
|
|
@@ -25,9 +26,31 @@ const parseTurnSendArguments = (tokens) => {
|
|
|
25
26
|
return {
|
|
26
27
|
expectedRevision: readExpectedRevision(parsed.options.get("--expected-revision")),
|
|
27
28
|
sessionId,
|
|
29
|
+
wait: parsed.flags.has("--wait"),
|
|
28
30
|
...(commandId === undefined ? {} : { commandId }),
|
|
29
31
|
};
|
|
30
32
|
};
|
|
33
|
+
const waitFailure = (turnId, error) => ({
|
|
34
|
+
...error,
|
|
35
|
+
message: `Turn ${turnId} was accepted, but waiting for it failed: ${error.message} Follow it with 'maia session turn wait ${turnId}'.`,
|
|
36
|
+
});
|
|
37
|
+
const waitForSentTurn = (context, sent) => Effect.gen(function* () {
|
|
38
|
+
const { waitTurns } = context.dependencies;
|
|
39
|
+
if (waitTurns === undefined)
|
|
40
|
+
throw new CliArgumentError("Turn wait is unavailable.");
|
|
41
|
+
const waited = yield* waitTurns({
|
|
42
|
+
mode: "all",
|
|
43
|
+
timeoutMilliseconds: SEND_WAIT_MILLISECONDS,
|
|
44
|
+
turnIds: [sent.turn.id],
|
|
45
|
+
});
|
|
46
|
+
if (!waited.ok)
|
|
47
|
+
return reportError(waitFailure(sent.turn.id, waited.error), context);
|
|
48
|
+
writeSuccess({
|
|
49
|
+
command: "turn.send",
|
|
50
|
+
result: { ...summarizeTurnMutation(sent), wait: waited.value },
|
|
51
|
+
}, context, formatTurnSend);
|
|
52
|
+
return turnWaitExitCode(waited.value);
|
|
53
|
+
});
|
|
31
54
|
export const runTurnSend = (tokens, context) => Effect.gen(function* () {
|
|
32
55
|
const input = parseTurnSendArguments(tokens);
|
|
33
56
|
if (context.io.stdin === undefined) {
|
|
@@ -38,14 +61,21 @@ export const runTurnSend = (tokens, context) => Effect.gen(function* () {
|
|
|
38
61
|
maxBytes: MAX_TURN_INPUT_BYTES,
|
|
39
62
|
maxChunks: 1024,
|
|
40
63
|
});
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}),
|
|
47
|
-
toText: formatTurnMutation,
|
|
64
|
+
const sent = yield* context.dependencies.sendTurn({
|
|
65
|
+
...(input.commandId === undefined ? {} : { commandId: input.commandId }),
|
|
66
|
+
expectedRevision: input.expectedRevision,
|
|
67
|
+
prompt,
|
|
68
|
+
sessionId: input.sessionId,
|
|
48
69
|
});
|
|
70
|
+
if (!sent.ok || !input.wait)
|
|
71
|
+
return writeNodeResult(sent, context, {
|
|
72
|
+
toResult: (value) => ({
|
|
73
|
+
command: "turn.send",
|
|
74
|
+
result: summarizeTurnMutation(value),
|
|
75
|
+
}),
|
|
76
|
+
toText: formatTurnSend,
|
|
77
|
+
});
|
|
78
|
+
return yield* waitForSentTurn(context, sent.value);
|
|
49
79
|
});
|
|
50
80
|
const parseTurnMutationArguments = (tokens, revisionOption) => {
|
|
51
81
|
const parsed = parseOptions(tokens, new Set(["--command-id", revisionOption]));
|
|
@@ -106,14 +136,21 @@ export const runTurnQueue = (tokens, context) => Effect.gen(function* () {
|
|
|
106
136
|
});
|
|
107
137
|
});
|
|
108
138
|
const parseTurnShowArguments = (tokens) => {
|
|
109
|
-
const parsed = parseOptions(tokens, new Set(), new Set(["--include-content"]));
|
|
110
|
-
requirePositionals(parsed.positionals, 1);
|
|
139
|
+
const parsed = parseOptions(tokens, new Set(["--session"]), new Set(["--include-content", "--latest"]));
|
|
111
140
|
const includeContent = parsed.flags.has("--include-content");
|
|
141
|
+
const sessionId = parsed.options.get("--session");
|
|
142
|
+
if (sessionId !== undefined || parsed.flags.has("--latest")) {
|
|
143
|
+
if (sessionId === undefined || !parsed.flags.has("--latest"))
|
|
144
|
+
throw new CliArgumentError("Use '--session' and '--latest' together.");
|
|
145
|
+
requirePositionals(parsed.positionals, 0);
|
|
146
|
+
return { includeContent, target: { sessionId, type: "latest" } };
|
|
147
|
+
}
|
|
148
|
+
requirePositionals(parsed.positionals, 1);
|
|
112
149
|
const turnId = parsed.positionals[0];
|
|
113
150
|
if (turnId === undefined) {
|
|
114
151
|
throw new CliArgumentError("The turn identifier is missing.");
|
|
115
152
|
}
|
|
116
|
-
return { includeContent, turnId };
|
|
153
|
+
return { includeContent, target: { turnId, type: "turn" } };
|
|
117
154
|
};
|
|
118
155
|
const turnTerminalProjection = (turn) => {
|
|
119
156
|
if (turn.state === "completed") {
|
|
@@ -145,22 +182,32 @@ const projectTurnWithoutContent = (value) => ({
|
|
|
145
182
|
const summarizeTurnShow = (value, includeContent) => includeContent
|
|
146
183
|
? { ...value, contentIncluded: true }
|
|
147
184
|
: projectTurnWithoutContent(value);
|
|
185
|
+
const turnToShow = (context, target) => {
|
|
186
|
+
const { showSession, showTurn } = context.dependencies;
|
|
187
|
+
if (target.type === "turn")
|
|
188
|
+
return showTurn(target.turnId);
|
|
189
|
+
return Effect.flatMap(showSession(target.sessionId), (shown) => {
|
|
190
|
+
if (!shown.ok)
|
|
191
|
+
return Effect.succeed({ error: shown.error, ok: false });
|
|
192
|
+
const { latestTurnId } = shown.value.session;
|
|
193
|
+
return latestTurnId === undefined
|
|
194
|
+
? Effect.succeed({ ok: true, value: undefined })
|
|
195
|
+
: showTurn(latestTurnId);
|
|
196
|
+
});
|
|
197
|
+
};
|
|
148
198
|
export const runTurnShow = (tokens, context) => Effect.gen(function* () {
|
|
149
199
|
const input = parseTurnShowArguments(tokens);
|
|
150
|
-
const result = yield* context
|
|
200
|
+
const result = yield* turnToShow(context, input.target);
|
|
151
201
|
return writeNodeResult(result, context, {
|
|
152
202
|
toResult: (value) => ({
|
|
153
203
|
command: "turn.show",
|
|
154
|
-
result:
|
|
204
|
+
result: value === undefined
|
|
205
|
+
? { contentIncluded: false, method: "turn.show" }
|
|
206
|
+
: summarizeTurnShow(value, input.includeContent),
|
|
155
207
|
}),
|
|
156
208
|
toText: formatTurnShow,
|
|
157
209
|
});
|
|
158
210
|
});
|
|
159
|
-
const DEFAULT_TURN_WAIT_SECONDS = 600;
|
|
160
|
-
const MAX_TURN_WAIT_SECONDS = 86_400;
|
|
161
|
-
const readWaitTimeoutSeconds = (value) => value === undefined
|
|
162
|
-
? DEFAULT_TURN_WAIT_SECONDS
|
|
163
|
-
: readDuration(value, "--timeout", { max: MAX_TURN_WAIT_SECONDS, min: 1 });
|
|
164
211
|
const parseTurnWaitArguments = (tokens) => {
|
|
165
212
|
const parsed = parseOptions(tokens, new Set(["--timeout"]), new Set(["--any"]));
|
|
166
213
|
if (parsed.positionals.length === 0 ||
|
|
@@ -8,6 +8,7 @@ export type CliTurnMutation = {
|
|
|
8
8
|
readonly sessionId: string;
|
|
9
9
|
readonly state: TurnInterruptResult["turn"]["state"];
|
|
10
10
|
readonly turnId: string;
|
|
11
|
+
readonly wait?: TurnWaitResult;
|
|
11
12
|
};
|
|
12
13
|
};
|
|
13
14
|
export type CliTurnShow = {
|
|
@@ -29,6 +30,10 @@ export type CliTurnShow = {
|
|
|
29
30
|
readonly state: TurnShowResult["turn"]["state"];
|
|
30
31
|
readonly tokenUsage?: TurnTokenUsage;
|
|
31
32
|
};
|
|
33
|
+
} | {
|
|
34
|
+
readonly contentIncluded: false;
|
|
35
|
+
readonly method: "turn.show";
|
|
36
|
+
readonly turn?: undefined;
|
|
32
37
|
};
|
|
33
38
|
};
|
|
34
39
|
export type CliTurnWait = {
|
|
@@ -40,6 +45,7 @@ export type CliTurnQueue = {
|
|
|
40
45
|
readonly result: TurnQueueListResult;
|
|
41
46
|
};
|
|
42
47
|
export declare const formatTurnMutation: ({ result }: CliTurnMutation) => string;
|
|
48
|
+
export declare const formatTurnSend: (output: CliTurnMutation) => string;
|
|
43
49
|
export declare const formatTurnQueue: ({ result }: CliTurnQueue) => string;
|
|
44
50
|
export declare const formatTurnShow: ({ result }: CliTurnShow) => string;
|
|
45
51
|
export declare const formatTurnWait: ({ result }: CliTurnWait) => string;
|
|
@@ -5,6 +5,9 @@ export const formatTurnMutation = ({ result }) => fields([
|
|
|
5
5
|
["state", result.state],
|
|
6
6
|
["revision", result.revision],
|
|
7
7
|
]);
|
|
8
|
+
export const formatTurnSend = (output) => output.result.wait === undefined
|
|
9
|
+
? formatTurnMutation(output)
|
|
10
|
+
: formatTurnWait({ command: "turn.wait", result: output.result.wait });
|
|
8
11
|
const turnFields = (turn, reason) => fields([
|
|
9
12
|
["turn", turn.id],
|
|
10
13
|
["state", turn.state],
|
|
@@ -31,13 +34,20 @@ export const formatTurnQueue = ({ result }) => {
|
|
|
31
34
|
headers: ["POSITION", "STATE", "TURN", "REVISION", "INPUT"],
|
|
32
35
|
});
|
|
33
36
|
};
|
|
37
|
+
const formatContext = (usage) => usage.contextTokens === undefined || usage.contextWindow === undefined
|
|
38
|
+
? ""
|
|
39
|
+
: `context: ${String(usage.contextTokens)} of ${String(usage.contextWindow)} tokens (${String(Math.round((100 * usage.contextTokens) / usage.contextWindow))}%)\n`;
|
|
34
40
|
const formatUsage = (usage) => usage === undefined
|
|
35
41
|
? ""
|
|
36
|
-
: `tokens: input ${String(usage.inputTokens)} (cached ${String(usage.cachedInputTokens)}), output ${String(usage.outputTokens)} (reasoning ${String(usage.reasoningOutputTokens)}), total ${String(usage.totalTokens)}${usage.modelCallCount === undefined ? "" : `, model calls ${String(usage.modelCallCount)}`}\n`;
|
|
42
|
+
: `tokens: input ${String(usage.inputTokens)} (cached ${String(usage.cachedInputTokens)}), output ${String(usage.outputTokens)} (reasoning ${String(usage.reasoningOutputTokens)}), total ${String(usage.totalTokens)}${usage.modelCallCount === undefined ? "" : `, model calls ${String(usage.modelCallCount)}`}\n${formatContext(usage)}`;
|
|
37
43
|
const formatContent = (turn) => `input:\n${block(turn.input.text)}\n${turn.state === "completed" ? `response:\n${block(turn.responseText)}\n` : ""}`;
|
|
38
|
-
const shownContent = (result) => result.contentIncluded
|
|
44
|
+
const shownContent = (result) => result.contentIncluded && result.turn !== undefined
|
|
45
|
+
? formatContent(result.turn)
|
|
46
|
+
: "";
|
|
39
47
|
export const formatTurnShow = ({ result }) => {
|
|
40
48
|
const { turn } = result;
|
|
49
|
+
if (turn === undefined)
|
|
50
|
+
return "no turn with output yet\n";
|
|
41
51
|
const failure = "failure" in turn &&
|
|
42
52
|
(turn.state === "failed" || turn.state === "outcome-unknown")
|
|
43
53
|
? formatFailure(turn.failure, turn.state)
|
package/dist/status/client.d.ts
CHANGED
|
@@ -8,11 +8,17 @@ export declare const makeStatusClient: (node: CliNodeOperations) => {
|
|
|
8
8
|
readonly pid: number;
|
|
9
9
|
readonly profile: string;
|
|
10
10
|
readonly startedAt: string;
|
|
11
|
+
readonly admissionCaps?: {
|
|
12
|
+
readonly defaultAccountSessions: number;
|
|
13
|
+
readonly maximumActiveSessions: number;
|
|
14
|
+
} | undefined;
|
|
11
15
|
readonly executorHost?: {
|
|
12
16
|
readonly bubblewrap: "found" | "missing";
|
|
13
17
|
readonly socat: "found" | "missing";
|
|
14
18
|
readonly userNamespaces: "allowed" | "no_nesting" | "restricted";
|
|
15
19
|
} | undefined;
|
|
20
|
+
readonly headlessApprovals?: "off" | "on" | undefined;
|
|
21
|
+
readonly hostAuthority?: "disabled" | "enabled" | undefined;
|
|
16
22
|
readonly method: "node.status";
|
|
17
23
|
readonly processResources: {
|
|
18
24
|
readonly activeTrees: number;
|
|
@@ -47,7 +53,7 @@ export declare const makeStatusClient: (node: CliNodeOperations) => {
|
|
|
47
53
|
};
|
|
48
54
|
readonly cleanupUnknownTrees: number;
|
|
49
55
|
readonly fencedTrees: number;
|
|
50
|
-
readonly nextStep: "close_idle_terminal" | "inspect_cleanup_unknown" | "inspect_observed_pressure" | "none" | "run_node_in_delegated_cgroup" | "verify_native_host";
|
|
56
|
+
readonly nextStep: "close_idle_terminal" | "inspect_cleanup_unknown" | "inspect_observed_pressure" | "none" | "run_node_in_delegated_cgroup" | "upgrade_kernel" | "verify_native_host";
|
|
51
57
|
readonly observations: {
|
|
52
58
|
readonly cpuTimeMilliseconds: {
|
|
53
59
|
readonly availableTrees: number;
|
|
@@ -107,14 +113,19 @@ export declare const makeStatusClient: (node: CliNodeOperations) => {
|
|
|
107
113
|
};
|
|
108
114
|
readonly treeCount: number;
|
|
109
115
|
};
|
|
110
|
-
readonly pressure: "admission_degraded" | "cgroup_delegation_unavailable" | "cleanup_unknown" | "healthy" | "observed_pressure" | "warning";
|
|
116
|
+
readonly pressure: "admission_degraded" | "cgroup_delegation_unavailable" | "cleanup_unknown" | "healthy" | "landlock_scoped_unavailable" | "observed_pressure" | "warning";
|
|
111
117
|
readonly supervision: {
|
|
112
118
|
readonly trackedTrees: number;
|
|
113
119
|
readonly watcherFibers: number;
|
|
114
120
|
};
|
|
115
121
|
};
|
|
116
122
|
readonly storage: {
|
|
117
|
-
readonly
|
|
123
|
+
readonly events?: {
|
|
124
|
+
readonly checkpointBlocked?: boolean | undefined;
|
|
125
|
+
readonly excessBytes: number;
|
|
126
|
+
readonly oldestAgeMs?: number | undefined;
|
|
127
|
+
} | undefined;
|
|
128
|
+
readonly integrity: "ok" | "unavailable";
|
|
118
129
|
readonly journalMode: "wal";
|
|
119
130
|
readonly schemaTag: string;
|
|
120
131
|
readonly schemaVersion: number;
|
package/dist/status/command.js
CHANGED
|
@@ -14,7 +14,9 @@ const unavailableError = (cause) => {
|
|
|
14
14
|
const remote = Predicate.hasProperty(error, "remoteError")
|
|
15
15
|
? protocolErrorSchema.safeParse(error.remoteError)
|
|
16
16
|
: undefined;
|
|
17
|
-
return remote?.success === true &&
|
|
17
|
+
return remote?.success === true &&
|
|
18
|
+
(remote.data.code === "node_unavailable" ||
|
|
19
|
+
remote.data.code === "invalid_argument")
|
|
18
20
|
? remote.data
|
|
19
21
|
: createUnavailableError();
|
|
20
22
|
};
|
package/dist/status/doctor.d.ts
CHANGED
|
@@ -5,9 +5,13 @@ export type DoctorCheck = {
|
|
|
5
5
|
readonly next?: string;
|
|
6
6
|
readonly ok: boolean;
|
|
7
7
|
};
|
|
8
|
+
export type DoctorScope = "machine" | "node";
|
|
8
9
|
export type CliDoctorResult = {
|
|
9
|
-
readonly checks: readonly DoctorCheck
|
|
10
|
+
readonly checks: readonly (DoctorCheck & {
|
|
11
|
+
readonly scope: DoctorScope;
|
|
12
|
+
})[];
|
|
10
13
|
readonly command: "doctor";
|
|
14
|
+
readonly node?: string;
|
|
11
15
|
readonly ok: boolean;
|
|
12
16
|
readonly version: string;
|
|
13
17
|
};
|
package/dist/status/doctor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import * as Option from "effect/Option";
|
|
3
|
-
import { requireNoArguments, writeSuccess, } from "../command-line/index.js";
|
|
3
|
+
import { LOCAL_NODE, requireNoArguments, writeSuccess, } from "../command-line/index.js";
|
|
4
4
|
const EXIT_FAILED = 70;
|
|
5
5
|
const vendorWords = (executor) => executor === "codex-cli"
|
|
6
6
|
? { integration: "codex", login: "codex" }
|
|
@@ -71,8 +71,8 @@ const nodeChecks = (detected, connections) => {
|
|
|
71
71
|
]),
|
|
72
72
|
];
|
|
73
73
|
};
|
|
74
|
-
const formatDoctor = (result) => `Maia doctor ${result.ok ? "ok" : "failed"}\n${result.checks
|
|
75
|
-
.map((check) => ` ${check.code}: ${check.ok ? "ok" : "failed"}${check.detail === undefined ? "" : ` (${check.detail})`}${check.ok || check.next === undefined ? "" : `; next: ${check.next}`}\n`)
|
|
74
|
+
const formatDoctor = (result) => `Maia doctor ${result.ok ? "ok" : "failed"}${result.node === undefined ? "" : ` (Node ${result.node})`}\n${result.checks
|
|
75
|
+
.map((check) => ` ${check.code}${check.scope === "machine" ? " (this machine)" : ""}: ${check.ok ? "ok" : "failed"}${check.detail === undefined ? "" : ` (${check.detail})`}${check.ok || check.next === undefined ? "" : `; next: ${check.next}`}\n`)
|
|
76
76
|
.join("")}`;
|
|
77
77
|
const readLifecycle = (dependencies) => Effect.map(Effect.option(Effect.map(Effect.suspend(() => dependencies.readStatus()), (node) => node.lifecycle)), Option.getOrUndefined);
|
|
78
78
|
const nodeCheck = (lifecycle) => lifecycle === undefined
|
|
@@ -100,8 +100,14 @@ export const runDoctor = (tokens, context) => Effect.gen(function* () {
|
|
|
100
100
|
const checks = yield* readChecks(context);
|
|
101
101
|
const ok = checks.every((check) => check.ok);
|
|
102
102
|
const result = {
|
|
103
|
-
checks
|
|
103
|
+
checks: checks.map((check) => ({
|
|
104
|
+
...check,
|
|
105
|
+
scope: check.code === "cli" ? "machine" : "node",
|
|
106
|
+
})),
|
|
104
107
|
command: "doctor",
|
|
108
|
+
...(context.node === undefined || context.node === LOCAL_NODE
|
|
109
|
+
? {}
|
|
110
|
+
: { node: context.node }),
|
|
105
111
|
ok,
|
|
106
112
|
version: context.version,
|
|
107
113
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { LocalNodeStatusResult } from "@maiaos/sdk";
|
|
2
2
|
export declare const sumObservationWarningTrees: (observations: LocalNodeStatusResult["processResources"]["observations"]) => number;
|
|
3
3
|
export type CliCompactStatusResult = {
|
|
4
|
+
readonly admissionCaps?: LocalNodeStatusResult["admissionCaps"];
|
|
4
5
|
readonly command: "status";
|
|
5
6
|
readonly executorHost?: LocalNodeStatusResult["executorHost"];
|
|
7
|
+
readonly hostAuthority?: LocalNodeStatusResult["hostAuthority"];
|
|
6
8
|
readonly instanceId: LocalNodeStatusResult["instanceId"];
|
|
7
9
|
readonly lifecycle: LocalNodeStatusResult["lifecycle"];
|
|
8
10
|
readonly pid: LocalNodeStatusResult["pid"];
|
|
@@ -23,6 +25,7 @@ export type CliCompactStatusResult = {
|
|
|
23
25
|
};
|
|
24
26
|
readonly profile: LocalNodeStatusResult["profile"];
|
|
25
27
|
readonly storage: {
|
|
28
|
+
readonly events?: LocalNodeStatusResult["storage"]["events"];
|
|
26
29
|
readonly integrity: LocalNodeStatusResult["storage"]["integrity"];
|
|
27
30
|
readonly journalMode: LocalNodeStatusResult["storage"]["journalMode"];
|
|
28
31
|
readonly schemaVersion: LocalNodeStatusResult["storage"]["schemaVersion"];
|
|
@@ -24,23 +24,33 @@ const projectStatusCapability = (capability) => ({
|
|
|
24
24
|
mode: capability.mode,
|
|
25
25
|
releaseQualified: capability.releaseQualified,
|
|
26
26
|
});
|
|
27
|
+
const projectProcessResources = (node) => ({
|
|
28
|
+
admission: projectStatusAdmission(node.processResources.admission),
|
|
29
|
+
capability: projectStatusCapability(node.processResources.capability),
|
|
30
|
+
nextStep: node.processResources.nextStep,
|
|
31
|
+
pressure: node.processResources.pressure,
|
|
32
|
+
warningTrees: sumObservationWarningTrees(node.processResources.observations),
|
|
33
|
+
});
|
|
27
34
|
export const projectStatusResult = (node) => ({
|
|
28
35
|
command: "status",
|
|
36
|
+
...(node.admissionCaps === undefined
|
|
37
|
+
? {}
|
|
38
|
+
: { admissionCaps: node.admissionCaps }),
|
|
29
39
|
...(node.executorHost === undefined
|
|
30
40
|
? {}
|
|
31
41
|
: { executorHost: node.executorHost }),
|
|
42
|
+
...(node.hostAuthority === undefined
|
|
43
|
+
? {}
|
|
44
|
+
: { hostAuthority: node.hostAuthority }),
|
|
32
45
|
instanceId: node.instanceId,
|
|
33
46
|
lifecycle: node.lifecycle,
|
|
34
47
|
pid: node.pid,
|
|
35
|
-
processResources:
|
|
36
|
-
admission: projectStatusAdmission(node.processResources.admission),
|
|
37
|
-
capability: projectStatusCapability(node.processResources.capability),
|
|
38
|
-
nextStep: node.processResources.nextStep,
|
|
39
|
-
pressure: node.processResources.pressure,
|
|
40
|
-
warningTrees: sumObservationWarningTrees(node.processResources.observations),
|
|
41
|
-
},
|
|
48
|
+
processResources: projectProcessResources(node),
|
|
42
49
|
profile: node.profile,
|
|
43
50
|
storage: {
|
|
51
|
+
...(node.storage.events === undefined
|
|
52
|
+
? {}
|
|
53
|
+
: { events: node.storage.events }),
|
|
44
54
|
integrity: node.storage.integrity,
|
|
45
55
|
journalMode: node.storage.journalMode,
|
|
46
56
|
schemaVersion: node.storage.schemaVersion,
|
|
@@ -10,6 +10,8 @@ const processResourceNextStep = (nextStep) => {
|
|
|
10
10
|
return "none";
|
|
11
11
|
case "run_node_in_delegated_cgroup":
|
|
12
12
|
return "restart the Node in a cgroup delegated to its user: a systemd user unit with Delegate=yes and DelegateSubgroup=node, or systemd-run --user -p Delegate=yes -p DelegateSubgroup=node";
|
|
13
|
+
case "upgrade_kernel":
|
|
14
|
+
return "upgrade the Linux kernel to 6.12 or newer";
|
|
13
15
|
case "verify_native_host":
|
|
14
16
|
return "verify the native process host";
|
|
15
17
|
}
|
|
@@ -73,12 +75,25 @@ const executorHostLines = (host) => {
|
|
|
73
75
|
userNamespaces[host.userNamespaces],
|
|
74
76
|
];
|
|
75
77
|
};
|
|
78
|
+
const eventLines = (events) => events === undefined
|
|
79
|
+
? []
|
|
80
|
+
: [
|
|
81
|
+
`events: ${String(events.excessBytes)} bytes over limit` +
|
|
82
|
+
(events.oldestAgeMs === undefined
|
|
83
|
+
? ""
|
|
84
|
+
: `, oldest ${String(Math.floor(events.oldestAgeMs / 3_600_000))} h`) +
|
|
85
|
+
(events.checkpointBlocked === true ? ", checkpoint blocked" : ""),
|
|
86
|
+
];
|
|
76
87
|
export const formatHumanStatus = ({ node }) => {
|
|
77
88
|
const lines = [
|
|
78
89
|
`profile: ${node.profile}`,
|
|
79
90
|
`pid: ${String(node.pid)}`,
|
|
80
91
|
`instance: ${node.instanceId}`,
|
|
81
92
|
`storage: ${node.storage.integrity} (${node.storage.journalMode})`,
|
|
93
|
+
...(node.hostAuthority === undefined
|
|
94
|
+
? []
|
|
95
|
+
: [`host authority: ${node.hostAuthority}`]),
|
|
96
|
+
...eventLines(node.storage.events),
|
|
82
97
|
...processResourceLines(node.processResources),
|
|
83
98
|
...executorHostLines(node.executorHost),
|
|
84
99
|
];
|