@maiaos/cli 0.1.0-canary.2
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 +287 -0
- package/dist/bin/maia.NOTICES.txt +59 -0
- package/dist/bin/maia.cdx.json +145 -0
- package/dist/bin/maia.mjs +2 -0
- package/dist/bootstrap/index.d.ts +3 -0
- package/dist/bootstrap/index.js +3 -0
- package/dist/bootstrap/process.d.ts +5 -0
- package/dist/bootstrap/process.js +45 -0
- package/dist/bootstrap/run.d.ts +25 -0
- package/dist/bootstrap/run.js +95 -0
- package/dist/bootstrap/stdio.d.ts +4 -0
- package/dist/bootstrap/stdio.js +9 -0
- package/dist/cli/cli.d.ts +17 -0
- package/dist/cli/cli.js +481 -0
- package/dist/cli/environment.d.ts +8 -0
- package/dist/cli/environment.js +12 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/services.d.ts +4 -0
- package/dist/cli/services.js +4 -0
- package/dist/command-line/context.d.ts +178 -0
- package/dist/command-line/context.js +2 -0
- package/dist/command-line/index.d.ts +7 -0
- package/dist/command-line/index.js +6 -0
- package/dist/command-line/input/arguments.d.ts +55 -0
- package/dist/command-line/input/arguments.js +220 -0
- package/dist/command-line/input/index.d.ts +4 -0
- package/dist/command-line/input/index.js +4 -0
- package/dist/command-line/input/prompt.d.ts +8 -0
- package/dist/command-line/input/prompt.js +44 -0
- package/dist/command-line/input/stdin-stream.d.ts +4 -0
- package/dist/command-line/input/stdin-stream.js +3 -0
- package/dist/command-line/input/stdin.d.ts +11 -0
- package/dist/command-line/input/stdin.js +23 -0
- package/dist/command-line/json-decoder.d.ts +3 -0
- package/dist/command-line/json-decoder.js +3 -0
- package/dist/command-line/json.d.ts +3 -0
- package/dist/command-line/json.js +4 -0
- package/dist/command-line/output.d.ts +57 -0
- package/dist/command-line/output.js +94 -0
- package/dist/command-line/rows.d.ts +10 -0
- package/dist/command-line/rows.js +32 -0
- package/dist/command-line/two-phase.d.ts +57 -0
- package/dist/command-line/two-phase.js +148 -0
- package/dist/command-receipt/command.d.ts +4 -0
- package/dist/command-receipt/command.js +59 -0
- package/dist/command-receipt/compact-list.d.ts +20 -0
- package/dist/command-receipt/compact-list.js +29 -0
- package/dist/command-receipt/index.d.ts +3 -0
- package/dist/command-receipt/index.js +3 -0
- package/dist/command-tree/commands.d.ts +17 -0
- package/dist/command-tree/commands.js +41 -0
- package/dist/command-tree/completion.d.ts +6 -0
- package/dist/command-tree/completion.js +36 -0
- package/dist/command-tree/grammar.d.ts +18 -0
- package/dist/command-tree/grammar.js +160 -0
- package/dist/command-tree/help.d.ts +62 -0
- package/dist/command-tree/help.js +219 -0
- package/dist/command-tree/index.d.ts +8 -0
- package/dist/command-tree/index.js +6 -0
- package/dist/command-tree/local.d.ts +3 -0
- package/dist/command-tree/local.js +126 -0
- package/dist/command-tree/placeholder.d.ts +3 -0
- package/dist/command-tree/placeholder.js +4 -0
- package/dist/command-tree/row.d.ts +29 -0
- package/dist/command-tree/row.js +2 -0
- package/dist/command-tree/suggest.d.ts +3 -0
- package/dist/command-tree/suggest.js +81 -0
- package/dist/command-tree/tree.d.ts +34 -0
- package/dist/command-tree/tree.js +124 -0
- package/dist/connection/client.d.ts +692 -0
- package/dist/connection/client.js +28 -0
- package/dist/connection/commands.d.ts +15 -0
- package/dist/connection/commands.js +118 -0
- package/dist/connection/index.d.ts +7 -0
- package/dist/connection/index.js +7 -0
- package/dist/connection/input.d.ts +50 -0
- package/dist/connection/input.js +90 -0
- package/dist/connection/login.d.ts +13 -0
- package/dist/connection/login.js +69 -0
- package/dist/connection/output/format.d.ts +32 -0
- package/dist/connection/output/format.js +94 -0
- package/dist/connection/output/index.d.ts +2 -0
- package/dist/connection/output/index.js +2 -0
- package/dist/connection/resolve.d.ts +60 -0
- package/dist/connection/resolve.js +30 -0
- package/dist/connection/signin.d.ts +4 -0
- package/dist/connection/signin.js +32 -0
- package/dist/connection/system.d.ts +4 -0
- package/dist/connection/system.js +190 -0
- package/dist/connection/tree/index.d.ts +2 -0
- package/dist/connection/tree/index.js +2 -0
- package/dist/connection/tree/tree.d.ts +3 -0
- package/dist/connection/tree/tree.js +209 -0
- package/dist/container/client.d.ts +142 -0
- package/dist/container/client.js +11 -0
- package/dist/container/commands.d.ts +7 -0
- package/dist/container/commands.js +100 -0
- package/dist/container/index.d.ts +3 -0
- package/dist/container/index.js +3 -0
- package/dist/container/output/format.d.ts +11 -0
- package/dist/container/output/format.js +28 -0
- package/dist/container/output/index.d.ts +2 -0
- package/dist/container/output/index.js +2 -0
- package/dist/context/client.d.ts +7 -0
- package/dist/context/client.js +21 -0
- package/dist/context/commands.d.ts +3 -0
- package/dist/context/commands.js +27 -0
- package/dist/context/index.d.ts +3 -0
- package/dist/context/index.js +3 -0
- package/dist/development/cli.d.ts +3 -0
- package/dist/development/cli.js +44 -0
- package/dist/execution/client.d.ts +25 -0
- package/dist/execution/client.js +24 -0
- package/dist/execution/index.d.ts +3 -0
- package/dist/execution/index.js +3 -0
- package/dist/execution/relocation.d.ts +6 -0
- package/dist/execution/relocation.js +123 -0
- package/dist/execution/tree/index.d.ts +2 -0
- package/dist/execution/tree/index.js +2 -0
- package/dist/execution/tree/tree.d.ts +3 -0
- package/dist/execution/tree/tree.js +137 -0
- package/dist/hold/client.d.ts +137 -0
- package/dist/hold/client.js +12 -0
- package/dist/hold/commands.d.ts +5 -0
- package/dist/hold/commands.js +91 -0
- package/dist/hold/index.d.ts +3 -0
- package/dist/hold/index.js +3 -0
- package/dist/hold/output/format.d.ts +11 -0
- package/dist/hold/output/format.js +29 -0
- package/dist/hold/output/index.d.ts +2 -0
- package/dist/hold/output/index.js +2 -0
- package/dist/hold/tree/index.d.ts +2 -0
- package/dist/hold/tree/index.js +2 -0
- package/dist/hold/tree/tree.d.ts +3 -0
- package/dist/hold/tree/tree.js +96 -0
- package/dist/import/client.d.ts +14 -0
- package/dist/import/client.js +16 -0
- package/dist/import/commands.d.ts +5 -0
- package/dist/import/commands.js +76 -0
- package/dist/import/index.d.ts +3 -0
- package/dist/import/index.js +3 -0
- package/dist/import/input.d.ts +16 -0
- package/dist/import/input.js +92 -0
- package/dist/import/output.d.ts +6 -0
- package/dist/import/output.js +40 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/integration/client.d.ts +1284 -0
- package/dist/integration/client.js +24 -0
- package/dist/integration/commands.d.ts +10 -0
- package/dist/integration/commands.js +104 -0
- package/dist/integration/index.d.ts +3 -0
- package/dist/integration/index.js +3 -0
- package/dist/integration/output.d.ts +22 -0
- package/dist/integration/output.js +20 -0
- package/dist/local-node/call.d.ts +7 -0
- package/dist/local-node/call.js +13 -0
- package/dist/local-node/client.d.ts +67 -0
- package/dist/local-node/client.js +241 -0
- package/dist/local-node/index.d.ts +3 -0
- package/dist/local-node/index.js +3 -0
- package/dist/login/agent-provider.d.ts +20 -0
- package/dist/login/agent-provider.js +109 -0
- package/dist/login/commands.d.ts +4 -0
- package/dist/login/commands.js +93 -0
- package/dist/login/failure.d.ts +3 -0
- package/dist/login/failure.js +14 -0
- package/dist/login/gateway.d.ts +12 -0
- package/dist/login/gateway.js +71 -0
- package/dist/login/index.d.ts +3 -0
- package/dist/login/index.js +2 -0
- package/dist/login/menu.d.ts +4 -0
- package/dist/login/menu.js +105 -0
- package/dist/login/output/format.d.ts +16 -0
- package/dist/login/output/format.js +31 -0
- package/dist/login/output/index.d.ts +2 -0
- package/dist/login/output/index.js +2 -0
- package/dist/login/vendor-account.d.ts +95 -0
- package/dist/login/vendor-account.js +75 -0
- package/dist/login/vendor-input.d.ts +14 -0
- package/dist/login/vendor-input.js +36 -0
- package/dist/mcp/calls.d.ts +7 -0
- package/dist/mcp/calls.js +202 -0
- package/dist/mcp/commands.d.ts +9 -0
- package/dist/mcp/commands.js +21 -0
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/server.d.ts +11 -0
- package/dist/mcp/server.js +57 -0
- package/dist/orchestration/client.d.ts +78 -0
- package/dist/orchestration/client.js +89 -0
- package/dist/orchestration/commands.d.ts +14 -0
- package/dist/orchestration/commands.js +312 -0
- package/dist/orchestration/index.d.ts +3 -0
- package/dist/orchestration/index.js +3 -0
- package/dist/orchestration/output/compact-aggregate.d.ts +121 -0
- package/dist/orchestration/output/compact-aggregate.js +110 -0
- package/dist/orchestration/output/compact-run-list.d.ts +20 -0
- package/dist/orchestration/output/compact-run-list.js +16 -0
- package/dist/orchestration/output/human.d.ts +80 -0
- package/dist/orchestration/output/human.js +252 -0
- package/dist/orchestration/output/index.d.ts +4 -0
- package/dist/orchestration/output/index.js +4 -0
- package/dist/orchestration/tree/index.d.ts +2 -0
- package/dist/orchestration/tree/index.js +2 -0
- package/dist/orchestration/tree/tree.d.ts +3 -0
- package/dist/orchestration/tree/tree.js +142 -0
- package/dist/port-lease/client.d.ts +160 -0
- package/dist/port-lease/client.js +11 -0
- package/dist/port-lease/commands.d.ts +6 -0
- package/dist/port-lease/commands.js +17 -0
- package/dist/port-lease/index.d.ts +3 -0
- package/dist/port-lease/index.js +3 -0
- package/dist/port-lease/input.d.ts +65 -0
- package/dist/port-lease/input.js +67 -0
- package/dist/port-lease/output/format.d.ts +11 -0
- package/dist/port-lease/output/format.js +24 -0
- package/dist/port-lease/output/index.d.ts +2 -0
- package/dist/port-lease/output/index.js +2 -0
- package/dist/presentation/client.d.ts +10 -0
- package/dist/presentation/client.js +9 -0
- package/dist/presentation/commands.d.ts +6 -0
- package/dist/presentation/commands.js +78 -0
- package/dist/presentation/index.d.ts +4 -0
- package/dist/presentation/index.js +3 -0
- package/dist/presentation/output/format.d.ts +11 -0
- package/dist/presentation/output/format.js +32 -0
- package/dist/presentation/output/index.d.ts +3 -0
- package/dist/presentation/output/index.js +2 -0
- package/dist/project-guard/client.d.ts +88 -0
- package/dist/project-guard/client.js +7 -0
- package/dist/project-guard/commands.d.ts +4 -0
- package/dist/project-guard/commands.js +39 -0
- package/dist/project-guard/index.d.ts +3 -0
- package/dist/project-guard/index.js +3 -0
- package/dist/project-guard/input.d.ts +18 -0
- package/dist/project-guard/input.js +47 -0
- package/dist/project-guard/output/format.d.ts +11 -0
- package/dist/project-guard/output/format.js +35 -0
- package/dist/project-guard/output/index.d.ts +2 -0
- package/dist/project-guard/output/index.js +2 -0
- package/dist/project-workspace/client.d.ts +86 -0
- package/dist/project-workspace/client.js +159 -0
- package/dist/project-workspace/commands.d.ts +30 -0
- package/dist/project-workspace/commands.js +700 -0
- package/dist/project-workspace/index.d.ts +5 -0
- package/dist/project-workspace/index.js +5 -0
- package/dist/project-workspace/metadata-client.d.ts +99 -0
- package/dist/project-workspace/metadata-client.js +8 -0
- package/dist/project-workspace/metadata-commands.d.ts +4 -0
- package/dist/project-workspace/metadata-commands.js +56 -0
- package/dist/project-workspace/output/human.d.ts +126 -0
- package/dist/project-workspace/output/human.js +103 -0
- package/dist/project-workspace/output/index.d.ts +3 -0
- package/dist/project-workspace/output/index.js +3 -0
- package/dist/project-workspace/output/metadata.d.ts +11 -0
- package/dist/project-workspace/output/metadata.js +17 -0
- package/dist/project-workspace/tree/index.d.ts +2 -0
- package/dist/project-workspace/tree/index.js +2 -0
- package/dist/project-workspace/tree/tree.d.ts +3 -0
- package/dist/project-workspace/tree/tree.js +197 -0
- package/dist/provider/client.d.ts +6 -0
- package/dist/provider/client.js +5 -0
- package/dist/provider/commands.d.ts +3 -0
- package/dist/provider/commands.js +38 -0
- package/dist/provider/index.d.ts +3 -0
- package/dist/provider/index.js +3 -0
- package/dist/reference/commands.d.ts +3 -0
- package/dist/reference/commands.js +39 -0
- package/dist/reference/index.d.ts +3 -0
- package/dist/reference/index.js +3 -0
- package/dist/reference/resolve.d.ts +29 -0
- package/dist/reference/resolve.js +294 -0
- package/dist/reference/tree/index.d.ts +2 -0
- package/dist/reference/tree/index.js +2 -0
- package/dist/reference/tree/tree.d.ts +3 -0
- package/dist/reference/tree/tree.js +17 -0
- package/dist/remote-node/client.d.ts +258 -0
- package/dist/remote-node/client.js +12 -0
- package/dist/remote-node/commands.d.ts +6 -0
- package/dist/remote-node/commands.js +264 -0
- package/dist/remote-node/connector.d.ts +59 -0
- package/dist/remote-node/connector.js +122 -0
- package/dist/remote-node/index.d.ts +4 -0
- package/dist/remote-node/index.js +4 -0
- package/dist/remote-node/reachability.d.ts +22 -0
- package/dist/remote-node/reachability.js +34 -0
- package/dist/remote-node/text.d.ts +9 -0
- package/dist/remote-node/text.js +64 -0
- package/dist/remote-node/tree/index.d.ts +2 -0
- package/dist/remote-node/tree/index.js +2 -0
- package/dist/remote-node/tree/tree.d.ts +3 -0
- package/dist/remote-node/tree/tree.js +51 -0
- package/dist/run-ledger/client.d.ts +358 -0
- package/dist/run-ledger/client.js +13 -0
- package/dist/run-ledger/commands.d.ts +8 -0
- package/dist/run-ledger/commands.js +19 -0
- package/dist/run-ledger/index.d.ts +3 -0
- package/dist/run-ledger/index.js +3 -0
- package/dist/run-ledger/input.d.ts +42 -0
- package/dist/run-ledger/input.js +107 -0
- package/dist/run-ledger/output/format.d.ts +11 -0
- package/dist/run-ledger/output/format.js +49 -0
- package/dist/run-ledger/output/index.d.ts +2 -0
- package/dist/run-ledger/output/index.js +2 -0
- package/dist/session/agent-permission.d.ts +63 -0
- package/dist/session/agent-permission.js +20 -0
- package/dist/session/approval/client.d.ts +117 -0
- package/dist/session/approval/client.js +7 -0
- package/dist/session/approval/commands.d.ts +7 -0
- package/dist/session/approval/commands.js +123 -0
- package/dist/session/approval/index.d.ts +3 -0
- package/dist/session/approval/index.js +3 -0
- package/dist/session/approval/output/format.d.ts +12 -0
- package/dist/session/approval/output/format.js +25 -0
- package/dist/session/approval/output/index.d.ts +2 -0
- package/dist/session/approval/output/index.js +2 -0
- package/dist/session/attach-client.d.ts +16 -0
- package/dist/session/attach-client.js +8 -0
- package/dist/session/attach-render.d.ts +16 -0
- package/dist/session/attach-render.js +154 -0
- package/dist/session/attach.d.ts +5 -0
- package/dist/session/attach.js +106 -0
- package/dist/session/client.d.ts +132 -0
- package/dist/session/client.js +128 -0
- package/dist/session/coding-client.d.ts +16 -0
- package/dist/session/coding-client.js +15 -0
- package/dist/session/coding-commands.d.ts +4 -0
- package/dist/session/coding-commands.js +50 -0
- package/dist/session/commands.d.ts +13 -0
- package/dist/session/commands.js +488 -0
- package/dist/session/create-tasks.d.ts +20 -0
- package/dist/session/create-tasks.js +110 -0
- package/dist/session/index.d.ts +9 -0
- package/dist/session/index.js +7 -0
- package/dist/session/interaction/client.d.ts +347 -0
- package/dist/session/interaction/client.js +15 -0
- package/dist/session/interaction/commands.d.ts +7 -0
- package/dist/session/interaction/commands.js +101 -0
- package/dist/session/interaction/index.d.ts +3 -0
- package/dist/session/interaction/index.js +3 -0
- package/dist/session/interaction/input.d.ts +15 -0
- package/dist/session/interaction/input.js +46 -0
- package/dist/session/interaction/output/format.d.ts +11 -0
- package/dist/session/interaction/output/format.js +3 -0
- package/dist/session/interaction/output/index.d.ts +2 -0
- package/dist/session/interaction/output/index.js +2 -0
- package/dist/session/output/diff.d.ts +3 -0
- package/dist/session/output/diff.js +30 -0
- package/dist/session/output/failure.d.ts +11 -0
- package/dist/session/output/failure.js +24 -0
- package/dist/session/output/human.d.ts +112 -0
- package/dist/session/output/human.js +71 -0
- package/dist/session/output/index.d.ts +6 -0
- package/dist/session/output/index.js +6 -0
- package/dist/session/output/observe.d.ts +4 -0
- package/dist/session/output/observe.js +46 -0
- package/dist/session/output/tasks.d.ts +19 -0
- package/dist/session/output/tasks.js +34 -0
- package/dist/session/rename.d.ts +3 -0
- package/dist/session/rename.js +37 -0
- package/dist/session/task-file.d.ts +5 -0
- package/dist/session/task-file.js +23 -0
- package/dist/session/tree/index.d.ts +2 -0
- package/dist/session/tree/index.js +2 -0
- package/dist/session/tree/tree.d.ts +3 -0
- package/dist/session/tree/tree.js +309 -0
- package/dist/session/turn/client.d.ts +25 -0
- package/dist/session/turn/client.js +40 -0
- package/dist/session/turn/commands.d.ts +6 -0
- package/dist/session/turn/commands.js +157 -0
- package/dist/session/turn/index.d.ts +4 -0
- package/dist/session/turn/index.js +3 -0
- package/dist/session/turn/output.d.ts +42 -0
- package/dist/session/turn/output.js +38 -0
- package/dist/status/client.d.ts +119 -0
- package/dist/status/client.js +5 -0
- package/dist/status/command.d.ts +4 -0
- package/dist/status/command.js +40 -0
- package/dist/status/doctor.d.ts +15 -0
- package/dist/status/doctor.js +111 -0
- package/dist/status/index.d.ts +5 -0
- package/dist/status/index.js +4 -0
- package/dist/status/output/compact.d.ts +31 -0
- package/dist/status/output/compact.js +46 -0
- package/dist/status/output/human.d.ts +7 -0
- package/dist/status/output/human.js +30 -0
- package/dist/status/output/index.d.ts +3 -0
- package/dist/status/output/index.js +3 -0
- package/dist/terminal/arguments.d.ts +13 -0
- package/dist/terminal/arguments.js +79 -0
- package/dist/terminal/client.d.ts +79 -0
- package/dist/terminal/client.js +68 -0
- package/dist/terminal/commands.d.ts +7 -0
- package/dist/terminal/commands.js +131 -0
- package/dist/terminal/control-commands.d.ts +10 -0
- package/dist/terminal/control-commands.js +212 -0
- package/dist/terminal/index.d.ts +4 -0
- package/dist/terminal/index.js +4 -0
- package/dist/terminal/output/compact-list.d.ts +147 -0
- package/dist/terminal/output/compact-list.js +152 -0
- package/dist/terminal/output/human.d.ts +59 -0
- package/dist/terminal/output/human.js +55 -0
- package/dist/terminal/output/index.d.ts +3 -0
- package/dist/terminal/output/index.js +3 -0
- package/dist/terminal/tree/index.d.ts +2 -0
- package/dist/terminal/tree/index.js +2 -0
- package/dist/terminal/tree/tree.d.ts +3 -0
- package/dist/terminal/tree/tree.js +104 -0
- package/guidance/maia-cli/SKILL.md +58 -0
- package/guidance/maia-orchestration/SKILL.md +54 -0
- package/package.json +76 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
const session = () => import("../index.js");
|
|
2
|
+
const turn = () => import("../turn/index.js");
|
|
3
|
+
const approval = () => import("../approval/index.js");
|
|
4
|
+
const interaction = () => import("../interaction/index.js");
|
|
5
|
+
const discovery = () => import("../../import/index.js");
|
|
6
|
+
export const SESSION_TREE = {
|
|
7
|
+
groups: [
|
|
8
|
+
["session", "Sessions: workers that run in a Workspace."],
|
|
9
|
+
["session events", "A Session's events."],
|
|
10
|
+
["session history", "Session transcripts."],
|
|
11
|
+
["session inbox", "This Session's inbox."],
|
|
12
|
+
["session message", "Messages between Sessions."],
|
|
13
|
+
["session agent-permission", "Agent permission grants."],
|
|
14
|
+
["session turn", "Turns sent to a Session."],
|
|
15
|
+
["session approval", "What a worker waits on a person for."],
|
|
16
|
+
["session interaction", "Record-only questions to a person."],
|
|
17
|
+
["import", "Find sessions to adopt."],
|
|
18
|
+
],
|
|
19
|
+
leaves: [
|
|
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-definition <key> --agent-definition-version <version> --agent-definition-digest <sha256>] [--base <branch-tag-or-commit>] [--title <text>] [--message <text> | --prompt-stdin | --from-file <path>]",
|
|
22
|
+
0,
|
|
23
|
+
"session.create",
|
|
24
|
+
"Create a Session, optionally starting it with a first message.",
|
|
25
|
+
{
|
|
26
|
+
example: "maia --json session create --executor codex-cli --message 'Fix the build' --command-id create-1",
|
|
27
|
+
run: [session, "runSessionCreate"],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
"session list (--project <project-id> | --all) [--state <state>[,<state>...]] [--attention] [--limit <1..100>] [--after <cursor>]",
|
|
32
|
+
0,
|
|
33
|
+
"session.list",
|
|
34
|
+
"List Sessions of a Project, or all of them.",
|
|
35
|
+
{
|
|
36
|
+
example: "maia --json session list --all --attention",
|
|
37
|
+
run: [session, "runSessionList"],
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
[
|
|
41
|
+
"session show <session-id>",
|
|
42
|
+
0,
|
|
43
|
+
"session.show",
|
|
44
|
+
"Show one Session.",
|
|
45
|
+
{
|
|
46
|
+
example: "maia --json session show session_1",
|
|
47
|
+
run: [session, "runSessionShow"],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
"session rename <session-id> --title <text> --expected-revision <revision> [--command-id <id>]",
|
|
52
|
+
1,
|
|
53
|
+
"session.rename",
|
|
54
|
+
"Rename a Session at its current revision.",
|
|
55
|
+
{
|
|
56
|
+
example: "maia --json session rename session_1 --title 'Fix the build' --expected-revision 2",
|
|
57
|
+
run: [session, "runSessionRename"],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
[
|
|
61
|
+
"session start <session-id> --expected-revision <revision> [--command-id <id>] [--wait [--timeout <duration>]]",
|
|
62
|
+
1,
|
|
63
|
+
"session.start",
|
|
64
|
+
"Start a Session; --wait returns once it runs.",
|
|
65
|
+
{
|
|
66
|
+
example: "maia --json session start session_1 --expected-revision 1 --command-id start-1 --wait",
|
|
67
|
+
run: [session, "runSessionStart"],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
"session stop <session-id> --expected-revision <revision> [--command-id <id>]",
|
|
72
|
+
1,
|
|
73
|
+
"session.stop",
|
|
74
|
+
"Stop a Session.",
|
|
75
|
+
{
|
|
76
|
+
example: "maia --json session stop session_1 --expected-revision 2 --command-id stop-1",
|
|
77
|
+
run: [session, "runSessionStop"],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
"session resume <session-id> --expected-revision <revision> [--command-id <id>]",
|
|
82
|
+
1,
|
|
83
|
+
"session.resume",
|
|
84
|
+
"Resume a stopped Session.",
|
|
85
|
+
{ run: [session, "runSessionResume"] },
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
"session archive <session-id> --expected-revision <revision> [--command-id <id>]",
|
|
89
|
+
1,
|
|
90
|
+
"session.archive",
|
|
91
|
+
"Archive a Session and retire its worktree.",
|
|
92
|
+
{
|
|
93
|
+
example: "maia --json session archive session_1 --expected-revision 3 --command-id archive-1",
|
|
94
|
+
run: [session, "runSessionArchive"],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
[
|
|
98
|
+
"session diff <session-id> [--stat]",
|
|
99
|
+
1,
|
|
100
|
+
"session.diff",
|
|
101
|
+
"Show the changes a coding Session made.",
|
|
102
|
+
{
|
|
103
|
+
example: "maia session diff session_1 --stat",
|
|
104
|
+
run: [session, "runSessionDiff"],
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
"session observe [<session-id>...] [--stall-after <duration>]",
|
|
109
|
+
0,
|
|
110
|
+
"session.observe",
|
|
111
|
+
"Stream Session state changes and stalls.",
|
|
112
|
+
{
|
|
113
|
+
example: "maia --json session observe --stall-after 5m",
|
|
114
|
+
run: [session, "runSessionObserve"],
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
[
|
|
118
|
+
"session attach <session-id> [--after <epoch>:<sequence>] [--no-follow]",
|
|
119
|
+
1,
|
|
120
|
+
"session.attach",
|
|
121
|
+
"Follow a Session's live items.",
|
|
122
|
+
{
|
|
123
|
+
example: "maia session attach session_1",
|
|
124
|
+
run: [session, "runSessionAttach"],
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
[
|
|
128
|
+
"session events list --session <session-id> [--limit <1..32>] [--after <session-cursor>]",
|
|
129
|
+
0,
|
|
130
|
+
"session.events.list",
|
|
131
|
+
"List a Session's events.",
|
|
132
|
+
{ run: [session, "runSessionEventsList"] },
|
|
133
|
+
],
|
|
134
|
+
[
|
|
135
|
+
"session history read <session-id|claude:<id>|codex:<id>> [--offset <n>] [--limit <1..50>]",
|
|
136
|
+
1,
|
|
137
|
+
"session.history.read",
|
|
138
|
+
"Read a Session's or vendor session's history.",
|
|
139
|
+
{ run: [discovery, "runHistoryRead"] },
|
|
140
|
+
],
|
|
141
|
+
[
|
|
142
|
+
"session adopt (<claude|codex>:<native-id> --workspace <workspace-id> [--attest-ended] [--command-id <id>] [--dry-run] | --confirm-stdin)",
|
|
143
|
+
1,
|
|
144
|
+
["session.adopt.preview", "session.adopt.confirm"],
|
|
145
|
+
"Adopt a Claude Code or Codex session after a preview.",
|
|
146
|
+
{
|
|
147
|
+
example: "maia --json session adopt codex:019a --workspace workspace_1 --dry-run",
|
|
148
|
+
kind: "two-phase",
|
|
149
|
+
run: [discovery, "runAdopt"],
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
[
|
|
153
|
+
"session agent-permission set (--input-stdin --dry-run | --confirm-stdin)",
|
|
154
|
+
1,
|
|
155
|
+
["session.agent-permission.preview", "session.agent-permission.confirm"],
|
|
156
|
+
"Grant or change an agent permission after a preview.",
|
|
157
|
+
{ kind: "two-phase", run: [session, "runAgentPermissionSet"] },
|
|
158
|
+
],
|
|
159
|
+
[
|
|
160
|
+
"session message send --session <recipient-session-id> --attached --subject <text> --body-stdin [--command-id <id>]",
|
|
161
|
+
1,
|
|
162
|
+
"session.message.send",
|
|
163
|
+
"Send a message to another Session.",
|
|
164
|
+
{ run: [session, "runSessionMessageSend"] },
|
|
165
|
+
],
|
|
166
|
+
[
|
|
167
|
+
"session inbox check --attached [--limit <1..16>]",
|
|
168
|
+
1,
|
|
169
|
+
"session.inbox.check",
|
|
170
|
+
"Check this Session's inbox.",
|
|
171
|
+
{ run: [session, "runSessionInboxCheck"] },
|
|
172
|
+
],
|
|
173
|
+
[
|
|
174
|
+
"session inbox ack <delivery-id> --attached --expected-mailbox-revision <revision> [--command-id <id>]",
|
|
175
|
+
1,
|
|
176
|
+
"session.inbox.ack",
|
|
177
|
+
"Acknowledge one message delivered to this Session.",
|
|
178
|
+
{ run: [session, "runSessionInboxAck"] },
|
|
179
|
+
],
|
|
180
|
+
[
|
|
181
|
+
"session turn send --session <session-id> --prompt-stdin --expected-revision <revision> [--command-id <id>]",
|
|
182
|
+
1,
|
|
183
|
+
"turn.send",
|
|
184
|
+
"Send a turn to a Session from standard input.",
|
|
185
|
+
{
|
|
186
|
+
example: "printf %s 'Explain the build' | maia --json session turn send --session session_1 --prompt-stdin --expected-revision 2 --command-id send-1",
|
|
187
|
+
run: [turn, "runTurnSend"],
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
[
|
|
191
|
+
"session turn show <turn-id> [--include-content]",
|
|
192
|
+
1,
|
|
193
|
+
"turn.show",
|
|
194
|
+
"Show one turn, its usage and, with --include-content, its text.",
|
|
195
|
+
{
|
|
196
|
+
example: "maia --json session turn show turn_1 --include-content",
|
|
197
|
+
run: [turn, "runTurnShow"],
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
[
|
|
201
|
+
"session turn wait <turn-id>... [--any] [--timeout <duration>]",
|
|
202
|
+
1,
|
|
203
|
+
"turn.wait",
|
|
204
|
+
"Wait for turns to finish; a failed turn exits non-zero.",
|
|
205
|
+
{
|
|
206
|
+
example: "maia --json session turn wait turn_1 --timeout 10m",
|
|
207
|
+
run: [turn, "runTurnWait"],
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
[
|
|
211
|
+
"session turn interrupt <turn-id> --expected-session-revision <revision> [--command-id <id>]",
|
|
212
|
+
1,
|
|
213
|
+
"turn.interrupt",
|
|
214
|
+
"Interrupt a running turn at its Session's revision.",
|
|
215
|
+
{
|
|
216
|
+
example: "maia --json session turn interrupt turn_1 --expected-session-revision 4 --command-id stop-turn-1",
|
|
217
|
+
run: [turn, "runTurnInterrupt"],
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
[
|
|
221
|
+
"session approval list [--session <session-id>] [--all] [--limit <1..50>]",
|
|
222
|
+
1,
|
|
223
|
+
"approval.list",
|
|
224
|
+
"List what workers wait on a person for.",
|
|
225
|
+
{
|
|
226
|
+
example: "maia --json session approval list --all",
|
|
227
|
+
run: [approval, "runApprovalList"],
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
[
|
|
231
|
+
"session approval show <approval-id>",
|
|
232
|
+
1,
|
|
233
|
+
"approval.show",
|
|
234
|
+
"Show one approval request.",
|
|
235
|
+
{ run: [approval, "runApprovalShow"] },
|
|
236
|
+
],
|
|
237
|
+
[
|
|
238
|
+
"session approval approve <approval-id> [--for-session] [--command-id <id>]",
|
|
239
|
+
1,
|
|
240
|
+
"approval.respond",
|
|
241
|
+
"Approve a worker's request.",
|
|
242
|
+
{
|
|
243
|
+
example: "maia session approval approve approval_1 --command-id approve-1",
|
|
244
|
+
kind: "discriminant",
|
|
245
|
+
run: [approval, "runApprovalApprove"],
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
[
|
|
249
|
+
"session approval deny <approval-id> [--reason <text>] [--command-id <id>]",
|
|
250
|
+
1,
|
|
251
|
+
"approval.respond",
|
|
252
|
+
"Deny a worker's request.",
|
|
253
|
+
{ kind: "discriminant", run: [approval, "runApprovalDeny"] },
|
|
254
|
+
],
|
|
255
|
+
[
|
|
256
|
+
"session approval answer <approval-id> (--text <answer> | --option <option-id>) [--command-id <id>]",
|
|
257
|
+
1,
|
|
258
|
+
"approval.respond",
|
|
259
|
+
"Answer a worker's question.",
|
|
260
|
+
{ kind: "discriminant", run: [approval, "runApprovalAnswer"] },
|
|
261
|
+
],
|
|
262
|
+
[
|
|
263
|
+
"session interaction create --input-stdin",
|
|
264
|
+
1,
|
|
265
|
+
"interaction.create",
|
|
266
|
+
"Ask a person a question for an idle Session.",
|
|
267
|
+
{ run: [interaction, "runInteractionCreate"] },
|
|
268
|
+
],
|
|
269
|
+
[
|
|
270
|
+
"session interaction list --session <session-id> --project <project-id> [--status <pending|answered|cancelled|expired>] [--limit <1..100>] [--after <cursor>]",
|
|
271
|
+
1,
|
|
272
|
+
"interaction.list",
|
|
273
|
+
"List a Session's questions.",
|
|
274
|
+
{ run: [interaction, "runInteractionList"] },
|
|
275
|
+
],
|
|
276
|
+
[
|
|
277
|
+
"session interaction show <interaction-id>",
|
|
278
|
+
1,
|
|
279
|
+
"interaction.show",
|
|
280
|
+
"Show one question.",
|
|
281
|
+
{ run: [interaction, "runInteractionShow"] },
|
|
282
|
+
],
|
|
283
|
+
[
|
|
284
|
+
"session interaction respond --input-stdin",
|
|
285
|
+
1,
|
|
286
|
+
"interaction.respond",
|
|
287
|
+
"Record an answer to a question.",
|
|
288
|
+
{ run: [interaction, "runInteractionRespond"] },
|
|
289
|
+
],
|
|
290
|
+
[
|
|
291
|
+
"session interaction cancel --input-stdin",
|
|
292
|
+
1,
|
|
293
|
+
"interaction.cancel",
|
|
294
|
+
"Cancel a question.",
|
|
295
|
+
{ run: [interaction, "runInteractionCancel"] },
|
|
296
|
+
],
|
|
297
|
+
[
|
|
298
|
+
"import scan [--source claude,codex] [--since <days>d] [--root <path>] [--include-content] [--limit <1..100>] [--after <cursor>]",
|
|
299
|
+
1,
|
|
300
|
+
"discovery.sessions.list",
|
|
301
|
+
"Find Claude Code and Codex sessions to adopt.",
|
|
302
|
+
{
|
|
303
|
+
example: "maia --json import scan --source codex --since 7d",
|
|
304
|
+
run: [discovery, "runScan"],
|
|
305
|
+
},
|
|
306
|
+
],
|
|
307
|
+
],
|
|
308
|
+
};
|
|
309
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TurnInterruptResult, TurnSendResult, TurnShowResult, TurnWaitParameters, TurnWaitResult } from "@maiaos/sdk";
|
|
2
|
+
import { type CliNodeEffect, type CliNodeOperations } from "../../local-node/index.js";
|
|
3
|
+
export type InterruptTurnInput = {
|
|
4
|
+
readonly commandId?: string;
|
|
5
|
+
readonly expectedRevision: string;
|
|
6
|
+
readonly turnId: string;
|
|
7
|
+
};
|
|
8
|
+
export type SendTurnInput = {
|
|
9
|
+
readonly commandId?: string;
|
|
10
|
+
readonly expectedRevision: string;
|
|
11
|
+
readonly prompt: string;
|
|
12
|
+
readonly sessionId: string;
|
|
13
|
+
};
|
|
14
|
+
export type WaitTurnsInput = {
|
|
15
|
+
readonly mode: TurnWaitParameters["mode"];
|
|
16
|
+
readonly timeoutMilliseconds: number;
|
|
17
|
+
readonly turnIds: readonly string[];
|
|
18
|
+
};
|
|
19
|
+
export declare const makeTurnClient: (node: CliNodeOperations) => {
|
|
20
|
+
interruptTurn: (input: InterruptTurnInput) => CliNodeEffect<TurnInterruptResult>;
|
|
21
|
+
sendTurn: (input: SendTurnInput) => CliNodeEffect<TurnSendResult>;
|
|
22
|
+
showTurn: (turnId: string) => CliNodeEffect<TurnShowResult>;
|
|
23
|
+
waitTurns: (input: WaitTurnsInput) => CliNodeEffect<TurnWaitResult>;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { MAX_TURN_WAIT_MILLISECONDS, turnInterruptParametersSchema, turnSendParametersSchema, turnShowParametersSchema, turnWaitParametersSchema, } from "@maiaos/sdk";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { commandIdentifier, } from "../../local-node/index.js";
|
|
4
|
+
export const makeTurnClient = (node) => {
|
|
5
|
+
const interruptTurn = (input) => {
|
|
6
|
+
return Effect.flatMap(commandIdentifier(input.commandId), (commandId) => {
|
|
7
|
+
return node.runValidatedNodeOperation({
|
|
8
|
+
commandId,
|
|
9
|
+
expectedRevision: input.expectedRevision,
|
|
10
|
+
turnId: input.turnId,
|
|
11
|
+
}, turnInterruptParametersSchema, (client, parameters, options) => client.interruptTurn(parameters, options), { commandId });
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
const sendTurn = (input) => {
|
|
15
|
+
return Effect.flatMap(commandIdentifier(input.commandId), (commandId) => {
|
|
16
|
+
return node.runValidatedNodeOperation({
|
|
17
|
+
commandId,
|
|
18
|
+
expectedRevision: input.expectedRevision,
|
|
19
|
+
input: { text: input.prompt, type: "text" },
|
|
20
|
+
sessionId: input.sessionId,
|
|
21
|
+
}, turnSendParametersSchema, (client, parameters, options) => client.sendTurn(parameters, options), { commandId });
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const showTurn = (turnId) => node.runValidatedNodeOperation({ turnId }, turnShowParametersSchema, (client, parameters, options) => client.showTurn(parameters, options));
|
|
25
|
+
const waitTurnsOnce = (parameters) => node.runValidatedNodeOperation(parameters, turnWaitParametersSchema, (client, validated, options) => client.waitTurns(validated, options));
|
|
26
|
+
const waitWithin = (input) => Effect.gen(function* () {
|
|
27
|
+
const waitMilliseconds = Math.min(MAX_TURN_WAIT_MILLISECONDS, input.timeoutMilliseconds);
|
|
28
|
+
const result = yield* waitTurnsOnce({
|
|
29
|
+
mode: input.mode,
|
|
30
|
+
turnIds: input.turnIds,
|
|
31
|
+
waitMilliseconds,
|
|
32
|
+
});
|
|
33
|
+
const remaining = input.timeoutMilliseconds - waitMilliseconds;
|
|
34
|
+
if (!result.ok || result.value.satisfied || remaining <= 0)
|
|
35
|
+
return result;
|
|
36
|
+
return yield* waitWithin({ ...input, timeoutMilliseconds: remaining });
|
|
37
|
+
});
|
|
38
|
+
return { interruptTurn, sendTurn, showTurn, waitTurns: waitWithin };
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type CommandContext, type CommandEffect } from "../../command-line/index.js";
|
|
2
|
+
export declare const runTurnSend: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
3
|
+
export declare const runTurnInterrupt: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
4
|
+
export declare const runTurnShow: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
5
|
+
export declare const runTurnWait: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
6
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { MAX_TURN_INPUT_BYTES, MAX_TURN_WAIT_IDS, } from "@maiaos/sdk";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { CliArgumentError, parseOptions, readDuration, readExpectedRevision, readRevisionOption, requirePositionals, writeNodeResult, } from "../../command-line/index.js";
|
|
4
|
+
import { formatTurnMutation, formatTurnShow, formatTurnWait, turnWaitExitCode, } from "./output.js";
|
|
5
|
+
const utf8 = new TextEncoder();
|
|
6
|
+
const summarizeTurnMutation = (result) => ({
|
|
7
|
+
delivery: result.delivery,
|
|
8
|
+
receipt: result.receipt,
|
|
9
|
+
revision: result.turn.revision,
|
|
10
|
+
sessionId: result.turn.sessionId,
|
|
11
|
+
state: result.turn.state,
|
|
12
|
+
turnId: result.turn.id,
|
|
13
|
+
});
|
|
14
|
+
const parseTurnSendArguments = (tokens) => {
|
|
15
|
+
const parsed = parseOptions(tokens, new Set(["--command-id", "--expected-revision", "--session"]), new Set(["--prompt-stdin"]));
|
|
16
|
+
requirePositionals(parsed.positionals, 0);
|
|
17
|
+
const sessionId = parsed.options.get("--session");
|
|
18
|
+
if (sessionId === undefined) {
|
|
19
|
+
throw new CliArgumentError("Option '--session' is required.");
|
|
20
|
+
}
|
|
21
|
+
if (!parsed.flags.has("--prompt-stdin")) {
|
|
22
|
+
throw new CliArgumentError("Option '--prompt-stdin' is required.");
|
|
23
|
+
}
|
|
24
|
+
const commandId = parsed.options.get("--command-id");
|
|
25
|
+
return {
|
|
26
|
+
expectedRevision: readExpectedRevision(parsed.options.get("--expected-revision")),
|
|
27
|
+
sessionId,
|
|
28
|
+
...(commandId === undefined ? {} : { commandId }),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export const runTurnSend = (tokens, context) => Effect.gen(function* () {
|
|
32
|
+
const input = parseTurnSendArguments(tokens);
|
|
33
|
+
if (context.io.stdin === undefined) {
|
|
34
|
+
throw new CliArgumentError("Standard input is unavailable.");
|
|
35
|
+
}
|
|
36
|
+
const prompt = yield* context.io.stdin({
|
|
37
|
+
label: "turn prompt",
|
|
38
|
+
maxBytes: MAX_TURN_INPUT_BYTES,
|
|
39
|
+
maxChunks: 1024,
|
|
40
|
+
});
|
|
41
|
+
const result = yield* context.dependencies.sendTurn({ ...input, prompt });
|
|
42
|
+
return writeNodeResult(result, context, {
|
|
43
|
+
toResult: (value) => ({
|
|
44
|
+
command: "turn.send",
|
|
45
|
+
result: summarizeTurnMutation(value),
|
|
46
|
+
}),
|
|
47
|
+
toText: formatTurnMutation,
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
const parseTurnInterruptArguments = (tokens) => {
|
|
51
|
+
const parsed = parseOptions(tokens, new Set(["--command-id", "--expected-session-revision"]));
|
|
52
|
+
requirePositionals(parsed.positionals, 1);
|
|
53
|
+
const turnId = parsed.positionals[0];
|
|
54
|
+
if (turnId === undefined) {
|
|
55
|
+
throw new CliArgumentError("The turn identifier is missing.");
|
|
56
|
+
}
|
|
57
|
+
const commandId = parsed.options.get("--command-id");
|
|
58
|
+
return {
|
|
59
|
+
expectedRevision: readRevisionOption(parsed.options.get("--expected-session-revision"), "--expected-session-revision"),
|
|
60
|
+
turnId,
|
|
61
|
+
...(commandId === undefined ? {} : { commandId }),
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export const runTurnInterrupt = (tokens, context) => Effect.gen(function* () {
|
|
65
|
+
const input = parseTurnInterruptArguments(tokens);
|
|
66
|
+
const result = yield* context.dependencies.interruptTurn(input);
|
|
67
|
+
return writeNodeResult(result, context, {
|
|
68
|
+
toResult: (value) => ({
|
|
69
|
+
command: "turn.interrupt",
|
|
70
|
+
result: summarizeTurnMutation(value),
|
|
71
|
+
}),
|
|
72
|
+
toText: formatTurnMutation,
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
const parseTurnShowArguments = (tokens) => {
|
|
76
|
+
const parsed = parseOptions(tokens, new Set(), new Set(["--include-content"]));
|
|
77
|
+
requirePositionals(parsed.positionals, 1);
|
|
78
|
+
const includeContent = parsed.flags.has("--include-content");
|
|
79
|
+
const turnId = parsed.positionals[0];
|
|
80
|
+
if (turnId === undefined) {
|
|
81
|
+
throw new CliArgumentError("The turn identifier is missing.");
|
|
82
|
+
}
|
|
83
|
+
return { includeContent, turnId };
|
|
84
|
+
};
|
|
85
|
+
const turnTerminalProjection = (turn) => {
|
|
86
|
+
if (turn.state === "completed") {
|
|
87
|
+
return {
|
|
88
|
+
responseBytes: utf8.encode(turn.responseText).byteLength,
|
|
89
|
+
...(turn.tokenUsage === undefined ? {} : { tokenUsage: turn.tokenUsage }),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return turn.state === "failed" || turn.state === "outcome-unknown"
|
|
93
|
+
? {
|
|
94
|
+
...(turn.failure === undefined ? {} : { failure: turn.failure }),
|
|
95
|
+
failureReason: turn.failureReason,
|
|
96
|
+
}
|
|
97
|
+
: {};
|
|
98
|
+
};
|
|
99
|
+
const projectTurnWithoutContent = (value) => ({
|
|
100
|
+
contentIncluded: false,
|
|
101
|
+
method: value.method,
|
|
102
|
+
turn: {
|
|
103
|
+
id: value.turn.id,
|
|
104
|
+
inputBytes: utf8.encode(value.turn.input.text).byteLength,
|
|
105
|
+
revision: value.turn.revision,
|
|
106
|
+
sessionId: value.turn.sessionId,
|
|
107
|
+
sessionRevision: value.turn.sessionRevision,
|
|
108
|
+
state: value.turn.state,
|
|
109
|
+
...turnTerminalProjection(value.turn),
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
const summarizeTurnShow = (value, includeContent) => includeContent
|
|
113
|
+
? { ...value, contentIncluded: true }
|
|
114
|
+
: projectTurnWithoutContent(value);
|
|
115
|
+
export const runTurnShow = (tokens, context) => Effect.gen(function* () {
|
|
116
|
+
const input = parseTurnShowArguments(tokens);
|
|
117
|
+
const result = yield* context.dependencies.showTurn(input.turnId);
|
|
118
|
+
return writeNodeResult(result, context, {
|
|
119
|
+
toResult: (value) => ({
|
|
120
|
+
command: "turn.show",
|
|
121
|
+
result: summarizeTurnShow(value, input.includeContent),
|
|
122
|
+
}),
|
|
123
|
+
toText: formatTurnShow,
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
const DEFAULT_TURN_WAIT_SECONDS = 600;
|
|
127
|
+
const MAX_TURN_WAIT_SECONDS = 86_400;
|
|
128
|
+
const readWaitTimeoutSeconds = (value) => value === undefined
|
|
129
|
+
? DEFAULT_TURN_WAIT_SECONDS
|
|
130
|
+
: readDuration(value, "--timeout", { max: MAX_TURN_WAIT_SECONDS, min: 1 });
|
|
131
|
+
const parseTurnWaitArguments = (tokens) => {
|
|
132
|
+
const parsed = parseOptions(tokens, new Set(["--timeout"]), new Set(["--any"]));
|
|
133
|
+
if (parsed.positionals.length === 0 ||
|
|
134
|
+
parsed.positionals.length > MAX_TURN_WAIT_IDS)
|
|
135
|
+
throw new CliArgumentError(`Wait for 1 to ${String(MAX_TURN_WAIT_IDS)} turns.`);
|
|
136
|
+
return {
|
|
137
|
+
mode: parsed.flags.has("--any") ? "any" : "all",
|
|
138
|
+
timeoutMilliseconds: readWaitTimeoutSeconds(parsed.options.get("--timeout")) * 1000,
|
|
139
|
+
turnIds: parsed.positionals,
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
export const runTurnWait = (tokens, context) => Effect.gen(function* () {
|
|
143
|
+
const input = parseTurnWaitArguments(tokens);
|
|
144
|
+
const { waitTurns } = context.dependencies;
|
|
145
|
+
if (waitTurns === undefined)
|
|
146
|
+
throw new CliArgumentError("Turn wait is unavailable.");
|
|
147
|
+
const result = yield* waitTurns(input);
|
|
148
|
+
const code = writeNodeResult(result, context, {
|
|
149
|
+
toResult: (value) => ({
|
|
150
|
+
command: "turn.wait",
|
|
151
|
+
result: value,
|
|
152
|
+
}),
|
|
153
|
+
toText: formatTurnWait,
|
|
154
|
+
});
|
|
155
|
+
return result.ok ? turnWaitExitCode(result.value) : code;
|
|
156
|
+
});
|
|
157
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { type InterruptTurnInput, makeTurnClient, type SendTurnInput, type WaitTurnsInput, } from "./client.js";
|
|
2
|
+
export { runTurnInterrupt, runTurnSend, runTurnShow, runTurnWait, } from "./commands.js";
|
|
3
|
+
export { type CliTurnMutation, type CliTurnShow, type CliTurnWait, } from "./output.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { FailureDetail, TurnInterruptResult, TurnShowResult, TurnTokenUsage, TurnWaitResult } from "@maiaos/sdk";
|
|
2
|
+
export type CliTurnMutation = {
|
|
3
|
+
readonly command: "turn.interrupt" | "turn.send";
|
|
4
|
+
readonly result: {
|
|
5
|
+
readonly delivery: TurnInterruptResult["delivery"];
|
|
6
|
+
readonly receipt: TurnInterruptResult["receipt"];
|
|
7
|
+
readonly revision: string;
|
|
8
|
+
readonly sessionId: string;
|
|
9
|
+
readonly state: TurnInterruptResult["turn"]["state"];
|
|
10
|
+
readonly turnId: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type CliTurnShow = {
|
|
14
|
+
readonly command: "turn.show";
|
|
15
|
+
readonly result: (TurnShowResult & {
|
|
16
|
+
readonly contentIncluded: true;
|
|
17
|
+
}) | {
|
|
18
|
+
readonly contentIncluded: false;
|
|
19
|
+
readonly method: "turn.show";
|
|
20
|
+
readonly turn: {
|
|
21
|
+
readonly failure?: FailureDetail;
|
|
22
|
+
readonly failureReason?: string;
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly inputBytes: number;
|
|
25
|
+
readonly responseBytes?: number;
|
|
26
|
+
readonly revision: string;
|
|
27
|
+
readonly sessionId: string;
|
|
28
|
+
readonly sessionRevision: string;
|
|
29
|
+
readonly state: TurnShowResult["turn"]["state"];
|
|
30
|
+
readonly tokenUsage?: TurnTokenUsage;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export type CliTurnWait = {
|
|
35
|
+
readonly command: "turn.wait";
|
|
36
|
+
readonly result: TurnWaitResult;
|
|
37
|
+
};
|
|
38
|
+
export declare const formatTurnMutation: ({ result }: CliTurnMutation) => string;
|
|
39
|
+
export declare const formatTurnShow: ({ result }: CliTurnShow) => string;
|
|
40
|
+
export declare const formatTurnWait: ({ result }: CliTurnWait) => string;
|
|
41
|
+
export declare const turnWaitExitCode: (result: TurnWaitResult) => number;
|
|
42
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { formatFailure } from "../output/index.js";
|
|
2
|
+
const tab = (values) => values.join("\t");
|
|
3
|
+
const printable = (text) => Array.from(text, (character) => {
|
|
4
|
+
const point = character.codePointAt(0) ?? 0;
|
|
5
|
+
return (point < 32 && character !== "\n" && character !== "\t") ||
|
|
6
|
+
(point >= 127 && point <= 159)
|
|
7
|
+
? "�"
|
|
8
|
+
: character;
|
|
9
|
+
}).join("");
|
|
10
|
+
export const formatTurnMutation = ({ result }) => `${result.turnId}\t${result.state}\t${result.revision}\n`;
|
|
11
|
+
const formatUsage = (usage) => usage === undefined
|
|
12
|
+
? ""
|
|
13
|
+
: `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`;
|
|
14
|
+
const formatContent = (turn) => `input:\n${printable(turn.input.text)}\n${turn.state === "completed" ? `response:\n${printable(turn.responseText)}\n` : ""}`;
|
|
15
|
+
const shownContent = (result) => result.contentIncluded ? formatContent(result.turn) : "";
|
|
16
|
+
export const formatTurnShow = ({ result }) => {
|
|
17
|
+
const { turn } = result;
|
|
18
|
+
const failure = "failure" in turn &&
|
|
19
|
+
(turn.state === "failed" || turn.state === "outcome-unknown")
|
|
20
|
+
? formatFailure(turn.failure, turn.state)
|
|
21
|
+
: "";
|
|
22
|
+
const usage = "tokenUsage" in turn ? formatUsage(turn.tokenUsage) : "";
|
|
23
|
+
return `${tab([turn.id, turn.state, turn.revision, turn.sessionId])}\n${failure}${usage}${shownContent(result)}`;
|
|
24
|
+
};
|
|
25
|
+
export const formatTurnWait = ({ result }) => result.turns
|
|
26
|
+
.map((turn) => `${tab([turn.id, turn.state, turn.revision, turn.sessionId, ...(turn.failureReason === undefined ? [] : [turn.failureReason])])}\n${turn.state === "failed" || turn.state === "outcome-unknown" ? formatFailure(turn.failure, turn.state) : ""}`)
|
|
27
|
+
.join("");
|
|
28
|
+
const EXIT_FAILED = 70;
|
|
29
|
+
const EXIT_DEADLINE = 74;
|
|
30
|
+
const EXIT_OUTCOME_UNKNOWN = 76;
|
|
31
|
+
export const turnWaitExitCode = (result) => {
|
|
32
|
+
if (!result.satisfied)
|
|
33
|
+
return EXIT_DEADLINE;
|
|
34
|
+
if (result.turns.some((turn) => turn.state === "outcome-unknown"))
|
|
35
|
+
return EXIT_OUTCOME_UNKNOWN;
|
|
36
|
+
return result.turns.some((turn) => turn.state === "failed") ? EXIT_FAILED : 0;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=output.js.map
|