@maiaos/cli 0.1.0-canary.10
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 +60 -0
- package/dist/address-space/address-space.d.ts +38 -0
- package/dist/address-space/address-space.js +130 -0
- package/dist/address-space/index.d.ts +2 -0
- package/dist/address-space/index.js +2 -0
- package/dist/agents/client.d.ts +171 -0
- package/dist/agents/client.js +8 -0
- package/dist/agents/commands.d.ts +7 -0
- package/dist/agents/commands.js +65 -0
- package/dist/agents/index.d.ts +3 -0
- package/dist/agents/index.js +3 -0
- package/dist/agents/input.d.ts +130 -0
- package/dist/agents/input.js +99 -0
- package/dist/agents/output/format.d.ts +8 -0
- package/dist/agents/output/format.js +47 -0
- package/dist/agents/output/index.d.ts +2 -0
- package/dist/agents/output/index.js +2 -0
- package/dist/agents/tree/index.d.ts +2 -0
- package/dist/agents/tree/index.js +2 -0
- package/dist/agents/tree/tree.d.ts +3 -0
- package/dist/agents/tree/tree.js +43 -0
- package/dist/bin/maia.NOTICES.txt +59 -0
- package/dist/bin/maia.cdx.json +168 -0
- package/dist/bin/maia.mjs +2 -0
- package/dist/bootstrap/exit.d.ts +14 -0
- package/dist/bootstrap/exit.js +42 -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 +23 -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 +545 -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 +188 -0
- package/dist/command-line/context.js +2 -0
- package/dist/command-line/index.d.ts +7 -0
- package/dist/command-line/index.js +7 -0
- package/dist/command-line/input/arguments.d.ts +62 -0
- package/dist/command-line/input/arguments.js +232 -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 +12 -0
- package/dist/command-line/input/stdin.js +24 -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 +4 -0
- package/dist/command-line/json.js +27 -0
- package/dist/command-line/output.d.ts +64 -0
- package/dist/command-line/output.js +113 -0
- package/dist/command-line/rows.d.ts +12 -0
- package/dist/command-line/rows.js +41 -0
- package/dist/command-line/two-phase.d.ts +62 -0
- package/dist/command-line/two-phase.js +173 -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 +220 -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 +138 -0
- package/dist/command-tree/placeholder.d.ts +4 -0
- package/dist/command-tree/placeholder.js +5 -0
- package/dist/command-tree/row.d.ts +31 -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 +35 -0
- package/dist/command-tree/tree.js +140 -0
- package/dist/connection/access/client.d.ts +13 -0
- package/dist/connection/access/client.js +19 -0
- package/dist/connection/access/commands.d.ts +6 -0
- package/dist/connection/access/commands.js +60 -0
- package/dist/connection/access/format.d.ts +8 -0
- package/dist/connection/access/format.js +61 -0
- package/dist/connection/access/index.d.ts +3 -0
- package/dist/connection/access/index.js +3 -0
- package/dist/connection/access/input.d.ts +53 -0
- package/dist/connection/access/input.js +83 -0
- package/dist/connection/client.d.ts +790 -0
- package/dist/connection/client.js +36 -0
- package/dist/connection/commands.d.ts +15 -0
- package/dist/connection/commands.js +118 -0
- package/dist/connection/index.d.ts +8 -0
- package/dist/connection/index.js +8 -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 +5 -0
- package/dist/connection/system.js +294 -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 +260 -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 +27 -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/dashboard/cockpit-client.d.ts +6 -0
- package/dist/dashboard/cockpit-client.js +27 -0
- package/dist/dashboard/cockpits.d.ts +29 -0
- package/dist/dashboard/cockpits.js +65 -0
- package/dist/dashboard/dashboard.d.ts +7 -0
- package/dist/dashboard/dashboard.js +47 -0
- package/dist/dashboard/draw.d.ts +15 -0
- package/dist/dashboard/draw.js +30 -0
- package/dist/dashboard/frame.d.ts +4 -0
- package/dist/dashboard/frame.js +15 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.js +2 -0
- package/dist/dashboard/modes.d.ts +5 -0
- package/dist/dashboard/modes.js +16 -0
- package/dist/dashboard/node-connection.d.ts +15 -0
- package/dist/dashboard/node-connection.js +51 -0
- package/dist/dashboard/pi-tui.d.ts +6 -0
- package/dist/dashboard/pi-tui.js +35 -0
- package/dist/dashboard/status-bar.d.ts +4 -0
- package/dist/dashboard/status-bar.js +60 -0
- package/dist/dashboard/terminal.d.ts +53 -0
- package/dist/dashboard/terminal.js +165 -0
- package/dist/dashboard/tree-model.d.ts +28 -0
- package/dist/dashboard/tree-model.js +97 -0
- package/dist/dashboard/tree.d.ts +10 -0
- package/dist/dashboard/tree.js +76 -0
- package/dist/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/fleet/fleet.d.ts +70 -0
- package/dist/fleet/fleet.js +91 -0
- package/dist/fleet/index.d.ts +2 -0
- package/dist/fleet/index.js +2 -0
- package/dist/hold/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 +25 -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 +97 -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 +75 -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 +37 -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 +72 -0
- package/dist/local-node/client.js +253 -0
- package/dist/local-node/index.d.ts +4 -0
- package/dist/local-node/index.js +4 -0
- package/dist/local-node/wait.d.ts +10 -0
- package/dist/local-node/wait.js +17 -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 +94 -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 +8 -0
- package/dist/mcp/calls.js +236 -0
- package/dist/mcp/commands.d.ts +12 -0
- package/dist/mcp/commands.js +47 -0
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/routing.d.ts +24 -0
- package/dist/mcp/routing.js +188 -0
- package/dist/mcp/server.d.ts +20 -0
- package/dist/mcp/server.js +80 -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 +33 -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 +48 -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 +710 -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 +139 -0
- package/dist/project-workspace/output/human.js +115 -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 +212 -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 +41 -0
- package/dist/reference/index.d.ts +3 -0
- package/dist/reference/index.js +3 -0
- package/dist/reference/resolve.d.ts +31 -0
- package/dist/reference/resolve.js +304 -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 +338 -0
- package/dist/remote-node/client.js +17 -0
- package/dist/remote-node/commands.d.ts +15 -0
- package/dist/remote-node/commands.js +342 -0
- package/dist/remote-node/connector.d.ts +67 -0
- package/dist/remote-node/connector.js +143 -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 +64 -0
- package/dist/remote-node/reachability.js +44 -0
- package/dist/remote-node/text.d.ts +10 -0
- package/dist/remote-node/text.js +111 -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 +71 -0
- package/dist/routine/client.d.ts +398 -0
- package/dist/routine/client.js +28 -0
- package/dist/routine/commands.d.ts +9 -0
- package/dist/routine/commands.js +109 -0
- package/dist/routine/index.d.ts +3 -0
- package/dist/routine/index.js +3 -0
- package/dist/routine/input.d.ts +28 -0
- package/dist/routine/input.js +44 -0
- package/dist/routine/output/format.d.ts +23 -0
- package/dist/routine/output/format.js +83 -0
- package/dist/routine/output/index.d.ts +2 -0
- package/dist/routine/output/index.js +2 -0
- package/dist/routine/tree/index.d.ts +2 -0
- package/dist/routine/tree/index.js +2 -0
- package/dist/routine/tree/tree.d.ts +3 -0
- package/dist/routine/tree/tree.js +70 -0
- package/dist/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 +145 -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 +23 -0
- package/dist/session/approval/output/format.js +33 -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 +17 -0
- package/dist/session/attach-render.d.ts +16 -0
- package/dist/session/attach-render.js +162 -0
- package/dist/session/attach.d.ts +5 -0
- package/dist/session/attach.js +120 -0
- package/dist/session/client.d.ts +140 -0
- package/dist/session/client.js +129 -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 +14 -0
- package/dist/session/commands.js +585 -0
- package/dist/session/create-tasks.d.ts +20 -0
- package/dist/session/create-tasks.js +128 -0
- package/dist/session/index.d.ts +9 -0
- package/dist/session/index.js +8 -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 +4 -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 +23 -0
- package/dist/session/output/failure.d.ts +11 -0
- package/dist/session/output/failure.js +17 -0
- package/dist/session/output/human.d.ts +113 -0
- package/dist/session/output/human.js +82 -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 +34 -0
- package/dist/session/output/tasks.js +48 -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 +368 -0
- package/dist/session/turn/client.d.ts +28 -0
- package/dist/session/turn/client.js +51 -0
- package/dist/session/turn/commands.d.ts +8 -0
- package/dist/session/turn/commands.js +185 -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 +47 -0
- package/dist/session/turn/output.js +61 -0
- package/dist/status/client.d.ts +124 -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 +32 -0
- package/dist/status/output/compact.js +49 -0
- package/dist/status/output/human.d.ts +7 -0
- package/dist/status/output/human.js +87 -0
- package/dist/status/output/index.d.ts +3 -0
- package/dist/status/output/index.js +3 -0
- package/dist/team-workspace/ceremony.d.ts +19 -0
- package/dist/team-workspace/ceremony.js +141 -0
- package/dist/team-workspace/client.d.ts +58 -0
- package/dist/team-workspace/client.js +6 -0
- package/dist/team-workspace/commands.d.ts +3 -0
- package/dist/team-workspace/commands.js +85 -0
- package/dist/team-workspace/confirmation.d.ts +4 -0
- package/dist/team-workspace/confirmation.js +8 -0
- package/dist/team-workspace/dependencies.d.ts +8 -0
- package/dist/team-workspace/dependencies.js +2 -0
- package/dist/team-workspace/index.d.ts +6 -0
- package/dist/team-workspace/index.js +5 -0
- package/dist/team-workspace/launcher.d.ts +17 -0
- package/dist/team-workspace/launcher.js +30 -0
- package/dist/team-workspace/output.d.ts +15 -0
- package/dist/team-workspace/output.js +28 -0
- package/dist/team-workspace/terminal.d.ts +9 -0
- package/dist/team-workspace/terminal.js +46 -0
- package/dist/terminal/arguments.d.ts +13 -0
- package/dist/terminal/arguments.js +79 -0
- package/dist/terminal/client.d.ts +83 -0
- package/dist/terminal/client.js +71 -0
- package/dist/terminal/commands.d.ts +7 -0
- package/dist/terminal/commands.js +143 -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 +148 -0
- package/dist/terminal/output/compact-list.js +153 -0
- package/dist/terminal/output/human.d.ts +42 -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 +78 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { CliArgumentError, writeSuccess, } from "../command-line/index.js";
|
|
3
|
+
import { callNode, ConnectionNodeError, findConnectionByName, formatConnectionResult, redactConnection, redactConnectionResult, runVendorLogin, } from "../connection/index.js";
|
|
4
|
+
import { newCliIdentifier } from "../local-node/index.js";
|
|
5
|
+
import { safeLoginError } from "./failure.js";
|
|
6
|
+
import { nextFreeName } from "./vendor-input.js";
|
|
7
|
+
const allAccounts = (context) => callNode(context.dependencies.listConnections, (list) => list({ limit: 100 }));
|
|
8
|
+
const accountName = (context, input) => input.name === undefined
|
|
9
|
+
? allAccounts(context).pipe(Effect.map((result) => nextFreeName(input.vendor, new Set(result.items.map((item) => item.name)))))
|
|
10
|
+
: Effect.succeed(input.name);
|
|
11
|
+
const createAccount = (context, input, name) => callNode(context.dependencies.createConnection, (create) => Effect.flatMap(newCliIdentifier("command"), (commandId) => create({
|
|
12
|
+
commandId,
|
|
13
|
+
configRootKind: "maia-managed",
|
|
14
|
+
executor: input.executor,
|
|
15
|
+
name,
|
|
16
|
+
...(input.maxConcurrentSessions === undefined
|
|
17
|
+
? {}
|
|
18
|
+
: { maxConcurrentSessions: input.maxConcurrentSessions }),
|
|
19
|
+
}))).pipe(Effect.map((result) => result.connection));
|
|
20
|
+
const requireSignable = (connection, input) => {
|
|
21
|
+
if (connection.executor !== input.executor)
|
|
22
|
+
return Effect.fail(new CliArgumentError(`'${connection.name}' is a ${connection.executor} account.`));
|
|
23
|
+
if (connection.state !== "enabled")
|
|
24
|
+
return Effect.fail(new CliArgumentError(`Enable '${connection.name}' first: maia connection enable ${connection.name}.`));
|
|
25
|
+
return connection.configRoot.kind === "maia-managed"
|
|
26
|
+
? Effect.succeed(connection)
|
|
27
|
+
: Effect.fail(new CliArgumentError(`'${connection.name}' uses your normal ${input.vendor} login; it is already signed in through the ${input.vendor} CLI.`));
|
|
28
|
+
};
|
|
29
|
+
const signableAccount = (context, input) => Effect.gen(function* () {
|
|
30
|
+
const name = yield* accountName(context, input);
|
|
31
|
+
const existing = yield* findConnectionByName(context, name);
|
|
32
|
+
return yield* requireSignable(existing ?? (yield* createAccount(context, input, name)), input);
|
|
33
|
+
});
|
|
34
|
+
const vendorSignIn = (context, connection, input) => Effect.suspend(() => (context.dependencies.runVendorLogin ?? runVendorLogin)(connection, {
|
|
35
|
+
deviceCode: input.deviceCode,
|
|
36
|
+
})).pipe(Effect.catchDefect(Effect.fail), Effect.mapError(() => safeLoginError("The vendor sign-in could not start.")), Effect.flatMap((status) => status === 0
|
|
37
|
+
? Effect.void
|
|
38
|
+
: Effect.fail(new ConnectionNodeError({
|
|
39
|
+
code: "login_failed",
|
|
40
|
+
message: `The ${connection.executor} sign-in exited with status ${String(status)}.`,
|
|
41
|
+
retryable: true,
|
|
42
|
+
}))));
|
|
43
|
+
const freshUsage = (context, connection) => connection.executor === "codex-cli"
|
|
44
|
+
? callNode(context.dependencies.showConnectionUsage, (show) => show({ connectionId: connection.connectionId, refresh: true })).pipe(Effect.map((result) => result.connection), Effect.orElseSucceed(() => connection))
|
|
45
|
+
: Effect.succeed(connection);
|
|
46
|
+
export const signInHere = (context, input) => Effect.gen(function* () {
|
|
47
|
+
const connection = yield* signableAccount(context, input);
|
|
48
|
+
yield* vendorSignIn(context, connection, input);
|
|
49
|
+
return yield* freshUsage(context, connection);
|
|
50
|
+
});
|
|
51
|
+
export const writeSignedIn = (context, connection) => {
|
|
52
|
+
writeSuccess({
|
|
53
|
+
command: "connection.login",
|
|
54
|
+
result: {
|
|
55
|
+
connection: redactConnection(connection),
|
|
56
|
+
method: "connection.login",
|
|
57
|
+
},
|
|
58
|
+
}, context, formatConnectionResult);
|
|
59
|
+
return 0;
|
|
60
|
+
};
|
|
61
|
+
const startDeviceCodeLogin = (context, connection) => callNode(context.dependencies.startConnectionLogin, (start) => Effect.flatMap(newCliIdentifier("command"), (commandId) => start({
|
|
62
|
+
commandId,
|
|
63
|
+
connectionId: connection.connectionId,
|
|
64
|
+
expectedRevision: connection.revision,
|
|
65
|
+
flow: "device-code",
|
|
66
|
+
})));
|
|
67
|
+
export const signInThroughNode = (context, input) => Effect.gen(function* () {
|
|
68
|
+
if (input.executor !== "codex-cli")
|
|
69
|
+
return yield* Effect.fail(new CliArgumentError("Claude Code signs in from a terminal: run 'maia login claude' in one."));
|
|
70
|
+
const connection = yield* signableAccount(context, input);
|
|
71
|
+
const started = yield* startDeviceCodeLogin(context, connection);
|
|
72
|
+
writeSuccess({ command: started.method, result: redactConnectionResult(started) }, context, formatConnectionResult);
|
|
73
|
+
return 0;
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=vendor-account.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Vendor = "claude" | "codex";
|
|
2
|
+
type VendorExecutor = "claude-code" | "codex-cli";
|
|
3
|
+
export declare const vendorExecutor: (vendor: string) => undefined | VendorExecutor;
|
|
4
|
+
export type VendorLoginInput = {
|
|
5
|
+
readonly deviceCode: boolean;
|
|
6
|
+
readonly executor: VendorExecutor;
|
|
7
|
+
readonly maxConcurrentSessions?: number;
|
|
8
|
+
readonly name?: string;
|
|
9
|
+
readonly vendor: Vendor;
|
|
10
|
+
};
|
|
11
|
+
export declare const readVendorLogin: (tokens: readonly string[]) => VendorLoginInput;
|
|
12
|
+
export declare const nextFreeName: (vendor: Vendor, taken: ReadonlySet<string>) => string;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=vendor-input.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CliArgumentError, parseOptions, requirePositionals, } from "../command-line/index.js";
|
|
2
|
+
const EXECUTORS = new Map([
|
|
3
|
+
["claude", "claude-code"],
|
|
4
|
+
["codex", "codex-cli"],
|
|
5
|
+
]);
|
|
6
|
+
export const vendorExecutor = (vendor) => EXECUTORS.get(vendor);
|
|
7
|
+
const readSessionLimit = (value) => {
|
|
8
|
+
if (value === undefined)
|
|
9
|
+
return {};
|
|
10
|
+
if (!/^(?:[1-9]|1[0-6])$/u.test(value))
|
|
11
|
+
throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to 16.");
|
|
12
|
+
return { maxConcurrentSessions: Number(value) };
|
|
13
|
+
};
|
|
14
|
+
export const readVendorLogin = (tokens) => {
|
|
15
|
+
const parsed = parseOptions(tokens, new Set(["--max-sessions", "--name"]), new Set(["--device-code"]));
|
|
16
|
+
requirePositionals(parsed.positionals, 1);
|
|
17
|
+
const vendor = parsed.positionals[0] ?? "";
|
|
18
|
+
const executor = vendorExecutor(vendor);
|
|
19
|
+
if (executor === undefined || (vendor !== "claude" && vendor !== "codex"))
|
|
20
|
+
throw new CliArgumentError("The vendor must be claude or codex.");
|
|
21
|
+
const name = parsed.options.get("--name");
|
|
22
|
+
return {
|
|
23
|
+
deviceCode: parsed.flags.has("--device-code"),
|
|
24
|
+
executor,
|
|
25
|
+
vendor,
|
|
26
|
+
...(name === undefined ? {} : { name }),
|
|
27
|
+
...readSessionLimit(parsed.options.get("--max-sessions")),
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export const nextFreeName = (vendor, taken) => {
|
|
31
|
+
const candidate = (index) => taken.has(`${vendor}-${String(index)}`)
|
|
32
|
+
? candidate(index + 1)
|
|
33
|
+
: `${vendor}-${String(index)}`;
|
|
34
|
+
return candidate(1);
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=vendor-input.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CoordinatorToolOperation } from "@maiaos/sdk";
|
|
2
|
+
import { type LocalNodeRequestMethod } from "@maiaos/sdk";
|
|
3
|
+
import { type CliNodeEffect, type CliNodeOperations } from "../local-node/index.js";
|
|
4
|
+
export type CoordinatorCall = (node: CliNodeOperations, input: unknown) => CliNodeEffect<unknown>;
|
|
5
|
+
export declare const COORDINATOR_CALLS: ReadonlyMap<CoordinatorToolOperation, CoordinatorCall>;
|
|
6
|
+
export declare const callCoordinator: (node: CliNodeOperations) => (operation: CoordinatorToolOperation, input: unknown) => CliNodeEffect<unknown>;
|
|
7
|
+
export declare const WORKER_CALLS: ReadonlyMap<LocalNodeRequestMethod, CoordinatorCall>;
|
|
8
|
+
//# sourceMappingURL=calls.d.ts.map
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { agentsListParametersSchema, agentsShowParametersSchema, approvalListParametersSchema, approvalRespondParametersSchema, approvalShowParametersSchema, connectionDetectParametersSchema, connectionListParametersSchema, connectionModelsListParametersSchema, connectionShowParametersSchema, connectionUsageShowParametersSchema, containerIndexListParametersSchema, COORDINATOR_TOOL_OPERATIONS, discoverySessionsListParametersSchema, invocationContextShowParametersSchema, LOCAL_NODE_CALL_METHODS, localNodeRequestPayloadSchema, portLeaseAcquireParametersSchema, portLeaseListParametersSchema, portLeaseReleaseParametersSchema, portLeaseRenewParametersSchema, projectGuardShowParametersSchema, projectListParametersSchema, projectShowParametersSchema, receiptGetParametersSchema, routineListParametersSchema, routineShowParametersSchema, runLedgerCreateParametersSchema, runLedgerListParametersSchema, runLedgerTaskDispatchParametersSchema, runLedgerTaskListParametersSchema, runLedgerTaskSettleParametersSchema, runLedgerTaskShowParametersSchema, sessionArchiveParametersSchema, sessionCreateParametersSchema, sessionDiffParametersSchema, sessionEventsListParametersSchema, sessionHistoryReadParametersSchema, sessionInboxAckParametersSchema, sessionInboxCheckParametersSchema, sessionListParametersSchema, sessionMessageSendParametersSchema, sessionObserveParametersSchema, sessionResumeParametersSchema, sessionShowParametersSchema, sessionStartParametersSchema, sessionStopParametersSchema, turnCancelParametersSchema, turnInterruptParametersSchema, turnQueueListParametersSchema, turnSendParametersSchema, turnShowParametersSchema, turnWaitParametersSchema, workerToolDefinitions, workspaceListParametersSchema, workspaceShowParametersSchema, } from "@maiaos/sdk";
|
|
2
|
+
import { Effect, Predicate } from "effect";
|
|
3
|
+
import { invalidNodeInput, } from "../local-node/index.js";
|
|
4
|
+
const recoveryOf = (input) => Predicate.hasProperty(input, "commandId") &&
|
|
5
|
+
Predicate.isString(input.commandId)
|
|
6
|
+
? { commandId: input.commandId }
|
|
7
|
+
: undefined;
|
|
8
|
+
const validated = (schema, run) => (node, input) => node.runValidatedNodeOperation(input, schema, run, recoveryOf(input));
|
|
9
|
+
const status = (node, input) => input === undefined ||
|
|
10
|
+
(Predicate.isObject(input) && Object.keys(input).length === 0)
|
|
11
|
+
? node.runNodeClientOperation((client, options) => client.status(options))
|
|
12
|
+
: invalidNodeInput();
|
|
13
|
+
const callBound = new Set(LOCAL_NODE_CALL_METHODS);
|
|
14
|
+
const isCallPayload = (payload) => callBound.has(payload.method);
|
|
15
|
+
const isCallBound = (operation) => callBound.has(operation);
|
|
16
|
+
const typedCall = (method) => (node, input) => {
|
|
17
|
+
const payload = localNodeRequestPayloadSchema.safeParse({
|
|
18
|
+
method,
|
|
19
|
+
parameters: input,
|
|
20
|
+
});
|
|
21
|
+
if (!payload.success)
|
|
22
|
+
return invalidNodeInput(payload.error);
|
|
23
|
+
const { data } = payload;
|
|
24
|
+
return isCallPayload(data)
|
|
25
|
+
? node.runNodeClientOperation((client, options) => client.call(data.method, data.parameters, options), recoveryOf(input))
|
|
26
|
+
: invalidNodeInput();
|
|
27
|
+
};
|
|
28
|
+
export const COORDINATOR_CALLS = new Map([
|
|
29
|
+
...COORDINATOR_TOOL_OPERATIONS.filter(isCallBound).map((operation) => [operation, typedCall(operation)]),
|
|
30
|
+
[
|
|
31
|
+
"agents.list",
|
|
32
|
+
validated(agentsListParametersSchema, (client, parameters, options) => client.listAgents(parameters, options)),
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
"agents.show",
|
|
36
|
+
validated(agentsShowParametersSchema, (client, parameters, options) => client.showAgent(parameters, options)),
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
"approval.list",
|
|
40
|
+
validated(approvalListParametersSchema, (client, parameters, options) => client.listApprovals(parameters, options)),
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
"approval.show",
|
|
44
|
+
validated(approvalShowParametersSchema, (client, parameters, options) => client.showApproval(parameters, options)),
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"connection.detect",
|
|
48
|
+
validated(connectionDetectParametersSchema, (client, parameters, options) => client.detectConnections(parameters, options)),
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
"connection.list",
|
|
52
|
+
validated(connectionListParametersSchema, (client, parameters, options) => client.listConnections(parameters, options)),
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
"connection.models.list",
|
|
56
|
+
validated(connectionModelsListParametersSchema, (client, parameters, options) => client.listConnectionModels(parameters, options)),
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
"connection.show",
|
|
60
|
+
validated(connectionShowParametersSchema, (client, parameters, options) => client.showConnection(parameters, options)),
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
"connection.usage.show",
|
|
64
|
+
validated(connectionUsageShowParametersSchema, (client, parameters, options) => client.showConnectionUsage(parameters, options)),
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
"container.index.list",
|
|
68
|
+
validated(containerIndexListParametersSchema, (client, parameters, options) => client.listContainerIndex(parameters, options)),
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
"discovery.sessions.list",
|
|
72
|
+
validated(discoverySessionsListParametersSchema, (client, parameters, options) => client.listDiscoveredSessions(parameters, options)),
|
|
73
|
+
],
|
|
74
|
+
["node.status", status],
|
|
75
|
+
[
|
|
76
|
+
"port.lease.acquire",
|
|
77
|
+
validated(portLeaseAcquireParametersSchema, (client, parameters, options) => client.acquirePortLease(parameters, options)),
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
"port.lease.list",
|
|
81
|
+
validated(portLeaseListParametersSchema, (client, parameters, options) => client.listPortLeases(parameters, options)),
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
"port.lease.release",
|
|
85
|
+
validated(portLeaseReleaseParametersSchema, (client, parameters, options) => client.releasePortLease(parameters, options)),
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
"port.lease.renew",
|
|
89
|
+
validated(portLeaseRenewParametersSchema, (client, parameters, options) => client.renewPortLease(parameters, options)),
|
|
90
|
+
],
|
|
91
|
+
[
|
|
92
|
+
"project.guard.show",
|
|
93
|
+
validated(projectGuardShowParametersSchema, (client, parameters, options) => client.showProjectGuard(parameters, options)),
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
"project.list",
|
|
97
|
+
validated(projectListParametersSchema, (client, parameters, options) => client.listProjects(parameters, options)),
|
|
98
|
+
],
|
|
99
|
+
[
|
|
100
|
+
"project.show",
|
|
101
|
+
validated(projectShowParametersSchema, (client, parameters, options) => client.showProject(parameters, options)),
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
"receipt.get",
|
|
105
|
+
validated(receiptGetParametersSchema, (client, parameters, options) => client.getReceipt(parameters, options)),
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
"routine.list",
|
|
109
|
+
validated(routineListParametersSchema, (client, parameters, options) => client.listRoutines(parameters, options)),
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
"routine.show",
|
|
113
|
+
validated(routineShowParametersSchema, (client, parameters, options) => client.showRoutine(parameters, options)),
|
|
114
|
+
],
|
|
115
|
+
[
|
|
116
|
+
"run.ledger.create",
|
|
117
|
+
validated(runLedgerCreateParametersSchema, (client, parameters, options) => client.createRunLedger(parameters, options)),
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
"run.ledger.list",
|
|
121
|
+
validated(runLedgerListParametersSchema, (client, parameters, options) => client.listRunLedgers(parameters, options)),
|
|
122
|
+
],
|
|
123
|
+
[
|
|
124
|
+
"run.ledger.task.dispatch",
|
|
125
|
+
validated(runLedgerTaskDispatchParametersSchema, (client, parameters, options) => client.dispatchRunLedgerTask(parameters, options)),
|
|
126
|
+
],
|
|
127
|
+
[
|
|
128
|
+
"run.ledger.task.list",
|
|
129
|
+
validated(runLedgerTaskListParametersSchema, (client, parameters, options) => client.listRunLedgerTasks(parameters, options)),
|
|
130
|
+
],
|
|
131
|
+
[
|
|
132
|
+
"run.ledger.task.settle",
|
|
133
|
+
validated(runLedgerTaskSettleParametersSchema, (client, parameters, options) => client.settleRunLedgerTask(parameters, options)),
|
|
134
|
+
],
|
|
135
|
+
[
|
|
136
|
+
"run.ledger.task.show",
|
|
137
|
+
validated(runLedgerTaskShowParametersSchema, (client, parameters, options) => client.showRunLedgerTask(parameters, options)),
|
|
138
|
+
],
|
|
139
|
+
[
|
|
140
|
+
"session.archive",
|
|
141
|
+
validated(sessionArchiveParametersSchema, (client, parameters, options) => client.archiveSession(parameters, options)),
|
|
142
|
+
],
|
|
143
|
+
[
|
|
144
|
+
"session.create",
|
|
145
|
+
validated(sessionCreateParametersSchema, (client, parameters, options) => client.createSession(parameters, options)),
|
|
146
|
+
],
|
|
147
|
+
[
|
|
148
|
+
"session.diff",
|
|
149
|
+
validated(sessionDiffParametersSchema, (client, parameters, options) => client.diffSession(parameters, options)),
|
|
150
|
+
],
|
|
151
|
+
[
|
|
152
|
+
"session.events.list",
|
|
153
|
+
validated(sessionEventsListParametersSchema, (client, parameters, options) => client.listSessionEvents(parameters, options)),
|
|
154
|
+
],
|
|
155
|
+
[
|
|
156
|
+
"session.history.read",
|
|
157
|
+
validated(sessionHistoryReadParametersSchema, (client, parameters, options) => client.readSessionHistory(parameters, options)),
|
|
158
|
+
],
|
|
159
|
+
[
|
|
160
|
+
"session.list",
|
|
161
|
+
validated(sessionListParametersSchema, (client, parameters, options) => client.listSessions(parameters, options)),
|
|
162
|
+
],
|
|
163
|
+
[
|
|
164
|
+
"session.observe",
|
|
165
|
+
validated(sessionObserveParametersSchema, (client, parameters, options) => client.observeSessions(parameters, options)),
|
|
166
|
+
],
|
|
167
|
+
[
|
|
168
|
+
"session.resume",
|
|
169
|
+
validated(sessionResumeParametersSchema, (client, parameters, options) => client.resumeSession(parameters, options)),
|
|
170
|
+
],
|
|
171
|
+
[
|
|
172
|
+
"session.show",
|
|
173
|
+
validated(sessionShowParametersSchema, (client, parameters, options) => client.showSession(parameters, options)),
|
|
174
|
+
],
|
|
175
|
+
[
|
|
176
|
+
"session.start",
|
|
177
|
+
validated(sessionStartParametersSchema, (client, parameters, options) => client.startSession(parameters, options)),
|
|
178
|
+
],
|
|
179
|
+
[
|
|
180
|
+
"session.stop",
|
|
181
|
+
validated(sessionStopParametersSchema, (client, parameters, options) => client.stopSession(parameters, options)),
|
|
182
|
+
],
|
|
183
|
+
[
|
|
184
|
+
"turn.cancel",
|
|
185
|
+
validated(turnCancelParametersSchema, (client, parameters, options) => client.cancelTurn(parameters, options)),
|
|
186
|
+
],
|
|
187
|
+
[
|
|
188
|
+
"turn.interrupt",
|
|
189
|
+
validated(turnInterruptParametersSchema, (client, parameters, options) => client.interruptTurn(parameters, options)),
|
|
190
|
+
],
|
|
191
|
+
[
|
|
192
|
+
"turn.queue.list",
|
|
193
|
+
validated(turnQueueListParametersSchema, (client, parameters, options) => client.listTurnQueue(parameters, options)),
|
|
194
|
+
],
|
|
195
|
+
[
|
|
196
|
+
"turn.send",
|
|
197
|
+
validated(turnSendParametersSchema, (client, parameters, options) => client.sendTurn(parameters, options)),
|
|
198
|
+
],
|
|
199
|
+
[
|
|
200
|
+
"turn.show",
|
|
201
|
+
validated(turnShowParametersSchema, (client, parameters, options) => client.showTurn(parameters, options)),
|
|
202
|
+
],
|
|
203
|
+
[
|
|
204
|
+
"turn.wait",
|
|
205
|
+
validated(turnWaitParametersSchema, (client, parameters, options) => client.waitTurns(parameters, options)),
|
|
206
|
+
],
|
|
207
|
+
[
|
|
208
|
+
"workspace.list",
|
|
209
|
+
validated(workspaceListParametersSchema, (client, parameters, options) => client.listWorkspaces(parameters, options)),
|
|
210
|
+
],
|
|
211
|
+
[
|
|
212
|
+
"workspace.show",
|
|
213
|
+
validated(workspaceShowParametersSchema, (client, parameters, options) => client.showWorkspace(parameters, options)),
|
|
214
|
+
],
|
|
215
|
+
]);
|
|
216
|
+
export const callCoordinator = (node) => (operation, input) => {
|
|
217
|
+
const call = COORDINATOR_CALLS.get(operation);
|
|
218
|
+
return call === undefined
|
|
219
|
+
? Effect.die(new Error(`No SDK call for ${operation}.`))
|
|
220
|
+
: call(node, input);
|
|
221
|
+
};
|
|
222
|
+
export const WORKER_CALLS = (() => {
|
|
223
|
+
const available = new Map(COORDINATOR_CALLS);
|
|
224
|
+
available.set("context.show", validated(invocationContextShowParametersSchema, (client, parameters, options) => client.showCurrentContext(parameters, options)));
|
|
225
|
+
available.set("approval.respond", validated(approvalRespondParametersSchema, (client, parameters, options) => client.respondToApproval(parameters, options)));
|
|
226
|
+
available.set("session.inbox.ack", validated(sessionInboxAckParametersSchema, (client, parameters, options) => client.acknowledgeSessionDelivery(parameters, options)));
|
|
227
|
+
available.set("session.inbox.check", validated(sessionInboxCheckParametersSchema, (client, parameters, options) => client.checkSessionInbox(parameters, options)));
|
|
228
|
+
available.set("session.message.send", validated(sessionMessageSendParametersSchema, (client, parameters, options) => client.sendSessionMessage(parameters, options)));
|
|
229
|
+
return new Map(workerToolDefinitions("orchestrator").map(({ operation }) => {
|
|
230
|
+
const call = available.get(operation);
|
|
231
|
+
if (call === undefined)
|
|
232
|
+
throw new Error(`No worker SDK call for ${operation}.`);
|
|
233
|
+
return [operation, call];
|
|
234
|
+
}));
|
|
235
|
+
})();
|
|
236
|
+
//# sourceMappingURL=calls.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CoordinatorToolOperation } from "@maiaos/sdk";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { type CliServices, type CommandContext, type CommandEffect } from "../command-line/index.js";
|
|
4
|
+
import type { CliNodeEffect, CliNodeOperations } from "../local-node/index.js";
|
|
5
|
+
import type { ToolFleet } from "./server.js";
|
|
6
|
+
export type McpCliDependencies = {
|
|
7
|
+
readonly callCoordinatorTool: (operation: CoordinatorToolOperation, input: unknown) => CliNodeEffect<unknown>;
|
|
8
|
+
readonly serveMcp: (version: string, worker?: boolean, fleet?: ToolFleet) => Effect.Effect<number, unknown, CliServices>;
|
|
9
|
+
};
|
|
10
|
+
export declare const makeMcpClient: (node: CliNodeOperations) => McpCliDependencies;
|
|
11
|
+
export declare const runMcpCommand: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
12
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as Config from "effect/Config";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Option from "effect/Option";
|
|
4
|
+
import { LOCAL_NODE, requireNoArguments, } from "../command-line/index.js";
|
|
5
|
+
import { refused } from "../fleet/index.js";
|
|
6
|
+
const coordinatorTool = (node) => (operation, input) => Effect.promise(() => import("./calls.js")).pipe(Effect.flatMap((module) => module.callCoordinator(node.asCoordinator())(operation, input)));
|
|
7
|
+
export const makeMcpClient = (node) => ({
|
|
8
|
+
callCoordinatorTool: coordinatorTool(node),
|
|
9
|
+
serveMcp: (version, worker = false, fleet) => Effect.promise(() => import("./server.js")).pipe(Effect.flatMap((module) => Effect.gen(function* () {
|
|
10
|
+
const credential = yield* Config.option(Config.String("MAIA_SESSION_CREDENTIAL"));
|
|
11
|
+
const origin = yield* Config.option(Config.String("MAIA_NODE_ORIGIN"));
|
|
12
|
+
const session = worker || Option.isSome(credential) || Option.isSome(origin);
|
|
13
|
+
return yield* module.serveCoordinatorMcp(session ? node.asSession() : node.asCoordinator(), version, {
|
|
14
|
+
worker: session,
|
|
15
|
+
...(session || fleet === undefined ? {} : { fleet }),
|
|
16
|
+
});
|
|
17
|
+
}))),
|
|
18
|
+
});
|
|
19
|
+
const fleetOf = ({ bindNode, dependencies, node, }) => {
|
|
20
|
+
const bound = new Map();
|
|
21
|
+
const bind = (name) => {
|
|
22
|
+
const known = bound.get(name);
|
|
23
|
+
if (known !== undefined)
|
|
24
|
+
return known;
|
|
25
|
+
const call = bindNode?.(name).callCoordinatorTool;
|
|
26
|
+
const reach = (operation, input) => call === undefined
|
|
27
|
+
? Effect.succeed(refused("internal_error", `Node ${name} has no coordinator tools.`))
|
|
28
|
+
: call(operation, input);
|
|
29
|
+
bound.set(name, reach);
|
|
30
|
+
return reach;
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
bind: bindNode && bind,
|
|
34
|
+
chosen: node !== undefined,
|
|
35
|
+
listRemoteNodes: dependencies.listRemoteNodes,
|
|
36
|
+
node: node ?? LOCAL_NODE,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export const runMcpCommand = (tokens, context) => {
|
|
40
|
+
const worker = tokens[0] === "--worker";
|
|
41
|
+
requireNoArguments(worker ? tokens.slice(1) : tokens, "MCP");
|
|
42
|
+
const { serveMcp } = context.dependencies;
|
|
43
|
+
if (serveMcp === undefined)
|
|
44
|
+
return Effect.die(new Error("The MCP server is unavailable."));
|
|
45
|
+
return Effect.orDie(serveMcp(context.version, worker, worker ? undefined : fleetOf(context)));
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RouteKind } from "@maiaos/client-core/cockpit";
|
|
2
|
+
import { type CoordinatorToolOperation, type ProtocolError } from "@maiaos/sdk";
|
|
3
|
+
import { type Crypto, Effect } from "effect";
|
|
4
|
+
import { type Fleet } from "../fleet/index.js";
|
|
5
|
+
import { type CliNodeEffect, type CliNodeResult } from "../local-node/index.js";
|
|
6
|
+
export type ToolReach = (operation: CoordinatorToolOperation, input: unknown) => CliNodeEffect<unknown>;
|
|
7
|
+
export type ToolAnswer = CliNodeResult<unknown> | {
|
|
8
|
+
readonly error: ProtocolError;
|
|
9
|
+
readonly ok: false;
|
|
10
|
+
readonly result: unknown;
|
|
11
|
+
};
|
|
12
|
+
type ToolKind = Exclude<RouteKind, "terminal">;
|
|
13
|
+
type ToolRoute = {
|
|
14
|
+
readonly held?: {
|
|
15
|
+
readonly ids: (input: object) => unknown;
|
|
16
|
+
readonly kind: ToolKind;
|
|
17
|
+
};
|
|
18
|
+
readonly merged?: true;
|
|
19
|
+
};
|
|
20
|
+
export declare const TOOL_ROUTES: ReadonlyMap<CoordinatorToolOperation, ToolRoute>;
|
|
21
|
+
export declare const isRoutedTool: (operation: string) => operation is CoordinatorToolOperation;
|
|
22
|
+
export declare const routeToolCall: (fleet: Fleet<ToolReach>, operation: CoordinatorToolOperation, input: unknown) => Effect.Effect<ToolAnswer, never, Crypto.Crypto>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=routing.d.ts.map
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { localNodeRequestPayloadSchema, } from "@maiaos/sdk";
|
|
2
|
+
import { Effect, Predicate, Result } from "effect";
|
|
3
|
+
import { askEach, failureOf, fleetNodes, holderIn, mergeLists, refused, routes, } from "../fleet/index.js";
|
|
4
|
+
import { invalidNodeInput, } from "../local-node/index.js";
|
|
5
|
+
const LOCAL = {};
|
|
6
|
+
const held = (kind, field, merged) => ({
|
|
7
|
+
held: {
|
|
8
|
+
ids: (input) => Predicate.hasProperty(input, field) ? input[field] : undefined,
|
|
9
|
+
kind,
|
|
10
|
+
},
|
|
11
|
+
...(merged === undefined ? {} : { merged }),
|
|
12
|
+
});
|
|
13
|
+
const HISTORY = {
|
|
14
|
+
held: {
|
|
15
|
+
ids: (input) => Predicate.hasProperty(input, "target") &&
|
|
16
|
+
Predicate.hasProperty(input.target, "sessionId") &&
|
|
17
|
+
Predicate.hasProperty(input.target, "kind") &&
|
|
18
|
+
input.target.kind === "session"
|
|
19
|
+
? input.target.sessionId
|
|
20
|
+
: undefined,
|
|
21
|
+
kind: "session",
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export const TOOL_ROUTES = new Map([
|
|
25
|
+
["agents.list", LOCAL],
|
|
26
|
+
["agents.show", LOCAL],
|
|
27
|
+
["approval.list", held("session", "sessionId", true)],
|
|
28
|
+
["approval.show", held("approval", "approvalId")],
|
|
29
|
+
["connection.detect", LOCAL],
|
|
30
|
+
["connection.list", LOCAL],
|
|
31
|
+
["connection.models.list", LOCAL],
|
|
32
|
+
["connection.show", LOCAL],
|
|
33
|
+
["connection.usage.show", LOCAL],
|
|
34
|
+
["container.index.list", LOCAL],
|
|
35
|
+
["discovery.sessions.list", LOCAL],
|
|
36
|
+
["node.status", LOCAL],
|
|
37
|
+
["port.lease.acquire", LOCAL],
|
|
38
|
+
["port.lease.list", LOCAL],
|
|
39
|
+
["port.lease.release", LOCAL],
|
|
40
|
+
["port.lease.renew", LOCAL],
|
|
41
|
+
["project.guard.show", held("project", "projectId")],
|
|
42
|
+
["project.list", { merged: true }],
|
|
43
|
+
["project.show", held("project", "projectId")],
|
|
44
|
+
["receipt.get", held("command", "commandId")],
|
|
45
|
+
["reference.resolve", held("project", "projectId")],
|
|
46
|
+
["routine.list", held("project", "projectId", true)],
|
|
47
|
+
["routine.show", held("routine", "routineId")],
|
|
48
|
+
["run.ledger.create", LOCAL],
|
|
49
|
+
["run.ledger.list", LOCAL],
|
|
50
|
+
["run.ledger.task.dispatch", LOCAL],
|
|
51
|
+
["run.ledger.task.list", LOCAL],
|
|
52
|
+
["run.ledger.task.settle", LOCAL],
|
|
53
|
+
["run.ledger.task.show", LOCAL],
|
|
54
|
+
["session.archive", held("session", "sessionId")],
|
|
55
|
+
["session.create", held("workspace", "workspaceId")],
|
|
56
|
+
["session.diff", held("session", "sessionId")],
|
|
57
|
+
["session.events.list", held("session", "sessionId")],
|
|
58
|
+
["session.history.read", HISTORY],
|
|
59
|
+
["session.list", held("project", "projectId", true)],
|
|
60
|
+
["session.observe", held("session", "sessionIds", true)],
|
|
61
|
+
["session.rename", held("session", "sessionId")],
|
|
62
|
+
["session.resume", held("session", "sessionId")],
|
|
63
|
+
["session.show", held("session", "sessionId")],
|
|
64
|
+
["session.start", held("session", "sessionId")],
|
|
65
|
+
["session.stop", held("session", "sessionId")],
|
|
66
|
+
["turn.cancel", held("turn", "turnId")],
|
|
67
|
+
["turn.interrupt", held("turn", "turnId")],
|
|
68
|
+
["turn.queue.list", held("session", "sessionId")],
|
|
69
|
+
["turn.send", held("session", "sessionId")],
|
|
70
|
+
["turn.show", held("turn", "turnId")],
|
|
71
|
+
["turn.wait", held("turn", "turnIds")],
|
|
72
|
+
["workspace.list", held("project", "projectId")],
|
|
73
|
+
["workspace.show", held("workspace", "workspaceId")],
|
|
74
|
+
]);
|
|
75
|
+
const PROBES = {
|
|
76
|
+
approval: (approvalId) => ["approval.show", { approvalId }],
|
|
77
|
+
command: (commandId) => ["receipt.get", { commandId }],
|
|
78
|
+
project: (projectId) => ["project.show", { projectId }],
|
|
79
|
+
routine: (routineId) => ["routine.show", { routineId }],
|
|
80
|
+
session: (sessionId) => ["session.show", { sessionId }],
|
|
81
|
+
turn: (turnId) => ["turn.show", { turnId }],
|
|
82
|
+
workspace: (workspaceId) => ["workspace.show", { workspaceId }],
|
|
83
|
+
};
|
|
84
|
+
const CHOOSE_NODE = "serve that Node alone with 'maia --node <name> mcp'";
|
|
85
|
+
const heldIds = ({ ids, kind }, input) => {
|
|
86
|
+
const value = Predicate.isObject(input) ? ids(input) : undefined;
|
|
87
|
+
const named = [value].flat();
|
|
88
|
+
return named.length > 0 &&
|
|
89
|
+
named.every((id) => Predicate.isString(id) && routes({ id, kind }))
|
|
90
|
+
? [...new Set(named)]
|
|
91
|
+
: [];
|
|
92
|
+
};
|
|
93
|
+
const oneHolder = (ids) => (holders) => {
|
|
94
|
+
const names = [...new Set(holders.map(({ node }) => node))];
|
|
95
|
+
const [holder] = holders;
|
|
96
|
+
return holder !== undefined && names.length === 1
|
|
97
|
+
? { ok: true, value: holder }
|
|
98
|
+
: refused("invalid_argument", `${ids.join(", ")} are on different Nodes (${names.join(", ")}): call once per Node.`);
|
|
99
|
+
};
|
|
100
|
+
const holderOf = (nodes, kind, id) => Effect.flatMap(holderIn(nodes, { id, kind }, {
|
|
101
|
+
choose: CHOOSE_NODE,
|
|
102
|
+
probe: (reach) => reach(...PROBES[kind](id)),
|
|
103
|
+
}), (found) => Result.isSuccess(found)
|
|
104
|
+
? Effect.succeed(found.success)
|
|
105
|
+
: Effect.fail(found.failure.error));
|
|
106
|
+
const holderOfAll = (nodes, kind, ids) => Effect.forEach(ids, (id) => holderOf(nodes, kind, id)).pipe(Effect.match({
|
|
107
|
+
onFailure: (error) => ({ error, ok: false }),
|
|
108
|
+
onSuccess: oneHolder(ids),
|
|
109
|
+
}));
|
|
110
|
+
const pageOf = (node, result) => {
|
|
111
|
+
if (!result.ok)
|
|
112
|
+
return result;
|
|
113
|
+
const { value } = result;
|
|
114
|
+
return Predicate.hasProperty(value, "items") && Array.isArray(value.items)
|
|
115
|
+
? { ok: true, value: value }
|
|
116
|
+
: refused("internal_error", `Node ${node} answered a list without items.`);
|
|
117
|
+
};
|
|
118
|
+
const continues = (input) => Predicate.hasProperty(input, "afterCursor") &&
|
|
119
|
+
input.afterCursor !== undefined &&
|
|
120
|
+
input.afterCursor !== "0";
|
|
121
|
+
const observationOf = (result) => {
|
|
122
|
+
if (!result.ok)
|
|
123
|
+
return {};
|
|
124
|
+
const { value } = result;
|
|
125
|
+
return {
|
|
126
|
+
...(Predicate.hasProperty(value, "observedAt")
|
|
127
|
+
? { observedAt: value.observedAt }
|
|
128
|
+
: {}),
|
|
129
|
+
...(Predicate.hasProperty(value, "stallAfterSeconds")
|
|
130
|
+
? { stallAfterSeconds: value.stallAfterSeconds }
|
|
131
|
+
: {}),
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
const mergedAnswer = (operation) => (answers) => {
|
|
135
|
+
const lists = mergeLists(answers.map(({ node, result }) => ({
|
|
136
|
+
node,
|
|
137
|
+
result: pageOf(node, result),
|
|
138
|
+
})));
|
|
139
|
+
const merged = {
|
|
140
|
+
...lists,
|
|
141
|
+
method: operation,
|
|
142
|
+
nodes: lists.nodes.map((entry, index) => {
|
|
143
|
+
const answer = answers[index];
|
|
144
|
+
return answer === undefined
|
|
145
|
+
? entry
|
|
146
|
+
: { ...entry, ...observationOf(answer.result) };
|
|
147
|
+
}),
|
|
148
|
+
};
|
|
149
|
+
const failed = failureOf(merged.nodes);
|
|
150
|
+
return failed === undefined
|
|
151
|
+
? { ok: true, value: merged }
|
|
152
|
+
: { error: failed, ok: false, result: merged };
|
|
153
|
+
};
|
|
154
|
+
const mergedList = (nodes, operation, input) => continues(input)
|
|
155
|
+
? Effect.succeed(refused("invalid_argument", `A cursor pages one Node: ${CHOOSE_NODE} to page it.`))
|
|
156
|
+
: Effect.map(askEach(nodes, (reach) => reach(operation, input)), mergedAnswer(operation));
|
|
157
|
+
const routeAmong = (local, nodes, { held, merged }) => (operation, input) => {
|
|
158
|
+
const ids = held === undefined ? [] : heldIds(held, input);
|
|
159
|
+
if (held !== undefined && ids.length > 0)
|
|
160
|
+
return Effect.flatMap(holderOfAll(nodes, held.kind, ids), (holder) => holder.ok
|
|
161
|
+
? holder.value.reach(operation, input)
|
|
162
|
+
: Effect.succeed(holder));
|
|
163
|
+
return merged === undefined
|
|
164
|
+
? local.reach(operation, input)
|
|
165
|
+
: mergedList(nodes, operation, input);
|
|
166
|
+
};
|
|
167
|
+
const ROUTED = new Set(TOOL_ROUTES.keys());
|
|
168
|
+
export const isRoutedTool = (operation) => ROUTED.has(operation);
|
|
169
|
+
export const routeToolCall = (fleet, operation, input) => {
|
|
170
|
+
const route = TOOL_ROUTES.get(operation) ?? LOCAL;
|
|
171
|
+
const { local } = fleet;
|
|
172
|
+
if (route.held === undefined && route.merged === undefined)
|
|
173
|
+
return local.reach(operation, input);
|
|
174
|
+
const checked = localNodeRequestPayloadSchema.safeParse({
|
|
175
|
+
method: operation,
|
|
176
|
+
parameters: input,
|
|
177
|
+
});
|
|
178
|
+
if (!checked.success)
|
|
179
|
+
return invalidNodeInput(checked.error);
|
|
180
|
+
return Effect.flatMap(fleetNodes(fleet), (space) => {
|
|
181
|
+
if (!space.ok)
|
|
182
|
+
return Effect.succeed(space);
|
|
183
|
+
return space.value.length === 1
|
|
184
|
+
? local.reach(operation, input)
|
|
185
|
+
: routeAmong(local, space.value, route)(operation, input);
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
//# sourceMappingURL=routing.js.map
|