@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,137 @@
|
|
|
1
|
+
import { type HoldListParameters, type HoldPlaceConfirmParameters, type HoldPlacePreviewParameters, type HoldReleaseConfirmParameters, type HoldReleasePreviewParameters } from "@maiaos/sdk";
|
|
2
|
+
import type { CliNodeOperations } from "../local-node/index.js";
|
|
3
|
+
export declare const makeHoldClient: (node: CliNodeOperations) => {
|
|
4
|
+
confirmHoldPlace: (input: HoldPlaceConfirmParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
5
|
+
readonly actorId: string;
|
|
6
|
+
readonly commandId: string;
|
|
7
|
+
readonly delivery: "duplicate" | "new";
|
|
8
|
+
readonly hold: {
|
|
9
|
+
readonly createdAt: string;
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly reason: string;
|
|
12
|
+
readonly revision: string;
|
|
13
|
+
readonly running: "keep" | "stop";
|
|
14
|
+
readonly schemaVersion: "maia.hold/v1";
|
|
15
|
+
readonly state: "active" | "released";
|
|
16
|
+
readonly targets: readonly {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly kind: "connection" | "project";
|
|
19
|
+
}[];
|
|
20
|
+
readonly updatedAt: string;
|
|
21
|
+
};
|
|
22
|
+
readonly inputDigest: string;
|
|
23
|
+
readonly receipt: {
|
|
24
|
+
readonly actorId: string;
|
|
25
|
+
readonly aggregateRevision: string;
|
|
26
|
+
readonly commandId: string;
|
|
27
|
+
readonly createdAt: string;
|
|
28
|
+
readonly eventCursor: string;
|
|
29
|
+
readonly method: string;
|
|
30
|
+
readonly receiptId: string;
|
|
31
|
+
readonly schemaVersion: 1;
|
|
32
|
+
readonly state: "succeeded";
|
|
33
|
+
readonly target: {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly type: string;
|
|
36
|
+
};
|
|
37
|
+
readonly updatedAt: string;
|
|
38
|
+
};
|
|
39
|
+
readonly method: "hold.place.confirm";
|
|
40
|
+
readonly stoppedSessionIds: readonly string[];
|
|
41
|
+
}>;
|
|
42
|
+
confirmHoldRelease: (input: HoldReleaseConfirmParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
43
|
+
readonly actorId: string;
|
|
44
|
+
readonly commandId: string;
|
|
45
|
+
readonly delivery: "duplicate" | "new";
|
|
46
|
+
readonly hold: {
|
|
47
|
+
readonly createdAt: string;
|
|
48
|
+
readonly id: string;
|
|
49
|
+
readonly reason: string;
|
|
50
|
+
readonly revision: string;
|
|
51
|
+
readonly running: "keep" | "stop";
|
|
52
|
+
readonly schemaVersion: "maia.hold/v1";
|
|
53
|
+
readonly state: "active" | "released";
|
|
54
|
+
readonly targets: readonly {
|
|
55
|
+
readonly id: string;
|
|
56
|
+
readonly kind: "connection" | "project";
|
|
57
|
+
}[];
|
|
58
|
+
readonly updatedAt: string;
|
|
59
|
+
};
|
|
60
|
+
readonly inputDigest: string;
|
|
61
|
+
readonly receipt: {
|
|
62
|
+
readonly actorId: string;
|
|
63
|
+
readonly aggregateRevision: string;
|
|
64
|
+
readonly commandId: string;
|
|
65
|
+
readonly createdAt: string;
|
|
66
|
+
readonly eventCursor: string;
|
|
67
|
+
readonly method: string;
|
|
68
|
+
readonly receiptId: string;
|
|
69
|
+
readonly schemaVersion: 1;
|
|
70
|
+
readonly state: "succeeded";
|
|
71
|
+
readonly target: {
|
|
72
|
+
readonly id: string;
|
|
73
|
+
readonly type: string;
|
|
74
|
+
};
|
|
75
|
+
readonly updatedAt: string;
|
|
76
|
+
};
|
|
77
|
+
readonly expectedRevision: string;
|
|
78
|
+
readonly method: "hold.release.confirm";
|
|
79
|
+
}>;
|
|
80
|
+
listHolds: (input: HoldListParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
81
|
+
readonly items: readonly {
|
|
82
|
+
readonly createdAt: string;
|
|
83
|
+
readonly id: string;
|
|
84
|
+
readonly reason: string;
|
|
85
|
+
readonly revision: string;
|
|
86
|
+
readonly running: "keep" | "stop";
|
|
87
|
+
readonly schemaVersion: "maia.hold/v1";
|
|
88
|
+
readonly state: "active" | "released";
|
|
89
|
+
readonly targets: readonly {
|
|
90
|
+
readonly id: string;
|
|
91
|
+
readonly kind: "connection" | "project";
|
|
92
|
+
}[];
|
|
93
|
+
readonly updatedAt: string;
|
|
94
|
+
}[];
|
|
95
|
+
readonly method: "hold.list";
|
|
96
|
+
readonly nextCursor?: string | undefined;
|
|
97
|
+
}>;
|
|
98
|
+
previewHoldPlace: (input: HoldPlacePreviewParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
99
|
+
readonly commandId: string;
|
|
100
|
+
readonly reason: string;
|
|
101
|
+
readonly running: "keep" | "stop";
|
|
102
|
+
readonly targets: readonly {
|
|
103
|
+
readonly id: string;
|
|
104
|
+
readonly kind: "connection" | "project";
|
|
105
|
+
}[];
|
|
106
|
+
readonly inputDigest: string;
|
|
107
|
+
readonly proof: string;
|
|
108
|
+
readonly actorId: string;
|
|
109
|
+
readonly expiresAt: string;
|
|
110
|
+
readonly issuedAt: string;
|
|
111
|
+
readonly holdId: string;
|
|
112
|
+
readonly method: "hold.place.preview";
|
|
113
|
+
readonly sessions: readonly {
|
|
114
|
+
readonly connectionId?: string | undefined;
|
|
115
|
+
readonly projectId: string;
|
|
116
|
+
readonly sessionId: string;
|
|
117
|
+
readonly state: "recovering" | "running" | "starting";
|
|
118
|
+
}[];
|
|
119
|
+
}>;
|
|
120
|
+
previewHoldRelease: (input: HoldReleasePreviewParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
121
|
+
readonly commandId: string;
|
|
122
|
+
readonly expectedRevision: string;
|
|
123
|
+
readonly holdId: string;
|
|
124
|
+
readonly inputDigest: string;
|
|
125
|
+
readonly proof: string;
|
|
126
|
+
readonly actorId: string;
|
|
127
|
+
readonly expiresAt: string;
|
|
128
|
+
readonly issuedAt: string;
|
|
129
|
+
readonly method: "hold.release.preview";
|
|
130
|
+
readonly targets: readonly {
|
|
131
|
+
readonly id: string;
|
|
132
|
+
readonly kind: "connection" | "project";
|
|
133
|
+
}[];
|
|
134
|
+
}>;
|
|
135
|
+
};
|
|
136
|
+
export type HoldCliDependencies = ReturnType<typeof makeHoldClient>;
|
|
137
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { holdListParametersSchema, holdPlaceConfirmParametersSchema, holdPlacePreviewParametersSchema, holdReleaseConfirmParametersSchema, holdReleasePreviewParametersSchema, } from "@maiaos/sdk";
|
|
2
|
+
const makeHoldConfirmationClient = (node) => ({
|
|
3
|
+
confirmHoldPlace: (input) => node.runValidatedNodeOperation(input, holdPlaceConfirmParametersSchema, (client, parameters, options) => client.confirmHoldPlace(parameters, options), { commandId: input.commandId }),
|
|
4
|
+
confirmHoldRelease: (input) => node.runValidatedNodeOperation(input, holdReleaseConfirmParametersSchema, (client, parameters, options) => client.confirmHoldRelease(parameters, options), { commandId: input.commandId }),
|
|
5
|
+
});
|
|
6
|
+
export const makeHoldClient = (node) => ({
|
|
7
|
+
...makeHoldConfirmationClient(node),
|
|
8
|
+
listHolds: (input) => node.runValidatedNodeOperation(input, holdListParametersSchema, (client, parameters, options) => client.listHolds(parameters, options)),
|
|
9
|
+
previewHoldPlace: (input) => node.runValidatedNodeOperation(input, holdPlacePreviewParametersSchema, (client, parameters, options) => client.previewHoldPlace(parameters, options)),
|
|
10
|
+
previewHoldRelease: (input) => node.runValidatedNodeOperation(input, holdReleasePreviewParametersSchema, (client, parameters, options) => client.previewHoldRelease(parameters, options)),
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type CommandContext, type CommandEffect } from "../command-line/index.js";
|
|
2
|
+
export declare const runHoldList: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
3
|
+
export declare const runHoldPlace: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
4
|
+
export declare const runHoldRelease: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
5
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { holdListParametersSchema, holdPlaceConfirmParametersSchema, holdPlacePreviewParametersSchema, holdReleaseConfirmParametersSchema, holdReleasePreviewParametersSchema, protocolErrorSchema, } from "@maiaos/sdk";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { CliArgumentError, parseOptions, readPageSize, reportError, requirePositionals, runInputTwoPhase, writeSuccess, } from "../command-line/index.js";
|
|
4
|
+
import { formatHoldResult } from "./output/index.js";
|
|
5
|
+
const invalidInput = () => new CliArgumentError("Invalid hold operation input.");
|
|
6
|
+
const readList = (tokens) => {
|
|
7
|
+
const parsed = parseOptions(tokens, new Set(["--after", "--limit", "--state"]));
|
|
8
|
+
requirePositionals(parsed.positionals, 0);
|
|
9
|
+
const afterCursor = parsed.options.get("--after");
|
|
10
|
+
const state = parsed.options.get("--state");
|
|
11
|
+
if (state !== undefined && state !== "active" && state !== "released")
|
|
12
|
+
throw new CliArgumentError("Option '--state' must be 'active' or 'released'.");
|
|
13
|
+
return {
|
|
14
|
+
...(afterCursor === undefined ? {} : { afterCursor }),
|
|
15
|
+
limit: readPageSize(parsed.options.get("--limit")),
|
|
16
|
+
...(state === undefined ? {} : { state }),
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const recoveryFor = (code, parameters) => code === "outcome_unknown" &&
|
|
20
|
+
typeof parameters === "object" &&
|
|
21
|
+
parameters !== null &&
|
|
22
|
+
"commandId" in parameters &&
|
|
23
|
+
"proof" in parameters &&
|
|
24
|
+
typeof parameters.commandId === "string"
|
|
25
|
+
? { recovery: { commandId: parameters.commandId } }
|
|
26
|
+
: {};
|
|
27
|
+
const writeResponse = (response, parameters, context) => {
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
const error = protocolErrorSchema.parse(response.error);
|
|
30
|
+
return reportError(error, {
|
|
31
|
+
...context,
|
|
32
|
+
...(response.recovery === undefined
|
|
33
|
+
? recoveryFor(error.code, parameters)
|
|
34
|
+
: { recovery: response.recovery }),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
writeSuccess({ command: response.value.method, result: response.value }, context, formatHoldResult);
|
|
38
|
+
return 0;
|
|
39
|
+
};
|
|
40
|
+
const invoke = (spec, context) => Effect.gen(function* () {
|
|
41
|
+
const input = yield* spec.input;
|
|
42
|
+
const parameters = yield* Effect.try({
|
|
43
|
+
catch: invalidInput,
|
|
44
|
+
try: () => spec.parameters.parse(input),
|
|
45
|
+
});
|
|
46
|
+
const operation = spec.operation;
|
|
47
|
+
if (operation === undefined)
|
|
48
|
+
return yield* Effect.fail(new Error("Missing hold client."));
|
|
49
|
+
const response = yield* Effect.suspend(() => operation(parameters)).pipe(Effect.catchDefect(() => Effect.fail(new Error("Hold request failed."))));
|
|
50
|
+
return yield* Effect.try({
|
|
51
|
+
catch: () => new Error("Invalid hold result."),
|
|
52
|
+
try: () => writeResponse(response, parameters, context),
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
const reportFailure = (context) => (error) => Effect.sync(() => reportError({
|
|
56
|
+
code: error instanceof CliArgumentError
|
|
57
|
+
? "invalid_argument"
|
|
58
|
+
: "internal_error",
|
|
59
|
+
message: error instanceof CliArgumentError
|
|
60
|
+
? error.message
|
|
61
|
+
: "Hold command failed.",
|
|
62
|
+
retryable: false,
|
|
63
|
+
}, context));
|
|
64
|
+
export const runHoldList = (tokens, context) => Effect.suspend(() => invoke({
|
|
65
|
+
input: Effect.succeed(readList(tokens)),
|
|
66
|
+
operation: context.dependencies.listHolds,
|
|
67
|
+
parameters: holdListParametersSchema,
|
|
68
|
+
}, context)).pipe(Effect.catch(reportFailure(context)));
|
|
69
|
+
export const runHoldPlace = (tokens, context) => runInputTwoPhase({
|
|
70
|
+
confirm: context.dependencies.confirmHoldPlace,
|
|
71
|
+
confirmSchema: holdPlaceConfirmParametersSchema,
|
|
72
|
+
context,
|
|
73
|
+
label: "hold input",
|
|
74
|
+
preview: context.dependencies.previewHoldPlace,
|
|
75
|
+
previewOnly: ["holdId", "sessions"],
|
|
76
|
+
previewSchema: holdPlacePreviewParametersSchema,
|
|
77
|
+
tokens,
|
|
78
|
+
write: (result) => writeResponse(result, undefined, context),
|
|
79
|
+
}).pipe(Effect.catch(reportFailure(context)));
|
|
80
|
+
export const runHoldRelease = (tokens, context) => runInputTwoPhase({
|
|
81
|
+
confirm: context.dependencies.confirmHoldRelease,
|
|
82
|
+
confirmSchema: holdReleaseConfirmParametersSchema,
|
|
83
|
+
context,
|
|
84
|
+
label: "hold input",
|
|
85
|
+
preview: context.dependencies.previewHoldRelease,
|
|
86
|
+
previewOnly: ["targets"],
|
|
87
|
+
previewSchema: holdReleasePreviewParametersSchema,
|
|
88
|
+
tokens,
|
|
89
|
+
write: (result) => writeResponse(result, undefined, context),
|
|
90
|
+
}).pipe(Effect.catch(reportFailure(context)));
|
|
91
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HoldListResult, HoldPlaceConfirmResult, HoldPlacePreviewResult, HoldReleaseConfirmResult, HoldReleasePreviewResult } from "@maiaos/sdk";
|
|
2
|
+
export type HoldResult = HoldListResult | HoldPlaceConfirmResult | HoldPlacePreviewResult | HoldReleaseConfirmResult | HoldReleasePreviewResult;
|
|
3
|
+
export type CliHoldResult = {
|
|
4
|
+
readonly command: HoldResult["method"];
|
|
5
|
+
readonly result: HoldResult;
|
|
6
|
+
};
|
|
7
|
+
export declare const isHoldResult: (result: {
|
|
8
|
+
readonly command: string;
|
|
9
|
+
}) => result is CliHoldResult;
|
|
10
|
+
export declare const formatHoldResult: ({ result }: CliHoldResult) => string;
|
|
11
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { formatRows } from "../../command-line/index.js";
|
|
2
|
+
export const isHoldResult = (result) => result.command.startsWith("hold.");
|
|
3
|
+
const cell = (value) => Array.from(value, (character) => {
|
|
4
|
+
const point = character.codePointAt(0) ?? 0;
|
|
5
|
+
return point < 32 || (point >= 127 && point <= 159) ? " " : character;
|
|
6
|
+
}).join("");
|
|
7
|
+
const targetList = (targets) => targets.map((target) => `${target.kind}:${target.id}`).join(",");
|
|
8
|
+
export const formatHoldResult = ({ result }) => {
|
|
9
|
+
switch (result.method) {
|
|
10
|
+
case "hold.list":
|
|
11
|
+
return formatRows(result.items, (hold) => `${hold.id}\t${hold.state}\t${hold.running}\t${targetList(hold.targets)}\t${cell(hold.reason)}`, {
|
|
12
|
+
empty: "No holds.",
|
|
13
|
+
headers: ["HOLD", "STATE", "RUNNING", "TARGETS", "REASON"],
|
|
14
|
+
});
|
|
15
|
+
case "hold.place.preview":
|
|
16
|
+
return `${result.holdId}\t${result.running}\t${targetList(result.targets)}\t${result.expiresAt}\n${result.sessions
|
|
17
|
+
.map((session) => `session\t${session.sessionId}\t${session.state}\n`)
|
|
18
|
+
.join("")}`;
|
|
19
|
+
case "hold.place.confirm":
|
|
20
|
+
return `${result.hold.id}\t${result.hold.state}\t${result.hold.running}\t${result.receipt.receiptId}\t${result.delivery}\n${result.stoppedSessionIds
|
|
21
|
+
.map((sessionId) => `stopped\t${sessionId}\n`)
|
|
22
|
+
.join("")}`;
|
|
23
|
+
case "hold.release.preview":
|
|
24
|
+
return `${result.holdId}\t${result.expectedRevision}\t${targetList(result.targets)}\t${result.expiresAt}\n`;
|
|
25
|
+
case "hold.release.confirm":
|
|
26
|
+
return `${result.hold.id}\t${result.hold.state}\t${result.hold.revision}\t${result.receipt.receiptId}\t${result.delivery}\n`;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const hold = () => import("../index.js");
|
|
2
|
+
const receipt = () => import("../../command-receipt/index.js");
|
|
3
|
+
const context = () => import("../../context/index.js");
|
|
4
|
+
const port = () => import("../../port-lease/index.js");
|
|
5
|
+
export const SAFETY_TREE = {
|
|
6
|
+
groups: [
|
|
7
|
+
["hold", "Emergency holds on exact Projects and accounts."],
|
|
8
|
+
["receipt", "Outcomes of mutations by command ID."],
|
|
9
|
+
["context", "The Node or attached Session context."],
|
|
10
|
+
["port", "Advisory loopback ports."],
|
|
11
|
+
["port lease", "Port leases for a Session."],
|
|
12
|
+
],
|
|
13
|
+
leaves: [
|
|
14
|
+
[
|
|
15
|
+
"hold list [--state <active|released>] [--limit <1..100>] [--after <cursor>]",
|
|
16
|
+
1,
|
|
17
|
+
"hold.list",
|
|
18
|
+
"List emergency holds.",
|
|
19
|
+
{ run: [hold, "runHoldList"] },
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
"hold place (--input-stdin --dry-run | --confirm-stdin)",
|
|
23
|
+
1,
|
|
24
|
+
["hold.place.preview", "hold.place.confirm"],
|
|
25
|
+
"Place an emergency hold after a preview.",
|
|
26
|
+
{
|
|
27
|
+
example: "maia --json hold place --input-stdin --dry-run",
|
|
28
|
+
kind: "two-phase",
|
|
29
|
+
run: [hold, "runHoldPlace"],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
"hold release (--input-stdin --dry-run | --confirm-stdin)",
|
|
34
|
+
1,
|
|
35
|
+
["hold.release.preview", "hold.release.confirm"],
|
|
36
|
+
"Release a hold after a preview.",
|
|
37
|
+
{ kind: "two-phase", run: [hold, "runHoldRelease"] },
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
"receipt list [--limit <1..32>] [--after <cursor>] [--actor <actor-id>] [--method <method>] [--since <recorded-at>] [--until <recorded-at>]",
|
|
41
|
+
0,
|
|
42
|
+
"receipt.list",
|
|
43
|
+
"List mutation receipts.",
|
|
44
|
+
{ run: [receipt, "runReceiptList"] },
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"receipt show <command-id>",
|
|
48
|
+
0,
|
|
49
|
+
"receipt.get",
|
|
50
|
+
"Show the receipt of one command ID.",
|
|
51
|
+
{
|
|
52
|
+
example: "maia --json receipt show create-1",
|
|
53
|
+
run: [receipt, "runReceiptShow"],
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
"context show [--attached]",
|
|
58
|
+
1,
|
|
59
|
+
"context.show",
|
|
60
|
+
"Show the Node's current context, or the attached Session's.",
|
|
61
|
+
{ run: [context, "runContextShow"] },
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
"port lease acquire --purpose <label> [--session <session-id>] [--count <1..8>] [--preferred <port>] [--command-id <id>]",
|
|
65
|
+
1,
|
|
66
|
+
"port.lease.acquire",
|
|
67
|
+
"Lease loopback ports for a Session.",
|
|
68
|
+
{
|
|
69
|
+
example: "maia --json port lease acquire --purpose dev-server --command-id lease-1",
|
|
70
|
+
run: [port, "runPortLeaseAcquire"],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
"port lease renew <lease-id> --expected-revision <revision> [--command-id <id>]",
|
|
75
|
+
1,
|
|
76
|
+
"port.lease.renew",
|
|
77
|
+
"Renew a port lease.",
|
|
78
|
+
{ run: [port, "runPortLeaseRenew"] },
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
"port lease release <lease-id> [--command-id <id>]",
|
|
82
|
+
1,
|
|
83
|
+
"port.lease.release",
|
|
84
|
+
"Release a port lease.",
|
|
85
|
+
{ run: [port, "runPortLeaseRelease"] },
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
"port lease list [--session <session-id>] [--limit <1..100>] [--after <cursor>]",
|
|
89
|
+
1,
|
|
90
|
+
"port.lease.list",
|
|
91
|
+
"List port leases.",
|
|
92
|
+
{ run: [port, "runPortLeaseList"] },
|
|
93
|
+
],
|
|
94
|
+
],
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type DiscoverySessionsListParameters, type DiscoverySessionsListResult, type SessionAdoptConfirmResult, type SessionAdoptPreviewParameters, type SessionAdoptPreviewResult, type SessionHistoryReadParameters, type SessionHistoryReadResult } from "@maiaos/sdk";
|
|
2
|
+
import { type CliNodeEffect, type CliNodeOperations } from "../local-node/index.js";
|
|
3
|
+
type AdoptInput = Omit<SessionAdoptPreviewParameters, "commandId"> & {
|
|
4
|
+
readonly commandId?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const makeDiscoveryClient: (node: CliNodeOperations) => {
|
|
7
|
+
previewSessionAdopt: (input: AdoptInput) => CliNodeEffect<SessionAdoptPreviewResult>;
|
|
8
|
+
confirmSessionAdopt: (previewId: string) => CliNodeEffect<SessionAdoptConfirmResult>;
|
|
9
|
+
listDiscoveredSessions: (input: DiscoverySessionsListParameters) => CliNodeEffect<DiscoverySessionsListResult>;
|
|
10
|
+
readSessionHistory: (input: SessionHistoryReadParameters) => CliNodeEffect<SessionHistoryReadResult>;
|
|
11
|
+
};
|
|
12
|
+
export type DiscoveryCliDependencies = ReturnType<typeof makeDiscoveryClient>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { discoverySessionsListParametersSchema, sessionAdoptConfirmParametersSchema, sessionAdoptPreviewParametersSchema, sessionHistoryReadParametersSchema, } from "@maiaos/sdk";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { commandIdentifier, } from "../local-node/index.js";
|
|
4
|
+
const makePreviewClient = (node) => ({
|
|
5
|
+
previewSessionAdopt: (input) => Effect.flatMap(commandIdentifier(input.commandId), (commandId) => node.runValidatedNodeOperation({ ...input, commandId }, sessionAdoptPreviewParametersSchema, (client, parameters, options) => client.previewSessionAdopt(parameters, options))),
|
|
6
|
+
});
|
|
7
|
+
const makeConfirmClient = (node) => ({
|
|
8
|
+
confirmSessionAdopt: (previewId) => node.runValidatedNodeOperation({ previewId }, sessionAdoptConfirmParametersSchema, (client, parameters, options) => client.confirmSessionAdopt(parameters, options)),
|
|
9
|
+
});
|
|
10
|
+
export const makeDiscoveryClient = (node) => ({
|
|
11
|
+
...makePreviewClient(node),
|
|
12
|
+
...makeConfirmClient(node),
|
|
13
|
+
listDiscoveredSessions: (input) => node.runValidatedNodeOperation(input, discoverySessionsListParametersSchema, (client, parameters, options) => client.listDiscoveredSessions(parameters, options)),
|
|
14
|
+
readSessionHistory: (input) => node.runValidatedNodeOperation(input, sessionHistoryReadParametersSchema, (client, parameters, options) => client.readSessionHistory(parameters, options)),
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type CommandContext, type CommandEffect } from "../command-line/index.js";
|
|
2
|
+
export declare const runScan: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
3
|
+
export declare const runHistoryRead: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
4
|
+
export declare const runAdopt: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
5
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { CliArgumentError, parseOptions, readTwoPhaseMode, reportError, requirePositionals, runTwoPhase, TWO_PHASE_FLAGS, } from "../command-line/index.js";
|
|
3
|
+
import { readAdopt, readHistory, readScan } from "./input.js";
|
|
4
|
+
import { formatAdoptConfirm, formatAdoptPreview, formatHistory, formatScan, } from "./output.js";
|
|
5
|
+
const missingClient = () => Effect.fail(new CliArgumentError("Session discovery is unavailable."));
|
|
6
|
+
const write = (response, context, output) => {
|
|
7
|
+
if (!response.ok)
|
|
8
|
+
return reportError(response.error, context);
|
|
9
|
+
context.io.stdout(context.json
|
|
10
|
+
? `${JSON.stringify({ ok: true, result: { command: output.command, result: response.value } })}\n`
|
|
11
|
+
: output.format(response.value));
|
|
12
|
+
return 0;
|
|
13
|
+
};
|
|
14
|
+
const required = (context, name) => {
|
|
15
|
+
const operation = context.dependencies[name];
|
|
16
|
+
return operation === undefined ? missingClient() : Effect.succeed(operation);
|
|
17
|
+
};
|
|
18
|
+
const failed = (context) => (error) => Effect.sync(() => reportError({
|
|
19
|
+
code: error instanceof CliArgumentError
|
|
20
|
+
? "invalid_argument"
|
|
21
|
+
: "internal_error",
|
|
22
|
+
message: error instanceof CliArgumentError
|
|
23
|
+
? error.message
|
|
24
|
+
: "The discovery command failed.",
|
|
25
|
+
retryable: false,
|
|
26
|
+
}, context));
|
|
27
|
+
export const runScan = (tokens, context) => Effect.gen(function* () {
|
|
28
|
+
const input = readScan(tokens);
|
|
29
|
+
const list = yield* required(context, "listDiscoveredSessions");
|
|
30
|
+
return write(yield* list(input), context, {
|
|
31
|
+
command: "discovery.sessions.list",
|
|
32
|
+
format: formatScan,
|
|
33
|
+
});
|
|
34
|
+
}).pipe(Effect.catch(failed(context)));
|
|
35
|
+
export const runHistoryRead = (tokens, context) => Effect.gen(function* () {
|
|
36
|
+
const input = readHistory(tokens);
|
|
37
|
+
const read = yield* required(context, "readSessionHistory");
|
|
38
|
+
return write(yield* read(input), context, {
|
|
39
|
+
command: "session.history.read",
|
|
40
|
+
format: formatHistory,
|
|
41
|
+
});
|
|
42
|
+
}).pipe(Effect.catch(failed(context)));
|
|
43
|
+
const previewIdOf = (preview) => {
|
|
44
|
+
const previewId = Reflect.get(preview, "previewId");
|
|
45
|
+
if (typeof previewId !== "string" || !previewId.startsWith("adopt_"))
|
|
46
|
+
throw new CliArgumentError("The piped preview is invalid; pipe the output of 'maia --json session adopt … --dry-run'.");
|
|
47
|
+
return previewId;
|
|
48
|
+
};
|
|
49
|
+
const readAdoptMode = (tokens, context) => {
|
|
50
|
+
const parsed = parseOptions(tokens, new Set(["--command-id", "--workspace"]), new Set(["--attest-ended", ...TWO_PHASE_FLAGS]));
|
|
51
|
+
const mode = readTwoPhaseMode(parsed.flags, context);
|
|
52
|
+
if (mode === "confirm-stdin")
|
|
53
|
+
requirePositionals(parsed.positionals, 0);
|
|
54
|
+
return { mode, parsed };
|
|
55
|
+
};
|
|
56
|
+
export const runAdopt = (tokens, context) => Effect.gen(function* () {
|
|
57
|
+
const { mode, parsed } = readAdoptMode(tokens, context);
|
|
58
|
+
const previewSessionAdopt = yield* required(context, "previewSessionAdopt");
|
|
59
|
+
const confirmSessionAdopt = yield* required(context, "confirmSessionAdopt");
|
|
60
|
+
return yield* runTwoPhase({
|
|
61
|
+
confirm: (preview) => Effect.suspend(() => confirmSessionAdopt(previewIdOf(preview))),
|
|
62
|
+
context,
|
|
63
|
+
mode,
|
|
64
|
+
preview: () => Effect.suspend(() => previewSessionAdopt(readAdopt(parsed))),
|
|
65
|
+
prompt: { describe: formatAdoptPreview, question: "Adopt this session?" },
|
|
66
|
+
writeConfirm: (result) => write(result, context, {
|
|
67
|
+
command: "session.adopt.confirm",
|
|
68
|
+
format: formatAdoptConfirm,
|
|
69
|
+
}),
|
|
70
|
+
writePreview: (result) => write(result, context, {
|
|
71
|
+
command: "session.adopt.preview",
|
|
72
|
+
format: formatAdoptPreview,
|
|
73
|
+
}),
|
|
74
|
+
});
|
|
75
|
+
}).pipe(Effect.catch(failed(context)));
|
|
76
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DiscoverySessionsListParameters, SessionHistoryReadParameters } from "@maiaos/sdk";
|
|
2
|
+
import { type ParsedOptions } from "../command-line/index.js";
|
|
3
|
+
export declare const readScan: (tokens: readonly string[]) => DiscoverySessionsListParameters;
|
|
4
|
+
export declare const readNativeTarget: (value: string) => {
|
|
5
|
+
executor: "claude-code" | "codex-cli";
|
|
6
|
+
nativeId: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const readHistory: (tokens: readonly string[]) => SessionHistoryReadParameters;
|
|
9
|
+
export declare const readAdopt: (parsed: ParsedOptions) => {
|
|
10
|
+
executor: "claude-code" | "codex-cli";
|
|
11
|
+
nativeId: string;
|
|
12
|
+
attestEnded?: true | undefined;
|
|
13
|
+
commandId?: string | undefined;
|
|
14
|
+
workspaceId: string;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { CliArgumentError, parseOptions, readPageSize, requirePositionals, } from "../command-line/index.js";
|
|
2
|
+
const SOURCES = ["claude", "codex"];
|
|
3
|
+
const readSources = (value) => {
|
|
4
|
+
if (value === undefined)
|
|
5
|
+
return SOURCES;
|
|
6
|
+
const names = value.split(",");
|
|
7
|
+
const sources = SOURCES.filter((source) => names.includes(source));
|
|
8
|
+
if (sources.length !== names.length || sources.length === 0)
|
|
9
|
+
throw new CliArgumentError("Option '--source' takes claude or codex, comma-separated.");
|
|
10
|
+
return sources;
|
|
11
|
+
};
|
|
12
|
+
const readDays = (value) => {
|
|
13
|
+
if (value === undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
const match = /^([1-9]\d{0,2})d$/u.exec(value);
|
|
16
|
+
const days = Number(match?.[1]);
|
|
17
|
+
if (match === null || days > 365)
|
|
18
|
+
throw new CliArgumentError("Option '--since' takes 1d to 365d.");
|
|
19
|
+
return days;
|
|
20
|
+
};
|
|
21
|
+
const readScanLimit = (value) => value === undefined ? 50 : readPageSize(value);
|
|
22
|
+
export const readScan = (tokens) => {
|
|
23
|
+
const parsed = parseOptions(tokens, new Set(["--after", "--limit", "--root", "--since", "--source"]), new Set(["--include-content"]));
|
|
24
|
+
requirePositionals(parsed.positionals, 0);
|
|
25
|
+
const cursor = parsed.options.get("--after");
|
|
26
|
+
const root = parsed.options.get("--root");
|
|
27
|
+
const sinceDays = readDays(parsed.options.get("--since"));
|
|
28
|
+
return {
|
|
29
|
+
...(cursor === undefined ? {} : { cursor }),
|
|
30
|
+
...(parsed.flags.has("--include-content")
|
|
31
|
+
? { includeContentFields: true }
|
|
32
|
+
: {}),
|
|
33
|
+
limit: readScanLimit(parsed.options.get("--limit")),
|
|
34
|
+
...(root === undefined ? {} : { roots: [root] }),
|
|
35
|
+
...(sinceDays === undefined ? {} : { sinceDays }),
|
|
36
|
+
sources: readSources(parsed.options.get("--source")),
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export const readNativeTarget = (value) => {
|
|
40
|
+
const match = /^(claude|codex):(.+)$/u.exec(value);
|
|
41
|
+
if (match?.[2] === undefined)
|
|
42
|
+
throw new CliArgumentError("The vendor session must be claude:<id> or codex:<id>.");
|
|
43
|
+
return {
|
|
44
|
+
executor: match[1] === "claude" ? "claude-code" : "codex-cli",
|
|
45
|
+
nativeId: match[2],
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
const readInteger = (value, option, bounds) => {
|
|
49
|
+
if (value === undefined)
|
|
50
|
+
return undefined;
|
|
51
|
+
const number = Number(value);
|
|
52
|
+
if (!/^\d{1,7}$/u.test(value) ||
|
|
53
|
+
number < bounds.minimum ||
|
|
54
|
+
number > bounds.maximum)
|
|
55
|
+
throw new CliArgumentError(`Option '${option}' must be an integer from ${String(bounds.minimum)} to ${String(bounds.maximum)}.`);
|
|
56
|
+
return number;
|
|
57
|
+
};
|
|
58
|
+
export const readHistory = (tokens) => {
|
|
59
|
+
const parsed = parseOptions(tokens, new Set(["--limit", "--offset"]));
|
|
60
|
+
requirePositionals(parsed.positionals, 1);
|
|
61
|
+
const [target = ""] = parsed.positionals;
|
|
62
|
+
const offset = readInteger(parsed.options.get("--offset"), "--offset", {
|
|
63
|
+
maximum: 1_000_000,
|
|
64
|
+
minimum: 0,
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
limit: readInteger(parsed.options.get("--limit"), "--limit", {
|
|
68
|
+
maximum: 50,
|
|
69
|
+
minimum: 1,
|
|
70
|
+
}) ?? 20,
|
|
71
|
+
...(offset === undefined ? {} : { offset }),
|
|
72
|
+
target: target.includes(":")
|
|
73
|
+
? { kind: "native", ...readNativeTarget(target) }
|
|
74
|
+
: { kind: "session", sessionId: target },
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export const readAdopt = (parsed) => {
|
|
78
|
+
requirePositionals(parsed.positionals, 1);
|
|
79
|
+
const workspaceId = parsed.options.get("--workspace");
|
|
80
|
+
if (workspaceId === undefined)
|
|
81
|
+
throw new CliArgumentError("Option '--workspace' is required.");
|
|
82
|
+
const commandId = parsed.options.get("--command-id");
|
|
83
|
+
return {
|
|
84
|
+
...(parsed.flags.has("--attest-ended")
|
|
85
|
+
? { attestEnded: true }
|
|
86
|
+
: {}),
|
|
87
|
+
...(commandId === undefined ? {} : { commandId }),
|
|
88
|
+
...readNativeTarget(parsed.positionals[0] ?? ""),
|
|
89
|
+
workspaceId,
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=input.js.map
|