@maiaos/cli 0.1.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +287 -0
- package/dist/bin/maia.NOTICES.txt +59 -0
- package/dist/bin/maia.cdx.json +145 -0
- package/dist/bin/maia.mjs +2 -0
- package/dist/bootstrap/index.d.ts +3 -0
- package/dist/bootstrap/index.js +3 -0
- package/dist/bootstrap/process.d.ts +5 -0
- package/dist/bootstrap/process.js +45 -0
- package/dist/bootstrap/run.d.ts +25 -0
- package/dist/bootstrap/run.js +95 -0
- package/dist/bootstrap/stdio.d.ts +4 -0
- package/dist/bootstrap/stdio.js +9 -0
- package/dist/cli/cli.d.ts +17 -0
- package/dist/cli/cli.js +481 -0
- package/dist/cli/environment.d.ts +8 -0
- package/dist/cli/environment.js +12 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/services.d.ts +4 -0
- package/dist/cli/services.js +4 -0
- package/dist/command-line/context.d.ts +178 -0
- package/dist/command-line/context.js +2 -0
- package/dist/command-line/index.d.ts +7 -0
- package/dist/command-line/index.js +6 -0
- package/dist/command-line/input/arguments.d.ts +55 -0
- package/dist/command-line/input/arguments.js +220 -0
- package/dist/command-line/input/index.d.ts +4 -0
- package/dist/command-line/input/index.js +4 -0
- package/dist/command-line/input/prompt.d.ts +8 -0
- package/dist/command-line/input/prompt.js +44 -0
- package/dist/command-line/input/stdin-stream.d.ts +4 -0
- package/dist/command-line/input/stdin-stream.js +3 -0
- package/dist/command-line/input/stdin.d.ts +11 -0
- package/dist/command-line/input/stdin.js +23 -0
- package/dist/command-line/json-decoder.d.ts +3 -0
- package/dist/command-line/json-decoder.js +3 -0
- package/dist/command-line/json.d.ts +3 -0
- package/dist/command-line/json.js +4 -0
- package/dist/command-line/output.d.ts +57 -0
- package/dist/command-line/output.js +94 -0
- package/dist/command-line/rows.d.ts +10 -0
- package/dist/command-line/rows.js +32 -0
- package/dist/command-line/two-phase.d.ts +57 -0
- package/dist/command-line/two-phase.js +148 -0
- package/dist/command-receipt/command.d.ts +4 -0
- package/dist/command-receipt/command.js +59 -0
- package/dist/command-receipt/compact-list.d.ts +20 -0
- package/dist/command-receipt/compact-list.js +29 -0
- package/dist/command-receipt/index.d.ts +3 -0
- package/dist/command-receipt/index.js +3 -0
- package/dist/command-tree/commands.d.ts +17 -0
- package/dist/command-tree/commands.js +41 -0
- package/dist/command-tree/completion.d.ts +6 -0
- package/dist/command-tree/completion.js +36 -0
- package/dist/command-tree/grammar.d.ts +18 -0
- package/dist/command-tree/grammar.js +160 -0
- package/dist/command-tree/help.d.ts +62 -0
- package/dist/command-tree/help.js +219 -0
- package/dist/command-tree/index.d.ts +8 -0
- package/dist/command-tree/index.js +6 -0
- package/dist/command-tree/local.d.ts +3 -0
- package/dist/command-tree/local.js +126 -0
- package/dist/command-tree/placeholder.d.ts +3 -0
- package/dist/command-tree/placeholder.js +4 -0
- package/dist/command-tree/row.d.ts +29 -0
- package/dist/command-tree/row.js +2 -0
- package/dist/command-tree/suggest.d.ts +3 -0
- package/dist/command-tree/suggest.js +81 -0
- package/dist/command-tree/tree.d.ts +34 -0
- package/dist/command-tree/tree.js +124 -0
- package/dist/connection/client.d.ts +692 -0
- package/dist/connection/client.js +28 -0
- package/dist/connection/commands.d.ts +15 -0
- package/dist/connection/commands.js +118 -0
- package/dist/connection/index.d.ts +7 -0
- package/dist/connection/index.js +7 -0
- package/dist/connection/input.d.ts +50 -0
- package/dist/connection/input.js +90 -0
- package/dist/connection/login.d.ts +13 -0
- package/dist/connection/login.js +69 -0
- package/dist/connection/output/format.d.ts +32 -0
- package/dist/connection/output/format.js +94 -0
- package/dist/connection/output/index.d.ts +2 -0
- package/dist/connection/output/index.js +2 -0
- package/dist/connection/resolve.d.ts +60 -0
- package/dist/connection/resolve.js +30 -0
- package/dist/connection/signin.d.ts +4 -0
- package/dist/connection/signin.js +32 -0
- package/dist/connection/system.d.ts +4 -0
- package/dist/connection/system.js +190 -0
- package/dist/connection/tree/index.d.ts +2 -0
- package/dist/connection/tree/index.js +2 -0
- package/dist/connection/tree/tree.d.ts +3 -0
- package/dist/connection/tree/tree.js +209 -0
- package/dist/container/client.d.ts +142 -0
- package/dist/container/client.js +11 -0
- package/dist/container/commands.d.ts +7 -0
- package/dist/container/commands.js +100 -0
- package/dist/container/index.d.ts +3 -0
- package/dist/container/index.js +3 -0
- package/dist/container/output/format.d.ts +11 -0
- package/dist/container/output/format.js +28 -0
- package/dist/container/output/index.d.ts +2 -0
- package/dist/container/output/index.js +2 -0
- package/dist/context/client.d.ts +7 -0
- package/dist/context/client.js +21 -0
- package/dist/context/commands.d.ts +3 -0
- package/dist/context/commands.js +27 -0
- package/dist/context/index.d.ts +3 -0
- package/dist/context/index.js +3 -0
- package/dist/development/cli.d.ts +3 -0
- package/dist/development/cli.js +44 -0
- package/dist/execution/client.d.ts +25 -0
- package/dist/execution/client.js +24 -0
- package/dist/execution/index.d.ts +3 -0
- package/dist/execution/index.js +3 -0
- package/dist/execution/relocation.d.ts +6 -0
- package/dist/execution/relocation.js +123 -0
- package/dist/execution/tree/index.d.ts +2 -0
- package/dist/execution/tree/index.js +2 -0
- package/dist/execution/tree/tree.d.ts +3 -0
- package/dist/execution/tree/tree.js +137 -0
- package/dist/hold/client.d.ts +137 -0
- package/dist/hold/client.js +12 -0
- package/dist/hold/commands.d.ts +5 -0
- package/dist/hold/commands.js +91 -0
- package/dist/hold/index.d.ts +3 -0
- package/dist/hold/index.js +3 -0
- package/dist/hold/output/format.d.ts +11 -0
- package/dist/hold/output/format.js +29 -0
- package/dist/hold/output/index.d.ts +2 -0
- package/dist/hold/output/index.js +2 -0
- package/dist/hold/tree/index.d.ts +2 -0
- package/dist/hold/tree/index.js +2 -0
- package/dist/hold/tree/tree.d.ts +3 -0
- package/dist/hold/tree/tree.js +96 -0
- package/dist/import/client.d.ts +14 -0
- package/dist/import/client.js +16 -0
- package/dist/import/commands.d.ts +5 -0
- package/dist/import/commands.js +76 -0
- package/dist/import/index.d.ts +3 -0
- package/dist/import/index.js +3 -0
- package/dist/import/input.d.ts +16 -0
- package/dist/import/input.js +92 -0
- package/dist/import/output.d.ts +6 -0
- package/dist/import/output.js +40 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/integration/client.d.ts +1284 -0
- package/dist/integration/client.js +24 -0
- package/dist/integration/commands.d.ts +10 -0
- package/dist/integration/commands.js +104 -0
- package/dist/integration/index.d.ts +3 -0
- package/dist/integration/index.js +3 -0
- package/dist/integration/output.d.ts +22 -0
- package/dist/integration/output.js +20 -0
- package/dist/local-node/call.d.ts +7 -0
- package/dist/local-node/call.js +13 -0
- package/dist/local-node/client.d.ts +67 -0
- package/dist/local-node/client.js +241 -0
- package/dist/local-node/index.d.ts +3 -0
- package/dist/local-node/index.js +3 -0
- package/dist/login/agent-provider.d.ts +20 -0
- package/dist/login/agent-provider.js +109 -0
- package/dist/login/commands.d.ts +4 -0
- package/dist/login/commands.js +93 -0
- package/dist/login/failure.d.ts +3 -0
- package/dist/login/failure.js +14 -0
- package/dist/login/gateway.d.ts +12 -0
- package/dist/login/gateway.js +71 -0
- package/dist/login/index.d.ts +3 -0
- package/dist/login/index.js +2 -0
- package/dist/login/menu.d.ts +4 -0
- package/dist/login/menu.js +105 -0
- package/dist/login/output/format.d.ts +16 -0
- package/dist/login/output/format.js +31 -0
- package/dist/login/output/index.d.ts +2 -0
- package/dist/login/output/index.js +2 -0
- package/dist/login/vendor-account.d.ts +95 -0
- package/dist/login/vendor-account.js +75 -0
- package/dist/login/vendor-input.d.ts +14 -0
- package/dist/login/vendor-input.js +36 -0
- package/dist/mcp/calls.d.ts +7 -0
- package/dist/mcp/calls.js +202 -0
- package/dist/mcp/commands.d.ts +9 -0
- package/dist/mcp/commands.js +21 -0
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/server.d.ts +11 -0
- package/dist/mcp/server.js +57 -0
- package/dist/orchestration/client.d.ts +78 -0
- package/dist/orchestration/client.js +89 -0
- package/dist/orchestration/commands.d.ts +14 -0
- package/dist/orchestration/commands.js +312 -0
- package/dist/orchestration/index.d.ts +3 -0
- package/dist/orchestration/index.js +3 -0
- package/dist/orchestration/output/compact-aggregate.d.ts +121 -0
- package/dist/orchestration/output/compact-aggregate.js +110 -0
- package/dist/orchestration/output/compact-run-list.d.ts +20 -0
- package/dist/orchestration/output/compact-run-list.js +16 -0
- package/dist/orchestration/output/human.d.ts +80 -0
- package/dist/orchestration/output/human.js +252 -0
- package/dist/orchestration/output/index.d.ts +4 -0
- package/dist/orchestration/output/index.js +4 -0
- package/dist/orchestration/tree/index.d.ts +2 -0
- package/dist/orchestration/tree/index.js +2 -0
- package/dist/orchestration/tree/tree.d.ts +3 -0
- package/dist/orchestration/tree/tree.js +142 -0
- package/dist/port-lease/client.d.ts +160 -0
- package/dist/port-lease/client.js +11 -0
- package/dist/port-lease/commands.d.ts +6 -0
- package/dist/port-lease/commands.js +17 -0
- package/dist/port-lease/index.d.ts +3 -0
- package/dist/port-lease/index.js +3 -0
- package/dist/port-lease/input.d.ts +65 -0
- package/dist/port-lease/input.js +67 -0
- package/dist/port-lease/output/format.d.ts +11 -0
- package/dist/port-lease/output/format.js +24 -0
- package/dist/port-lease/output/index.d.ts +2 -0
- package/dist/port-lease/output/index.js +2 -0
- package/dist/presentation/client.d.ts +10 -0
- package/dist/presentation/client.js +9 -0
- package/dist/presentation/commands.d.ts +6 -0
- package/dist/presentation/commands.js +78 -0
- package/dist/presentation/index.d.ts +4 -0
- package/dist/presentation/index.js +3 -0
- package/dist/presentation/output/format.d.ts +11 -0
- package/dist/presentation/output/format.js +32 -0
- package/dist/presentation/output/index.d.ts +3 -0
- package/dist/presentation/output/index.js +2 -0
- package/dist/project-guard/client.d.ts +88 -0
- package/dist/project-guard/client.js +7 -0
- package/dist/project-guard/commands.d.ts +4 -0
- package/dist/project-guard/commands.js +39 -0
- package/dist/project-guard/index.d.ts +3 -0
- package/dist/project-guard/index.js +3 -0
- package/dist/project-guard/input.d.ts +18 -0
- package/dist/project-guard/input.js +47 -0
- package/dist/project-guard/output/format.d.ts +11 -0
- package/dist/project-guard/output/format.js +35 -0
- package/dist/project-guard/output/index.d.ts +2 -0
- package/dist/project-guard/output/index.js +2 -0
- package/dist/project-workspace/client.d.ts +86 -0
- package/dist/project-workspace/client.js +159 -0
- package/dist/project-workspace/commands.d.ts +30 -0
- package/dist/project-workspace/commands.js +700 -0
- package/dist/project-workspace/index.d.ts +5 -0
- package/dist/project-workspace/index.js +5 -0
- package/dist/project-workspace/metadata-client.d.ts +99 -0
- package/dist/project-workspace/metadata-client.js +8 -0
- package/dist/project-workspace/metadata-commands.d.ts +4 -0
- package/dist/project-workspace/metadata-commands.js +56 -0
- package/dist/project-workspace/output/human.d.ts +126 -0
- package/dist/project-workspace/output/human.js +103 -0
- package/dist/project-workspace/output/index.d.ts +3 -0
- package/dist/project-workspace/output/index.js +3 -0
- package/dist/project-workspace/output/metadata.d.ts +11 -0
- package/dist/project-workspace/output/metadata.js +17 -0
- package/dist/project-workspace/tree/index.d.ts +2 -0
- package/dist/project-workspace/tree/index.js +2 -0
- package/dist/project-workspace/tree/tree.d.ts +3 -0
- package/dist/project-workspace/tree/tree.js +197 -0
- package/dist/provider/client.d.ts +6 -0
- package/dist/provider/client.js +5 -0
- package/dist/provider/commands.d.ts +3 -0
- package/dist/provider/commands.js +38 -0
- package/dist/provider/index.d.ts +3 -0
- package/dist/provider/index.js +3 -0
- package/dist/reference/commands.d.ts +3 -0
- package/dist/reference/commands.js +39 -0
- package/dist/reference/index.d.ts +3 -0
- package/dist/reference/index.js +3 -0
- package/dist/reference/resolve.d.ts +29 -0
- package/dist/reference/resolve.js +294 -0
- package/dist/reference/tree/index.d.ts +2 -0
- package/dist/reference/tree/index.js +2 -0
- package/dist/reference/tree/tree.d.ts +3 -0
- package/dist/reference/tree/tree.js +17 -0
- package/dist/remote-node/client.d.ts +258 -0
- package/dist/remote-node/client.js +12 -0
- package/dist/remote-node/commands.d.ts +6 -0
- package/dist/remote-node/commands.js +264 -0
- package/dist/remote-node/connector.d.ts +59 -0
- package/dist/remote-node/connector.js +122 -0
- package/dist/remote-node/index.d.ts +4 -0
- package/dist/remote-node/index.js +4 -0
- package/dist/remote-node/reachability.d.ts +22 -0
- package/dist/remote-node/reachability.js +34 -0
- package/dist/remote-node/text.d.ts +9 -0
- package/dist/remote-node/text.js +64 -0
- package/dist/remote-node/tree/index.d.ts +2 -0
- package/dist/remote-node/tree/index.js +2 -0
- package/dist/remote-node/tree/tree.d.ts +3 -0
- package/dist/remote-node/tree/tree.js +51 -0
- package/dist/run-ledger/client.d.ts +358 -0
- package/dist/run-ledger/client.js +13 -0
- package/dist/run-ledger/commands.d.ts +8 -0
- package/dist/run-ledger/commands.js +19 -0
- package/dist/run-ledger/index.d.ts +3 -0
- package/dist/run-ledger/index.js +3 -0
- package/dist/run-ledger/input.d.ts +42 -0
- package/dist/run-ledger/input.js +107 -0
- package/dist/run-ledger/output/format.d.ts +11 -0
- package/dist/run-ledger/output/format.js +49 -0
- package/dist/run-ledger/output/index.d.ts +2 -0
- package/dist/run-ledger/output/index.js +2 -0
- package/dist/session/agent-permission.d.ts +63 -0
- package/dist/session/agent-permission.js +20 -0
- package/dist/session/approval/client.d.ts +117 -0
- package/dist/session/approval/client.js +7 -0
- package/dist/session/approval/commands.d.ts +7 -0
- package/dist/session/approval/commands.js +123 -0
- package/dist/session/approval/index.d.ts +3 -0
- package/dist/session/approval/index.js +3 -0
- package/dist/session/approval/output/format.d.ts +12 -0
- package/dist/session/approval/output/format.js +25 -0
- package/dist/session/approval/output/index.d.ts +2 -0
- package/dist/session/approval/output/index.js +2 -0
- package/dist/session/attach-client.d.ts +16 -0
- package/dist/session/attach-client.js +8 -0
- package/dist/session/attach-render.d.ts +16 -0
- package/dist/session/attach-render.js +154 -0
- package/dist/session/attach.d.ts +5 -0
- package/dist/session/attach.js +106 -0
- package/dist/session/client.d.ts +132 -0
- package/dist/session/client.js +128 -0
- package/dist/session/coding-client.d.ts +16 -0
- package/dist/session/coding-client.js +15 -0
- package/dist/session/coding-commands.d.ts +4 -0
- package/dist/session/coding-commands.js +50 -0
- package/dist/session/commands.d.ts +13 -0
- package/dist/session/commands.js +488 -0
- package/dist/session/create-tasks.d.ts +20 -0
- package/dist/session/create-tasks.js +110 -0
- package/dist/session/index.d.ts +9 -0
- package/dist/session/index.js +7 -0
- package/dist/session/interaction/client.d.ts +347 -0
- package/dist/session/interaction/client.js +15 -0
- package/dist/session/interaction/commands.d.ts +7 -0
- package/dist/session/interaction/commands.js +101 -0
- package/dist/session/interaction/index.d.ts +3 -0
- package/dist/session/interaction/index.js +3 -0
- package/dist/session/interaction/input.d.ts +15 -0
- package/dist/session/interaction/input.js +46 -0
- package/dist/session/interaction/output/format.d.ts +11 -0
- package/dist/session/interaction/output/format.js +3 -0
- package/dist/session/interaction/output/index.d.ts +2 -0
- package/dist/session/interaction/output/index.js +2 -0
- package/dist/session/output/diff.d.ts +3 -0
- package/dist/session/output/diff.js +30 -0
- package/dist/session/output/failure.d.ts +11 -0
- package/dist/session/output/failure.js +24 -0
- package/dist/session/output/human.d.ts +112 -0
- package/dist/session/output/human.js +71 -0
- package/dist/session/output/index.d.ts +6 -0
- package/dist/session/output/index.js +6 -0
- package/dist/session/output/observe.d.ts +4 -0
- package/dist/session/output/observe.js +46 -0
- package/dist/session/output/tasks.d.ts +19 -0
- package/dist/session/output/tasks.js +34 -0
- package/dist/session/rename.d.ts +3 -0
- package/dist/session/rename.js +37 -0
- package/dist/session/task-file.d.ts +5 -0
- package/dist/session/task-file.js +23 -0
- package/dist/session/tree/index.d.ts +2 -0
- package/dist/session/tree/index.js +2 -0
- package/dist/session/tree/tree.d.ts +3 -0
- package/dist/session/tree/tree.js +309 -0
- package/dist/session/turn/client.d.ts +25 -0
- package/dist/session/turn/client.js +40 -0
- package/dist/session/turn/commands.d.ts +6 -0
- package/dist/session/turn/commands.js +157 -0
- package/dist/session/turn/index.d.ts +4 -0
- package/dist/session/turn/index.js +3 -0
- package/dist/session/turn/output.d.ts +42 -0
- package/dist/session/turn/output.js +38 -0
- package/dist/status/client.d.ts +119 -0
- package/dist/status/client.js +5 -0
- package/dist/status/command.d.ts +4 -0
- package/dist/status/command.js +40 -0
- package/dist/status/doctor.d.ts +15 -0
- package/dist/status/doctor.js +111 -0
- package/dist/status/index.d.ts +5 -0
- package/dist/status/index.js +4 -0
- package/dist/status/output/compact.d.ts +31 -0
- package/dist/status/output/compact.js +46 -0
- package/dist/status/output/human.d.ts +7 -0
- package/dist/status/output/human.js +30 -0
- package/dist/status/output/index.d.ts +3 -0
- package/dist/status/output/index.js +3 -0
- package/dist/terminal/arguments.d.ts +13 -0
- package/dist/terminal/arguments.js +79 -0
- package/dist/terminal/client.d.ts +79 -0
- package/dist/terminal/client.js +68 -0
- package/dist/terminal/commands.d.ts +7 -0
- package/dist/terminal/commands.js +131 -0
- package/dist/terminal/control-commands.d.ts +10 -0
- package/dist/terminal/control-commands.js +212 -0
- package/dist/terminal/index.d.ts +4 -0
- package/dist/terminal/index.js +4 -0
- package/dist/terminal/output/compact-list.d.ts +147 -0
- package/dist/terminal/output/compact-list.js +152 -0
- package/dist/terminal/output/human.d.ts +59 -0
- package/dist/terminal/output/human.js +55 -0
- package/dist/terminal/output/index.d.ts +3 -0
- package/dist/terminal/output/index.js +3 -0
- package/dist/terminal/tree/index.d.ts +2 -0
- package/dist/terminal/tree/index.js +2 -0
- package/dist/terminal/tree/tree.d.ts +3 -0
- package/dist/terminal/tree/tree.js +104 -0
- package/guidance/maia-cli/SKILL.md +58 -0
- package/guidance/maia-orchestration/SKILL.md +54 -0
- package/package.json +76 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { MonitorBootstrapCreateResult } from "@maiaos/sdk";
|
|
2
|
+
import type { CliNodeEffect, CliNodeOperations } from "../local-node/index.js";
|
|
3
|
+
export declare const makeStatusClient: (node: CliNodeOperations) => {
|
|
4
|
+
createMonitorBootstrap: () => CliNodeEffect<MonitorBootstrapCreateResult>;
|
|
5
|
+
readStatus: () => import("effect/Effect").Effect<{
|
|
6
|
+
readonly instanceId: string;
|
|
7
|
+
readonly lifecycle: "draining" | "failed" | "ready" | "starting" | "stopped";
|
|
8
|
+
readonly pid: number;
|
|
9
|
+
readonly profile: string;
|
|
10
|
+
readonly startedAt: string;
|
|
11
|
+
readonly method: "node.status";
|
|
12
|
+
readonly processResources: {
|
|
13
|
+
readonly activeTrees: number;
|
|
14
|
+
readonly admission: {
|
|
15
|
+
readonly availableTrees: number;
|
|
16
|
+
readonly capacity: number;
|
|
17
|
+
readonly queuedSpawns: 0;
|
|
18
|
+
readonly state: "available" | "degraded" | "pressured" | "saturated" | "unavailable";
|
|
19
|
+
readonly usedTrees: number;
|
|
20
|
+
};
|
|
21
|
+
readonly capability: {
|
|
22
|
+
readonly hardLimitEnforcement: "enforced";
|
|
23
|
+
readonly metricSampling: "host_sampled";
|
|
24
|
+
readonly mode: "hard_containment";
|
|
25
|
+
readonly observedPressureTermination: "disabled";
|
|
26
|
+
readonly releaseQualified: false;
|
|
27
|
+
readonly sourceCandidate: true;
|
|
28
|
+
} | {
|
|
29
|
+
readonly hardLimitEnforcement: "unavailable";
|
|
30
|
+
readonly metricSampling: "host_sampled";
|
|
31
|
+
readonly mode: "macos_cooperative";
|
|
32
|
+
readonly observedPressureTermination: "disabled";
|
|
33
|
+
readonly releaseQualified: false;
|
|
34
|
+
readonly sourceCandidate: true;
|
|
35
|
+
} | {
|
|
36
|
+
readonly hardLimitEnforcement: "unavailable";
|
|
37
|
+
readonly metricSampling: "unavailable";
|
|
38
|
+
readonly mode: "unavailable";
|
|
39
|
+
readonly observedPressureTermination: "disabled";
|
|
40
|
+
readonly releaseQualified: false;
|
|
41
|
+
readonly sourceCandidate: false;
|
|
42
|
+
};
|
|
43
|
+
readonly cleanupUnknownTrees: number;
|
|
44
|
+
readonly fencedTrees: number;
|
|
45
|
+
readonly nextStep: "close_idle_terminal" | "inspect_cleanup_unknown" | "inspect_observed_pressure" | "none" | "verify_native_host";
|
|
46
|
+
readonly observations: {
|
|
47
|
+
readonly cpuTimeMilliseconds: {
|
|
48
|
+
readonly availableTrees: number;
|
|
49
|
+
readonly budget: "declared_per_tree_limit" | "unavailable_not_declared";
|
|
50
|
+
readonly maximumValue?: number | undefined;
|
|
51
|
+
readonly state: "available" | "partial" | "unavailable";
|
|
52
|
+
readonly unavailableTrees: number;
|
|
53
|
+
readonly warningTrees: number;
|
|
54
|
+
};
|
|
55
|
+
readonly fileDescriptorCount: {
|
|
56
|
+
readonly availableTrees: number;
|
|
57
|
+
readonly budget: "declared_per_tree_limit" | "unavailable_not_declared";
|
|
58
|
+
readonly maximumValue?: number | undefined;
|
|
59
|
+
readonly state: "available" | "partial" | "unavailable";
|
|
60
|
+
readonly unavailableTrees: number;
|
|
61
|
+
readonly warningTrees: number;
|
|
62
|
+
};
|
|
63
|
+
readonly ioReadBytes: {
|
|
64
|
+
readonly availableTrees: number;
|
|
65
|
+
readonly budget: "declared_per_tree_limit" | "unavailable_not_declared";
|
|
66
|
+
readonly maximumValue?: number | undefined;
|
|
67
|
+
readonly state: "available" | "partial" | "unavailable";
|
|
68
|
+
readonly unavailableTrees: number;
|
|
69
|
+
readonly warningTrees: number;
|
|
70
|
+
};
|
|
71
|
+
readonly ioWriteBytes: {
|
|
72
|
+
readonly availableTrees: number;
|
|
73
|
+
readonly budget: "declared_per_tree_limit" | "unavailable_not_declared";
|
|
74
|
+
readonly maximumValue?: number | undefined;
|
|
75
|
+
readonly state: "available" | "partial" | "unavailable";
|
|
76
|
+
readonly unavailableTrees: number;
|
|
77
|
+
readonly warningTrees: number;
|
|
78
|
+
};
|
|
79
|
+
readonly observedPeakRssBytes: {
|
|
80
|
+
readonly availableTrees: number;
|
|
81
|
+
readonly budget: "declared_per_tree_limit" | "unavailable_not_declared";
|
|
82
|
+
readonly maximumValue?: number | undefined;
|
|
83
|
+
readonly state: "available" | "partial" | "unavailable";
|
|
84
|
+
readonly unavailableTrees: number;
|
|
85
|
+
readonly warningTrees: number;
|
|
86
|
+
};
|
|
87
|
+
readonly processCount: {
|
|
88
|
+
readonly availableTrees: number;
|
|
89
|
+
readonly budget: "declared_per_tree_limit" | "unavailable_not_declared";
|
|
90
|
+
readonly maximumValue?: number | undefined;
|
|
91
|
+
readonly state: "available" | "partial" | "unavailable";
|
|
92
|
+
readonly unavailableTrees: number;
|
|
93
|
+
readonly warningTrees: number;
|
|
94
|
+
};
|
|
95
|
+
readonly rssBytes: {
|
|
96
|
+
readonly availableTrees: number;
|
|
97
|
+
readonly budget: "declared_per_tree_limit" | "unavailable_not_declared";
|
|
98
|
+
readonly maximumValue?: number | undefined;
|
|
99
|
+
readonly state: "available" | "partial" | "unavailable";
|
|
100
|
+
readonly unavailableTrees: number;
|
|
101
|
+
readonly warningTrees: number;
|
|
102
|
+
};
|
|
103
|
+
readonly treeCount: number;
|
|
104
|
+
};
|
|
105
|
+
readonly pressure: "admission_degraded" | "cleanup_unknown" | "healthy" | "observed_pressure" | "warning";
|
|
106
|
+
readonly supervision: {
|
|
107
|
+
readonly trackedTrees: number;
|
|
108
|
+
readonly watcherFibers: number;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
readonly storage: {
|
|
112
|
+
readonly integrity: "ok";
|
|
113
|
+
readonly journalMode: "wal";
|
|
114
|
+
readonly schemaTag: string;
|
|
115
|
+
readonly schemaVersion: number;
|
|
116
|
+
};
|
|
117
|
+
}, unknown, import("effect/Crypto").Crypto>;
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type CommandContext, type CommandEffect } from "../command-line/index.js";
|
|
2
|
+
export declare const runNodeStatus: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
3
|
+
export declare const runNodeMonitor: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
4
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { protocolErrorSchema } from "@maiaos/sdk";
|
|
2
|
+
import * as Cause from "effect/Cause";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Predicate from "effect/Predicate";
|
|
5
|
+
import { reportError, requireNoArguments, writeNodeResult, writeSuccess, } from "../command-line/index.js";
|
|
6
|
+
import { formatHumanStatus, projectStatusResult } from "./output/index.js";
|
|
7
|
+
const createUnavailableError = () => ({
|
|
8
|
+
code: "node_unavailable",
|
|
9
|
+
message: "The local Maia node is unavailable: start it with 'maia-node --desktop', or 'pnpm dev:node' in a dev worktree, then retry.",
|
|
10
|
+
retryable: true,
|
|
11
|
+
});
|
|
12
|
+
const unavailableError = (cause) => {
|
|
13
|
+
const error = Cause.squash(cause);
|
|
14
|
+
const remote = Predicate.hasProperty(error, "remoteError")
|
|
15
|
+
? protocolErrorSchema.safeParse(error.remoteError)
|
|
16
|
+
: undefined;
|
|
17
|
+
return remote?.success === true && remote.data.code === "node_unavailable"
|
|
18
|
+
? remote.data
|
|
19
|
+
: createUnavailableError();
|
|
20
|
+
};
|
|
21
|
+
export const runNodeStatus = (tokens, context) => Effect.suspend(() => {
|
|
22
|
+
requireNoArguments(tokens, "Status");
|
|
23
|
+
return context.dependencies.readStatus();
|
|
24
|
+
}).pipe(Effect.flatMap((node) => Effect.sync(() => {
|
|
25
|
+
writeSuccess(projectStatusResult(node), context, () => formatHumanStatus({ command: "status", node }));
|
|
26
|
+
return 0;
|
|
27
|
+
})), Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause)
|
|
28
|
+
? Effect.interrupt
|
|
29
|
+
: Effect.sync(() => reportError(unavailableError(cause), context))));
|
|
30
|
+
export const runNodeMonitor = (tokens, context) => {
|
|
31
|
+
requireNoArguments(tokens, "Monitor");
|
|
32
|
+
const create = context.dependencies.createMonitorBootstrap;
|
|
33
|
+
return create === undefined
|
|
34
|
+
? Effect.die(new Error("No monitor."))
|
|
35
|
+
: Effect.map(create(), (result) => writeNodeResult(result, context, {
|
|
36
|
+
toResult: (value) => ({ command: "monitor", result: value }),
|
|
37
|
+
toText: ({ result: value }) => `${value.url}\n`,
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CommandContext, type CommandEffect } from "../command-line/index.js";
|
|
2
|
+
export type DoctorCheck = {
|
|
3
|
+
readonly code: string;
|
|
4
|
+
readonly detail?: string;
|
|
5
|
+
readonly next?: string;
|
|
6
|
+
readonly ok: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type CliDoctorResult = {
|
|
9
|
+
readonly checks: readonly DoctorCheck[];
|
|
10
|
+
readonly command: "doctor";
|
|
11
|
+
readonly ok: boolean;
|
|
12
|
+
readonly version: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const runDoctor: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
15
|
+
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Option from "effect/Option";
|
|
3
|
+
import { requireNoArguments, writeSuccess, } from "../command-line/index.js";
|
|
4
|
+
const EXIT_FAILED = 70;
|
|
5
|
+
const vendorWords = (executor) => executor === "codex-cli"
|
|
6
|
+
? { integration: "codex", login: "codex" }
|
|
7
|
+
: { integration: "claude-code", login: "claude" };
|
|
8
|
+
const answer = (effect) => effect === undefined
|
|
9
|
+
? Effect.undefined
|
|
10
|
+
: Effect.map(Effect.orElseSucceed(effect, () => ({ ok: false })), (result) => (result.ok ? result.value : undefined));
|
|
11
|
+
const hasAccount = (item, connections) => item.connection?.state === "enabled" ||
|
|
12
|
+
(connections?.items ?? []).some((connection) => connection.executor === item.executor && connection.state === "enabled");
|
|
13
|
+
const workerPromptChecks = (item, version) => {
|
|
14
|
+
const code = `${item.executor}.worker-prompt`;
|
|
15
|
+
switch (item.workerPrompt) {
|
|
16
|
+
case undefined:
|
|
17
|
+
return [];
|
|
18
|
+
case "ok":
|
|
19
|
+
return [{ code, ok: true }];
|
|
20
|
+
case "inconclusive":
|
|
21
|
+
return [{ code, detail: "probe inconclusive", ok: true }];
|
|
22
|
+
case "failed":
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
code,
|
|
26
|
+
detail: `skills.* keys no longer honored by ${version === undefined ? "this Codex" : `Codex ${version}`}`,
|
|
27
|
+
next: "update Maia",
|
|
28
|
+
ok: false,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const vendorChecks = (item, connections) => {
|
|
34
|
+
const { integration, login } = vendorWords(item.executor);
|
|
35
|
+
if (!item.binary.found)
|
|
36
|
+
return [{ code: item.executor, detail: "not installed", ok: true }];
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
code: `${item.executor}.account`,
|
|
40
|
+
next: `maia setup, or maia login ${login}`,
|
|
41
|
+
ok: hasAccount(item, connections),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
code: `${item.executor}.executable`,
|
|
45
|
+
next: `maia integration plan ${integration}`,
|
|
46
|
+
ok: item.executableApproved,
|
|
47
|
+
},
|
|
48
|
+
...workerPromptChecks(item, item.binary.version),
|
|
49
|
+
].map((check) => check.ok && check.detail === undefined
|
|
50
|
+
? { code: check.code, ok: true }
|
|
51
|
+
: check);
|
|
52
|
+
};
|
|
53
|
+
const nodeChecks = (detected, connections) => {
|
|
54
|
+
if (detected === undefined)
|
|
55
|
+
return [{ code: "vendors", next: "maia connection detect", ok: false }];
|
|
56
|
+
const checks = detected.executors.flatMap((item) => vendorChecks(item, connections));
|
|
57
|
+
const usable = detected.executors.some((item) => item.binary.found &&
|
|
58
|
+
item.executableApproved &&
|
|
59
|
+
hasAccount(item, connections));
|
|
60
|
+
return [
|
|
61
|
+
...checks,
|
|
62
|
+
...(usable
|
|
63
|
+
? []
|
|
64
|
+
: [
|
|
65
|
+
{
|
|
66
|
+
code: "worker",
|
|
67
|
+
detail: "no Claude Code or Codex worker is ready",
|
|
68
|
+
next: "install Claude Code or Codex, then maia setup",
|
|
69
|
+
ok: false,
|
|
70
|
+
},
|
|
71
|
+
]),
|
|
72
|
+
];
|
|
73
|
+
};
|
|
74
|
+
const formatDoctor = (result) => `Maia doctor ${result.ok ? "ok" : "failed"}\n${result.checks
|
|
75
|
+
.map((check) => ` ${check.code}: ${check.ok ? "ok" : "failed"}${check.detail === undefined ? "" : ` (${check.detail})`}${check.ok || check.next === undefined ? "" : `; next: ${check.next}`}\n`)
|
|
76
|
+
.join("")}`;
|
|
77
|
+
const readLifecycle = (dependencies) => Effect.map(Effect.option(Effect.map(Effect.suspend(() => dependencies.readStatus()), (node) => node.lifecycle)), Option.getOrUndefined);
|
|
78
|
+
const nodeCheck = (lifecycle) => lifecycle === undefined
|
|
79
|
+
? {
|
|
80
|
+
code: "node",
|
|
81
|
+
next: "maia-node --desktop, or pnpm dev:node in a dev worktree",
|
|
82
|
+
ok: false,
|
|
83
|
+
}
|
|
84
|
+
: { code: "node", detail: lifecycle, ok: true };
|
|
85
|
+
const readChecks = (context) => Effect.gen(function* () {
|
|
86
|
+
const { dependencies, version } = context;
|
|
87
|
+
const lifecycle = yield* readLifecycle(dependencies);
|
|
88
|
+
const base = [
|
|
89
|
+
{ code: "cli", detail: version, ok: true },
|
|
90
|
+
nodeCheck(lifecycle),
|
|
91
|
+
];
|
|
92
|
+
if (lifecycle === undefined)
|
|
93
|
+
return base;
|
|
94
|
+
const detected = yield* answer(dependencies.detectConnections?.({}));
|
|
95
|
+
const connections = yield* answer(dependencies.listConnections?.({ limit: 100 }));
|
|
96
|
+
return [...base, ...nodeChecks(detected, connections)];
|
|
97
|
+
});
|
|
98
|
+
export const runDoctor = (tokens, context) => Effect.gen(function* () {
|
|
99
|
+
requireNoArguments(tokens, "Doctor");
|
|
100
|
+
const checks = yield* readChecks(context);
|
|
101
|
+
const ok = checks.every((check) => check.ok);
|
|
102
|
+
const result = {
|
|
103
|
+
checks,
|
|
104
|
+
command: "doctor",
|
|
105
|
+
ok,
|
|
106
|
+
version: context.version,
|
|
107
|
+
};
|
|
108
|
+
writeSuccess(result, context, formatDoctor);
|
|
109
|
+
return ok ? 0 : EXIT_FAILED;
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { makeStatusClient } from "./client.js";
|
|
2
|
+
export { runNodeMonitor, runNodeStatus } from "./command.js";
|
|
3
|
+
export { type CliDoctorResult, type DoctorCheck, runDoctor } from "./doctor.js";
|
|
4
|
+
export { type CliStatusResult } from "./output/index.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { LocalNodeStatusResult } from "@maiaos/sdk";
|
|
2
|
+
export declare const sumObservationWarningTrees: (observations: LocalNodeStatusResult["processResources"]["observations"]) => number;
|
|
3
|
+
export type CliCompactStatusResult = {
|
|
4
|
+
readonly command: "status";
|
|
5
|
+
readonly instanceId: LocalNodeStatusResult["instanceId"];
|
|
6
|
+
readonly lifecycle: LocalNodeStatusResult["lifecycle"];
|
|
7
|
+
readonly pid: LocalNodeStatusResult["pid"];
|
|
8
|
+
readonly processResources: {
|
|
9
|
+
readonly admission: {
|
|
10
|
+
readonly capacity: LocalNodeStatusResult["processResources"]["admission"]["capacity"];
|
|
11
|
+
readonly state: LocalNodeStatusResult["processResources"]["admission"]["state"];
|
|
12
|
+
readonly usedTrees: LocalNodeStatusResult["processResources"]["admission"]["usedTrees"];
|
|
13
|
+
};
|
|
14
|
+
readonly capability: {
|
|
15
|
+
readonly hardLimitEnforcement: LocalNodeStatusResult["processResources"]["capability"]["hardLimitEnforcement"];
|
|
16
|
+
readonly mode: LocalNodeStatusResult["processResources"]["capability"]["mode"];
|
|
17
|
+
readonly releaseQualified: LocalNodeStatusResult["processResources"]["capability"]["releaseQualified"];
|
|
18
|
+
};
|
|
19
|
+
readonly nextStep: LocalNodeStatusResult["processResources"]["nextStep"];
|
|
20
|
+
readonly pressure: LocalNodeStatusResult["processResources"]["pressure"];
|
|
21
|
+
readonly warningTrees: number;
|
|
22
|
+
};
|
|
23
|
+
readonly profile: LocalNodeStatusResult["profile"];
|
|
24
|
+
readonly storage: {
|
|
25
|
+
readonly integrity: LocalNodeStatusResult["storage"]["integrity"];
|
|
26
|
+
readonly journalMode: LocalNodeStatusResult["storage"]["journalMode"];
|
|
27
|
+
readonly schemaVersion: LocalNodeStatusResult["storage"]["schemaVersion"];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare const projectStatusResult: (node: LocalNodeStatusResult) => CliCompactStatusResult;
|
|
31
|
+
//# sourceMappingURL=compact.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const observedMetricKeys = [
|
|
2
|
+
"cpuTimeMilliseconds",
|
|
3
|
+
"fileDescriptorCount",
|
|
4
|
+
"ioReadBytes",
|
|
5
|
+
"ioWriteBytes",
|
|
6
|
+
"observedPeakRssBytes",
|
|
7
|
+
"processCount",
|
|
8
|
+
"rssBytes",
|
|
9
|
+
];
|
|
10
|
+
const warningTreesFromMetric = (metric) => "warningTrees" in metric && typeof metric.warningTrees === "number"
|
|
11
|
+
? metric.warningTrees
|
|
12
|
+
: undefined;
|
|
13
|
+
export const sumObservationWarningTrees = (observations) => observedMetricKeys.reduce((total, key) => {
|
|
14
|
+
const warningTrees = warningTreesFromMetric(observations[key]);
|
|
15
|
+
return warningTrees === undefined ? total : total + warningTrees;
|
|
16
|
+
}, 0);
|
|
17
|
+
const projectStatusAdmission = (admission) => ({
|
|
18
|
+
capacity: admission.capacity,
|
|
19
|
+
state: admission.state,
|
|
20
|
+
usedTrees: admission.usedTrees,
|
|
21
|
+
});
|
|
22
|
+
const projectStatusCapability = (capability) => ({
|
|
23
|
+
hardLimitEnforcement: capability.hardLimitEnforcement,
|
|
24
|
+
mode: capability.mode,
|
|
25
|
+
releaseQualified: capability.releaseQualified,
|
|
26
|
+
});
|
|
27
|
+
export const projectStatusResult = (node) => ({
|
|
28
|
+
command: "status",
|
|
29
|
+
instanceId: node.instanceId,
|
|
30
|
+
lifecycle: node.lifecycle,
|
|
31
|
+
pid: node.pid,
|
|
32
|
+
processResources: {
|
|
33
|
+
admission: projectStatusAdmission(node.processResources.admission),
|
|
34
|
+
capability: projectStatusCapability(node.processResources.capability),
|
|
35
|
+
nextStep: node.processResources.nextStep,
|
|
36
|
+
pressure: node.processResources.pressure,
|
|
37
|
+
warningTrees: sumObservationWarningTrees(node.processResources.observations),
|
|
38
|
+
},
|
|
39
|
+
profile: node.profile,
|
|
40
|
+
storage: {
|
|
41
|
+
integrity: node.storage.integrity,
|
|
42
|
+
journalMode: node.storage.journalMode,
|
|
43
|
+
schemaVersion: node.storage.schemaVersion,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=compact.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LocalNodeStatusResult } from "@maiaos/sdk";
|
|
2
|
+
export type CliStatusResult = {
|
|
3
|
+
readonly command: "status";
|
|
4
|
+
readonly node: LocalNodeStatusResult;
|
|
5
|
+
};
|
|
6
|
+
export declare const formatHumanStatus: (result: CliStatusResult) => string;
|
|
7
|
+
//# sourceMappingURL=human.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const processResourceNextStep = (nextStep) => {
|
|
2
|
+
switch (nextStep) {
|
|
3
|
+
case "close_idle_terminal":
|
|
4
|
+
return "close an idle Maia terminal, then retry";
|
|
5
|
+
case "inspect_cleanup_unknown":
|
|
6
|
+
return "inspect cleanup-unknown terminals and processes before restart";
|
|
7
|
+
case "inspect_observed_pressure":
|
|
8
|
+
return "inspect per-tree pressure warnings; termination stays disabled";
|
|
9
|
+
case "none":
|
|
10
|
+
return "none";
|
|
11
|
+
case "verify_native_host":
|
|
12
|
+
return "verify the native process host";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const formatObservedMetric = (label, metric) => `${label} ${metric.state}${metric.maximumValue === undefined ? "" : ` max ${String(metric.maximumValue)}`}; budget ${metric.budget}; ${String(metric.warningTrees)} warning`;
|
|
16
|
+
export const formatHumanStatus = (result) => {
|
|
17
|
+
const { node } = result;
|
|
18
|
+
const resources = node.processResources;
|
|
19
|
+
const observed = resources.observations;
|
|
20
|
+
return `Maia node ${node.lifecycle}\n profile: ${node.profile}\n pid: ${String(node.pid)}\n instance: ${node.instanceId}\n storage: ${node.storage.integrity} (${node.storage.journalMode})\n process resources: ${resources.pressure} (${resources.capability.mode}; hard limits ${resources.capability.hardLimitEnforcement}; release qualified ${String(resources.capability.releaseQualified)})\n admission: ${resources.admission.state}; ${String(resources.admission.usedTrees)}/${String(resources.admission.capacity)} used; ${String(resources.admission.availableTrees)} available; ${String(resources.admission.queuedSpawns)} queued\n ownership: ${String(resources.activeTrees)} active; ${String(resources.fencedTrees)} fenced; ${String(resources.cleanupUnknownTrees)} cleanup unknown; ${String(resources.supervision.watcherFibers)} watcher fibers\n latest target observations: ${[
|
|
21
|
+
formatObservedMetric("cpu-ms", observed.cpuTimeMilliseconds),
|
|
22
|
+
formatObservedMetric("rss-bytes", observed.rssBytes),
|
|
23
|
+
formatObservedMetric("peak-rss-bytes", observed.observedPeakRssBytes),
|
|
24
|
+
formatObservedMetric("processes", observed.processCount),
|
|
25
|
+
formatObservedMetric("fds", observed.fileDescriptorCount),
|
|
26
|
+
formatObservedMetric("io-read-bytes", observed.ioReadBytes),
|
|
27
|
+
formatObservedMetric("io-write-bytes", observed.ioWriteBytes),
|
|
28
|
+
].join("; ")}\n observed-pressure termination: ${resources.capability.observedPressureTermination}; samples are advisory, not hard enforcement or automatic kill\n inspect: --json compact; SDK lossless\n next step: ${processResourceNextStep(resources.nextStep)}\n get started: maia doctor checks accounts and integrations; maia setup uses the installed CLIs\n`;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=human.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LiveTerminalCloseParameters } from "@maiaos/sdk";
|
|
2
|
+
import { type ParsedOptions } from "../command-line/index.js";
|
|
3
|
+
export declare const readTerminalColumns: (value: string | undefined, fallback?: number) => number;
|
|
4
|
+
export declare const readTerminalRows: (value: string | undefined, fallback?: number) => number;
|
|
5
|
+
export declare const readTerminalGeneration: (parsed: ParsedOptions) => number;
|
|
6
|
+
export declare const readTerminalLeaseDuration: (parsed: ParsedOptions) => number;
|
|
7
|
+
export declare const readTerminalInputSequence: (parsed: ParsedOptions) => number;
|
|
8
|
+
export declare const readTerminalExpectedRevision: (parsed: ParsedOptions) => string;
|
|
9
|
+
type TerminalControllerFenceInput = Omit<LiveTerminalCloseParameters, "commandId">;
|
|
10
|
+
export declare const readTerminalControllerFence: (parsed: ParsedOptions, terminalId: string) => TerminalControllerFenceInput;
|
|
11
|
+
export declare const terminalControllerFenceOptionNames: readonly ["--command-id", "--controller-epoch", "--controller-expires-at", "--controller-id", "--controller-revision", "--expected-revision", "--terminal-generation"];
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=arguments.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { MAX_TERMINAL_COLUMNS, MAX_TERMINAL_CONTROLLER_LEASE_MS, MAX_TERMINAL_GENERATION, MAX_TERMINAL_INPUT_SEQUENCE, MAX_TERMINAL_ROWS, MIN_TERMINAL_COLUMNS, MIN_TERMINAL_CONTROLLER_LEASE_MS, MIN_TERMINAL_ROWS, } from "@maiaos/sdk";
|
|
2
|
+
import { CliArgumentError } from "../command-line/index.js";
|
|
3
|
+
const MAX_SIGNED_SQLITE_INTEGER = 9223372036854775807n;
|
|
4
|
+
const requiredOption = (parsed, name) => {
|
|
5
|
+
const value = parsed.options.get(name);
|
|
6
|
+
if (value === undefined) {
|
|
7
|
+
throw new CliArgumentError(`Option '${name}' is required.`);
|
|
8
|
+
}
|
|
9
|
+
return value;
|
|
10
|
+
};
|
|
11
|
+
const readBoundedInteger = (value, bounds) => {
|
|
12
|
+
const { maximum, minimum, name } = bounds;
|
|
13
|
+
if (!/^[1-9]\d*$/u.test(value)) {
|
|
14
|
+
throw new CliArgumentError(`Option '${name}' must be an integer from ${String(minimum)} to ${String(maximum)}.`);
|
|
15
|
+
}
|
|
16
|
+
const parsed = Number(value);
|
|
17
|
+
if (!Number.isSafeInteger(parsed) || parsed < minimum || parsed > maximum) {
|
|
18
|
+
throw new CliArgumentError(`Option '${name}' must be an integer from ${String(minimum)} to ${String(maximum)}.`);
|
|
19
|
+
}
|
|
20
|
+
return parsed;
|
|
21
|
+
};
|
|
22
|
+
const readRevision = (value, name) => {
|
|
23
|
+
if (!/^(?:0|[1-9]\d*)$/u.test(value) ||
|
|
24
|
+
BigInt(value) > MAX_SIGNED_SQLITE_INTEGER) {
|
|
25
|
+
throw new CliArgumentError(`Option '${name}' must be a non-negative signed 64-bit integer.`);
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
};
|
|
29
|
+
export const readTerminalColumns = (value, fallback) => readBoundedInteger(value ?? String(fallback), {
|
|
30
|
+
maximum: MAX_TERMINAL_COLUMNS,
|
|
31
|
+
minimum: MIN_TERMINAL_COLUMNS,
|
|
32
|
+
name: "--columns",
|
|
33
|
+
});
|
|
34
|
+
export const readTerminalRows = (value, fallback) => readBoundedInteger(value ?? String(fallback), {
|
|
35
|
+
maximum: MAX_TERMINAL_ROWS,
|
|
36
|
+
minimum: MIN_TERMINAL_ROWS,
|
|
37
|
+
name: "--rows",
|
|
38
|
+
});
|
|
39
|
+
export const readTerminalGeneration = (parsed) => readBoundedInteger(requiredOption(parsed, "--terminal-generation"), {
|
|
40
|
+
maximum: MAX_TERMINAL_GENERATION,
|
|
41
|
+
minimum: 1,
|
|
42
|
+
name: "--terminal-generation",
|
|
43
|
+
});
|
|
44
|
+
export const readTerminalLeaseDuration = (parsed) => readBoundedInteger(requiredOption(parsed, "--lease-ms"), {
|
|
45
|
+
maximum: MAX_TERMINAL_CONTROLLER_LEASE_MS,
|
|
46
|
+
minimum: MIN_TERMINAL_CONTROLLER_LEASE_MS,
|
|
47
|
+
name: "--lease-ms",
|
|
48
|
+
});
|
|
49
|
+
export const readTerminalInputSequence = (parsed) => readBoundedInteger(requiredOption(parsed, "--input-sequence"), {
|
|
50
|
+
maximum: MAX_TERMINAL_INPUT_SEQUENCE,
|
|
51
|
+
minimum: 1,
|
|
52
|
+
name: "--input-sequence",
|
|
53
|
+
});
|
|
54
|
+
export const readTerminalExpectedRevision = (parsed) => readRevision(requiredOption(parsed, "--expected-revision"), "--expected-revision");
|
|
55
|
+
export const readTerminalControllerFence = (parsed, terminalId) => {
|
|
56
|
+
const terminalGeneration = readTerminalGeneration(parsed);
|
|
57
|
+
return {
|
|
58
|
+
controller: {
|
|
59
|
+
epoch: readRevision(requiredOption(parsed, "--controller-epoch"), "--controller-epoch"),
|
|
60
|
+
expiresAt: requiredOption(parsed, "--controller-expires-at"),
|
|
61
|
+
id: requiredOption(parsed, "--controller-id"),
|
|
62
|
+
revision: readRevision(requiredOption(parsed, "--controller-revision"), "--controller-revision"),
|
|
63
|
+
terminalGeneration,
|
|
64
|
+
terminalId,
|
|
65
|
+
},
|
|
66
|
+
expectedTerminalRevision: readTerminalExpectedRevision(parsed),
|
|
67
|
+
terminalId,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export const terminalControllerFenceOptionNames = [
|
|
71
|
+
"--command-id",
|
|
72
|
+
"--controller-epoch",
|
|
73
|
+
"--controller-expires-at",
|
|
74
|
+
"--controller-id",
|
|
75
|
+
"--controller-revision",
|
|
76
|
+
"--expected-revision",
|
|
77
|
+
"--terminal-generation",
|
|
78
|
+
];
|
|
79
|
+
//# sourceMappingURL=arguments.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { LiveTerminalCloseParameters, LiveTerminalCloseResult, LiveTerminalControllerAcquireParameters, LiveTerminalControllerAcquireResult, LiveTerminalControllerReleaseParameters, LiveTerminalControllerReleaseResult, LiveTerminalControllerRequestParameters, LiveTerminalControllerRequestResult, LiveTerminalControllerRequestShowParameters, LiveTerminalControllerRequestShowResult, LiveTerminalResizeParameters, LiveTerminalResizeResult, LiveTerminalSignalParameters, LiveTerminalSignalResult, LiveTerminalWriteParameters, LiveTerminalWriteResult, TerminalCreateResult, TerminalEventsListResult, TerminalListResult, TerminalReadResult, TerminalShowResult } from "@maiaos/sdk";
|
|
2
|
+
import { type CliNodeEffect, type CliNodeOperations } from "../local-node/index.js";
|
|
3
|
+
export type CreateTerminalInput = {
|
|
4
|
+
readonly columns: number;
|
|
5
|
+
readonly commandId?: string;
|
|
6
|
+
readonly interactive: true;
|
|
7
|
+
readonly rows: number;
|
|
8
|
+
readonly workspaceId: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly commandId?: string;
|
|
11
|
+
readonly interactive?: false;
|
|
12
|
+
readonly workspaceId: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const makeTerminalClient: (node: CliNodeOperations) => {
|
|
15
|
+
acquireTerminalController: (input: Omit<LiveTerminalControllerAcquireParameters, "commandId"> & {
|
|
16
|
+
readonly commandId?: string;
|
|
17
|
+
}) => CliNodeEffect<LiveTerminalControllerAcquireResult>;
|
|
18
|
+
closeTerminal: (input: Omit<{
|
|
19
|
+
readonly commandId: string;
|
|
20
|
+
readonly controller: {
|
|
21
|
+
readonly epoch: string;
|
|
22
|
+
readonly expiresAt: string;
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly revision: string;
|
|
25
|
+
readonly terminalGeneration: number;
|
|
26
|
+
readonly terminalId: string;
|
|
27
|
+
};
|
|
28
|
+
readonly expectedTerminalRevision: string;
|
|
29
|
+
readonly terminalId: string;
|
|
30
|
+
}, "commandId"> & {
|
|
31
|
+
readonly commandId?: string;
|
|
32
|
+
}) => CliNodeEffect<LiveTerminalCloseResult>;
|
|
33
|
+
createTerminal: (input: CreateTerminalInput) => CliNodeEffect<TerminalCreateResult>;
|
|
34
|
+
listTerminalEvents: (input: {
|
|
35
|
+
readonly afterTerminalCursor: string;
|
|
36
|
+
readonly limit: number;
|
|
37
|
+
readonly terminalId: string;
|
|
38
|
+
}) => CliNodeEffect<TerminalEventsListResult>;
|
|
39
|
+
listTerminals: (input: {
|
|
40
|
+
readonly afterCursor: string;
|
|
41
|
+
readonly limit: number;
|
|
42
|
+
readonly workspaceId: string;
|
|
43
|
+
}) => CliNodeEffect<TerminalListResult>;
|
|
44
|
+
readTerminal: (input: {
|
|
45
|
+
readonly afterChunkCursor: string;
|
|
46
|
+
readonly limit: number;
|
|
47
|
+
readonly terminalId: string;
|
|
48
|
+
}) => CliNodeEffect<TerminalReadResult>;
|
|
49
|
+
releaseTerminalController: (input: Omit<{
|
|
50
|
+
readonly commandId: string;
|
|
51
|
+
readonly controller: {
|
|
52
|
+
readonly epoch: string;
|
|
53
|
+
readonly expiresAt: string;
|
|
54
|
+
readonly id: string;
|
|
55
|
+
readonly revision: string;
|
|
56
|
+
readonly terminalGeneration: number;
|
|
57
|
+
readonly terminalId: string;
|
|
58
|
+
};
|
|
59
|
+
readonly expectedTerminalRevision: string;
|
|
60
|
+
readonly terminalId: string;
|
|
61
|
+
}, "commandId"> & {
|
|
62
|
+
readonly commandId?: string;
|
|
63
|
+
}) => CliNodeEffect<LiveTerminalControllerReleaseResult>;
|
|
64
|
+
requestTerminalController: (input: Omit<LiveTerminalControllerRequestParameters, "commandId"> & {
|
|
65
|
+
readonly commandId?: string;
|
|
66
|
+
}) => CliNodeEffect<LiveTerminalControllerRequestResult>;
|
|
67
|
+
resizeTerminal: (input: Omit<LiveTerminalResizeParameters, "commandId"> & {
|
|
68
|
+
readonly commandId?: string;
|
|
69
|
+
}) => CliNodeEffect<LiveTerminalResizeResult>;
|
|
70
|
+
showTerminal: (terminalId: string) => CliNodeEffect<TerminalShowResult>;
|
|
71
|
+
showTerminalControllerRequest: (input: LiveTerminalControllerRequestShowParameters) => CliNodeEffect<LiveTerminalControllerRequestShowResult>;
|
|
72
|
+
signalTerminal: (input: Omit<LiveTerminalSignalParameters, "commandId"> & {
|
|
73
|
+
readonly commandId?: string;
|
|
74
|
+
}) => CliNodeEffect<LiveTerminalSignalResult>;
|
|
75
|
+
writeTerminalInput: (input: Omit<LiveTerminalWriteParameters, "commandId"> & {
|
|
76
|
+
readonly commandId?: string;
|
|
77
|
+
}) => CliNodeEffect<LiveTerminalWriteResult>;
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=client.d.ts.map
|