@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,17 @@
|
|
|
1
|
+
const reference = () => import("../index.js");
|
|
2
|
+
export const REFERENCE_TREE = {
|
|
3
|
+
groups: [["reference", "Exact IDs for names, ID prefixes and folders."]],
|
|
4
|
+
leaves: [
|
|
5
|
+
[
|
|
6
|
+
"reference resolve <connection|container|project|session|workspace> [<reference>] [--project <project-id>]",
|
|
7
|
+
1,
|
|
8
|
+
"reference.resolve",
|
|
9
|
+
"Resolve a name, ID prefix or the current folder to an exact ID.",
|
|
10
|
+
{
|
|
11
|
+
example: "maia --json reference resolve session 'Fix the build'",
|
|
12
|
+
run: [reference, "runReferenceResolve"],
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { type RemoteNodeInstallConfirmParameters, type RemoteNodeInstallPreviewParameters, type RemoteNodeListParameters, type RemoteNodeRemoveConfirmParameters, type RemoteNodeRemovePreviewParameters } from "@maiaos/sdk";
|
|
2
|
+
import type { CliNodeOperations } from "../local-node/index.js";
|
|
3
|
+
export declare const makeRemoteNodeClient: (node: CliNodeOperations) => {
|
|
4
|
+
confirmRemoteNodeInstall: (input: RemoteNodeInstallConfirmParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
5
|
+
readonly actorId: string;
|
|
6
|
+
readonly commandId: string;
|
|
7
|
+
readonly delivery: "duplicate" | "new";
|
|
8
|
+
readonly inputDigest: string;
|
|
9
|
+
readonly node: {
|
|
10
|
+
readonly createdAt: string;
|
|
11
|
+
readonly error?: {
|
|
12
|
+
readonly code: string;
|
|
13
|
+
readonly message: string;
|
|
14
|
+
} | undefined;
|
|
15
|
+
readonly executors: readonly {
|
|
16
|
+
readonly executor: "claude-code" | "codex-cli";
|
|
17
|
+
readonly interpreter?: {
|
|
18
|
+
readonly path: string;
|
|
19
|
+
readonly sha256: string;
|
|
20
|
+
} | undefined;
|
|
21
|
+
readonly path?: string | undefined;
|
|
22
|
+
readonly realPath?: string | undefined;
|
|
23
|
+
readonly reason?: string | undefined;
|
|
24
|
+
readonly sha256?: string | undefined;
|
|
25
|
+
readonly source: "discovered" | "override";
|
|
26
|
+
readonly state: "available" | "unavailable";
|
|
27
|
+
}[];
|
|
28
|
+
readonly host: string;
|
|
29
|
+
readonly installedAt?: string | undefined;
|
|
30
|
+
readonly launcherPath: string;
|
|
31
|
+
readonly maiaVersion?: string | undefined;
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly profile: string;
|
|
34
|
+
readonly releaseId?: string | undefined;
|
|
35
|
+
readonly remaining?: readonly string[] | undefined;
|
|
36
|
+
readonly revision: string;
|
|
37
|
+
readonly root: string;
|
|
38
|
+
readonly schemaVersion: "maia.remote-node/v1";
|
|
39
|
+
readonly state: "install_failed" | "installing" | "ready" | "remove_failed" | "removed" | "removing";
|
|
40
|
+
readonly unitName: string;
|
|
41
|
+
readonly updatedAt: string;
|
|
42
|
+
};
|
|
43
|
+
readonly receipt: {
|
|
44
|
+
readonly actorId: string;
|
|
45
|
+
readonly aggregateRevision: string;
|
|
46
|
+
readonly commandId: string;
|
|
47
|
+
readonly createdAt: string;
|
|
48
|
+
readonly eventCursor: string;
|
|
49
|
+
readonly method: string;
|
|
50
|
+
readonly receiptId: string;
|
|
51
|
+
readonly schemaVersion: 1;
|
|
52
|
+
readonly state: "succeeded";
|
|
53
|
+
readonly target: {
|
|
54
|
+
readonly id: string;
|
|
55
|
+
readonly type: string;
|
|
56
|
+
};
|
|
57
|
+
readonly updatedAt: string;
|
|
58
|
+
};
|
|
59
|
+
readonly method: "node.remote.install.confirm";
|
|
60
|
+
}>;
|
|
61
|
+
previewRemoteNodeInstall: (input: RemoteNodeInstallPreviewParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
62
|
+
readonly actorId: string;
|
|
63
|
+
readonly expiresAt: string;
|
|
64
|
+
readonly inputDigest: string;
|
|
65
|
+
readonly issuedAt: string;
|
|
66
|
+
readonly proof: string;
|
|
67
|
+
readonly commandId: string;
|
|
68
|
+
readonly method: "node.remote.install.preview";
|
|
69
|
+
readonly name: string;
|
|
70
|
+
readonly plan: {
|
|
71
|
+
readonly cli: {
|
|
72
|
+
readonly path: string;
|
|
73
|
+
readonly sha256: string;
|
|
74
|
+
};
|
|
75
|
+
readonly executorChanges: readonly {
|
|
76
|
+
readonly executor: "claude-code" | "codex-cli";
|
|
77
|
+
readonly from?: {
|
|
78
|
+
readonly path: string;
|
|
79
|
+
readonly sha256: string;
|
|
80
|
+
} | undefined;
|
|
81
|
+
readonly to?: {
|
|
82
|
+
readonly path: string;
|
|
83
|
+
readonly sha256: string;
|
|
84
|
+
} | undefined;
|
|
85
|
+
}[];
|
|
86
|
+
readonly executors: readonly {
|
|
87
|
+
readonly executor: "claude-code" | "codex-cli";
|
|
88
|
+
readonly interpreter?: {
|
|
89
|
+
readonly path: string;
|
|
90
|
+
readonly sha256: string;
|
|
91
|
+
} | undefined;
|
|
92
|
+
readonly path?: string | undefined;
|
|
93
|
+
readonly realPath?: string | undefined;
|
|
94
|
+
readonly reason?: string | undefined;
|
|
95
|
+
readonly sha256?: string | undefined;
|
|
96
|
+
readonly source: "discovered" | "override";
|
|
97
|
+
readonly state: "available" | "unavailable";
|
|
98
|
+
}[];
|
|
99
|
+
readonly keep: number;
|
|
100
|
+
readonly launcherPath: string;
|
|
101
|
+
readonly maiaVersion: string;
|
|
102
|
+
readonly mode: "install" | "reinstall" | "upgrade";
|
|
103
|
+
readonly path: string;
|
|
104
|
+
readonly previousRelease?: string | undefined;
|
|
105
|
+
readonly profile: string;
|
|
106
|
+
readonly prune: {
|
|
107
|
+
readonly releases: readonly string[];
|
|
108
|
+
readonly runtimes: readonly string[];
|
|
109
|
+
};
|
|
110
|
+
readonly releaseId: string;
|
|
111
|
+
readonly root: string;
|
|
112
|
+
readonly runtimeId: string;
|
|
113
|
+
readonly unitName: string;
|
|
114
|
+
readonly uploadBytes: number;
|
|
115
|
+
};
|
|
116
|
+
readonly planDigest: string;
|
|
117
|
+
readonly state: "ready";
|
|
118
|
+
} | {
|
|
119
|
+
readonly commandId: string;
|
|
120
|
+
readonly method: "node.remote.install.preview";
|
|
121
|
+
readonly state: "probing";
|
|
122
|
+
} | {
|
|
123
|
+
readonly blockers: readonly {
|
|
124
|
+
readonly code: string;
|
|
125
|
+
readonly message: string;
|
|
126
|
+
readonly remedy?: string | undefined;
|
|
127
|
+
}[];
|
|
128
|
+
readonly commandId: string;
|
|
129
|
+
readonly facts: {
|
|
130
|
+
readonly activeRelease?: string | undefined;
|
|
131
|
+
readonly arch: string;
|
|
132
|
+
readonly distro: string;
|
|
133
|
+
readonly home: string;
|
|
134
|
+
readonly kernel: string;
|
|
135
|
+
readonly landlockAbi?: number | undefined;
|
|
136
|
+
readonly linger: string;
|
|
137
|
+
readonly os: string;
|
|
138
|
+
readonly root: string;
|
|
139
|
+
readonly rootState: "absent" | "empty" | "foreign" | "maia" | "symlink";
|
|
140
|
+
readonly systemdVersion?: number | undefined;
|
|
141
|
+
readonly user: string;
|
|
142
|
+
};
|
|
143
|
+
readonly method: "node.remote.install.preview";
|
|
144
|
+
readonly state: "blocked";
|
|
145
|
+
}>;
|
|
146
|
+
confirmRemoteNodeRemove: (input: RemoteNodeRemoveConfirmParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
147
|
+
readonly actorId: string;
|
|
148
|
+
readonly commandId: string;
|
|
149
|
+
readonly delivery: "duplicate" | "new";
|
|
150
|
+
readonly inputDigest: string;
|
|
151
|
+
readonly node: {
|
|
152
|
+
readonly createdAt: string;
|
|
153
|
+
readonly error?: {
|
|
154
|
+
readonly code: string;
|
|
155
|
+
readonly message: string;
|
|
156
|
+
} | undefined;
|
|
157
|
+
readonly executors: readonly {
|
|
158
|
+
readonly executor: "claude-code" | "codex-cli";
|
|
159
|
+
readonly interpreter?: {
|
|
160
|
+
readonly path: string;
|
|
161
|
+
readonly sha256: string;
|
|
162
|
+
} | undefined;
|
|
163
|
+
readonly path?: string | undefined;
|
|
164
|
+
readonly realPath?: string | undefined;
|
|
165
|
+
readonly reason?: string | undefined;
|
|
166
|
+
readonly sha256?: string | undefined;
|
|
167
|
+
readonly source: "discovered" | "override";
|
|
168
|
+
readonly state: "available" | "unavailable";
|
|
169
|
+
}[];
|
|
170
|
+
readonly host: string;
|
|
171
|
+
readonly installedAt?: string | undefined;
|
|
172
|
+
readonly launcherPath: string;
|
|
173
|
+
readonly maiaVersion?: string | undefined;
|
|
174
|
+
readonly name: string;
|
|
175
|
+
readonly profile: string;
|
|
176
|
+
readonly releaseId?: string | undefined;
|
|
177
|
+
readonly remaining?: readonly string[] | undefined;
|
|
178
|
+
readonly revision: string;
|
|
179
|
+
readonly root: string;
|
|
180
|
+
readonly schemaVersion: "maia.remote-node/v1";
|
|
181
|
+
readonly state: "install_failed" | "installing" | "ready" | "remove_failed" | "removed" | "removing";
|
|
182
|
+
readonly unitName: string;
|
|
183
|
+
readonly updatedAt: string;
|
|
184
|
+
};
|
|
185
|
+
readonly receipt: {
|
|
186
|
+
readonly actorId: string;
|
|
187
|
+
readonly aggregateRevision: string;
|
|
188
|
+
readonly commandId: string;
|
|
189
|
+
readonly createdAt: string;
|
|
190
|
+
readonly eventCursor: string;
|
|
191
|
+
readonly method: string;
|
|
192
|
+
readonly receiptId: string;
|
|
193
|
+
readonly schemaVersion: 1;
|
|
194
|
+
readonly state: "succeeded";
|
|
195
|
+
readonly target: {
|
|
196
|
+
readonly id: string;
|
|
197
|
+
readonly type: string;
|
|
198
|
+
};
|
|
199
|
+
readonly updatedAt: string;
|
|
200
|
+
};
|
|
201
|
+
readonly method: "node.remote.remove.confirm";
|
|
202
|
+
}>;
|
|
203
|
+
listRemoteNodes: (input: RemoteNodeListParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
204
|
+
readonly method: "node.remote.list";
|
|
205
|
+
readonly nodes: readonly {
|
|
206
|
+
readonly createdAt: string;
|
|
207
|
+
readonly error?: {
|
|
208
|
+
readonly code: string;
|
|
209
|
+
readonly message: string;
|
|
210
|
+
} | undefined;
|
|
211
|
+
readonly executors: readonly {
|
|
212
|
+
readonly executor: "claude-code" | "codex-cli";
|
|
213
|
+
readonly interpreter?: {
|
|
214
|
+
readonly path: string;
|
|
215
|
+
readonly sha256: string;
|
|
216
|
+
} | undefined;
|
|
217
|
+
readonly path?: string | undefined;
|
|
218
|
+
readonly realPath?: string | undefined;
|
|
219
|
+
readonly reason?: string | undefined;
|
|
220
|
+
readonly sha256?: string | undefined;
|
|
221
|
+
readonly source: "discovered" | "override";
|
|
222
|
+
readonly state: "available" | "unavailable";
|
|
223
|
+
}[];
|
|
224
|
+
readonly host: string;
|
|
225
|
+
readonly installedAt?: string | undefined;
|
|
226
|
+
readonly launcherPath: string;
|
|
227
|
+
readonly maiaVersion?: string | undefined;
|
|
228
|
+
readonly name: string;
|
|
229
|
+
readonly profile: string;
|
|
230
|
+
readonly releaseId?: string | undefined;
|
|
231
|
+
readonly remaining?: readonly string[] | undefined;
|
|
232
|
+
readonly revision: string;
|
|
233
|
+
readonly root: string;
|
|
234
|
+
readonly schemaVersion: "maia.remote-node/v1";
|
|
235
|
+
readonly state: "install_failed" | "installing" | "ready" | "remove_failed" | "removed" | "removing";
|
|
236
|
+
readonly unitName: string;
|
|
237
|
+
readonly updatedAt: string;
|
|
238
|
+
}[];
|
|
239
|
+
}>;
|
|
240
|
+
previewRemoteNodeRemove: (input: RemoteNodeRemovePreviewParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
241
|
+
readonly host: string;
|
|
242
|
+
readonly profile: string;
|
|
243
|
+
readonly actorId: string;
|
|
244
|
+
readonly expiresAt: string;
|
|
245
|
+
readonly inputDigest: string;
|
|
246
|
+
readonly issuedAt: string;
|
|
247
|
+
readonly proof: string;
|
|
248
|
+
readonly commandId: string;
|
|
249
|
+
readonly expectedRevision: string;
|
|
250
|
+
readonly method: "node.remote.remove.preview";
|
|
251
|
+
readonly name: string;
|
|
252
|
+
readonly purge: boolean;
|
|
253
|
+
readonly root: string;
|
|
254
|
+
readonly unitName: string;
|
|
255
|
+
}>;
|
|
256
|
+
};
|
|
257
|
+
export type RemoteNodeCliDependencies = ReturnType<typeof makeRemoteNodeClient>;
|
|
258
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { remoteNodeInstallConfirmParametersSchema, remoteNodeInstallPreviewParametersSchema, remoteNodeListParametersSchema, remoteNodeRemoveConfirmParametersSchema, remoteNodeRemovePreviewParametersSchema, } from "@maiaos/sdk";
|
|
2
|
+
const installOperations = (node) => ({
|
|
3
|
+
confirmRemoteNodeInstall: (input) => node.runValidatedNodeOperation(input, remoteNodeInstallConfirmParametersSchema, (client, parameters, options) => client.confirmRemoteNodeInstall(parameters, options), { commandId: input.commandId }),
|
|
4
|
+
previewRemoteNodeInstall: (input) => node.runValidatedNodeOperation(input, remoteNodeInstallPreviewParametersSchema, (client, parameters, options) => client.previewRemoteNodeInstall(parameters, options)),
|
|
5
|
+
});
|
|
6
|
+
export const makeRemoteNodeClient = (node) => ({
|
|
7
|
+
...installOperations(node),
|
|
8
|
+
confirmRemoteNodeRemove: (input) => node.runValidatedNodeOperation(input, remoteNodeRemoveConfirmParametersSchema, (client, parameters, options) => client.confirmRemoteNodeRemove(parameters, options), { commandId: input.commandId }),
|
|
9
|
+
listRemoteNodes: (input) => node.runValidatedNodeOperation(input, remoteNodeListParametersSchema, (client, parameters, options) => client.listRemoteNodes(parameters, options)),
|
|
10
|
+
previewRemoteNodeRemove: (input) => node.runValidatedNodeOperation(input, remoteNodeRemovePreviewParametersSchema, (client, parameters, options) => client.previewRemoteNodeRemove(parameters, options)),
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type CommandContext, type CommandEffect } from "../command-line/index.js";
|
|
2
|
+
export declare const nameFromHost: (host: string) => string;
|
|
3
|
+
export declare const runNodeInstall: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
4
|
+
export declare const runNodeList: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
5
|
+
export declare const runNodeRemove: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
6
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import { remoteNodeInstallConfirmParametersSchema, remoteNodeRemoveConfirmParametersSchema, } from "@maiaos/sdk";
|
|
4
|
+
import * as Data from "effect/Data";
|
|
5
|
+
import * as Duration from "effect/Duration";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as Schedule from "effect/Schedule";
|
|
8
|
+
import { askToConfirm, CliArgumentError, confirmParameters, missingArgument, parseOptions, promptOrRefuse, readPipedPreview, reportError, requestedTwoPhaseMode, requirePositionals, TWO_PHASE_FLAGS, } from "../command-line/index.js";
|
|
9
|
+
import { commandIdentifier, } from "../local-node/index.js";
|
|
10
|
+
import { checkReachability } from "./reachability.js";
|
|
11
|
+
import { installedText, listText, planText, removedText } from "./text.js";
|
|
12
|
+
const WAIT_MS = 3500;
|
|
13
|
+
const PROBE_DEADLINE = Duration.minutes(3);
|
|
14
|
+
const JOB_DEADLINE = Duration.minutes(20);
|
|
15
|
+
const EXIT_UNAVAILABLE = 69;
|
|
16
|
+
const EXIT_TEMPORARY = 75;
|
|
17
|
+
const cancelled = (context) => {
|
|
18
|
+
context.io.stderr("Cancelled; nothing changed on the host.\n");
|
|
19
|
+
return 1;
|
|
20
|
+
};
|
|
21
|
+
class NodeCommandError extends Data.TaggedError("NodeCommandError") {
|
|
22
|
+
}
|
|
23
|
+
const required = (effect) => Effect.flatMap(effect, (result) => result.ok
|
|
24
|
+
? Effect.succeed(result.value)
|
|
25
|
+
: Effect.fail(new NodeCommandError({ error: result.error })));
|
|
26
|
+
const operation = (value) => {
|
|
27
|
+
if (value === undefined)
|
|
28
|
+
throw new CliArgumentError("Remote Nodes are unavailable in this CLI.");
|
|
29
|
+
return value;
|
|
30
|
+
};
|
|
31
|
+
export const nameFromHost = (host) => {
|
|
32
|
+
const name = (host.split("@").at(-1) ?? "")
|
|
33
|
+
.toLowerCase()
|
|
34
|
+
.replaceAll(/[^a-z0-9-]+/gu, "-")
|
|
35
|
+
.replace(/^-+/u, "")
|
|
36
|
+
.slice(0, 63)
|
|
37
|
+
.replace(/-+$/u, "");
|
|
38
|
+
if (name === "")
|
|
39
|
+
throw new CliArgumentError("Name the Node with --name <name>.");
|
|
40
|
+
return name;
|
|
41
|
+
};
|
|
42
|
+
const readKeep = (value = "3") => {
|
|
43
|
+
if (!/^[2-8]$/u.test(value))
|
|
44
|
+
throw new CliArgumentError("--keep must be 2 to 8.");
|
|
45
|
+
return Number(value);
|
|
46
|
+
};
|
|
47
|
+
const ADD_OPTIONS = new Set([
|
|
48
|
+
"--claude-bin",
|
|
49
|
+
"--codex-bin",
|
|
50
|
+
"--command-id",
|
|
51
|
+
"--keep",
|
|
52
|
+
"--name",
|
|
53
|
+
"--node-runtime",
|
|
54
|
+
"--release",
|
|
55
|
+
"--remote-profile",
|
|
56
|
+
"--root",
|
|
57
|
+
]);
|
|
58
|
+
const optionalBinaries = (options) => {
|
|
59
|
+
const codexBin = options.get("--codex-bin");
|
|
60
|
+
const claudeBin = options.get("--claude-bin");
|
|
61
|
+
return {
|
|
62
|
+
...(claudeBin === undefined ? {} : { claudeBin }),
|
|
63
|
+
...(codexBin === undefined ? {} : { codexBin }),
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
const CONFIRM_FLAGS = new Set(["--yes", ...TWO_PHASE_FLAGS]);
|
|
67
|
+
const readAdd = ({ options, positionals }) => {
|
|
68
|
+
requirePositionals(positionals, 1);
|
|
69
|
+
const host = positionals[0] ?? "";
|
|
70
|
+
const release = options.get("--release");
|
|
71
|
+
const runtime = options.get("--node-runtime");
|
|
72
|
+
if (release === undefined || runtime === undefined)
|
|
73
|
+
throw missingArgument();
|
|
74
|
+
return {
|
|
75
|
+
commandId: options.get("--command-id"),
|
|
76
|
+
parameters: {
|
|
77
|
+
...optionalBinaries(options),
|
|
78
|
+
host,
|
|
79
|
+
keep: readKeep(options.get("--keep")),
|
|
80
|
+
name: options.get("--name") ?? nameFromHost(host),
|
|
81
|
+
nodeRuntime: resolve(process.cwd(), runtime),
|
|
82
|
+
profile: options.get("--remote-profile") ?? "default",
|
|
83
|
+
release: resolve(process.cwd(), release),
|
|
84
|
+
root: options.get("--root") ?? "~/.maia",
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
const confirmed = (context, question, mode) => mode === "prompt" ? askToConfirm(context, question) : Effect.succeed(true);
|
|
89
|
+
const pipedPlan = (piped) => {
|
|
90
|
+
const parameters = Reflect.get(piped, "parameters");
|
|
91
|
+
const preview = Reflect.get(piped, "preview");
|
|
92
|
+
if (typeof parameters !== "object" ||
|
|
93
|
+
parameters === null ||
|
|
94
|
+
typeof preview !== "object" ||
|
|
95
|
+
preview === null)
|
|
96
|
+
return {};
|
|
97
|
+
const planDigest = Reflect.get(preview, "planDigest");
|
|
98
|
+
return {
|
|
99
|
+
...parameters,
|
|
100
|
+
inputDigest: Reflect.get(preview, "inputDigest"),
|
|
101
|
+
...(planDigest === undefined ? {} : { planDigest }),
|
|
102
|
+
proof: Reflect.get(preview, "proof"),
|
|
103
|
+
waitMs: WAIT_MS,
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
const notSettled = () => new NodeCommandError({
|
|
107
|
+
error: {
|
|
108
|
+
code: "deadline_exceeded",
|
|
109
|
+
message: "The remote Node did not settle in time; maia node list shows where it stands.",
|
|
110
|
+
retryable: true,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
const repeatUntil = (effect, settled, deadline) => effect.pipe(Effect.repeat({
|
|
114
|
+
schedule: Schedule.spaced(Duration.millis(250)),
|
|
115
|
+
until: settled,
|
|
116
|
+
}), Effect.timeoutOrElse({
|
|
117
|
+
duration: deadline,
|
|
118
|
+
orElse: () => Effect.fail(notSettled()),
|
|
119
|
+
}));
|
|
120
|
+
const write = (context, output, text) => {
|
|
121
|
+
context.io.stdout(context.json ? `${JSON.stringify({ ok: true, result: output })}\n` : text);
|
|
122
|
+
};
|
|
123
|
+
const exitFor = (node) => {
|
|
124
|
+
if (node.state === "ready" || node.state === "removed")
|
|
125
|
+
return 0;
|
|
126
|
+
return node.error?.code === "blocked" ? EXIT_UNAVAILABLE : EXIT_TEMPORARY;
|
|
127
|
+
};
|
|
128
|
+
const previewUntilSettled = (context, parameters) => {
|
|
129
|
+
const preview = operation(context.dependencies.previewRemoteNodeInstall);
|
|
130
|
+
if (!context.json)
|
|
131
|
+
context.io.stderr(`Probing ${parameters.host}…\n`);
|
|
132
|
+
return repeatUntil(required(preview({ ...parameters, waitMs: WAIT_MS })), (result) => result.state !== "probing", PROBE_DEADLINE);
|
|
133
|
+
};
|
|
134
|
+
const install = (context, confirmation) => {
|
|
135
|
+
const confirm = operation(context.dependencies.confirmRemoteNodeInstall);
|
|
136
|
+
if (!context.json)
|
|
137
|
+
context.io.stderr(`Installing on ${confirmation.host}; a first install takes about a minute…\n`);
|
|
138
|
+
return repeatUntil(required(confirm(confirmation)), (result) => result.node.state !== "installing", JOB_DEADLINE);
|
|
139
|
+
};
|
|
140
|
+
const finishInstall = (context, confirmation) => Effect.gen(function* () {
|
|
141
|
+
const result = yield* install(context, confirmation);
|
|
142
|
+
write(context, { command: "node.remote.install.confirm", result }, installedText(result.node));
|
|
143
|
+
return exitFor(result.node);
|
|
144
|
+
});
|
|
145
|
+
const runConfirmedInstall = (context) => Effect.flatMap(readPipedPreview(context), (piped) => Effect.flatMap(confirmParameters(remoteNodeInstallConfirmParametersSchema, pipedPlan(piped)), (confirmation) => finishInstall(context, confirmation)));
|
|
146
|
+
const planInstall = (context, parsed, requested) => Effect.gen(function* () {
|
|
147
|
+
const input = readAdd(parsed);
|
|
148
|
+
const commandId = yield* commandIdentifier(input.commandId);
|
|
149
|
+
const parameters = { ...input.parameters, commandId };
|
|
150
|
+
const preview = yield* previewUntilSettled(context, parameters);
|
|
151
|
+
const planned = {
|
|
152
|
+
parameters,
|
|
153
|
+
preview,
|
|
154
|
+
};
|
|
155
|
+
if (preview.state !== "ready" || !context.json || requested === "dry-run")
|
|
156
|
+
write(context, { command: "node.remote.install.preview", result: planned }, planText(preview));
|
|
157
|
+
return planned;
|
|
158
|
+
});
|
|
159
|
+
export const runNodeInstall = (tokens, context) => guarded(Effect.gen(function* () {
|
|
160
|
+
const parsed = parseOptions(tokens, ADD_OPTIONS, CONFIRM_FLAGS);
|
|
161
|
+
const requested = requestedTwoPhaseMode(parsed.flags, true);
|
|
162
|
+
if (requested === "confirm-stdin")
|
|
163
|
+
return yield* runConfirmedInstall(context);
|
|
164
|
+
const planned = yield* planInstall(context, parsed, requested);
|
|
165
|
+
const { parameters, preview } = planned;
|
|
166
|
+
if (preview.state !== "ready")
|
|
167
|
+
return EXIT_UNAVAILABLE;
|
|
168
|
+
if (requested === "dry-run")
|
|
169
|
+
return 0;
|
|
170
|
+
const mode = requested ?? promptOrRefuse(context, true);
|
|
171
|
+
const question = `Install this plan on ${parameters.host} as ${parameters.name}?`;
|
|
172
|
+
if (!(yield* confirmed(context, question, mode)))
|
|
173
|
+
return cancelled(context);
|
|
174
|
+
const { inputDigest, planDigest, proof } = preview;
|
|
175
|
+
const proven = { inputDigest, planDigest, proof, waitMs: WAIT_MS };
|
|
176
|
+
return yield* finishInstall(context, { ...parameters, ...proven });
|
|
177
|
+
}), context);
|
|
178
|
+
const withReachability = (nodes) => Effect.forEach(nodes, (node) => Effect.map(checkReachability(node), (reachability) => ({
|
|
179
|
+
...node,
|
|
180
|
+
reachability,
|
|
181
|
+
})), { concurrency: 4 });
|
|
182
|
+
export const runNodeList = (tokens, context) => guarded(Effect.gen(function* () {
|
|
183
|
+
const { flags, positionals } = parseOptions(tokens, new Set(), new Set(["--all"]));
|
|
184
|
+
requirePositionals(positionals, 0);
|
|
185
|
+
const listed = yield* required(operation(context.dependencies.listRemoteNodes)({
|
|
186
|
+
includeRemoved: flags.has("--all"),
|
|
187
|
+
}));
|
|
188
|
+
const nodes = yield* withReachability(listed.nodes);
|
|
189
|
+
write(context, { command: "node.remote.list", result: { nodes } }, listText(nodes));
|
|
190
|
+
return 0;
|
|
191
|
+
}), context);
|
|
192
|
+
const readRemove = ({ flags, options, positionals }) => {
|
|
193
|
+
requirePositionals(positionals, 1);
|
|
194
|
+
return {
|
|
195
|
+
commandId: options.get("--command-id"),
|
|
196
|
+
name: positionals[0] ?? "",
|
|
197
|
+
purge: flags.has("--purge"),
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
const removeQuestion = (node, purge) => purge
|
|
201
|
+
? `Uninstall ${node.name} from ${node.host}:${node.root} and DELETE profile ${node.profile}'s state (its database)? Sign-ins there stay.`
|
|
202
|
+
: `Uninstall ${node.name} from ${node.host}:${node.root}? Profile ${node.profile}'s state stays for a later add.`;
|
|
203
|
+
const registered = (context, name) => Effect.flatMap(required(operation(context.dependencies.listRemoteNodes)({})), (listed) => {
|
|
204
|
+
const node = listed.nodes.find((candidate) => candidate.name === name);
|
|
205
|
+
return node === undefined
|
|
206
|
+
? Effect.fail(new CliArgumentError(`No remote Node is registered as ${name}.`))
|
|
207
|
+
: Effect.succeed(node);
|
|
208
|
+
});
|
|
209
|
+
const uninstall = (context, confirmation) => repeatUntil(required(operation(context.dependencies.confirmRemoteNodeRemove)(confirmation)), (value) => value.node.state !== "removing", JOB_DEADLINE);
|
|
210
|
+
const finishRemove = (context, confirmation) => Effect.gen(function* () {
|
|
211
|
+
const result = yield* uninstall(context, confirmation);
|
|
212
|
+
write(context, { command: "node.remote.remove.confirm", result }, removedText(result.node));
|
|
213
|
+
return exitFor(result.node);
|
|
214
|
+
});
|
|
215
|
+
const confirmPipedRemove = (context) => Effect.gen(function* () {
|
|
216
|
+
const piped = yield* readPipedPreview(context);
|
|
217
|
+
return yield* finishRemove(context, yield* confirmParameters(remoteNodeRemoveConfirmParametersSchema, pipedPlan(piped)));
|
|
218
|
+
});
|
|
219
|
+
const planRemove = (context, parsed) => Effect.gen(function* () {
|
|
220
|
+
const input = readRemove(parsed);
|
|
221
|
+
const node = yield* registered(context, input.name);
|
|
222
|
+
const removal = {
|
|
223
|
+
commandId: yield* commandIdentifier(input.commandId),
|
|
224
|
+
expectedRevision: node.revision,
|
|
225
|
+
name: node.name,
|
|
226
|
+
purge: input.purge,
|
|
227
|
+
};
|
|
228
|
+
const preview = yield* required(operation(context.dependencies.previewRemoteNodeRemove)(removal));
|
|
229
|
+
return { preview, question: removeQuestion(node, input.purge), removal };
|
|
230
|
+
});
|
|
231
|
+
const writeRemovePreview = (context, { preview, question, removal }) => {
|
|
232
|
+
write(context, {
|
|
233
|
+
command: "node.remote.remove.preview",
|
|
234
|
+
result: { parameters: removal, preview },
|
|
235
|
+
}, `${question}\n`);
|
|
236
|
+
return 0;
|
|
237
|
+
};
|
|
238
|
+
export const runNodeRemove = (tokens, context) => guarded(Effect.gen(function* () {
|
|
239
|
+
const parsed = parseOptions(tokens, new Set(["--command-id"]), new Set(["--purge", ...CONFIRM_FLAGS]));
|
|
240
|
+
const requested = requestedTwoPhaseMode(parsed.flags, true);
|
|
241
|
+
if (requested === "confirm-stdin")
|
|
242
|
+
return yield* confirmPipedRemove(context);
|
|
243
|
+
const { preview, question, removal } = yield* planRemove(context, parsed);
|
|
244
|
+
if (requested === "dry-run")
|
|
245
|
+
return writeRemovePreview(context, { preview, question, removal });
|
|
246
|
+
const mode = requested ?? promptOrRefuse(context, true);
|
|
247
|
+
if (!(yield* confirmed(context, question, mode)))
|
|
248
|
+
return cancelled(context);
|
|
249
|
+
const { inputDigest, proof } = preview;
|
|
250
|
+
const proven = { inputDigest, proof, waitMs: WAIT_MS };
|
|
251
|
+
return yield* finishRemove(context, { ...removal, ...proven });
|
|
252
|
+
}), context);
|
|
253
|
+
const failure = (error) => {
|
|
254
|
+
if (error instanceof NodeCommandError)
|
|
255
|
+
return error.error;
|
|
256
|
+
const usage = error instanceof CliArgumentError;
|
|
257
|
+
return {
|
|
258
|
+
code: usage ? "invalid_argument" : "internal_error",
|
|
259
|
+
message: usage ? error.message : "The node command failed.",
|
|
260
|
+
retryable: false,
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
const guarded = (program, context) => Effect.suspend(() => program).pipe(Effect.catch((error) => Effect.sync(() => reportError(failure(error), context))));
|
|
264
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type Connection, type LocalNodeStatusResult, MaiaClientError, type RemoteNodeRecord } from "@maiaos/sdk";
|
|
2
|
+
import { type LocalNodeEffectClient, type NodeApiEffectDiscoveryOptions } from "@maiaos/sdk/node/effect";
|
|
3
|
+
import type * as Crypto from "effect/Crypto";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Scope from "effect/Scope";
|
|
6
|
+
import { type CliNodeConnector } from "../local-node/index.js";
|
|
7
|
+
export declare const readRemoteNode: (connector: CliNodeConnector, options: NodeApiEffectDiscoveryOptions, name: string) => Effect.Effect<{
|
|
8
|
+
readonly createdAt: string;
|
|
9
|
+
readonly error?: {
|
|
10
|
+
readonly code: string;
|
|
11
|
+
readonly message: string;
|
|
12
|
+
} | undefined;
|
|
13
|
+
readonly executors: readonly {
|
|
14
|
+
readonly executor: "claude-code" | "codex-cli";
|
|
15
|
+
readonly interpreter?: {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly sha256: string;
|
|
18
|
+
} | undefined;
|
|
19
|
+
readonly path?: string | undefined;
|
|
20
|
+
readonly realPath?: string | undefined;
|
|
21
|
+
readonly reason?: string | undefined;
|
|
22
|
+
readonly sha256?: string | undefined;
|
|
23
|
+
readonly source: "discovered" | "override";
|
|
24
|
+
readonly state: "available" | "unavailable";
|
|
25
|
+
}[];
|
|
26
|
+
readonly host: string;
|
|
27
|
+
readonly installedAt?: string | undefined;
|
|
28
|
+
readonly launcherPath: string;
|
|
29
|
+
readonly maiaVersion?: string | undefined;
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly profile: string;
|
|
32
|
+
readonly releaseId?: string | undefined;
|
|
33
|
+
readonly remaining?: readonly string[] | undefined;
|
|
34
|
+
readonly revision: string;
|
|
35
|
+
readonly root: string;
|
|
36
|
+
readonly schemaVersion: "maia.remote-node/v1";
|
|
37
|
+
readonly state: "install_failed" | "installing" | "ready" | "remove_failed" | "removed" | "removing";
|
|
38
|
+
readonly unitName: string;
|
|
39
|
+
readonly updatedAt: string;
|
|
40
|
+
}, unknown, Crypto.Crypto>;
|
|
41
|
+
export type RemoteBridge = {
|
|
42
|
+
readonly client: LocalNodeEffectClient;
|
|
43
|
+
readonly closed: Effect.Effect<boolean>;
|
|
44
|
+
readonly status: LocalNodeStatusResult;
|
|
45
|
+
readonly version: string;
|
|
46
|
+
};
|
|
47
|
+
export declare const openRemoteBridge: (node: RemoteNodeRecord, scope: Scope.Scope) => Effect.Effect<RemoteBridge, MaiaClientError>;
|
|
48
|
+
export declare const makeRemoteNodeConnector: (input: {
|
|
49
|
+
readonly local?: CliNodeConnector;
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly scope: Scope.Scope;
|
|
52
|
+
}) => CliNodeConnector;
|
|
53
|
+
export declare const remoteSignInScript: (node: RemoteNodeRecord, connection: Connection) => string | undefined;
|
|
54
|
+
export declare const remoteVendorLogin: (input: {
|
|
55
|
+
readonly connector?: CliNodeConnector;
|
|
56
|
+
readonly name: string;
|
|
57
|
+
readonly profile?: string;
|
|
58
|
+
}) => (connection: Connection) => Effect.Effect<number, unknown>;
|
|
59
|
+
//# sourceMappingURL=connector.d.ts.map
|