@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,27 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { isTerminalControl } from "./rows.js";
|
|
3
|
+
const loadDecoder = () => import("./json-decoder.js");
|
|
4
|
+
const DEL = 127;
|
|
5
|
+
const ASTRAL = 65_536;
|
|
6
|
+
const HIGH_SURROGATE = 55_296;
|
|
7
|
+
const LOW_SURROGATE = 56_320;
|
|
8
|
+
const SURROGATE_SPAN = 1024;
|
|
9
|
+
const unitEscape = (unit) => `\\u${unit.toString(16).padStart(4, "0")}`;
|
|
10
|
+
const escapeCharacter = (point) => {
|
|
11
|
+
if (point < ASTRAL)
|
|
12
|
+
return unitEscape(point);
|
|
13
|
+
const offset = point - ASTRAL;
|
|
14
|
+
return (unitEscape(HIGH_SURROGATE + Math.floor(offset / SURROGATE_SPAN)) +
|
|
15
|
+
unitEscape(LOW_SURROGATE + (offset % SURROGATE_SPAN)));
|
|
16
|
+
};
|
|
17
|
+
export const jsonLine = (value) => {
|
|
18
|
+
const escaped = Array.from(JSON.stringify(value), (character) => {
|
|
19
|
+
const point = character.codePointAt(0) ?? 0;
|
|
20
|
+
return point >= DEL && isTerminalControl(character)
|
|
21
|
+
? escapeCharacter(point)
|
|
22
|
+
: character;
|
|
23
|
+
}).join("");
|
|
24
|
+
return `${escaped}\n`;
|
|
25
|
+
};
|
|
26
|
+
export const decodeJsonText = (text, failure) => Effect.promise(loadDecoder).pipe(Effect.flatMap((decoder) => decoder.decodeJson(text)), Effect.mapError(failure));
|
|
27
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { NodeHolding } from "@maiaos/client-core/cockpit";
|
|
2
|
+
import type { ProtocolError } from "@maiaos/sdk";
|
|
3
|
+
import type * as Effect from "effect/Effect";
|
|
4
|
+
import type { CliMutationRecovery, CliNodeResult } from "../local-node/index.js";
|
|
5
|
+
import type { BoundedStdinRequest, CliArgumentError, PromptOptions } from "./input/index.js";
|
|
6
|
+
export type CliIo = {
|
|
7
|
+
readonly cwd?: string;
|
|
8
|
+
readonly interactive?: boolean;
|
|
9
|
+
readonly prompt?: (question: string, options?: PromptOptions) => Effect.Effect<string | undefined>;
|
|
10
|
+
readonly stderr: (text: string) => void;
|
|
11
|
+
readonly stdin?: (request: BoundedStdinRequest) => Effect.Effect<string, CliArgumentError>;
|
|
12
|
+
readonly stdout: (text: string) => void;
|
|
13
|
+
};
|
|
14
|
+
export type CliSuccessResult = {
|
|
15
|
+
readonly command: string;
|
|
16
|
+
};
|
|
17
|
+
export type CliResolution = {
|
|
18
|
+
readonly argument: string;
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly kind: string;
|
|
21
|
+
readonly label?: string;
|
|
22
|
+
readonly match: "id" | "name" | "path" | "prefix" | "selection";
|
|
23
|
+
readonly reference?: string;
|
|
24
|
+
};
|
|
25
|
+
export type CliSuccessOutput = {
|
|
26
|
+
readonly error?: ProtocolError;
|
|
27
|
+
readonly ok: boolean;
|
|
28
|
+
readonly resolved?: readonly CliResolution[];
|
|
29
|
+
readonly result: CliSuccessResult;
|
|
30
|
+
};
|
|
31
|
+
export type CliUsageHint = {
|
|
32
|
+
readonly hint: string;
|
|
33
|
+
readonly usage: readonly string[];
|
|
34
|
+
};
|
|
35
|
+
export type CliErrorOutput = Partial<CliUsageHint> & {
|
|
36
|
+
readonly error: ProtocolError;
|
|
37
|
+
readonly nodes?: readonly NodeHolding[];
|
|
38
|
+
readonly ok: false;
|
|
39
|
+
readonly recovery?: CliMutationRecovery;
|
|
40
|
+
};
|
|
41
|
+
export type OutputContext = {
|
|
42
|
+
readonly error?: ProtocolError;
|
|
43
|
+
readonly io: CliIo;
|
|
44
|
+
readonly json: boolean;
|
|
45
|
+
readonly ok?: boolean;
|
|
46
|
+
readonly resolved?: readonly CliResolution[];
|
|
47
|
+
};
|
|
48
|
+
type ErrorContext = OutputContext & {
|
|
49
|
+
readonly nodes?: readonly NodeHolding[];
|
|
50
|
+
readonly notFoundHint?: string;
|
|
51
|
+
readonly recovery?: CliMutationRecovery;
|
|
52
|
+
readonly usage?: CliUsageHint;
|
|
53
|
+
};
|
|
54
|
+
export type CliCommandOutput = CliSuccessResult;
|
|
55
|
+
export declare const writeSuccess: <TResult extends CliCommandOutput>(result: TResult, { error, io, json, ok, resolved }: OutputContext, human: (result: TResult) => string) => void;
|
|
56
|
+
export declare const reportError: (error: ProtocolError, context: ErrorContext) => number;
|
|
57
|
+
export declare const exitCodeOf: (error: ProtocolError) => number;
|
|
58
|
+
export type NodeResultPresenter<TValue, TResult extends CliCommandOutput> = {
|
|
59
|
+
readonly toResult: (value: TValue) => TResult;
|
|
60
|
+
readonly toText: (result: TResult) => string;
|
|
61
|
+
};
|
|
62
|
+
export declare const writeNodeResult: <TValue, TResult extends CliCommandOutput>(result: CliNodeResult<TValue>, context: OutputContext, { toResult, toText }: NodeResultPresenter<TValue, TResult>) => number;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsonLine } from "./json.js";
|
|
2
|
+
import { cell } from "./rows.js";
|
|
3
|
+
const EXIT_DATA_NOT_FOUND = 66;
|
|
4
|
+
const EXIT_USAGE = 64;
|
|
5
|
+
const EXIT_UNAVAILABLE = 69;
|
|
6
|
+
const EXIT_SOFTWARE = 70;
|
|
7
|
+
const EXIT_DEADLINE = 74;
|
|
8
|
+
const EXIT_TEMPORARY = 75;
|
|
9
|
+
const EXIT_OUTCOME_UNKNOWN = 76;
|
|
10
|
+
const EXIT_PERMISSION = 77;
|
|
11
|
+
export const writeSuccess = (result, { error, io, json, ok = true, resolved = [] }, human) => {
|
|
12
|
+
if (json) {
|
|
13
|
+
const output = {
|
|
14
|
+
...(ok || error === undefined ? {} : { error }),
|
|
15
|
+
ok,
|
|
16
|
+
...(resolved.length === 0 ? {} : { resolved }),
|
|
17
|
+
result,
|
|
18
|
+
};
|
|
19
|
+
io.stdout(jsonLine(output));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
io.stdout(human(result));
|
|
23
|
+
};
|
|
24
|
+
const formatUsageHint = (error, hint) => {
|
|
25
|
+
if (hint !== undefined)
|
|
26
|
+
return `Usage:\n ${hint.usage.join("\n ")}\n${hint.hint}\n`;
|
|
27
|
+
return error.code === "invalid_argument" ||
|
|
28
|
+
error.code === "command_not_implemented"
|
|
29
|
+
? "Run 'maia --help' for usage.\n"
|
|
30
|
+
: "";
|
|
31
|
+
};
|
|
32
|
+
const formatRecovery = ({ commandId, profile }) => profile === undefined
|
|
33
|
+
? `Outcome unknown. Recover with:\n maia receipt show ${commandId}\n`
|
|
34
|
+
: `Outcome unknown. Start the Node of profile ${profile}, then read the receipt:\n maia-node --desktop --profile ${profile}\n maia --profile ${profile} receipt show ${commandId}\n`;
|
|
35
|
+
const writeError = (error, context) => {
|
|
36
|
+
const { io, json, nodes, notFoundHint, recovery, usage: hint } = context;
|
|
37
|
+
const notFound = error.code === "resource_not_found" ? notFoundHint : undefined;
|
|
38
|
+
if (json) {
|
|
39
|
+
const output = {
|
|
40
|
+
error,
|
|
41
|
+
ok: false,
|
|
42
|
+
...(nodes === undefined ? {} : { nodes }),
|
|
43
|
+
...(recovery === undefined ? {} : { recovery }),
|
|
44
|
+
...(notFound === undefined ? {} : { hint: notFound }),
|
|
45
|
+
...hint,
|
|
46
|
+
};
|
|
47
|
+
io.stderr(jsonLine(output));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const usage = formatUsageHint(error, hint);
|
|
51
|
+
const recoveryHint = recovery === undefined ? "" : formatRecovery(recovery);
|
|
52
|
+
const notFoundLine = notFound === undefined ? "" : `${notFound}\n`;
|
|
53
|
+
io.stderr(`maia: ${cell(error.message)}\n${notFoundLine}${recoveryHint}${usage}`);
|
|
54
|
+
};
|
|
55
|
+
const TEMPORARY_ERROR_CODES = new Set([
|
|
56
|
+
"guard_leases_per_session_exceeded",
|
|
57
|
+
"guard_live_children_exceeded",
|
|
58
|
+
"guard_messages_per_minute_exceeded",
|
|
59
|
+
"held",
|
|
60
|
+
"saturated",
|
|
61
|
+
]);
|
|
62
|
+
const PERMISSION_ERROR_CODES = new Set([
|
|
63
|
+
"authentication_failed",
|
|
64
|
+
"context_override_forbidden",
|
|
65
|
+
"role_denied",
|
|
66
|
+
"terminal_program_not_admitted",
|
|
67
|
+
]);
|
|
68
|
+
const USAGE_ERROR_CODES = new Set([
|
|
69
|
+
"command_not_implemented",
|
|
70
|
+
"invalid_argument",
|
|
71
|
+
"node_ambiguous",
|
|
72
|
+
]);
|
|
73
|
+
const UNAVAILABLE_ERROR_CODES = new Set([
|
|
74
|
+
"node_context_unavailable",
|
|
75
|
+
"node_unavailable",
|
|
76
|
+
"platform_unsupported",
|
|
77
|
+
"terminal_containment_unsupported",
|
|
78
|
+
]);
|
|
79
|
+
export const reportError = (error, context) => {
|
|
80
|
+
writeError(error, context);
|
|
81
|
+
return exitCodeOf(error);
|
|
82
|
+
};
|
|
83
|
+
export const exitCodeOf = (error) => {
|
|
84
|
+
if (USAGE_ERROR_CODES.has(error.code))
|
|
85
|
+
return EXIT_USAGE;
|
|
86
|
+
if (error.code === "resource_not_found" ||
|
|
87
|
+
error.code === "port_lease_not_found")
|
|
88
|
+
return EXIT_DATA_NOT_FOUND;
|
|
89
|
+
if (PERMISSION_ERROR_CODES.has(error.code))
|
|
90
|
+
return EXIT_PERMISSION;
|
|
91
|
+
if (UNAVAILABLE_ERROR_CODES.has(error.code))
|
|
92
|
+
return EXIT_UNAVAILABLE;
|
|
93
|
+
if (error.code === "deadline_exceeded")
|
|
94
|
+
return EXIT_DEADLINE;
|
|
95
|
+
if (error.code === "outcome_unknown")
|
|
96
|
+
return EXIT_OUTCOME_UNKNOWN;
|
|
97
|
+
if (TEMPORARY_ERROR_CODES.has(error.code))
|
|
98
|
+
return EXIT_TEMPORARY;
|
|
99
|
+
if (error.retryable)
|
|
100
|
+
return EXIT_TEMPORARY;
|
|
101
|
+
return EXIT_SOFTWARE;
|
|
102
|
+
};
|
|
103
|
+
export const writeNodeResult = (result, context, { toResult, toText }) => {
|
|
104
|
+
if (!result.ok) {
|
|
105
|
+
return reportError(result.error, {
|
|
106
|
+
...context,
|
|
107
|
+
...(result.recovery === undefined ? {} : { recovery: result.recovery }),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
writeSuccess(toResult(result.value), context, toText);
|
|
111
|
+
return 0;
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const isTerminalControl: (character: string) => boolean;
|
|
2
|
+
export declare const cell: (value: string) => string;
|
|
3
|
+
export declare const block: (value: string) => string;
|
|
4
|
+
export declare const tab: (values: readonly unknown[]) => string;
|
|
5
|
+
export declare const fields: (entries: readonly (readonly [label: string, value: string | undefined])[]) => string;
|
|
6
|
+
export type CliTable = {
|
|
7
|
+
readonly empty: string;
|
|
8
|
+
readonly headers: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
export declare const formatRows: <TValue>(items: readonly TValue[], format: (value: TValue) => string, text?: CliTable | string) => string;
|
|
11
|
+
export declare const withNextPage: (text: string, nextCursor?: string) => string;
|
|
12
|
+
//# sourceMappingURL=rows.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const FORMAT_CHARACTER = /^\p{Cf}$/u;
|
|
2
|
+
const JOINERS = new Set([8204, 8205]);
|
|
3
|
+
export const isTerminalControl = (character) => {
|
|
4
|
+
const point = character.codePointAt(0) ?? 0;
|
|
5
|
+
return (point <= 31 ||
|
|
6
|
+
(point >= 127 && point <= 159) ||
|
|
7
|
+
point === 8232 ||
|
|
8
|
+
point === 8233 ||
|
|
9
|
+
(FORMAT_CHARACTER.test(character) && !JOINERS.has(point)));
|
|
10
|
+
};
|
|
11
|
+
const replaceControls = (value, kept) => Array.from(value, (character) => !kept.includes(character) && isTerminalControl(character) ? "�" : character).join("");
|
|
12
|
+
export const cell = (value) => replaceControls(value, "");
|
|
13
|
+
export const block = (value) => replaceControls(value, "\t\n");
|
|
14
|
+
export const tab = (values) => values.join("\t");
|
|
15
|
+
const align = (rows) => {
|
|
16
|
+
const widths = rows.reduce((sizes, row) => row.map((value, index) => Math.max(sizes[index] ?? 0, value.length)), []);
|
|
17
|
+
return `${rows
|
|
18
|
+
.map((row) => row
|
|
19
|
+
.map((value, index) => index === row.length - 1 ? value : value.padEnd(widths[index] ?? 0))
|
|
20
|
+
.join(" ")
|
|
21
|
+
.trimEnd())
|
|
22
|
+
.join("\n")}\n`;
|
|
23
|
+
};
|
|
24
|
+
export const fields = (entries) => {
|
|
25
|
+
const shown = entries.flatMap(([label, value]) => value === undefined ? [] : [[`${label}:`, cell(value)]]);
|
|
26
|
+
const width = Math.max(...shown.map(([label]) => label.length)) + 1;
|
|
27
|
+
return shown
|
|
28
|
+
.map(([label, value]) => `${label.padEnd(width)}${value}\n`)
|
|
29
|
+
.join("");
|
|
30
|
+
};
|
|
31
|
+
export const formatRows = (items, format, text) => {
|
|
32
|
+
const empty = typeof text === "object" ? text.empty : text;
|
|
33
|
+
if (items.length === 0)
|
|
34
|
+
return empty === undefined ? "" : `${empty}\n`;
|
|
35
|
+
const lines = items.map(format);
|
|
36
|
+
return typeof text === "object"
|
|
37
|
+
? align([text.headers, ...lines.map((line) => line.split("\t"))])
|
|
38
|
+
: `${lines.join("\n")}\n`;
|
|
39
|
+
};
|
|
40
|
+
export const withNextPage = (text, nextCursor) => nextCursor === undefined ? text : `${text}next: --after ${nextCursor}\n`;
|
|
41
|
+
//# sourceMappingURL=rows.js.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import type { CliNodeResult } from "../local-node/index.js";
|
|
3
|
+
import type { CommandContext } from "./context.js";
|
|
4
|
+
import { CliArgumentError } from "./input/index.js";
|
|
5
|
+
export type TwoPhaseMode = "confirm-stdin" | "dry-run" | "prompt" | "yes";
|
|
6
|
+
export declare const TWO_PHASE_FLAGS: readonly string[];
|
|
7
|
+
export declare const canPrompt: (context: CommandContext) => boolean;
|
|
8
|
+
export declare const requestedTwoPhaseMode: (flags: ReadonlySet<string>, offersYes?: boolean) => Exclude<TwoPhaseMode, "prompt"> | undefined;
|
|
9
|
+
export declare const promptOrRefuse: (context: CommandContext, offersYes?: boolean) => "prompt";
|
|
10
|
+
export declare const readTwoPhaseMode: (flags: ReadonlySet<string>, context: CommandContext, offersYes?: boolean) => TwoPhaseMode;
|
|
11
|
+
export declare const readPipedPreview: (context: CommandContext) => Effect.Effect<object, CliArgumentError>;
|
|
12
|
+
export declare const peekStdin: (context: CommandContext) => Effect.Effect<{
|
|
13
|
+
readonly context: CommandContext;
|
|
14
|
+
readonly input: unknown;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const confirmParameters: <TParameters>(schema: {
|
|
17
|
+
readonly safeParse: (input: unknown) => {
|
|
18
|
+
readonly data: TParameters;
|
|
19
|
+
readonly success: true;
|
|
20
|
+
} | {
|
|
21
|
+
readonly success: false;
|
|
22
|
+
};
|
|
23
|
+
}, preview: object, previewOnly?: readonly string[]) => Effect.Effect<TParameters, CliArgumentError>;
|
|
24
|
+
export declare const confirmationOf: (preview: object, previewOnly?: readonly string[]) => Record<string, unknown>;
|
|
25
|
+
export declare const askToConfirm: (context: CommandContext, question: string) => Effect.Effect<boolean>;
|
|
26
|
+
export declare const EXIT_CANCELLED = 1;
|
|
27
|
+
export type TwoPhaseSpec<TPreview extends object, TConfirm, TRequirements> = {
|
|
28
|
+
readonly confirm: (preview: object) => Effect.Effect<CliNodeResult<TConfirm>, CliArgumentError, TRequirements>;
|
|
29
|
+
readonly context: CommandContext;
|
|
30
|
+
readonly mode: TwoPhaseMode;
|
|
31
|
+
readonly preview: () => Effect.Effect<CliNodeResult<TPreview>, CliArgumentError, TRequirements>;
|
|
32
|
+
readonly prompt?: {
|
|
33
|
+
readonly describe: (preview: TPreview) => string;
|
|
34
|
+
readonly question: string;
|
|
35
|
+
};
|
|
36
|
+
readonly writeConfirm: (result: CliNodeResult<TConfirm>) => number;
|
|
37
|
+
readonly writePreview: (result: CliNodeResult<TPreview>) => number;
|
|
38
|
+
};
|
|
39
|
+
export declare const runTwoPhase: <TPreview extends object, TConfirm, TRequirements>(spec: TwoPhaseSpec<TPreview, TConfirm, TRequirements>) => Effect.Effect<number, CliArgumentError, TRequirements>;
|
|
40
|
+
type SafeParser<TValue> = {
|
|
41
|
+
readonly safeParse: (input: unknown) => {
|
|
42
|
+
readonly data: TValue;
|
|
43
|
+
readonly success: true;
|
|
44
|
+
} | {
|
|
45
|
+
readonly success: false;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type InputTwoPhaseSpec<TPreviewParameters, TPreview extends object, TConfirmParameters, TConfirm, TRequirements> = {
|
|
49
|
+
readonly confirm?: (parameters: TConfirmParameters) => Effect.Effect<CliNodeResult<TConfirm>, never, TRequirements>;
|
|
50
|
+
readonly confirmSchema: SafeParser<TConfirmParameters>;
|
|
51
|
+
readonly context: CommandContext;
|
|
52
|
+
readonly label: string;
|
|
53
|
+
readonly preview?: (parameters: TPreviewParameters) => Effect.Effect<CliNodeResult<TPreview>, never, TRequirements>;
|
|
54
|
+
readonly previewOnly?: readonly string[];
|
|
55
|
+
readonly previewSchema: SafeParser<TPreviewParameters>;
|
|
56
|
+
readonly tokens: readonly string[];
|
|
57
|
+
readonly write: (result: CliNodeResult<TConfirm | TPreview>) => number;
|
|
58
|
+
};
|
|
59
|
+
export declare const readInputMode: (tokens: readonly string[]) => "confirm-stdin" | "dry-run";
|
|
60
|
+
export declare const runInputTwoPhase: <TPreviewParameters, TPreview extends object, TConfirmParameters, TConfirm, TRequirements>(spec: InputTwoPhaseSpec<TPreviewParameters, TPreview, TConfirmParameters, TConfirm, TRequirements>) => Effect.Effect<number, CliArgumentError, TRequirements>;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=two-phase.d.ts.map
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import * as Cause from "effect/Cause";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Exit from "effect/Exit";
|
|
4
|
+
import { CliArgumentError, parseOptions, recoverStdin, replayStdin, requirePositionals, } from "./input/index.js";
|
|
5
|
+
import { decodeJsonText } from "./json.js";
|
|
6
|
+
export const TWO_PHASE_FLAGS = [
|
|
7
|
+
"--confirm-stdin",
|
|
8
|
+
"--dry-run",
|
|
9
|
+
];
|
|
10
|
+
export const canPrompt = (context) => context.io.interactive === true &&
|
|
11
|
+
context.io.prompt !== undefined &&
|
|
12
|
+
!context.json;
|
|
13
|
+
export const requestedTwoPhaseMode = (flags, offersYes = false) => {
|
|
14
|
+
const offered = [...TWO_PHASE_FLAGS, ...(offersYes ? ["--yes"] : [])];
|
|
15
|
+
const chosen = offered.filter((flag) => flags.has(flag));
|
|
16
|
+
if (chosen.length > 1)
|
|
17
|
+
throw new CliArgumentError(`Use one of ${offered.map((flag) => `'${flag}'`).join(", ")}.`);
|
|
18
|
+
const [flag] = chosen;
|
|
19
|
+
if (flag === "--dry-run")
|
|
20
|
+
return "dry-run";
|
|
21
|
+
if (flag === "--confirm-stdin")
|
|
22
|
+
return "confirm-stdin";
|
|
23
|
+
return flag === "--yes" ? "yes" : undefined;
|
|
24
|
+
};
|
|
25
|
+
export const promptOrRefuse = (context, offersYes = false) => {
|
|
26
|
+
if (canPrompt(context))
|
|
27
|
+
return "prompt";
|
|
28
|
+
throw new CliArgumentError(`No person can confirm here: preview with '--dry-run', then pipe that preview to '--confirm-stdin'${offersYes ? ", or confirm at once with '--yes'" : ""}.`);
|
|
29
|
+
};
|
|
30
|
+
export const readTwoPhaseMode = (flags, context, offersYes = false) => requestedTwoPhaseMode(flags, offersYes) ?? promptOrRefuse(context, offersYes);
|
|
31
|
+
const PIPED_PREVIEW = {
|
|
32
|
+
label: "preview",
|
|
33
|
+
maxBytes: 64 * 1024,
|
|
34
|
+
maxChunks: 256,
|
|
35
|
+
};
|
|
36
|
+
const invalidPreview = () => new CliArgumentError("The piped preview is invalid; pipe the output of the same command with '--json --dry-run'.");
|
|
37
|
+
const unwrapPreview = (value) => {
|
|
38
|
+
const envelope = typeof value === "object" && value !== null && "ok" in value
|
|
39
|
+
? Reflect.get(value, "result")
|
|
40
|
+
: value;
|
|
41
|
+
return typeof envelope === "object" &&
|
|
42
|
+
envelope !== null &&
|
|
43
|
+
"command" in envelope &&
|
|
44
|
+
"result" in envelope
|
|
45
|
+
? Reflect.get(envelope, "result")
|
|
46
|
+
: envelope;
|
|
47
|
+
};
|
|
48
|
+
export const readPipedPreview = (context) => Effect.gen(function* () {
|
|
49
|
+
const stdin = context.io.stdin;
|
|
50
|
+
if (stdin === undefined)
|
|
51
|
+
return yield* new CliArgumentError("Standard input is unavailable.");
|
|
52
|
+
const text = yield* stdin(PIPED_PREVIEW);
|
|
53
|
+
const preview = unwrapPreview(yield* decodeJsonText(text, invalidPreview));
|
|
54
|
+
return typeof preview === "object" && preview !== null
|
|
55
|
+
? preview
|
|
56
|
+
: yield* invalidPreview();
|
|
57
|
+
});
|
|
58
|
+
export const peekStdin = (context) => Effect.gen(function* () {
|
|
59
|
+
const { io } = context;
|
|
60
|
+
if (io.stdin === undefined)
|
|
61
|
+
return { context, input: undefined };
|
|
62
|
+
const read = yield* Effect.exit(io.stdin(PIPED_PREVIEW));
|
|
63
|
+
if (Exit.isFailure(read)) {
|
|
64
|
+
if (Cause.hasInterruptsOnly(read.cause))
|
|
65
|
+
return yield* Effect.interrupt;
|
|
66
|
+
const { cause } = read;
|
|
67
|
+
return {
|
|
68
|
+
context: {
|
|
69
|
+
...context,
|
|
70
|
+
io: { ...io, stdin: () => Effect.failCause(cause) },
|
|
71
|
+
},
|
|
72
|
+
input: undefined,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const input = yield* Effect.orElseSucceed(decodeJsonText(read.value, invalidPreview), () => ({}));
|
|
76
|
+
return {
|
|
77
|
+
context: { ...context, io: { ...io, stdin: replayStdin(read.value) } },
|
|
78
|
+
input: unwrapPreview(input),
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
export const confirmParameters = (schema, preview, previewOnly = []) => {
|
|
82
|
+
const parsed = schema.safeParse(confirmationOf(preview, previewOnly));
|
|
83
|
+
return parsed.success
|
|
84
|
+
? Effect.succeed(parsed.data)
|
|
85
|
+
: Effect.fail(invalidPreview());
|
|
86
|
+
};
|
|
87
|
+
export const confirmationOf = (preview, previewOnly = []) => Object.fromEntries(Object.entries(preview).filter(([key]) => ![
|
|
88
|
+
"actorId",
|
|
89
|
+
"expiresAt",
|
|
90
|
+
"issuedAt",
|
|
91
|
+
"method",
|
|
92
|
+
...previewOnly,
|
|
93
|
+
].includes(key)));
|
|
94
|
+
export const askToConfirm = (context, question) => {
|
|
95
|
+
const prompt = context.io.prompt;
|
|
96
|
+
if (prompt === undefined)
|
|
97
|
+
return Effect.succeed(false);
|
|
98
|
+
return Effect.map(prompt(`${question} [y/N] `), (answer) => ["y", "yes"].includes((answer ?? "").toLowerCase()));
|
|
99
|
+
};
|
|
100
|
+
export const EXIT_CANCELLED = 1;
|
|
101
|
+
const personConfirms = (context, description, question) => Effect.gen(function* () {
|
|
102
|
+
context.io.stderr(description);
|
|
103
|
+
if (yield* askToConfirm(context, question))
|
|
104
|
+
return true;
|
|
105
|
+
context.io.stderr("Cancelled; nothing changed.\n");
|
|
106
|
+
return false;
|
|
107
|
+
});
|
|
108
|
+
export const runTwoPhase = (spec) => Effect.gen(function* () {
|
|
109
|
+
const { context, mode } = spec;
|
|
110
|
+
if (mode === "confirm-stdin") {
|
|
111
|
+
const piped = yield* readPipedPreview(context);
|
|
112
|
+
return spec.writeConfirm(yield* spec.confirm(piped));
|
|
113
|
+
}
|
|
114
|
+
const { confirm, prompt, writeConfirm, writePreview } = spec;
|
|
115
|
+
const previewed = yield* spec.preview();
|
|
116
|
+
if (mode === "dry-run" || !previewed.ok)
|
|
117
|
+
return writePreview(previewed);
|
|
118
|
+
if (mode === "prompt" &&
|
|
119
|
+
(prompt === undefined ||
|
|
120
|
+
!(yield* personConfirms(context, prompt.describe(previewed.value), prompt.question))))
|
|
121
|
+
return EXIT_CANCELLED;
|
|
122
|
+
return writeConfirm(yield* confirm(previewed.value));
|
|
123
|
+
});
|
|
124
|
+
const withRecovery = (result, parameters) => {
|
|
125
|
+
if (result.ok || result.error.code !== "outcome_unknown")
|
|
126
|
+
return result;
|
|
127
|
+
const commandId = typeof parameters === "object" && parameters !== null
|
|
128
|
+
? Reflect.get(parameters, "commandId")
|
|
129
|
+
: undefined;
|
|
130
|
+
const { recovery: _claimed, ...failure } = result;
|
|
131
|
+
return typeof commandId === "string"
|
|
132
|
+
? { ...failure, recovery: { commandId } }
|
|
133
|
+
: failure;
|
|
134
|
+
};
|
|
135
|
+
const unavailableOperation = (label) => new CliArgumentError(`This CLI cannot send the ${label}.`);
|
|
136
|
+
const previewFromStdin = (context, spec) => Effect.gen(function* () {
|
|
137
|
+
const invalid = () => new CliArgumentError(`The ${spec.label} is invalid.`);
|
|
138
|
+
const stdin = context.io.stdin;
|
|
139
|
+
if (stdin === undefined)
|
|
140
|
+
return yield* invalid();
|
|
141
|
+
const text = yield* recoverStdin(stdin({ label: spec.label, maxBytes: 8192, maxChunks: 32 }), invalid);
|
|
142
|
+
const input = spec.previewSchema.safeParse(yield* decodeJsonText(text, invalid));
|
|
143
|
+
if (!input.success)
|
|
144
|
+
return yield* invalid();
|
|
145
|
+
return spec.preview === undefined
|
|
146
|
+
? yield* unavailableOperation(spec.label)
|
|
147
|
+
: yield* spec.preview(input.data);
|
|
148
|
+
});
|
|
149
|
+
const confirmPreview = (spec, previewed) => Effect.flatMap(confirmParameters(spec.confirmSchema, previewed, spec.previewOnly), (parameters) => spec.confirm === undefined
|
|
150
|
+
? Effect.fail(unavailableOperation(spec.label))
|
|
151
|
+
: Effect.map(spec.confirm(parameters), (result) => withRecovery(result, parameters)));
|
|
152
|
+
export const readInputMode = (tokens) => {
|
|
153
|
+
const parsed = parseOptions(tokens, new Set(), new Set(["--input-stdin", ...TWO_PHASE_FLAGS]));
|
|
154
|
+
requirePositionals(parsed.positionals, 0);
|
|
155
|
+
const mode = requestedTwoPhaseMode(parsed.flags);
|
|
156
|
+
const input = parsed.flags.has("--input-stdin");
|
|
157
|
+
if (mode === "confirm-stdin" && !input)
|
|
158
|
+
return mode;
|
|
159
|
+
if (mode === "dry-run" && input)
|
|
160
|
+
return mode;
|
|
161
|
+
throw new CliArgumentError(mode === "confirm-stdin"
|
|
162
|
+
? "Use one of '--input-stdin' or '--confirm-stdin'."
|
|
163
|
+
: "Preview with '--input-stdin --dry-run', then pipe that preview to '--confirm-stdin'.");
|
|
164
|
+
};
|
|
165
|
+
export const runInputTwoPhase = (spec) => Effect.suspend(() => runTwoPhase({
|
|
166
|
+
confirm: (previewed) => confirmPreview(spec, previewed),
|
|
167
|
+
context: spec.context,
|
|
168
|
+
mode: readInputMode(spec.tokens),
|
|
169
|
+
preview: () => previewFromStdin(spec.context, spec),
|
|
170
|
+
writeConfirm: spec.write,
|
|
171
|
+
writePreview: spec.write,
|
|
172
|
+
}));
|
|
173
|
+
//# sourceMappingURL=two-phase.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type CommandContext, type CommandEffect } from "../command-line/index.js";
|
|
2
|
+
export declare const runReceiptList: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
3
|
+
export declare const runReceiptShow: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
4
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { DEFAULT_RECEIPT_LIST_PAGE_SIZE, } from "@maiaos/sdk";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { CliArgumentError, parseOptions, requirePositionals, writeNodeResult, } from "../command-line/index.js";
|
|
4
|
+
import { formatReceiptList, projectReceiptListResult } from "./compact-list.js";
|
|
5
|
+
const readReceiptListPageSize = (value) => {
|
|
6
|
+
if (value === undefined)
|
|
7
|
+
return DEFAULT_RECEIPT_LIST_PAGE_SIZE;
|
|
8
|
+
if (!/^(?:[1-9]|[12]\d|3[0-2])$/u.test(value)) {
|
|
9
|
+
throw new CliArgumentError("Option '--limit' must be an integer from 1 to 32.");
|
|
10
|
+
}
|
|
11
|
+
return Number(value);
|
|
12
|
+
};
|
|
13
|
+
const optionalListFilter = (options, flag, key) => {
|
|
14
|
+
const value = options.get(flag);
|
|
15
|
+
return value === undefined ? {} : { [key]: value };
|
|
16
|
+
};
|
|
17
|
+
const readReceiptListParameters = (tokens) => {
|
|
18
|
+
const parsed = parseOptions(tokens, new Set([
|
|
19
|
+
"--actor",
|
|
20
|
+
"--after",
|
|
21
|
+
"--limit",
|
|
22
|
+
"--method",
|
|
23
|
+
"--since",
|
|
24
|
+
"--until",
|
|
25
|
+
]));
|
|
26
|
+
requirePositionals(parsed.positionals, 0);
|
|
27
|
+
return {
|
|
28
|
+
limit: readReceiptListPageSize(parsed.options.get("--limit")),
|
|
29
|
+
...optionalListFilter(parsed.options, "--actor", "actor"),
|
|
30
|
+
...optionalListFilter(parsed.options, "--after", "afterCursor"),
|
|
31
|
+
...optionalListFilter(parsed.options, "--method", "method"),
|
|
32
|
+
...optionalListFilter(parsed.options, "--since", "since"),
|
|
33
|
+
...optionalListFilter(parsed.options, "--until", "until"),
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export const runReceiptList = (tokens, context) => Effect.gen(function* () {
|
|
37
|
+
const result = yield* context.dependencies.listReceipts(readReceiptListParameters(tokens));
|
|
38
|
+
return writeNodeResult(result, context, {
|
|
39
|
+
toResult: projectReceiptListResult,
|
|
40
|
+
toText: formatReceiptList,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
export const runReceiptShow = (tokens, context) => Effect.gen(function* () {
|
|
44
|
+
const parsed = parseOptions(tokens, new Set());
|
|
45
|
+
requirePositionals(parsed.positionals, 1);
|
|
46
|
+
const commandId = parsed.positionals[0];
|
|
47
|
+
if (commandId === undefined) {
|
|
48
|
+
throw new CliArgumentError("The command identifier is missing.");
|
|
49
|
+
}
|
|
50
|
+
const result = yield* context.dependencies.getReceipt(commandId);
|
|
51
|
+
return writeNodeResult(result, context, {
|
|
52
|
+
toResult: (value) => ({
|
|
53
|
+
command: "receipt.show",
|
|
54
|
+
result: value,
|
|
55
|
+
}),
|
|
56
|
+
toText: ({ result: { receipt } }) => `${receipt.receiptId}\t${receipt.state}\t${receipt.target.type}:${receipt.target.id}\n`,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReceiptListResult } from "@maiaos/sdk";
|
|
2
|
+
type CliReceiptListItem = {
|
|
3
|
+
readonly commandId: ReceiptListResult["items"][number]["commandId"];
|
|
4
|
+
readonly createdAt: ReceiptListResult["items"][number]["createdAt"];
|
|
5
|
+
readonly method: ReceiptListResult["items"][number]["method"];
|
|
6
|
+
readonly receiptId: ReceiptListResult["items"][number]["receiptId"];
|
|
7
|
+
readonly state: ReceiptListResult["items"][number]["state"];
|
|
8
|
+
readonly target: ReceiptListResult["items"][number]["target"];
|
|
9
|
+
};
|
|
10
|
+
export type CliReceiptListResult = {
|
|
11
|
+
readonly command: "receipt.list";
|
|
12
|
+
readonly count: number;
|
|
13
|
+
readonly items: readonly CliReceiptListItem[];
|
|
14
|
+
readonly nextCursor?: ReceiptListResult["nextCursor"];
|
|
15
|
+
};
|
|
16
|
+
export declare const projectReceiptListItem: (item: ReceiptListResult["items"][number]) => CliReceiptListItem;
|
|
17
|
+
export declare const projectReceiptListResult: (value: ReceiptListResult) => CliReceiptListResult;
|
|
18
|
+
export declare const formatReceiptList: (result: CliReceiptListResult) => string;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=compact-list.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { formatRows, tab, withNextPage } from "../command-line/index.js";
|
|
2
|
+
export const projectReceiptListItem = (item) => ({
|
|
3
|
+
commandId: item.commandId,
|
|
4
|
+
createdAt: item.createdAt,
|
|
5
|
+
method: item.method,
|
|
6
|
+
receiptId: item.receiptId,
|
|
7
|
+
state: item.state,
|
|
8
|
+
target: {
|
|
9
|
+
id: item.target.id,
|
|
10
|
+
type: item.target.type,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
export const projectReceiptListResult = (value) => ({
|
|
14
|
+
command: "receipt.list",
|
|
15
|
+
count: value.items.length,
|
|
16
|
+
items: value.items.map(projectReceiptListItem),
|
|
17
|
+
...(value.nextCursor === undefined ? {} : { nextCursor: value.nextCursor }),
|
|
18
|
+
});
|
|
19
|
+
export const formatReceiptList = (result) => withNextPage(formatRows(result.items, (item) => tab([
|
|
20
|
+
item.commandId,
|
|
21
|
+
item.method,
|
|
22
|
+
item.state,
|
|
23
|
+
item.target.type,
|
|
24
|
+
item.target.id,
|
|
25
|
+
]), {
|
|
26
|
+
empty: "No receipts.",
|
|
27
|
+
headers: ["COMMAND", "METHOD", "STATE", "TARGET", "TARGET ID"],
|
|
28
|
+
}), result.nextCursor);
|
|
29
|
+
//# sourceMappingURL=compact-list.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CommandContext, type CommandEffect } from "../command-line/index.js";
|
|
2
|
+
export declare const CLI_PROTOCOL_VERSION = "maia.protocol/v1alpha1";
|
|
3
|
+
export type CliVersionResult = {
|
|
4
|
+
readonly command: "version";
|
|
5
|
+
readonly commit?: string;
|
|
6
|
+
readonly name: "maia";
|
|
7
|
+
readonly protocol: string;
|
|
8
|
+
readonly version: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const runVersion: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
11
|
+
export declare const runHelp: () => CommandEffect;
|
|
12
|
+
export declare const runCompletion: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
13
|
+
declare const agentArguments: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
14
|
+
export declare const runAgent: typeof agentArguments;
|
|
15
|
+
export declare const runAgentExtensionDigest: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=commands.d.ts.map
|