@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,15 @@
|
|
|
1
|
+
import { cell } from "../command-line/index.js";
|
|
2
|
+
import { tooSmall } from "./tree.js";
|
|
3
|
+
const statusLine = (profile) => `Maia dashboard | profile: ${cell(profile)}`;
|
|
4
|
+
const TREE_NOTICE = "The Tree arrives in a later version.";
|
|
5
|
+
export const plainLines = (profile) => [
|
|
6
|
+
statusLine(profile),
|
|
7
|
+
TREE_NOTICE,
|
|
8
|
+
];
|
|
9
|
+
export const frameLines = (profile, size) => {
|
|
10
|
+
const small = tooSmall(size);
|
|
11
|
+
return small === undefined
|
|
12
|
+
? [`${statusLine(profile)} | q quits`, TREE_NOTICE]
|
|
13
|
+
: [small];
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=frame.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type ModeLedger = readonly string[];
|
|
2
|
+
export declare const NO_MODES: ModeLedger;
|
|
3
|
+
export declare const observe: (ledger: ModeLedger, chunk: string) => ModeLedger;
|
|
4
|
+
export declare const resetBytes: (ledger: ModeLedger) => string;
|
|
5
|
+
//# sourceMappingURL=modes.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const MODES = [
|
|
2
|
+
["\u001B[?1049h", "\u001B[?1049l"],
|
|
3
|
+
["\u001B[?7l", "\u001B[?7h"],
|
|
4
|
+
["\u001B[?25l", "\u001B[?25h"],
|
|
5
|
+
["\u001B[?2004h", "\u001B[?2004l"],
|
|
6
|
+
["\u001B[>7u", "\u001B[<u"],
|
|
7
|
+
["\u001B[>4;2m", "\u001B[>4;0m"],
|
|
8
|
+
];
|
|
9
|
+
export const NO_MODES = [];
|
|
10
|
+
export const observe = (ledger, chunk) => MODES.filter(([on, off]) => {
|
|
11
|
+
const turnedOn = chunk.lastIndexOf(on);
|
|
12
|
+
const turnedOff = chunk.lastIndexOf(off);
|
|
13
|
+
return turnedOn === turnedOff ? ledger.includes(off) : turnedOn > turnedOff;
|
|
14
|
+
}).map(([, off]) => off);
|
|
15
|
+
export const resetBytes = (ledger) => ledger.toReversed().join("");
|
|
16
|
+
//# sourceMappingURL=modes.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MaiaClientError } from "@maiaos/sdk";
|
|
2
|
+
import type * as Crypto from "effect/Crypto";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import type * as Scope from "effect/Scope";
|
|
5
|
+
import type { CliNodeConnection } from "../local-node/index.js";
|
|
6
|
+
export declare const UNANSWERED_BEFORE_LOST = 3;
|
|
7
|
+
export type OpenConnection = (scope: Scope.Scope) => Effect.Effect<CliNodeConnection, unknown, Crypto.Crypto>;
|
|
8
|
+
export declare const noConnection: (reason: "node_connecting" | "node_unreachable", detail?: string) => MaiaClientError;
|
|
9
|
+
export type HeldConnection = {
|
|
10
|
+
readonly current: Effect.Effect<CliNodeConnection, MaiaClientError>;
|
|
11
|
+
readonly heard: (connection: CliNodeConnection, answered: boolean) => Effect.Effect<void>;
|
|
12
|
+
readonly lose: (connection: CliNodeConnection) => Effect.Effect<void>;
|
|
13
|
+
};
|
|
14
|
+
export declare const holdConnection: (open: OpenConnection) => Effect.Effect<HeldConnection, never, Crypto.Crypto | Scope.Scope>;
|
|
15
|
+
//# sourceMappingURL=node-connection.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { MaiaClientError } from "@maiaos/sdk";
|
|
2
|
+
import * as Duration from "effect/Duration";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Latch from "effect/Latch";
|
|
5
|
+
import * as Ref from "effect/Ref";
|
|
6
|
+
import * as Schedule from "effect/Schedule";
|
|
7
|
+
const RECONNECT_BACKOFF = Schedule.min([
|
|
8
|
+
Schedule.exponential(Duration.seconds(2)),
|
|
9
|
+
Schedule.spaced(Duration.seconds(30)),
|
|
10
|
+
]);
|
|
11
|
+
export const UNANSWERED_BEFORE_LOST = 3;
|
|
12
|
+
export const noConnection = (reason, detail) => new MaiaClientError("transport_failure", "The Node has no live connection; nothing was sent.", { cause: { reason, ...(detail === undefined ? {} : { detail }) } });
|
|
13
|
+
const ifHeld = (state) => (connection, change) => Effect.asVoid(Effect.flatten(Ref.modify(state, (held) => "connection" in held && held.connection === connection
|
|
14
|
+
? change(held)
|
|
15
|
+
: [Effect.void, held])));
|
|
16
|
+
const view = (state) => {
|
|
17
|
+
const onHeld = ifHeld(state);
|
|
18
|
+
return {
|
|
19
|
+
current: Effect.flatMap(Ref.get(state), (held) => "connection" in held
|
|
20
|
+
? Effect.succeed(held.connection)
|
|
21
|
+
: Effect.fail(held.failure)),
|
|
22
|
+
heard: (connection, answered) => onHeld(connection, (live) => {
|
|
23
|
+
const unanswered = answered ? 0 : live.unanswered + 1;
|
|
24
|
+
return [
|
|
25
|
+
unanswered >= UNANSWERED_BEFORE_LOST ? live.lost.open : Effect.void,
|
|
26
|
+
{ ...live, unanswered },
|
|
27
|
+
];
|
|
28
|
+
}),
|
|
29
|
+
lose: (connection) => onHeld(connection, (live) => [live.lost.open, live]),
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const generation = (open, state, attempted) => Effect.scoped(Effect.gen(function* () {
|
|
33
|
+
const connection = yield* Effect.flatMap(Effect.scope, open).pipe(Effect.tapError((error) => Ref.set(state, {
|
|
34
|
+
failure: noConnection("node_unreachable", error instanceof MaiaClientError ? error.message : undefined),
|
|
35
|
+
}).pipe(Effect.andThen(attempted.open))));
|
|
36
|
+
const lost = yield* Latch.make();
|
|
37
|
+
yield* Ref.set(state, { connection, lost, unanswered: 0 });
|
|
38
|
+
yield* attempted.open;
|
|
39
|
+
yield* lost.await;
|
|
40
|
+
yield* Ref.set(state, { failure: noConnection("node_connecting") });
|
|
41
|
+
}));
|
|
42
|
+
export const holdConnection = (open) => Effect.gen(function* () {
|
|
43
|
+
const state = yield* Ref.make({
|
|
44
|
+
failure: noConnection("node_connecting"),
|
|
45
|
+
});
|
|
46
|
+
const attempted = yield* Latch.make();
|
|
47
|
+
yield* Effect.forkScoped(Effect.forever(generation(open, state, attempted).pipe(Effect.retry(RECONNECT_BACKOFF))));
|
|
48
|
+
yield* attempted.await;
|
|
49
|
+
return view(state);
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=node-connection.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as PiTui from "@earendil-works/pi-tui";
|
|
2
|
+
import { type LoadSurface } from "./terminal.js";
|
|
3
|
+
type Library = Pick<typeof PiTui, "isKeyRelease" | "isKeyRepeat" | "matchesKey" | "ProcessTerminal" | "TuiAltScreen">;
|
|
4
|
+
export declare const loadPiTui: (importLibrary?: () => Promise<Library>) => LoadSurface;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=pi-tui.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { constVoid } from "effect/Function";
|
|
3
|
+
import { TerminalFailure } from "./terminal.js";
|
|
4
|
+
const NO_LOG_DIRECTORY = undefined;
|
|
5
|
+
const surfaceOf = (library) => {
|
|
6
|
+
const terminal = new library.ProcessTerminal();
|
|
7
|
+
const tui = new library.TuiAltScreen(terminal, false, NO_LOG_DIRECTORY, {
|
|
8
|
+
mouse: false,
|
|
9
|
+
});
|
|
10
|
+
return {
|
|
11
|
+
drain: () => terminal.drainInput(),
|
|
12
|
+
matches: (input, key) => library.matchesKey(input, key) &&
|
|
13
|
+
!library.isKeyRelease(input) &&
|
|
14
|
+
!library.isKeyRepeat(input),
|
|
15
|
+
show: (paint, onInput) => {
|
|
16
|
+
tui.addChild({ invalidate: constVoid, render: paint });
|
|
17
|
+
tui.addInputListener((input) => {
|
|
18
|
+
onInput(input);
|
|
19
|
+
return { consume: true };
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
size: () => ({ columns: terminal.columns, rows: terminal.rows }),
|
|
23
|
+
start: () => {
|
|
24
|
+
tui.start();
|
|
25
|
+
},
|
|
26
|
+
stop: () => {
|
|
27
|
+
tui.stop({ preserveScreen: true });
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export const loadPiTui = (importLibrary = () => import("@earendil-works/pi-tui")) => Effect.tryPromise({
|
|
32
|
+
catch: (cause) => new TerminalFailure({ cause, reason: "missing" }),
|
|
33
|
+
try: importLibrary,
|
|
34
|
+
}).pipe(Effect.map(surfaceOf));
|
|
35
|
+
//# sourceMappingURL=pi-tui.js.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { MAX_ATTENTION_ITEMS } from "@maiaos/client-core/cockpit";
|
|
2
|
+
import { ALARM, attentionStyle, WARNING, } from "./tree-model.js";
|
|
3
|
+
const LIMIT = { label: 12, profile: 16, reason: 16 };
|
|
4
|
+
const isDown = ({ health }) => health === "connecting" || health === "unreachable";
|
|
5
|
+
const reasonOf = (node) => {
|
|
6
|
+
if (node.health === "connecting")
|
|
7
|
+
return node.health;
|
|
8
|
+
if (node.health === "unreachable")
|
|
9
|
+
return node.lastFailure ?? node.health;
|
|
10
|
+
return [
|
|
11
|
+
node.health === "stale" || node.stale ? "stale" : "",
|
|
12
|
+
node.partial ? "partial" : "",
|
|
13
|
+
]
|
|
14
|
+
.filter((reason) => reason !== "")
|
|
15
|
+
.join(",");
|
|
16
|
+
};
|
|
17
|
+
const namesOf = (nodes, draw) => nodes
|
|
18
|
+
.filter((node) => reasonOf(node) !== "")
|
|
19
|
+
.toSorted((left, right) => Number(isDown(right)) - Number(isDown(left)))
|
|
20
|
+
.map((node) => `${draw.clip(node.hostLabel, LIMIT.label)}:${draw.clip(reasonOf(node), LIMIT.reason)}`);
|
|
21
|
+
const listed = (names, room, draw) => {
|
|
22
|
+
const [first, ...rest] = names;
|
|
23
|
+
if (first === undefined)
|
|
24
|
+
return "";
|
|
25
|
+
const used = 1 + draw.width(first);
|
|
26
|
+
const reserve = rest.length > 0 ? ` +${String(rest.length)}`.length : 0;
|
|
27
|
+
return used + reserve > room
|
|
28
|
+
? ` +${String(names.length)}`
|
|
29
|
+
: ` ${first}${listed(rest, room - used, draw)}`;
|
|
30
|
+
};
|
|
31
|
+
const countSpans = ({ nodes, state }, running) => {
|
|
32
|
+
const low = state.partial ||
|
|
33
|
+
state.stale ||
|
|
34
|
+
state.index.coverage === "truncated" ||
|
|
35
|
+
nodes.some(({ health }) => health !== "ready");
|
|
36
|
+
const lost = low || state.attention.length >= MAX_ATTENTION_ITEMS;
|
|
37
|
+
const styled = (style) => state.attention.filter(({ reason }) => attentionStyle(reason) === style)
|
|
38
|
+
.length;
|
|
39
|
+
return [
|
|
40
|
+
["ALM", styled(ALARM), ALARM, lost],
|
|
41
|
+
["WRN", styled(WARNING), WARNING, lost],
|
|
42
|
+
["RUN", running, undefined, low],
|
|
43
|
+
].map(([label, total, style, plus]) => [
|
|
44
|
+
` ${label} ${String(total)}${plus ? "+" : ""}`,
|
|
45
|
+
total > 0 ? style : undefined,
|
|
46
|
+
]);
|
|
47
|
+
};
|
|
48
|
+
export const statusBar = (input, rows, draw) => {
|
|
49
|
+
const { nodes, profile } = input;
|
|
50
|
+
const running = rows.filter(({ children, code }) => children.length === 0 && code === "RUN").length;
|
|
51
|
+
const up = nodes.filter(({ health }) => health === "ready").length;
|
|
52
|
+
const head = [
|
|
53
|
+
[draw.clip(profile, LIMIT.profile)],
|
|
54
|
+
...countSpans(input, running),
|
|
55
|
+
[` NODE ${String(up)}/${String(nodes.length)}`],
|
|
56
|
+
];
|
|
57
|
+
const room = draw.columns - draw.width(head.map(([text]) => text).join(""));
|
|
58
|
+
return [...head, [listed(namesOf(nodes, draw), room, draw)]];
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=status-bar.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { KeyId } from "@earendil-works/pi-tui";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Layer from "effect/Layer";
|
|
5
|
+
export type ScreenSize = {
|
|
6
|
+
readonly columns: number;
|
|
7
|
+
readonly rows: number;
|
|
8
|
+
};
|
|
9
|
+
export type Screen = {
|
|
10
|
+
readonly quitKeys: readonly KeyId[];
|
|
11
|
+
readonly render: (size: ScreenSize) => readonly string[];
|
|
12
|
+
};
|
|
13
|
+
export type Surface = {
|
|
14
|
+
readonly drain: () => Promise<void>;
|
|
15
|
+
readonly matches: (input: string, key: KeyId) => boolean;
|
|
16
|
+
readonly show: (paint: () => string[], onInput: (input: string) => void) => void;
|
|
17
|
+
readonly size: () => ScreenSize;
|
|
18
|
+
readonly start: () => void;
|
|
19
|
+
readonly stop: () => void;
|
|
20
|
+
};
|
|
21
|
+
type Write = (chunk: string, callback?: () => void) => unknown;
|
|
22
|
+
export type TerminalHost = {
|
|
23
|
+
readonly env: Readonly<NodeJS.ProcessEnv>;
|
|
24
|
+
readonly kill: (pid: number, signal: "SIGTSTP") => unknown;
|
|
25
|
+
readonly off: (event: string, listener: () => void) => unknown;
|
|
26
|
+
readonly on: (event: string, listener: () => void) => unknown;
|
|
27
|
+
readonly platform: NodeJS.Platform;
|
|
28
|
+
readonly stdin: {
|
|
29
|
+
readonly isTTY?: boolean;
|
|
30
|
+
readonly setRawMode?: (mode: boolean) => unknown;
|
|
31
|
+
};
|
|
32
|
+
readonly stdout: {
|
|
33
|
+
readonly isTTY?: boolean;
|
|
34
|
+
write: Write;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
declare const TerminalFailure_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
38
|
+
readonly _tag: "TerminalFailure";
|
|
39
|
+
} & Readonly<A>;
|
|
40
|
+
export declare class TerminalFailure extends TerminalFailure_base<{
|
|
41
|
+
readonly cause?: unknown;
|
|
42
|
+
readonly reason: "callback" | "missing" | "no-terminal";
|
|
43
|
+
}> {
|
|
44
|
+
}
|
|
45
|
+
declare const DashboardTerminal_base: Context.ServiceClass<DashboardTerminal, "maia/cli/DashboardTerminal", {
|
|
46
|
+
readonly run: (screen: Screen) => Effect.Effect<number, TerminalFailure>;
|
|
47
|
+
}>;
|
|
48
|
+
export declare class DashboardTerminal extends DashboardTerminal_base {
|
|
49
|
+
}
|
|
50
|
+
export type LoadSurface = Effect.Effect<Surface, TerminalFailure>;
|
|
51
|
+
export declare const terminalLayer: (host: TerminalHost, load: LoadSurface) => Layer.Layer<DashboardTerminal, never, never>;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=terminal.d.ts.map
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Data from "effect/Data";
|
|
3
|
+
import * as Deferred from "effect/Deferred";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Layer from "effect/Layer";
|
|
6
|
+
import { NO_MODES, observe, resetBytes } from "./modes.js";
|
|
7
|
+
const EXIT_SIGNALLED = 130;
|
|
8
|
+
const SHUTDOWN_SIGNALS = ["SIGHUP", "SIGINT", "SIGTERM"];
|
|
9
|
+
const SUSPEND_KEY = "ctrl+z";
|
|
10
|
+
const PROCESS_GROUP = 0;
|
|
11
|
+
const WITHOUT_JOB_CONTROL = "win32";
|
|
12
|
+
const TERMINAL_PANE = "MAIA_TERMINAL_PANE";
|
|
13
|
+
const TERMINAL_GONE = "EIO";
|
|
14
|
+
export class TerminalFailure extends Data.TaggedError("TerminalFailure") {
|
|
15
|
+
}
|
|
16
|
+
export class DashboardTerminal extends Context.Service()("maia/cli/DashboardTerminal") {
|
|
17
|
+
}
|
|
18
|
+
const ignoringGoneTerminal = (action) => {
|
|
19
|
+
try {
|
|
20
|
+
action();
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
const code = error instanceof Error ? Reflect.get(error, "code") : undefined;
|
|
24
|
+
if (code !== TERMINAL_GONE)
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const restore = (session) => {
|
|
29
|
+
const bytes = resetBytes(session.ledger);
|
|
30
|
+
session.ledger = NO_MODES;
|
|
31
|
+
if (bytes !== "")
|
|
32
|
+
session.host.stdout.write(bytes);
|
|
33
|
+
ignoringGoneTerminal(() => {
|
|
34
|
+
session.host.stdin.setRawMode?.(false);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const leave = (session) => {
|
|
38
|
+
try {
|
|
39
|
+
ignoringGoneTerminal(session.surface.stop);
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
restore(session);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const listen = (session) => {
|
|
46
|
+
const { stdout } = session.host;
|
|
47
|
+
const original = stdout.write;
|
|
48
|
+
stdout.write = (chunk, callback) => {
|
|
49
|
+
session.ledger = observe(session.ledger, chunk);
|
|
50
|
+
return original.call(stdout, chunk, callback);
|
|
51
|
+
};
|
|
52
|
+
return () => {
|
|
53
|
+
stdout.write = original;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const end = (session, code) => {
|
|
57
|
+
Deferred.doneUnsafe(session.outcome, Effect.succeed(code));
|
|
58
|
+
};
|
|
59
|
+
const attempt = (session, fallback, action) => {
|
|
60
|
+
try {
|
|
61
|
+
return action();
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
Deferred.doneUnsafe(session.outcome, Effect.fail(new TerminalFailure({ cause: error, reason: "callback" })));
|
|
65
|
+
return fallback;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const suspend = (session) => {
|
|
69
|
+
const { host, onStop, surface } = session;
|
|
70
|
+
if (host.platform === WITHOUT_JOB_CONTROL || host.env[TERMINAL_PANE] === "1")
|
|
71
|
+
return;
|
|
72
|
+
attempt(session, undefined, () => {
|
|
73
|
+
leave(session);
|
|
74
|
+
host.off("SIGTSTP", onStop);
|
|
75
|
+
host.kill(PROCESS_GROUP, "SIGTSTP");
|
|
76
|
+
host.on("SIGTSTP", onStop);
|
|
77
|
+
surface.start();
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
const present = (session) => {
|
|
81
|
+
const { screen, surface } = session;
|
|
82
|
+
surface.show(() => attempt(session, [], () => [...screen.render(surface.size())]), (input) => {
|
|
83
|
+
attempt(session, undefined, () => {
|
|
84
|
+
if (surface.matches(input, SUSPEND_KEY))
|
|
85
|
+
suspend(session);
|
|
86
|
+
else if (screen.quitKeys.some((key) => surface.matches(input, key)))
|
|
87
|
+
end(session, 0);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
attempt(session, undefined, surface.start);
|
|
91
|
+
};
|
|
92
|
+
const onExit = (session) => () => {
|
|
93
|
+
restore(session);
|
|
94
|
+
};
|
|
95
|
+
const take = (session) => {
|
|
96
|
+
const unlisten = listen(session);
|
|
97
|
+
const shutdown = () => {
|
|
98
|
+
end(session, EXIT_SIGNALLED);
|
|
99
|
+
};
|
|
100
|
+
const handlers = [
|
|
101
|
+
...SHUTDOWN_SIGNALS.map((signal) => [signal, shutdown]),
|
|
102
|
+
["SIGTSTP", session.onStop],
|
|
103
|
+
["exit", onExit(session)],
|
|
104
|
+
];
|
|
105
|
+
handlers.forEach(([event, handler]) => session.host.on(event, handler));
|
|
106
|
+
return () => {
|
|
107
|
+
unlisten();
|
|
108
|
+
handlers.forEach(([event, handler]) => session.host.off(event, handler));
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
const keep = (session, cause) => {
|
|
112
|
+
session.failure ??= { cause };
|
|
113
|
+
};
|
|
114
|
+
const release = (session, detach) => {
|
|
115
|
+
const drain = Effect.tryPromise({
|
|
116
|
+
catch: (error) => error,
|
|
117
|
+
try: () => session.surface.drain(),
|
|
118
|
+
}).pipe(Effect.catch((error) => Effect.sync(() => {
|
|
119
|
+
keep(session, error);
|
|
120
|
+
})));
|
|
121
|
+
const finish = Effect.sync(() => {
|
|
122
|
+
try {
|
|
123
|
+
leave(session);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
keep(session, error);
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
detach();
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
return Effect.ensuring(drain, finish);
|
|
133
|
+
};
|
|
134
|
+
const hold = (session) => Effect.gen(function* () {
|
|
135
|
+
yield* Effect.acquireRelease(Effect.sync(() => take(session)), (detach) => release(session, detach));
|
|
136
|
+
yield* Effect.sync(() => {
|
|
137
|
+
present(session);
|
|
138
|
+
});
|
|
139
|
+
return yield* Deferred.await(session.outcome);
|
|
140
|
+
}).pipe(Effect.scoped);
|
|
141
|
+
const run = (host, load, screen) => Effect.gen(function* () {
|
|
142
|
+
if (host.stdin.isTTY !== true || host.stdout.isTTY !== true)
|
|
143
|
+
return yield* new TerminalFailure({ reason: "no-terminal" });
|
|
144
|
+
const session = {
|
|
145
|
+
host,
|
|
146
|
+
ledger: NO_MODES,
|
|
147
|
+
onStop: () => {
|
|
148
|
+
suspend(session);
|
|
149
|
+
},
|
|
150
|
+
outcome: yield* Deferred.make(),
|
|
151
|
+
screen,
|
|
152
|
+
surface: yield* load,
|
|
153
|
+
};
|
|
154
|
+
const code = yield* hold(session);
|
|
155
|
+
return session.failure === undefined
|
|
156
|
+
? code
|
|
157
|
+
: yield* new TerminalFailure({
|
|
158
|
+
cause: session.failure.cause,
|
|
159
|
+
reason: "callback",
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
export const terminalLayer = (host, load) => Layer.succeed(DashboardTerminal, {
|
|
163
|
+
run: (screen) => run(host, load, screen),
|
|
164
|
+
});
|
|
165
|
+
//# sourceMappingURL=terminal.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AttentionReason, type CockpitState } from "@maiaos/client-core/cockpit";
|
|
2
|
+
import type { NodeView } from "@maiaos/client-core/node-registry";
|
|
3
|
+
import type { Routine } from "@maiaos/sdk";
|
|
4
|
+
export type TreeNode = NodeView & Pick<CockpitState, "partial" | "stale">;
|
|
5
|
+
export type TreeInput = {
|
|
6
|
+
readonly accounts?: ReadonlyMap<string, string>;
|
|
7
|
+
readonly nodes: readonly TreeNode[];
|
|
8
|
+
readonly now: number;
|
|
9
|
+
readonly profile: string;
|
|
10
|
+
readonly routines?: readonly Routine[];
|
|
11
|
+
readonly state: CockpitState;
|
|
12
|
+
};
|
|
13
|
+
export type Row = {
|
|
14
|
+
readonly at: string;
|
|
15
|
+
readonly cells: readonly string[];
|
|
16
|
+
readonly children: readonly Row[];
|
|
17
|
+
readonly code: string;
|
|
18
|
+
readonly depth: number;
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly marker: boolean;
|
|
21
|
+
readonly name: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const ALARM = "1;31";
|
|
24
|
+
export declare const WARNING = "33";
|
|
25
|
+
export declare const codeStyle: (code: string) => string | undefined;
|
|
26
|
+
export declare const attentionStyle: (reason: AttentionReason) => string | undefined;
|
|
27
|
+
export declare const treeRows: (input: TreeInput) => readonly Row[];
|
|
28
|
+
//# sourceMappingURL=tree-model.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { isWorking, runtimeStatus, } from "@maiaos/client-core/cockpit";
|
|
2
|
+
export const ALARM = "1;31";
|
|
3
|
+
export const WARNING = "33";
|
|
4
|
+
const CODES = [..."APPR ASK FAIL STAL DONE RUN IDLE HOLD OFF".split(" "), ""];
|
|
5
|
+
const ATTENTION_CODES = new Map([
|
|
6
|
+
["approval_pending", "APPR"],
|
|
7
|
+
["failed", "FAIL"],
|
|
8
|
+
["question", "ASK"],
|
|
9
|
+
["settled_unreviewed", "DONE"],
|
|
10
|
+
["stalled", "STAL"],
|
|
11
|
+
["turn_failed", "FAIL"],
|
|
12
|
+
]);
|
|
13
|
+
const ROUTINE_CODES = {
|
|
14
|
+
active: "IDLE",
|
|
15
|
+
disabled: "OFF",
|
|
16
|
+
paused: "HOLD",
|
|
17
|
+
};
|
|
18
|
+
export const codeStyle = (code) => [ALARM, ALARM, WARNING, WARNING][CODES.indexOf(code)];
|
|
19
|
+
export const attentionStyle = (reason) => codeStyle(ATTENTION_CODES.get(reason) ?? "");
|
|
20
|
+
const order = (left, right) => Number(left > right) - Number(left < right);
|
|
21
|
+
const byUrgency = (left, right) => CODES.indexOf(left.code) - CODES.indexOf(right.code) ||
|
|
22
|
+
order(right.at, left.at) ||
|
|
23
|
+
order(left.id, right.id);
|
|
24
|
+
const group = (head, ...blocks) => {
|
|
25
|
+
const children = blocks.flatMap((block) => block.toSorted(byUrgency));
|
|
26
|
+
const { at, code, marker } = children.toSorted(byUrgency)[0] ?? {
|
|
27
|
+
at: "",
|
|
28
|
+
code: "",
|
|
29
|
+
marker: false,
|
|
30
|
+
};
|
|
31
|
+
return { ...head, at, cells: [], children, code, marker };
|
|
32
|
+
};
|
|
33
|
+
const marked = (lookup, holder) => holder === undefined || !lookup.fresh.has(holder.nodeId);
|
|
34
|
+
const sessionCode = ({ state }, session) => {
|
|
35
|
+
const reason = state.index.attention.get(session.id);
|
|
36
|
+
if (reason !== undefined)
|
|
37
|
+
return ATTENTION_CODES.get(reason) ?? "";
|
|
38
|
+
if (session.state === "waiting-approval")
|
|
39
|
+
return "APPR";
|
|
40
|
+
if (session.state === "failed")
|
|
41
|
+
return "FAIL";
|
|
42
|
+
const runtime = runtimeStatus(state.runtimes.get(session.id));
|
|
43
|
+
return isWorking({ ...runtime, state: session.state }) ? "RUN" : "IDLE";
|
|
44
|
+
};
|
|
45
|
+
const sessionRow = (lookup, session) => {
|
|
46
|
+
const { executor, id, title, updatedAt } = session;
|
|
47
|
+
const holder = lookup.state.index.sessionNodes?.get(id);
|
|
48
|
+
const [harness = "", model = "", effort = "", account = ""] = executor === undefined
|
|
49
|
+
? []
|
|
50
|
+
: [
|
|
51
|
+
executor.kind.split("-")[0],
|
|
52
|
+
executor.model ?? "default",
|
|
53
|
+
executor.effort ?? "default",
|
|
54
|
+
lookup.accounts?.get(executor.connectionId) ?? executor.connectionId,
|
|
55
|
+
];
|
|
56
|
+
return {
|
|
57
|
+
at: updatedAt,
|
|
58
|
+
cells: [harness, model, effort, holder?.hostLabel ?? "", account],
|
|
59
|
+
children: [],
|
|
60
|
+
code: sessionCode(lookup, session),
|
|
61
|
+
depth: 2,
|
|
62
|
+
id,
|
|
63
|
+
marker: marked(lookup, holder),
|
|
64
|
+
name: title ?? id,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const routineRow = (lookup, routine) => {
|
|
68
|
+
const { id, name, state, template, updatedAt } = routine;
|
|
69
|
+
const holder = lookup.state.index.projectNodes?.get(template.projectId);
|
|
70
|
+
return {
|
|
71
|
+
at: updatedAt,
|
|
72
|
+
cells: ["", "", "", holder?.hostLabel ?? ""],
|
|
73
|
+
children: [],
|
|
74
|
+
code: ROUTINE_CODES[state],
|
|
75
|
+
depth: 2,
|
|
76
|
+
id,
|
|
77
|
+
marker: marked(lookup, holder),
|
|
78
|
+
name,
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const flatten = (row) => [
|
|
82
|
+
row,
|
|
83
|
+
...row.children.flatMap(flatten),
|
|
84
|
+
];
|
|
85
|
+
export const treeRows = (input) => {
|
|
86
|
+
const { nodes, routines = [], state } = input;
|
|
87
|
+
const fresh = nodes.filter(({ health, stale }) => health === "ready" && !stale);
|
|
88
|
+
const lookup = { ...input, fresh: new Set(fresh.map((node) => node.nodeId)) };
|
|
89
|
+
const sessionsOf = Map.groupBy(state.index.sessions.values(), (s) => s.projectId);
|
|
90
|
+
const routinesOf = Map.groupBy(routines, (r) => r.template.projectId);
|
|
91
|
+
const projectRow = (id) => group({ depth: 1, id, name: state.index.projects.get(id)?.name ?? id }, (routinesOf.get(id) ?? []).map((r) => routineRow(lookup, r)), (sessionsOf.get(id) ?? []).map((s) => sessionRow(lookup, s)));
|
|
92
|
+
return [...state.index.workspaces.values()]
|
|
93
|
+
.map(({ id, name, projectIds }) => group({ depth: 0, id, name }, projectIds.map(projectRow)))
|
|
94
|
+
.toSorted(byUrgency)
|
|
95
|
+
.flatMap(flatten);
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=tree-model.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Width } from "./draw.js";
|
|
2
|
+
import type { ScreenSize } from "./terminal.js";
|
|
3
|
+
import { type TreeInput } from "./tree-model.js";
|
|
4
|
+
export type TreeOptions = {
|
|
5
|
+
readonly color: boolean;
|
|
6
|
+
readonly width: Width;
|
|
7
|
+
};
|
|
8
|
+
export declare const tooSmall: ({ columns, rows }: ScreenSize) => string | undefined;
|
|
9
|
+
export declare const renderTree: (input: TreeInput, size: ScreenSize, { color, width }: TreeOptions) => readonly string[];
|
|
10
|
+
//# sourceMappingURL=tree.d.ts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { makeDraw } from "./draw.js";
|
|
2
|
+
import { statusBar } from "./status-bar.js";
|
|
3
|
+
import { codeStyle, treeRows } from "./tree-model.js";
|
|
4
|
+
const MINIMUM = { columns: 80, rows: 24 };
|
|
5
|
+
const COLUMNS = [
|
|
6
|
+
["HARN", 7],
|
|
7
|
+
["MODEL", 16],
|
|
8
|
+
["EFF", 8],
|
|
9
|
+
["NODE", 6],
|
|
10
|
+
["ACCT", 9],
|
|
11
|
+
];
|
|
12
|
+
const GRID_WIDTH = 55;
|
|
13
|
+
const AGE_COLUMNS = 3;
|
|
14
|
+
const BAND_ROWS = 2;
|
|
15
|
+
export const tooSmall = ({ columns, rows }) => columns < MINIMUM.columns || rows < MINIMUM.rows
|
|
16
|
+
? `Maia dashboard needs ${String(MINIMUM.columns)}x${String(MINIMUM.rows)} or more; this one is ${String(columns)}x${String(rows)}.`
|
|
17
|
+
: undefined;
|
|
18
|
+
const ageOf = (at, now) => {
|
|
19
|
+
const minutes = Math.max(0, Math.floor((now - Date.parse(at)) / 60_000));
|
|
20
|
+
if (Number.isNaN(minutes))
|
|
21
|
+
return "-";
|
|
22
|
+
const hours = Math.floor(minutes / 60);
|
|
23
|
+
const days = Math.floor(hours / 24);
|
|
24
|
+
if (minutes < 1)
|
|
25
|
+
return "<1m";
|
|
26
|
+
if (hours < 1)
|
|
27
|
+
return `${String(minutes)}m`;
|
|
28
|
+
if (days < 1)
|
|
29
|
+
return `${String(hours)}h`;
|
|
30
|
+
if (days < 100)
|
|
31
|
+
return `${String(days)}d`;
|
|
32
|
+
if (days < 365)
|
|
33
|
+
return `${String(Math.floor(days / 7))}w`;
|
|
34
|
+
return `${String(Math.min(99, Math.floor(days / 365)))}y`;
|
|
35
|
+
};
|
|
36
|
+
const grid = (draw, texts) => COLUMNS.map(([, size], index) => draw.column(texts[index] ?? "", size)).join("");
|
|
37
|
+
const rowLine = (draw, now, row) => draw.line([
|
|
38
|
+
[
|
|
39
|
+
draw.column(`${" ".repeat(row.depth)}${row.name}`, draw.columns - GRID_WIDTH),
|
|
40
|
+
],
|
|
41
|
+
[row.code.padEnd(4), codeStyle(row.code)],
|
|
42
|
+
[`${row.marker ? "?" : " "} `],
|
|
43
|
+
[grid(draw, row.cells)],
|
|
44
|
+
[ageOf(row.at, now).padStart(AGE_COLUMNS)],
|
|
45
|
+
]);
|
|
46
|
+
const headerLine = (draw) => draw.line([
|
|
47
|
+
[draw.column("NAME", draw.columns - GRID_WIDTH)],
|
|
48
|
+
["STATE "],
|
|
49
|
+
[
|
|
50
|
+
grid(draw, COLUMNS.map(([label]) => label)),
|
|
51
|
+
],
|
|
52
|
+
["AGE".padStart(AGE_COLUMNS)],
|
|
53
|
+
]);
|
|
54
|
+
export const renderTree = (input, size, { color, width }) => {
|
|
55
|
+
const draw = makeDraw({ color, columns: size.columns, width });
|
|
56
|
+
const small = tooSmall(size);
|
|
57
|
+
if (small !== undefined)
|
|
58
|
+
return [draw.line([[small]])];
|
|
59
|
+
const rows = treeRows(input);
|
|
60
|
+
const room = size.rows - BAND_ROWS;
|
|
61
|
+
const shown = rows.slice(0, rows.length > room ? room - 1 : room);
|
|
62
|
+
const empty = input.state.partial
|
|
63
|
+
? "No Workspace read yet."
|
|
64
|
+
: "No Workspace yet. Add one: maia container create --input-stdin --dry-run";
|
|
65
|
+
return [
|
|
66
|
+
draw.line(statusBar(input, rows, draw)),
|
|
67
|
+
headerLine(draw),
|
|
68
|
+
...(rows.length === 0
|
|
69
|
+
? [draw.line([[empty]])]
|
|
70
|
+
: shown.map((row) => rowLine(draw, input.now, row))),
|
|
71
|
+
...(shown.length < rows.length
|
|
72
|
+
? [draw.line([[`... ${String(rows.length - shown.length)} more rows`]])]
|
|
73
|
+
: []),
|
|
74
|
+
];
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=tree.js.map
|