@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,178 @@
|
|
|
1
|
+
import type { AgentPermissionConfirmParameters, AgentPermissionConfirmResult, AgentPermissionPreviewParameters, AgentPermissionPreviewResult, ExecutionCatalogGetResult, ExecutionCommandRunResult, ExecutionFileReadResult, ExecutionPlacementCreateResult, ExecutionPlacementShowResult, ExecutionRelocationApplyResult, ExecutionRelocationPlanResult, ExecutionRelocationReconcileResult, ExecutionRelocationShowResult, ExecutionWorktreeCheckpointCreateResult, ExecutionWorktreeCheckpointShowResult, ExecutionWorktreeCreateResult, ExecutionWorktreeImportResult, ExecutionWorktreeReconcileResult, ExecutionWorktreeRemoveApplyResult, ExecutionWorktreeRemovePlanResult, ExecutionWorktreeStatusResult, InvocationContextShowResult, LiveTerminalCloseResult, LiveTerminalControllerAcquireResult, LiveTerminalControllerReleaseResult, LiveTerminalControllerRequestResult, LiveTerminalControllerRequestShowResult, LiveTerminalResizeResult, LiveTerminalSignalResult, LiveTerminalWriteResult, LocalNodeStatusResult, MonitorBootstrapCreateResult, OrchestrationDispatchSettleTerminalResult, OrchestrationDispatchShowResult, OrchestrationInboxAckResult, OrchestrationInboxCheckResult, OrchestrationQuestionCancelResult, OrchestrationQuestionOpenResult, OrchestrationQuestionReplyResult, OrchestrationRunCreateResult, OrchestrationRunListResult, OrchestrationRunShowResult, OrchestrationTaskListResult, OrchestrationTaskShowResult, ProjectContextListResult, ProjectContextRecordResult, ProjectContextShowResult, ProjectListResult, ProjectRegisterResult, ProjectShowResult, ProviderPoolListResult, ReceiptGetResult, ReceiptListParameters, ReceiptListResult, SessionArchiveResult, SessionCreateResult, SessionDiffResult, SessionEventsListResult, SessionInboxAckResult, SessionInboxCheckResult, SessionListResult, SessionMessageSendResult, SessionObserveResult, SessionResumeResult, SessionShowResult, SessionStartResult, SessionStopResult, TerminalCreateResult, TerminalEventsListResult, TerminalListResult, TerminalReadResult, TerminalShowResult, TurnInterruptResult, TurnSendResult, TurnShowResult, TurnWaitResult, WorkspaceContextShowResult, WorkspaceExecutionConfigureResult, WorkspaceExecutionShowResult, WorkspaceListResult, WorkspaceMembershipAttachResult, WorkspaceRepositoryAttachResult, WorkspaceSelectResult, WorkspaceShowResult } from "@maiaos/sdk";
|
|
2
|
+
import type * as Crypto from "effect/Crypto";
|
|
3
|
+
import type * as Effect from "effect/Effect";
|
|
4
|
+
import type { ConnectionCliDependencies, VendorLogin } from "../connection/index.js";
|
|
5
|
+
import type { ContainerCliDependencies } from "../container/index.js";
|
|
6
|
+
import type { ApplyExecutionRelocationInput, PlanExecutionRelocationInput, ReconcileExecutionRelocationInput } from "../execution/index.js";
|
|
7
|
+
import type { HoldCliDependencies } from "../hold/index.js";
|
|
8
|
+
import type { DiscoveryCliDependencies } from "../import/index.js";
|
|
9
|
+
import type { IntegrationCliDependencies } from "../integration/index.js";
|
|
10
|
+
import type { CliNodeCall, CliNodeEffect } from "../local-node/index.js";
|
|
11
|
+
import type { AgentProviderAccess } from "../login/index.js";
|
|
12
|
+
import type { McpCliDependencies } from "../mcp/index.js";
|
|
13
|
+
import type { makeOrchestrationClient } from "../orchestration/index.js";
|
|
14
|
+
import type { PortLeaseCliDependencies } from "../port-lease/index.js";
|
|
15
|
+
import type { PresentationCliDependencies } from "../presentation/index.js";
|
|
16
|
+
import type { ProjectGuardCliDependencies } from "../project-guard/index.js";
|
|
17
|
+
import type { AttachRepositoryInput, AttachWorkspaceMembershipInput, ConfigureWorkspaceExecutionInput, CreateExecutionCheckpointInput, CreateExecutionPlacementInput, CreateExecutionWorktreeInput, ImportExecutionWorktreeInput, ProjectMetadataCliDependencies, ReadExecutionFileInput, ReconcileExecutionWorktreeInput, RecordProjectContextInput, RegisterProjectInput, RemoveExecutionWorktreeInput, RunExecutionCommandInput, SelectWorkspaceInput } from "../project-workspace/index.js";
|
|
18
|
+
import type { RemoteNodeCliDependencies } from "../remote-node/index.js";
|
|
19
|
+
import type { RunLedgerCliDependencies } from "../run-ledger/index.js";
|
|
20
|
+
import type { ApprovalCliDependencies } from "../session/approval/index.js";
|
|
21
|
+
import type { ArchiveSessionInput, AttachSessionInput, CreateSessionInput, DiffSessionInput, ListSessionsInput, makeSessionClient, SessionAttachStream, StartSessionInput } from "../session/index.js";
|
|
22
|
+
import type { InteractionCliDependencies } from "../session/interaction/index.js";
|
|
23
|
+
import type { InterruptTurnInput, SendTurnInput, WaitTurnsInput } from "../session/turn/index.js";
|
|
24
|
+
import type { CreateTerminalInput, makeTerminalClient } from "../terminal/index.js";
|
|
25
|
+
import type { CliArgumentError } from "./input/index.js";
|
|
26
|
+
import type { CliIo, CliResolution } from "./output.js";
|
|
27
|
+
type OrchestrationClient = ReturnType<typeof makeOrchestrationClient>;
|
|
28
|
+
type SessionClient = ReturnType<typeof makeSessionClient>;
|
|
29
|
+
type TerminalClient = ReturnType<typeof makeTerminalClient>;
|
|
30
|
+
export type CliDependencies = Partial<ApprovalCliDependencies & ConnectionCliDependencies & ContainerCliDependencies & HoldCliDependencies & DiscoveryCliDependencies & IntegrationCliDependencies & PresentationCliDependencies & McpCliDependencies & InteractionCliDependencies & PortLeaseCliDependencies & ProjectGuardCliDependencies & ProjectMetadataCliDependencies & RemoteNodeCliDependencies & RunLedgerCliDependencies> & {
|
|
31
|
+
readonly acknowledgeAttachedSessionDelivery?: (input: Parameters<SessionClient["acknowledgeAttachedSessionDelivery"]>[0]) => CliNodeEffect<SessionInboxAckResult>;
|
|
32
|
+
readonly acknowledgeRunDelivery: (input: Parameters<OrchestrationClient["acknowledgeRunDelivery"]>[0]) => CliNodeEffect<OrchestrationInboxAckResult>;
|
|
33
|
+
readonly acquireTerminalController: (input: Parameters<TerminalClient["acquireTerminalController"]>[0]) => CliNodeEffect<LiveTerminalControllerAcquireResult>;
|
|
34
|
+
readonly agentProviders?: AgentProviderAccess;
|
|
35
|
+
readonly applyExecutionRelocation?: (input: ApplyExecutionRelocationInput) => CliNodeEffect<ExecutionRelocationApplyResult>;
|
|
36
|
+
readonly archiveSession?: (input: ArchiveSessionInput) => CliNodeEffect<SessionArchiveResult>;
|
|
37
|
+
readonly attachSession?: (input: AttachSessionInput) => CliNodeEffect<SessionAttachStream>;
|
|
38
|
+
readonly attachWorkspaceMembership?: (input: AttachWorkspaceMembershipInput) => CliNodeEffect<WorkspaceMembershipAttachResult>;
|
|
39
|
+
readonly attachWorkspaceRepository: (input: AttachRepositoryInput) => CliNodeEffect<WorkspaceRepositoryAttachResult>;
|
|
40
|
+
readonly awaitSessionRunning?: SessionClient["awaitSessionRunning"];
|
|
41
|
+
readonly call?: CliNodeCall;
|
|
42
|
+
readonly cancelRunQuestion: (input: Parameters<OrchestrationClient["cancelRunQuestion"]>[0]) => CliNodeEffect<OrchestrationQuestionCancelResult>;
|
|
43
|
+
readonly checkAttachedSessionInbox?: (input: Parameters<SessionClient["checkAttachedSessionInbox"]>[0]) => CliNodeEffect<SessionInboxCheckResult>;
|
|
44
|
+
readonly checkRunInbox: (input: Parameters<OrchestrationClient["checkRunInbox"]>[0]) => CliNodeEffect<OrchestrationInboxCheckResult>;
|
|
45
|
+
readonly closeTerminal: (input: Parameters<TerminalClient["closeTerminal"]>[0]) => CliNodeEffect<LiveTerminalCloseResult>;
|
|
46
|
+
readonly configureWorkspaceExecution?: (input: ConfigureWorkspaceExecutionInput) => CliNodeEffect<WorkspaceExecutionConfigureResult>;
|
|
47
|
+
readonly confirmAgentPermission?: (input: AgentPermissionConfirmParameters) => CliNodeEffect<AgentPermissionConfirmResult>;
|
|
48
|
+
readonly createExecutionCheckpoint?: (input: CreateExecutionCheckpointInput) => CliNodeEffect<ExecutionWorktreeCheckpointCreateResult>;
|
|
49
|
+
readonly createExecutionPlacement?: (input: CreateExecutionPlacementInput) => CliNodeEffect<ExecutionPlacementCreateResult>;
|
|
50
|
+
readonly createExecutionWorktree?: (input: CreateExecutionWorktreeInput) => CliNodeEffect<ExecutionWorktreeCreateResult>;
|
|
51
|
+
readonly createMonitorBootstrap?: () => CliNodeEffect<MonitorBootstrapCreateResult>;
|
|
52
|
+
readonly createRun: (input: Parameters<OrchestrationClient["createRun"]>[0]) => CliNodeEffect<OrchestrationRunCreateResult>;
|
|
53
|
+
readonly createSession: (input: CreateSessionInput) => CliNodeEffect<SessionCreateResult>;
|
|
54
|
+
readonly createTerminal: (input: CreateTerminalInput) => CliNodeEffect<TerminalCreateResult>;
|
|
55
|
+
readonly diffSession?: (input: DiffSessionInput) => CliNodeEffect<SessionDiffResult>;
|
|
56
|
+
readonly getReceipt: (commandId: string) => CliNodeEffect<ReceiptGetResult>;
|
|
57
|
+
readonly importExecutionWorktree?: (input: ImportExecutionWorktreeInput) => CliNodeEffect<ExecutionWorktreeImportResult>;
|
|
58
|
+
readonly interruptTurn: (input: InterruptTurnInput) => CliNodeEffect<TurnInterruptResult>;
|
|
59
|
+
readonly listProjectContext: (input: {
|
|
60
|
+
readonly afterCursor: string;
|
|
61
|
+
readonly limit: number;
|
|
62
|
+
readonly projectId: string;
|
|
63
|
+
}) => CliNodeEffect<ProjectContextListResult>;
|
|
64
|
+
readonly listProjects: (input: {
|
|
65
|
+
readonly afterCursor: string;
|
|
66
|
+
readonly limit: number;
|
|
67
|
+
}) => CliNodeEffect<ProjectListResult>;
|
|
68
|
+
readonly listProviderPools?: () => CliNodeEffect<ProviderPoolListResult>;
|
|
69
|
+
readonly listReceipts: (parameters: ReceiptListParameters) => CliNodeEffect<ReceiptListResult>;
|
|
70
|
+
readonly listRuns: (input: {
|
|
71
|
+
readonly afterCursor: string;
|
|
72
|
+
readonly limit: number;
|
|
73
|
+
readonly workspaceId: string;
|
|
74
|
+
}) => CliNodeEffect<OrchestrationRunListResult>;
|
|
75
|
+
readonly listSessionEvents: (input: {
|
|
76
|
+
readonly afterSessionCursor: string;
|
|
77
|
+
readonly limit: number;
|
|
78
|
+
readonly sessionId: string;
|
|
79
|
+
}) => CliNodeEffect<SessionEventsListResult>;
|
|
80
|
+
readonly listSessions: (input: ListSessionsInput) => CliNodeEffect<SessionListResult>;
|
|
81
|
+
readonly listTasks: (input: {
|
|
82
|
+
readonly afterCursor: string;
|
|
83
|
+
readonly limit: number;
|
|
84
|
+
readonly runId: string;
|
|
85
|
+
}) => CliNodeEffect<OrchestrationTaskListResult>;
|
|
86
|
+
readonly listTerminalEvents: (input: {
|
|
87
|
+
readonly afterTerminalCursor: string;
|
|
88
|
+
readonly limit: number;
|
|
89
|
+
readonly terminalId: string;
|
|
90
|
+
}) => CliNodeEffect<TerminalEventsListResult>;
|
|
91
|
+
readonly listTerminals: (input: {
|
|
92
|
+
readonly afterCursor: string;
|
|
93
|
+
readonly limit: number;
|
|
94
|
+
readonly workspaceId: string;
|
|
95
|
+
}) => CliNodeEffect<TerminalListResult>;
|
|
96
|
+
readonly listWorkspaces: (input: {
|
|
97
|
+
readonly afterCursor: string;
|
|
98
|
+
readonly limit: number;
|
|
99
|
+
readonly projectId: string;
|
|
100
|
+
}) => CliNodeEffect<WorkspaceListResult>;
|
|
101
|
+
readonly observeSessions?: (input: {
|
|
102
|
+
readonly sessionIds?: readonly string[];
|
|
103
|
+
readonly stallAfterSeconds?: number;
|
|
104
|
+
}) => CliNodeEffect<SessionObserveResult>;
|
|
105
|
+
readonly openRunQuestion: (input: Parameters<OrchestrationClient["openRunQuestion"]>[0]) => CliNodeEffect<OrchestrationQuestionOpenResult>;
|
|
106
|
+
readonly planExecutionRelocation?: (input: PlanExecutionRelocationInput) => CliNodeEffect<ExecutionRelocationPlanResult>;
|
|
107
|
+
readonly planExecutionWorktreeRemove?: (workspaceId: string) => CliNodeEffect<ExecutionWorktreeRemovePlanResult>;
|
|
108
|
+
readonly planSessions?: SessionClient["planSessions"];
|
|
109
|
+
readonly previewAgentPermission?: (input: AgentPermissionPreviewParameters) => CliNodeEffect<AgentPermissionPreviewResult>;
|
|
110
|
+
readonly readExecutionCatalog?: () => CliNodeEffect<ExecutionCatalogGetResult>;
|
|
111
|
+
readonly readExecutionFile?: (input: ReadExecutionFileInput) => CliNodeEffect<ExecutionFileReadResult>;
|
|
112
|
+
readonly readStatus: () => Effect.Effect<LocalNodeStatusResult, unknown, Crypto.Crypto>;
|
|
113
|
+
readonly readTerminal: (input: {
|
|
114
|
+
readonly afterChunkCursor: string;
|
|
115
|
+
readonly limit: number;
|
|
116
|
+
readonly terminalId: string;
|
|
117
|
+
}) => CliNodeEffect<TerminalReadResult>;
|
|
118
|
+
readonly reconcileExecutionRelocation?: (input: ReconcileExecutionRelocationInput) => CliNodeEffect<ExecutionRelocationReconcileResult>;
|
|
119
|
+
readonly reconcileExecutionWorktree?: (input: ReconcileExecutionWorktreeInput) => CliNodeEffect<ExecutionWorktreeReconcileResult>;
|
|
120
|
+
readonly recordProjectContext: (input: RecordProjectContextInput) => CliNodeEffect<ProjectContextRecordResult>;
|
|
121
|
+
readonly registerProject: (input: RegisterProjectInput) => CliNodeEffect<ProjectRegisterResult>;
|
|
122
|
+
readonly releaseTerminalController: (input: Parameters<TerminalClient["releaseTerminalController"]>[0]) => CliNodeEffect<LiveTerminalControllerReleaseResult>;
|
|
123
|
+
readonly removeExecutionWorktree?: (input: RemoveExecutionWorktreeInput) => CliNodeEffect<ExecutionWorktreeRemoveApplyResult>;
|
|
124
|
+
readonly replyRunQuestion: (input: Parameters<OrchestrationClient["replyRunQuestion"]>[0]) => CliNodeEffect<OrchestrationQuestionReplyResult>;
|
|
125
|
+
readonly requestTerminalController: (input: Parameters<TerminalClient["requestTerminalController"]>[0]) => CliNodeEffect<LiveTerminalControllerRequestResult>;
|
|
126
|
+
readonly resizeTerminal: (input: Parameters<TerminalClient["resizeTerminal"]>[0]) => CliNodeEffect<LiveTerminalResizeResult>;
|
|
127
|
+
readonly resumeSession?: (input: StartSessionInput) => CliNodeEffect<SessionResumeResult>;
|
|
128
|
+
readonly runAgent?: (arguments_: readonly string[], io: CliIo) => Effect.Effect<number, unknown>;
|
|
129
|
+
readonly runExecutionCommand?: (input: RunExecutionCommandInput) => CliNodeEffect<ExecutionCommandRunResult>;
|
|
130
|
+
readonly runSessions?: SessionClient["runSessions"];
|
|
131
|
+
readonly runVendorLogin?: VendorLogin;
|
|
132
|
+
readonly selectWorkspace?: (input: SelectWorkspaceInput) => CliNodeEffect<WorkspaceSelectResult>;
|
|
133
|
+
readonly sendAttachedSessionMessage?: (input: Parameters<SessionClient["sendAttachedSessionMessage"]>[0]) => CliNodeEffect<SessionMessageSendResult>;
|
|
134
|
+
readonly sendTurn: (input: SendTurnInput) => CliNodeEffect<TurnSendResult>;
|
|
135
|
+
readonly settleRunDispatchTerminal: (input: Parameters<OrchestrationClient["settleRunDispatchTerminal"]>[0]) => CliNodeEffect<OrchestrationDispatchSettleTerminalResult>;
|
|
136
|
+
readonly showAttachedCurrentContext?: () => CliNodeEffect<InvocationContextShowResult>;
|
|
137
|
+
readonly showCurrentContext: () => CliNodeEffect<InvocationContextShowResult>;
|
|
138
|
+
readonly showDispatch: (runId: string) => CliNodeEffect<OrchestrationDispatchShowResult>;
|
|
139
|
+
readonly showExecutionCheckpoint?: (checkpointId: string) => CliNodeEffect<ExecutionWorktreeCheckpointShowResult>;
|
|
140
|
+
readonly showExecutionPlacement?: (input: {
|
|
141
|
+
readonly kind: "attempt" | "session";
|
|
142
|
+
readonly ownerId: string;
|
|
143
|
+
}) => CliNodeEffect<ExecutionPlacementShowResult>;
|
|
144
|
+
readonly showExecutionRelocation?: (relocationId: string) => CliNodeEffect<ExecutionRelocationShowResult>;
|
|
145
|
+
readonly showExecutionWorktreeStatus?: (workspaceId: string) => CliNodeEffect<ExecutionWorktreeStatusResult>;
|
|
146
|
+
readonly showProject: (projectId: string) => CliNodeEffect<ProjectShowResult>;
|
|
147
|
+
readonly showProjectContext: (noteId: string) => CliNodeEffect<ProjectContextShowResult>;
|
|
148
|
+
readonly showRun: (runId: string) => CliNodeEffect<OrchestrationRunShowResult>;
|
|
149
|
+
readonly showSession: (sessionId: string) => CliNodeEffect<SessionShowResult>;
|
|
150
|
+
readonly showTask: (input: {
|
|
151
|
+
readonly runId: string;
|
|
152
|
+
readonly taskId: string;
|
|
153
|
+
}) => CliNodeEffect<OrchestrationTaskShowResult>;
|
|
154
|
+
readonly showTerminal: (terminalId: string) => CliNodeEffect<TerminalShowResult>;
|
|
155
|
+
readonly showTerminalControllerRequest: (input: Parameters<TerminalClient["showTerminalControllerRequest"]>[0]) => CliNodeEffect<LiveTerminalControllerRequestShowResult>;
|
|
156
|
+
readonly showTurn: (turnId: string) => CliNodeEffect<TurnShowResult>;
|
|
157
|
+
readonly showWorkspace: (workspaceId: string) => CliNodeEffect<WorkspaceShowResult>;
|
|
158
|
+
readonly showWorkspaceContext?: () => CliNodeEffect<WorkspaceContextShowResult>;
|
|
159
|
+
readonly showWorkspaceExecution?: (workspaceId: string) => CliNodeEffect<WorkspaceExecutionShowResult>;
|
|
160
|
+
readonly signalTerminal: (input: Parameters<TerminalClient["signalTerminal"]>[0]) => CliNodeEffect<LiveTerminalSignalResult>;
|
|
161
|
+
readonly startSession: (input: StartSessionInput) => CliNodeEffect<SessionStartResult>;
|
|
162
|
+
readonly stopSession?: (input: StartSessionInput) => CliNodeEffect<SessionStopResult>;
|
|
163
|
+
readonly waitTurns?: (input: WaitTurnsInput) => CliNodeEffect<TurnWaitResult>;
|
|
164
|
+
readonly writeTerminalInput: (input: Parameters<TerminalClient["writeTerminalInput"]>[0]) => CliNodeEffect<LiveTerminalWriteResult>;
|
|
165
|
+
};
|
|
166
|
+
export type CliServices = Crypto.Crypto;
|
|
167
|
+
export type CommandEffect = Effect.Effect<number, CliArgumentError, CliServices>;
|
|
168
|
+
export type CommandContext = {
|
|
169
|
+
readonly dependencies: CliDependencies;
|
|
170
|
+
readonly io: CliIo;
|
|
171
|
+
readonly json: boolean;
|
|
172
|
+
readonly node?: string;
|
|
173
|
+
readonly profile?: string;
|
|
174
|
+
readonly resolved?: readonly CliResolution[];
|
|
175
|
+
readonly version: string;
|
|
176
|
+
};
|
|
177
|
+
export {};
|
|
178
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { type CliDependencies, type CliServices, type CommandContext, type CommandEffect, } from "./context.js";
|
|
2
|
+
export { argumentsAreBounded, type ArgumentToken, CliArgumentError, missingArgument, parseArguments, type ParsedArguments, type ParsedOptions, parseOptions, readBoundedStdin, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, recoverStdin, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./input/index.js";
|
|
3
|
+
export { decodeJsonText } from "./json.js";
|
|
4
|
+
export { type CliCommandOutput, type CliErrorOutput, type CliIo, type CliResolution, type CliSuccessOutput, type CliSuccessResult, type NodeResultPresenter, reportError, writeNodeResult, writeSuccess, } from "./output.js";
|
|
5
|
+
export { cell, formatRows, tab, withNextPage } from "./rows.js";
|
|
6
|
+
export { askToConfirm, canPrompt, confirmationOf, confirmParameters, EXIT_CANCELLED, promptOrRefuse, readPipedPreview, readTwoPhaseMode, requestedTwoPhaseMode, runInputTwoPhase, runTwoPhase, TWO_PHASE_FLAGS, type TwoPhaseMode, } from "./two-phase.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { argumentsAreBounded, CliArgumentError, missingArgument, parseArguments, parseOptions, readBoundedStdin, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, recoverStdin, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./input/index.js";
|
|
2
|
+
export { decodeJsonText } from "./json.js";
|
|
3
|
+
export { reportError, writeNodeResult, writeSuccess, } from "./output.js";
|
|
4
|
+
export { cell, formatRows, tab, withNextPage } from "./rows.js";
|
|
5
|
+
export { askToConfirm, canPrompt, confirmationOf, confirmParameters, EXIT_CANCELLED, promptOrRefuse, readPipedPreview, readTwoPhaseMode, requestedTwoPhaseMode, runInputTwoPhase, runTwoPhase, TWO_PHASE_FLAGS, } from "./two-phase.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type ParsedArguments = {
|
|
2
|
+
readonly help: boolean;
|
|
3
|
+
readonly json: boolean;
|
|
4
|
+
readonly jsonFlagCount: number;
|
|
5
|
+
readonly node?: string;
|
|
6
|
+
readonly noInput: boolean;
|
|
7
|
+
readonly profile?: string;
|
|
8
|
+
readonly tokens: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
export type ParsedOptions = {
|
|
11
|
+
readonly flags: ReadonlySet<string>;
|
|
12
|
+
readonly options: ReadonlyMap<string, string>;
|
|
13
|
+
readonly positionals: readonly string[];
|
|
14
|
+
};
|
|
15
|
+
declare const CliArgumentError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
16
|
+
readonly _tag: "CliArgumentError";
|
|
17
|
+
} & Readonly<A>;
|
|
18
|
+
export declare class CliArgumentError extends CliArgumentError_base<{
|
|
19
|
+
readonly message: string;
|
|
20
|
+
}> {
|
|
21
|
+
constructor(message: string);
|
|
22
|
+
}
|
|
23
|
+
export declare const argumentsAreBounded: (arguments_: readonly string[]) => boolean;
|
|
24
|
+
type ValueOption = "--node" | "--profile";
|
|
25
|
+
export declare const readGlobalValue: (option: ValueOption, value: string | undefined) => string;
|
|
26
|
+
export declare const parseArguments: (arguments_: readonly string[]) => ParsedArguments;
|
|
27
|
+
export declare const parseOptions: (tokens: readonly string[], allowed: ReadonlySet<string>, allowedFlags?: ReadonlySet<string>) => ParsedOptions;
|
|
28
|
+
export declare const requirePositionals: (positionals: readonly string[], count: number) => void;
|
|
29
|
+
export declare const missingArgument: () => CliArgumentError;
|
|
30
|
+
export declare const unknownCommand: () => CliArgumentError;
|
|
31
|
+
export declare const requireNoArguments: (tokens: readonly string[], command: string) => void;
|
|
32
|
+
export declare const readPageSize: (value: string | undefined, maximum?: number) => number;
|
|
33
|
+
export declare const readCursor: (value?: string) => string;
|
|
34
|
+
export declare const readRevisionOption: (value: string | undefined, option: `--${string}`) => string;
|
|
35
|
+
export declare const readExpectedRevision: (value: string | undefined) => string;
|
|
36
|
+
export declare const readDuration: (value: string, option: `--${string}`, range: {
|
|
37
|
+
readonly max: number;
|
|
38
|
+
readonly min: number;
|
|
39
|
+
}) => number;
|
|
40
|
+
export type ArgumentToken = {
|
|
41
|
+
readonly index: number;
|
|
42
|
+
readonly inline: boolean;
|
|
43
|
+
readonly kind: "value";
|
|
44
|
+
readonly name: string;
|
|
45
|
+
} | {
|
|
46
|
+
readonly index: number;
|
|
47
|
+
readonly kind: "flag";
|
|
48
|
+
readonly name: string;
|
|
49
|
+
} | {
|
|
50
|
+
readonly index: number;
|
|
51
|
+
readonly kind: "positional";
|
|
52
|
+
};
|
|
53
|
+
export declare const tokenizeArguments: (tokens: readonly string[], valueOptions: ReadonlySet<string>) => readonly ArgumentToken[];
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=arguments.d.ts.map
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
import * as Data from "effect/Data";
|
|
3
|
+
const MAX_ARGUMENT_BYTES = 16 * 1024;
|
|
4
|
+
const MAX_ARGUMENT_COUNT = 32;
|
|
5
|
+
const MAX_TOKEN_BYTES = 4096;
|
|
6
|
+
const MAX_SIGNED_INT_64 = 9223372036854775807n;
|
|
7
|
+
const DEFAULT_PAGE_SIZE = 20;
|
|
8
|
+
export class CliArgumentError extends Data.TaggedError("CliArgumentError") {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super({ message });
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export const argumentsAreBounded = (arguments_) => arguments_.length <= MAX_ARGUMENT_COUNT &&
|
|
14
|
+
arguments_.every((argument) => Buffer.byteLength(argument, "utf8") <= MAX_TOKEN_BYTES) &&
|
|
15
|
+
arguments_.reduce((total, argument) => total + Buffer.byteLength(argument, "utf8"), 0) <= MAX_ARGUMENT_BYTES;
|
|
16
|
+
const PROFILE_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u;
|
|
17
|
+
const NODE_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}$/u;
|
|
18
|
+
const GLOBAL_FLAGS = new Set([
|
|
19
|
+
"--help",
|
|
20
|
+
"--json",
|
|
21
|
+
"--no-input",
|
|
22
|
+
"-h",
|
|
23
|
+
]);
|
|
24
|
+
export const readGlobalValue = (option, value) => {
|
|
25
|
+
if (value === undefined || value.startsWith("-"))
|
|
26
|
+
throw new CliArgumentError(`Option '${option}' requires a value.`);
|
|
27
|
+
if (!(option === "--node" ? NODE_PATTERN : PROFILE_PATTERN).test(value))
|
|
28
|
+
throw new CliArgumentError(`Option '${option}' is invalid.`);
|
|
29
|
+
return value;
|
|
30
|
+
};
|
|
31
|
+
const scanToken = (scan, tokens, index) => {
|
|
32
|
+
const token = tokens[index] ?? "";
|
|
33
|
+
if (GLOBAL_FLAGS.has(token)) {
|
|
34
|
+
scan.flags.set(token, (scan.flags.get(token) ?? 0) + 1);
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
if (token === "--node" || token === "--profile") {
|
|
38
|
+
if (scan.values.has(token))
|
|
39
|
+
throw new CliArgumentError(`Option '${token}' may be used only once.`);
|
|
40
|
+
scan.values.set(token, readGlobalValue(token, tokens[index + 1]));
|
|
41
|
+
return 2;
|
|
42
|
+
}
|
|
43
|
+
scan.tokens.push(token);
|
|
44
|
+
return 1;
|
|
45
|
+
};
|
|
46
|
+
const scanFrom = (scan, tokens, index) => {
|
|
47
|
+
if (index >= tokens.length)
|
|
48
|
+
return;
|
|
49
|
+
scanFrom(scan, tokens, index + scanToken(scan, tokens, index));
|
|
50
|
+
};
|
|
51
|
+
const agentArguments = (arguments_) => ({
|
|
52
|
+
help: false,
|
|
53
|
+
json: false,
|
|
54
|
+
jsonFlagCount: 0,
|
|
55
|
+
noInput: false,
|
|
56
|
+
tokens: arguments_,
|
|
57
|
+
});
|
|
58
|
+
export const parseArguments = (arguments_) => {
|
|
59
|
+
if (arguments_[0] === "agent")
|
|
60
|
+
return agentArguments(arguments_);
|
|
61
|
+
const end = arguments_.indexOf("--");
|
|
62
|
+
const head = end === -1 ? arguments_ : arguments_.slice(0, end);
|
|
63
|
+
const scan = { flags: new Map(), tokens: [], values: new Map() };
|
|
64
|
+
scanFrom(scan, head, 0);
|
|
65
|
+
if ((scan.flags.get("--no-input") ?? 0) > 1)
|
|
66
|
+
throw new CliArgumentError("Option '--no-input' may be used only once.");
|
|
67
|
+
const node = scan.values.get("--node");
|
|
68
|
+
const profile = scan.values.get("--profile");
|
|
69
|
+
const jsonFlagCount = scan.flags.get("--json") ?? 0;
|
|
70
|
+
return {
|
|
71
|
+
help: scan.flags.has("-h") || scan.flags.has("--help"),
|
|
72
|
+
json: jsonFlagCount > 0,
|
|
73
|
+
jsonFlagCount,
|
|
74
|
+
noInput: scan.flags.has("--no-input"),
|
|
75
|
+
...(node === undefined ? {} : { node }),
|
|
76
|
+
...(profile === undefined ? {} : { profile }),
|
|
77
|
+
tokens: [...scan.tokens, ...(end === -1 ? [] : arguments_.slice(end))],
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
const parseOptionToken = (state, token) => {
|
|
81
|
+
if (state.pendingOption !== undefined) {
|
|
82
|
+
if (token.startsWith("--")) {
|
|
83
|
+
throw new CliArgumentError(`Option '${state.pendingOption}' requires a value.`);
|
|
84
|
+
}
|
|
85
|
+
state.options.set(state.pendingOption, token);
|
|
86
|
+
delete state.pendingOption;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (!token.startsWith("--")) {
|
|
90
|
+
state.positionals.push(token);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (state.allowedFlags.has(token)) {
|
|
94
|
+
if (state.flags.has(token)) {
|
|
95
|
+
throw new CliArgumentError(`Option '${token}' may be used only once.`);
|
|
96
|
+
}
|
|
97
|
+
state.flags.add(token);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (!state.allowed.has(token)) {
|
|
101
|
+
throw new CliArgumentError("The command contains an unknown option.");
|
|
102
|
+
}
|
|
103
|
+
if (state.options.has(token)) {
|
|
104
|
+
throw new CliArgumentError(`Option '${token}' may be used only once.`);
|
|
105
|
+
}
|
|
106
|
+
state.pendingOption = token;
|
|
107
|
+
};
|
|
108
|
+
const splitInlineValue = (token, allowed) => {
|
|
109
|
+
const separator = token.indexOf("=");
|
|
110
|
+
if (!token.startsWith("--") || separator === -1)
|
|
111
|
+
return [token];
|
|
112
|
+
const name = token.slice(0, separator);
|
|
113
|
+
return allowed.has(name) ? [name, token.slice(separator + 1)] : [token];
|
|
114
|
+
};
|
|
115
|
+
export const parseOptions = (tokens, allowed, allowedFlags = new Set()) => {
|
|
116
|
+
const state = {
|
|
117
|
+
allowed,
|
|
118
|
+
allowedFlags,
|
|
119
|
+
flags: new Set(),
|
|
120
|
+
options: new Map(),
|
|
121
|
+
positionals: [],
|
|
122
|
+
};
|
|
123
|
+
tokens
|
|
124
|
+
.flatMap((token) => splitInlineValue(token, allowed))
|
|
125
|
+
.forEach((token) => {
|
|
126
|
+
parseOptionToken(state, token);
|
|
127
|
+
});
|
|
128
|
+
if (state.pendingOption !== undefined) {
|
|
129
|
+
throw new CliArgumentError(`Option '${state.pendingOption}' requires a value.`);
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
flags: state.flags,
|
|
133
|
+
options: state.options,
|
|
134
|
+
positionals: state.positionals,
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
export const requirePositionals = (positionals, count) => {
|
|
138
|
+
if (positionals.length === count)
|
|
139
|
+
return;
|
|
140
|
+
throw new CliArgumentError(count === 0
|
|
141
|
+
? "The command takes no positional arguments."
|
|
142
|
+
: `The command takes ${String(count)} positional argument${count === 1 ? "" : "s"}.`);
|
|
143
|
+
};
|
|
144
|
+
export const missingArgument = () => new CliArgumentError("A required argument is missing.");
|
|
145
|
+
export const unknownCommand = () => new CliArgumentError("The command is missing or unknown.");
|
|
146
|
+
export const requireNoArguments = (tokens, command) => {
|
|
147
|
+
if (tokens.length > 0) {
|
|
148
|
+
throw new CliArgumentError(`${command} does not accept additional arguments.`);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
export const readPageSize = (value, maximum = 100) => {
|
|
152
|
+
if (value === undefined)
|
|
153
|
+
return DEFAULT_PAGE_SIZE;
|
|
154
|
+
const size = /^[1-9]\d{0,2}$/u.test(value) ? Number(value) : 0;
|
|
155
|
+
if (size < 1 || size > maximum) {
|
|
156
|
+
throw new CliArgumentError(`Option '--limit' must be an integer from 1 to ${String(maximum)}.`);
|
|
157
|
+
}
|
|
158
|
+
return size;
|
|
159
|
+
};
|
|
160
|
+
const readInt64 = (value, errorMessage) => {
|
|
161
|
+
if (!/^(?:0|[1-9]\d*)$/u.test(value) || BigInt(value) > MAX_SIGNED_INT_64) {
|
|
162
|
+
throw new CliArgumentError(errorMessage);
|
|
163
|
+
}
|
|
164
|
+
return value;
|
|
165
|
+
};
|
|
166
|
+
export const readCursor = (value = "0") => readInt64(value, "Option '--after' must be a non-negative signed 64-bit integer cursor.");
|
|
167
|
+
export const readRevisionOption = (value, option) => {
|
|
168
|
+
if (value === undefined) {
|
|
169
|
+
throw new CliArgumentError(`Option '${option}' is required.`);
|
|
170
|
+
}
|
|
171
|
+
return readInt64(value, `Option '${option}' must be a non-negative signed 64-bit integer.`);
|
|
172
|
+
};
|
|
173
|
+
export const readExpectedRevision = (value) => readRevisionOption(value, "--expected-revision");
|
|
174
|
+
const DURATION = /^([1-9]\d{0,5})(s|m|h)$/u;
|
|
175
|
+
const unitSeconds = (unit) => {
|
|
176
|
+
if (unit === "h")
|
|
177
|
+
return 3600;
|
|
178
|
+
return unit === "m" ? 60 : 1;
|
|
179
|
+
};
|
|
180
|
+
const describeSeconds = (seconds) => {
|
|
181
|
+
if (seconds % 3600 === 0)
|
|
182
|
+
return `${String(seconds / 3600)}h`;
|
|
183
|
+
return seconds % 60 === 0
|
|
184
|
+
? `${String(seconds / 60)}m`
|
|
185
|
+
: `${String(seconds)}s`;
|
|
186
|
+
};
|
|
187
|
+
export const readDuration = (value, option, range) => {
|
|
188
|
+
const match = DURATION.exec(value);
|
|
189
|
+
const seconds = match === null ? 0 : Number(match[1]) * unitSeconds(match[2]);
|
|
190
|
+
if (seconds < range.min || seconds > range.max)
|
|
191
|
+
throw new CliArgumentError(`Option '${option}' must be a duration from ${describeSeconds(range.min)} to ${describeSeconds(range.max)}, such as 30s, 10m or 1h.`);
|
|
192
|
+
return seconds;
|
|
193
|
+
};
|
|
194
|
+
const tokenRole = (token, index, valueOptions) => {
|
|
195
|
+
if (!token.startsWith("--"))
|
|
196
|
+
return { index, kind: "positional" };
|
|
197
|
+
const [name = token, ...value] = splitInlineValue(token, valueOptions);
|
|
198
|
+
if (value.length > 0)
|
|
199
|
+
return { index, inline: true, kind: "value", name };
|
|
200
|
+
return valueOptions.has(name)
|
|
201
|
+
? { pending: name }
|
|
202
|
+
: { index, kind: "flag", name };
|
|
203
|
+
};
|
|
204
|
+
export const tokenizeArguments = (tokens, valueOptions) => {
|
|
205
|
+
const end = tokens.indexOf("--");
|
|
206
|
+
return tokens.slice(0, end === -1 ? tokens.length : end).reduce(({ pending, roles }, token, index) => {
|
|
207
|
+
if (pending !== undefined)
|
|
208
|
+
return {
|
|
209
|
+
roles: [
|
|
210
|
+
...roles,
|
|
211
|
+
{ index, inline: false, kind: "value", name: pending },
|
|
212
|
+
],
|
|
213
|
+
};
|
|
214
|
+
const role = tokenRole(token, index, valueOptions);
|
|
215
|
+
return "pending" in role
|
|
216
|
+
? { pending: role.pending, roles }
|
|
217
|
+
: { roles: [...roles, role] };
|
|
218
|
+
}, { roles: [] }).roles;
|
|
219
|
+
};
|
|
220
|
+
//# sourceMappingURL=arguments.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { argumentsAreBounded, type ArgumentToken, CliArgumentError, missingArgument, parseArguments, type ParsedArguments, type ParsedOptions, parseOptions, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./arguments.js";
|
|
2
|
+
export { promptLine, type PromptOptions, terminalIsInteractive, } from "./prompt.js";
|
|
3
|
+
export { type BoundedStdinRequest, readBoundedStdin, recoverStdin, } from "./stdin.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { argumentsAreBounded, CliArgumentError, missingArgument, parseArguments, parseOptions, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./arguments.js";
|
|
2
|
+
export { promptLine, terminalIsInteractive, } from "./prompt.js";
|
|
3
|
+
export { readBoundedStdin, recoverStdin, } from "./stdin.js";
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
export type PromptOptions = {
|
|
3
|
+
readonly secret?: boolean;
|
|
4
|
+
readonly signal?: AbortSignal;
|
|
5
|
+
};
|
|
6
|
+
export declare const promptLine: (question: string, options?: PromptOptions) => Effect.Effect<string | undefined>;
|
|
7
|
+
export declare const terminalIsInteractive: () => boolean;
|
|
8
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { createInterface } from "node:readline/promises";
|
|
3
|
+
import { Writable } from "node:stream";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
const promptStream = (state) => new Writable({
|
|
6
|
+
write: (chunk, _encoding, done) => {
|
|
7
|
+
if (!state.muted &&
|
|
8
|
+
(typeof chunk === "string" || chunk instanceof Uint8Array)) {
|
|
9
|
+
process.stderr.write(chunk);
|
|
10
|
+
}
|
|
11
|
+
done();
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
const openPrompt = Effect.sync(() => {
|
|
15
|
+
const state = { muted: false };
|
|
16
|
+
return {
|
|
17
|
+
lines: createInterface({
|
|
18
|
+
input: process.stdin,
|
|
19
|
+
output: promptStream(state),
|
|
20
|
+
terminal: true,
|
|
21
|
+
}),
|
|
22
|
+
state,
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
const ask = ({ lines, state }, question, options) => Effect.tryPromise({
|
|
26
|
+
catch: (error) => error,
|
|
27
|
+
try: (interrupted) => {
|
|
28
|
+
const pending = lines.question(question, {
|
|
29
|
+
signal: options.signal ?? interrupted,
|
|
30
|
+
});
|
|
31
|
+
state.muted = options.secret === true;
|
|
32
|
+
return pending;
|
|
33
|
+
},
|
|
34
|
+
}).pipe(Effect.map((answer) => {
|
|
35
|
+
if (state.muted)
|
|
36
|
+
process.stderr.write("\n");
|
|
37
|
+
return answer.trim();
|
|
38
|
+
}), Effect.catch(() => Effect.andThen(Effect.sync(() => process.stderr.write("\n")), Effect.undefined)));
|
|
39
|
+
export const promptLine = (question, options = {}) => Effect.acquireUseRelease(openPrompt, (session) => ask(session, question, options), ({ lines }) => Effect.sync(() => {
|
|
40
|
+
lines.close();
|
|
41
|
+
}));
|
|
42
|
+
const isTerminal = (stream) => stream.isTTY === true;
|
|
43
|
+
export const terminalIsInteractive = () => isTerminal(process.stdin) && isTerminal(process.stderr);
|
|
44
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type * as Effect from "effect/Effect";
|
|
2
|
+
import * as Stream from "effect/Stream";
|
|
3
|
+
export declare const foldStream: <TChunk, TState, TError>(input: Stream.Stream<TChunk, unknown>, initial: () => TState, step: (state: TState, chunk: TChunk) => Effect.Effect<TState, TError>) => Effect.Effect<TState, TError>;
|
|
4
|
+
//# sourceMappingURL=stdin-stream.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import type * as Stream from "effect/Stream";
|
|
3
|
+
import { CliArgumentError } from "./arguments.js";
|
|
4
|
+
export type BoundedStdinRequest = {
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly maxBytes: number;
|
|
7
|
+
readonly maxChunks: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const readBoundedStdin: (input: Stream.Stream<string | Uint8Array, unknown>, request: BoundedStdinRequest) => Effect.Effect<string, CliArgumentError>;
|
|
10
|
+
export declare const recoverStdin: <TError>(read: Effect.Effect<string, CliArgumentError>, recover: (error: unknown) => TError) => Effect.Effect<string, TError>;
|
|
11
|
+
//# sourceMappingURL=stdin.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
import * as Cause from "effect/Cause";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import { CliArgumentError } from "./arguments.js";
|
|
5
|
+
const collectChunk = (request, collected, chunk) => {
|
|
6
|
+
const buffer = Buffer.from(chunk);
|
|
7
|
+
const bytes = collected.bytes + buffer.byteLength;
|
|
8
|
+
if (bytes > request.maxBytes || collected.chunks.length >= request.maxChunks)
|
|
9
|
+
return Effect.fail(new CliArgumentError(`Standard input exceeds the bounded ${request.label} limit.`));
|
|
10
|
+
collected.bytes = bytes;
|
|
11
|
+
collected.chunks.push(buffer);
|
|
12
|
+
return Effect.succeed(collected);
|
|
13
|
+
};
|
|
14
|
+
const decodeUtf8 = (collected) => Effect.try({
|
|
15
|
+
catch: () => new CliArgumentError("Standard input must contain valid UTF-8."),
|
|
16
|
+
try: () => new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(collected.chunks, collected.bytes)),
|
|
17
|
+
});
|
|
18
|
+
const loadStreamFold = () => import("./stdin-stream.js");
|
|
19
|
+
export const readBoundedStdin = (input, request) => Effect.promise(loadStreamFold).pipe(Effect.flatMap(({ foldStream }) => foldStream(input, () => ({ bytes: 0, chunks: [] }), (collected, chunk) => collectChunk(request, collected, chunk))), Effect.flatMap(decodeUtf8));
|
|
20
|
+
export const recoverStdin = (read, recover) => read.pipe(Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause)
|
|
21
|
+
? Effect.interrupt
|
|
22
|
+
: Effect.fail(recover(Cause.squash(cause)))));
|
|
23
|
+
//# sourceMappingURL=stdin.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
const loadDecoder = () => import("./json-decoder.js");
|
|
3
|
+
export const decodeJsonText = (text, failure) => Effect.promise(loadDecoder).pipe(Effect.flatMap((decoder) => decoder.decodeJson(text)), Effect.mapError(failure));
|
|
4
|
+
//# sourceMappingURL=json.js.map
|