@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,63 @@
|
|
|
1
|
+
import { type AgentPermissionConfirmParameters, type AgentPermissionPreviewParameters } from "@maiaos/sdk";
|
|
2
|
+
import { type CommandContext, type CommandEffect } from "../command-line/index.js";
|
|
3
|
+
import type { CliNodeOperations } from "../local-node/index.js";
|
|
4
|
+
export declare const makeAgentPermissionCliClient: (node: CliNodeOperations) => {
|
|
5
|
+
confirmAgentPermission: (input: AgentPermissionConfirmParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
6
|
+
readonly delivery: "duplicate" | "new";
|
|
7
|
+
readonly grant: {
|
|
8
|
+
readonly definitionRef: {
|
|
9
|
+
readonly contentDigest: string;
|
|
10
|
+
readonly key: string;
|
|
11
|
+
readonly version: string;
|
|
12
|
+
};
|
|
13
|
+
readonly expectedSessionRevision: string;
|
|
14
|
+
readonly expectedWorkspaceRevision: string;
|
|
15
|
+
readonly sessionId: string;
|
|
16
|
+
readonly workspaceId: string;
|
|
17
|
+
readonly actorId: string;
|
|
18
|
+
readonly commandId: string;
|
|
19
|
+
readonly grantedAt: string;
|
|
20
|
+
readonly inputDigest: string;
|
|
21
|
+
readonly operationIds: readonly ("approval.list" | "approval.respond" | "approval.show" | "connection.capacity.set" | "connection.create" | "connection.detect" | "connection.gateway.create" | "connection.list" | "connection.login.start" | "connection.models.list" | "connection.show" | "connection.state.set" | "connection.system.confirm" | "connection.system.preview" | "connection.usage.show" | "container.create.confirm" | "container.create.preview" | "container.index.list" | "container.list" | "container.rename.confirm" | "container.rename.preview" | "container.show" | "context.show" | "discovery.sessions.list" | "execution.catalog.get" | "execution.checkpoint.create" | "execution.checkpoint.show" | "execution.command.run" | "execution.file.read" | "execution.placement.create" | "execution.placement.show" | "execution.relocation.apply" | "execution.relocation.plan" | "execution.relocation.reconcile" | "execution.relocation.show" | "execution.worktree.create" | "execution.worktree.import" | "execution.worktree.reconcile" | "execution.worktree.remove.apply" | "execution.worktree.remove.plan" | "execution.worktree.status" | "harness.installed.list" | "hold.list" | "hold.place.confirm" | "hold.place.preview" | "hold.release.confirm" | "hold.release.preview" | "integration.apply.claude-code" | "integration.apply.codex" | "integration.apply.pi-rpc" | "integration.plan.claude-code" | "integration.plan.codex" | "integration.plan.pi-rpc" | "integration.remove.claude-code" | "integration.remove.codex" | "integration.remove.pi-rpc" | "integration.status.claude-code" | "integration.status.codex" | "integration.status.pi-rpc" | "interaction.cancel" | "interaction.create" | "interaction.list" | "interaction.respond" | "interaction.show" | "monitor.bootstrap.create" | "node.remote.install.confirm" | "node.remote.install.preview" | "node.remote.list" | "node.remote.remove.confirm" | "node.remote.remove.preview" | "node.shutdown" | "node.status" | "port.lease.acquire" | "port.lease.list" | "port.lease.release" | "port.lease.renew" | "presentation.catalog.show" | "presentation.project-list.show" | "presentation.session-list.show" | "presentation.workspace-directory.show" | "project.context.list" | "project.context.record" | "project.context.show" | "project.create.confirm" | "project.create.preview" | "project.guard.confirm" | "project.guard.preview" | "project.guard.show" | "project.list" | "project.register" | "project.rename.confirm" | "project.rename.preview" | "project.show" | "provider.pool.list" | "receipt.get" | "receipt.list" | "reference.resolve" | "run.create" | "run.dispatch.settle-terminal" | "run.dispatch.show" | "run.inbox.ack" | "run.inbox.check" | "run.ledger.create" | "run.ledger.list" | "run.ledger.task.dispatch" | "run.ledger.task.list" | "run.ledger.task.settle" | "run.ledger.task.show" | "run.list" | "run.question.cancel" | "run.question.open" | "run.question.reply" | "run.show" | "run.task.list" | "run.task.show" | "runtime.probe" | "session.adopt.confirm" | "session.adopt.preview" | "session.agent-permission.confirm" | "session.agent-permission.preview" | "session.archive" | "session.create" | "session.diff" | "session.events.list" | "session.history.read" | "session.inbox.ack" | "session.inbox.check" | "session.list" | "session.message.send" | "session.observe" | "session.rename" | "session.resume" | "session.show" | "session.spawn" | "session.start" | "session.stop" | "terminal.controller.acquire" | "terminal.controller.release" | "terminal.controller.renew" | "terminal.controller.request" | "terminal.controller.request.show" | "terminal.create" | "terminal.events.list" | "terminal.input.write" | "terminal.list" | "terminal.mutation.reconcile" | "terminal.observer.attach" | "terminal.observer.check" | "terminal.observer.detach" | "terminal.observer.resync" | "terminal.read" | "terminal.session.close" | "terminal.session.delete" | "terminal.session.resize" | "terminal.session.restart" | "terminal.session.signal" | "terminal.show" | "turn.interrupt" | "turn.send" | "turn.show" | "turn.wait" | "voice.managed-turn.confirm" | "voice.managed-turn.preview" | "voice.orchestrator.context.show" | "voice.orchestrator.tool.call" | "voice.pi.relay" | "voice.pi.relay.preview" | "voice.pi.relay.reconcile" | "workspace.context.show" | "workspace.execution.configure" | "workspace.execution.show" | "workspace.list" | "workspace.membership.attach" | "workspace.repository.attach" | "workspace.select" | "workspace.show")[];
|
|
22
|
+
readonly revision: "1";
|
|
23
|
+
};
|
|
24
|
+
readonly method: "session.agent-permission.confirm";
|
|
25
|
+
readonly receipt: {
|
|
26
|
+
readonly actorId: string;
|
|
27
|
+
readonly aggregateRevision: string;
|
|
28
|
+
readonly commandId: string;
|
|
29
|
+
readonly createdAt: string;
|
|
30
|
+
readonly eventCursor: string;
|
|
31
|
+
readonly method: string;
|
|
32
|
+
readonly receiptId: string;
|
|
33
|
+
readonly schemaVersion: 1;
|
|
34
|
+
readonly state: "succeeded";
|
|
35
|
+
readonly target: {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly type: string;
|
|
38
|
+
};
|
|
39
|
+
readonly updatedAt: string;
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
previewAgentPermission: (input: AgentPermissionPreviewParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
43
|
+
readonly definitionRef: {
|
|
44
|
+
readonly contentDigest: string;
|
|
45
|
+
readonly key: string;
|
|
46
|
+
readonly version: string;
|
|
47
|
+
};
|
|
48
|
+
readonly expectedSessionRevision: string;
|
|
49
|
+
readonly expectedWorkspaceRevision: string;
|
|
50
|
+
readonly sessionId: string;
|
|
51
|
+
readonly workspaceId: string;
|
|
52
|
+
readonly actorId: string;
|
|
53
|
+
readonly commandId: string;
|
|
54
|
+
readonly expiresAt: string;
|
|
55
|
+
readonly inputDigest: string;
|
|
56
|
+
readonly issuedAt: string;
|
|
57
|
+
readonly method: "session.agent-permission.preview";
|
|
58
|
+
readonly operationIds: readonly ("approval.list" | "approval.respond" | "approval.show" | "connection.capacity.set" | "connection.create" | "connection.detect" | "connection.gateway.create" | "connection.list" | "connection.login.start" | "connection.models.list" | "connection.show" | "connection.state.set" | "connection.system.confirm" | "connection.system.preview" | "connection.usage.show" | "container.create.confirm" | "container.create.preview" | "container.index.list" | "container.list" | "container.rename.confirm" | "container.rename.preview" | "container.show" | "context.show" | "discovery.sessions.list" | "execution.catalog.get" | "execution.checkpoint.create" | "execution.checkpoint.show" | "execution.command.run" | "execution.file.read" | "execution.placement.create" | "execution.placement.show" | "execution.relocation.apply" | "execution.relocation.plan" | "execution.relocation.reconcile" | "execution.relocation.show" | "execution.worktree.create" | "execution.worktree.import" | "execution.worktree.reconcile" | "execution.worktree.remove.apply" | "execution.worktree.remove.plan" | "execution.worktree.status" | "harness.installed.list" | "hold.list" | "hold.place.confirm" | "hold.place.preview" | "hold.release.confirm" | "hold.release.preview" | "integration.apply.claude-code" | "integration.apply.codex" | "integration.apply.pi-rpc" | "integration.plan.claude-code" | "integration.plan.codex" | "integration.plan.pi-rpc" | "integration.remove.claude-code" | "integration.remove.codex" | "integration.remove.pi-rpc" | "integration.status.claude-code" | "integration.status.codex" | "integration.status.pi-rpc" | "interaction.cancel" | "interaction.create" | "interaction.list" | "interaction.respond" | "interaction.show" | "monitor.bootstrap.create" | "node.remote.install.confirm" | "node.remote.install.preview" | "node.remote.list" | "node.remote.remove.confirm" | "node.remote.remove.preview" | "node.shutdown" | "node.status" | "port.lease.acquire" | "port.lease.list" | "port.lease.release" | "port.lease.renew" | "presentation.catalog.show" | "presentation.project-list.show" | "presentation.session-list.show" | "presentation.workspace-directory.show" | "project.context.list" | "project.context.record" | "project.context.show" | "project.create.confirm" | "project.create.preview" | "project.guard.confirm" | "project.guard.preview" | "project.guard.show" | "project.list" | "project.register" | "project.rename.confirm" | "project.rename.preview" | "project.show" | "provider.pool.list" | "receipt.get" | "receipt.list" | "reference.resolve" | "run.create" | "run.dispatch.settle-terminal" | "run.dispatch.show" | "run.inbox.ack" | "run.inbox.check" | "run.ledger.create" | "run.ledger.list" | "run.ledger.task.dispatch" | "run.ledger.task.list" | "run.ledger.task.settle" | "run.ledger.task.show" | "run.list" | "run.question.cancel" | "run.question.open" | "run.question.reply" | "run.show" | "run.task.list" | "run.task.show" | "runtime.probe" | "session.adopt.confirm" | "session.adopt.preview" | "session.agent-permission.confirm" | "session.agent-permission.preview" | "session.archive" | "session.create" | "session.diff" | "session.events.list" | "session.history.read" | "session.inbox.ack" | "session.inbox.check" | "session.list" | "session.message.send" | "session.observe" | "session.rename" | "session.resume" | "session.show" | "session.spawn" | "session.start" | "session.stop" | "terminal.controller.acquire" | "terminal.controller.release" | "terminal.controller.renew" | "terminal.controller.request" | "terminal.controller.request.show" | "terminal.create" | "terminal.events.list" | "terminal.input.write" | "terminal.list" | "terminal.mutation.reconcile" | "terminal.observer.attach" | "terminal.observer.check" | "terminal.observer.detach" | "terminal.observer.resync" | "terminal.read" | "terminal.session.close" | "terminal.session.delete" | "terminal.session.resize" | "terminal.session.restart" | "terminal.session.signal" | "terminal.show" | "turn.interrupt" | "turn.send" | "turn.show" | "turn.wait" | "voice.managed-turn.confirm" | "voice.managed-turn.preview" | "voice.orchestrator.context.show" | "voice.orchestrator.tool.call" | "voice.pi.relay" | "voice.pi.relay.preview" | "voice.pi.relay.reconcile" | "workspace.context.show" | "workspace.execution.configure" | "workspace.execution.show" | "workspace.list" | "workspace.membership.attach" | "workspace.repository.attach" | "workspace.select" | "workspace.show")[];
|
|
59
|
+
readonly proof: string;
|
|
60
|
+
}>;
|
|
61
|
+
};
|
|
62
|
+
export declare const runAgentPermissionSet: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
63
|
+
//# sourceMappingURL=agent-permission.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { agentPermissionConfirmParametersSchema, agentPermissionPreviewParametersSchema, } from "@maiaos/sdk";
|
|
2
|
+
import { runInputTwoPhase, } from "../command-line/index.js";
|
|
3
|
+
import { writeSessionResult } from "./output/index.js";
|
|
4
|
+
export const makeAgentPermissionCliClient = (node) => ({
|
|
5
|
+
confirmAgentPermission: (input) => node.runValidatedNodeOperation(input, agentPermissionConfirmParametersSchema, (client, parameters, options) => client.confirmAgentPermission(parameters, options), { commandId: input.commandId }),
|
|
6
|
+
previewAgentPermission: (input) => node.runValidatedNodeOperation(input, agentPermissionPreviewParametersSchema, (client, parameters, options) => client.previewAgentPermission(parameters, options)),
|
|
7
|
+
});
|
|
8
|
+
export const runAgentPermissionSet = (tokens, context) => runInputTwoPhase({
|
|
9
|
+
confirm: context.dependencies.confirmAgentPermission,
|
|
10
|
+
confirmSchema: agentPermissionConfirmParametersSchema,
|
|
11
|
+
context,
|
|
12
|
+
label: "Agent permission input",
|
|
13
|
+
preview: context.dependencies.previewAgentPermission,
|
|
14
|
+
previewSchema: agentPermissionPreviewParametersSchema,
|
|
15
|
+
tokens,
|
|
16
|
+
write: (result) => writeSessionResult(result, context, (value) => value.method === "session.agent-permission.preview"
|
|
17
|
+
? { command: value.method, result: value }
|
|
18
|
+
: { command: value.method, result: value }),
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=agent-permission.js.map
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type ApprovalListParameters, type ApprovalRespondParameters, type ApprovalShowParameters } from "@maiaos/sdk";
|
|
2
|
+
import type { CliNodeOperations } from "../../local-node/index.js";
|
|
3
|
+
export declare const makeApprovalClient: (node: CliNodeOperations) => {
|
|
4
|
+
listApprovals: (input: ApprovalListParameters) => import("../../local-node/client.js").CliNodeEffect<{
|
|
5
|
+
readonly items: readonly {
|
|
6
|
+
readonly approvalId: string;
|
|
7
|
+
readonly createdAt: string;
|
|
8
|
+
readonly executor: "claude-code" | "codex-cli";
|
|
9
|
+
readonly expiresAt: string;
|
|
10
|
+
readonly forSessionOffered: boolean;
|
|
11
|
+
readonly kind: "command" | "file_change" | "question" | "tool";
|
|
12
|
+
readonly options?: readonly {
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly optionId: string;
|
|
15
|
+
}[] | undefined;
|
|
16
|
+
readonly reason?: string | undefined;
|
|
17
|
+
readonly requestDigest: string;
|
|
18
|
+
readonly resolution?: {
|
|
19
|
+
readonly actorId: string;
|
|
20
|
+
readonly answer?: string | undefined;
|
|
21
|
+
readonly forSession?: true | undefined;
|
|
22
|
+
readonly reason?: string | undefined;
|
|
23
|
+
readonly resolvedAt: string;
|
|
24
|
+
} | undefined;
|
|
25
|
+
readonly revision: string;
|
|
26
|
+
readonly schemaVersion: "maia.approval/v1";
|
|
27
|
+
readonly sessionId: string;
|
|
28
|
+
readonly status: "answered" | "approved" | "cancelled" | "denied" | "expired" | "pending";
|
|
29
|
+
readonly summary: string;
|
|
30
|
+
readonly turnId: string;
|
|
31
|
+
readonly workspaceId: string;
|
|
32
|
+
}[];
|
|
33
|
+
readonly method: "approval.list";
|
|
34
|
+
}>;
|
|
35
|
+
respondToApproval: (input: ApprovalRespondParameters) => import("../../local-node/client.js").CliNodeEffect<{
|
|
36
|
+
readonly approval: {
|
|
37
|
+
readonly approvalId: string;
|
|
38
|
+
readonly createdAt: string;
|
|
39
|
+
readonly executor: "claude-code" | "codex-cli";
|
|
40
|
+
readonly expiresAt: string;
|
|
41
|
+
readonly forSessionOffered: boolean;
|
|
42
|
+
readonly kind: "command" | "file_change" | "question" | "tool";
|
|
43
|
+
readonly options?: readonly {
|
|
44
|
+
readonly label: string;
|
|
45
|
+
readonly optionId: string;
|
|
46
|
+
}[] | undefined;
|
|
47
|
+
readonly reason?: string | undefined;
|
|
48
|
+
readonly requestDigest: string;
|
|
49
|
+
readonly resolution?: {
|
|
50
|
+
readonly actorId: string;
|
|
51
|
+
readonly answer?: string | undefined;
|
|
52
|
+
readonly forSession?: true | undefined;
|
|
53
|
+
readonly reason?: string | undefined;
|
|
54
|
+
readonly resolvedAt: string;
|
|
55
|
+
} | undefined;
|
|
56
|
+
readonly revision: string;
|
|
57
|
+
readonly schemaVersion: "maia.approval/v1";
|
|
58
|
+
readonly sessionId: string;
|
|
59
|
+
readonly status: "answered" | "approved" | "cancelled" | "denied" | "expired" | "pending";
|
|
60
|
+
readonly summary: string;
|
|
61
|
+
readonly turnId: string;
|
|
62
|
+
readonly workspaceId: string;
|
|
63
|
+
};
|
|
64
|
+
readonly commandId: string;
|
|
65
|
+
readonly delivery: "duplicate" | "new";
|
|
66
|
+
readonly method: "approval.respond";
|
|
67
|
+
readonly receipt: {
|
|
68
|
+
readonly actorId: string;
|
|
69
|
+
readonly aggregateRevision: string;
|
|
70
|
+
readonly commandId: string;
|
|
71
|
+
readonly createdAt: string;
|
|
72
|
+
readonly eventCursor: string;
|
|
73
|
+
readonly method: string;
|
|
74
|
+
readonly receiptId: string;
|
|
75
|
+
readonly schemaVersion: 1;
|
|
76
|
+
readonly state: "succeeded";
|
|
77
|
+
readonly target: {
|
|
78
|
+
readonly id: string;
|
|
79
|
+
readonly type: string;
|
|
80
|
+
};
|
|
81
|
+
readonly updatedAt: string;
|
|
82
|
+
};
|
|
83
|
+
}>;
|
|
84
|
+
showApproval: (input: ApprovalShowParameters) => import("../../local-node/client.js").CliNodeEffect<{
|
|
85
|
+
readonly approval: {
|
|
86
|
+
readonly approvalId: string;
|
|
87
|
+
readonly createdAt: string;
|
|
88
|
+
readonly executor: "claude-code" | "codex-cli";
|
|
89
|
+
readonly expiresAt: string;
|
|
90
|
+
readonly forSessionOffered: boolean;
|
|
91
|
+
readonly kind: "command" | "file_change" | "question" | "tool";
|
|
92
|
+
readonly options?: readonly {
|
|
93
|
+
readonly label: string;
|
|
94
|
+
readonly optionId: string;
|
|
95
|
+
}[] | undefined;
|
|
96
|
+
readonly reason?: string | undefined;
|
|
97
|
+
readonly requestDigest: string;
|
|
98
|
+
readonly resolution?: {
|
|
99
|
+
readonly actorId: string;
|
|
100
|
+
readonly answer?: string | undefined;
|
|
101
|
+
readonly forSession?: true | undefined;
|
|
102
|
+
readonly reason?: string | undefined;
|
|
103
|
+
readonly resolvedAt: string;
|
|
104
|
+
} | undefined;
|
|
105
|
+
readonly revision: string;
|
|
106
|
+
readonly schemaVersion: "maia.approval/v1";
|
|
107
|
+
readonly sessionId: string;
|
|
108
|
+
readonly status: "answered" | "approved" | "cancelled" | "denied" | "expired" | "pending";
|
|
109
|
+
readonly summary: string;
|
|
110
|
+
readonly turnId: string;
|
|
111
|
+
readonly workspaceId: string;
|
|
112
|
+
};
|
|
113
|
+
readonly method: "approval.show";
|
|
114
|
+
}>;
|
|
115
|
+
};
|
|
116
|
+
export type ApprovalCliDependencies = ReturnType<typeof makeApprovalClient>;
|
|
117
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { approvalListParametersSchema, approvalRespondParametersSchema, approvalShowParametersSchema, } from "@maiaos/sdk";
|
|
2
|
+
export const makeApprovalClient = (node) => ({
|
|
3
|
+
listApprovals: (input) => node.runValidatedNodeOperation(input, approvalListParametersSchema, (client, parameters, options) => client.listApprovals(parameters, options)),
|
|
4
|
+
respondToApproval: (input) => node.runValidatedNodeOperation(input, approvalRespondParametersSchema, (client, parameters, options) => client.respondToApproval(parameters, options), { commandId: input.commandId }),
|
|
5
|
+
showApproval: (input) => node.runValidatedNodeOperation(input, approvalShowParametersSchema, (client, parameters, options) => client.showApproval(parameters, options)),
|
|
6
|
+
});
|
|
7
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CommandContext, type CommandEffect } from "../../command-line/index.js";
|
|
2
|
+
export declare const runApprovalList: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
3
|
+
export declare const runApprovalShow: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
4
|
+
export declare const runApprovalApprove: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
5
|
+
export declare const runApprovalDeny: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
6
|
+
export declare const runApprovalAnswer: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
7
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { CliArgumentError, parseOptions, reportError, requirePositionals, writeNodeResult, } from "../../command-line/index.js";
|
|
3
|
+
import { commandIdentifier, } from "../../local-node/index.js";
|
|
4
|
+
import { describeApproval, formatApprovalResult, } from "./output/index.js";
|
|
5
|
+
const missing = (name) => Effect.die(new Error(`Missing approval client: ${name}.`));
|
|
6
|
+
const write = (context) => (result) => writeNodeResult(result, context, {
|
|
7
|
+
toResult: (value) => ({ command: value.method, result: value }),
|
|
8
|
+
toText: formatApprovalResult,
|
|
9
|
+
});
|
|
10
|
+
const readLimit = (value) => {
|
|
11
|
+
if (value === undefined)
|
|
12
|
+
return 20;
|
|
13
|
+
if (!/^[1-9]\d?$/u.test(value) || Number(value) > 50)
|
|
14
|
+
throw new CliArgumentError("Option '--limit' must be an integer from 1 to 50.");
|
|
15
|
+
return Number(value);
|
|
16
|
+
};
|
|
17
|
+
export const runApprovalList = (tokens, context) => {
|
|
18
|
+
const parsed = parseOptions(tokens, new Set(["--limit", "--session"]), new Set(["--all"]));
|
|
19
|
+
requirePositionals(parsed.positionals, 0);
|
|
20
|
+
const session = parsed.options.get("--session");
|
|
21
|
+
const { listApprovals } = context.dependencies;
|
|
22
|
+
if (listApprovals === undefined)
|
|
23
|
+
return missing("list");
|
|
24
|
+
return Effect.map(listApprovals({
|
|
25
|
+
limit: readLimit(parsed.options.get("--limit")),
|
|
26
|
+
...(parsed.flags.has("--all") ? { pendingOnly: false } : {}),
|
|
27
|
+
...(session === undefined ? {} : { sessionId: session }),
|
|
28
|
+
}), write(context));
|
|
29
|
+
};
|
|
30
|
+
export const runApprovalShow = (tokens, context) => {
|
|
31
|
+
const rest = tokens;
|
|
32
|
+
requirePositionals(rest, 1);
|
|
33
|
+
const { showApproval } = context.dependencies;
|
|
34
|
+
if (showApproval === undefined)
|
|
35
|
+
return missing("show");
|
|
36
|
+
return Effect.map(showApproval({ approvalId: rest[0] ?? "" }), write(context));
|
|
37
|
+
};
|
|
38
|
+
const requirePerson = (context, verb) => {
|
|
39
|
+
if (context.io.interactive !== true || context.io.prompt === undefined)
|
|
40
|
+
throw new CliArgumentError(`Only a person can ${verb}: run 'maia session approval ${verb}' at an interactive terminal, or answer from Desktop.`);
|
|
41
|
+
};
|
|
42
|
+
const readDecision = (verb, options, flags) => {
|
|
43
|
+
if (verb === "approve")
|
|
44
|
+
return {
|
|
45
|
+
decision: flags.has("--for-session") ? "approve_for_session" : "approve",
|
|
46
|
+
};
|
|
47
|
+
if (verb === "deny") {
|
|
48
|
+
const reason = options.get("--reason");
|
|
49
|
+
return { decision: "deny", ...(reason === undefined ? {} : { reason }) };
|
|
50
|
+
}
|
|
51
|
+
const text = options.get("--text");
|
|
52
|
+
const option = options.get("--option");
|
|
53
|
+
if ((text === undefined) === (option === undefined))
|
|
54
|
+
throw new CliArgumentError("Answer with one of '--text' or '--option'.");
|
|
55
|
+
return { answer: text ?? option ?? "", decision: "answer" };
|
|
56
|
+
};
|
|
57
|
+
const resolveAnswer = (approval, decision) => {
|
|
58
|
+
if (decision.decision !== "answer" || approval.options === undefined)
|
|
59
|
+
return decision;
|
|
60
|
+
const chosen = approval.options.find((option) => option.optionId === decision.answer);
|
|
61
|
+
return chosen === undefined
|
|
62
|
+
? decision
|
|
63
|
+
: { ...decision, answer: chosen.label };
|
|
64
|
+
};
|
|
65
|
+
const OPTIONS = {
|
|
66
|
+
answer: new Set(["--command-id", "--option", "--text"]),
|
|
67
|
+
approve: new Set(["--command-id"]),
|
|
68
|
+
deny: new Set(["--command-id", "--reason"]),
|
|
69
|
+
};
|
|
70
|
+
const confirmed = (context, approval, decision) => {
|
|
71
|
+
context.io.stderr(`${describeApproval(approval)}\n`);
|
|
72
|
+
if (decision.decision !== "approve" &&
|
|
73
|
+
decision.decision !== "approve_for_session")
|
|
74
|
+
return Effect.succeed(true);
|
|
75
|
+
const scope = decision.decision === "approve_for_session"
|
|
76
|
+
? "for this Session until its worker restarts"
|
|
77
|
+
: "once";
|
|
78
|
+
const prompt = context.io.prompt;
|
|
79
|
+
if (prompt === undefined)
|
|
80
|
+
return Effect.succeed(false);
|
|
81
|
+
return Effect.map(prompt(`Approve this ${approval.kind} ${scope}? [y/N] `), (answer) => ["y", "yes"].includes((answer ?? "").toLowerCase()));
|
|
82
|
+
};
|
|
83
|
+
const notConfirmed = (context) => reportError({
|
|
84
|
+
code: "invalid_argument",
|
|
85
|
+
message: "Nothing approved; the worker still waits until the request expires.",
|
|
86
|
+
retryable: false,
|
|
87
|
+
}, context);
|
|
88
|
+
const decide = (context, input) => {
|
|
89
|
+
const { respondToApproval, showApproval } = context.dependencies;
|
|
90
|
+
if (respondToApproval === undefined || showApproval === undefined)
|
|
91
|
+
return missing("decision");
|
|
92
|
+
return Effect.gen(function* () {
|
|
93
|
+
const shown = yield* showApproval({ approvalId: input.approvalId });
|
|
94
|
+
if (!shown.ok)
|
|
95
|
+
return write(context)(shown);
|
|
96
|
+
const { approval } = shown.value;
|
|
97
|
+
const decision = resolveAnswer(approval, input.requested);
|
|
98
|
+
if (!(yield* confirmed(context, approval, decision)))
|
|
99
|
+
return notConfirmed(context);
|
|
100
|
+
const commandId = yield* commandIdentifier(input.commandId);
|
|
101
|
+
return write(context)(yield* respondToApproval({
|
|
102
|
+
...decision,
|
|
103
|
+
approvalId: input.approvalId,
|
|
104
|
+
commandId,
|
|
105
|
+
requestDigest: approval.requestDigest,
|
|
106
|
+
}));
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
const runDecision = (verb, tokens, context) => {
|
|
110
|
+
requirePerson(context, verb);
|
|
111
|
+
const parsed = parseOptions(tokens, OPTIONS[verb], verb === "approve" ? new Set(["--for-session"]) : new Set());
|
|
112
|
+
requirePositionals(parsed.positionals, 1);
|
|
113
|
+
const commandId = parsed.options.get("--command-id");
|
|
114
|
+
return decide(context, {
|
|
115
|
+
approvalId: parsed.positionals[0] ?? "",
|
|
116
|
+
...(commandId === undefined ? {} : { commandId }),
|
|
117
|
+
requested: readDecision(verb, parsed.options, parsed.flags),
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
export const runApprovalApprove = (tokens, context) => runDecision("approve", tokens, context);
|
|
121
|
+
export const runApprovalDeny = (tokens, context) => runDecision("deny", tokens, context);
|
|
122
|
+
export const runApprovalAnswer = (tokens, context) => runDecision("answer", tokens, context);
|
|
123
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Approval, ApprovalListResult, ApprovalRespondResult, ApprovalShowResult } from "@maiaos/sdk";
|
|
2
|
+
export type ApprovalCliResult = ApprovalListResult | ApprovalRespondResult | ApprovalShowResult;
|
|
3
|
+
export type CliApprovalResult = {
|
|
4
|
+
readonly command: ApprovalCliResult["method"];
|
|
5
|
+
readonly result: ApprovalCliResult;
|
|
6
|
+
};
|
|
7
|
+
export declare const isApprovalResult: (result: {
|
|
8
|
+
readonly command: string;
|
|
9
|
+
}) => result is CliApprovalResult;
|
|
10
|
+
export declare const describeApproval: (approval: Approval) => string;
|
|
11
|
+
export declare const formatApprovalResult: ({ result }: CliApprovalResult) => string;
|
|
12
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const isApprovalResult = (result) => result.command.startsWith("approval.");
|
|
2
|
+
const indent = (text) => text
|
|
3
|
+
.split("\n")
|
|
4
|
+
.map((line) => ` ${line}`)
|
|
5
|
+
.join("\n");
|
|
6
|
+
export const describeApproval = (approval) => [
|
|
7
|
+
`${approval.approvalId}\t${approval.kind}\t${approval.status}\tsession=${approval.sessionId}\tturn=${approval.turnId}\texpires=${approval.expiresAt}`,
|
|
8
|
+
indent(approval.summary),
|
|
9
|
+
...(approval.reason === undefined ? [] : [` reason: ${approval.reason}`]),
|
|
10
|
+
...(approval.options ?? []).map((option) => ` --option ${option.optionId}\t${option.label}`),
|
|
11
|
+
...(approval.resolution === undefined
|
|
12
|
+
? []
|
|
13
|
+
: [
|
|
14
|
+
` by ${approval.resolution.actorId} at ${approval.resolution.resolvedAt}${approval.resolution.forSession === true ? " for the Session" : ""}`,
|
|
15
|
+
]),
|
|
16
|
+
].join("\n");
|
|
17
|
+
const formatList = (result) => result.items.length === 0
|
|
18
|
+
? "No worker waits on a person.\n"
|
|
19
|
+
: `${result.items.map(describeApproval).join("\n")}\n`;
|
|
20
|
+
export const formatApprovalResult = ({ result }) => {
|
|
21
|
+
if (result.method === "approval.list")
|
|
22
|
+
return formatList(result);
|
|
23
|
+
return `${describeApproval(result.approval)}\n`;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SessionAttachFrame } from "@maiaos/sdk";
|
|
2
|
+
import type * as Crypto from "effect/Crypto";
|
|
3
|
+
import type * as Stream from "effect/Stream";
|
|
4
|
+
import type { CliNodeEffect, CliNodeOperations } from "../local-node/index.js";
|
|
5
|
+
export type AttachSessionInput = {
|
|
6
|
+
readonly after?: {
|
|
7
|
+
readonly epoch: string;
|
|
8
|
+
readonly sequence: number;
|
|
9
|
+
};
|
|
10
|
+
readonly sessionId: string;
|
|
11
|
+
};
|
|
12
|
+
export type SessionAttachStream = Stream.Stream<SessionAttachFrame, unknown, Crypto.Crypto>;
|
|
13
|
+
export declare const makeAttachClient: (node: CliNodeOperations) => {
|
|
14
|
+
attachSession: (input: AttachSessionInput) => CliNodeEffect<SessionAttachStream>;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=attach-client.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
export const makeAttachClient = (node) => ({
|
|
3
|
+
attachSession: (input) => node.runDiscoveryOperation((options) => Effect.promise(() => import("@maiaos/sdk/node/effect")).pipe(Effect.map((sdk) => sdk.attachSessionEffect({
|
|
4
|
+
...(input.after === undefined ? {} : { after: input.after }),
|
|
5
|
+
sessionId: input.sessionId,
|
|
6
|
+
}, options)))),
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=attach-client.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type SessionAttachFrame, type SessionAttachView } from "@maiaos/sdk";
|
|
2
|
+
export type AttachRenderState = {
|
|
3
|
+
readonly lineOpen: boolean;
|
|
4
|
+
readonly openItem?: string;
|
|
5
|
+
readonly view: SessionAttachView;
|
|
6
|
+
readonly written: ReadonlyMap<string, string>;
|
|
7
|
+
};
|
|
8
|
+
type Rendered = {
|
|
9
|
+
readonly state: AttachRenderState;
|
|
10
|
+
readonly text: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const initialAttachRenderState: (view: SessionAttachView) => AttachRenderState;
|
|
13
|
+
export declare const renderSessionAttachFrame: (state: AttachRenderState, frame: SessionAttachFrame) => Rendered;
|
|
14
|
+
export declare const finishSessionAttachRender: (state: AttachRenderState) => string;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=attach-render.d.ts.map
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { isNewSessionRecord, reduceSessionAttach, sessionItemText, } from "@maiaos/sdk";
|
|
2
|
+
import { formatFailureCell } from "./output/index.js";
|
|
3
|
+
const MAX_ARGUMENTS_SHOWN = 200;
|
|
4
|
+
const header = (item) => {
|
|
5
|
+
switch (item.kind) {
|
|
6
|
+
case "message":
|
|
7
|
+
return item.role === "user" ? "user> " : "assistant> ";
|
|
8
|
+
case "reasoning":
|
|
9
|
+
return "thinking> ";
|
|
10
|
+
case "command":
|
|
11
|
+
return `$ ${item.command}\n`;
|
|
12
|
+
case "tool_call":
|
|
13
|
+
return `tool ${item.name} ${(item.arguments ?? "").slice(0, MAX_ARGUMENTS_SHOWN)}\n`;
|
|
14
|
+
case "approval_request":
|
|
15
|
+
return item.approvalId === undefined
|
|
16
|
+
? "approval? "
|
|
17
|
+
: `approval ${item.approvalId}? `;
|
|
18
|
+
case "error":
|
|
19
|
+
return "error: ";
|
|
20
|
+
case "file_change":
|
|
21
|
+
case "usage":
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const footer = (record) => {
|
|
26
|
+
const { item } = record;
|
|
27
|
+
const status = record.status === "completed" ? "" : `[${record.status}]\n`;
|
|
28
|
+
if (item.kind === "command" && item.exitCode !== undefined)
|
|
29
|
+
return `[exit ${String(item.exitCode)}]\n${status}`;
|
|
30
|
+
if (item.kind === "file_change")
|
|
31
|
+
return `${item.changes.map((change) => `${change.change} ${change.path}\n`).join("")}${status}`;
|
|
32
|
+
if (item.kind === "usage")
|
|
33
|
+
return `tokens: ${String(item.inputTokens)} in (${String(item.cachedInputTokens)} cached), ${String(item.outputTokens)} out${item.modelCallCount === undefined ? "" : `, ${String(item.modelCallCount)} model call${item.modelCallCount === 1 ? "" : "s"}`}\n`;
|
|
34
|
+
return status;
|
|
35
|
+
};
|
|
36
|
+
const emit = (rendered, text) => text.length === 0
|
|
37
|
+
? rendered
|
|
38
|
+
: {
|
|
39
|
+
state: { ...rendered.state, lineOpen: !text.endsWith("\n") },
|
|
40
|
+
text: `${rendered.text}${text}`,
|
|
41
|
+
};
|
|
42
|
+
const closeLine = (rendered) => {
|
|
43
|
+
const closed = rendered.state.lineOpen ? emit(rendered, "\n") : rendered;
|
|
44
|
+
return { ...closed, state: { ...closed.state, openItem: undefined } };
|
|
45
|
+
};
|
|
46
|
+
const onItemLine = (rendered, itemId) => {
|
|
47
|
+
if (rendered.state.openItem === itemId)
|
|
48
|
+
return rendered;
|
|
49
|
+
const closed = closeLine(rendered);
|
|
50
|
+
return { ...closed, state: { ...closed.state, openItem: itemId } };
|
|
51
|
+
};
|
|
52
|
+
const withShown = (rendered, itemId, shown) => ({
|
|
53
|
+
...rendered,
|
|
54
|
+
state: {
|
|
55
|
+
...rendered.state,
|
|
56
|
+
written: new Map(rendered.state.written).set(itemId, shown),
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
const writeItemText = (rendered, itemId, { cut = false, text }) => {
|
|
60
|
+
const shown = rendered.state.written.get(itemId) ?? "";
|
|
61
|
+
if (text.length < shown.length && shown.endsWith(text))
|
|
62
|
+
return withShown(rendered, itemId, text);
|
|
63
|
+
const extendsShown = text.startsWith(shown);
|
|
64
|
+
if (cut && !extendsShown) {
|
|
65
|
+
const positioned = onItemLine(rendered, itemId);
|
|
66
|
+
const separator = positioned.state.lineOpen ? "\n" : "";
|
|
67
|
+
return withShown(emit(positioned, `${separator}…${text}`), itemId, text);
|
|
68
|
+
}
|
|
69
|
+
if (!extendsShown || text.length === shown.length)
|
|
70
|
+
return rendered;
|
|
71
|
+
return withShown(emit(onItemLine(rendered, itemId), text.slice(shown.length)), itemId, text);
|
|
72
|
+
};
|
|
73
|
+
const renderStarted = (rendered, record) => {
|
|
74
|
+
const opened = emit(closeLine(rendered), header(record.item));
|
|
75
|
+
return writeItemText({
|
|
76
|
+
...opened,
|
|
77
|
+
state: {
|
|
78
|
+
...opened.state,
|
|
79
|
+
openItem: record.itemId,
|
|
80
|
+
written: new Map(opened.state.written).set(record.itemId, ""),
|
|
81
|
+
},
|
|
82
|
+
}, record.itemId, { text: sessionItemText(record.item) });
|
|
83
|
+
};
|
|
84
|
+
const renderDelta = (rendered, record) => {
|
|
85
|
+
const shown = rendered.state.written.get(record.itemId);
|
|
86
|
+
if (shown === undefined)
|
|
87
|
+
return rendered;
|
|
88
|
+
const appended = emit(onItemLine(rendered, record.itemId), record.delta);
|
|
89
|
+
return {
|
|
90
|
+
...appended,
|
|
91
|
+
state: {
|
|
92
|
+
...appended.state,
|
|
93
|
+
written: new Map(appended.state.written).set(record.itemId, shown + record.delta),
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
const renderCompleted = (rendered, record) => {
|
|
98
|
+
const started = rendered.state.written.has(record.itemId)
|
|
99
|
+
? rendered
|
|
100
|
+
: renderStarted(rendered, { ...record, type: "item.started" });
|
|
101
|
+
const finished = writeItemText(started, record.itemId, {
|
|
102
|
+
text: sessionItemText(record.item),
|
|
103
|
+
});
|
|
104
|
+
const closed = emit(closeLine(finished), footer(record));
|
|
105
|
+
const written = new Map(closed.state.written);
|
|
106
|
+
written.delete(record.itemId);
|
|
107
|
+
return { ...closed, state: { ...closed.state, written } };
|
|
108
|
+
};
|
|
109
|
+
const renderRecord = (rendered, record) => {
|
|
110
|
+
switch (record.type) {
|
|
111
|
+
case "turn.started":
|
|
112
|
+
return emit(closeLine(rendered), `## turn ${record.turnId}\n`);
|
|
113
|
+
case "turn.completed":
|
|
114
|
+
return emit(closeLine(rendered), `## turn ${record.turnId} ${record.status}${record.failure === undefined ? "" : `: ${formatFailureCell(record.failure)}`}\n`);
|
|
115
|
+
case "item.started":
|
|
116
|
+
return renderStarted(rendered, record);
|
|
117
|
+
case "item.delta":
|
|
118
|
+
return renderDelta(rendered, record);
|
|
119
|
+
case "item.completed":
|
|
120
|
+
return renderCompleted(rendered, record);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const renderOpenItems = (rendered, openItems) => openItems.reduce((current, open) => {
|
|
124
|
+
if (!current.state.written.has(open.itemId))
|
|
125
|
+
return current;
|
|
126
|
+
return writeItemText(current, open.itemId, {
|
|
127
|
+
cut: open.truncated === true,
|
|
128
|
+
text: open.text,
|
|
129
|
+
});
|
|
130
|
+
}, rendered);
|
|
131
|
+
const renderFrameText = (state, frame) => {
|
|
132
|
+
const start = { state, text: "" };
|
|
133
|
+
if (frame.kind === "records")
|
|
134
|
+
return frame.data.records
|
|
135
|
+
.filter((record) => isNewSessionRecord(state.view, record))
|
|
136
|
+
.reduce(renderRecord, start);
|
|
137
|
+
if (frame.kind === "synchronized")
|
|
138
|
+
return renderOpenItems(start, frame.data.openItems);
|
|
139
|
+
if (frame.kind === "attached" && frame.data.mode === "snapshot")
|
|
140
|
+
return state.view.sequence === 0
|
|
141
|
+
? start
|
|
142
|
+
: emit(closeLine({ state: { ...state, written: new Map() }, text: "" }), "-- resynchronized --\n");
|
|
143
|
+
return start;
|
|
144
|
+
};
|
|
145
|
+
export const initialAttachRenderState = (view) => ({ lineOpen: false, view, written: new Map() });
|
|
146
|
+
export const renderSessionAttachFrame = (state, frame) => {
|
|
147
|
+
const rendered = renderFrameText(state, frame);
|
|
148
|
+
return {
|
|
149
|
+
state: { ...rendered.state, view: reduceSessionAttach(state.view, frame) },
|
|
150
|
+
text: rendered.text,
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
export const finishSessionAttachRender = (state) => state.lineOpen ? "\n" : "";
|
|
154
|
+
//# sourceMappingURL=attach-render.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type CommandContext, type CommandEffect } from "../command-line/index.js";
|
|
2
|
+
import type { AttachSessionInput } from "./attach-client.js";
|
|
3
|
+
export declare const readAttachCursor: (value: string | undefined) => AttachSessionInput["after"];
|
|
4
|
+
export declare const runSessionAttach: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
5
|
+
//# sourceMappingURL=attach.d.ts.map
|