@tickernelz/paperclip-pro-adapter-utils 2026.925.0
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 +37 -0
- package/dist/acpx-engine/cli.d.ts +2 -0
- package/dist/acpx-engine/cli.d.ts.map +1 -0
- package/dist/acpx-engine/cli.js +128 -0
- package/dist/acpx-engine/cli.js.map +1 -0
- package/dist/acpx-engine/composed-run-characterization.test.d.ts +2 -0
- package/dist/acpx-engine/composed-run-characterization.test.d.ts.map +1 -0
- package/dist/acpx-engine/composed-run-characterization.test.js +739 -0
- package/dist/acpx-engine/composed-run-characterization.test.js.map +1 -0
- package/dist/acpx-engine/constants.d.ts +20 -0
- package/dist/acpx-engine/constants.d.ts.map +1 -0
- package/dist/acpx-engine/constants.js +37 -0
- package/dist/acpx-engine/constants.js.map +1 -0
- package/dist/acpx-engine/execute-identity.test.d.ts +2 -0
- package/dist/acpx-engine/execute-identity.test.d.ts.map +1 -0
- package/dist/acpx-engine/execute-identity.test.js +218 -0
- package/dist/acpx-engine/execute-identity.test.js.map +1 -0
- package/dist/acpx-engine/execute.d.ts +325 -0
- package/dist/acpx-engine/execute.d.ts.map +1 -0
- package/dist/acpx-engine/execute.js +4448 -0
- package/dist/acpx-engine/execute.js.map +1 -0
- package/dist/acpx-engine/execute.test.d.ts +2 -0
- package/dist/acpx-engine/execute.test.d.ts.map +1 -0
- package/dist/acpx-engine/execute.test.js +6694 -0
- package/dist/acpx-engine/execute.test.js.map +1 -0
- package/dist/acpx-engine/index.d.ts +6 -0
- package/dist/acpx-engine/index.d.ts.map +1 -0
- package/dist/acpx-engine/index.js +6 -0
- package/dist/acpx-engine/index.js.map +1 -0
- package/dist/acpx-engine/local-process-control.d.ts +5 -0
- package/dist/acpx-engine/local-process-control.d.ts.map +1 -0
- package/dist/acpx-engine/local-process-control.js +39 -0
- package/dist/acpx-engine/local-process-control.js.map +1 -0
- package/dist/acpx-engine/local-process-control.test.d.ts +2 -0
- package/dist/acpx-engine/local-process-control.test.d.ts.map +1 -0
- package/dist/acpx-engine/local-process-control.test.js +38 -0
- package/dist/acpx-engine/local-process-control.test.js.map +1 -0
- package/dist/acpx-engine/operator-stop.test.d.ts +2 -0
- package/dist/acpx-engine/operator-stop.test.d.ts.map +1 -0
- package/dist/acpx-engine/operator-stop.test.js +107 -0
- package/dist/acpx-engine/operator-stop.test.js.map +1 -0
- package/dist/acpx-engine/remote-spawn-smoke.test.d.ts +2 -0
- package/dist/acpx-engine/remote-spawn-smoke.test.d.ts.map +1 -0
- package/dist/acpx-engine/remote-spawn-smoke.test.js +151 -0
- package/dist/acpx-engine/remote-spawn-smoke.test.js.map +1 -0
- package/dist/acpx-engine/run-contracts.d.ts +413 -0
- package/dist/acpx-engine/run-contracts.d.ts.map +1 -0
- package/dist/acpx-engine/run-contracts.js +20 -0
- package/dist/acpx-engine/run-contracts.js.map +1 -0
- package/dist/acpx-engine/run-contracts.test.d.ts +2 -0
- package/dist/acpx-engine/run-contracts.test.d.ts.map +1 -0
- package/dist/acpx-engine/run-contracts.test.js +57 -0
- package/dist/acpx-engine/run-contracts.test.js.map +1 -0
- package/dist/acpx-engine/run-coordinator.d.ts +57 -0
- package/dist/acpx-engine/run-coordinator.d.ts.map +1 -0
- package/dist/acpx-engine/run-coordinator.js +63 -0
- package/dist/acpx-engine/run-coordinator.js.map +1 -0
- package/dist/acpx-engine/run-coordinator.test.d.ts +2 -0
- package/dist/acpx-engine/run-coordinator.test.d.ts.map +1 -0
- package/dist/acpx-engine/run-coordinator.test.js +160 -0
- package/dist/acpx-engine/run-coordinator.test.js.map +1 -0
- package/dist/acpx-engine/run-fault-matrix.test.d.ts +2 -0
- package/dist/acpx-engine/run-fault-matrix.test.d.ts.map +1 -0
- package/dist/acpx-engine/run-fault-matrix.test.js +829 -0
- package/dist/acpx-engine/run-fault-matrix.test.js.map +1 -0
- package/dist/acpx-engine/run-resource-ledger.d.ts +30 -0
- package/dist/acpx-engine/run-resource-ledger.d.ts.map +1 -0
- package/dist/acpx-engine/run-resource-ledger.js +148 -0
- package/dist/acpx-engine/run-resource-ledger.js.map +1 -0
- package/dist/acpx-engine/run-resource-ledger.test.d.ts +2 -0
- package/dist/acpx-engine/run-resource-ledger.test.d.ts.map +1 -0
- package/dist/acpx-engine/run-resource-ledger.test.js +154 -0
- package/dist/acpx-engine/run-resource-ledger.test.js.map +1 -0
- package/dist/acpx-engine/run-site-host.d.ts +73 -0
- package/dist/acpx-engine/run-site-host.d.ts.map +1 -0
- package/dist/acpx-engine/run-site-host.js +65 -0
- package/dist/acpx-engine/run-site-host.js.map +1 -0
- package/dist/acpx-engine/run-site-host.test.d.ts +2 -0
- package/dist/acpx-engine/run-site-host.test.d.ts.map +1 -0
- package/dist/acpx-engine/run-site-host.test.js +98 -0
- package/dist/acpx-engine/run-site-host.test.js.map +1 -0
- package/dist/acpx-engine/run-site-sandbox.d.ts +142 -0
- package/dist/acpx-engine/run-site-sandbox.d.ts.map +1 -0
- package/dist/acpx-engine/run-site-sandbox.js +278 -0
- package/dist/acpx-engine/run-site-sandbox.js.map +1 -0
- package/dist/acpx-engine/run-site-sandbox.test.d.ts +2 -0
- package/dist/acpx-engine/run-site-sandbox.test.d.ts.map +1 -0
- package/dist/acpx-engine/run-site-sandbox.test.js +275 -0
- package/dist/acpx-engine/run-site-sandbox.test.js.map +1 -0
- package/dist/acpx-engine/session-codec.d.ts +3 -0
- package/dist/acpx-engine/session-codec.d.ts.map +1 -0
- package/dist/acpx-engine/session-codec.js +49 -0
- package/dist/acpx-engine/session-codec.js.map +1 -0
- package/dist/acpx-engine/session-reuse-store.d.ts +62 -0
- package/dist/acpx-engine/session-reuse-store.d.ts.map +1 -0
- package/dist/acpx-engine/session-reuse-store.js +134 -0
- package/dist/acpx-engine/session-reuse-store.js.map +1 -0
- package/dist/acpx-engine/session-reuse-store.test.d.ts +2 -0
- package/dist/acpx-engine/session-reuse-store.test.d.ts.map +1 -0
- package/dist/acpx-engine/session-reuse-store.test.js +134 -0
- package/dist/acpx-engine/session-reuse-store.test.js.map +1 -0
- package/dist/acpx-engine/settlement-characterization.test.d.ts +2 -0
- package/dist/acpx-engine/settlement-characterization.test.d.ts.map +1 -0
- package/dist/acpx-engine/settlement-characterization.test.js +880 -0
- package/dist/acpx-engine/settlement-characterization.test.js.map +1 -0
- package/dist/acpx-engine/settlement-sequence.d.ts +77 -0
- package/dist/acpx-engine/settlement-sequence.d.ts.map +1 -0
- package/dist/acpx-engine/settlement-sequence.js +119 -0
- package/dist/acpx-engine/settlement-sequence.js.map +1 -0
- package/dist/acpx-engine/settlement-sequence.test.d.ts +2 -0
- package/dist/acpx-engine/settlement-sequence.test.d.ts.map +1 -0
- package/dist/acpx-engine/settlement-sequence.test.js +272 -0
- package/dist/acpx-engine/settlement-sequence.test.js.map +1 -0
- package/dist/acpx-engine/spawn-smoke.test.d.ts +2 -0
- package/dist/acpx-engine/spawn-smoke.test.d.ts.map +1 -0
- package/dist/acpx-engine/spawn-smoke.test.js +184 -0
- package/dist/acpx-engine/spawn-smoke.test.js.map +1 -0
- package/dist/acpx-engine/startup-cancellation.d.ts +8 -0
- package/dist/acpx-engine/startup-cancellation.d.ts.map +1 -0
- package/dist/acpx-engine/startup-cancellation.js +92 -0
- package/dist/acpx-engine/startup-cancellation.js.map +1 -0
- package/dist/acpx-engine/startup-cancellation.test.d.ts +2 -0
- package/dist/acpx-engine/startup-cancellation.test.d.ts.map +1 -0
- package/dist/acpx-engine/startup-cancellation.test.js +115 -0
- package/dist/acpx-engine/startup-cancellation.test.js.map +1 -0
- package/dist/acpx-engine/startup-characterization.test.d.ts +2 -0
- package/dist/acpx-engine/startup-characterization.test.d.ts.map +1 -0
- package/dist/acpx-engine/startup-characterization.test.js +742 -0
- package/dist/acpx-engine/startup-characterization.test.js.map +1 -0
- package/dist/acpx-engine/startup-timing.d.ts +419 -0
- package/dist/acpx-engine/startup-timing.d.ts.map +1 -0
- package/dist/acpx-engine/startup-timing.js +616 -0
- package/dist/acpx-engine/startup-timing.js.map +1 -0
- package/dist/acpx-engine/startup-timing.test.d.ts +2 -0
- package/dist/acpx-engine/startup-timing.test.d.ts.map +1 -0
- package/dist/acpx-engine/startup-timing.test.js +619 -0
- package/dist/acpx-engine/startup-timing.test.js.map +1 -0
- package/dist/acpx-engine/turn-characterization.test.d.ts +2 -0
- package/dist/acpx-engine/turn-characterization.test.d.ts.map +1 -0
- package/dist/acpx-engine/turn-characterization.test.js +566 -0
- package/dist/acpx-engine/turn-characterization.test.js.map +1 -0
- package/dist/acpx-engine/turn-sequence.d.ts +54 -0
- package/dist/acpx-engine/turn-sequence.d.ts.map +1 -0
- package/dist/acpx-engine/turn-sequence.js +75 -0
- package/dist/acpx-engine/turn-sequence.js.map +1 -0
- package/dist/acpx-engine/turn-sequence.test.d.ts +2 -0
- package/dist/acpx-engine/turn-sequence.test.d.ts.map +1 -0
- package/dist/acpx-engine/turn-sequence.test.js +177 -0
- package/dist/acpx-engine/turn-sequence.test.js.map +1 -0
- package/dist/acpx-engine/ui.d.ts +3 -0
- package/dist/acpx-engine/ui.d.ts.map +1 -0
- package/dist/acpx-engine/ui.js +162 -0
- package/dist/acpx-engine/ui.js.map +1 -0
- package/dist/billing.d.ts +2 -0
- package/dist/billing.d.ts.map +1 -0
- package/dist/billing.js +16 -0
- package/dist/billing.js.map +1 -0
- package/dist/billing.test.d.ts +2 -0
- package/dist/billing.test.d.ts.map +1 -0
- package/dist/billing.test.js +14 -0
- package/dist/billing.test.js.map +1 -0
- package/dist/bridge-transport-contract.d.ts +43 -0
- package/dist/bridge-transport-contract.d.ts.map +1 -0
- package/dist/bridge-transport-contract.js +33 -0
- package/dist/bridge-transport-contract.js.map +1 -0
- package/dist/chat-file-delivery.d.ts +10 -0
- package/dist/chat-file-delivery.d.ts.map +1 -0
- package/dist/chat-file-delivery.js +38 -0
- package/dist/chat-file-delivery.js.map +1 -0
- package/dist/chat-file-delivery.test.d.ts +2 -0
- package/dist/chat-file-delivery.test.d.ts.map +1 -0
- package/dist/chat-file-delivery.test.js +92 -0
- package/dist/chat-file-delivery.test.js.map +1 -0
- package/dist/command-managed-runtime.d.ts +162 -0
- package/dist/command-managed-runtime.d.ts.map +1 -0
- package/dist/command-managed-runtime.js +456 -0
- package/dist/command-managed-runtime.js.map +1 -0
- package/dist/command-managed-runtime.test.d.ts +2 -0
- package/dist/command-managed-runtime.test.d.ts.map +1 -0
- package/dist/command-managed-runtime.test.js +908 -0
- package/dist/command-managed-runtime.test.js.map +1 -0
- package/dist/command-redaction.d.ts +15 -0
- package/dist/command-redaction.d.ts.map +1 -0
- package/dist/command-redaction.js +97 -0
- package/dist/command-redaction.js.map +1 -0
- package/dist/command-redaction.test.d.ts +2 -0
- package/dist/command-redaction.test.d.ts.map +1 -0
- package/dist/command-redaction.test.js +80 -0
- package/dist/command-redaction.test.js.map +1 -0
- package/dist/duplex-frame-codec.d.ts +124 -0
- package/dist/duplex-frame-codec.d.ts.map +1 -0
- package/dist/duplex-frame-codec.js +134 -0
- package/dist/duplex-frame-codec.js.map +1 -0
- package/dist/duplex-frame-codec.test.d.ts +2 -0
- package/dist/duplex-frame-codec.test.d.ts.map +1 -0
- package/dist/duplex-frame-codec.test.js +172 -0
- package/dist/duplex-frame-codec.test.js.map +1 -0
- package/dist/duplex-observability.d.ts +220 -0
- package/dist/duplex-observability.d.ts.map +1 -0
- package/dist/duplex-observability.js +248 -0
- package/dist/duplex-observability.js.map +1 -0
- package/dist/duplex-observability.test.d.ts +2 -0
- package/dist/duplex-observability.test.d.ts.map +1 -0
- package/dist/duplex-observability.test.js +55 -0
- package/dist/duplex-observability.test.js.map +1 -0
- package/dist/env-bindings.d.ts +17 -0
- package/dist/env-bindings.d.ts.map +1 -0
- package/dist/env-bindings.js +98 -0
- package/dist/env-bindings.js.map +1 -0
- package/dist/env-bindings.test.d.ts +2 -0
- package/dist/env-bindings.test.d.ts.map +1 -0
- package/dist/env-bindings.test.js +66 -0
- package/dist/env-bindings.test.js.map +1 -0
- package/dist/exclude-patterns.d.ts +4 -0
- package/dist/exclude-patterns.d.ts.map +1 -0
- package/dist/exclude-patterns.js +26 -0
- package/dist/exclude-patterns.js.map +1 -0
- package/dist/execution-target-sandbox.test.d.ts +2 -0
- package/dist/execution-target-sandbox.test.d.ts.map +1 -0
- package/dist/execution-target-sandbox.test.js +6522 -0
- package/dist/execution-target-sandbox.test.js.map +1 -0
- package/dist/execution-target-stdin-race.test.d.ts +2 -0
- package/dist/execution-target-stdin-race.test.d.ts.map +1 -0
- package/dist/execution-target-stdin-race.test.js +1842 -0
- package/dist/execution-target-stdin-race.test.js.map +1 -0
- package/dist/execution-target.d.ts +537 -0
- package/dist/execution-target.d.ts.map +1 -0
- package/dist/execution-target.js +3877 -0
- package/dist/execution-target.js.map +1 -0
- package/dist/execution-target.test.d.ts +2 -0
- package/dist/execution-target.test.d.ts.map +1 -0
- package/dist/execution-target.test.js +346 -0
- package/dist/execution-target.test.js.map +1 -0
- package/dist/git-workspace-sync.d.ts +193 -0
- package/dist/git-workspace-sync.d.ts.map +1 -0
- package/dist/git-workspace-sync.js +786 -0
- package/dist/git-workspace-sync.js.map +1 -0
- package/dist/git-workspace-sync.test.d.ts +2 -0
- package/dist/git-workspace-sync.test.d.ts.map +1 -0
- package/dist/git-workspace-sync.test.js +830 -0
- package/dist/git-workspace-sync.test.js.map +1 -0
- package/dist/github-launcher-environment.test.d.ts +2 -0
- package/dist/github-launcher-environment.test.d.ts.map +1 -0
- package/dist/github-launcher-environment.test.js +285 -0
- package/dist/github-launcher-environment.test.js.map +1 -0
- package/dist/github-launcher.d.ts +8 -0
- package/dist/github-launcher.d.ts.map +1 -0
- package/dist/github-launcher.js +127 -0
- package/dist/github-launcher.js.map +1 -0
- package/dist/github-launcher.test.d.ts +2 -0
- package/dist/github-launcher.test.d.ts.map +1 -0
- package/dist/github-launcher.test.js +166 -0
- package/dist/github-launcher.test.js.map +1 -0
- package/dist/http2-bridge-server.d.ts +465 -0
- package/dist/http2-bridge-server.d.ts.map +1 -0
- package/dist/http2-bridge-server.js +1087 -0
- package/dist/http2-bridge-server.js.map +1 -0
- package/dist/http2-bridge-server.test.d.ts +2 -0
- package/dist/http2-bridge-server.test.d.ts.map +1 -0
- package/dist/http2-bridge-server.test.js +2129 -0
- package/dist/http2-bridge-server.test.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/local-process-sandbox.d.ts +41 -0
- package/dist/local-process-sandbox.d.ts.map +1 -0
- package/dist/local-process-sandbox.js +432 -0
- package/dist/local-process-sandbox.js.map +1 -0
- package/dist/local-process-sandbox.test.d.ts +2 -0
- package/dist/local-process-sandbox.test.d.ts.map +1 -0
- package/dist/local-process-sandbox.test.js +399 -0
- package/dist/local-process-sandbox.test.js.map +1 -0
- package/dist/log-redaction.d.ts +9 -0
- package/dist/log-redaction.d.ts.map +1 -0
- package/dist/log-redaction.js +88 -0
- package/dist/log-redaction.js.map +1 -0
- package/dist/login-capability.d.ts +88 -0
- package/dist/login-capability.d.ts.map +1 -0
- package/dist/login-capability.js +78 -0
- package/dist/login-capability.js.map +1 -0
- package/dist/login-capability.test.d.ts +2 -0
- package/dist/login-capability.test.d.ts.map +1 -0
- package/dist/login-capability.test.js +78 -0
- package/dist/login-capability.test.js.map +1 -0
- package/dist/login-pty-transport.d.ts +80 -0
- package/dist/login-pty-transport.d.ts.map +1 -0
- package/dist/login-pty-transport.js +75 -0
- package/dist/login-pty-transport.js.map +1 -0
- package/dist/login-pty-transport.test.d.ts +2 -0
- package/dist/login-pty-transport.test.d.ts.map +1 -0
- package/dist/login-pty-transport.test.js +185 -0
- package/dist/login-pty-transport.test.js.map +1 -0
- package/dist/login-runner-lifecycle.d.ts +70 -0
- package/dist/login-runner-lifecycle.d.ts.map +1 -0
- package/dist/login-runner-lifecycle.js +52 -0
- package/dist/login-runner-lifecycle.js.map +1 -0
- package/dist/login-runner-lifecycle.test.d.ts +2 -0
- package/dist/login-runner-lifecycle.test.d.ts.map +1 -0
- package/dist/login-runner-lifecycle.test.js +122 -0
- package/dist/login-runner-lifecycle.test.js.map +1 -0
- package/dist/mcp-isolation.integration.test.d.ts +2 -0
- package/dist/mcp-isolation.integration.test.d.ts.map +1 -0
- package/dist/mcp-isolation.integration.test.js +202 -0
- package/dist/mcp-isolation.integration.test.js.map +1 -0
- package/dist/paperclip-runner-permissions.d.ts +110 -0
- package/dist/paperclip-runner-permissions.d.ts.map +1 -0
- package/dist/paperclip-runner-permissions.js +150 -0
- package/dist/paperclip-runner-permissions.js.map +1 -0
- package/dist/paperclip-runner-permissions.test.d.ts +2 -0
- package/dist/paperclip-runner-permissions.test.d.ts.map +1 -0
- package/dist/paperclip-runner-permissions.test.js +47 -0
- package/dist/paperclip-runner-permissions.test.js.map +1 -0
- package/dist/published-exports.test.d.ts +2 -0
- package/dist/published-exports.test.d.ts.map +1 -0
- package/dist/published-exports.test.js +17 -0
- package/dist/published-exports.test.js.map +1 -0
- package/dist/remote-execution-env.d.ts +2 -0
- package/dist/remote-execution-env.d.ts.map +1 -0
- package/dist/remote-execution-env.js +46 -0
- package/dist/remote-execution-env.js.map +1 -0
- package/dist/remote-managed-runtime.d.ts +45 -0
- package/dist/remote-managed-runtime.d.ts.map +1 -0
- package/dist/remote-managed-runtime.js +183 -0
- package/dist/remote-managed-runtime.js.map +1 -0
- package/dist/remote-managed-runtime.test.d.ts +2 -0
- package/dist/remote-managed-runtime.test.d.ts.map +1 -0
- package/dist/remote-managed-runtime.test.js +294 -0
- package/dist/remote-managed-runtime.test.js.map +1 -0
- package/dist/runner-connectivity.d.ts +61 -0
- package/dist/runner-connectivity.d.ts.map +1 -0
- package/dist/runner-connectivity.js +81 -0
- package/dist/runner-connectivity.js.map +1 -0
- package/dist/runner-connectivity.test.d.ts +2 -0
- package/dist/runner-connectivity.test.d.ts.map +1 -0
- package/dist/runner-connectivity.test.js +183 -0
- package/dist/runner-connectivity.test.js.map +1 -0
- package/dist/runtime-progress.d.ts +48 -0
- package/dist/runtime-progress.d.ts.map +1 -0
- package/dist/runtime-progress.js +99 -0
- package/dist/runtime-progress.js.map +1 -0
- package/dist/runtime-progress.test.d.ts +2 -0
- package/dist/runtime-progress.test.d.ts.map +1 -0
- package/dist/runtime-progress.test.js +240 -0
- package/dist/runtime-progress.test.js.map +1 -0
- package/dist/sandbox-callback-bridge-body.d.ts +12 -0
- package/dist/sandbox-callback-bridge-body.d.ts.map +1 -0
- package/dist/sandbox-callback-bridge-body.js +39 -0
- package/dist/sandbox-callback-bridge-body.js.map +1 -0
- package/dist/sandbox-callback-bridge-body.test.d.ts +2 -0
- package/dist/sandbox-callback-bridge-body.test.d.ts.map +1 -0
- package/dist/sandbox-callback-bridge-body.test.js +31 -0
- package/dist/sandbox-callback-bridge-body.test.js.map +1 -0
- package/dist/sandbox-callback-bridge.d.ts +268 -0
- package/dist/sandbox-callback-bridge.d.ts.map +1 -0
- package/dist/sandbox-callback-bridge.js +2357 -0
- package/dist/sandbox-callback-bridge.js.map +1 -0
- package/dist/sandbox-callback-bridge.test.d.ts +2 -0
- package/dist/sandbox-callback-bridge.test.d.ts.map +1 -0
- package/dist/sandbox-callback-bridge.test.js +3253 -0
- package/dist/sandbox-callback-bridge.test.js.map +1 -0
- package/dist/sandbox-file-sync.test.d.ts +2 -0
- package/dist/sandbox-file-sync.test.d.ts.map +1 -0
- package/dist/sandbox-file-sync.test.js +419 -0
- package/dist/sandbox-file-sync.test.js.map +1 -0
- package/dist/sandbox-install-command.d.ts +2 -0
- package/dist/sandbox-install-command.d.ts.map +1 -0
- package/dist/sandbox-install-command.js +47 -0
- package/dist/sandbox-install-command.js.map +1 -0
- package/dist/sandbox-install-command.test.d.ts +2 -0
- package/dist/sandbox-install-command.test.d.ts.map +1 -0
- package/dist/sandbox-install-command.test.js +22 -0
- package/dist/sandbox-install-command.test.js.map +1 -0
- package/dist/sandbox-managed-runtime.d.ts +417 -0
- package/dist/sandbox-managed-runtime.d.ts.map +1 -0
- package/dist/sandbox-managed-runtime.js +1337 -0
- package/dist/sandbox-managed-runtime.js.map +1 -0
- package/dist/sandbox-managed-runtime.test.d.ts +2 -0
- package/dist/sandbox-managed-runtime.test.d.ts.map +1 -0
- package/dist/sandbox-managed-runtime.test.js +3746 -0
- package/dist/sandbox-managed-runtime.test.js.map +1 -0
- package/dist/sandbox-run-log-stream.d.ts +44 -0
- package/dist/sandbox-run-log-stream.d.ts.map +1 -0
- package/dist/sandbox-run-log-stream.js +203 -0
- package/dist/sandbox-run-log-stream.js.map +1 -0
- package/dist/sandbox-shell.d.ts +3 -0
- package/dist/sandbox-shell.d.ts.map +1 -0
- package/dist/sandbox-shell.js +7 -0
- package/dist/sandbox-shell.js.map +1 -0
- package/dist/server-utils-env.test.d.ts +2 -0
- package/dist/server-utils-env.test.d.ts.map +1 -0
- package/dist/server-utils-env.test.js +15 -0
- package/dist/server-utils-env.test.js.map +1 -0
- package/dist/server-utils.d.ts +617 -0
- package/dist/server-utils.d.ts.map +1 -0
- package/dist/server-utils.js +3258 -0
- package/dist/server-utils.js.map +1 -0
- package/dist/server-utils.test.d.ts +2 -0
- package/dist/server-utils.test.d.ts.map +1 -0
- package/dist/server-utils.test.js +3047 -0
- package/dist/server-utils.test.js.map +1 -0
- package/dist/session-compaction.d.ts +25 -0
- package/dist/session-compaction.d.ts.map +1 -0
- package/dist/session-compaction.js +165 -0
- package/dist/session-compaction.js.map +1 -0
- package/dist/skill-library-manifest.d.ts +6 -0
- package/dist/skill-library-manifest.d.ts.map +1 -0
- package/dist/skill-library-manifest.js +53 -0
- package/dist/skill-library-manifest.js.map +1 -0
- package/dist/skill-library-manifest.test.d.ts +2 -0
- package/dist/skill-library-manifest.test.d.ts.map +1 -0
- package/dist/skill-library-manifest.test.js +84 -0
- package/dist/skill-library-manifest.test.js.map +1 -0
- package/dist/skills-staging-follow-symlinks.test.d.ts +2 -0
- package/dist/skills-staging-follow-symlinks.test.d.ts.map +1 -0
- package/dist/skills-staging-follow-symlinks.test.js +126 -0
- package/dist/skills-staging-follow-symlinks.test.js.map +1 -0
- package/dist/ssh-fixture.test.d.ts +2 -0
- package/dist/ssh-fixture.test.d.ts.map +1 -0
- package/dist/ssh-fixture.test.js +832 -0
- package/dist/ssh-fixture.test.js.map +1 -0
- package/dist/ssh.d.ts +124 -0
- package/dist/ssh.d.ts.map +1 -0
- package/dist/ssh.js +1667 -0
- package/dist/ssh.js.map +1 -0
- package/dist/sync-operation-schedule.d.ts +17 -0
- package/dist/sync-operation-schedule.d.ts.map +1 -0
- package/dist/sync-operation-schedule.js +66 -0
- package/dist/sync-operation-schedule.js.map +1 -0
- package/dist/sync-operation-schedule.test.d.ts +2 -0
- package/dist/sync-operation-schedule.test.d.ts.map +1 -0
- package/dist/sync-operation-schedule.test.js +130 -0
- package/dist/sync-operation-schedule.test.js.map +1 -0
- package/dist/test-support/mcp-isolation-harness.d.ts +23 -0
- package/dist/test-support/mcp-isolation-harness.d.ts.map +1 -0
- package/dist/test-support/mcp-isolation-harness.js +67 -0
- package/dist/test-support/mcp-isolation-harness.js.map +1 -0
- package/dist/types.d.ts +780 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/workspace-restore-merge.d.ts +77 -0
- package/dist/workspace-restore-merge.d.ts.map +1 -0
- package/dist/workspace-restore-merge.js +396 -0
- package/dist/workspace-restore-merge.js.map +1 -0
- package/dist/workspace-restore-merge.test.d.ts +2 -0
- package/dist/workspace-restore-merge.test.d.ts.map +1 -0
- package/dist/workspace-restore-merge.test.js +438 -0
- package/dist/workspace-restore-merge.test.js.map +1 -0
- package/dist/workspace-restore-teardown.d.ts +29 -0
- package/dist/workspace-restore-teardown.d.ts.map +1 -0
- package/dist/workspace-restore-teardown.js +34 -0
- package/dist/workspace-restore-teardown.js.map +1 -0
- package/dist/workspace-restore-teardown.test.d.ts +2 -0
- package/dist/workspace-restore-teardown.test.d.ts.map +1 -0
- package/dist/workspace-restore-teardown.test.js +71 -0
- package/dist/workspace-restore-teardown.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/LICENSE +191 -0
- package/node_modules/@agentclientprotocol/sdk/README.md +70 -0
- package/node_modules/@agentclientprotocol/sdk/dist/acp.d.ts +1803 -0
- package/node_modules/@agentclientprotocol/sdk/dist/acp.js +1869 -0
- package/node_modules/@agentclientprotocol/sdk/dist/acp.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/acp.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/acp.test.js +5036 -0
- package/node_modules/@agentclientprotocol/sdk/dist/acp.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/connection.d.ts +89 -0
- package/node_modules/@agentclientprotocol/sdk/dist/connection.js +490 -0
- package/node_modules/@agentclientprotocol/sdk/dist/connection.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/connection.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/connection.test.js +507 -0
- package/node_modules/@agentclientprotocol/sdk/dist/connection.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.d.ts +26 -0
- package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.js +96 -0
- package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.js +77 -0
- package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.d.ts +2 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.js +232 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/client.d.ts +2 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/client.js +132 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/client.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.d.ts +9 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js +221 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.d.ts +2 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.js +86 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.d.ts +2 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.js +112 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.d.ts +2 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.js +88 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/http-stream.d.ts +33 -0
- package/node_modules/@agentclientprotocol/sdk/dist/http-stream.js +435 -0
- package/node_modules/@agentclientprotocol/sdk/dist/http-stream.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.js +1380 -0
- package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.d.ts +603 -0
- package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js +1076 -0
- package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.js +917 -0
- package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.d.ts +22 -0
- package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.js +64 -0
- package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.js +45 -0
- package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.d.ts +17 -0
- package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.js +426 -0
- package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.js +499 -0
- package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.d.ts +37 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.js +474 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.js +535 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol.d.ts +11 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol.js +69 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.js +82 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.d.ts +183 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js +207 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/index.d.ts +51 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js +52 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.d.ts +6219 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.js +3 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.d.ts +15215 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js +3084 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.d.ts +30 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js +98 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.js +93 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.js +261 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.js +536 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-sse.d.ts +2 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-sse.js +88 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-sse.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.js +53 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.js +992 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server.d.ts +81 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server.js +386 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server.test.js +1116 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/sse.d.ts +4 -0
- package/node_modules/@agentclientprotocol/sdk/dist/sse.js +91 -0
- package/node_modules/@agentclientprotocol/sdk/dist/sse.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/sse.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/sse.test.js +126 -0
- package/node_modules/@agentclientprotocol/sdk/dist/sse.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/stream.d.ts +35 -0
- package/node_modules/@agentclientprotocol/sdk/dist/stream.js +115 -0
- package/node_modules/@agentclientprotocol/sdk/dist/stream.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/stream.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/stream.test.js +195 -0
- package/node_modules/@agentclientprotocol/sdk/dist/stream.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.d.ts +8 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.js +51 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.d.ts +24 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.js +163 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.d.ts +9 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.js +74 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.d.ts +957 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js +1484 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.js +1287 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.d.ts +946 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js +1046 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.d.ts +42 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.js +43 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.d.ts +6208 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.js +3 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.d.ts +33267 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js +3199 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-server.d.ts +14 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-server.js +357 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-server.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.d.ts +54 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.js +253 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.js +836 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.d.ts +13 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.js +78 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.js +42 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/package.json +104 -0
- package/node_modules/@agentclientprotocol/sdk/schema/schema.json +8967 -0
- package/node_modules/@agentclientprotocol/sdk/schema/v2/schema.unstable.json +10242 -0
- package/node_modules/@clack/core/LICENSE +9 -0
- package/node_modules/@clack/core/README.md +22 -0
- package/node_modules/@clack/core/dist/index.d.mts +503 -0
- package/node_modules/@clack/core/dist/index.mjs +1003 -0
- package/node_modules/@clack/core/package.json +63 -0
- package/node_modules/@clack/prompts/LICENSE +9 -0
- package/node_modules/@clack/prompts/README.md +396 -0
- package/node_modules/@clack/prompts/dist/index.d.mts +949 -0
- package/node_modules/@clack/prompts/dist/index.mjs +1423 -0
- package/node_modules/@clack/prompts/package.json +67 -0
- package/node_modules/@esbuild/linux-x64/README.md +3 -0
- package/node_modules/@esbuild/linux-x64/bin/esbuild +0 -0
- package/node_modules/@esbuild/linux-x64/package.json +20 -0
- package/node_modules/acpx/LICENSE +21 -0
- package/node_modules/acpx/README.md +424 -0
- package/node_modules/acpx/dist/cli-CxsS1XQp.js +197 -0
- package/node_modules/acpx/dist/cli-CxsS1XQp.js.map +1 -0
- package/node_modules/acpx/dist/cli.d.ts +14 -0
- package/node_modules/acpx/dist/cli.d.ts.map +1 -0
- package/node_modules/acpx/dist/cli.js +2683 -0
- package/node_modules/acpx/dist/cli.js.map +1 -0
- package/node_modules/acpx/dist/client-DwNyFauq.d.ts +192 -0
- package/node_modules/acpx/dist/client-DwNyFauq.d.ts.map +1 -0
- package/node_modules/acpx/dist/flags-Bjq_XQ4-.js +260 -0
- package/node_modules/acpx/dist/flags-Bjq_XQ4-.js.map +1 -0
- package/node_modules/acpx/dist/flows-Db_LZKu9.js +1920 -0
- package/node_modules/acpx/dist/flows-Db_LZKu9.js.map +1 -0
- package/node_modules/acpx/dist/flows.d.ts +318 -0
- package/node_modules/acpx/dist/flows.d.ts.map +1 -0
- package/node_modules/acpx/dist/flows.js +2 -0
- package/node_modules/acpx/dist/live-checkpoint-ClPCSdrW.js +6210 -0
- package/node_modules/acpx/dist/live-checkpoint-ClPCSdrW.js.map +1 -0
- package/node_modules/acpx/dist/output-CjdF5rHk.js +4593 -0
- package/node_modules/acpx/dist/output-CjdF5rHk.js.map +1 -0
- package/node_modules/acpx/dist/runtime.d.ts +472 -0
- package/node_modules/acpx/dist/runtime.d.ts.map +1 -0
- package/node_modules/acpx/dist/runtime.js +1711 -0
- package/node_modules/acpx/dist/runtime.js.map +1 -0
- package/node_modules/acpx/dist/session-options-jkYbBxGE.d.ts +278 -0
- package/node_modules/acpx/dist/session-options-jkYbBxGE.d.ts.map +1 -0
- package/node_modules/acpx/package.json +129 -0
- package/node_modules/acpx/skills/acpx/SKILL.md +617 -0
- package/node_modules/b4a/LICENSE +201 -0
- package/node_modules/b4a/README.md +153 -0
- package/node_modules/b4a/browser.js +546 -0
- package/node_modules/b4a/index.d.ts +144 -0
- package/node_modules/b4a/index.js +193 -0
- package/node_modules/b4a/lib/ascii.js +31 -0
- package/node_modules/b4a/lib/base64.js +64 -0
- package/node_modules/b4a/lib/hex.js +51 -0
- package/node_modules/b4a/lib/latin1.js +31 -0
- package/node_modules/b4a/lib/utf16le.js +40 -0
- package/node_modules/b4a/lib/utf8.js +144 -0
- package/node_modules/b4a/package.json +54 -0
- package/node_modules/b4a/react-native.js +5 -0
- package/node_modules/b4a/runtime.d.ts +14 -0
- package/node_modules/bare-events/LICENSE +201 -0
- package/node_modules/bare-events/README.md +25 -0
- package/node_modules/bare-events/global.d.ts +15 -0
- package/node_modules/bare-events/global.js +5 -0
- package/node_modules/bare-events/index.d.ts +89 -0
- package/node_modules/bare-events/index.js +397 -0
- package/node_modules/bare-events/lib/errors.js +23 -0
- package/node_modules/bare-events/package.json +63 -0
- package/node_modules/bare-events/web.d.ts +79 -0
- package/node_modules/bare-events/web.js +417 -0
- package/node_modules/bare-fs/CMakeLists.txt +13 -0
- package/node_modules/bare-fs/LICENSE +201 -0
- package/node_modules/bare-fs/README.md +33 -0
- package/node_modules/bare-fs/binding.c +2913 -0
- package/node_modules/bare-fs/binding.js +1 -0
- package/node_modules/bare-fs/index.d.ts +1502 -0
- package/node_modules/bare-fs/index.js +2855 -0
- package/node_modules/bare-fs/lib/constants.d.ts +50 -0
- package/node_modules/bare-fs/lib/constants.js +49 -0
- package/node_modules/bare-fs/lib/errors.d.ts +13 -0
- package/node_modules/bare-fs/lib/errors.js +55 -0
- package/node_modules/bare-fs/package.json +74 -0
- package/node_modules/bare-fs/prebuilds/android-arm/bare-fs.bare +0 -0
- package/node_modules/bare-fs/prebuilds/android-arm64/bare-fs.bare +0 -0
- package/node_modules/bare-fs/prebuilds/android-ia32/bare-fs.bare +0 -0
- package/node_modules/bare-fs/prebuilds/android-x64/bare-fs.bare +0 -0
- package/node_modules/bare-fs/prebuilds/darwin-arm64/bare-fs.bare +0 -0
- package/node_modules/bare-fs/prebuilds/darwin-x64/bare-fs.bare +0 -0
- package/node_modules/bare-fs/prebuilds/ios-arm64/bare-fs.bare +0 -0
- package/node_modules/bare-fs/prebuilds/ios-arm64-simulator/bare-fs.bare +0 -0
- package/node_modules/bare-fs/prebuilds/ios-x64-simulator/bare-fs.bare +0 -0
- package/node_modules/bare-fs/prebuilds/linux-arm64/bare-fs.bare +0 -0
- package/node_modules/bare-fs/prebuilds/linux-x64/bare-fs.bare +0 -0
- package/node_modules/bare-fs/prebuilds/win32-arm64/bare-fs.bare +0 -0
- package/node_modules/bare-fs/prebuilds/win32-x64/bare-fs.bare +0 -0
- package/node_modules/bare-fs/promises.d.ts +480 -0
- package/node_modules/bare-fs/promises.js +119 -0
- package/node_modules/bare-path/CMakeLists.txt +13 -0
- package/node_modules/bare-path/LICENSE +201 -0
- package/node_modules/bare-path/NOTICE +28 -0
- package/node_modules/bare-path/README.md +19 -0
- package/node_modules/bare-path/binding.c +106 -0
- package/node_modules/bare-path/binding.js +1 -0
- package/node_modules/bare-path/index.d.ts +27 -0
- package/node_modules/bare-path/index.js +9 -0
- package/node_modules/bare-path/lib/constants.js +11 -0
- package/node_modules/bare-path/lib/posix.js +263 -0
- package/node_modules/bare-path/lib/shared.js +81 -0
- package/node_modules/bare-path/lib/win32.js +564 -0
- package/node_modules/bare-path/package.json +47 -0
- package/node_modules/bare-path/prebuilds/android-arm/bare-path.bare +0 -0
- package/node_modules/bare-path/prebuilds/android-arm64/bare-path.bare +0 -0
- package/node_modules/bare-path/prebuilds/android-ia32/bare-path.bare +0 -0
- package/node_modules/bare-path/prebuilds/android-x64/bare-path.bare +0 -0
- package/node_modules/bare-path/prebuilds/darwin-arm64/bare-path.bare +0 -0
- package/node_modules/bare-path/prebuilds/darwin-x64/bare-path.bare +0 -0
- package/node_modules/bare-path/prebuilds/ios-arm64/bare-path.bare +0 -0
- package/node_modules/bare-path/prebuilds/ios-arm64-simulator/bare-path.bare +0 -0
- package/node_modules/bare-path/prebuilds/ios-x64-simulator/bare-path.bare +0 -0
- package/node_modules/bare-path/prebuilds/linux-arm64/bare-path.bare +0 -0
- package/node_modules/bare-path/prebuilds/linux-x64/bare-path.bare +0 -0
- package/node_modules/bare-path/prebuilds/win32-arm64/bare-path.bare +0 -0
- package/node_modules/bare-path/prebuilds/win32-x64/bare-path.bare +0 -0
- package/node_modules/bare-stream/LICENSE +201 -0
- package/node_modules/bare-stream/README.md +354 -0
- package/node_modules/bare-stream/global.d.ts +31 -0
- package/node_modules/bare-stream/global.js +15 -0
- package/node_modules/bare-stream/index.d.ts +235 -0
- package/node_modules/bare-stream/index.js +493 -0
- package/node_modules/bare-stream/package.json +75 -0
- package/node_modules/bare-stream/promises.js +3 -0
- package/node_modules/bare-stream/web.d.ts +152 -0
- package/node_modules/bare-stream/web.js +607 -0
- package/node_modules/bare-url/CMakeLists.txt +36 -0
- package/node_modules/bare-url/LICENSE +201 -0
- package/node_modules/bare-url/README.md +33 -0
- package/node_modules/bare-url/binding.c +422 -0
- package/node_modules/bare-url/binding.js +1 -0
- package/node_modules/bare-url/global.d.ts +24 -0
- package/node_modules/bare-url/global.js +2 -0
- package/node_modules/bare-url/index.d.ts +96 -0
- package/node_modules/bare-url/index.js +676 -0
- package/node_modules/bare-url/lib/errors.d.ts +10 -0
- package/node_modules/bare-url/lib/errors.js +33 -0
- package/node_modules/bare-url/lib/url-search-params.d.ts +66 -0
- package/node_modules/bare-url/lib/url-search-params.js +276 -0
- package/node_modules/bare-url/package.json +54 -0
- package/node_modules/bare-url/prebuilds/android-arm/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/android-arm64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/android-ia32/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/android-x64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/darwin-arm64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/darwin-x64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/ios-arm64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/ios-arm64-simulator/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/ios-x64-simulator/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/linux-arm64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/linux-x64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/win32-arm64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/win32-x64/bare-url.bare +0 -0
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1172 -0
- package/node_modules/commander/index.js +21 -0
- package/node_modules/commander/lib/argument.js +147 -0
- package/node_modules/commander/lib/command.js +2790 -0
- package/node_modules/commander/lib/error.js +36 -0
- package/node_modules/commander/lib/help.js +731 -0
- package/node_modules/commander/lib/option.js +377 -0
- package/node_modules/commander/lib/suggestSimilar.js +99 -0
- package/node_modules/commander/package-support.json +19 -0
- package/node_modules/commander/package.json +64 -0
- package/node_modules/commander/typings/index.d.ts +1113 -0
- package/node_modules/esbuild/LICENSE.md +21 -0
- package/node_modules/esbuild/README.md +3 -0
- package/node_modules/esbuild/bin/esbuild +223 -0
- package/node_modules/esbuild/install.js +300 -0
- package/node_modules/esbuild/lib/main.d.ts +720 -0
- package/node_modules/esbuild/lib/main.js +2536 -0
- package/node_modules/esbuild/package.json +74 -0
- package/node_modules/events-universal/LICENSE +201 -0
- package/node_modules/events-universal/README.md +17 -0
- package/node_modules/events-universal/bare.js +1 -0
- package/node_modules/events-universal/default.js +1 -0
- package/node_modules/events-universal/index.js +1 -0
- package/node_modules/events-universal/package.json +39 -0
- package/node_modules/events-universal/react-native.js +1 -0
- package/node_modules/fast-fifo/LICENSE +21 -0
- package/node_modules/fast-fifo/README.md +78 -0
- package/node_modules/fast-fifo/fixed-size.js +39 -0
- package/node_modules/fast-fifo/index.js +48 -0
- package/node_modules/fast-fifo/package.json +28 -0
- package/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
- package/node_modules/fast-string-truncated-width/dist/index.js +111 -0
- package/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
- package/node_modules/fast-string-truncated-width/dist/types.js +2 -0
- package/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
- package/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
- package/node_modules/fast-string-truncated-width/license +21 -0
- package/node_modules/fast-string-truncated-width/package.json +35 -0
- package/node_modules/fast-string-truncated-width/readme.md +59 -0
- package/node_modules/fast-string-width/dist/index.d.ts +4 -0
- package/node_modules/fast-string-width/dist/index.js +14 -0
- package/node_modules/fast-string-width/license +21 -0
- package/node_modules/fast-string-width/package.json +34 -0
- package/node_modules/fast-string-width/readme.md +42 -0
- package/node_modules/fast-wrap-ansi/LICENSE +23 -0
- package/node_modules/fast-wrap-ansi/README.md +26 -0
- package/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
- package/node_modules/fast-wrap-ansi/lib/main.js +218 -0
- package/node_modules/fast-wrap-ansi/package.json +51 -0
- package/node_modules/sisteransi/license +21 -0
- package/node_modules/sisteransi/package.json +34 -0
- package/node_modules/sisteransi/readme.md +113 -0
- package/node_modules/sisteransi/src/index.js +58 -0
- package/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
- package/node_modules/skillflag/LICENSE +21 -0
- package/node_modules/skillflag/README.md +44 -0
- package/node_modules/skillflag/dist/bin/skill-install.d.ts +3 -0
- package/node_modules/skillflag/dist/bin/skill-install.d.ts.map +1 -0
- package/node_modules/skillflag/dist/bin/skill-install.js +6 -0
- package/node_modules/skillflag/dist/bin/skill-install.js.map +1 -0
- package/node_modules/skillflag/dist/bin/skillflag.d.ts +3 -0
- package/node_modules/skillflag/dist/bin/skillflag.d.ts.map +1 -0
- package/node_modules/skillflag/dist/bin/skillflag.js +25 -0
- package/node_modules/skillflag/dist/bin/skillflag.js.map +1 -0
- package/node_modules/skillflag/dist/core/digest.d.ts +2 -0
- package/node_modules/skillflag/dist/core/digest.d.ts.map +1 -0
- package/node_modules/skillflag/dist/core/digest.js +15 -0
- package/node_modules/skillflag/dist/core/digest.js.map +1 -0
- package/node_modules/skillflag/dist/core/errors.d.ts +6 -0
- package/node_modules/skillflag/dist/core/errors.d.ts.map +1 -0
- package/node_modules/skillflag/dist/core/errors.js +13 -0
- package/node_modules/skillflag/dist/core/errors.js.map +1 -0
- package/node_modules/skillflag/dist/core/export.d.ts +2 -0
- package/node_modules/skillflag/dist/core/export.d.ts.map +1 -0
- package/node_modules/skillflag/dist/core/export.js +28 -0
- package/node_modules/skillflag/dist/core/export.js.map +1 -0
- package/node_modules/skillflag/dist/core/list.d.ts +21 -0
- package/node_modules/skillflag/dist/core/list.d.ts.map +1 -0
- package/node_modules/skillflag/dist/core/list.js +71 -0
- package/node_modules/skillflag/dist/core/list.js.map +1 -0
- package/node_modules/skillflag/dist/core/paths.d.ts +15 -0
- package/node_modules/skillflag/dist/core/paths.d.ts.map +1 -0
- package/node_modules/skillflag/dist/core/paths.js +149 -0
- package/node_modules/skillflag/dist/core/paths.js.map +1 -0
- package/node_modules/skillflag/dist/core/show.d.ts +2 -0
- package/node_modules/skillflag/dist/core/show.d.ts.map +1 -0
- package/node_modules/skillflag/dist/core/show.js +8 -0
- package/node_modules/skillflag/dist/core/show.js.map +1 -0
- package/node_modules/skillflag/dist/core/skillflag.d.ts +3 -0
- package/node_modules/skillflag/dist/core/skillflag.d.ts.map +1 -0
- package/node_modules/skillflag/dist/core/skillflag.js +2 -0
- package/node_modules/skillflag/dist/core/skillflag.js.map +1 -0
- package/node_modules/skillflag/dist/core/tar.d.ts +16 -0
- package/node_modules/skillflag/dist/core/tar.d.ts.map +1 -0
- package/node_modules/skillflag/dist/core/tar.js +140 -0
- package/node_modules/skillflag/dist/core/tar.js.map +1 -0
- package/node_modules/skillflag/dist/index.d.ts +5 -0
- package/node_modules/skillflag/dist/index.d.ts.map +1 -0
- package/node_modules/skillflag/dist/index.js +3 -0
- package/node_modules/skillflag/dist/index.js.map +1 -0
- package/node_modules/skillflag/dist/install/cli.d.ts +57 -0
- package/node_modules/skillflag/dist/install/cli.d.ts.map +1 -0
- package/node_modules/skillflag/dist/install/cli.js +653 -0
- package/node_modules/skillflag/dist/install/cli.js.map +1 -0
- package/node_modules/skillflag/dist/install/copy.d.ts +2 -0
- package/node_modules/skillflag/dist/install/copy.d.ts.map +1 -0
- package/node_modules/skillflag/dist/install/copy.js +19 -0
- package/node_modules/skillflag/dist/install/copy.js.map +1 -0
- package/node_modules/skillflag/dist/install/errors.d.ts +6 -0
- package/node_modules/skillflag/dist/install/errors.d.ts.map +1 -0
- package/node_modules/skillflag/dist/install/errors.js +13 -0
- package/node_modules/skillflag/dist/install/errors.js.map +1 -0
- package/node_modules/skillflag/dist/install/extract.d.ts +3 -0
- package/node_modules/skillflag/dist/install/extract.d.ts.map +1 -0
- package/node_modules/skillflag/dist/install/extract.js +76 -0
- package/node_modules/skillflag/dist/install/extract.js.map +1 -0
- package/node_modules/skillflag/dist/install/install.d.ts +21 -0
- package/node_modules/skillflag/dist/install/install.d.ts.map +1 -0
- package/node_modules/skillflag/dist/install/install.js +35 -0
- package/node_modules/skillflag/dist/install/install.js.map +1 -0
- package/node_modules/skillflag/dist/install/resolve.d.ts +12 -0
- package/node_modules/skillflag/dist/install/resolve.d.ts.map +1 -0
- package/node_modules/skillflag/dist/install/resolve.js +119 -0
- package/node_modules/skillflag/dist/install/resolve.js.map +1 -0
- package/node_modules/skillflag/dist/install/validate.d.ts +7 -0
- package/node_modules/skillflag/dist/install/validate.d.ts.map +1 -0
- package/node_modules/skillflag/dist/install/validate.js +28 -0
- package/node_modules/skillflag/dist/install/validate.js.map +1 -0
- package/node_modules/skillflag/dist/shared/frontmatter.d.ts +2 -0
- package/node_modules/skillflag/dist/shared/frontmatter.d.ts.map +1 -0
- package/node_modules/skillflag/dist/shared/frontmatter.js +28 -0
- package/node_modules/skillflag/dist/shared/frontmatter.js.map +1 -0
- package/node_modules/skillflag/dist/skillflag.d.ts +29 -0
- package/node_modules/skillflag/dist/skillflag.d.ts.map +1 -0
- package/node_modules/skillflag/dist/skillflag.js +230 -0
- package/node_modules/skillflag/dist/skillflag.js.map +1 -0
- package/node_modules/skillflag/dist/utils/collections.d.ts +3 -0
- package/node_modules/skillflag/dist/utils/collections.d.ts.map +1 -0
- package/node_modules/skillflag/dist/utils/collections.js +18 -0
- package/node_modules/skillflag/dist/utils/collections.js.map +1 -0
- package/node_modules/skillflag/package.json +78 -0
- package/node_modules/skillflag/skills/skillflag/SKILL.md +144 -0
- package/node_modules/streamx/LICENSE +21 -0
- package/node_modules/streamx/README.md +550 -0
- package/node_modules/streamx/index.d.ts +198 -0
- package/node_modules/streamx/index.js +1314 -0
- package/node_modules/streamx/lib/errors.d.ts +13 -0
- package/node_modules/streamx/lib/errors.js +47 -0
- package/node_modules/streamx/package.json +51 -0
- package/node_modules/streamx/runtime.d.ts +55 -0
- package/node_modules/tar-stream/LICENSE +21 -0
- package/node_modules/tar-stream/README.md +183 -0
- package/node_modules/tar-stream/constants.js +14 -0
- package/node_modules/tar-stream/extract.js +418 -0
- package/node_modules/tar-stream/headers.js +322 -0
- package/node_modules/tar-stream/index.d.ts +60 -0
- package/node_modules/tar-stream/index.js +2 -0
- package/node_modules/tar-stream/pack.js +287 -0
- package/node_modules/tar-stream/package.json +50 -0
- package/node_modules/teex/LICENSE +21 -0
- package/node_modules/teex/README.md +31 -0
- package/node_modules/teex/example.js +16 -0
- package/node_modules/teex/index.js +52 -0
- package/node_modules/teex/package.json +26 -0
- package/node_modules/teex/test.js +68 -0
- package/node_modules/text-decoder/LICENSE +201 -0
- package/node_modules/text-decoder/README.md +36 -0
- package/node_modules/text-decoder/index.js +64 -0
- package/node_modules/text-decoder/lib/pass-through-decoder.js +19 -0
- package/node_modules/text-decoder/lib/utf8-decoder.js +185 -0
- package/node_modules/text-decoder/package.json +39 -0
- package/node_modules/tsx/LICENSE +21 -0
- package/node_modules/tsx/README.md +32 -0
- package/node_modules/tsx/dist/cjs/api/index.cjs +2 -0
- package/node_modules/tsx/dist/cjs/api/index.d.cts +35 -0
- package/node_modules/tsx/dist/cjs/api/index.d.mts +35 -0
- package/node_modules/tsx/dist/cjs/api/index.mjs +2 -0
- package/node_modules/tsx/dist/cjs/index.cjs +1 -0
- package/node_modules/tsx/dist/cli.mjs +55 -0
- package/node_modules/tsx/dist/client-XItNFmsq.cjs +1 -0
- package/node_modules/tsx/dist/esm/api/index.cjs +2 -0
- package/node_modules/tsx/dist/esm/api/index.d.cts +37 -0
- package/node_modules/tsx/dist/esm/api/index.d.mts +37 -0
- package/node_modules/tsx/dist/esm/api/index.mjs +2 -0
- package/node_modules/tsx/dist/esm/index.mjs +2 -0
- package/node_modules/tsx/dist/index-Bqjv9TxC.mjs +1 -0
- package/node_modules/tsx/dist/index-DE3OBZuV.mjs +14 -0
- package/node_modules/tsx/dist/lexer-CGfpMDSb.cjs +3 -0
- package/node_modules/tsx/dist/lexer-CanA6ArK.mjs +3 -0
- package/node_modules/tsx/dist/loader.mjs +2 -0
- package/node_modules/tsx/dist/package-Dj0mHsMt.mjs +1 -0
- package/node_modules/tsx/dist/patch-repl.cjs +1 -0
- package/node_modules/tsx/dist/preflight.cjs +1 -0
- package/node_modules/tsx/dist/register-B1c7OH6V.cjs +23 -0
- package/node_modules/tsx/dist/register-nyXW-TH3.mjs +2 -0
- package/node_modules/tsx/dist/repl.mjs +4 -0
- package/node_modules/tsx/dist/require-CBjy4Foe.mjs +10 -0
- package/node_modules/tsx/dist/require-CVaYn9z3.cjs +1 -0
- package/node_modules/tsx/dist/suppress-warnings.cjs +1 -0
- package/node_modules/tsx/dist/temporary-directory-Du7LpLp9.mjs +1 -0
- package/node_modules/tsx/package.json +70 -0
- package/node_modules/zod/LICENSE +21 -0
- package/node_modules/zod/README.md +218 -0
- package/node_modules/zod/compile.cjs +96 -0
- package/node_modules/zod/compile.d.cts +1 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +52 -0
- package/node_modules/zod/index.d.cts +3 -0
- package/node_modules/zod/index.d.ts +3 -0
- package/node_modules/zod/index.js +7 -0
- package/node_modules/zod/locales/index.cjs +36 -0
- package/node_modules/zod/locales/index.d.cts +1 -0
- package/node_modules/zod/locales/index.d.ts +1 -0
- package/node_modules/zod/locales/index.js +1 -0
- package/node_modules/zod/locales/package.json +7 -0
- package/node_modules/zod/mini/index.cjs +51 -0
- package/node_modules/zod/mini/index.d.cts +3 -0
- package/node_modules/zod/mini/index.d.ts +3 -0
- package/node_modules/zod/mini/index.js +3 -0
- package/node_modules/zod/mini/package.json +7 -0
- package/node_modules/zod/package.json +147 -0
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +7 -0
- package/node_modules/zod/src/locales/index.ts +1 -0
- package/node_modules/zod/src/mini/index.ts +3 -0
- package/node_modules/zod/src/v3/ZodError.ts +340 -0
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/node_modules/zod/src/v3/errors.ts +13 -0
- package/node_modules/zod/src/v3/external.ts +6 -0
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
- package/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/node_modules/zod/src/v3/index.ts +4 -0
- package/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
- package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/node_modules/zod/src/v3/tests/error.test.ts +586 -0
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
- package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +128 -0
- package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +206 -0
- package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object.test.ts +431 -0
- package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/readonly.test.ts +114 -0
- package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/node_modules/zod/src/v3/tests/string.test.ts +922 -0
- package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/node_modules/zod/src/v3/types.ts +5138 -0
- package/node_modules/zod/src/v4/classic/checks.ts +33 -0
- package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/node_modules/zod/src/v4/classic/compat.ts +78 -0
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +97 -0
- package/node_modules/zod/src/v4/classic/external.ts +57 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +944 -0
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/node_modules/zod/src/v4/classic/iso.ts +20 -0
- package/node_modules/zod/src/v4/classic/parse.ts +88 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +2937 -0
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +86 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +402 -0
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +89 -0
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +604 -0
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +572 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +704 -0
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +92 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +316 -0
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +455 -0
- package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +221 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +942 -0
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +305 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +917 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +1108 -0
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
- package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +1467 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +391 -0
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +67 -0
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +958 -0
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +127 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +334 -0
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +262 -0
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +128 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +342 -0
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +401 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +1006 -0
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +366 -0
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +497 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +144 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +44 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +184 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +885 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +707 -0
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +693 -0
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +190 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +153 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +1440 -0
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +124 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +812 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +4733 -0
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +511 -0
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +310 -0
- package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/node_modules/zod/src/v4/core/api.ts +1875 -0
- package/node_modules/zod/src/v4/core/checks.ts +1266 -0
- package/node_modules/zod/src/v4/core/compile.ts +2313 -0
- package/node_modules/zod/src/v4/core/core.ts +230 -0
- package/node_modules/zod/src/v4/core/doc.ts +52 -0
- package/node_modules/zod/src/v4/core/errors.ts +543 -0
- package/node_modules/zod/src/v4/core/index.ts +19 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +131 -0
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +934 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +148 -0
- package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
- package/node_modules/zod/src/v4/core/parse.ts +309 -0
- package/node_modules/zod/src/v4/core/regexes.ts +217 -0
- package/node_modules/zod/src/v4/core/registries.ts +105 -0
- package/node_modules/zod/src/v4/core/schemas.ts +5192 -0
- package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
- package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +214 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +180 -0
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
- package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +857 -0
- package/node_modules/zod/src/v4/core/util.ts +1280 -0
- package/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/node_modules/zod/src/v4/index.ts +4 -0
- package/node_modules/zod/src/v4/locales/ar.ts +120 -0
- package/node_modules/zod/src/v4/locales/az.ts +116 -0
- package/node_modules/zod/src/v4/locales/be.ts +188 -0
- package/node_modules/zod/src/v4/locales/bg.ts +133 -0
- package/node_modules/zod/src/v4/locales/bn.ts +123 -0
- package/node_modules/zod/src/v4/locales/ca.ts +121 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
- package/node_modules/zod/src/v4/locales/cs.ts +123 -0
- package/node_modules/zod/src/v4/locales/da.ts +128 -0
- package/node_modules/zod/src/v4/locales/de.ts +121 -0
- package/node_modules/zod/src/v4/locales/el.ts +124 -0
- package/node_modules/zod/src/v4/locales/en.ts +136 -0
- package/node_modules/zod/src/v4/locales/eo.ts +123 -0
- package/node_modules/zod/src/v4/locales/es.ts +145 -0
- package/node_modules/zod/src/v4/locales/fa.ts +131 -0
- package/node_modules/zod/src/v4/locales/fi.ts +126 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +121 -0
- package/node_modules/zod/src/v4/locales/fr.ts +139 -0
- package/node_modules/zod/src/v4/locales/gu.ts +123 -0
- package/node_modules/zod/src/v4/locales/he.ts +253 -0
- package/node_modules/zod/src/v4/locales/hi.ts +126 -0
- package/node_modules/zod/src/v4/locales/hr.ts +135 -0
- package/node_modules/zod/src/v4/locales/hu.ts +122 -0
- package/node_modules/zod/src/v4/locales/hy.ts +175 -0
- package/node_modules/zod/src/v4/locales/id.ts +120 -0
- package/node_modules/zod/src/v4/locales/index.ts +63 -0
- package/node_modules/zod/src/v4/locales/is.ts +124 -0
- package/node_modules/zod/src/v4/locales/it.ts +121 -0
- package/node_modules/zod/src/v4/locales/ja.ts +119 -0
- package/node_modules/zod/src/v4/locales/ka.ts +128 -0
- package/node_modules/zod/src/v4/locales/kh.ts +7 -0
- package/node_modules/zod/src/v4/locales/km.ts +124 -0
- package/node_modules/zod/src/v4/locales/kn.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +126 -0
- package/node_modules/zod/src/v4/locales/lt.ts +243 -0
- package/node_modules/zod/src/v4/locales/mk.ts +123 -0
- package/node_modules/zod/src/v4/locales/ms.ts +120 -0
- package/node_modules/zod/src/v4/locales/ne.ts +128 -0
- package/node_modules/zod/src/v4/locales/nl.ts +126 -0
- package/node_modules/zod/src/v4/locales/nn.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +121 -0
- package/node_modules/zod/src/v4/locales/ota.ts +122 -0
- package/node_modules/zod/src/v4/locales/pl.ts +123 -0
- package/node_modules/zod/src/v4/locales/ps.ts +131 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
- package/node_modules/zod/src/v4/locales/pt.ts +159 -0
- package/node_modules/zod/src/v4/locales/ro.ts +132 -0
- package/node_modules/zod/src/v4/locales/ru.ts +188 -0
- package/node_modules/zod/src/v4/locales/sk.ts +123 -0
- package/node_modules/zod/src/v4/locales/sl.ts +123 -0
- package/node_modules/zod/src/v4/locales/sv.ts +124 -0
- package/node_modules/zod/src/v4/locales/ta.ts +123 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +124 -0
- package/node_modules/zod/src/v4/locales/tk.ts +113 -0
- package/node_modules/zod/src/v4/locales/tr.ts +116 -0
- package/node_modules/zod/src/v4/locales/ua.ts +7 -0
- package/node_modules/zod/src/v4/locales/uk.ts +122 -0
- package/node_modules/zod/src/v4/locales/ur.ts +124 -0
- package/node_modules/zod/src/v4/locales/uz.ts +120 -0
- package/node_modules/zod/src/v4/locales/vi.ts +122 -0
- package/node_modules/zod/src/v4/locales/yo.ts +129 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +121 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +120 -0
- package/node_modules/zod/src/v4/mini/checks.ts +33 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +52 -0
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/node_modules/zod/src/v4/mini/iso.ts +66 -0
- package/node_modules/zod/src/v4/mini/parse.ts +16 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +2051 -0
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +57 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +190 -0
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +158 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +582 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +30 -0
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +41 -0
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +1146 -0
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +109 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +292 -0
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +341 -0
- package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +396 -0
- package/node_modules/zod/src/v4-mini/index.ts +3 -0
- package/node_modules/zod/v3/ZodError.cjs +167 -0
- package/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/zod/v3/ZodError.d.ts +164 -0
- package/node_modules/zod/v3/ZodError.js +143 -0
- package/node_modules/zod/v3/errors.cjs +36 -0
- package/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/zod/v3/errors.d.ts +5 -0
- package/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/zod/v3/external.cjs +41 -0
- package/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/zod/v3/external.js +6 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +21 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +28 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/v3/helpers/parseUtil.cjs +143 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +21 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +21 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/v3/helpers/util.cjs +156 -0
- package/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/zod/v3/helpers/util.d.ts +85 -0
- package/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/zod/v3/index.cjs +52 -0
- package/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/zod/v3/index.js +4 -0
- package/node_modules/zod/v3/locales/en.cjs +112 -0
- package/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/zod/v3/locales/en.d.ts +3 -0
- package/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/zod/v3/package.json +7 -0
- package/node_modules/zod/v3/standard-schema.cjs +21 -0
- package/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/zod/v3/types.cjs +3798 -0
- package/node_modules/zod/v3/types.d.cts +1034 -0
- package/node_modules/zod/v3/types.d.ts +1034 -0
- package/node_modules/zod/v3/types.js +3697 -0
- package/node_modules/zod/v4/classic/checks.cjs +53 -0
- package/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/zod/v4/classic/coerce.cjs +66 -0
- package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/zod/v4/classic/compat.cjs +80 -0
- package/node_modules/zod/v4/classic/compat.d.cts +48 -0
- package/node_modules/zod/v4/classic/compat.d.ts +48 -0
- package/node_modules/zod/v4/classic/compat.js +31 -0
- package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +102 -0
- package/node_modules/zod/v4/classic/errors.d.cts +29 -0
- package/node_modules/zod/v4/classic/errors.d.ts +29 -0
- package/node_modules/zod/v4/classic/errors.js +57 -0
- package/node_modules/zod/v4/classic/external.cjs +97 -0
- package/node_modules/zod/v4/classic/external.d.cts +19 -0
- package/node_modules/zod/v4/classic/external.d.ts +19 -0
- package/node_modules/zod/v4/classic/external.js +17 -0
- package/node_modules/zod/v4/classic/from-json-schema.cjs +926 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.js +881 -0
- package/node_modules/zod/v4/classic/in-out.cjs +82 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +52 -0
- package/node_modules/zod/v4/classic/index.d.cts +3 -0
- package/node_modules/zod/v4/classic/index.d.ts +3 -0
- package/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/zod/v4/classic/iso.cjs +68 -0
- package/node_modules/zod/v4/classic/iso.d.cts +7 -0
- package/node_modules/zod/v4/classic/iso.d.ts +7 -0
- package/node_modules/zod/v4/classic/iso.js +15 -0
- package/node_modules/zod/v4/classic/package.json +7 -0
- package/node_modules/zod/v4/classic/parse.cjs +63 -0
- package/node_modules/zod/v4/classic/parse.d.cts +44 -0
- package/node_modules/zod/v4/classic/parse.d.ts +44 -0
- package/node_modules/zod/v4/classic/parse.js +16 -0
- package/node_modules/zod/v4/classic/schemas.cjs +1676 -0
- package/node_modules/zod/v4/classic/schemas.d.cts +816 -0
- package/node_modules/zod/v4/classic/schemas.d.ts +816 -0
- package/node_modules/zod/v4/classic/schemas.js +1535 -0
- package/node_modules/zod/v4/core/api.cjs +1269 -0
- package/node_modules/zod/v4/core/api.d.cts +335 -0
- package/node_modules/zod/v4/core/api.d.ts +335 -0
- package/node_modules/zod/v4/core/api.js +1107 -0
- package/node_modules/zod/v4/core/checks.cjs +561 -0
- package/node_modules/zod/v4/core/checks.d.cts +294 -0
- package/node_modules/zod/v4/core/checks.d.ts +294 -0
- package/node_modules/zod/v4/core/checks.js +516 -0
- package/node_modules/zod/v4/core/compile.cjs +1908 -0
- package/node_modules/zod/v4/core/compile.d.cts +65 -0
- package/node_modules/zod/v4/core/compile.d.ts +65 -0
- package/node_modules/zod/v4/core/compile.js +1858 -0
- package/node_modules/zod/v4/core/core.cjs +167 -0
- package/node_modules/zod/v4/core/core.d.cts +82 -0
- package/node_modules/zod/v4/core/core.d.ts +82 -0
- package/node_modules/zod/v4/core/core.js +141 -0
- package/node_modules/zod/v4/core/doc.cjs +61 -0
- package/node_modules/zod/v4/core/doc.d.cts +16 -0
- package/node_modules/zod/v4/core/doc.d.ts +16 -0
- package/node_modules/zod/v4/core/doc.js +38 -0
- package/node_modules/zod/v4/core/errors.cjs +317 -0
- package/node_modules/zod/v4/core/errors.d.cts +225 -0
- package/node_modules/zod/v4/core/errors.d.ts +225 -0
- package/node_modules/zod/v4/core/errors.js +267 -0
- package/node_modules/zod/v4/core/index.cjs +70 -0
- package/node_modules/zod/v4/core/index.d.cts +19 -0
- package/node_modules/zod/v4/core/index.d.ts +19 -0
- package/node_modules/zod/v4/core/index.js +19 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +122 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.js +99 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +929 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +843 -0
- package/node_modules/zod/v4/core/json-schema.cjs +21 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +89 -0
- package/node_modules/zod/v4/core/json-schema.d.ts +89 -0
- package/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/zod/v4/core/memoizer.cjs +360 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +311 -0
- package/node_modules/zod/v4/core/package.json +7 -0
- package/node_modules/zod/v4/core/parse.cjs +233 -0
- package/node_modules/zod/v4/core/parse.d.cts +52 -0
- package/node_modules/zod/v4/core/parse.d.ts +52 -0
- package/node_modules/zod/v4/core/parse.js +175 -0
- package/node_modules/zod/v4/core/regexes.cjs +209 -0
- package/node_modules/zod/v4/core/regexes.d.cts +90 -0
- package/node_modules/zod/v4/core/regexes.d.ts +90 -0
- package/node_modules/zod/v4/core/regexes.js +156 -0
- package/node_modules/zod/v4/core/registries.cjs +75 -0
- package/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/zod/v4/core/registries.js +51 -0
- package/node_modules/zod/v4/core/schemas.cjs +2669 -0
- package/node_modules/zod/v4/core/schemas.d.cts +1273 -0
- package/node_modules/zod/v4/core/schemas.d.ts +1273 -0
- package/node_modules/zod/v4/core/schemas.js +2606 -0
- package/node_modules/zod/v4/core/standard-schema.cjs +21 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
- package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
- package/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +681 -0
- package/node_modules/zod/v4/core/to-json-schema.d.cts +154 -0
- package/node_modules/zod/v4/core/to-json-schema.d.ts +154 -0
- package/node_modules/zod/v4/core/to-json-schema.js +651 -0
- package/node_modules/zod/v4/core/util.cjs +949 -0
- package/node_modules/zod/v4/core/util.d.cts +278 -0
- package/node_modules/zod/v4/core/util.d.ts +278 -0
- package/node_modules/zod/v4/core/util.js +859 -0
- package/node_modules/zod/v4/core/versions.cjs +27 -0
- package/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/zod/v4/core/visit.cjs +214 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +51 -0
- package/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +4 -0
- package/node_modules/zod/v4/locales/ar.cjs +138 -0
- package/node_modules/zod/v4/locales/ar.d.cts +5 -0
- package/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/v4/locales/ar.js +111 -0
- package/node_modules/zod/v4/locales/az.cjs +137 -0
- package/node_modules/zod/v4/locales/az.d.cts +5 -0
- package/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/v4/locales/az.js +110 -0
- package/node_modules/zod/v4/locales/be.cjs +195 -0
- package/node_modules/zod/v4/locales/be.d.cts +5 -0
- package/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/v4/locales/be.js +168 -0
- package/node_modules/zod/v4/locales/bg.cjs +152 -0
- package/node_modules/zod/v4/locales/bg.d.cts +5 -0
- package/node_modules/zod/v4/locales/bg.d.ts +4 -0
- package/node_modules/zod/v4/locales/bg.js +125 -0
- package/node_modules/zod/v4/locales/bn.cjs +140 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +113 -0
- package/node_modules/zod/v4/locales/ca.cjs +139 -0
- package/node_modules/zod/v4/locales/ca.d.cts +5 -0
- package/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/v4/locales/ca.js +112 -0
- package/node_modules/zod/v4/locales/ckb.cjs +160 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +133 -0
- package/node_modules/zod/v4/locales/cs.cjs +143 -0
- package/node_modules/zod/v4/locales/cs.d.cts +5 -0
- package/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/v4/locales/cs.js +116 -0
- package/node_modules/zod/v4/locales/da.cjs +147 -0
- package/node_modules/zod/v4/locales/da.d.cts +5 -0
- package/node_modules/zod/v4/locales/da.d.ts +4 -0
- package/node_modules/zod/v4/locales/da.js +120 -0
- package/node_modules/zod/v4/locales/de.cjs +140 -0
- package/node_modules/zod/v4/locales/de.d.cts +5 -0
- package/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/v4/locales/de.js +113 -0
- package/node_modules/zod/v4/locales/el.cjs +139 -0
- package/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/zod/v4/locales/el.js +112 -0
- package/node_modules/zod/v4/locales/en.cjs +152 -0
- package/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/zod/v4/locales/en.d.ts +4 -0
- package/node_modules/zod/v4/locales/en.js +125 -0
- package/node_modules/zod/v4/locales/eo.cjs +141 -0
- package/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/zod/v4/locales/eo.d.ts +4 -0
- package/node_modules/zod/v4/locales/eo.js +114 -0
- package/node_modules/zod/v4/locales/es.cjs +163 -0
- package/node_modules/zod/v4/locales/es.d.cts +5 -0
- package/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/v4/locales/es.js +136 -0
- package/node_modules/zod/v4/locales/fa.cjs +146 -0
- package/node_modules/zod/v4/locales/fa.d.cts +5 -0
- package/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/v4/locales/fa.js +119 -0
- package/node_modules/zod/v4/locales/fi.cjs +144 -0
- package/node_modules/zod/v4/locales/fi.d.cts +5 -0
- package/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/v4/locales/fi.js +117 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +139 -0
- package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +112 -0
- package/node_modules/zod/v4/locales/fr.cjs +156 -0
- package/node_modules/zod/v4/locales/fr.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr.js +129 -0
- package/node_modules/zod/v4/locales/gu.cjs +140 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +113 -0
- package/node_modules/zod/v4/locales/he.cjs +248 -0
- package/node_modules/zod/v4/locales/he.d.cts +5 -0
- package/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/v4/locales/he.js +221 -0
- package/node_modules/zod/v4/locales/hi.cjs +138 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +111 -0
- package/node_modules/zod/v4/locales/hr.cjs +153 -0
- package/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/zod/v4/locales/hr.js +126 -0
- package/node_modules/zod/v4/locales/hu.cjs +140 -0
- package/node_modules/zod/v4/locales/hu.d.cts +5 -0
- package/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/v4/locales/hu.js +113 -0
- package/node_modules/zod/v4/locales/hy.cjs +185 -0
- package/node_modules/zod/v4/locales/hy.d.cts +5 -0
- package/node_modules/zod/v4/locales/hy.d.ts +4 -0
- package/node_modules/zod/v4/locales/hy.js +158 -0
- package/node_modules/zod/v4/locales/id.cjs +138 -0
- package/node_modules/zod/v4/locales/id.d.cts +5 -0
- package/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/v4/locales/id.js +111 -0
- package/node_modules/zod/v4/locales/index.cjs +152 -0
- package/node_modules/zod/v4/locales/index.d.cts +63 -0
- package/node_modules/zod/v4/locales/index.d.ts +63 -0
- package/node_modules/zod/v4/locales/index.js +63 -0
- package/node_modules/zod/v4/locales/is.cjs +141 -0
- package/node_modules/zod/v4/locales/is.d.cts +5 -0
- package/node_modules/zod/v4/locales/is.d.ts +4 -0
- package/node_modules/zod/v4/locales/is.js +114 -0
- package/node_modules/zod/v4/locales/it.cjs +140 -0
- package/node_modules/zod/v4/locales/it.d.cts +5 -0
- package/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/v4/locales/it.js +113 -0
- package/node_modules/zod/v4/locales/ja.cjs +139 -0
- package/node_modules/zod/v4/locales/ja.d.cts +5 -0
- package/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/v4/locales/ja.js +112 -0
- package/node_modules/zod/v4/locales/ka.cjs +144 -0
- package/node_modules/zod/v4/locales/ka.d.cts +5 -0
- package/node_modules/zod/v4/locales/ka.d.ts +4 -0
- package/node_modules/zod/v4/locales/ka.js +117 -0
- package/node_modules/zod/v4/locales/kh.cjs +12 -0
- package/node_modules/zod/v4/locales/kh.d.cts +5 -0
- package/node_modules/zod/v4/locales/kh.d.ts +5 -0
- package/node_modules/zod/v4/locales/kh.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +142 -0
- package/node_modules/zod/v4/locales/km.d.cts +5 -0
- package/node_modules/zod/v4/locales/km.d.ts +4 -0
- package/node_modules/zod/v4/locales/km.js +115 -0
- package/node_modules/zod/v4/locales/kn.cjs +143 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +116 -0
- package/node_modules/zod/v4/locales/ko.cjs +143 -0
- package/node_modules/zod/v4/locales/ko.d.cts +5 -0
- package/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/v4/locales/ko.js +116 -0
- package/node_modules/zod/v4/locales/lt.cjs +234 -0
- package/node_modules/zod/v4/locales/lt.d.cts +5 -0
- package/node_modules/zod/v4/locales/lt.d.ts +4 -0
- package/node_modules/zod/v4/locales/lt.js +207 -0
- package/node_modules/zod/v4/locales/mk.cjs +141 -0
- package/node_modules/zod/v4/locales/mk.d.cts +5 -0
- package/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/v4/locales/mk.js +114 -0
- package/node_modules/zod/v4/locales/ms.cjs +139 -0
- package/node_modules/zod/v4/locales/ms.d.cts +5 -0
- package/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/v4/locales/ms.js +112 -0
- package/node_modules/zod/v4/locales/ne.cjs +138 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +111 -0
- package/node_modules/zod/v4/locales/nl.cjs +142 -0
- package/node_modules/zod/v4/locales/nl.d.cts +5 -0
- package/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/v4/locales/nl.js +115 -0
- package/node_modules/zod/v4/locales/nn.cjs +140 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +113 -0
- package/node_modules/zod/v4/locales/no.cjs +140 -0
- package/node_modules/zod/v4/locales/no.d.cts +5 -0
- package/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/v4/locales/no.js +113 -0
- package/node_modules/zod/v4/locales/ota.cjs +141 -0
- package/node_modules/zod/v4/locales/ota.d.cts +5 -0
- package/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/v4/locales/ota.js +114 -0
- package/node_modules/zod/v4/locales/package.json +7 -0
- package/node_modules/zod/v4/locales/pl.cjs +141 -0
- package/node_modules/zod/v4/locales/pl.d.cts +5 -0
- package/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/v4/locales/pl.js +114 -0
- package/node_modules/zod/v4/locales/ps.cjs +146 -0
- package/node_modules/zod/v4/locales/ps.d.cts +5 -0
- package/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/v4/locales/ps.js +119 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +143 -0
- package/node_modules/zod/v4/locales/pt.cjs +169 -0
- package/node_modules/zod/v4/locales/pt.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt.js +142 -0
- package/node_modules/zod/v4/locales/ro.cjs +149 -0
- package/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/zod/v4/locales/ro.js +122 -0
- package/node_modules/zod/v4/locales/ru.cjs +195 -0
- package/node_modules/zod/v4/locales/ru.d.cts +5 -0
- package/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/v4/locales/ru.js +168 -0
- package/node_modules/zod/v4/locales/sk.cjs +143 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +116 -0
- package/node_modules/zod/v4/locales/sl.cjs +141 -0
- package/node_modules/zod/v4/locales/sl.d.cts +5 -0
- package/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/v4/locales/sl.js +114 -0
- package/node_modules/zod/v4/locales/sv.cjs +142 -0
- package/node_modules/zod/v4/locales/sv.d.cts +5 -0
- package/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/v4/locales/sv.js +115 -0
- package/node_modules/zod/v4/locales/ta.cjs +142 -0
- package/node_modules/zod/v4/locales/ta.d.cts +5 -0
- package/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/v4/locales/ta.js +115 -0
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +142 -0
- package/node_modules/zod/v4/locales/th.d.cts +5 -0
- package/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/v4/locales/th.js +115 -0
- package/node_modules/zod/v4/locales/tk.cjs +134 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +107 -0
- package/node_modules/zod/v4/locales/tr.cjs +137 -0
- package/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/zod/v4/locales/tr.d.ts +4 -0
- package/node_modules/zod/v4/locales/tr.js +110 -0
- package/node_modules/zod/v4/locales/ua.cjs +12 -0
- package/node_modules/zod/v4/locales/ua.d.cts +5 -0
- package/node_modules/zod/v4/locales/ua.d.ts +5 -0
- package/node_modules/zod/v4/locales/ua.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +140 -0
- package/node_modules/zod/v4/locales/uk.d.cts +5 -0
- package/node_modules/zod/v4/locales/uk.d.ts +4 -0
- package/node_modules/zod/v4/locales/uk.js +113 -0
- package/node_modules/zod/v4/locales/ur.cjs +142 -0
- package/node_modules/zod/v4/locales/ur.d.cts +5 -0
- package/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/v4/locales/ur.js +115 -0
- package/node_modules/zod/v4/locales/uz.cjs +140 -0
- package/node_modules/zod/v4/locales/uz.d.cts +5 -0
- package/node_modules/zod/v4/locales/uz.d.ts +4 -0
- package/node_modules/zod/v4/locales/uz.js +113 -0
- package/node_modules/zod/v4/locales/vi.cjs +140 -0
- package/node_modules/zod/v4/locales/vi.d.cts +5 -0
- package/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/v4/locales/vi.js +113 -0
- package/node_modules/zod/v4/locales/yo.cjs +139 -0
- package/node_modules/zod/v4/locales/yo.d.cts +5 -0
- package/node_modules/zod/v4/locales/yo.d.ts +4 -0
- package/node_modules/zod/v4/locales/yo.js +112 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +141 -0
- package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +114 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +139 -0
- package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +112 -0
- package/node_modules/zod/v4/mini/checks.cjs +54 -0
- package/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/zod/v4/mini/coerce.cjs +71 -0
- package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/v4/mini/coerce.js +22 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +95 -0
- package/node_modules/zod/v4/mini/external.d.cts +16 -0
- package/node_modules/zod/v4/mini/external.d.ts +16 -0
- package/node_modules/zod/v4/mini/external.js +16 -0
- package/node_modules/zod/v4/mini/in-out.cjs +82 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -0
- package/node_modules/zod/v4/mini/index.cjs +51 -0
- package/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/zod/v4/mini/iso.cjs +83 -0
- package/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/v4/mini/iso.js +34 -0
- package/node_modules/zod/v4/mini/package.json +7 -0
- package/node_modules/zod/v4/mini/parse.cjs +37 -0
- package/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/zod/v4/mini/schemas.cjs +1147 -0
- package/node_modules/zod/v4/mini/schemas.d.cts +480 -0
- package/node_modules/zod/v4/mini/schemas.d.ts +480 -0
- package/node_modules/zod/v4/mini/schemas.js +1002 -0
- package/node_modules/zod/v4/package.json +7 -0
- package/node_modules/zod/v4-mini/index.cjs +51 -0
- package/node_modules/zod/v4-mini/index.d.cts +3 -0
- package/node_modules/zod/v4-mini/index.d.ts +3 -0
- package/node_modules/zod/v4-mini/index.js +3 -0
- package/node_modules/zod/v4-mini/package.json +7 -0
- package/package.json +50 -0
|
@@ -0,0 +1,2683 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { a as runSessionQueueOwner, c as buildQueueOwnerArgOverride, g as __exportAll, h as isProcessAlive, l as flushPerfMetricsCapture, n as getTextErrorRemediationHints, o as runOnce, p as probeQueueOwnerHealth, t as createOutputFormatter, u as installPerfMetricsCapture } from "./output-CjdF5rHk.js";
|
|
3
|
+
import { At as listBuiltInAgents, Et as TimeoutError, G as listSessions, Gt as OUTPUT_FORMATS, H as findSession, It as normalizeOutputError, L as getAcpxVersion, Nt as exitCodeForOutputErrorCode, St as parsePromptSource, Tt as InterruptedError, U as findSessionByDirectoryWalk, V as findGitRepositoryRoot, Vt as EXIT_CODES, X as writeSessionRecord, Xt as AgentSpawnError, Yt as AcpxOperationalError, ct as normalizeRuntimeSessionId, ft as sessionEventActivePath, gt as isAcpJsonRpcMessage, jt as normalizeAgentName$1, kt as DEFAULT_AGENT_NAME, mt as sessionEventSegmentPath, ot as parseSessionRecord, pt as sessionEventLockPath, q as normalizeName, st as serializeSessionRecordForDisk, ut as defaultSessionEventLog, wt as textPrompt, xt as mergePromptSourceWithText, yt as PromptInputValidationError } from "./live-checkpoint-ClPCSdrW.js";
|
|
4
|
+
import { _ as resolveGlobalFlags, b as resolveSessionNameFromFlags, c as parseHistoryLimit, d as parseOutputFormat$1, f as parsePruneBeforeDate, g as resolveAgentInvocation, h as parseTtlSeconds, i as addSessionOption, l as parseMaxTurns, m as parseTimeoutSeconds, n as addPromptInputOption, o as parseAllowedTools, p as parseSessionName, r as addSessionNameOption, s as parseDaysOlderThan, t as addGlobalFlags, u as parseNonEmptyValue, v as resolveOutputPolicy, x as loadPermissionPolicySpec, y as resolvePermissionMode } from "./flags-Bjq_XQ4-.js";
|
|
5
|
+
import { realpathSync } from "node:fs";
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { Command, CommanderError, InvalidArgumentError, Option } from "commander";
|
|
9
|
+
import fs$1 from "node:fs/promises";
|
|
10
|
+
import os from "node:os";
|
|
11
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
12
|
+
import { ZodError, z } from "zod";
|
|
13
|
+
import { performance } from "node:perf_hooks";
|
|
14
|
+
//#region src/cli-public.ts
|
|
15
|
+
function configurePublicCli(options) {
|
|
16
|
+
const builtInAgents = options.listBuiltInAgents(options.config.agents);
|
|
17
|
+
for (const agentName of builtInAgents) options.registerAgentCommand(options.program, agentName, options.config);
|
|
18
|
+
options.registerDefaultCommands(options.program, options.config);
|
|
19
|
+
const scan = options.detectAgentToken(options.argv);
|
|
20
|
+
if (!scan.hasAgentOverride && scan.token && !options.topLevelVerbs.has(scan.token) && !builtInAgents.includes(scan.token)) options.registerAgentCommand(options.program, scan.token, options.config);
|
|
21
|
+
options.program.argument("[prompt...]", "Prompt text").action(async function(promptParts) {
|
|
22
|
+
if (promptParts.length === 0 && process.stdin.isTTY) {
|
|
23
|
+
if (options.requestedJsonStrict) throw new InvalidArgumentError("Prompt is required (pass as argument, --file, or pipe via stdin)");
|
|
24
|
+
this.outputHelp();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
await options.handlePromptAction(this, promptParts);
|
|
28
|
+
});
|
|
29
|
+
options.program.addHelpText("after", `
|
|
30
|
+
Examples:
|
|
31
|
+
acpx pi "review recent changes"
|
|
32
|
+
acpx openclaw exec "summarize active session state"
|
|
33
|
+
acpx codex sessions new
|
|
34
|
+
acpx codex "fix the tests"
|
|
35
|
+
acpx codex prompt "fix the tests"
|
|
36
|
+
acpx codex --no-wait "queue follow-up task"
|
|
37
|
+
acpx codex exec "what does this repo do"
|
|
38
|
+
acpx codex cancel
|
|
39
|
+
acpx codex set-mode plan
|
|
40
|
+
acpx codex set model 'gpt-5.2[high]'
|
|
41
|
+
acpx codex -s backend "fix the API"
|
|
42
|
+
acpx codex sessions
|
|
43
|
+
acpx codex sessions new --name backend
|
|
44
|
+
acpx codex sessions ensure --name backend
|
|
45
|
+
acpx codex sessions close backend
|
|
46
|
+
acpx codex status
|
|
47
|
+
acpx config show
|
|
48
|
+
acpx config init
|
|
49
|
+
acpx --ttl 30 codex "investigate flaky tests"
|
|
50
|
+
acpx claude "refactor auth"
|
|
51
|
+
acpx --agent ./my-custom-server "do something"`);
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/acp/codex-compat.ts
|
|
55
|
+
function isLegacyZedCodexAcpInvocation(agentCommand) {
|
|
56
|
+
return /@zed-industries\/codex-acp\b/u.test(agentCommand);
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/session/export.ts
|
|
60
|
+
var SessionExportError = class extends AcpxOperationalError {
|
|
61
|
+
code;
|
|
62
|
+
exitCode = 2;
|
|
63
|
+
constructor(message, code) {
|
|
64
|
+
super(message, {
|
|
65
|
+
outputCode: "USAGE",
|
|
66
|
+
detailCode: code,
|
|
67
|
+
origin: "cli"
|
|
68
|
+
});
|
|
69
|
+
this.code = code;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function sessionLookupError(message, code) {
|
|
73
|
+
return new SessionExportError(message, code);
|
|
74
|
+
}
|
|
75
|
+
async function loadSessionRecord(sessionLookup) {
|
|
76
|
+
const cwd = path.resolve(sessionLookup.cwd ?? process.cwd());
|
|
77
|
+
const name = normalizeName(sessionLookup.name);
|
|
78
|
+
if (sessionLookup.agentCommand) {
|
|
79
|
+
const active = await findSession({
|
|
80
|
+
agentCommand: sessionLookup.agentCommand,
|
|
81
|
+
cwd,
|
|
82
|
+
name
|
|
83
|
+
});
|
|
84
|
+
if (active) return active;
|
|
85
|
+
return (await listSessions()).find((session) => {
|
|
86
|
+
if (session.agentCommand !== sessionLookup.agentCommand || session.cwd !== cwd) return false;
|
|
87
|
+
if (name == null) return session.name == null;
|
|
88
|
+
return session.name === name;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const matches = (await listSessions()).filter((session) => {
|
|
92
|
+
if (session.cwd !== cwd) return false;
|
|
93
|
+
if (name == null) return session.name == null;
|
|
94
|
+
return session.name === name;
|
|
95
|
+
});
|
|
96
|
+
if (matches.length > 1) throw sessionLookupError("multiple sessions match export lookup", "ambiguous-session");
|
|
97
|
+
return matches[0];
|
|
98
|
+
}
|
|
99
|
+
function parseEventLockPayload(raw) {
|
|
100
|
+
try {
|
|
101
|
+
const parsed = JSON.parse(raw);
|
|
102
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
103
|
+
const record = parsed;
|
|
104
|
+
return { pid: typeof record.pid === "number" ? record.pid : void 0 };
|
|
105
|
+
} catch {
|
|
106
|
+
return {};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async function hasLiveEventLock(recordId) {
|
|
110
|
+
try {
|
|
111
|
+
return isProcessAlive(parseEventLockPayload(await fs$1.readFile(sessionEventLockPath(recordId), "utf8")).pid);
|
|
112
|
+
} catch (error) {
|
|
113
|
+
if (error.code === "ENOENT") return false;
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function isSessionActive(record) {
|
|
118
|
+
if (record.closed) return false;
|
|
119
|
+
return isProcessAlive(record.pid) || await hasLiveEventLock(record.acpxRecordId);
|
|
120
|
+
}
|
|
121
|
+
async function readHistoryFile(filePath) {
|
|
122
|
+
const payload = await fs$1.readFile(filePath, "utf8").catch((error) => {
|
|
123
|
+
if (error.code === "ENOENT") return "";
|
|
124
|
+
throw error;
|
|
125
|
+
});
|
|
126
|
+
const history = [];
|
|
127
|
+
for (const line of payload.split("\n").filter((entry) => entry.trim().length > 0)) try {
|
|
128
|
+
const parsed = JSON.parse(line);
|
|
129
|
+
if (isAcpJsonRpcMessage(parsed)) history.push(parsed);
|
|
130
|
+
} catch {}
|
|
131
|
+
return history;
|
|
132
|
+
}
|
|
133
|
+
async function readSessionHistory(record) {
|
|
134
|
+
const history = [];
|
|
135
|
+
const maxSegments = Number.isInteger(record.eventLog.max_segments) ? record.eventLog.max_segments : 0;
|
|
136
|
+
for (let segment = maxSegments; segment >= 1; segment -= 1) history.push(...await readHistoryFile(sessionEventSegmentPath(record.acpxRecordId, segment)));
|
|
137
|
+
history.push(...await readHistoryFile(sessionEventActivePath(record.acpxRecordId)));
|
|
138
|
+
return history;
|
|
139
|
+
}
|
|
140
|
+
function cwdRelativeToHome(cwd, home) {
|
|
141
|
+
const relative = path.relative(home, cwd);
|
|
142
|
+
if (relative.length === 0) return ".";
|
|
143
|
+
if (relative.length > 0 && !relative.startsWith("..") && !path.isAbsolute(relative)) return relative;
|
|
144
|
+
return cwd;
|
|
145
|
+
}
|
|
146
|
+
function serializeSessionRecordForArchive(record, cwdRelative) {
|
|
147
|
+
const state = serializeSessionRecordForDisk(record);
|
|
148
|
+
state.cwd = cwdRelative;
|
|
149
|
+
if (state.event_log && typeof state.event_log === "object" && !Array.isArray(state.event_log)) state.event_log = {
|
|
150
|
+
...state.event_log,
|
|
151
|
+
active_path: ".stream.ndjson"
|
|
152
|
+
};
|
|
153
|
+
return state;
|
|
154
|
+
}
|
|
155
|
+
async function exportSession(sessionLookup, outputPath) {
|
|
156
|
+
const record = await loadSessionRecord(sessionLookup);
|
|
157
|
+
if (!record) throw sessionLookupError("session not found", "not-found");
|
|
158
|
+
if (await isSessionActive(record)) throw sessionLookupError("session is currently locked by a running queue owner; close it first with `acpx sessions close`", "session-locked");
|
|
159
|
+
const home = os.homedir();
|
|
160
|
+
const cwdRelative = cwdRelativeToHome(record.cwd, home);
|
|
161
|
+
const exported = {
|
|
162
|
+
format_version: 1,
|
|
163
|
+
exported_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
164
|
+
exported_by: "acpx",
|
|
165
|
+
session: {
|
|
166
|
+
record_id: record.acpxRecordId,
|
|
167
|
+
name: record.name ?? null,
|
|
168
|
+
agent: record.agentCommand,
|
|
169
|
+
agent_name: normalizeAgentName(sessionLookup.agentName),
|
|
170
|
+
cwd_relative: cwdRelative,
|
|
171
|
+
cwd_original: cwdRelative,
|
|
172
|
+
created_at: record.createdAt,
|
|
173
|
+
updated_at: record.lastUsedAt,
|
|
174
|
+
state: serializeSessionRecordForArchive(record, cwdRelative)
|
|
175
|
+
},
|
|
176
|
+
history: await readSessionHistory(record)
|
|
177
|
+
};
|
|
178
|
+
await fs$1.mkdir(path.dirname(path.resolve(outputPath)), { recursive: true });
|
|
179
|
+
await fs$1.writeFile(outputPath, `${JSON.stringify(exported, null, 2)}\n`, "utf8");
|
|
180
|
+
}
|
|
181
|
+
function normalizeAgentName(agentName) {
|
|
182
|
+
const normalized = agentName?.trim().toLowerCase();
|
|
183
|
+
if (!normalized || normalized.length === 0) return;
|
|
184
|
+
return normalized === "factory-droid" || normalized === "factorydroid" ? "droid" : normalized;
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/session/import.ts
|
|
188
|
+
const SUPPORTED_FORMAT_VERSION = 1;
|
|
189
|
+
const exportedSessionSchema = z.object({
|
|
190
|
+
format_version: z.literal(SUPPORTED_FORMAT_VERSION),
|
|
191
|
+
exported_at: z.string(),
|
|
192
|
+
exported_by: z.string(),
|
|
193
|
+
session: z.object({
|
|
194
|
+
record_id: z.string(),
|
|
195
|
+
name: z.string().nullable(),
|
|
196
|
+
agent: z.string(),
|
|
197
|
+
agent_name: z.string().optional(),
|
|
198
|
+
cwd_relative: z.string(),
|
|
199
|
+
cwd_original: z.string().optional(),
|
|
200
|
+
cwd_absolute_original: z.string().optional(),
|
|
201
|
+
created_at: z.string(),
|
|
202
|
+
updated_at: z.string(),
|
|
203
|
+
state: z.unknown()
|
|
204
|
+
}),
|
|
205
|
+
history: z.array(z.unknown())
|
|
206
|
+
});
|
|
207
|
+
var SessionImportError = class extends AcpxOperationalError {
|
|
208
|
+
code;
|
|
209
|
+
exitCode = 2;
|
|
210
|
+
constructor(message, code) {
|
|
211
|
+
super(message, {
|
|
212
|
+
outputCode: "USAGE",
|
|
213
|
+
detailCode: code,
|
|
214
|
+
origin: "cli"
|
|
215
|
+
});
|
|
216
|
+
this.code = code;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
function importError(message, code) {
|
|
220
|
+
return new SessionImportError(message, code);
|
|
221
|
+
}
|
|
222
|
+
function parseArchiveJson(raw) {
|
|
223
|
+
try {
|
|
224
|
+
return JSON.parse(raw);
|
|
225
|
+
} catch (error) {
|
|
226
|
+
throw importError(`Invalid session export archive JSON: ${error instanceof Error ? error.message : String(error)}`, "invalid-archive");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function assertSupportedFormatVersion(parsed) {
|
|
230
|
+
const record = parsed && typeof parsed === "object" ? parsed : {};
|
|
231
|
+
if (record.format_version !== SUPPORTED_FORMAT_VERSION) throw importError(`Unsupported session export format_version ${String(record.format_version)}; supported version is ${SUPPORTED_FORMAT_VERSION}`, "unsupported-format-version");
|
|
232
|
+
}
|
|
233
|
+
function parseArchive(raw) {
|
|
234
|
+
const parsed = parseArchiveJson(raw);
|
|
235
|
+
assertSupportedFormatVersion(parsed);
|
|
236
|
+
try {
|
|
237
|
+
return exportedSessionSchema.parse(parsed);
|
|
238
|
+
} catch (error) {
|
|
239
|
+
if (error instanceof ZodError) throw importError(`Invalid session export archive: ${error.issues[0]?.message}`, "invalid-archive");
|
|
240
|
+
throw error;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
async function generateRecordId(sessionsDir) {
|
|
244
|
+
for (;;) {
|
|
245
|
+
const recordId = randomUUID();
|
|
246
|
+
const filePath = path.join(sessionsDir, `${encodeURIComponent(recordId)}.json`);
|
|
247
|
+
try {
|
|
248
|
+
await fs$1.access(filePath);
|
|
249
|
+
} catch (error) {
|
|
250
|
+
if (error.code === "ENOENT") return recordId;
|
|
251
|
+
throw error;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function resolveImportedCwd(cwdRelative, newCwd) {
|
|
256
|
+
if (newCwd) return path.resolve(newCwd);
|
|
257
|
+
if (path.isAbsolute(cwdRelative)) return cwdRelative;
|
|
258
|
+
return path.join(os.homedir(), cwdRelative);
|
|
259
|
+
}
|
|
260
|
+
function resolveImportedName(parsed, requestedName) {
|
|
261
|
+
return requestedName ?? parsed.session.name ?? void 0;
|
|
262
|
+
}
|
|
263
|
+
function assertExpectedAgentCommand(parsed, sourceRecord, options) {
|
|
264
|
+
const expectedAgentCommand = options.expectedAgentCommand;
|
|
265
|
+
if (!expectedAgentCommand) return;
|
|
266
|
+
const expectedAgentName = normalizeAgentIdentity(options.expectedAgentName);
|
|
267
|
+
const archiveAgentName = normalizeAgentIdentity(parsed.session.agent_name);
|
|
268
|
+
const archiveCommandMatches = agentCommandMatchesExpected(parsed.session.agent, expectedAgentCommand, expectedAgentName);
|
|
269
|
+
const stateCommandMatches = agentCommandMatchesExpected(sourceRecord.agentCommand, expectedAgentCommand, expectedAgentName);
|
|
270
|
+
if (archiveCommandMatches && stateCommandMatches && archiveAgentNameMatches({
|
|
271
|
+
archiveAgentName,
|
|
272
|
+
expectedAgentName,
|
|
273
|
+
archiveCommand: parsed.session.agent,
|
|
274
|
+
stateCommand: sourceRecord.agentCommand,
|
|
275
|
+
expectedAgentCommand
|
|
276
|
+
})) {
|
|
277
|
+
sourceRecord.agentCommand = expectedAgentCommand;
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
throw importError("Session export archive agent does not match the requested agent", "agent-mismatch");
|
|
281
|
+
}
|
|
282
|
+
function archiveAgentNameMatches(params) {
|
|
283
|
+
if (params.archiveCommand === params.expectedAgentCommand && params.stateCommand === params.expectedAgentCommand) return true;
|
|
284
|
+
return params.archiveAgentName == null || params.expectedAgentName == null || params.archiveAgentName === params.expectedAgentName;
|
|
285
|
+
}
|
|
286
|
+
function normalizeAgentIdentity(agentName) {
|
|
287
|
+
const normalized = agentName?.trim().toLowerCase();
|
|
288
|
+
if (!normalized || normalized.length === 0) return;
|
|
289
|
+
return normalized === "factory-droid" || normalized === "factorydroid" ? "droid" : normalized;
|
|
290
|
+
}
|
|
291
|
+
function agentCommandMatchesExpected(archivedCommand, expectedAgentCommand, expectedAgentName) {
|
|
292
|
+
if (archivedCommand === expectedAgentCommand) return true;
|
|
293
|
+
return expectedAgentName ? commandLooksLikeBuiltInAgent(archivedCommand, expectedAgentName) : false;
|
|
294
|
+
}
|
|
295
|
+
function commandLooksLikeBuiltInAgent(command, agentName) {
|
|
296
|
+
const normalized = command.trim();
|
|
297
|
+
switch (agentName) {
|
|
298
|
+
case "pi": return /(?:^|\s)pi-acp(?:@|\s|$)/.test(normalized);
|
|
299
|
+
case "codex": return /(?:^|\s)@agentclientprotocol\/codex-acp(?:@|\s|$)/.test(normalized);
|
|
300
|
+
case "claude": return /(?:^|\s)@agentclientprotocol\/claude-agent-acp(?:@|\s|$)/.test(normalized);
|
|
301
|
+
default: return false;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
async function assertDestinationScopeAvailable(record) {
|
|
305
|
+
if (!await findSession({
|
|
306
|
+
agentCommand: record.agentCommand,
|
|
307
|
+
cwd: record.cwd,
|
|
308
|
+
name: record.name
|
|
309
|
+
})) return;
|
|
310
|
+
throw importError("A session already exists for the import destination scope; pass --name or --cwd to import a separate copy", "session-scope-exists");
|
|
311
|
+
}
|
|
312
|
+
async function assertProviderSessionAvailable(record) {
|
|
313
|
+
if (!(await listSessions()).find((session) => session.acpSessionId === record.acpSessionId)) return;
|
|
314
|
+
throw importError("A local session already uses this provider session id; prune or remove the existing record before importing this archive", "session-provider-exists");
|
|
315
|
+
}
|
|
316
|
+
function buildImportedRecord(parsed, sourceRecord, options) {
|
|
317
|
+
const eventLog = {
|
|
318
|
+
...defaultSessionEventLog(options.newRecordId),
|
|
319
|
+
max_segment_bytes: sourceRecord.eventLog.max_segment_bytes,
|
|
320
|
+
max_segments: sourceRecord.eventLog.max_segments,
|
|
321
|
+
segment_count: parsed.history.length > 0 ? 1 : sourceRecord.eventLog.segment_count
|
|
322
|
+
};
|
|
323
|
+
return {
|
|
324
|
+
...sourceRecord,
|
|
325
|
+
acpxRecordId: options.newRecordId,
|
|
326
|
+
cwd: options.cwd,
|
|
327
|
+
name: resolveImportedName(parsed, options.name),
|
|
328
|
+
closed: false,
|
|
329
|
+
closedAt: void 0,
|
|
330
|
+
pid: void 0,
|
|
331
|
+
agentStartedAt: void 0,
|
|
332
|
+
lastAgentExitCode: void 0,
|
|
333
|
+
lastAgentExitSignal: void 0,
|
|
334
|
+
lastAgentExitAt: void 0,
|
|
335
|
+
lastAgentDisconnectReason: void 0,
|
|
336
|
+
eventLog,
|
|
337
|
+
importedFrom: {
|
|
338
|
+
recordId: parsed.session.record_id,
|
|
339
|
+
cwdOriginal: parsed.session.cwd_original ?? parsed.session.cwd_relative,
|
|
340
|
+
exportedBy: parsed.exported_by,
|
|
341
|
+
exportedAt: parsed.exported_at
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
async function importSession(archivePath, options = {}) {
|
|
346
|
+
const parsed = parseArchive(await fs$1.readFile(archivePath, "utf8"));
|
|
347
|
+
const sourceRecord = parseSessionRecord(parsed.session.state);
|
|
348
|
+
if (!sourceRecord) throw importError("Invalid session export archive: session.state is not a session record", "invalid-archive");
|
|
349
|
+
assertExpectedAgentCommand(parsed, sourceRecord, options);
|
|
350
|
+
const sessionsDir = path.join(os.homedir(), ".acpx", "sessions");
|
|
351
|
+
await fs$1.mkdir(sessionsDir, { recursive: true });
|
|
352
|
+
const cwd = resolveImportedCwd(parsed.session.cwd_relative, options.newCwd);
|
|
353
|
+
const newRecordId = await generateRecordId(sessionsDir);
|
|
354
|
+
const newRecord = buildImportedRecord(parsed, sourceRecord, {
|
|
355
|
+
newRecordId,
|
|
356
|
+
cwd,
|
|
357
|
+
name: options.name
|
|
358
|
+
});
|
|
359
|
+
await assertDestinationScopeAvailable(newRecord);
|
|
360
|
+
await assertProviderSessionAvailable(newRecord);
|
|
361
|
+
await writeSessionRecord(newRecord);
|
|
362
|
+
if (parsed.history.length > 0) {
|
|
363
|
+
const history = parsed.history;
|
|
364
|
+
await fs$1.writeFile(sessionEventActivePath(newRecordId), `${history.map((entry) => JSON.stringify(entry)).join("\n")}\n`, "utf8");
|
|
365
|
+
}
|
|
366
|
+
return {
|
|
367
|
+
record_id: newRecordId,
|
|
368
|
+
cwd
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
//#endregion
|
|
372
|
+
//#region src/cli/output/json-output.ts
|
|
373
|
+
function emitJsonResult(format, payload) {
|
|
374
|
+
if (format !== "json") return false;
|
|
375
|
+
process.stdout.write(`${JSON.stringify(payload)}\n`);
|
|
376
|
+
return true;
|
|
377
|
+
}
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/cli/command-handlers.ts
|
|
380
|
+
var NoSessionError = class extends Error {
|
|
381
|
+
constructor(message) {
|
|
382
|
+
super(message);
|
|
383
|
+
this.name = "NoSessionError";
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
let sessionModulePromise;
|
|
387
|
+
let outputModulePromise;
|
|
388
|
+
let outputRenderModulePromise;
|
|
389
|
+
function loadSessionModule() {
|
|
390
|
+
sessionModulePromise ??= import("./output-CjdF5rHk.js").then((n) => n.i);
|
|
391
|
+
return sessionModulePromise;
|
|
392
|
+
}
|
|
393
|
+
function loadOutputModule() {
|
|
394
|
+
outputModulePromise ??= import("./output-CjdF5rHk.js").then((n) => n.r);
|
|
395
|
+
return outputModulePromise;
|
|
396
|
+
}
|
|
397
|
+
function loadOutputRenderModule() {
|
|
398
|
+
outputRenderModulePromise ??= Promise.resolve().then(() => render_exports);
|
|
399
|
+
return outputRenderModulePromise;
|
|
400
|
+
}
|
|
401
|
+
async function readPromptInputFromStdin() {
|
|
402
|
+
let data = "";
|
|
403
|
+
for await (const chunk of process.stdin) data += String(chunk);
|
|
404
|
+
return data;
|
|
405
|
+
}
|
|
406
|
+
async function readPrompt(promptParts, filePath, cwd) {
|
|
407
|
+
try {
|
|
408
|
+
if (filePath) return await readPromptFromFile(filePath, cwd, promptParts);
|
|
409
|
+
const joined = promptParts.join(" ").trim();
|
|
410
|
+
if (joined.length > 0) return textPrompt(joined);
|
|
411
|
+
if (process.stdin.isTTY) throw new InvalidArgumentError("Prompt is required (pass as argument, --file, or pipe via stdin)");
|
|
412
|
+
const prompt = parsePromptSource(await readPromptInputFromStdin());
|
|
413
|
+
if (prompt.length === 0) throw new InvalidArgumentError("Prompt from stdin is empty");
|
|
414
|
+
return prompt;
|
|
415
|
+
} catch (error) {
|
|
416
|
+
if (error instanceof PromptInputValidationError) throw new InvalidArgumentError(error.message);
|
|
417
|
+
throw error;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
async function readPromptFromFile(filePath, cwd, promptParts) {
|
|
421
|
+
const prompt = mergePromptSourceWithText(filePath === "-" ? await readPromptInputFromStdin() : await fs$1.readFile(path.resolve(cwd, filePath), "utf8"), promptParts.join(" "));
|
|
422
|
+
if (prompt.length === 0) throw new InvalidArgumentError("Prompt from --file is empty");
|
|
423
|
+
return prompt;
|
|
424
|
+
}
|
|
425
|
+
function applyPermissionExitCode(result, quietOutput) {
|
|
426
|
+
const stats = result.permissionStats;
|
|
427
|
+
const deniedOrCancelled = stats.denied + stats.cancelled;
|
|
428
|
+
if (stats.requested > 0 && stats.approved === 0 && deniedOrCancelled > 0) {
|
|
429
|
+
process.exitCode = EXIT_CODES.PERMISSION_DENIED;
|
|
430
|
+
quietOutput?.onError({
|
|
431
|
+
code: "PERMISSION_DENIED",
|
|
432
|
+
origin: "runtime",
|
|
433
|
+
message: "Permission request denied or cancelled"
|
|
434
|
+
});
|
|
435
|
+
quietOutput?.flush();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
function resolveCompatibleConfigId(agent, configId) {
|
|
439
|
+
if (isLegacyZedCodexAcpInvocation(agent.agentCommand) && configId === "thought_level") return "reasoning_effort";
|
|
440
|
+
return configId;
|
|
441
|
+
}
|
|
442
|
+
function resolveRequestedOutputPolicy(globalFlags) {
|
|
443
|
+
return {
|
|
444
|
+
...resolveOutputPolicy(globalFlags.format, globalFlags.jsonStrict === true),
|
|
445
|
+
suppressReads: globalFlags.suppressReads === true
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
function sessionOptionsFromGlobalFlags$1(globalFlags) {
|
|
449
|
+
return {
|
|
450
|
+
model: globalFlags.model,
|
|
451
|
+
allowedTools: globalFlags.allowedTools,
|
|
452
|
+
maxTurns: globalFlags.maxTurns,
|
|
453
|
+
systemPrompt: globalFlags.systemPrompt
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
async function resolvePermissionPolicyFromFlags$1(globalFlags) {
|
|
457
|
+
try {
|
|
458
|
+
return await loadPermissionPolicySpec(globalFlags.permissionPolicy, globalFlags.cwd);
|
|
459
|
+
} catch (error) {
|
|
460
|
+
throw new InvalidArgumentError(`Invalid permission policy: ${error instanceof Error ? error.message : String(error)}`);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
function buildSessionStartOptions(params) {
|
|
464
|
+
return {
|
|
465
|
+
agentCommand: params.agent.agentCommand,
|
|
466
|
+
cwd: params.agent.cwd,
|
|
467
|
+
name: params.flags.name,
|
|
468
|
+
resumeSessionId: params.flags.resumeSession,
|
|
469
|
+
mcpServers: params.config.mcpServers,
|
|
470
|
+
permissionMode: params.permissionMode,
|
|
471
|
+
nonInteractivePermissions: params.globalFlags.nonInteractivePermissions,
|
|
472
|
+
permissionPolicy: params.permissionPolicy,
|
|
473
|
+
authCredentials: params.config.auth,
|
|
474
|
+
authPolicy: params.globalFlags.authPolicy,
|
|
475
|
+
terminal: params.globalFlags.terminal,
|
|
476
|
+
timeoutMs: params.globalFlags.timeout,
|
|
477
|
+
verbose: params.globalFlags.verbose,
|
|
478
|
+
sessionOptions: sessionOptionsFromGlobalFlags$1(params.globalFlags),
|
|
479
|
+
onModelWarning: params.globalFlags.jsonStrict ? void 0 : (message) => process.stderr.write(`[acpx] warning: ${message}\n`)
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
function resolveSessionListFilterCwd(flags, agentCwd) {
|
|
483
|
+
return flags.filterCwd ? path.resolve(agentCwd, flags.filterCwd) : void 0;
|
|
484
|
+
}
|
|
485
|
+
async function printLocalSessionsList(agentCommand, filterCwd, format) {
|
|
486
|
+
const [{ listSessionsForAgent }, { printSessionsByFormat }] = await Promise.all([loadSessionModule(), loadOutputRenderModule()]);
|
|
487
|
+
const sessions = await listSessionsForAgent(agentCommand);
|
|
488
|
+
printSessionsByFormat(filterCwd ? sessions.filter((session) => session.cwd === filterCwd) : sessions, format);
|
|
489
|
+
}
|
|
490
|
+
function missingScopedSessionMessage(agent, sessionName) {
|
|
491
|
+
return sessionName ? `No named session "${sessionName}" for cwd ${agent.cwd} and agent ${agent.agentName}` : `No cwd session for ${agent.cwd} and agent ${agent.agentName}`;
|
|
492
|
+
}
|
|
493
|
+
async function findScopedSessionOrThrow(agent, sessionName) {
|
|
494
|
+
const record = await findSession({
|
|
495
|
+
agentCommand: agent.agentCommand,
|
|
496
|
+
cwd: agent.cwd,
|
|
497
|
+
name: sessionName,
|
|
498
|
+
includeClosed: true
|
|
499
|
+
});
|
|
500
|
+
if (!record) throw new Error(missingScopedSessionMessage(agent, sessionName));
|
|
501
|
+
return record;
|
|
502
|
+
}
|
|
503
|
+
async function findRoutedSessionOrThrow(agentCommand, agentName, cwd, sessionName) {
|
|
504
|
+
const walkBoundary = findGitRepositoryRoot(cwd) ?? cwd;
|
|
505
|
+
const record = await findSessionByDirectoryWalk({
|
|
506
|
+
agentCommand,
|
|
507
|
+
cwd,
|
|
508
|
+
name: sessionName,
|
|
509
|
+
boundary: walkBoundary
|
|
510
|
+
});
|
|
511
|
+
if (record) return record;
|
|
512
|
+
throw new NoSessionError(`⚠ No acpx session found (searched up to ${walkBoundary}).\nCreate one: ${sessionName ? `acpx ${agentName} sessions new --name ${sessionName}` : `acpx ${agentName} sessions new`}`);
|
|
513
|
+
}
|
|
514
|
+
async function handlePrompt(explicitAgentName, promptParts, flags, command, config) {
|
|
515
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
516
|
+
const outputPolicy = resolveRequestedOutputPolicy(globalFlags);
|
|
517
|
+
const permissionMode = resolvePermissionMode(globalFlags, config.defaultPermissions);
|
|
518
|
+
const permissionPolicy = await resolvePermissionPolicyFromFlags$1(globalFlags);
|
|
519
|
+
const prompt = await readPrompt(promptParts, flags.file, globalFlags.cwd);
|
|
520
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
521
|
+
const [{ createOutputFormatter }, { printPromptSessionBanner, printQueuedPromptByFormat }, { sendSession }] = await Promise.all([
|
|
522
|
+
loadOutputModule(),
|
|
523
|
+
loadOutputRenderModule(),
|
|
524
|
+
loadSessionModule()
|
|
525
|
+
]);
|
|
526
|
+
const record = await findRoutedSessionOrThrow(agent.agentCommand, agent.agentName, agent.cwd, resolveSessionNameFromFlags(flags, command));
|
|
527
|
+
const outputFormatter = createOutputFormatter(outputPolicy.format, {
|
|
528
|
+
jsonContext: { sessionId: record.acpxRecordId },
|
|
529
|
+
suppressReads: outputPolicy.suppressReads
|
|
530
|
+
});
|
|
531
|
+
await printPromptSessionBanner(record, agent.cwd, outputPolicy.format, outputPolicy.jsonStrict);
|
|
532
|
+
const result = await sendSession({
|
|
533
|
+
sessionId: record.acpxRecordId,
|
|
534
|
+
prompt,
|
|
535
|
+
mcpServers: config.mcpServers,
|
|
536
|
+
mcpConfigPath: config.mcpConfigPath,
|
|
537
|
+
mcpConfigFingerprint: config.mcpConfigFingerprint,
|
|
538
|
+
permissionMode,
|
|
539
|
+
nonInteractivePermissions: globalFlags.nonInteractivePermissions,
|
|
540
|
+
permissionPolicy,
|
|
541
|
+
authCredentials: config.auth,
|
|
542
|
+
authPolicy: globalFlags.authPolicy,
|
|
543
|
+
terminal: globalFlags.terminal,
|
|
544
|
+
outputFormatter,
|
|
545
|
+
errorEmissionPolicy: { queueErrorAlreadyEmitted: outputPolicy.queueErrorAlreadyEmitted },
|
|
546
|
+
suppressSdkConsoleErrors: outputPolicy.suppressSdkConsoleErrors,
|
|
547
|
+
timeoutMs: globalFlags.timeout,
|
|
548
|
+
ttlMs: globalFlags.ttl,
|
|
549
|
+
maxQueueDepth: config.queueMaxDepth,
|
|
550
|
+
promptRetries: globalFlags.promptRetries,
|
|
551
|
+
verbose: globalFlags.verbose,
|
|
552
|
+
waitForCompletion: flags.wait !== false,
|
|
553
|
+
sessionOptions: {
|
|
554
|
+
model: globalFlags.model,
|
|
555
|
+
allowedTools: globalFlags.allowedTools,
|
|
556
|
+
maxTurns: globalFlags.maxTurns,
|
|
557
|
+
systemPrompt: globalFlags.systemPrompt
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
if ("queued" in result) {
|
|
561
|
+
printQueuedPromptByFormat(result, outputPolicy.format);
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
applyPermissionExitCode(result, outputPolicy.format === "quiet" ? outputFormatter : void 0);
|
|
565
|
+
if (globalFlags.verbose && result.loadError) process.stderr.write(`[acpx] session reconnect failed, started fresh session: ${result.loadError}\n`);
|
|
566
|
+
}
|
|
567
|
+
async function handleExec(explicitAgentName, promptParts, flags, command, config) {
|
|
568
|
+
if (config.disableExec) {
|
|
569
|
+
if (resolveRequestedOutputPolicy(resolveGlobalFlags(command, config)).format === "json") process.stdout.write(`${JSON.stringify({
|
|
570
|
+
jsonrpc: "2.0",
|
|
571
|
+
error: {
|
|
572
|
+
code: -32603,
|
|
573
|
+
message: "exec subcommand is disabled by configuration (disableExec: true)",
|
|
574
|
+
data: { acpxCode: "EXEC_DISABLED" }
|
|
575
|
+
}
|
|
576
|
+
})}\n`);
|
|
577
|
+
else process.stderr.write("Error: exec subcommand is disabled by configuration (disableExec: true)\n");
|
|
578
|
+
process.exitCode = 1;
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
582
|
+
const outputPolicy = resolveRequestedOutputPolicy(globalFlags);
|
|
583
|
+
const permissionMode = resolvePermissionMode(globalFlags, config.defaultPermissions);
|
|
584
|
+
const permissionPolicy = await resolvePermissionPolicyFromFlags$1(globalFlags);
|
|
585
|
+
const prompt = await readPrompt(promptParts, flags.file, globalFlags.cwd);
|
|
586
|
+
const [{ createOutputFormatter }, { runOnce }] = await Promise.all([loadOutputModule(), loadSessionModule()]);
|
|
587
|
+
const outputFormatter = createOutputFormatter(outputPolicy.format, { suppressReads: outputPolicy.suppressReads });
|
|
588
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
589
|
+
applyPermissionExitCode(await runOnce({
|
|
590
|
+
agentCommand: agent.agentCommand,
|
|
591
|
+
cwd: agent.cwd,
|
|
592
|
+
prompt,
|
|
593
|
+
mcpServers: config.mcpServers,
|
|
594
|
+
permissionMode,
|
|
595
|
+
nonInteractivePermissions: globalFlags.nonInteractivePermissions,
|
|
596
|
+
permissionPolicy,
|
|
597
|
+
authCredentials: config.auth,
|
|
598
|
+
authPolicy: globalFlags.authPolicy,
|
|
599
|
+
terminal: globalFlags.terminal,
|
|
600
|
+
outputFormatter,
|
|
601
|
+
errorEmissionPolicy: { queueErrorAlreadyEmitted: outputPolicy.queueErrorAlreadyEmitted },
|
|
602
|
+
suppressSdkConsoleErrors: outputPolicy.suppressSdkConsoleErrors,
|
|
603
|
+
timeoutMs: globalFlags.timeout,
|
|
604
|
+
verbose: globalFlags.verbose,
|
|
605
|
+
promptRetries: globalFlags.promptRetries,
|
|
606
|
+
sessionOptions: {
|
|
607
|
+
model: globalFlags.model,
|
|
608
|
+
allowedTools: globalFlags.allowedTools,
|
|
609
|
+
maxTurns: globalFlags.maxTurns,
|
|
610
|
+
systemPrompt: globalFlags.systemPrompt
|
|
611
|
+
}
|
|
612
|
+
}), outputPolicy.format === "quiet" ? outputFormatter : void 0);
|
|
613
|
+
}
|
|
614
|
+
function printCancelResultByFormat(result, format) {
|
|
615
|
+
if (emitJsonResult(format, {
|
|
616
|
+
action: "cancel_result",
|
|
617
|
+
acpxRecordId: result.sessionId || "unknown",
|
|
618
|
+
cancelled: result.cancelled
|
|
619
|
+
})) return;
|
|
620
|
+
process.stdout.write(result.cancelled ? "cancel requested\n" : "nothing to cancel\n");
|
|
621
|
+
}
|
|
622
|
+
function printSetModeResultByFormat(modeId, result, format) {
|
|
623
|
+
if (emitJsonResult(format, {
|
|
624
|
+
action: "mode_set",
|
|
625
|
+
modeId,
|
|
626
|
+
resumed: result.resumed,
|
|
627
|
+
acpxRecordId: result.record.acpxRecordId,
|
|
628
|
+
acpxSessionId: result.record.acpSessionId,
|
|
629
|
+
agentSessionId: result.record.agentSessionId
|
|
630
|
+
})) return;
|
|
631
|
+
process.stdout.write(format === "quiet" ? `${modeId}\n` : `mode set: ${modeId}\n`);
|
|
632
|
+
}
|
|
633
|
+
function printSetModelResultByFormat(modelId, result, format) {
|
|
634
|
+
if (emitJsonResult(format, {
|
|
635
|
+
action: "model_set",
|
|
636
|
+
modelId,
|
|
637
|
+
resumed: result.resumed,
|
|
638
|
+
acpxRecordId: result.record.acpxRecordId,
|
|
639
|
+
acpxSessionId: result.record.acpSessionId,
|
|
640
|
+
agentSessionId: result.record.agentSessionId
|
|
641
|
+
})) return;
|
|
642
|
+
process.stdout.write(format === "quiet" ? `${modelId}\n` : `model set: ${modelId}\n`);
|
|
643
|
+
}
|
|
644
|
+
function printSetConfigOptionResultByFormat(configId, value, result, format) {
|
|
645
|
+
if (emitJsonResult(format, {
|
|
646
|
+
action: "config_set",
|
|
647
|
+
configId,
|
|
648
|
+
value,
|
|
649
|
+
resumed: result.resumed,
|
|
650
|
+
configOptions: result.response.configOptions,
|
|
651
|
+
acpxRecordId: result.record.acpxRecordId,
|
|
652
|
+
acpxSessionId: result.record.acpSessionId,
|
|
653
|
+
agentSessionId: result.record.agentSessionId
|
|
654
|
+
})) return;
|
|
655
|
+
process.stdout.write(format === "quiet" ? `${value}\n` : `config set: ${configId}=${value} (${result.response.configOptions.length} options)\n`);
|
|
656
|
+
}
|
|
657
|
+
async function handleCancel(explicitAgentName, flags, command, config) {
|
|
658
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
659
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
660
|
+
const { cancelSessionPrompt } = await loadSessionModule();
|
|
661
|
+
const walkBoundary = findGitRepositoryRoot(agent.cwd) ?? agent.cwd;
|
|
662
|
+
const record = await findSessionByDirectoryWalk({
|
|
663
|
+
agentCommand: agent.agentCommand,
|
|
664
|
+
cwd: agent.cwd,
|
|
665
|
+
name: resolveSessionNameFromFlags(flags, command),
|
|
666
|
+
boundary: walkBoundary
|
|
667
|
+
});
|
|
668
|
+
if (!record) {
|
|
669
|
+
printCancelResultByFormat({
|
|
670
|
+
sessionId: "",
|
|
671
|
+
cancelled: false
|
|
672
|
+
}, globalFlags.format);
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
printCancelResultByFormat(await cancelSessionPrompt({
|
|
676
|
+
sessionId: record.acpxRecordId,
|
|
677
|
+
verbose: globalFlags.verbose
|
|
678
|
+
}), globalFlags.format);
|
|
679
|
+
}
|
|
680
|
+
async function handleSetMode(explicitAgentName, modeId, flags, command, config) {
|
|
681
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
682
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
683
|
+
const { setSessionMode } = await loadSessionModule();
|
|
684
|
+
const result = await setSessionMode({
|
|
685
|
+
sessionId: (await findRoutedSessionOrThrow(agent.agentCommand, agent.agentName, agent.cwd, resolveSessionNameFromFlags(flags, command))).acpxRecordId,
|
|
686
|
+
modeId,
|
|
687
|
+
mcpServers: config.mcpServers,
|
|
688
|
+
nonInteractivePermissions: globalFlags.nonInteractivePermissions,
|
|
689
|
+
authCredentials: config.auth,
|
|
690
|
+
authPolicy: globalFlags.authPolicy,
|
|
691
|
+
terminal: globalFlags.terminal,
|
|
692
|
+
timeoutMs: globalFlags.timeout,
|
|
693
|
+
verbose: globalFlags.verbose
|
|
694
|
+
});
|
|
695
|
+
if (globalFlags.verbose && result.loadError) process.stderr.write(`[acpx] session reconnect failed, started fresh session: ${result.loadError}\n`);
|
|
696
|
+
printSetModeResultByFormat(modeId, result, globalFlags.format);
|
|
697
|
+
}
|
|
698
|
+
async function handleSetModel(explicitAgentName, modelId, flags, command, config) {
|
|
699
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
700
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
701
|
+
const { setSessionModel } = await loadSessionModule();
|
|
702
|
+
const result = await setSessionModel({
|
|
703
|
+
sessionId: (await findRoutedSessionOrThrow(agent.agentCommand, agent.agentName, agent.cwd, resolveSessionNameFromFlags(flags, command))).acpxRecordId,
|
|
704
|
+
modelId,
|
|
705
|
+
mcpServers: config.mcpServers,
|
|
706
|
+
nonInteractivePermissions: globalFlags.nonInteractivePermissions,
|
|
707
|
+
authCredentials: config.auth,
|
|
708
|
+
authPolicy: globalFlags.authPolicy,
|
|
709
|
+
terminal: globalFlags.terminal,
|
|
710
|
+
timeoutMs: globalFlags.timeout,
|
|
711
|
+
verbose: globalFlags.verbose
|
|
712
|
+
});
|
|
713
|
+
if (globalFlags.verbose && result.loadError) process.stderr.write(`[acpx] session reconnect failed, started fresh session: ${result.loadError}\n`);
|
|
714
|
+
printSetModelResultByFormat(modelId, result, globalFlags.format);
|
|
715
|
+
}
|
|
716
|
+
async function handleSetConfigOption(explicitAgentName, configId, value, flags, command, config) {
|
|
717
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
718
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
719
|
+
if (configId === "model") {
|
|
720
|
+
await handleSetModel(explicitAgentName, value, flags, command, config);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
const resolvedConfigId = resolveCompatibleConfigId(agent, configId);
|
|
724
|
+
const { setSessionConfigOption } = await loadSessionModule();
|
|
725
|
+
const result = await setSessionConfigOption({
|
|
726
|
+
sessionId: (await findRoutedSessionOrThrow(agent.agentCommand, agent.agentName, agent.cwd, resolveSessionNameFromFlags(flags, command))).acpxRecordId,
|
|
727
|
+
configId: resolvedConfigId,
|
|
728
|
+
value,
|
|
729
|
+
mcpServers: config.mcpServers,
|
|
730
|
+
nonInteractivePermissions: globalFlags.nonInteractivePermissions,
|
|
731
|
+
authCredentials: config.auth,
|
|
732
|
+
authPolicy: globalFlags.authPolicy,
|
|
733
|
+
terminal: globalFlags.terminal,
|
|
734
|
+
timeoutMs: globalFlags.timeout,
|
|
735
|
+
verbose: globalFlags.verbose
|
|
736
|
+
});
|
|
737
|
+
if (globalFlags.verbose && result.loadError) process.stderr.write(`[acpx] session reconnect failed, started fresh session: ${result.loadError}\n`);
|
|
738
|
+
printSetConfigOptionResultByFormat(configId, value, result, globalFlags.format);
|
|
739
|
+
}
|
|
740
|
+
async function tryListAgentSessions(agent, flags, globalFlags, config) {
|
|
741
|
+
const permissionMode = resolvePermissionMode(globalFlags, config.defaultPermissions);
|
|
742
|
+
const permissionPolicy = await resolvePermissionPolicyFromFlags$1(globalFlags);
|
|
743
|
+
const { listAgentSessions } = await loadSessionModule();
|
|
744
|
+
try {
|
|
745
|
+
return await listAgentSessions({
|
|
746
|
+
agentCommand: agent.agentCommand,
|
|
747
|
+
cwd: agent.cwd,
|
|
748
|
+
cursor: flags.cursor,
|
|
749
|
+
filterCwd: resolveSessionListFilterCwd(flags, agent.cwd),
|
|
750
|
+
mcpServers: config.mcpServers,
|
|
751
|
+
permissionMode,
|
|
752
|
+
nonInteractivePermissions: globalFlags.nonInteractivePermissions,
|
|
753
|
+
permissionPolicy,
|
|
754
|
+
authCredentials: config.auth,
|
|
755
|
+
authPolicy: globalFlags.authPolicy,
|
|
756
|
+
terminal: globalFlags.terminal,
|
|
757
|
+
timeoutMs: globalFlags.timeout,
|
|
758
|
+
verbose: globalFlags.verbose
|
|
759
|
+
});
|
|
760
|
+
} catch (error) {
|
|
761
|
+
if (error instanceof AgentSpawnError) return "spawn-failed";
|
|
762
|
+
throw error;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
async function handleSessionsList(explicitAgentName, flags, command, config) {
|
|
766
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
767
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
768
|
+
const filterCwd = resolveSessionListFilterCwd(flags, agent.cwd);
|
|
769
|
+
if (flags.local) {
|
|
770
|
+
if (flags.cursor) throw new InvalidArgumentError("--cursor cannot be combined with --local");
|
|
771
|
+
await printLocalSessionsList(agent.agentCommand, filterCwd, globalFlags.format);
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
const [result, { printAgentSessionsByFormat }] = await Promise.all([tryListAgentSessions(agent, flags, globalFlags, config), loadOutputRenderModule()]);
|
|
775
|
+
if (!result || result === "spawn-failed") {
|
|
776
|
+
if (result !== "spawn-failed" && (flags.cursor || flags.filterCwd)) throw new Error(`Agent command "${agent.agentCommand}" does not advertise sessionCapabilities.list; cannot use agent-side session/list filters`);
|
|
777
|
+
await printLocalSessionsList(agent.agentCommand, void 0, globalFlags.format);
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
printAgentSessionsByFormat(result, globalFlags.format);
|
|
781
|
+
}
|
|
782
|
+
async function handleSessionsClose(explicitAgentName, sessionName, command, config) {
|
|
783
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
784
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
785
|
+
const [{ closeSession }, { printClosedSessionByFormat }] = await Promise.all([loadSessionModule(), loadOutputRenderModule()]);
|
|
786
|
+
const record = await findSession({
|
|
787
|
+
agentCommand: agent.agentCommand,
|
|
788
|
+
cwd: agent.cwd,
|
|
789
|
+
name: sessionName
|
|
790
|
+
});
|
|
791
|
+
if (!record) throw new Error(missingScopedSessionMessage(agent, sessionName));
|
|
792
|
+
printClosedSessionByFormat(await closeSession(record.acpxRecordId), globalFlags.format);
|
|
793
|
+
}
|
|
794
|
+
async function handleSessionsNew(explicitAgentName, flags, command, config) {
|
|
795
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
796
|
+
const permissionMode = resolvePermissionMode(globalFlags, config.defaultPermissions);
|
|
797
|
+
const permissionPolicy = await resolvePermissionPolicyFromFlags$1(globalFlags);
|
|
798
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
799
|
+
const [{ createSession, closeSession }, { printCreatedSessionBanner, printNewSessionByFormat }] = await Promise.all([loadSessionModule(), loadOutputRenderModule()]);
|
|
800
|
+
const replaced = await findSession({
|
|
801
|
+
agentCommand: agent.agentCommand,
|
|
802
|
+
cwd: agent.cwd,
|
|
803
|
+
name: flags.name
|
|
804
|
+
});
|
|
805
|
+
if (replaced) {
|
|
806
|
+
await closeSession(replaced.acpxRecordId);
|
|
807
|
+
if (globalFlags.verbose) process.stderr.write(`[acpx] soft-closed prior session: ${replaced.acpxRecordId}\n`);
|
|
808
|
+
}
|
|
809
|
+
const created = await createSession(buildSessionStartOptions({
|
|
810
|
+
agent,
|
|
811
|
+
flags,
|
|
812
|
+
globalFlags,
|
|
813
|
+
config,
|
|
814
|
+
permissionMode,
|
|
815
|
+
permissionPolicy
|
|
816
|
+
}));
|
|
817
|
+
printCreatedSessionBanner(created, agent.agentName, globalFlags.format, globalFlags.jsonStrict);
|
|
818
|
+
if (globalFlags.verbose) {
|
|
819
|
+
const scope = flags.name ? `named session "${flags.name}"` : "cwd session";
|
|
820
|
+
process.stderr.write(`[acpx] created ${scope}: ${created.acpxRecordId}\n`);
|
|
821
|
+
}
|
|
822
|
+
printNewSessionByFormat(created, replaced, globalFlags.format);
|
|
823
|
+
}
|
|
824
|
+
async function handleSessionsEnsure(explicitAgentName, flags, command, config) {
|
|
825
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
826
|
+
const permissionMode = resolvePermissionMode(globalFlags, config.defaultPermissions);
|
|
827
|
+
const permissionPolicy = await resolvePermissionPolicyFromFlags$1(globalFlags);
|
|
828
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
829
|
+
const [{ ensureSession }, { printCreatedSessionBanner, printEnsuredSessionByFormat }] = await Promise.all([loadSessionModule(), loadOutputRenderModule()]);
|
|
830
|
+
const result = await ensureSession(buildSessionStartOptions({
|
|
831
|
+
agent,
|
|
832
|
+
flags,
|
|
833
|
+
globalFlags,
|
|
834
|
+
config,
|
|
835
|
+
permissionMode,
|
|
836
|
+
permissionPolicy
|
|
837
|
+
}));
|
|
838
|
+
if (result.created) printCreatedSessionBanner(result.record, agent.agentName, globalFlags.format, globalFlags.jsonStrict);
|
|
839
|
+
printEnsuredSessionByFormat(result.record, result.created, globalFlags.format);
|
|
840
|
+
}
|
|
841
|
+
function userContentToText(content) {
|
|
842
|
+
if ("Text" in content) return content.Text;
|
|
843
|
+
if ("Mention" in content) return content.Mention.content;
|
|
844
|
+
if ("Image" in content) return content.Image.source || "[image]";
|
|
845
|
+
if ("Audio" in content) return `[audio] ${content.Audio.mime_type || "audio"}`;
|
|
846
|
+
return "";
|
|
847
|
+
}
|
|
848
|
+
function agentContentToText(content) {
|
|
849
|
+
if ("Text" in content) return content.Text;
|
|
850
|
+
if ("Thinking" in content) return content.Thinking.text;
|
|
851
|
+
if ("RedactedThinking" in content) return "[redacted_thinking]";
|
|
852
|
+
if ("ToolUse" in content) return `[tool:${content.ToolUse.name}]`;
|
|
853
|
+
return "";
|
|
854
|
+
}
|
|
855
|
+
function conversationHistoryEntries(record) {
|
|
856
|
+
const entries = [];
|
|
857
|
+
for (const message of record.messages) {
|
|
858
|
+
if (message === "Resume") continue;
|
|
859
|
+
if ("User" in message) {
|
|
860
|
+
const text = message.User.content.map((entry) => userContentToText(entry)).join(" ").trim();
|
|
861
|
+
if (!text) continue;
|
|
862
|
+
entries.push({
|
|
863
|
+
role: "user",
|
|
864
|
+
timestamp: record.updated_at,
|
|
865
|
+
textPreview: text
|
|
866
|
+
});
|
|
867
|
+
continue;
|
|
868
|
+
}
|
|
869
|
+
if ("Agent" in message) {
|
|
870
|
+
const text = message.Agent.content.map((entry) => agentContentToText(entry)).join(" ").trim();
|
|
871
|
+
if (!text) continue;
|
|
872
|
+
entries.push({
|
|
873
|
+
role: "assistant",
|
|
874
|
+
timestamp: record.updated_at,
|
|
875
|
+
textPreview: text
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
return entries;
|
|
880
|
+
}
|
|
881
|
+
function printSessionDetailsByFormat(record, format) {
|
|
882
|
+
if (format === "json") {
|
|
883
|
+
process.stdout.write(`${JSON.stringify(record)}\n`);
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
if (format === "quiet") {
|
|
887
|
+
process.stdout.write(`${record.acpxRecordId}\n`);
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
for (const line of sessionDetailsLines(record)) process.stdout.write(`${line}\n`);
|
|
891
|
+
}
|
|
892
|
+
function sessionDetailsLines(record) {
|
|
893
|
+
return [
|
|
894
|
+
`id: ${record.acpxRecordId}`,
|
|
895
|
+
`sessionId: ${record.acpSessionId}`,
|
|
896
|
+
`agentSessionId: ${displayValue(record.agentSessionId)}`,
|
|
897
|
+
`agent: ${record.agentCommand}`,
|
|
898
|
+
`cwd: ${record.cwd}`,
|
|
899
|
+
`name: ${displayValue(record.name)}`,
|
|
900
|
+
`created: ${record.createdAt}`,
|
|
901
|
+
`lastActivity: ${record.lastUsedAt}`,
|
|
902
|
+
`lastPrompt: ${displayValue(record.lastPromptAt)}`,
|
|
903
|
+
`closed: ${record.closed ? "yes" : "no"}`,
|
|
904
|
+
`closedAt: ${displayValue(record.closedAt)}`,
|
|
905
|
+
`pid: ${displayValue(record.pid)}`,
|
|
906
|
+
`agentStartedAt: ${displayValue(record.agentStartedAt)}`,
|
|
907
|
+
`lastExitCode: ${displayValue(record.lastAgentExitCode)}`,
|
|
908
|
+
`lastExitSignal: ${displayValue(record.lastAgentExitSignal)}`,
|
|
909
|
+
`lastExitAt: ${displayValue(record.lastAgentExitAt)}`,
|
|
910
|
+
`disconnectReason: ${displayValue(record.lastAgentDisconnectReason)}`,
|
|
911
|
+
`historyEntries: ${conversationHistoryEntries(record).length}`
|
|
912
|
+
];
|
|
913
|
+
}
|
|
914
|
+
function displayValue(value) {
|
|
915
|
+
return value == null ? "-" : String(value);
|
|
916
|
+
}
|
|
917
|
+
function printSessionHistoryByFormat(record, limit, format) {
|
|
918
|
+
const history = conversationHistoryEntries(record);
|
|
919
|
+
const visible = limit === 0 ? history : history.slice(Math.max(0, history.length - limit));
|
|
920
|
+
if (format === "json") {
|
|
921
|
+
process.stdout.write(`${JSON.stringify({
|
|
922
|
+
id: record.acpxRecordId,
|
|
923
|
+
sessionId: record.acpSessionId,
|
|
924
|
+
limit,
|
|
925
|
+
count: visible.length,
|
|
926
|
+
entries: visible
|
|
927
|
+
})}\n`);
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
930
|
+
if (format === "quiet") {
|
|
931
|
+
for (const entry of visible) process.stdout.write(`${entry.textPreview}\n`);
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
process.stdout.write(`session: ${record.acpxRecordId} (${visible.length}/${history.length} shown)\n`);
|
|
935
|
+
if (visible.length === 0) {
|
|
936
|
+
process.stdout.write("No history\n");
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
for (const entry of visible) process.stdout.write(`${entry.timestamp}\t${entry.role}\t${entry.textPreview}\n`);
|
|
940
|
+
}
|
|
941
|
+
async function handleSessionsShow(explicitAgentName, sessionName, command, config) {
|
|
942
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
943
|
+
printSessionDetailsByFormat(await findScopedSessionOrThrow(resolveAgentInvocation(explicitAgentName, globalFlags, config), sessionName), globalFlags.format);
|
|
944
|
+
}
|
|
945
|
+
async function handleSessionsHistory(explicitAgentName, sessionName, flags, command, config) {
|
|
946
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
947
|
+
printSessionHistoryByFormat(await findScopedSessionOrThrow(resolveAgentInvocation(explicitAgentName, globalFlags, config), sessionName), flags.limit, globalFlags.format);
|
|
948
|
+
}
|
|
949
|
+
async function handleSessionsExport(explicitAgentName, sessionName, flags, command, config) {
|
|
950
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
951
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
952
|
+
const cwd = flags.sourceCwd ? path.resolve(agent.cwd, flags.sourceCwd) : agent.cwd;
|
|
953
|
+
await exportSession({
|
|
954
|
+
agentName: globalFlags.agent ? void 0 : agent.agentName,
|
|
955
|
+
agentCommand: agent.agentCommand,
|
|
956
|
+
cwd,
|
|
957
|
+
name: sessionName
|
|
958
|
+
}, flags.output);
|
|
959
|
+
if (emitJsonResult(globalFlags.format, {
|
|
960
|
+
action: "session_exported",
|
|
961
|
+
output: flags.output
|
|
962
|
+
})) return;
|
|
963
|
+
if (globalFlags.format === "quiet") {
|
|
964
|
+
process.stdout.write(`${flags.output}\n`);
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
process.stdout.write(`exported session to ${flags.output}\n`);
|
|
968
|
+
}
|
|
969
|
+
async function handleSessionsImport(explicitAgentName, archivePath, flags, command, config) {
|
|
970
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
971
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
972
|
+
const result = await importSession(archivePath, {
|
|
973
|
+
name: flags.name,
|
|
974
|
+
newCwd: flags.destinationCwd ? path.resolve(globalFlags.cwd, flags.destinationCwd) : void 0,
|
|
975
|
+
expectedAgentName: globalFlags.agent ? void 0 : agent.agentName,
|
|
976
|
+
expectedAgentCommand: agent.agentCommand
|
|
977
|
+
});
|
|
978
|
+
if (emitJsonResult(globalFlags.format, {
|
|
979
|
+
action: "session_imported",
|
|
980
|
+
record_id: result.record_id,
|
|
981
|
+
cwd: result.cwd
|
|
982
|
+
})) return;
|
|
983
|
+
if (globalFlags.format === "quiet") {
|
|
984
|
+
process.stdout.write(`${result.record_id}\n`);
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
process.stdout.write(`imported session ${result.record_id} at ${result.cwd}\n`);
|
|
988
|
+
}
|
|
989
|
+
async function handleSessionsPrune(explicitAgentName, flags, command, config) {
|
|
990
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
991
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
992
|
+
const [{ pruneSessions }, { printPruneResultByFormat }] = await Promise.all([loadSessionModule(), loadOutputRenderModule()]);
|
|
993
|
+
const olderThanMs = flags.olderThan != null ? flags.olderThan * 24 * 60 * 60 * 1e3 : void 0;
|
|
994
|
+
printPruneResultByFormat(await pruneSessions({
|
|
995
|
+
agentCommand: agent.agentCommand,
|
|
996
|
+
before: flags.before,
|
|
997
|
+
olderThanMs,
|
|
998
|
+
includeHistory: flags.includeHistory,
|
|
999
|
+
dryRun: flags.dryRun
|
|
1000
|
+
}), globalFlags.format);
|
|
1001
|
+
}
|
|
1002
|
+
//#endregion
|
|
1003
|
+
//#region src/cli/compare-command.ts
|
|
1004
|
+
const DEFAULT_COMPARE_TIMEOUT_MS = 3e5;
|
|
1005
|
+
const FINAL_MESSAGE_PREVIEW_CHARS = 200;
|
|
1006
|
+
var CaptureFormatter = class {
|
|
1007
|
+
setContext(_context) {}
|
|
1008
|
+
onAcpMessage(_message) {}
|
|
1009
|
+
onError(params) {}
|
|
1010
|
+
onPermissionEscalation(_event) {}
|
|
1011
|
+
flush() {}
|
|
1012
|
+
};
|
|
1013
|
+
function asRecord$2(value) {
|
|
1014
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
1015
|
+
}
|
|
1016
|
+
function numberField(source, keys) {
|
|
1017
|
+
if (!source) return null;
|
|
1018
|
+
for (const key of keys) {
|
|
1019
|
+
const value = source[key];
|
|
1020
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
1021
|
+
}
|
|
1022
|
+
return null;
|
|
1023
|
+
}
|
|
1024
|
+
function collapseWhitespace(value) {
|
|
1025
|
+
return value.replace(/\s+/g, " ").trim();
|
|
1026
|
+
}
|
|
1027
|
+
function truncate(value, maxChars) {
|
|
1028
|
+
if (value.length <= maxChars) return value;
|
|
1029
|
+
return `${value.slice(0, Math.max(0, maxChars - 3))}...`;
|
|
1030
|
+
}
|
|
1031
|
+
async function readStdin() {
|
|
1032
|
+
let data = "";
|
|
1033
|
+
for await (const chunk of process.stdin) data += String(chunk);
|
|
1034
|
+
return data;
|
|
1035
|
+
}
|
|
1036
|
+
async function readPromptFile(filePath, promptText, cwd) {
|
|
1037
|
+
const prompt = mergePromptSourceWithText(filePath === "-" ? await readStdin() : await fs$1.readFile(path.resolve(cwd, filePath), "utf8"), promptText);
|
|
1038
|
+
if (prompt.length === 0) throw new InvalidArgumentError("Prompt from --file is empty");
|
|
1039
|
+
return prompt;
|
|
1040
|
+
}
|
|
1041
|
+
async function readPromptFromStdin() {
|
|
1042
|
+
if (process.stdin.isTTY) throw new InvalidArgumentError("Prompt is required (pass as final argument, --file, or pipe via stdin)");
|
|
1043
|
+
const prompt = parsePromptSource(await readStdin());
|
|
1044
|
+
if (prompt.length === 0) throw new InvalidArgumentError("Prompt from stdin is empty");
|
|
1045
|
+
return prompt;
|
|
1046
|
+
}
|
|
1047
|
+
async function readPromptInput(filePath, promptText, cwd) {
|
|
1048
|
+
try {
|
|
1049
|
+
if (filePath) return await readPromptFile(filePath, promptText, cwd);
|
|
1050
|
+
const joined = promptText.trim();
|
|
1051
|
+
if (joined.length > 0) return textPrompt(joined);
|
|
1052
|
+
return await readPromptFromStdin();
|
|
1053
|
+
} catch (error) {
|
|
1054
|
+
if (error instanceof PromptInputValidationError) throw new InvalidArgumentError(error.message);
|
|
1055
|
+
throw error;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
function promptTokensAfterDoubleDash(command) {
|
|
1059
|
+
const commandName = command.name();
|
|
1060
|
+
const commandIndex = process.argv.findIndex((token, index) => index >= 2 && token === commandName);
|
|
1061
|
+
if (commandIndex < 0) return [];
|
|
1062
|
+
const delimiterIndex = process.argv.findIndex((token, index) => index > commandIndex && token === "--");
|
|
1063
|
+
return delimiterIndex < 0 ? [] : process.argv.slice(delimiterIndex + 1);
|
|
1064
|
+
}
|
|
1065
|
+
function splitCompareArgs(args, filePath, command) {
|
|
1066
|
+
if (filePath) {
|
|
1067
|
+
if (args.length === 0) throw new InvalidArgumentError("At least one agent is required");
|
|
1068
|
+
return {
|
|
1069
|
+
agents: args,
|
|
1070
|
+
promptText: ""
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
const promptTokens = promptTokensAfterDoubleDash(command);
|
|
1074
|
+
if (promptTokens.length > 0) {
|
|
1075
|
+
const agents = args.slice(0, -promptTokens.length);
|
|
1076
|
+
if (agents.length === 0) throw new InvalidArgumentError("At least one agent is required");
|
|
1077
|
+
return {
|
|
1078
|
+
agents,
|
|
1079
|
+
promptText: promptTokens.join(" ")
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
if (args.length < 2) throw new InvalidArgumentError("Usage: acpx compare <agent>... '<prompt>'");
|
|
1083
|
+
return {
|
|
1084
|
+
agents: args.slice(0, -1),
|
|
1085
|
+
promptText: args[args.length - 1] ?? ""
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
function captureUsage(update, capture) {
|
|
1089
|
+
const source = asRecord$2(asRecord$2(update._meta)?.usage) ?? update;
|
|
1090
|
+
capture.usage = {
|
|
1091
|
+
input_tokens: numberField(source, ["input_tokens", "inputTokens"]) ?? void 0,
|
|
1092
|
+
output_tokens: numberField(source, ["output_tokens", "outputTokens"]) ?? void 0,
|
|
1093
|
+
total_tokens: numberField(source, [
|
|
1094
|
+
"total_tokens",
|
|
1095
|
+
"totalTokens",
|
|
1096
|
+
"size",
|
|
1097
|
+
"used"
|
|
1098
|
+
]) ?? void 0
|
|
1099
|
+
};
|
|
1100
|
+
}
|
|
1101
|
+
function captureSessionUpdate(notification, capture) {
|
|
1102
|
+
const update = asRecord$2(notification.update);
|
|
1103
|
+
if (!update) return;
|
|
1104
|
+
if (update.sessionUpdate === "agent_message_chunk") {
|
|
1105
|
+
const content = asRecord$2(update.content);
|
|
1106
|
+
if (content?.type === "text" && typeof content.text === "string") capture.finalMessage += content.text;
|
|
1107
|
+
return;
|
|
1108
|
+
}
|
|
1109
|
+
if (update.sessionUpdate === "usage_update") captureUsage(update, capture);
|
|
1110
|
+
}
|
|
1111
|
+
function rowStatusFromPermissionStats(stats) {
|
|
1112
|
+
return stats.denied + stats.cancelled > 0 ? "permission_denied" : "ok";
|
|
1113
|
+
}
|
|
1114
|
+
function sessionOptionsFromGlobalFlags(globalFlags) {
|
|
1115
|
+
return {
|
|
1116
|
+
model: globalFlags.model,
|
|
1117
|
+
allowedTools: globalFlags.allowedTools,
|
|
1118
|
+
maxTurns: globalFlags.maxTurns,
|
|
1119
|
+
systemPrompt: globalFlags.systemPrompt
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
async function resolvePermissionPolicyFromFlags(globalFlags) {
|
|
1123
|
+
try {
|
|
1124
|
+
return await loadPermissionPolicySpec(globalFlags.permissionPolicy, globalFlags.cwd);
|
|
1125
|
+
} catch (error) {
|
|
1126
|
+
throw new InvalidArgumentError(`Invalid permission policy: ${error instanceof Error ? error.message : String(error)}`);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
function buildSuccessRow(agentName, result, capture, startedAt) {
|
|
1130
|
+
const permissionStats = result.permissionStats;
|
|
1131
|
+
return {
|
|
1132
|
+
agent: agentName,
|
|
1133
|
+
status: result.stopReason === "cancelled" ? "cancelled" : rowStatusFromPermissionStats(permissionStats),
|
|
1134
|
+
stop_reason: result.stopReason,
|
|
1135
|
+
wall_ms: Math.round(performance.now() - startedAt),
|
|
1136
|
+
input_tokens: capture.usage.input_tokens ?? null,
|
|
1137
|
+
output_tokens: capture.usage.output_tokens ?? null,
|
|
1138
|
+
total_tokens: capture.usage.total_tokens ?? null,
|
|
1139
|
+
final_message: truncate(collapseWhitespace(capture.finalMessage), FINAL_MESSAGE_PREVIEW_CHARS),
|
|
1140
|
+
error: null,
|
|
1141
|
+
permission_requests: permissionStats.requested,
|
|
1142
|
+
permission_denied: permissionStats.denied + permissionStats.cancelled
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
function buildErrorRow(agentName, caught, capture, startedAt) {
|
|
1146
|
+
return {
|
|
1147
|
+
agent: agentName,
|
|
1148
|
+
status: caught instanceof TimeoutError ? "cancelled" : "error",
|
|
1149
|
+
stop_reason: null,
|
|
1150
|
+
wall_ms: Math.round(performance.now() - startedAt),
|
|
1151
|
+
input_tokens: capture.usage.input_tokens ?? null,
|
|
1152
|
+
output_tokens: capture.usage.output_tokens ?? null,
|
|
1153
|
+
total_tokens: capture.usage.total_tokens ?? null,
|
|
1154
|
+
final_message: truncate(collapseWhitespace(capture.finalMessage), FINAL_MESSAGE_PREVIEW_CHARS),
|
|
1155
|
+
error: truncate(collapseWhitespace(caught instanceof Error ? caught.message : String(caught)), FINAL_MESSAGE_PREVIEW_CHARS),
|
|
1156
|
+
permission_requests: 0,
|
|
1157
|
+
permission_denied: 0
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
async function runAgentForCompare(params) {
|
|
1161
|
+
const capture = {
|
|
1162
|
+
finalMessage: "",
|
|
1163
|
+
usage: {},
|
|
1164
|
+
errors: []
|
|
1165
|
+
};
|
|
1166
|
+
const formatter = new CaptureFormatter();
|
|
1167
|
+
const t0 = performance.now();
|
|
1168
|
+
try {
|
|
1169
|
+
const agent = resolveAgentInvocation(params.agentName, params.globalFlags, params.config);
|
|
1170
|
+
const result = await runOnce({
|
|
1171
|
+
agentCommand: agent.agentCommand,
|
|
1172
|
+
cwd: agent.cwd,
|
|
1173
|
+
prompt: params.prompt,
|
|
1174
|
+
mcpServers: params.config.mcpServers,
|
|
1175
|
+
permissionMode: resolvePermissionMode(params.globalFlags, params.config.defaultPermissions),
|
|
1176
|
+
nonInteractivePermissions: params.globalFlags.nonInteractivePermissions,
|
|
1177
|
+
permissionPolicy: params.permissionPolicy,
|
|
1178
|
+
authCredentials: params.config.auth,
|
|
1179
|
+
authPolicy: params.globalFlags.authPolicy,
|
|
1180
|
+
terminal: params.globalFlags.terminal,
|
|
1181
|
+
outputFormatter: formatter,
|
|
1182
|
+
suppressSdkConsoleErrors: true,
|
|
1183
|
+
timeoutMs: params.globalFlags.timeout ?? DEFAULT_COMPARE_TIMEOUT_MS,
|
|
1184
|
+
verbose: params.globalFlags.verbose,
|
|
1185
|
+
promptRetries: params.globalFlags.promptRetries,
|
|
1186
|
+
sessionOptions: sessionOptionsFromGlobalFlags(params.globalFlags),
|
|
1187
|
+
onSessionUpdate: (notification) => captureSessionUpdate(notification, capture)
|
|
1188
|
+
});
|
|
1189
|
+
return buildSuccessRow(params.agentName, result, capture, t0);
|
|
1190
|
+
} catch (caught) {
|
|
1191
|
+
return buildErrorRow(params.agentName, caught, capture, t0);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
function formatCell(value) {
|
|
1195
|
+
if (value == null || value === "") return "-";
|
|
1196
|
+
if (typeof value === "string") return collapseWhitespace(value);
|
|
1197
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
1198
|
+
return collapseWhitespace(JSON.stringify(value));
|
|
1199
|
+
}
|
|
1200
|
+
function renderTable(rows) {
|
|
1201
|
+
const headers = [
|
|
1202
|
+
"agent",
|
|
1203
|
+
"status",
|
|
1204
|
+
"wall_ms",
|
|
1205
|
+
"input",
|
|
1206
|
+
"output",
|
|
1207
|
+
"total",
|
|
1208
|
+
"permissions",
|
|
1209
|
+
"stop_reason",
|
|
1210
|
+
"final_message",
|
|
1211
|
+
"error"
|
|
1212
|
+
];
|
|
1213
|
+
const body = rows.map((row) => [
|
|
1214
|
+
row.agent,
|
|
1215
|
+
row.status,
|
|
1216
|
+
row.wall_ms,
|
|
1217
|
+
row.input_tokens,
|
|
1218
|
+
row.output_tokens,
|
|
1219
|
+
row.total_tokens,
|
|
1220
|
+
`${row.permission_denied}/${row.permission_requests}`,
|
|
1221
|
+
row.stop_reason,
|
|
1222
|
+
row.final_message,
|
|
1223
|
+
row.error
|
|
1224
|
+
]);
|
|
1225
|
+
const widths = headers.map((header, index) => Math.max(header.length, ...body.map((cells) => formatCell(cells[index]).length)));
|
|
1226
|
+
const formatRow = (cells) => cells.map((cell, index) => truncate(formatCell(cell), widths[index] ?? 24).padEnd(widths[index] ?? 24)).join(" ").trimEnd();
|
|
1227
|
+
return [
|
|
1228
|
+
formatRow(headers),
|
|
1229
|
+
widths.map((width) => "-".repeat(width)).join(" "),
|
|
1230
|
+
...body.map(formatRow)
|
|
1231
|
+
].join("\n");
|
|
1232
|
+
}
|
|
1233
|
+
function printRows(rows, format) {
|
|
1234
|
+
if (format === "json") {
|
|
1235
|
+
process.stdout.write(`${JSON.stringify(rows)}\n`);
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
if (format === "quiet") {
|
|
1239
|
+
for (const row of rows) process.stdout.write(`${row.agent}\t${row.status}\n`);
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
process.stdout.write(`${renderTable(rows)}\n`);
|
|
1243
|
+
}
|
|
1244
|
+
function updateCompareExitCode(rows) {
|
|
1245
|
+
if (rows.some((row) => row.status === "error")) {
|
|
1246
|
+
process.exitCode = EXIT_CODES.ERROR;
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
if (rows.some((row) => row.status === "permission_denied")) {
|
|
1250
|
+
process.exitCode = EXIT_CODES.PERMISSION_DENIED;
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
if (rows.some((row) => row.status === "cancelled")) process.exitCode = EXIT_CODES.TIMEOUT;
|
|
1254
|
+
}
|
|
1255
|
+
function resolvePromptFile(flags) {
|
|
1256
|
+
if (flags.file && flags.promptFile && flags.file !== flags.promptFile) throw new InvalidArgumentError("Use only one prompt file flag: --file or --prompt-file");
|
|
1257
|
+
return flags.file ?? flags.promptFile;
|
|
1258
|
+
}
|
|
1259
|
+
function registerCompareCommand(program, config) {
|
|
1260
|
+
program.command("compare").description("Run one prompt across multiple agents and summarize the results").argument("<args...>", "Agents followed by prompt text, or agents with --file").option("--cwd <dir>", "Target workspace").option("--approve-all", "Auto-approve all permission requests").option("--approve-reads", "Auto-approve read/search requests and prompt for writes").option("--deny-all", "Deny all permission requests").option("--timeout <seconds>", "Per-agent timeout in seconds", parseTimeoutSeconds).option("--format <fmt>", "Output format: text, json, quiet", parseOutputFormat$1).option("--json", "Alias for --format json").option("-f, --file <path>", "Read prompt text from file path (use - for stdin)", (value) => parseNonEmptyValue("Prompt file", value)).option("--prompt-file <path>", "Alias for --file", (value) => parseNonEmptyValue("Prompt file", value)).action(async function(args, flags) {
|
|
1261
|
+
if (config.disableExec) throw new Error("compare subcommand is disabled by configuration (disableExec: true)");
|
|
1262
|
+
const globalFlags = resolveGlobalFlags(this, config);
|
|
1263
|
+
if (globalFlags.agent) throw new InvalidArgumentError("Do not combine compare with --agent; pass agent names");
|
|
1264
|
+
const outputPolicy = resolveOutputPolicy(flags.json === true ? "json" : globalFlags.format, globalFlags.jsonStrict === true);
|
|
1265
|
+
const promptFile = resolvePromptFile(flags);
|
|
1266
|
+
const { agents, promptText } = splitCompareArgs(args, promptFile, this);
|
|
1267
|
+
const prompt = await readPromptInput(promptFile, promptText, globalFlags.cwd);
|
|
1268
|
+
const permissionPolicy = await resolvePermissionPolicyFromFlags(globalFlags);
|
|
1269
|
+
const rows = [];
|
|
1270
|
+
for (const agentName of agents) rows.push(await runAgentForCompare({
|
|
1271
|
+
agentName,
|
|
1272
|
+
prompt,
|
|
1273
|
+
config,
|
|
1274
|
+
globalFlags,
|
|
1275
|
+
permissionPolicy
|
|
1276
|
+
}));
|
|
1277
|
+
printRows(rows, outputPolicy.format);
|
|
1278
|
+
updateCompareExitCode(rows);
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
//#endregion
|
|
1282
|
+
//#region src/mcp-servers.ts
|
|
1283
|
+
function asRecord$1(value) {
|
|
1284
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
1285
|
+
return value;
|
|
1286
|
+
}
|
|
1287
|
+
function parseNonEmptyString(value, path) {
|
|
1288
|
+
if (typeof value !== "string" || value.trim().length === 0) throw new Error(`Invalid ${path}: expected non-empty string`);
|
|
1289
|
+
return value.trim();
|
|
1290
|
+
}
|
|
1291
|
+
function parseHeaders(value, path) {
|
|
1292
|
+
if (value == null) return [];
|
|
1293
|
+
if (!Array.isArray(value)) throw new Error(`Invalid ${path}: expected array`);
|
|
1294
|
+
const headers = [];
|
|
1295
|
+
for (const [index, rawHeader] of value.entries()) {
|
|
1296
|
+
const headerRecord = asRecord$1(rawHeader);
|
|
1297
|
+
if (!headerRecord) throw new Error(`Invalid ${path}[${index}]: expected object`);
|
|
1298
|
+
const name = parseNonEmptyString(headerRecord.name, `${path}[${index}].name`);
|
|
1299
|
+
const headerValue = parseNonEmptyString(headerRecord.value, `${path}[${index}].value`);
|
|
1300
|
+
headers.push({
|
|
1301
|
+
name,
|
|
1302
|
+
value: headerValue
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
return headers;
|
|
1306
|
+
}
|
|
1307
|
+
function parseArgs(value, path) {
|
|
1308
|
+
if (value == null) return [];
|
|
1309
|
+
if (!Array.isArray(value)) throw new Error(`Invalid ${path}: expected array`);
|
|
1310
|
+
const args = [];
|
|
1311
|
+
for (const [index, rawArg] of value.entries()) {
|
|
1312
|
+
if (typeof rawArg !== "string") throw new Error(`Invalid ${path}[${index}]: expected string`);
|
|
1313
|
+
args.push(rawArg);
|
|
1314
|
+
}
|
|
1315
|
+
return args;
|
|
1316
|
+
}
|
|
1317
|
+
function parseEnv(value, path) {
|
|
1318
|
+
if (value == null) return [];
|
|
1319
|
+
if (!Array.isArray(value)) throw new Error(`Invalid ${path}: expected array`);
|
|
1320
|
+
const env = [];
|
|
1321
|
+
for (const [index, rawEntry] of value.entries()) {
|
|
1322
|
+
const entry = asRecord$1(rawEntry);
|
|
1323
|
+
if (!entry) throw new Error(`Invalid ${path}[${index}]: expected object`);
|
|
1324
|
+
const name = parseNonEmptyString(entry.name, `${path}[${index}].name`);
|
|
1325
|
+
const envValue = parseNonEmptyString(entry.value, `${path}[${index}].value`);
|
|
1326
|
+
env.push({
|
|
1327
|
+
name,
|
|
1328
|
+
value: envValue
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
return env;
|
|
1332
|
+
}
|
|
1333
|
+
function parseMeta(value, path) {
|
|
1334
|
+
if (value === void 0) return;
|
|
1335
|
+
if (value === null) return null;
|
|
1336
|
+
if (!asRecord$1(value)) throw new Error(`Invalid ${path}: expected object or null`);
|
|
1337
|
+
return value;
|
|
1338
|
+
}
|
|
1339
|
+
function parseServerType(rawType, path) {
|
|
1340
|
+
if (rawType === void 0) return "stdio";
|
|
1341
|
+
const parsedType = parseNonEmptyString(rawType, `${path}.type`);
|
|
1342
|
+
if (parsedType !== "http" && parsedType !== "sse" && parsedType !== "stdio") throw new Error(`Invalid ${path}.type: expected http, sse, or stdio`);
|
|
1343
|
+
return parsedType;
|
|
1344
|
+
}
|
|
1345
|
+
function parseHttpServer(serverRecord, path, type, name, _meta) {
|
|
1346
|
+
return {
|
|
1347
|
+
type,
|
|
1348
|
+
name,
|
|
1349
|
+
url: parseNonEmptyString(serverRecord.url, `${path}.url`),
|
|
1350
|
+
headers: parseHeaders(serverRecord.headers, `${path}.headers`),
|
|
1351
|
+
_meta
|
|
1352
|
+
};
|
|
1353
|
+
}
|
|
1354
|
+
function parseStdioServer(serverRecord, path, name, _meta) {
|
|
1355
|
+
return {
|
|
1356
|
+
name,
|
|
1357
|
+
command: parseNonEmptyString(serverRecord.command, `${path}.command`),
|
|
1358
|
+
args: parseArgs(serverRecord.args, `${path}.args`),
|
|
1359
|
+
env: parseEnv(serverRecord.env, `${path}.env`),
|
|
1360
|
+
_meta
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
function parseServer(rawServer, path) {
|
|
1364
|
+
const serverRecord = asRecord$1(rawServer);
|
|
1365
|
+
if (!serverRecord) throw new Error(`Invalid ${path}: expected object`);
|
|
1366
|
+
const name = parseNonEmptyString(serverRecord.name, `${path}.name`);
|
|
1367
|
+
const _meta = parseMeta(serverRecord._meta, `${path}._meta`);
|
|
1368
|
+
const typeValue = parseServerType(serverRecord.type, path);
|
|
1369
|
+
if (typeValue === "http" || typeValue === "sse") return parseHttpServer(serverRecord, path, typeValue, name, _meta);
|
|
1370
|
+
return parseStdioServer(serverRecord, path, name, _meta);
|
|
1371
|
+
}
|
|
1372
|
+
function parseMcpServers(value, sourcePath, fieldName = "mcpServers") {
|
|
1373
|
+
const fieldPath = `${fieldName} in ${sourcePath}`;
|
|
1374
|
+
if (!Array.isArray(value)) throw new Error(`Invalid ${fieldPath}: expected array`);
|
|
1375
|
+
const parsed = [];
|
|
1376
|
+
for (const [index, rawServer] of value.entries()) parsed.push(parseServer(rawServer, `${fieldName}[${index}] in ${sourcePath}`));
|
|
1377
|
+
return parsed;
|
|
1378
|
+
}
|
|
1379
|
+
function parseOptionalMcpServers(value, sourcePath, fieldName = "mcpServers") {
|
|
1380
|
+
if (value === void 0) return;
|
|
1381
|
+
return parseMcpServers(value, sourcePath, fieldName);
|
|
1382
|
+
}
|
|
1383
|
+
//#endregion
|
|
1384
|
+
//#region src/cli/config.ts
|
|
1385
|
+
const DEFAULT_TTL_MS = 3e5;
|
|
1386
|
+
const DEFAULT_PERMISSION_MODE = "approve-reads";
|
|
1387
|
+
const DEFAULT_NON_INTERACTIVE_PERMISSION_POLICY = "deny";
|
|
1388
|
+
const DEFAULT_AUTH_POLICY = "skip";
|
|
1389
|
+
const DEFAULT_OUTPUT_FORMAT = "text";
|
|
1390
|
+
const DEFAULT_QUEUE_MAX_DEPTH = 16;
|
|
1391
|
+
const DEFAULT_DISABLE_EXEC = false;
|
|
1392
|
+
const VALID_PERMISSION_MODES = /* @__PURE__ */ new Set([
|
|
1393
|
+
"approve-all",
|
|
1394
|
+
"approve-reads",
|
|
1395
|
+
"deny-all"
|
|
1396
|
+
]);
|
|
1397
|
+
const VALID_NON_INTERACTIVE_PERMISSION_POLICIES = /* @__PURE__ */ new Set(["deny", "fail"]);
|
|
1398
|
+
const VALID_AUTH_POLICIES = /* @__PURE__ */ new Set(["skip", "fail"]);
|
|
1399
|
+
const VALID_OUTPUT_FORMATS = /* @__PURE__ */ new Set([
|
|
1400
|
+
"text",
|
|
1401
|
+
"json",
|
|
1402
|
+
"quiet"
|
|
1403
|
+
]);
|
|
1404
|
+
function defaultGlobalConfigPath() {
|
|
1405
|
+
return path.join(os.homedir(), ".acpx", "config.json");
|
|
1406
|
+
}
|
|
1407
|
+
function projectConfigPath(cwd) {
|
|
1408
|
+
return path.join(path.resolve(cwd), ".acpxrc.json");
|
|
1409
|
+
}
|
|
1410
|
+
function isObject(value) {
|
|
1411
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1412
|
+
}
|
|
1413
|
+
function parseTtlMs(value, sourcePath) {
|
|
1414
|
+
if (value == null) return;
|
|
1415
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) throw new Error(`Invalid config ttl in ${sourcePath}: expected non-negative seconds`);
|
|
1416
|
+
return Math.round(value * 1e3);
|
|
1417
|
+
}
|
|
1418
|
+
function parseTimeoutMs(value, sourcePath) {
|
|
1419
|
+
if (value == null) return;
|
|
1420
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) throw new Error(`Invalid config timeout in ${sourcePath}: expected positive seconds or null`);
|
|
1421
|
+
return Math.round(value * 1e3);
|
|
1422
|
+
}
|
|
1423
|
+
function parseQueueMaxDepth(value, sourcePath) {
|
|
1424
|
+
if (value == null) return;
|
|
1425
|
+
if (!Number.isInteger(value) || value <= 0) throw new Error(`Invalid config queueMaxDepth in ${sourcePath}: expected positive integer`);
|
|
1426
|
+
return value;
|
|
1427
|
+
}
|
|
1428
|
+
function parsePermissionMode(value, sourcePath) {
|
|
1429
|
+
if (value == null) return;
|
|
1430
|
+
if (typeof value !== "string" || !VALID_PERMISSION_MODES.has(value)) throw new Error(`Invalid config defaultPermissions in ${sourcePath}: expected approve-all, approve-reads, or deny-all`);
|
|
1431
|
+
return value;
|
|
1432
|
+
}
|
|
1433
|
+
function parseNonInteractivePermissionPolicy(value, sourcePath) {
|
|
1434
|
+
if (value == null) return;
|
|
1435
|
+
if (typeof value !== "string" || !VALID_NON_INTERACTIVE_PERMISSION_POLICIES.has(value)) throw new Error(`Invalid config nonInteractivePermissions in ${sourcePath}: expected deny or fail`);
|
|
1436
|
+
return value;
|
|
1437
|
+
}
|
|
1438
|
+
function parseAuthPolicy(value, sourcePath) {
|
|
1439
|
+
if (value == null) return;
|
|
1440
|
+
if (typeof value !== "string" || !VALID_AUTH_POLICIES.has(value)) throw new Error(`Invalid config authPolicy in ${sourcePath}: expected skip or fail`);
|
|
1441
|
+
return value;
|
|
1442
|
+
}
|
|
1443
|
+
function parseOutputFormat(value, sourcePath) {
|
|
1444
|
+
if (value == null) return;
|
|
1445
|
+
if (typeof value !== "string" || !VALID_OUTPUT_FORMATS.has(value)) throw new Error(`Invalid config format in ${sourcePath}: expected text, json, or quiet`);
|
|
1446
|
+
return value;
|
|
1447
|
+
}
|
|
1448
|
+
function parseDefaultAgent(value, sourcePath) {
|
|
1449
|
+
if (value == null) return;
|
|
1450
|
+
if (typeof value !== "string" || value.trim().length === 0) throw new Error(`Invalid config defaultAgent in ${sourcePath}: expected non-empty string`);
|
|
1451
|
+
return normalizeAgentName$1(value);
|
|
1452
|
+
}
|
|
1453
|
+
function parseAgents(value, sourcePath) {
|
|
1454
|
+
if (value == null) return;
|
|
1455
|
+
if (!isObject(value)) throw new Error(`Invalid config agents in ${sourcePath}: expected object`);
|
|
1456
|
+
const parsed = {};
|
|
1457
|
+
for (const [name, raw] of Object.entries(value)) {
|
|
1458
|
+
if (!isObject(raw)) throw new Error(`Invalid config agents.${name} in ${sourcePath}: expected object with command`);
|
|
1459
|
+
const command = raw.command;
|
|
1460
|
+
if (typeof command !== "string" || command.trim().length === 0) throw new Error(`Invalid config agents.${name}.command in ${sourcePath}: expected non-empty string`);
|
|
1461
|
+
const args = parseAgentArgs(raw.args, name, sourcePath);
|
|
1462
|
+
parsed[normalizeAgentName$1(name)] = args.length > 0 ? `${command.trim()} ${args.map(quoteCommandArg).join(" ")}` : command.trim();
|
|
1463
|
+
}
|
|
1464
|
+
return parsed;
|
|
1465
|
+
}
|
|
1466
|
+
function parseAgentArgs(value, agentName, sourcePath) {
|
|
1467
|
+
if (value == null) return [];
|
|
1468
|
+
if (!Array.isArray(value)) throw new Error(`Invalid config agents.${agentName}.args in ${sourcePath}: expected array of strings`);
|
|
1469
|
+
return value.map((arg, index) => {
|
|
1470
|
+
if (typeof arg !== "string") throw new Error(`Invalid config agents.${agentName}.args[${index}] in ${sourcePath}: expected string`);
|
|
1471
|
+
return arg;
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
function quoteCommandArg(value) {
|
|
1475
|
+
return JSON.stringify(value);
|
|
1476
|
+
}
|
|
1477
|
+
function parseAuth(value, sourcePath) {
|
|
1478
|
+
if (value == null) return;
|
|
1479
|
+
if (!isObject(value)) throw new Error(`Invalid config auth in ${sourcePath}: expected object`);
|
|
1480
|
+
const parsed = {};
|
|
1481
|
+
for (const [methodId, rawCredential] of Object.entries(value)) {
|
|
1482
|
+
if (typeof rawCredential !== "string" || rawCredential.trim().length === 0) throw new Error(`Invalid config auth.${methodId} in ${sourcePath}: expected non-empty string`);
|
|
1483
|
+
parsed[methodId] = rawCredential;
|
|
1484
|
+
}
|
|
1485
|
+
return parsed;
|
|
1486
|
+
}
|
|
1487
|
+
function parseDisableExec(value, sourcePath) {
|
|
1488
|
+
if (value == null) return;
|
|
1489
|
+
if (typeof value !== "boolean") throw new Error(`Invalid config disableExec in ${sourcePath}: expected boolean`);
|
|
1490
|
+
return value;
|
|
1491
|
+
}
|
|
1492
|
+
async function readConfigFile(filePath) {
|
|
1493
|
+
try {
|
|
1494
|
+
const payload = await fs$1.readFile(filePath, "utf8");
|
|
1495
|
+
let parsed;
|
|
1496
|
+
try {
|
|
1497
|
+
parsed = JSON.parse(payload);
|
|
1498
|
+
} catch (error) {
|
|
1499
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
1500
|
+
throw new Error(`Invalid JSON in ${filePath}: ${reason}`, { cause: error });
|
|
1501
|
+
}
|
|
1502
|
+
if (!isObject(parsed)) throw new Error(`Invalid config in ${filePath}: expected top-level JSON object`);
|
|
1503
|
+
return {
|
|
1504
|
+
config: parsed,
|
|
1505
|
+
exists: true
|
|
1506
|
+
};
|
|
1507
|
+
} catch (error) {
|
|
1508
|
+
if (error.code === "ENOENT") return { exists: false };
|
|
1509
|
+
throw error;
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
async function loadExplicitMcpConfig(cwd, configuredPath) {
|
|
1513
|
+
if (!configuredPath) return {};
|
|
1514
|
+
const resolvedPath = path.resolve(cwd, configuredPath);
|
|
1515
|
+
const result = await readConfigFile(resolvedPath);
|
|
1516
|
+
if (!result.exists) throw new Error(`MCP config file not found: ${resolvedPath}`);
|
|
1517
|
+
return {
|
|
1518
|
+
path: resolvedPath,
|
|
1519
|
+
config: result.config
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
function mergeAgents(globalAgents, projectAgents) {
|
|
1523
|
+
return {
|
|
1524
|
+
...globalAgents,
|
|
1525
|
+
...projectAgents
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
function mergeAuth(globalAuth, projectAuth) {
|
|
1529
|
+
return {
|
|
1530
|
+
...globalAuth,
|
|
1531
|
+
...projectAuth
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
async function loadResolvedConfig(cwd, options = {}) {
|
|
1535
|
+
const globalPath = defaultGlobalConfigPath();
|
|
1536
|
+
const projectPath = projectConfigPath(cwd);
|
|
1537
|
+
const [globalResult, projectResult, explicitMcp] = await Promise.all([
|
|
1538
|
+
readConfigFile(globalPath),
|
|
1539
|
+
readConfigFile(projectPath),
|
|
1540
|
+
loadExplicitMcpConfig(cwd, options.mcpConfigPath)
|
|
1541
|
+
]);
|
|
1542
|
+
const globalConfig = globalResult.config;
|
|
1543
|
+
const projectConfig = projectResult.config;
|
|
1544
|
+
const scalar = resolveScalarConfigValues(projectConfig, projectPath, globalConfig, globalPath);
|
|
1545
|
+
const agents = mergeAgents(parseAgents(globalConfig?.agents, globalPath), parseAgents(projectConfig?.agents, projectPath));
|
|
1546
|
+
const auth = mergeAuth(parseAuth(globalConfig?.auth, globalPath), parseAuth(projectConfig?.auth, projectPath));
|
|
1547
|
+
const mcpServers = resolveMcpServers(projectConfig, projectPath, globalConfig, globalPath, explicitMcp.config, explicitMcp.path);
|
|
1548
|
+
const disableExec = resolveDisableExec(projectConfig, projectPath, globalConfig, globalPath);
|
|
1549
|
+
return {
|
|
1550
|
+
...scalar,
|
|
1551
|
+
agents,
|
|
1552
|
+
auth,
|
|
1553
|
+
disableExec,
|
|
1554
|
+
mcpServers,
|
|
1555
|
+
globalPath,
|
|
1556
|
+
projectPath,
|
|
1557
|
+
mcpConfigPath: explicitMcp.path,
|
|
1558
|
+
mcpConfigFingerprint: explicitMcp.path ? createHash("sha256").update(JSON.stringify(mcpServers)).digest("hex") : void 0,
|
|
1559
|
+
hasGlobalConfig: globalResult.exists,
|
|
1560
|
+
hasProjectConfig: projectResult.exists
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
function resolveScalarConfigValues(projectConfig, projectPath, globalConfig, globalPath) {
|
|
1564
|
+
return {
|
|
1565
|
+
defaultAgent: resolveDefaultAgent(projectConfig, projectPath, globalConfig, globalPath),
|
|
1566
|
+
defaultPermissions: resolveDefaultPermissions(projectConfig, projectPath, globalConfig, globalPath),
|
|
1567
|
+
nonInteractivePermissions: resolveNonInteractivePermissions(projectConfig, projectPath, globalConfig, globalPath),
|
|
1568
|
+
authPolicy: resolveAuthPolicy(projectConfig, projectPath, globalConfig, globalPath),
|
|
1569
|
+
ttlMs: resolveTtlMs(projectConfig, projectPath, globalConfig, globalPath),
|
|
1570
|
+
timeoutMs: resolveTimeoutMs(projectConfig, projectPath, globalConfig, globalPath),
|
|
1571
|
+
queueMaxDepth: resolveQueueMaxDepth(projectConfig, projectPath, globalConfig, globalPath),
|
|
1572
|
+
format: resolveFormat(projectConfig, projectPath, globalConfig, globalPath)
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
function resolveDefaultAgent(projectConfig, projectPath, globalConfig, globalPath) {
|
|
1576
|
+
return parseDefaultAgent(projectConfig?.defaultAgent, projectPath) ?? parseDefaultAgent(globalConfig?.defaultAgent, globalPath) ?? "codex";
|
|
1577
|
+
}
|
|
1578
|
+
function resolveDefaultPermissions(projectConfig, projectPath, globalConfig, globalPath) {
|
|
1579
|
+
return parsePermissionMode(projectConfig?.defaultPermissions, projectPath) ?? parsePermissionMode(globalConfig?.defaultPermissions, globalPath) ?? DEFAULT_PERMISSION_MODE;
|
|
1580
|
+
}
|
|
1581
|
+
function resolveNonInteractivePermissions(projectConfig, projectPath, globalConfig, globalPath) {
|
|
1582
|
+
return parseNonInteractivePermissionPolicy(projectConfig?.nonInteractivePermissions, projectPath) ?? parseNonInteractivePermissionPolicy(globalConfig?.nonInteractivePermissions, globalPath) ?? DEFAULT_NON_INTERACTIVE_PERMISSION_POLICY;
|
|
1583
|
+
}
|
|
1584
|
+
function resolveAuthPolicy(projectConfig, projectPath, globalConfig, globalPath) {
|
|
1585
|
+
return parseAuthPolicy(projectConfig?.authPolicy, projectPath) ?? parseAuthPolicy(globalConfig?.authPolicy, globalPath) ?? DEFAULT_AUTH_POLICY;
|
|
1586
|
+
}
|
|
1587
|
+
function resolveTtlMs(projectConfig, projectPath, globalConfig, globalPath) {
|
|
1588
|
+
return parseTtlMs(projectConfig?.ttl, projectPath) ?? parseTtlMs(globalConfig?.ttl, globalPath) ?? DEFAULT_TTL_MS;
|
|
1589
|
+
}
|
|
1590
|
+
function resolveQueueMaxDepth(projectConfig, projectPath, globalConfig, globalPath) {
|
|
1591
|
+
return parseQueueMaxDepth(projectConfig?.queueMaxDepth, projectPath) ?? parseQueueMaxDepth(globalConfig?.queueMaxDepth, globalPath) ?? DEFAULT_QUEUE_MAX_DEPTH;
|
|
1592
|
+
}
|
|
1593
|
+
function resolveFormat(projectConfig, projectPath, globalConfig, globalPath) {
|
|
1594
|
+
return parseOutputFormat(projectConfig?.format, projectPath) ?? parseOutputFormat(globalConfig?.format, globalPath) ?? DEFAULT_OUTPUT_FORMAT;
|
|
1595
|
+
}
|
|
1596
|
+
function hasConfigKey(config, key) {
|
|
1597
|
+
return config != null && Object.prototype.hasOwnProperty.call(config, key);
|
|
1598
|
+
}
|
|
1599
|
+
function resolveTimeoutMs(projectConfig, projectPath, globalConfig, globalPath) {
|
|
1600
|
+
if (hasConfigKey(projectConfig, "timeout")) return parseTimeoutMs(projectConfig?.timeout, projectPath);
|
|
1601
|
+
if (hasConfigKey(globalConfig, "timeout")) return parseTimeoutMs(globalConfig?.timeout, globalPath);
|
|
1602
|
+
}
|
|
1603
|
+
function resolveMcpServers(projectConfig, projectPath, globalConfig, globalPath, mcpConfig, mcpConfigPath) {
|
|
1604
|
+
if (mcpConfigPath) return parseMcpServers(mcpConfig?.mcpServers, mcpConfigPath);
|
|
1605
|
+
if (hasConfigKey(projectConfig, "mcpServers")) return parseMcpServers(projectConfig?.mcpServers, projectPath);
|
|
1606
|
+
if (hasConfigKey(globalConfig, "mcpServers")) return parseMcpServers(globalConfig?.mcpServers, globalPath);
|
|
1607
|
+
return [];
|
|
1608
|
+
}
|
|
1609
|
+
function resolveDisableExec(projectConfig, projectPath, globalConfig, globalPath) {
|
|
1610
|
+
return parseDisableExec(projectConfig?.disableExec, projectPath) ?? parseDisableExec(globalConfig?.disableExec, globalPath) ?? DEFAULT_DISABLE_EXEC;
|
|
1611
|
+
}
|
|
1612
|
+
function toConfigDisplay(config) {
|
|
1613
|
+
const agents = {};
|
|
1614
|
+
for (const [name, command] of Object.entries(config.agents)) agents[name] = { command };
|
|
1615
|
+
return {
|
|
1616
|
+
defaultAgent: config.defaultAgent,
|
|
1617
|
+
defaultPermissions: config.defaultPermissions,
|
|
1618
|
+
nonInteractivePermissions: config.nonInteractivePermissions,
|
|
1619
|
+
authPolicy: config.authPolicy,
|
|
1620
|
+
ttl: Math.round(config.ttlMs / 1e3),
|
|
1621
|
+
timeout: config.timeoutMs == null ? null : config.timeoutMs / 1e3,
|
|
1622
|
+
queueMaxDepth: config.queueMaxDepth,
|
|
1623
|
+
format: config.format,
|
|
1624
|
+
agents,
|
|
1625
|
+
authMethods: Object.keys(config.auth).toSorted(),
|
|
1626
|
+
disableExec: config.disableExec
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1629
|
+
async function initGlobalConfigFile() {
|
|
1630
|
+
const configPath = defaultGlobalConfigPath();
|
|
1631
|
+
await fs$1.mkdir(path.dirname(configPath), { recursive: true });
|
|
1632
|
+
try {
|
|
1633
|
+
await fs$1.access(configPath);
|
|
1634
|
+
return {
|
|
1635
|
+
path: configPath,
|
|
1636
|
+
created: false
|
|
1637
|
+
};
|
|
1638
|
+
} catch {}
|
|
1639
|
+
const payload = {
|
|
1640
|
+
defaultAgent: DEFAULT_AGENT_NAME,
|
|
1641
|
+
defaultPermissions: "approve-all",
|
|
1642
|
+
nonInteractivePermissions: "deny",
|
|
1643
|
+
authPolicy: "skip",
|
|
1644
|
+
ttl: 300,
|
|
1645
|
+
timeout: null,
|
|
1646
|
+
queueMaxDepth: DEFAULT_QUEUE_MAX_DEPTH,
|
|
1647
|
+
format: "text",
|
|
1648
|
+
agents: {},
|
|
1649
|
+
auth: {}
|
|
1650
|
+
};
|
|
1651
|
+
try {
|
|
1652
|
+
await fs$1.writeFile(configPath, `${JSON.stringify(payload, null, 2)}\n`, {
|
|
1653
|
+
encoding: "utf8",
|
|
1654
|
+
flag: "wx"
|
|
1655
|
+
});
|
|
1656
|
+
} catch (error) {
|
|
1657
|
+
if (error.code === "EEXIST") return {
|
|
1658
|
+
path: configPath,
|
|
1659
|
+
created: false
|
|
1660
|
+
};
|
|
1661
|
+
throw error;
|
|
1662
|
+
}
|
|
1663
|
+
return {
|
|
1664
|
+
path: configPath,
|
|
1665
|
+
created: true
|
|
1666
|
+
};
|
|
1667
|
+
}
|
|
1668
|
+
//#endregion
|
|
1669
|
+
//#region src/cli/config-command.ts
|
|
1670
|
+
async function handleConfigShow(command, config) {
|
|
1671
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
1672
|
+
const payload = {
|
|
1673
|
+
...toConfigDisplay(config),
|
|
1674
|
+
paths: {
|
|
1675
|
+
global: config.globalPath,
|
|
1676
|
+
project: config.projectPath,
|
|
1677
|
+
...config.mcpConfigPath ? { mcp: config.mcpConfigPath } : {}
|
|
1678
|
+
},
|
|
1679
|
+
loaded: {
|
|
1680
|
+
global: config.hasGlobalConfig,
|
|
1681
|
+
project: config.hasProjectConfig
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
if (globalFlags.format === "json") {
|
|
1685
|
+
process.stdout.write(`${JSON.stringify(payload)}\n`);
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1688
|
+
process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
|
|
1689
|
+
}
|
|
1690
|
+
async function handleConfigInit(command, config) {
|
|
1691
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
1692
|
+
const result = await initGlobalConfigFile();
|
|
1693
|
+
if (globalFlags.format === "json") {
|
|
1694
|
+
process.stdout.write(`${JSON.stringify({
|
|
1695
|
+
path: result.path,
|
|
1696
|
+
created: result.created
|
|
1697
|
+
})}\n`);
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
if (globalFlags.format === "quiet") {
|
|
1701
|
+
process.stdout.write(`${result.path}\n`);
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1704
|
+
if (result.created) {
|
|
1705
|
+
process.stdout.write(`Created ${result.path}\n`);
|
|
1706
|
+
return;
|
|
1707
|
+
}
|
|
1708
|
+
process.stdout.write(`Config already exists: ${result.path}\n`);
|
|
1709
|
+
}
|
|
1710
|
+
function registerConfigCommand(program, config) {
|
|
1711
|
+
const configCommand = program.command("config").description("Inspect and initialize acpx configuration");
|
|
1712
|
+
configCommand.command("show").description("Show resolved config").option("--format <fmt>", "Output format: text, json, quiet", parseOutputFormat$1).action(async function() {
|
|
1713
|
+
await handleConfigShow(this, config);
|
|
1714
|
+
});
|
|
1715
|
+
configCommand.command("init").description("Create global config template").option("--format <fmt>", "Output format: text, json, quiet", parseOutputFormat$1).action(async function() {
|
|
1716
|
+
await handleConfigInit(this, config);
|
|
1717
|
+
});
|
|
1718
|
+
configCommand.action(async function() {
|
|
1719
|
+
await handleConfigShow(this, config);
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
//#endregion
|
|
1723
|
+
//#region src/cli/output/render.ts
|
|
1724
|
+
var render_exports = /* @__PURE__ */ __exportAll({
|
|
1725
|
+
agentSessionIdPayload: () => agentSessionIdPayload,
|
|
1726
|
+
formatPromptSessionBannerLine: () => formatPromptSessionBannerLine,
|
|
1727
|
+
printAgentSessionsByFormat: () => printAgentSessionsByFormat,
|
|
1728
|
+
printClosedSessionByFormat: () => printClosedSessionByFormat,
|
|
1729
|
+
printCreatedSessionBanner: () => printCreatedSessionBanner,
|
|
1730
|
+
printEnsuredSessionByFormat: () => printEnsuredSessionByFormat,
|
|
1731
|
+
printNewSessionByFormat: () => printNewSessionByFormat,
|
|
1732
|
+
printPromptSessionBanner: () => printPromptSessionBanner,
|
|
1733
|
+
printPruneResultByFormat: () => printPruneResultByFormat,
|
|
1734
|
+
printQueuedPromptByFormat: () => printQueuedPromptByFormat,
|
|
1735
|
+
printSessionsByFormat: () => printSessionsByFormat
|
|
1736
|
+
});
|
|
1737
|
+
function formatSessionLabel(record) {
|
|
1738
|
+
return record.name ?? "cwd";
|
|
1739
|
+
}
|
|
1740
|
+
function formatRoutedFrom(sessionCwd, currentCwd) {
|
|
1741
|
+
const relative = path.relative(sessionCwd, currentCwd);
|
|
1742
|
+
if (!relative || relative === ".") return;
|
|
1743
|
+
return relative.startsWith(".") ? relative : `.${path.sep}${relative}`;
|
|
1744
|
+
}
|
|
1745
|
+
async function resolveSessionConnectionStatus(record) {
|
|
1746
|
+
return (await probeQueueOwnerHealth(record.acpxRecordId)).healthy ? "connected" : "needs reconnect";
|
|
1747
|
+
}
|
|
1748
|
+
function printSessionsByFormat(sessions, format) {
|
|
1749
|
+
if (format === "json") {
|
|
1750
|
+
process.stdout.write(`${JSON.stringify(sessions)}\n`);
|
|
1751
|
+
return;
|
|
1752
|
+
}
|
|
1753
|
+
if (format === "quiet") {
|
|
1754
|
+
printQuietSessions(sessions);
|
|
1755
|
+
return;
|
|
1756
|
+
}
|
|
1757
|
+
if (sessions.length === 0) {
|
|
1758
|
+
process.stdout.write("No sessions\n");
|
|
1759
|
+
return;
|
|
1760
|
+
}
|
|
1761
|
+
for (const session of sessions) {
|
|
1762
|
+
const closedMarker = session.closed ? " [closed]" : "";
|
|
1763
|
+
process.stdout.write(`${session.acpxRecordId}${closedMarker}\t${session.name ?? "-"}\t${session.cwd}\t${session.lastUsedAt}\n`);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
function printQuietSessions(sessions) {
|
|
1767
|
+
for (const session of sessions) {
|
|
1768
|
+
const closedMarker = session.closed ? " [closed]" : "";
|
|
1769
|
+
process.stdout.write(`${session.acpxRecordId}${closedMarker}\n`);
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
function printAgentSessionsByFormat(result, format) {
|
|
1773
|
+
if (format === "json") {
|
|
1774
|
+
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
1775
|
+
return;
|
|
1776
|
+
}
|
|
1777
|
+
if (format === "quiet") {
|
|
1778
|
+
printQuietAgentSessions(result);
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
printTextAgentSessions(result);
|
|
1782
|
+
}
|
|
1783
|
+
function printQuietAgentSessions(result) {
|
|
1784
|
+
for (const session of result.sessions) process.stdout.write(`${session.sessionId}\n`);
|
|
1785
|
+
}
|
|
1786
|
+
function printTextAgentSessions(result) {
|
|
1787
|
+
if (result.sessions.length === 0) process.stdout.write("No sessions\n");
|
|
1788
|
+
else for (const session of result.sessions) {
|
|
1789
|
+
const title = session.title ?? "-";
|
|
1790
|
+
const updatedAt = session.updatedAt ?? "-";
|
|
1791
|
+
const meta = session._meta ? JSON.stringify(session._meta) : "-";
|
|
1792
|
+
process.stdout.write(`${session.sessionId}\t${title}\t${session.cwd}\t${updatedAt}\t${meta}\n`);
|
|
1793
|
+
}
|
|
1794
|
+
if (result.nextCursor) process.stdout.write(`Next cursor: ${result.nextCursor}\n`);
|
|
1795
|
+
}
|
|
1796
|
+
function printClosedSessionByFormat(record, format) {
|
|
1797
|
+
if (emitJsonResult(format, {
|
|
1798
|
+
action: "session_closed",
|
|
1799
|
+
acpxRecordId: record.acpxRecordId,
|
|
1800
|
+
acpxSessionId: record.acpSessionId,
|
|
1801
|
+
agentSessionId: record.agentSessionId
|
|
1802
|
+
})) return;
|
|
1803
|
+
if (format === "quiet") return;
|
|
1804
|
+
process.stdout.write(`${record.acpxRecordId}\n`);
|
|
1805
|
+
}
|
|
1806
|
+
function printNewSessionByFormat(record, replaced, format) {
|
|
1807
|
+
if (emitJsonResult(format, {
|
|
1808
|
+
action: "session_ensured",
|
|
1809
|
+
created: true,
|
|
1810
|
+
acpxRecordId: record.acpxRecordId,
|
|
1811
|
+
acpxSessionId: record.acpSessionId,
|
|
1812
|
+
agentSessionId: record.agentSessionId,
|
|
1813
|
+
name: record.name,
|
|
1814
|
+
replacedSessionId: replaced?.acpxRecordId
|
|
1815
|
+
})) return;
|
|
1816
|
+
if (format === "quiet") {
|
|
1817
|
+
process.stdout.write(`${record.acpxRecordId}\n`);
|
|
1818
|
+
return;
|
|
1819
|
+
}
|
|
1820
|
+
if (replaced) {
|
|
1821
|
+
process.stdout.write(`${record.acpxRecordId}\t(replaced ${replaced.acpxRecordId})\n`);
|
|
1822
|
+
return;
|
|
1823
|
+
}
|
|
1824
|
+
process.stdout.write(`${record.acpxRecordId}\n`);
|
|
1825
|
+
}
|
|
1826
|
+
function printEnsuredSessionByFormat(record, created, format) {
|
|
1827
|
+
if (emitJsonResult(format, {
|
|
1828
|
+
action: "session_ensured",
|
|
1829
|
+
created,
|
|
1830
|
+
acpxRecordId: record.acpxRecordId,
|
|
1831
|
+
acpxSessionId: record.acpSessionId,
|
|
1832
|
+
agentSessionId: record.agentSessionId,
|
|
1833
|
+
name: record.name
|
|
1834
|
+
})) return;
|
|
1835
|
+
if (format === "quiet") {
|
|
1836
|
+
process.stdout.write(`${record.acpxRecordId}\n`);
|
|
1837
|
+
return;
|
|
1838
|
+
}
|
|
1839
|
+
const action = created ? "created" : "existing";
|
|
1840
|
+
process.stdout.write(`${record.acpxRecordId}\t(${action})\n`);
|
|
1841
|
+
}
|
|
1842
|
+
function printQueuedPromptByFormat(result, format) {
|
|
1843
|
+
if (emitJsonResult(format, {
|
|
1844
|
+
action: "prompt_queued",
|
|
1845
|
+
acpxRecordId: result.sessionId,
|
|
1846
|
+
requestId: result.requestId
|
|
1847
|
+
})) return;
|
|
1848
|
+
if (format === "quiet") return;
|
|
1849
|
+
process.stdout.write(`[queued] ${result.requestId}\n`);
|
|
1850
|
+
}
|
|
1851
|
+
function formatPromptSessionBannerLine(record, currentCwd, connectionStatus = "needs reconnect") {
|
|
1852
|
+
const label = formatSessionLabel(record);
|
|
1853
|
+
const normalizedSessionCwd = path.resolve(record.cwd);
|
|
1854
|
+
const normalizedCurrentCwd = path.resolve(currentCwd);
|
|
1855
|
+
const routedFrom = normalizedSessionCwd === normalizedCurrentCwd ? void 0 : formatRoutedFrom(normalizedSessionCwd, normalizedCurrentCwd);
|
|
1856
|
+
const status = connectionStatus;
|
|
1857
|
+
if (routedFrom) return `[acpx] session ${label} (${record.acpxRecordId}) · ${normalizedSessionCwd} (routed from ${routedFrom}) · agent ${status}`;
|
|
1858
|
+
return `[acpx] session ${label} (${record.acpxRecordId}) · ${normalizedSessionCwd} · agent ${status}`;
|
|
1859
|
+
}
|
|
1860
|
+
async function printPromptSessionBanner(record, currentCwd, format, jsonStrict = false) {
|
|
1861
|
+
if (format === "quiet" || jsonStrict && format === "json") return;
|
|
1862
|
+
const status = await resolveSessionConnectionStatus(record);
|
|
1863
|
+
process.stderr.write(`${formatPromptSessionBannerLine(record, currentCwd, status)}\n`);
|
|
1864
|
+
}
|
|
1865
|
+
function printCreatedSessionBanner(record, agentName, format, jsonStrict = false) {
|
|
1866
|
+
if (format === "quiet" || jsonStrict && format === "json") return;
|
|
1867
|
+
const label = formatSessionLabel(record);
|
|
1868
|
+
process.stderr.write(`[acpx] created session ${label} (${record.acpxRecordId})\n`);
|
|
1869
|
+
process.stderr.write(`[acpx] agent: ${agentName}\n`);
|
|
1870
|
+
process.stderr.write(`[acpx] cwd: ${record.cwd}\n`);
|
|
1871
|
+
}
|
|
1872
|
+
function formatBytes(bytes) {
|
|
1873
|
+
if (bytes >= 1073741824) return `${(bytes / 1073741824).toFixed(1)} GB`;
|
|
1874
|
+
if (bytes >= 1048576) return `${(bytes / 1048576).toFixed(1)} MB`;
|
|
1875
|
+
if (bytes >= 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
1876
|
+
return `${bytes} B`;
|
|
1877
|
+
}
|
|
1878
|
+
function printPruneResultByFormat(result, format) {
|
|
1879
|
+
const count = result.pruned.length;
|
|
1880
|
+
if (emitPruneJsonResult(result, format, count)) return;
|
|
1881
|
+
if (format === "quiet") {
|
|
1882
|
+
printQuietPruneResult(result.pruned);
|
|
1883
|
+
return;
|
|
1884
|
+
}
|
|
1885
|
+
if (count === 0) {
|
|
1886
|
+
process.stdout.write(result.dryRun ? "[DRY RUN] No sessions to prune\n" : "No sessions pruned\n");
|
|
1887
|
+
return;
|
|
1888
|
+
}
|
|
1889
|
+
process.stdout.write(`${formatPruneSummaryLine(result, count)}\n`);
|
|
1890
|
+
for (const record of result.pruned) {
|
|
1891
|
+
const label = record.name ? ` (${record.name})` : "";
|
|
1892
|
+
process.stdout.write(` ${record.acpxRecordId}${label}\t${record.closedAt ?? record.lastUsedAt}\n`);
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
function emitPruneJsonResult(result, format, count) {
|
|
1896
|
+
return emitJsonResult(format, {
|
|
1897
|
+
action: result.dryRun ? "sessions_prune_dry_run" : "sessions_pruned",
|
|
1898
|
+
dryRun: result.dryRun,
|
|
1899
|
+
count,
|
|
1900
|
+
bytesFreed: result.bytesFreed,
|
|
1901
|
+
pruned: result.pruned.map((r) => r.acpxRecordId)
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
function printQuietPruneResult(pruned) {
|
|
1905
|
+
for (const record of pruned) process.stdout.write(`${record.acpxRecordId}\n`);
|
|
1906
|
+
}
|
|
1907
|
+
function formatPruneSummaryLine(result, count) {
|
|
1908
|
+
const prefix = result.dryRun ? "[DRY RUN] Would prune" : "Pruned";
|
|
1909
|
+
const bytesSuffix = !result.dryRun && result.bytesFreed > 0 ? `, freed ${formatBytes(result.bytesFreed)}` : "";
|
|
1910
|
+
return `${prefix} ${count} session${count === 1 ? "" : "s"}${bytesSuffix}`;
|
|
1911
|
+
}
|
|
1912
|
+
function agentSessionIdPayload(agentSessionId) {
|
|
1913
|
+
const normalized = normalizeRuntimeSessionId(agentSessionId);
|
|
1914
|
+
if (!normalized) return {};
|
|
1915
|
+
return { agentSessionId: normalized };
|
|
1916
|
+
}
|
|
1917
|
+
//#endregion
|
|
1918
|
+
//#region src/cli/status-command.ts
|
|
1919
|
+
function formatUptime(startedAt) {
|
|
1920
|
+
if (!startedAt) return;
|
|
1921
|
+
const startedMs = Date.parse(startedAt);
|
|
1922
|
+
if (!Number.isFinite(startedMs)) return;
|
|
1923
|
+
const elapsedMs = Math.max(0, Date.now() - startedMs);
|
|
1924
|
+
const seconds = Math.floor(elapsedMs / 1e3);
|
|
1925
|
+
const hours = Math.floor(seconds / 3600);
|
|
1926
|
+
const minutes = Math.floor(seconds % 3600 / 60);
|
|
1927
|
+
const remSeconds = seconds % 60;
|
|
1928
|
+
return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}:${remSeconds.toString().padStart(2, "0")}`;
|
|
1929
|
+
}
|
|
1930
|
+
function resolveStatusState(record, health) {
|
|
1931
|
+
if (health.healthy) return "running";
|
|
1932
|
+
if (health.hasLease) return "dead";
|
|
1933
|
+
if (record.lastAgentExitSignal || (record.lastAgentExitCode ?? 0) !== 0) return "dead";
|
|
1934
|
+
return "idle";
|
|
1935
|
+
}
|
|
1936
|
+
function statusSummary(state) {
|
|
1937
|
+
switch (state) {
|
|
1938
|
+
case "running": return "queue owner healthy";
|
|
1939
|
+
case "idle": return "session idle; queue owner will start on next prompt";
|
|
1940
|
+
case "dead": return "queue owner unavailable";
|
|
1941
|
+
}
|
|
1942
|
+
return "queue owner unavailable";
|
|
1943
|
+
}
|
|
1944
|
+
async function handleStatus(explicitAgentName, flags, command, config) {
|
|
1945
|
+
const globalFlags = resolveGlobalFlags(command, config);
|
|
1946
|
+
const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
|
|
1947
|
+
const record = await findSession({
|
|
1948
|
+
agentCommand: agent.agentCommand,
|
|
1949
|
+
cwd: agent.cwd,
|
|
1950
|
+
name: resolveSessionNameFromFlags(flags, command)
|
|
1951
|
+
});
|
|
1952
|
+
if (!record) {
|
|
1953
|
+
printMissingStatus(globalFlags.format, agent.agentCommand);
|
|
1954
|
+
return;
|
|
1955
|
+
}
|
|
1956
|
+
await printSessionStatus(record, globalFlags.format);
|
|
1957
|
+
}
|
|
1958
|
+
function printMissingStatus(format, agentCommand) {
|
|
1959
|
+
if (emitJsonResult(format, {
|
|
1960
|
+
action: "status_snapshot",
|
|
1961
|
+
status: "no-session",
|
|
1962
|
+
summary: "no active session"
|
|
1963
|
+
})) return;
|
|
1964
|
+
if (format === "quiet") {
|
|
1965
|
+
process.stdout.write("no-session\n");
|
|
1966
|
+
return;
|
|
1967
|
+
}
|
|
1968
|
+
process.stdout.write("session: -\n");
|
|
1969
|
+
process.stdout.write(`agent: ${agentCommand}\n`);
|
|
1970
|
+
process.stdout.write("pid: -\n");
|
|
1971
|
+
process.stdout.write("status: no-session\n");
|
|
1972
|
+
process.stdout.write("model: -\n");
|
|
1973
|
+
process.stdout.write("mode: -\n");
|
|
1974
|
+
process.stdout.write("uptime: -\n");
|
|
1975
|
+
process.stdout.write("lastPromptTime: -\n");
|
|
1976
|
+
}
|
|
1977
|
+
async function printSessionStatus(record, format) {
|
|
1978
|
+
const health = await probeQueueOwnerHealth(record.acpxRecordId);
|
|
1979
|
+
const statusState = resolveStatusState(record, health);
|
|
1980
|
+
const payload = createStatusPayload(record, health, statusState);
|
|
1981
|
+
const running = isRunningStatus(statusState);
|
|
1982
|
+
const dead = isDeadStatus(statusState);
|
|
1983
|
+
if (emitStatusJson(format, record, payload, statusState, running, dead)) return;
|
|
1984
|
+
if (format === "quiet") {
|
|
1985
|
+
process.stdout.write(`${payload.status}\n`);
|
|
1986
|
+
return;
|
|
1987
|
+
}
|
|
1988
|
+
printTextStatus(payload, dead);
|
|
1989
|
+
}
|
|
1990
|
+
function createStatusPayload(record, health, statusState) {
|
|
1991
|
+
const running = isRunningStatus(statusState);
|
|
1992
|
+
const acpx = statusAcpxFields(record);
|
|
1993
|
+
return {
|
|
1994
|
+
sessionId: record.acpxRecordId,
|
|
1995
|
+
agentCommand: record.agentCommand,
|
|
1996
|
+
pid: statusPid(health),
|
|
1997
|
+
status: statusState,
|
|
1998
|
+
model: acpx.model,
|
|
1999
|
+
mode: acpx.mode,
|
|
2000
|
+
availableModels: acpx.availableModels,
|
|
2001
|
+
uptime: running ? optionalStatusString(formatUptime(record.agentStartedAt)) : null,
|
|
2002
|
+
lastPromptTime: optionalStatusString(record.lastPromptAt),
|
|
2003
|
+
exitCode: running ? null : optionalStatusNumber(record.lastAgentExitCode),
|
|
2004
|
+
signal: running ? null : optionalStatusSignal(record.lastAgentExitSignal),
|
|
2005
|
+
...agentSessionIdPayload(record.agentSessionId)
|
|
2006
|
+
};
|
|
2007
|
+
}
|
|
2008
|
+
function statusAcpxFields(record) {
|
|
2009
|
+
return {
|
|
2010
|
+
model: record.acpx?.current_model_id ?? null,
|
|
2011
|
+
mode: record.acpx?.current_mode_id ?? null,
|
|
2012
|
+
availableModels: record.acpx?.available_models ?? null
|
|
2013
|
+
};
|
|
2014
|
+
}
|
|
2015
|
+
function statusPid(health) {
|
|
2016
|
+
if (health.pidAlive) return health.pid ?? null;
|
|
2017
|
+
return null;
|
|
2018
|
+
}
|
|
2019
|
+
function optionalStatusString(value) {
|
|
2020
|
+
return value ?? null;
|
|
2021
|
+
}
|
|
2022
|
+
function optionalStatusNumber(value) {
|
|
2023
|
+
return value ?? null;
|
|
2024
|
+
}
|
|
2025
|
+
function optionalStatusSignal(value) {
|
|
2026
|
+
return value ?? null;
|
|
2027
|
+
}
|
|
2028
|
+
function isRunningStatus(status) {
|
|
2029
|
+
return status === "running";
|
|
2030
|
+
}
|
|
2031
|
+
function isDeadStatus(status) {
|
|
2032
|
+
return status === "dead";
|
|
2033
|
+
}
|
|
2034
|
+
function emitStatusJson(format, record, payload, statusState, running, dead) {
|
|
2035
|
+
return emitJsonResult(format, statusJsonPayload(record, payload, statusState, running, dead));
|
|
2036
|
+
}
|
|
2037
|
+
function statusJsonPayload(record, payload, statusState, running, dead) {
|
|
2038
|
+
const result = {
|
|
2039
|
+
action: "status_snapshot",
|
|
2040
|
+
status: running ? "alive" : statusState,
|
|
2041
|
+
summary: statusSummary(statusState),
|
|
2042
|
+
acpxRecordId: record.acpxRecordId,
|
|
2043
|
+
acpxSessionId: record.acpSessionId,
|
|
2044
|
+
agentSessionId: record.agentSessionId
|
|
2045
|
+
};
|
|
2046
|
+
assignDefinedJsonField(result, "pid", payload.pid);
|
|
2047
|
+
assignDefinedJsonField(result, "model", payload.model);
|
|
2048
|
+
assignDefinedJsonField(result, "mode", payload.mode);
|
|
2049
|
+
assignDefinedJsonField(result, "availableModels", payload.availableModels);
|
|
2050
|
+
assignDefinedJsonField(result, "uptime", payload.uptime);
|
|
2051
|
+
assignDefinedJsonField(result, "lastPromptTime", payload.lastPromptTime);
|
|
2052
|
+
if (dead) {
|
|
2053
|
+
assignDefinedJsonField(result, "exitCode", payload.exitCode);
|
|
2054
|
+
assignDefinedJsonField(result, "signal", payload.signal);
|
|
2055
|
+
}
|
|
2056
|
+
return result;
|
|
2057
|
+
}
|
|
2058
|
+
function assignDefinedJsonField(target, key, value) {
|
|
2059
|
+
if (value !== null && value !== void 0) target[key] = value;
|
|
2060
|
+
}
|
|
2061
|
+
function printTextStatus(payload, dead) {
|
|
2062
|
+
process.stdout.write(`session: ${payload.sessionId}\n`);
|
|
2063
|
+
if ("agentSessionId" in payload) process.stdout.write(`agentSessionId: ${payload.agentSessionId}\n`);
|
|
2064
|
+
process.stdout.write(`agent: ${payload.agentCommand}\n`);
|
|
2065
|
+
process.stdout.write(`pid: ${payload.pid ?? "-"}\n`);
|
|
2066
|
+
process.stdout.write(`status: ${payload.status}\n`);
|
|
2067
|
+
process.stdout.write(`model: ${payload.model ?? "-"}\n`);
|
|
2068
|
+
process.stdout.write(`mode: ${payload.mode ?? "-"}\n`);
|
|
2069
|
+
process.stdout.write(`uptime: ${payload.uptime ?? "-"}\n`);
|
|
2070
|
+
process.stdout.write(`lastPromptTime: ${payload.lastPromptTime ?? "-"}\n`);
|
|
2071
|
+
if (dead) printDeadStatusDetails(payload);
|
|
2072
|
+
}
|
|
2073
|
+
function printDeadStatusDetails(payload) {
|
|
2074
|
+
process.stdout.write(`exitCode: ${payload.exitCode ?? "-"}\n`);
|
|
2075
|
+
process.stdout.write(`signal: ${payload.signal ?? "-"}\n`);
|
|
2076
|
+
}
|
|
2077
|
+
function registerStatusCommand(parent, explicitAgentName, config, description) {
|
|
2078
|
+
const statusCommand = parent.command("status").description(description);
|
|
2079
|
+
addSessionNameOption(statusCommand);
|
|
2080
|
+
statusCommand.action(async function(flags) {
|
|
2081
|
+
await handleStatus(explicitAgentName, flags, this, config);
|
|
2082
|
+
});
|
|
2083
|
+
}
|
|
2084
|
+
//#endregion
|
|
2085
|
+
//#region src/cli/command-registration.ts
|
|
2086
|
+
var LocalAttributeOption = class extends Option {
|
|
2087
|
+
localAttributeName;
|
|
2088
|
+
constructor(flags, description, localAttributeName) {
|
|
2089
|
+
super(flags, description);
|
|
2090
|
+
this.localAttributeName = localAttributeName;
|
|
2091
|
+
}
|
|
2092
|
+
attributeName() {
|
|
2093
|
+
return this.localAttributeName;
|
|
2094
|
+
}
|
|
2095
|
+
};
|
|
2096
|
+
function addSessionsListOptions(command) {
|
|
2097
|
+
return command.option("--local", "List local acpx session records instead of agent protocol sessions").option("--cursor <cursor>", "Opaque ACP session/list cursor", (value) => parseNonEmptyValue("Cursor", value)).option("--filter-cwd <dir>", "Filter agent sessions by working directory", (value) => parseNonEmptyValue("Filter cwd", value));
|
|
2098
|
+
}
|
|
2099
|
+
function registerSessionsCommand(parent, explicitAgentName, config) {
|
|
2100
|
+
const sessionsCommand = parent.command("sessions").description("List, ensure, create, or close sessions for this agent");
|
|
2101
|
+
addSessionsListOptions(sessionsCommand);
|
|
2102
|
+
sessionsCommand.action(async function(flags) {
|
|
2103
|
+
await handleSessionsList(explicitAgentName, flags, this, config);
|
|
2104
|
+
});
|
|
2105
|
+
addSessionsListOptions(sessionsCommand.command("list")).description("List sessions").action(async function(flags) {
|
|
2106
|
+
await handleSessionsList(explicitAgentName, flags, this, config);
|
|
2107
|
+
});
|
|
2108
|
+
sessionsCommand.command("new").description("Create a fresh session for current cwd").option("-s, --name <name>", "Session name", parseSessionName).option("--resume-session <id>", "Resume existing ACP session id", (value) => parseNonEmptyValue("Resume session id", value)).action(async function(flags) {
|
|
2109
|
+
await handleSessionsNew(explicitAgentName, flags, this, config);
|
|
2110
|
+
});
|
|
2111
|
+
sessionsCommand.command("ensure").description("Ensure a session exists for current cwd or ancestor").option("-s, --name <name>", "Session name", parseSessionName).option("--resume-session <id>", "Resume existing ACP session id", (value) => parseNonEmptyValue("Resume session id", value)).action(async function(flags) {
|
|
2112
|
+
await handleSessionsEnsure(explicitAgentName, flags, this, config);
|
|
2113
|
+
});
|
|
2114
|
+
sessionsCommand.command("close").description("Close session for current cwd").argument("[name]", "Session name", parseSessionName).action(async function(name) {
|
|
2115
|
+
await handleSessionsClose(explicitAgentName, name, this, config);
|
|
2116
|
+
});
|
|
2117
|
+
sessionsCommand.command("show").description("Show session metadata for current cwd").argument("[name]", "Session name", parseSessionName).action(async function(name) {
|
|
2118
|
+
await handleSessionsShow(explicitAgentName, name, this, config);
|
|
2119
|
+
});
|
|
2120
|
+
sessionsCommand.command("history").description("Show recent session history entries").argument("[name]", "Session name", parseSessionName).option("--limit <count>", `Maximum number of entries to show (default: 20)`, parseHistoryLimit, 20).action(async function(name, flags) {
|
|
2121
|
+
await handleSessionsHistory(explicitAgentName, name, flags, this, config);
|
|
2122
|
+
});
|
|
2123
|
+
sessionsCommand.command("read").description("Read full session history").argument("[name]", "Session name", parseSessionName).option("--tail <count>", "Show only the last N entries instead of all history", parseHistoryLimit).action(async function(name, flags) {
|
|
2124
|
+
await handleSessionsHistory(explicitAgentName, name, { limit: flags.tail ?? 0 }, this, config);
|
|
2125
|
+
});
|
|
2126
|
+
sessionsCommand.command("export").description("Export a portable session archive").argument("[name]", "Session name", parseSessionName).requiredOption("--output <path>", "Output archive path", (value) => parseNonEmptyValue("Output path", value)).addOption(new LocalAttributeOption("--cwd <cwd>", "Session cwd to export", "sourceCwd").argParser((value) => parseNonEmptyValue("Session cwd", value))).action(async function(name, flags) {
|
|
2127
|
+
await handleSessionsExport(explicitAgentName, name, flags, this, config);
|
|
2128
|
+
});
|
|
2129
|
+
sessionsCommand.command("import").description("Import a portable session archive").argument("<archive-path>", "Archive path", (value) => parseNonEmptyValue("Archive path", value)).option("--name <name>", "Imported session name", parseSessionName).addOption(new LocalAttributeOption("--cwd <cwd>", "Imported session cwd", "destinationCwd").argParser((value) => parseNonEmptyValue("Imported session cwd", value))).action(async function(archivePath, flags) {
|
|
2130
|
+
await handleSessionsImport(explicitAgentName, archivePath, flags, this, config);
|
|
2131
|
+
});
|
|
2132
|
+
sessionsCommand.command("prune").description("Delete closed sessions and free disk space").option("--dry-run", "Preview what would be pruned without deleting anything").option("--before <date>", "Prune sessions closed before this date", parsePruneBeforeDate).option("--older-than <days>", "Prune sessions closed more than N days ago", parseDaysOlderThan).option("--include-history", "Also delete event stream files (.stream.ndjson)").action(async function(flags) {
|
|
2133
|
+
await handleSessionsPrune(explicitAgentName, flags, this, config);
|
|
2134
|
+
});
|
|
2135
|
+
}
|
|
2136
|
+
function registerSharedAgentSubcommands(parent, explicitAgentName, config, descriptions) {
|
|
2137
|
+
const promptCommand = parent.command("prompt").description(descriptions.prompt).argument("[prompt...]", "Prompt text").showHelpAfterError();
|
|
2138
|
+
addSessionOption(promptCommand);
|
|
2139
|
+
addPromptInputOption(promptCommand);
|
|
2140
|
+
promptCommand.action(async function(promptParts, flags) {
|
|
2141
|
+
await handlePrompt(explicitAgentName, promptParts, flags, this, config);
|
|
2142
|
+
});
|
|
2143
|
+
const execCommand = parent.command("exec").description(descriptions.exec).argument("[prompt...]", "Prompt text").showHelpAfterError();
|
|
2144
|
+
addPromptInputOption(execCommand);
|
|
2145
|
+
execCommand.action(async function(promptParts, flags) {
|
|
2146
|
+
await handleExec(explicitAgentName, promptParts, flags, this, config);
|
|
2147
|
+
});
|
|
2148
|
+
const cancelCommand = parent.command("cancel").description(descriptions.cancel);
|
|
2149
|
+
addSessionNameOption(cancelCommand);
|
|
2150
|
+
cancelCommand.action(async function(flags) {
|
|
2151
|
+
await handleCancel(explicitAgentName, flags, this, config);
|
|
2152
|
+
});
|
|
2153
|
+
const setModeCommand = parent.command("set-mode").description(descriptions.setMode).argument("<mode>", "Mode id", (value) => parseNonEmptyValue("Mode", value));
|
|
2154
|
+
addSessionNameOption(setModeCommand);
|
|
2155
|
+
setModeCommand.action(async function(modeId, flags) {
|
|
2156
|
+
await handleSetMode(explicitAgentName, modeId, flags, this, config);
|
|
2157
|
+
});
|
|
2158
|
+
const setConfigCommand = parent.command("set").description(descriptions.setConfig).argument("<key>", "Config option id", (value) => parseNonEmptyValue("Config option key", value)).argument("<value>", "Config option value", (value) => parseNonEmptyValue("Config option value", value));
|
|
2159
|
+
addSessionNameOption(setConfigCommand);
|
|
2160
|
+
setConfigCommand.action(async function(key, value, flags) {
|
|
2161
|
+
await handleSetConfigOption(explicitAgentName, key, value, flags, this, config);
|
|
2162
|
+
});
|
|
2163
|
+
registerStatusCommand(parent, explicitAgentName, config, descriptions.status);
|
|
2164
|
+
}
|
|
2165
|
+
function registerAgentCommand(program, agentName, config) {
|
|
2166
|
+
const agentCommand = program.command(agentName).description(`Use ${agentName} agent`).argument("[prompt...]", "Prompt text").enablePositionalOptions().passThroughOptions().showHelpAfterError();
|
|
2167
|
+
addSessionOption(agentCommand);
|
|
2168
|
+
addPromptInputOption(agentCommand);
|
|
2169
|
+
agentCommand.action(async function(promptParts, flags) {
|
|
2170
|
+
await handlePrompt(agentName, promptParts, flags, this, config);
|
|
2171
|
+
});
|
|
2172
|
+
registerSharedAgentSubcommands(agentCommand, agentName, config, {
|
|
2173
|
+
prompt: "Prompt using persistent session",
|
|
2174
|
+
exec: "One-shot prompt without saved session",
|
|
2175
|
+
cancel: "Cooperatively cancel current in-flight prompt",
|
|
2176
|
+
setMode: "Set session mode",
|
|
2177
|
+
setConfig: "Set session config option",
|
|
2178
|
+
status: "Show local status of current session agent process"
|
|
2179
|
+
});
|
|
2180
|
+
registerSessionsCommand(agentCommand, agentName, config);
|
|
2181
|
+
}
|
|
2182
|
+
function registerFlowCommand(program, config) {
|
|
2183
|
+
program.command("flow").description("Run multi-step ACP workflows from flow files").command("run").description("Run a flow file").argument("<file>", "Flow module path").option("--input-json <json>", "Flow input as JSON").option("--input-file <path>", "Read flow input JSON from file").option("--default-agent <name>", "Default agent profile for ACP nodes without profile", (value) => parseNonEmptyValue("Default agent", value)).action(async function(file, flags) {
|
|
2184
|
+
const { handleFlowRun } = await import("./cli-CxsS1XQp.js");
|
|
2185
|
+
await handleFlowRun(file, flags, this, config);
|
|
2186
|
+
});
|
|
2187
|
+
}
|
|
2188
|
+
function registerDefaultCommands(program, config) {
|
|
2189
|
+
registerSharedAgentSubcommands(program, void 0, config, {
|
|
2190
|
+
prompt: `Prompt using ${config.defaultAgent} by default`,
|
|
2191
|
+
exec: `One-shot prompt using ${config.defaultAgent} by default`,
|
|
2192
|
+
cancel: `Cancel active prompt for ${config.defaultAgent} by default`,
|
|
2193
|
+
setMode: `Set session mode for ${config.defaultAgent} by default`,
|
|
2194
|
+
setConfig: `Set session config option for ${config.defaultAgent} by default`,
|
|
2195
|
+
status: `Show local status for ${config.defaultAgent} by default`
|
|
2196
|
+
});
|
|
2197
|
+
registerSessionsCommand(program, void 0, config);
|
|
2198
|
+
registerConfigCommand(program, config);
|
|
2199
|
+
registerCompareCommand(program, config);
|
|
2200
|
+
registerFlowCommand(program, config);
|
|
2201
|
+
}
|
|
2202
|
+
//#endregion
|
|
2203
|
+
//#region src/cli/queue/owner-env.ts
|
|
2204
|
+
const QUEUE_OWNER_PAYLOAD_FILE_ENV = "ACPX_QUEUE_OWNER_PAYLOAD_FILE";
|
|
2205
|
+
const QUEUE_OWNER_PAYLOAD_ENV = "ACPX_QUEUE_OWNER_PAYLOAD";
|
|
2206
|
+
function asRecord(value) {
|
|
2207
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
2208
|
+
return value;
|
|
2209
|
+
}
|
|
2210
|
+
function parseQueueOwnerPayload(raw) {
|
|
2211
|
+
const record = asRecord(JSON.parse(raw));
|
|
2212
|
+
if (!record) throw new Error("queue owner payload must be an object");
|
|
2213
|
+
if (typeof record.sessionId !== "string" || record.sessionId.trim().length === 0) throw new Error("queue owner payload missing sessionId");
|
|
2214
|
+
if (record.permissionMode !== "approve-all" && record.permissionMode !== "approve-reads" && record.permissionMode !== "deny-all") throw new Error("queue owner payload has invalid permissionMode");
|
|
2215
|
+
const options = {
|
|
2216
|
+
sessionId: record.sessionId,
|
|
2217
|
+
permissionMode: record.permissionMode
|
|
2218
|
+
};
|
|
2219
|
+
assignQueueOwnerTransportOptions(options, record);
|
|
2220
|
+
assignQueueOwnerScalarOptions(options, record);
|
|
2221
|
+
assignQueueOwnerSessionOptions(options, record.sessionOptions);
|
|
2222
|
+
return options;
|
|
2223
|
+
}
|
|
2224
|
+
function assignQueueOwnerTransportOptions(options, record) {
|
|
2225
|
+
const parsedMcpServers = parseOptionalMcpServers(record.mcpServers, "queue owner payload");
|
|
2226
|
+
if (parsedMcpServers) options.mcpServers = parsedMcpServers;
|
|
2227
|
+
if (typeof record.mcpConfigPath === "string" && record.mcpConfigPath.length > 0) options.mcpConfigPath = record.mcpConfigPath;
|
|
2228
|
+
if (typeof record.mcpConfigFingerprint === "string" && record.mcpConfigFingerprint.length > 0) options.mcpConfigFingerprint = record.mcpConfigFingerprint;
|
|
2229
|
+
if (record.authCredentials && typeof record.authCredentials === "object") {
|
|
2230
|
+
const entries = Object.entries(record.authCredentials).filter(([, value]) => typeof value === "string");
|
|
2231
|
+
options.authCredentials = Object.fromEntries(entries);
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
function assignQueueOwnerScalarOptions(options, record) {
|
|
2235
|
+
if (record.nonInteractivePermissions === "deny" || record.nonInteractivePermissions === "fail") options.nonInteractivePermissions = record.nonInteractivePermissions;
|
|
2236
|
+
if (record.authPolicy === "skip" || record.authPolicy === "fail") options.authPolicy = record.authPolicy;
|
|
2237
|
+
assignBooleanOption(options, "terminal", record.terminal);
|
|
2238
|
+
assignBooleanOption(options, "suppressSdkConsoleErrors", record.suppressSdkConsoleErrors);
|
|
2239
|
+
assignBooleanOption(options, "verbose", record.verbose);
|
|
2240
|
+
assignFiniteNumberOption(options, "ttlMs", record.ttlMs);
|
|
2241
|
+
assignRoundedNumberOption(options, "maxQueueDepth", record.maxQueueDepth, 1);
|
|
2242
|
+
assignRoundedNumberOption(options, "promptRetries", record.promptRetries, 0);
|
|
2243
|
+
}
|
|
2244
|
+
function assignBooleanOption(options, key, value) {
|
|
2245
|
+
if (typeof value === "boolean") options[key] = value;
|
|
2246
|
+
}
|
|
2247
|
+
function assignFiniteNumberOption(options, key, value) {
|
|
2248
|
+
if (typeof value === "number" && Number.isFinite(value)) options[key] = value;
|
|
2249
|
+
}
|
|
2250
|
+
function assignRoundedNumberOption(options, key, value, min) {
|
|
2251
|
+
if (typeof value === "number" && Number.isFinite(value)) options[key] = Math.max(min, Math.round(value));
|
|
2252
|
+
}
|
|
2253
|
+
function assignQueueOwnerSessionOptions(options, rawSessionOptions) {
|
|
2254
|
+
const sessionOpts = asRecord(rawSessionOptions);
|
|
2255
|
+
if (!sessionOpts) return;
|
|
2256
|
+
options.sessionOptions = {};
|
|
2257
|
+
assignSessionModel(options.sessionOptions, sessionOpts.model);
|
|
2258
|
+
assignSessionAllowedTools(options.sessionOptions, sessionOpts.allowedTools);
|
|
2259
|
+
assignSessionMaxTurns(options.sessionOptions, sessionOpts.maxTurns);
|
|
2260
|
+
assignSessionSystemPrompt(options.sessionOptions, sessionOpts.systemPrompt);
|
|
2261
|
+
assignSessionEnv(options.sessionOptions, sessionOpts.env);
|
|
2262
|
+
}
|
|
2263
|
+
function assignSessionModel(options, value) {
|
|
2264
|
+
if (typeof value === "string" && value.trim().length > 0) options.model = value;
|
|
2265
|
+
}
|
|
2266
|
+
function assignSessionAllowedTools(options, value) {
|
|
2267
|
+
if (Array.isArray(value)) options.allowedTools = value.filter((tool) => typeof tool === "string");
|
|
2268
|
+
}
|
|
2269
|
+
function assignSessionMaxTurns(options, value) {
|
|
2270
|
+
if (typeof value === "number" && Number.isFinite(value)) options.maxTurns = Math.max(1, Math.round(value));
|
|
2271
|
+
}
|
|
2272
|
+
function assignSessionSystemPrompt(options, value) {
|
|
2273
|
+
if (typeof value === "string") {
|
|
2274
|
+
options.systemPrompt = value;
|
|
2275
|
+
return;
|
|
2276
|
+
}
|
|
2277
|
+
const systemPrompt = asRecord(value);
|
|
2278
|
+
if (typeof systemPrompt?.append === "string") options.systemPrompt = { append: systemPrompt.append };
|
|
2279
|
+
}
|
|
2280
|
+
function assignSessionEnv(options, value) {
|
|
2281
|
+
const env = asRecord(value);
|
|
2282
|
+
if (!env) return;
|
|
2283
|
+
const entries = Object.entries(env).filter((entry) => typeof entry[1] === "string");
|
|
2284
|
+
if (entries.length > 0) options.env = Object.fromEntries(entries);
|
|
2285
|
+
}
|
|
2286
|
+
async function runQueueOwnerFromEnv(env) {
|
|
2287
|
+
await runSessionQueueOwner(parseQueueOwnerPayload(await readQueueOwnerPayloadFromEnv(env)));
|
|
2288
|
+
}
|
|
2289
|
+
async function readQueueOwnerPayloadFromEnv(env) {
|
|
2290
|
+
const payloadFile = env[QUEUE_OWNER_PAYLOAD_FILE_ENV];
|
|
2291
|
+
if (payloadFile) {
|
|
2292
|
+
const payload = await fs$1.readFile(payloadFile, "utf8");
|
|
2293
|
+
await cleanupQueueOwnerPayloadFile(payloadFile).catch(() => {});
|
|
2294
|
+
return payload;
|
|
2295
|
+
}
|
|
2296
|
+
const payload = env[QUEUE_OWNER_PAYLOAD_ENV];
|
|
2297
|
+
if (!payload) throw new Error(`missing ${QUEUE_OWNER_PAYLOAD_ENV}`);
|
|
2298
|
+
return payload;
|
|
2299
|
+
}
|
|
2300
|
+
async function cleanupQueueOwnerPayloadFile(payloadFile) {
|
|
2301
|
+
if (!isQueueOwnerPayloadFile(payloadFile)) return;
|
|
2302
|
+
await fs$1.unlink(payloadFile).catch(() => {});
|
|
2303
|
+
await fs$1.rmdir(path.dirname(payloadFile)).catch(() => {});
|
|
2304
|
+
}
|
|
2305
|
+
function isQueueOwnerPayloadFile(payloadFile) {
|
|
2306
|
+
const resolved = path.resolve(payloadFile);
|
|
2307
|
+
const payloadDir = path.dirname(resolved);
|
|
2308
|
+
return path.dirname(payloadDir) === path.resolve(os.tmpdir()) && path.basename(payloadDir).startsWith("acpx-queue-owner-") && path.basename(resolved) === "payload.json";
|
|
2309
|
+
}
|
|
2310
|
+
//#endregion
|
|
2311
|
+
//#region src/cli-core.ts
|
|
2312
|
+
const TOP_LEVEL_VERBS = /* @__PURE__ */ new Set([
|
|
2313
|
+
"prompt",
|
|
2314
|
+
"exec",
|
|
2315
|
+
"cancel",
|
|
2316
|
+
"compare",
|
|
2317
|
+
"flow",
|
|
2318
|
+
"set-mode",
|
|
2319
|
+
"set",
|
|
2320
|
+
"sessions",
|
|
2321
|
+
"status",
|
|
2322
|
+
"config",
|
|
2323
|
+
"help"
|
|
2324
|
+
]);
|
|
2325
|
+
const TOP_LEVEL_VERSION_VALUE_FLAG_VALUES = [
|
|
2326
|
+
"--agent",
|
|
2327
|
+
"--cwd",
|
|
2328
|
+
"--auth-policy",
|
|
2329
|
+
"--non-interactive-permissions",
|
|
2330
|
+
"--permission-policy",
|
|
2331
|
+
"--policy",
|
|
2332
|
+
"--format",
|
|
2333
|
+
"--model",
|
|
2334
|
+
"--allowed-tools",
|
|
2335
|
+
"--max-turns",
|
|
2336
|
+
"--system-prompt",
|
|
2337
|
+
"--append-system-prompt",
|
|
2338
|
+
"--prompt-retries",
|
|
2339
|
+
"--timeout",
|
|
2340
|
+
"--ttl",
|
|
2341
|
+
"--mcp-config"
|
|
2342
|
+
];
|
|
2343
|
+
const TOP_LEVEL_VERSION_VALUE_FLAGS = new Set(TOP_LEVEL_VERSION_VALUE_FLAG_VALUES);
|
|
2344
|
+
const TOP_LEVEL_VERSION_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
2345
|
+
"--approve-all",
|
|
2346
|
+
"--approve-reads",
|
|
2347
|
+
"--deny-all",
|
|
2348
|
+
"--suppress-reads",
|
|
2349
|
+
"--json-strict",
|
|
2350
|
+
"--no-terminal",
|
|
2351
|
+
"--verbose"
|
|
2352
|
+
]);
|
|
2353
|
+
const AGENT_SCAN_VALUE_FLAG_VALUES = [...TOP_LEVEL_VERSION_VALUE_FLAG_VALUES, "--file"];
|
|
2354
|
+
const AGENT_SCAN_VALUE_FLAGS = new Set(AGENT_SCAN_VALUE_FLAG_VALUES);
|
|
2355
|
+
const AGENT_SCAN_BOOLEAN_FLAGS = new Set(TOP_LEVEL_VERSION_BOOLEAN_FLAGS);
|
|
2356
|
+
let skillflagModulePromise;
|
|
2357
|
+
function loadSkillflagModule() {
|
|
2358
|
+
skillflagModulePromise ??= import("skillflag");
|
|
2359
|
+
return skillflagModulePromise;
|
|
2360
|
+
}
|
|
2361
|
+
function shouldMaybeHandleSkillflag(argv) {
|
|
2362
|
+
return argv.some((token) => token === "--skill" || token.startsWith("--skill="));
|
|
2363
|
+
}
|
|
2364
|
+
function matchesLongFlagValue(token, flags) {
|
|
2365
|
+
for (const flag of flags) if (token.startsWith(`${flag}=`)) return true;
|
|
2366
|
+
return false;
|
|
2367
|
+
}
|
|
2368
|
+
function classifyAgentTokenFlag(token) {
|
|
2369
|
+
if (token === "--agent" || token.startsWith("--agent=")) return "agent-value";
|
|
2370
|
+
if (AGENT_SCAN_VALUE_FLAGS.has(token)) return "skip-next";
|
|
2371
|
+
if (AGENT_SCAN_BOOLEAN_FLAGS.has(token) || matchesLongFlagValue(token, AGENT_SCAN_VALUE_FLAGS) || token.startsWith("--json-strict=")) return "skip";
|
|
2372
|
+
return "unknown";
|
|
2373
|
+
}
|
|
2374
|
+
function scanAgentTokenStep(token, hasAgentOverride) {
|
|
2375
|
+
if (token === "--") return {
|
|
2376
|
+
result: { hasAgentOverride },
|
|
2377
|
+
indexDelta: 0
|
|
2378
|
+
};
|
|
2379
|
+
if (!token.startsWith("-") || token === "-") return {
|
|
2380
|
+
result: {
|
|
2381
|
+
token,
|
|
2382
|
+
hasAgentOverride
|
|
2383
|
+
},
|
|
2384
|
+
indexDelta: 0
|
|
2385
|
+
};
|
|
2386
|
+
const flagScan = classifyAgentTokenFlag(token);
|
|
2387
|
+
if (flagScan === "agent-value") return {
|
|
2388
|
+
indexDelta: token === "--agent" ? 1 : 0,
|
|
2389
|
+
hasAgentOverride: true
|
|
2390
|
+
};
|
|
2391
|
+
if (flagScan === "skip-next") return { indexDelta: 1 };
|
|
2392
|
+
if (flagScan === "skip") return { indexDelta: 0 };
|
|
2393
|
+
return {
|
|
2394
|
+
result: { hasAgentOverride },
|
|
2395
|
+
indexDelta: 0
|
|
2396
|
+
};
|
|
2397
|
+
}
|
|
2398
|
+
function detectAgentToken(argv) {
|
|
2399
|
+
let hasAgentOverride = false;
|
|
2400
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
2401
|
+
const token = argv[index];
|
|
2402
|
+
const step = scanAgentTokenStep(token, hasAgentOverride);
|
|
2403
|
+
if (step.result) return step.result;
|
|
2404
|
+
if (step.hasAgentOverride) hasAgentOverride = true;
|
|
2405
|
+
index += step.indexDelta;
|
|
2406
|
+
}
|
|
2407
|
+
return { hasAgentOverride };
|
|
2408
|
+
}
|
|
2409
|
+
function detectInitialCwd(argv) {
|
|
2410
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
2411
|
+
const token = argv[index];
|
|
2412
|
+
const scan = classifyTopLevelFlagScan(token);
|
|
2413
|
+
if (scan.stop) break;
|
|
2414
|
+
const cwd = readCwdFlagValue(token, argv[index + 1]);
|
|
2415
|
+
if (cwd) return path.resolve(cwd);
|
|
2416
|
+
if (isCwdFlagToken(token)) break;
|
|
2417
|
+
if (scan.skipNext) index += 1;
|
|
2418
|
+
}
|
|
2419
|
+
return process.cwd();
|
|
2420
|
+
}
|
|
2421
|
+
function detectMcpConfigPath(argv, cwd) {
|
|
2422
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
2423
|
+
const scan = scanMcpConfigToken(argv[index], argv[index + 1], cwd);
|
|
2424
|
+
if (scan.stop) return scan.path;
|
|
2425
|
+
if (scan.skipNext) index += 1;
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
function scanMcpConfigToken(token, nextToken, cwd) {
|
|
2429
|
+
if (token === "--" || !token.startsWith("-") || token === "-") return { stop: true };
|
|
2430
|
+
if (token === "--mcp-config") return {
|
|
2431
|
+
path: resolveMcpConfigPath(nextToken, cwd),
|
|
2432
|
+
stop: true
|
|
2433
|
+
};
|
|
2434
|
+
if (token.startsWith("--mcp-config=")) return {
|
|
2435
|
+
path: resolveMcpConfigPath(token.slice(13), cwd),
|
|
2436
|
+
stop: true
|
|
2437
|
+
};
|
|
2438
|
+
return { skipNext: TOP_LEVEL_VERSION_VALUE_FLAGS.has(token) };
|
|
2439
|
+
}
|
|
2440
|
+
function resolveMcpConfigPath(value, cwd) {
|
|
2441
|
+
const trimmed = value?.trim();
|
|
2442
|
+
return trimmed && trimmed !== "--" ? path.resolve(cwd, trimmed) : void 0;
|
|
2443
|
+
}
|
|
2444
|
+
function isCwdFlagToken(token) {
|
|
2445
|
+
return token === "--cwd" || token.startsWith("--cwd=");
|
|
2446
|
+
}
|
|
2447
|
+
function readCwdFlagValue(token, nextToken) {
|
|
2448
|
+
const value = (token === "--cwd" ? nextToken : readInlineFlagValue(token, "--cwd"))?.trim();
|
|
2449
|
+
if (!value || value === "--") return;
|
|
2450
|
+
return value;
|
|
2451
|
+
}
|
|
2452
|
+
function detectRequestedOutputFormat(argv, fallback) {
|
|
2453
|
+
let detectedFormat = fallback;
|
|
2454
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
2455
|
+
const token = argv[index];
|
|
2456
|
+
const scan = classifyTopLevelFlagScan(token);
|
|
2457
|
+
if (scan.stop) break;
|
|
2458
|
+
if (isJsonStrictToken(token)) return "json";
|
|
2459
|
+
const format = readFormatFlagValue(token, argv[index + 1]);
|
|
2460
|
+
if (format) detectedFormat = format;
|
|
2461
|
+
if (scan.skipNext) index += 1;
|
|
2462
|
+
}
|
|
2463
|
+
return detectedFormat;
|
|
2464
|
+
}
|
|
2465
|
+
function classifyTopLevelFlagScan(token) {
|
|
2466
|
+
if (token === "--" || !token.startsWith("-") || token === "-") return {
|
|
2467
|
+
stop: true,
|
|
2468
|
+
skipNext: false
|
|
2469
|
+
};
|
|
2470
|
+
return {
|
|
2471
|
+
stop: false,
|
|
2472
|
+
skipNext: TOP_LEVEL_VERSION_VALUE_FLAGS.has(token)
|
|
2473
|
+
};
|
|
2474
|
+
}
|
|
2475
|
+
function readFormatFlagValue(token, nextToken) {
|
|
2476
|
+
const raw = token === "--format" ? nextToken : readInlineFlagValue(token, "--format");
|
|
2477
|
+
return isOutputFormat(raw) ? raw : void 0;
|
|
2478
|
+
}
|
|
2479
|
+
function readInlineFlagValue(token, flag) {
|
|
2480
|
+
if (!token.startsWith(`${flag}=`)) return;
|
|
2481
|
+
return token.slice(flag.length + 1).trim();
|
|
2482
|
+
}
|
|
2483
|
+
function isOutputFormat(value) {
|
|
2484
|
+
return typeof value === "string" && OUTPUT_FORMATS.includes(value);
|
|
2485
|
+
}
|
|
2486
|
+
function isJsonStrictToken(token) {
|
|
2487
|
+
return token === "--json-strict" || token.startsWith("--json-strict=");
|
|
2488
|
+
}
|
|
2489
|
+
function detectJsonStrict(argv) {
|
|
2490
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
2491
|
+
const token = argv[index];
|
|
2492
|
+
const scan = classifyTopLevelFlagScan(token);
|
|
2493
|
+
if (scan.stop) break;
|
|
2494
|
+
if (isJsonStrictToken(token)) return true;
|
|
2495
|
+
if (scan.skipNext) index += 1;
|
|
2496
|
+
}
|
|
2497
|
+
return false;
|
|
2498
|
+
}
|
|
2499
|
+
function shouldSkipTopLevelVersionToken(token) {
|
|
2500
|
+
return matchesLongFlagValue(token, TOP_LEVEL_VERSION_VALUE_FLAG_VALUES) || TOP_LEVEL_VERSION_BOOLEAN_FLAGS.has(token);
|
|
2501
|
+
}
|
|
2502
|
+
function topLevelVersionTokenDecision(token) {
|
|
2503
|
+
if (token === "--version" || token === "-V") return "version";
|
|
2504
|
+
if (!token.startsWith("-") || token === "-") return "stop";
|
|
2505
|
+
if (TOP_LEVEL_VERSION_VALUE_FLAGS.has(token)) return "skip-next";
|
|
2506
|
+
if (shouldSkipTopLevelVersionToken(token)) return "skip";
|
|
2507
|
+
return "stop";
|
|
2508
|
+
}
|
|
2509
|
+
function isTopLevelVersionRequest(argv) {
|
|
2510
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
2511
|
+
const token = argv[index];
|
|
2512
|
+
if (token === "--") return false;
|
|
2513
|
+
const decision = topLevelVersionTokenDecision(token);
|
|
2514
|
+
if (decision === "version") return true;
|
|
2515
|
+
if (decision === "stop") return false;
|
|
2516
|
+
if (decision === "skip-next") index += 1;
|
|
2517
|
+
}
|
|
2518
|
+
return false;
|
|
2519
|
+
}
|
|
2520
|
+
async function emitJsonErrorEvent(error) {
|
|
2521
|
+
const formatter = createOutputFormatter("json", {
|
|
2522
|
+
jsonContext: { sessionId: "unknown" },
|
|
2523
|
+
suppressReads: false
|
|
2524
|
+
});
|
|
2525
|
+
formatter.onError(error);
|
|
2526
|
+
formatter.flush();
|
|
2527
|
+
}
|
|
2528
|
+
function isOutputAlreadyEmitted(error) {
|
|
2529
|
+
if (!error || typeof error !== "object") return false;
|
|
2530
|
+
return error.outputAlreadyEmitted === true;
|
|
2531
|
+
}
|
|
2532
|
+
async function emitRequestedError(error, normalized, outputPolicy) {
|
|
2533
|
+
if (isOutputAlreadyEmitted(error)) return;
|
|
2534
|
+
if (outputPolicy.format === "json") {
|
|
2535
|
+
await emitJsonErrorEvent(normalized);
|
|
2536
|
+
return;
|
|
2537
|
+
}
|
|
2538
|
+
if (outputPolicy.format === "quiet") {
|
|
2539
|
+
const formatter = createOutputFormatter("quiet");
|
|
2540
|
+
formatter.onError(normalized);
|
|
2541
|
+
formatter.flush();
|
|
2542
|
+
return;
|
|
2543
|
+
}
|
|
2544
|
+
if (!outputPolicy.suppressNonJsonStderr) {
|
|
2545
|
+
process.stderr.write(`${normalized.message}\n`);
|
|
2546
|
+
if (outputPolicy.format === "text") for (const hint of getTextErrorRemediationHints(normalized)) process.stderr.write(`${hint}\n`);
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
async function runWithOutputPolicy(_outputPolicy, run) {
|
|
2550
|
+
return await run();
|
|
2551
|
+
}
|
|
2552
|
+
async function handleQueueOwnerCommand(argv) {
|
|
2553
|
+
installPerfMetricsCapture({
|
|
2554
|
+
argv: argv.slice(2),
|
|
2555
|
+
role: argv[2] === "__queue-owner" ? "queue_owner" : "cli"
|
|
2556
|
+
});
|
|
2557
|
+
if (argv[2] !== "__queue-owner") return false;
|
|
2558
|
+
try {
|
|
2559
|
+
await runQueueOwnerFromEnv(process.env);
|
|
2560
|
+
return true;
|
|
2561
|
+
} catch (error) {
|
|
2562
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2563
|
+
process.stderr.write(`[acpx] queue owner failed: ${message}\n`);
|
|
2564
|
+
process.exit(EXIT_CODES.ERROR);
|
|
2565
|
+
return true;
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
async function maybeHandleSkillflag(argv) {
|
|
2569
|
+
if (!shouldMaybeHandleSkillflag(argv)) return;
|
|
2570
|
+
const { findSkillsRoot, maybeHandleSkillflag } = await loadSkillflagModule();
|
|
2571
|
+
await maybeHandleSkillflag(argv, {
|
|
2572
|
+
skillsRoot: findSkillsRoot(import.meta.url),
|
|
2573
|
+
includeBundledSkill: false
|
|
2574
|
+
});
|
|
2575
|
+
}
|
|
2576
|
+
function createProgram(requestedJsonStrict) {
|
|
2577
|
+
const program = new Command();
|
|
2578
|
+
program.name("acpx").description("Headless CLI client for the Agent Client Protocol").version(getAcpxVersion()).enablePositionalOptions().showHelpAfterError();
|
|
2579
|
+
if (requestedJsonStrict) program.configureOutput({
|
|
2580
|
+
writeOut: () => {},
|
|
2581
|
+
writeErr: () => {}
|
|
2582
|
+
});
|
|
2583
|
+
return program;
|
|
2584
|
+
}
|
|
2585
|
+
async function handleProgramParseError(error, requestedOutputPolicy) {
|
|
2586
|
+
if (error instanceof CommanderError) {
|
|
2587
|
+
if (error.code === "commander.helpDisplayed" || error.code === "commander.version") process.exit(EXIT_CODES.SUCCESS);
|
|
2588
|
+
const normalized = normalizeOutputError(error, {
|
|
2589
|
+
defaultCode: "USAGE",
|
|
2590
|
+
origin: "cli"
|
|
2591
|
+
});
|
|
2592
|
+
await emitRequestedError(error, normalized, requestedOutputPolicy);
|
|
2593
|
+
process.exit(exitCodeForOutputErrorCode(normalized.code));
|
|
2594
|
+
}
|
|
2595
|
+
if (error instanceof InterruptedError) process.exit(EXIT_CODES.INTERRUPTED);
|
|
2596
|
+
const normalized = normalizeOutputError(error, { origin: "cli" });
|
|
2597
|
+
await emitRequestedError(error, normalized, requestedOutputPolicy);
|
|
2598
|
+
process.exit(exitCodeForOutputErrorCode(normalized.code));
|
|
2599
|
+
}
|
|
2600
|
+
async function main(argv = process.argv) {
|
|
2601
|
+
const rawArgs = normalizeLifecycleScriptArgs(argv.slice(2));
|
|
2602
|
+
const normalizedArgv = [
|
|
2603
|
+
argv[0] ?? "node",
|
|
2604
|
+
argv[1] ?? "acpx",
|
|
2605
|
+
...rawArgs
|
|
2606
|
+
];
|
|
2607
|
+
if (await handleQueueOwnerCommand(argv)) return;
|
|
2608
|
+
if (isTopLevelVersionRequest(rawArgs)) {
|
|
2609
|
+
process.stdout.write(`${getAcpxVersion()}\n`);
|
|
2610
|
+
return;
|
|
2611
|
+
}
|
|
2612
|
+
await maybeHandleSkillflag(normalizedArgv);
|
|
2613
|
+
const initialCwd = detectInitialCwd(rawArgs);
|
|
2614
|
+
const config = await loadResolvedConfig(initialCwd, { mcpConfigPath: detectMcpConfigPath(rawArgs, initialCwd) });
|
|
2615
|
+
const requestedJsonStrict = detectJsonStrict(rawArgs);
|
|
2616
|
+
const requestedOutputPolicy = {
|
|
2617
|
+
...resolveOutputPolicy(detectRequestedOutputFormat(rawArgs, config.format), requestedJsonStrict),
|
|
2618
|
+
suppressReads: rawArgs.some((token) => token === "--suppress-reads")
|
|
2619
|
+
};
|
|
2620
|
+
const program = createProgram(requestedJsonStrict);
|
|
2621
|
+
addGlobalFlags(program);
|
|
2622
|
+
configurePublicCli({
|
|
2623
|
+
program,
|
|
2624
|
+
argv: rawArgs,
|
|
2625
|
+
config,
|
|
2626
|
+
requestedJsonStrict,
|
|
2627
|
+
topLevelVerbs: TOP_LEVEL_VERBS,
|
|
2628
|
+
listBuiltInAgents,
|
|
2629
|
+
detectAgentToken,
|
|
2630
|
+
registerAgentCommand,
|
|
2631
|
+
registerDefaultCommands,
|
|
2632
|
+
handlePromptAction: async (command, promptParts) => {
|
|
2633
|
+
await handlePrompt(void 0, promptParts, {}, command, config);
|
|
2634
|
+
}
|
|
2635
|
+
});
|
|
2636
|
+
program.exitOverride((error) => {
|
|
2637
|
+
throw error;
|
|
2638
|
+
});
|
|
2639
|
+
try {
|
|
2640
|
+
await runWithOutputPolicy(requestedOutputPolicy, async () => {
|
|
2641
|
+
try {
|
|
2642
|
+
await program.parseAsync(normalizedArgv);
|
|
2643
|
+
} catch (error) {
|
|
2644
|
+
await handleProgramParseError(error, requestedOutputPolicy);
|
|
2645
|
+
}
|
|
2646
|
+
});
|
|
2647
|
+
} finally {
|
|
2648
|
+
flushPerfMetricsCapture();
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
function normalizeLifecycleScriptArgs(rawArgs) {
|
|
2652
|
+
if (rawArgs[0] === "--" && (process.env.npm_lifecycle_event || process.env.npm_lifecycle_script)) return rawArgs.slice(1);
|
|
2653
|
+
return rawArgs;
|
|
2654
|
+
}
|
|
2655
|
+
//#endregion
|
|
2656
|
+
//#region src/cli.ts
|
|
2657
|
+
function installBrokenPipeHandler(stream) {
|
|
2658
|
+
stream.on("error", (error) => {
|
|
2659
|
+
if (error.code === "EPIPE") process.exit(0);
|
|
2660
|
+
throw error;
|
|
2661
|
+
});
|
|
2662
|
+
}
|
|
2663
|
+
function isCliEntrypoint(argv) {
|
|
2664
|
+
const entry = argv[1];
|
|
2665
|
+
if (!entry) return false;
|
|
2666
|
+
try {
|
|
2667
|
+
const resolved = pathToFileURL(realpathSync(entry)).href;
|
|
2668
|
+
return import.meta.url === resolved;
|
|
2669
|
+
} catch {
|
|
2670
|
+
return false;
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
if (isCliEntrypoint(process.argv)) {
|
|
2674
|
+
installBrokenPipeHandler(process.stdout);
|
|
2675
|
+
installBrokenPipeHandler(process.stderr);
|
|
2676
|
+
const queueOwnerArgOverride = buildQueueOwnerArgOverride(fileURLToPath(import.meta.url));
|
|
2677
|
+
if (queueOwnerArgOverride) process.env.ACPX_QUEUE_OWNER_ARGS ??= queueOwnerArgOverride;
|
|
2678
|
+
main(process.argv);
|
|
2679
|
+
}
|
|
2680
|
+
//#endregion
|
|
2681
|
+
export { formatPromptSessionBannerLine, parseAllowedTools, parseMaxTurns, parseTtlSeconds };
|
|
2682
|
+
|
|
2683
|
+
//# sourceMappingURL=cli.js.map
|