@the-open-engine/zeroshot 6.30.1 → 6.31.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/lib/agent-cli-provider/adapters/acp.d.ts.map +1 -1
- package/lib/agent-cli-provider/adapters/acp.js +7 -11
- package/lib/agent-cli-provider/adapters/acp.js.map +1 -1
- package/lib/agent-cli-provider/adapters/omp-policy.d.ts +4 -0
- package/lib/agent-cli-provider/adapters/omp-policy.d.ts.map +1 -0
- package/lib/agent-cli-provider/adapters/omp-policy.js +47 -0
- package/lib/agent-cli-provider/adapters/omp-policy.js.map +1 -0
- package/lib/agent-cli-provider/adapters/omp.d.ts.map +1 -1
- package/lib/agent-cli-provider/adapters/omp.js +8 -158
- package/lib/agent-cli-provider/adapters/omp.js.map +1 -1
- package/lib/agent-cli-provider/adapters/pi.d.ts.map +1 -1
- package/lib/agent-cli-provider/adapters/pi.js +12 -124
- package/lib/agent-cli-provider/adapters/pi.js.map +1 -1
- package/lib/agent-cli-provider/assistant-stream.d.ts +27 -0
- package/lib/agent-cli-provider/assistant-stream.d.ts.map +1 -0
- package/lib/agent-cli-provider/assistant-stream.js +119 -0
- package/lib/agent-cli-provider/assistant-stream.js.map +1 -0
- package/lib/agent-cli-provider/contract-actions.d.ts.map +1 -1
- package/lib/agent-cli-provider/contract-actions.js +42 -1
- package/lib/agent-cli-provider/contract-actions.js.map +1 -1
- package/lib/agent-cli-provider/contract-invoke.d.ts.map +1 -1
- package/lib/agent-cli-provider/contract-invoke.js +68 -38
- package/lib/agent-cli-provider/contract-invoke.js.map +1 -1
- package/lib/agent-cli-provider/contract-support.d.ts +5 -6
- package/lib/agent-cli-provider/contract-support.d.ts.map +1 -1
- package/lib/agent-cli-provider/contract-support.js +99 -6
- package/lib/agent-cli-provider/contract-support.js.map +1 -1
- package/lib/agent-cli-provider/index.d.ts +8 -6
- package/lib/agent-cli-provider/index.d.ts.map +1 -1
- package/lib/agent-cli-provider/index.js +34 -10
- package/lib/agent-cli-provider/index.js.map +1 -1
- package/lib/agent-cli-provider/omp/auth-policy.d.ts +31 -0
- package/lib/agent-cli-provider/omp/auth-policy.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/auth-policy.js +98 -0
- package/lib/agent-cli-provider/omp/auth-policy.js.map +1 -0
- package/lib/agent-cli-provider/{omp-release.d.ts → omp/release.d.ts} +1 -1
- package/lib/agent-cli-provider/omp/release.d.ts.map +1 -0
- package/lib/agent-cli-provider/{omp-release.js → omp/release.js} +1 -1
- package/lib/agent-cli-provider/omp/release.js.map +1 -0
- package/lib/agent-cli-provider/{omp-rpc-bounds.d.ts → omp/rpc-bounds.d.ts} +1 -1
- package/lib/agent-cli-provider/omp/rpc-bounds.d.ts.map +1 -0
- package/lib/agent-cli-provider/{omp-rpc-bounds.js → omp/rpc-bounds.js} +1 -1
- package/lib/agent-cli-provider/omp/rpc-bounds.js.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-driver-channel.d.ts +19 -0
- package/lib/agent-cli-provider/omp/rpc-driver-channel.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-driver-channel.js +109 -0
- package/lib/agent-cli-provider/omp/rpc-driver-channel.js.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-driver-dispatch.d.ts +27 -0
- package/lib/agent-cli-provider/omp/rpc-driver-dispatch.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-driver-dispatch.js +135 -0
- package/lib/agent-cli-provider/omp/rpc-driver-dispatch.js.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-driver-runner.d.ts +3 -0
- package/lib/agent-cli-provider/omp/rpc-driver-runner.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-driver-runner.js +205 -0
- package/lib/agent-cli-provider/omp/rpc-driver-runner.js.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-driver-state.d.ts +80 -0
- package/lib/agent-cli-provider/omp/rpc-driver-state.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-driver-state.js +86 -0
- package/lib/agent-cli-provider/omp/rpc-driver-state.js.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-driver.d.ts +3 -0
- package/lib/agent-cli-provider/omp/rpc-driver.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-driver.js +6 -0
- package/lib/agent-cli-provider/omp/rpc-driver.js.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-event-lines.d.ts +8 -0
- package/lib/agent-cli-provider/omp/rpc-event-lines.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-event-lines.js +59 -0
- package/lib/agent-cli-provider/omp/rpc-event-lines.js.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-events.d.ts +16 -0
- package/lib/agent-cli-provider/omp/rpc-events.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-events.js +115 -0
- package/lib/agent-cli-provider/omp/rpc-events.js.map +1 -0
- package/lib/agent-cli-provider/{omp-rpc-protocol.d.ts → omp/rpc-protocol-contract.d.ts} +1 -13
- package/lib/agent-cli-provider/omp/rpc-protocol-contract.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-protocol-contract.js +54 -0
- package/lib/agent-cli-provider/omp/rpc-protocol-contract.js.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-protocol.d.ts +15 -0
- package/lib/agent-cli-provider/omp/rpc-protocol.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/rpc-protocol.js +208 -0
- package/lib/agent-cli-provider/omp/rpc-protocol.js.map +1 -0
- package/lib/agent-cli-provider/{omp-rpc-session.d.ts → omp/rpc-session.d.ts} +1 -1
- package/lib/agent-cli-provider/omp/rpc-session.d.ts.map +1 -0
- package/lib/agent-cli-provider/{omp-rpc-session.js → omp/rpc-session.js} +1 -1
- package/lib/agent-cli-provider/omp/rpc-session.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-contract.d.ts +34 -0
- package/lib/agent-cli-provider/omp/sdk-contract.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-contract.js +81 -0
- package/lib/agent-cli-provider/omp/sdk-contract.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-process-credentials.d.ts +6 -0
- package/lib/agent-cli-provider/omp/sdk-process-credentials.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-process-credentials.js +44 -0
- package/lib/agent-cli-provider/omp/sdk-process-credentials.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-process-error.d.ts +5 -0
- package/lib/agent-cli-provider/omp/sdk-process-error.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-process-error.js +13 -0
- package/lib/agent-cli-provider/omp/sdk-process-error.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-process-io.d.ts +18 -0
- package/lib/agent-cli-provider/omp/sdk-process-io.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-process-io.js +80 -0
- package/lib/agent-cli-provider/omp/sdk-process-io.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-process-private-runtime.d.ts +51 -0
- package/lib/agent-cli-provider/omp/sdk-process-private-runtime.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-process-private-runtime.js +154 -0
- package/lib/agent-cli-provider/omp/sdk-process-private-runtime.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-process-result.d.ts +26 -0
- package/lib/agent-cli-provider/omp/sdk-process-result.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-process-result.js +117 -0
- package/lib/agent-cli-provider/omp/sdk-process-result.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-process-runner.d.ts +7 -0
- package/lib/agent-cli-provider/omp/sdk-process-runner.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-process-runner.js +204 -0
- package/lib/agent-cli-provider/omp/sdk-process-runner.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-collector.d.ts +3 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-collector.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-collector.js +145 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-collector.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-frame.d.ts +4 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-frame.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-frame.js +183 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-frame.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-request.d.ts +8 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-request.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-request.js +170 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-request.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-result.d.ts +5 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-result.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-result.js +74 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-result.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-types.d.ts +94 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-types.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-types.js +54 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-types.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-value.d.ts +18 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-value.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-value.js +229 -0
- package/lib/agent-cli-provider/omp/sdk-protocol-value.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol.d.ts +7 -0
- package/lib/agent-cli-provider/omp/sdk-protocol.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-protocol.js +28 -0
- package/lib/agent-cli-provider/omp/sdk-protocol.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-runtime.d.ts +29 -0
- package/lib/agent-cli-provider/omp/sdk-runtime.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-runtime.js +110 -0
- package/lib/agent-cli-provider/omp/sdk-runtime.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-auth.d.ts +3 -0
- package/lib/agent-cli-provider/omp/sdk-settings-auth.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-auth.js +86 -0
- package/lib/agent-cli-provider/omp/sdk-settings-auth.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-constants.d.ts +26 -0
- package/lib/agent-cli-provider/omp/sdk-settings-constants.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-constants.js +148 -0
- package/lib/agent-cli-provider/omp/sdk-settings-constants.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-model-fields.d.ts +5 -0
- package/lib/agent-cli-provider/omp/sdk-settings-model-fields.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-model-fields.js +198 -0
- package/lib/agent-cli-provider/omp/sdk-settings-model-fields.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-model.d.ts +4 -0
- package/lib/agent-cli-provider/omp/sdk-settings-model.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-model.js +163 -0
- package/lib/agent-cli-provider/omp/sdk-settings-model.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-normalize.d.ts +18 -0
- package/lib/agent-cli-provider/omp/sdk-settings-normalize.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-normalize.js +148 -0
- package/lib/agent-cli-provider/omp/sdk-settings-normalize.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-selector.d.ts +3 -0
- package/lib/agent-cli-provider/omp/sdk-settings-selector.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-selector.js +22 -0
- package/lib/agent-cli-provider/omp/sdk-settings-selector.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-types.d.ts +68 -0
- package/lib/agent-cli-provider/omp/sdk-settings-types.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-types.js +19 -0
- package/lib/agent-cli-provider/omp/sdk-settings-types.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-values.d.ts +14 -0
- package/lib/agent-cli-provider/omp/sdk-settings-values.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings-values.js +112 -0
- package/lib/agent-cli-provider/omp/sdk-settings-values.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings.d.ts +5 -0
- package/lib/agent-cli-provider/omp/sdk-settings.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-settings.js +16 -0
- package/lib/agent-cli-provider/omp/sdk-settings.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-context.d.ts +11 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-context.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-context.js +171 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-context.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-credentials.d.ts +5 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-credentials.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-credentials.js +94 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-credentials.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-execute.d.ts +5 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-execute.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-execute.js +175 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-execute.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-output.d.ts +5 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-output.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-output.js +216 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-output.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-runtime.d.ts +11 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-runtime.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-runtime.js +265 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-runtime.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-types.d.ts +148 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-types.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-types.js +84 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar-types.js.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar.d.ts +4 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar.d.ts.map +1 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar.js +9 -0
- package/lib/agent-cli-provider/omp/sdk-sidecar.js.map +1 -0
- package/lib/agent-cli-provider/process-runner.d.ts +1 -0
- package/lib/agent-cli-provider/process-runner.d.ts.map +1 -1
- package/lib/agent-cli-provider/process-runner.js +19 -6
- package/lib/agent-cli-provider/process-runner.js.map +1 -1
- package/lib/agent-cli-provider/provider-registry.d.ts +18 -4
- package/lib/agent-cli-provider/provider-registry.d.ts.map +1 -1
- package/lib/agent-cli-provider/provider-registry.js +21 -7
- package/lib/agent-cli-provider/provider-registry.js.map +1 -1
- package/lib/agent-cli-provider/single-agent-runtime.d.ts +10 -1
- package/lib/agent-cli-provider/single-agent-runtime.d.ts.map +1 -1
- package/lib/agent-cli-provider/single-agent-runtime.js +378 -11
- package/lib/agent-cli-provider/single-agent-runtime.js.map +1 -1
- package/lib/agent-cli-provider/types.d.ts +110 -2
- package/lib/agent-cli-provider/types.d.ts.map +1 -1
- package/lib/agent-cli-provider/types.js.map +1 -1
- package/npm-shrinkwrap.json +18116 -0
- package/package.json +16 -3
- package/scripts/omp/bun-ffi.d.ts +28 -0
- package/scripts/omp/host-supervisor-cleanup.ts +100 -0
- package/scripts/omp/host-supervisor-launch.ts +38 -0
- package/scripts/omp/host-supervisor-native.ts +181 -0
- package/scripts/omp/host-supervisor-tracker.ts +258 -0
- package/scripts/omp/host-supervisor.ts +298 -0
- package/scripts/omp/promise-gate.ts +13 -0
- package/scripts/omp/runtime-identities.js +283 -0
- package/scripts/omp/runtime-lock.js +232 -0
- package/scripts/omp/runtime-release.js +105 -0
- package/scripts/omp/runtime.js +33 -0
- package/scripts/omp/sidecar.ts +124 -0
- package/scripts/opcore-introduced-check.js +5 -0
- package/scripts/release-preflight.js +19 -0
- package/src/agent-cli-provider/adapters/acp.ts +18 -17
- package/src/agent-cli-provider/adapters/omp-policy.ts +45 -0
- package/src/agent-cli-provider/adapters/omp.ts +9 -155
- package/src/agent-cli-provider/adapters/pi.ts +15 -145
- package/src/agent-cli-provider/assistant-stream.ts +155 -0
- package/src/agent-cli-provider/contract-actions.ts +14 -2
- package/src/agent-cli-provider/contract-invoke.ts +77 -40
- package/src/agent-cli-provider/contract-support.ts +83 -12
- package/src/agent-cli-provider/index.ts +60 -5
- package/src/agent-cli-provider/omp/auth-policy.ts +126 -0
- package/src/agent-cli-provider/omp/rpc-driver-channel.ts +144 -0
- package/src/agent-cli-provider/omp/rpc-driver-dispatch.ts +177 -0
- package/src/agent-cli-provider/omp/rpc-driver-runner.ts +199 -0
- package/src/agent-cli-provider/omp/rpc-driver-state.ts +165 -0
- package/src/agent-cli-provider/omp/rpc-driver.ts +8 -0
- package/src/agent-cli-provider/omp/rpc-event-lines.ts +58 -0
- package/src/agent-cli-provider/omp/rpc-events.ts +154 -0
- package/src/agent-cli-provider/omp/rpc-protocol-contract.ts +77 -0
- package/src/agent-cli-provider/{omp-rpc-protocol.ts → omp/rpc-protocol.ts} +9 -111
- package/src/agent-cli-provider/omp/sdk-contract.ts +123 -0
- package/src/agent-cli-provider/omp/sdk-process-credentials.ts +55 -0
- package/src/agent-cli-provider/omp/sdk-process-error.ts +9 -0
- package/src/agent-cli-provider/omp/sdk-process-io.ts +92 -0
- package/src/agent-cli-provider/omp/sdk-process-private-runtime.ts +249 -0
- package/src/agent-cli-provider/omp/sdk-process-result.ts +181 -0
- package/src/agent-cli-provider/omp/sdk-process-runner.ts +281 -0
- package/src/agent-cli-provider/omp/sdk-protocol-collector.ts +140 -0
- package/src/agent-cli-provider/omp/sdk-protocol-frame.ts +260 -0
- package/src/agent-cli-provider/omp/sdk-protocol-request.ts +181 -0
- package/src/agent-cli-provider/omp/sdk-protocol-result.ts +80 -0
- package/src/agent-cli-provider/omp/sdk-protocol-types.ts +156 -0
- package/src/agent-cli-provider/omp/sdk-protocol-value.ts +234 -0
- package/src/agent-cli-provider/omp/sdk-protocol.ts +46 -0
- package/src/agent-cli-provider/omp/sdk-runtime.ts +159 -0
- package/src/agent-cli-provider/omp/sdk-settings-auth.ts +78 -0
- package/src/agent-cli-provider/omp/sdk-settings-constants.ts +147 -0
- package/src/agent-cli-provider/omp/sdk-settings-model-fields.ts +233 -0
- package/src/agent-cli-provider/omp/sdk-settings-model.ts +238 -0
- package/src/agent-cli-provider/omp/sdk-settings-normalize.ts +242 -0
- package/src/agent-cli-provider/omp/sdk-settings-selector.ts +28 -0
- package/src/agent-cli-provider/omp/sdk-settings-types.ts +88 -0
- package/src/agent-cli-provider/omp/sdk-settings-values.ts +118 -0
- package/src/agent-cli-provider/omp/sdk-settings.ts +33 -0
- package/src/agent-cli-provider/omp/sdk-sidecar-context.ts +199 -0
- package/src/agent-cli-provider/omp/sdk-sidecar-credentials.ts +100 -0
- package/src/agent-cli-provider/omp/sdk-sidecar-execute.ts +201 -0
- package/src/agent-cli-provider/omp/sdk-sidecar-output.ts +235 -0
- package/src/agent-cli-provider/omp/sdk-sidecar-runtime.ts +244 -0
- package/src/agent-cli-provider/omp/sdk-sidecar-types.ts +173 -0
- package/src/agent-cli-provider/omp/sdk-sidecar.ts +3 -0
- package/src/agent-cli-provider/process-runner.ts +22 -8
- package/src/agent-cli-provider/provider-registry.ts +29 -10
- package/src/agent-cli-provider/single-agent-runtime.ts +444 -18
- package/src/agent-cli-provider/types.ts +131 -3
- package/src/command-cleanup-ownership.js +15 -0
- package/task-lib/omp-sdk-runtime.js +8 -0
- package/task-lib/runner.js +121 -40
- package/task-lib/sdk-watcher.js +154 -0
- package/lib/agent-cli-provider/omp-release.d.ts.map +0 -1
- package/lib/agent-cli-provider/omp-release.js.map +0 -1
- package/lib/agent-cli-provider/omp-rpc-bounds.d.ts.map +0 -1
- package/lib/agent-cli-provider/omp-rpc-bounds.js.map +0 -1
- package/lib/agent-cli-provider/omp-rpc-driver.d.ts +0 -40
- package/lib/agent-cli-provider/omp-rpc-driver.d.ts.map +0 -1
- package/lib/agent-cli-provider/omp-rpc-driver.js +0 -519
- package/lib/agent-cli-provider/omp-rpc-driver.js.map +0 -1
- package/lib/agent-cli-provider/omp-rpc-events.d.ts +0 -28
- package/lib/agent-cli-provider/omp-rpc-events.d.ts.map +0 -1
- package/lib/agent-cli-provider/omp-rpc-events.js +0 -264
- package/lib/agent-cli-provider/omp-rpc-events.js.map +0 -1
- package/lib/agent-cli-provider/omp-rpc-protocol.d.ts.map +0 -1
- package/lib/agent-cli-provider/omp-rpc-protocol.js +0 -272
- package/lib/agent-cli-provider/omp-rpc-protocol.js.map +0 -1
- package/lib/agent-cli-provider/omp-rpc-session.d.ts.map +0 -1
- package/lib/agent-cli-provider/omp-rpc-session.js.map +0 -1
- package/src/agent-cli-provider/omp-rpc-driver.ts +0 -639
- package/src/agent-cli-provider/omp-rpc-events.ts +0 -318
- /package/src/agent-cli-provider/{omp-release.ts → omp/release.ts} +0 -0
- /package/src/agent-cli-provider/{omp-rpc-bounds.ts → omp/rpc-bounds.ts} +0 -0
- /package/src/agent-cli-provider/{omp-rpc-session.ts → omp/rpc-session.ts} +0 -0
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
StructuredOutputProviderRegistryEntry,
|
|
13
13
|
UnstructuredOutputProviderRegistryEntry,
|
|
14
14
|
} from './provider-registry';
|
|
15
|
-
import type { OmpSessionLaunch } from './omp
|
|
15
|
+
import type { OmpSessionLaunch } from './omp/rpc-session';
|
|
16
16
|
|
|
17
17
|
export type ProviderId = (typeof providerIds)[number];
|
|
18
18
|
export type ProviderAlias = (typeof providerAliases)[number];
|
|
@@ -290,7 +290,12 @@ export interface CleanupMetadata {
|
|
|
290
290
|
readonly kind: 'temp-file' | 'temp-directory';
|
|
291
291
|
readonly provider: ProviderId;
|
|
292
292
|
readonly path: string;
|
|
293
|
-
readonly reason:
|
|
293
|
+
readonly reason:
|
|
294
|
+
| 'output-schema'
|
|
295
|
+
| 'settings-overlay'
|
|
296
|
+
| 'admin-policy'
|
|
297
|
+
| 'isolated-config'
|
|
298
|
+
| 'sdk-private-root';
|
|
294
299
|
}
|
|
295
300
|
|
|
296
301
|
export interface WarningMetadata {
|
|
@@ -310,6 +315,118 @@ export interface WebSearchAttestation {
|
|
|
310
315
|
readonly effective: boolean;
|
|
311
316
|
}
|
|
312
317
|
|
|
318
|
+
export type InvocationLane = 'spawn' | 'acp-stdio' | 'rpc-stdio';
|
|
319
|
+
|
|
320
|
+
export interface InvocationLaneMetadata {
|
|
321
|
+
readonly lane: InvocationLane;
|
|
322
|
+
readonly pty: boolean;
|
|
323
|
+
readonly protocol?: 'omp-sdk-v1' | 'omp-rpc-v2' | 'acp';
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export type PreparedInvocationParser = 'provider' | 'acp' | 'omp-sdk-ndjson';
|
|
327
|
+
|
|
328
|
+
export interface PreparedProviderInvoke {
|
|
329
|
+
readonly lane: InvocationLane;
|
|
330
|
+
readonly parser: PreparedInvocationParser;
|
|
331
|
+
readonly ptyEligible: boolean;
|
|
332
|
+
readonly strictTerminal: boolean;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export interface PreparedEnvironmentPolicy {
|
|
336
|
+
readonly inherit: 'minimal';
|
|
337
|
+
readonly values: Readonly<Record<string, string>>;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export interface PreparedPrivateArtifacts {
|
|
341
|
+
readonly root: string;
|
|
342
|
+
readonly requestPath: string;
|
|
343
|
+
readonly owned: true;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export interface OmpSdkExecutionIdentity {
|
|
347
|
+
readonly backend: 'omp-sdk';
|
|
348
|
+
readonly backendVersion: '17.2.1';
|
|
349
|
+
readonly runtime: {
|
|
350
|
+
readonly name: 'bun';
|
|
351
|
+
readonly version: '1.3.14';
|
|
352
|
+
};
|
|
353
|
+
readonly transport: 'sdk';
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface OmpSdkSemanticIdentity {
|
|
357
|
+
readonly requestedModelSelector: string;
|
|
358
|
+
readonly reasoningEffort: ReasoningEffort;
|
|
359
|
+
readonly provider: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export interface OmpSdkContainmentRequirement {
|
|
363
|
+
readonly mode: 'host-process-tree' | 'container';
|
|
364
|
+
readonly required: true;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export interface OmpSdkCleanupAttestation {
|
|
368
|
+
readonly mode: OmpSdkContainmentRequirement['mode'];
|
|
369
|
+
readonly terminalBuffered: true;
|
|
370
|
+
readonly descendantsReaped: true;
|
|
371
|
+
readonly clean: true;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export interface OmpSdkRequestedIdentity {
|
|
375
|
+
readonly modelSelector: string;
|
|
376
|
+
readonly reasoningEffort: ReasoningEffort;
|
|
377
|
+
readonly outputMode: 'json' | 'text';
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export interface OmpSdkResolvedIdentity {
|
|
381
|
+
readonly modelSelector: string;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export interface OmpSdkStrictOutputEvidence {
|
|
385
|
+
readonly source: 'caller';
|
|
386
|
+
readonly mode: 'strict';
|
|
387
|
+
readonly status: 'valid';
|
|
388
|
+
readonly yieldCount: 1;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export interface OmpSdkUsageEvidence {
|
|
392
|
+
readonly source: 'omp-aggregate';
|
|
393
|
+
readonly completeness: 'unknown';
|
|
394
|
+
readonly inputTokens: number;
|
|
395
|
+
readonly outputTokens: number;
|
|
396
|
+
readonly cacheReadInputTokens: number;
|
|
397
|
+
readonly cacheCreationInputTokens: number;
|
|
398
|
+
readonly totalTokens: number;
|
|
399
|
+
readonly requests: number;
|
|
400
|
+
readonly durationMs: number;
|
|
401
|
+
readonly cost: {
|
|
402
|
+
readonly input: number;
|
|
403
|
+
readonly output: number;
|
|
404
|
+
readonly cacheRead: number;
|
|
405
|
+
readonly cacheWrite: number;
|
|
406
|
+
readonly total: number;
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export interface OmpSdkTerminalEvidence {
|
|
411
|
+
readonly backend: {
|
|
412
|
+
readonly id: 'omp-sdk';
|
|
413
|
+
readonly version: '17.2.1';
|
|
414
|
+
};
|
|
415
|
+
readonly runtime: {
|
|
416
|
+
readonly name: 'bun';
|
|
417
|
+
readonly version: '1.3.14';
|
|
418
|
+
};
|
|
419
|
+
readonly requested: OmpSdkRequestedIdentity;
|
|
420
|
+
readonly resolved: OmpSdkResolvedIdentity;
|
|
421
|
+
readonly strictOutput: OmpSdkStrictOutputEvidence;
|
|
422
|
+
readonly fallback: false;
|
|
423
|
+
readonly execution: {
|
|
424
|
+
readonly exitCode: 0;
|
|
425
|
+
readonly aborted: false;
|
|
426
|
+
};
|
|
427
|
+
readonly usage: OmpSdkUsageEvidence;
|
|
428
|
+
}
|
|
429
|
+
|
|
313
430
|
export interface CommandSpec {
|
|
314
431
|
readonly binary: string;
|
|
315
432
|
readonly args: readonly string[];
|
|
@@ -319,6 +436,7 @@ export interface CommandSpec {
|
|
|
319
436
|
readonly cleanupMetadata: readonly CleanupMetadata[];
|
|
320
437
|
readonly warnings: readonly WarningMetadata[];
|
|
321
438
|
readonly redactions: readonly RedactionMetadata[];
|
|
439
|
+
readonly invocation?: InvocationLaneMetadata;
|
|
322
440
|
}
|
|
323
441
|
|
|
324
442
|
export interface BuildProviderCommandOptions {
|
|
@@ -331,7 +449,7 @@ export interface BuildProviderCommandOptions {
|
|
|
331
449
|
readonly resumeSessionId?: string;
|
|
332
450
|
readonly continueSession?: boolean;
|
|
333
451
|
// OMP-only: a verified session launch (none/fresh/resume) built from a checked partition —
|
|
334
|
-
// never a raw session id string. See src/agent-cli-provider/omp
|
|
452
|
+
// never a raw session id string. See src/agent-cli-provider/omp/rpc-session.ts.
|
|
335
453
|
readonly ompSession?: OmpSessionLaunch;
|
|
336
454
|
readonly webSearch?: boolean;
|
|
337
455
|
readonly claudeSettingsFile?: string;
|
|
@@ -339,6 +457,11 @@ export interface BuildProviderCommandOptions {
|
|
|
339
457
|
readonly authEnv?: Readonly<Record<string, string>>;
|
|
340
458
|
readonly strictSchema?: boolean;
|
|
341
459
|
readonly gateway?: GatewayBuildOptions;
|
|
460
|
+
/**
|
|
461
|
+
* Required for fresh OMP SDK runs so preparation can select the containment and
|
|
462
|
+
* authentication policy before any private request is materialized.
|
|
463
|
+
*/
|
|
464
|
+
readonly executionContext?: 'host' | 'detached' | 'docker' | 'benchmark';
|
|
342
465
|
// MCP server configs forwarded to providers that accept an MCP config CLI flag. Claude accepts
|
|
343
466
|
// one variadic `--mcp-config` followed by file paths; adapters such as Copilot accept repeated
|
|
344
467
|
// flags with inline JSON so configs survive container path translation.
|
|
@@ -383,6 +506,11 @@ export interface ResultEvent {
|
|
|
383
506
|
readonly cacheReadInputTokens?: number;
|
|
384
507
|
readonly cacheCreationInputTokens?: number;
|
|
385
508
|
readonly modelUsage?: unknown;
|
|
509
|
+
readonly requests?: number;
|
|
510
|
+
readonly usageSource?: 'omp-aggregate';
|
|
511
|
+
readonly usageCompleteness?: 'unknown';
|
|
512
|
+
readonly invocation?: InvocationLaneMetadata;
|
|
513
|
+
readonly ompSdk?: OmpSdkTerminalEvidence;
|
|
386
514
|
}
|
|
387
515
|
|
|
388
516
|
export type OutputEvent = TextEvent | ThinkingEvent | ToolCallEvent | ToolResultEvent | ResultEvent;
|
|
@@ -17,6 +17,7 @@ const POLICY_DIRECTORY_PATTERN = /^zeroshot-gemini-policy-[A-Za-z0-9_-]+$/u;
|
|
|
17
17
|
const POLICY_FILE_PATTERN =
|
|
18
18
|
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\.toml$/u;
|
|
19
19
|
const OPENCODE_CONFIG_DIRECTORY_PATTERN = /^zeroshot-opencode-config-[A-Za-z0-9_-]+$/u;
|
|
20
|
+
const OMP_SDK_PRIVATE_DIRECTORY_PATTERN = /^zeroshot-omp-sdk-[A-Za-z0-9_-]+$/u;
|
|
20
21
|
|
|
21
22
|
function assertClosedCleanupMetadata(cleanupPath, metadata) {
|
|
22
23
|
if (!metadata || typeof metadata !== 'object' || Array.isArray(metadata)) {
|
|
@@ -121,6 +122,16 @@ function assertOwnedOmpConfigDirectory(cleanupPath) {
|
|
|
121
122
|
}
|
|
122
123
|
return false;
|
|
123
124
|
}
|
|
125
|
+
function assertOwnedOmpSdkDirectory(cleanupPath) {
|
|
126
|
+
if (assertOwnedNamedTempDirectory(cleanupPath, OMP_SDK_PRIVATE_DIRECTORY_PATTERN)) return true;
|
|
127
|
+
const stat = lstatSync(cleanupPath);
|
|
128
|
+
const ownedByProcess = typeof process.getuid !== 'function' || stat.uid === process.getuid();
|
|
129
|
+
const privateMode = process.platform === 'win32' || (stat.mode & 0o777) === 0o700;
|
|
130
|
+
if (!ownedByProcess || !privateMode) {
|
|
131
|
+
throw new Error(`Refusing unowned temporary directory cleanup: ${cleanupPath}`);
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
124
135
|
|
|
125
136
|
function assertOwnedTempDirectory(cleanupPath, metadata) {
|
|
126
137
|
const isOpenCodeConfig =
|
|
@@ -133,6 +144,10 @@ function assertOwnedTempDirectory(cleanupPath, metadata) {
|
|
|
133
144
|
if (isOmpConfig) {
|
|
134
145
|
return assertOwnedOmpConfigDirectory(cleanupPath);
|
|
135
146
|
}
|
|
147
|
+
const isOmpSdkPrivateRoot = metadata.provider === 'omp' && metadata.reason === 'sdk-private-root';
|
|
148
|
+
if (isOmpSdkPrivateRoot) {
|
|
149
|
+
return assertOwnedOmpSdkDirectory(cleanupPath);
|
|
150
|
+
}
|
|
136
151
|
|
|
137
152
|
if (
|
|
138
153
|
metadata.provider !== 'claude' ||
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
|
|
5
|
+
export const { resolveOmpTransport } = require('../lib/agent-cli-provider/single-agent-runtime.js');
|
|
6
|
+
export const {
|
|
7
|
+
spawnOmpSdkProcess,
|
|
8
|
+
} = require('../lib/agent-cli-provider/omp/sdk-process-runner.js');
|
package/task-lib/runner.js
CHANGED
|
@@ -24,6 +24,8 @@ const {
|
|
|
24
24
|
prepareSingleAgentProviderCommand,
|
|
25
25
|
} = require('./provider-helper-runtime.js');
|
|
26
26
|
const { getDefaultProviderId } = require('../lib/provider-names.js');
|
|
27
|
+
const { loadSettings } = require('../lib/settings.js');
|
|
28
|
+
const { resolveOmpTransport } = require('./omp-sdk-runtime.js');
|
|
27
29
|
const {
|
|
28
30
|
ISOLATED_SETTINGS_FILE_ENV,
|
|
29
31
|
ISOLATED_SETTINGS_FILE_MARKER,
|
|
@@ -155,10 +157,11 @@ export function resolveOmpResumeExpectation({ descriptor, storageRoot, canonical
|
|
|
155
157
|
* the structural/identity/fingerprint verification plus the owner transfer happen in the rpc-stdio
|
|
156
158
|
* watcher, not here.
|
|
157
159
|
*/
|
|
158
|
-
function resolveOmpSessionPlan({ id, cwd, options }) {
|
|
160
|
+
function resolveOmpSessionPlan({ id, cwd, options, providerName }) {
|
|
159
161
|
if (options.structuredOutputRecovery) return null;
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
+
const resolvedProviderName =
|
|
163
|
+
providerName || normalizeProviderName(options.provider || getDefaultProviderId());
|
|
164
|
+
if (resolvedProviderName !== 'omp') return null;
|
|
162
165
|
// Docker stays fresh-only (issue #866). Returning null here means no partition is allocated, no
|
|
163
166
|
// ownership row is written, and the adapter falls back to `--no-session`.
|
|
164
167
|
if (isOmpSessionlessRun(options)) return null;
|
|
@@ -237,6 +240,47 @@ function failSpawnAtProvisionalBoundary(id, error) {
|
|
|
237
240
|
console.warn(`Warning: failed to mark task ${id} failed: ${updateError.message}`);
|
|
238
241
|
}
|
|
239
242
|
}
|
|
243
|
+
function prepareTaskSpawn(prompt, options, runtime) {
|
|
244
|
+
const outputFormat = resolveOutputFormat(options);
|
|
245
|
+
const jsonSchema = resolveJsonSchema(options, outputFormat);
|
|
246
|
+
const settings = loadSettings();
|
|
247
|
+
const providerName = normalizeProviderName(
|
|
248
|
+
options.provider || settings.defaultProvider || getDefaultProviderId()
|
|
249
|
+
);
|
|
250
|
+
const ompTransport = providerName === 'omp' ? resolveOmpTransport(settings) : null;
|
|
251
|
+
const providerOutputFormat =
|
|
252
|
+
ompTransport === 'sdk' && outputFormat === 'stream-json' && jsonSchema === null
|
|
253
|
+
? 'text'
|
|
254
|
+
: outputFormat;
|
|
255
|
+
if (ompTransport === 'sdk' && options.ompResume) {
|
|
256
|
+
throw new Error(
|
|
257
|
+
'OMP SDK detached runs are always fresh; --omp-resume requires transport "rpc".'
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
const ompPlan =
|
|
261
|
+
ompTransport === 'rpc' ? resolveOmpSessionPlan({ ...runtime, options, providerName }) : null;
|
|
262
|
+
const prepared = prepareTaskProviderCommandFromResolved(
|
|
263
|
+
prompt,
|
|
264
|
+
options,
|
|
265
|
+
{
|
|
266
|
+
outputFormat: providerOutputFormat,
|
|
267
|
+
jsonSchema,
|
|
268
|
+
cwd: runtime.cwd,
|
|
269
|
+
ompSession: ompPlan?.session,
|
|
270
|
+
},
|
|
271
|
+
settings
|
|
272
|
+
);
|
|
273
|
+
const resolvedProviderName = prepared.adapter.id;
|
|
274
|
+
return {
|
|
275
|
+
outputFormat,
|
|
276
|
+
jsonSchema,
|
|
277
|
+
ompPlan,
|
|
278
|
+
prepared,
|
|
279
|
+
providerName: resolvedProviderName,
|
|
280
|
+
modelSpec: prepared.options.modelSpec,
|
|
281
|
+
commandSpec: attachClaudeOverlayCleanup(prepared.commandSpec, resolvedProviderName),
|
|
282
|
+
};
|
|
283
|
+
}
|
|
240
284
|
|
|
241
285
|
export function spawnTask(prompt, options = {}) {
|
|
242
286
|
ensureDirs();
|
|
@@ -245,18 +289,8 @@ export function spawnTask(prompt, options = {}) {
|
|
|
245
289
|
const logFile = join(LOGS_DIR, `${id}.log`);
|
|
246
290
|
const cwd = options.cwd || process.cwd();
|
|
247
291
|
|
|
248
|
-
const outputFormat =
|
|
249
|
-
|
|
250
|
-
const ompPlan = resolveOmpSessionPlan({ id, cwd, options });
|
|
251
|
-
const prepared = prepareTaskProviderCommandFromResolved(prompt, options, {
|
|
252
|
-
outputFormat,
|
|
253
|
-
jsonSchema,
|
|
254
|
-
cwd,
|
|
255
|
-
ompSession: ompPlan?.session,
|
|
256
|
-
});
|
|
257
|
-
const providerName = prepared.adapter.id;
|
|
258
|
-
const modelSpec = prepared.options.modelSpec;
|
|
259
|
-
const commandSpec = attachClaudeOverlayCleanup(prepared.commandSpec, providerName);
|
|
292
|
+
const { outputFormat, jsonSchema, ompPlan, prepared, providerName, modelSpec, commandSpec } =
|
|
293
|
+
prepareTaskSpawn(prompt, options, { id, cwd });
|
|
260
294
|
|
|
261
295
|
const task = buildTaskRecord({
|
|
262
296
|
id,
|
|
@@ -293,6 +327,7 @@ export function spawnTask(prompt, options = {}) {
|
|
|
293
327
|
jsonSchema,
|
|
294
328
|
options,
|
|
295
329
|
providerName,
|
|
330
|
+
prepared,
|
|
296
331
|
commandSpec,
|
|
297
332
|
ompPlan
|
|
298
333
|
);
|
|
@@ -301,7 +336,8 @@ export function spawnTask(prompt, options = {}) {
|
|
|
301
336
|
attachable: options.attachable,
|
|
302
337
|
jsonSchema,
|
|
303
338
|
},
|
|
304
|
-
providerName
|
|
339
|
+
providerName,
|
|
340
|
+
prepared.invoke
|
|
305
341
|
);
|
|
306
342
|
spawnWatcher({
|
|
307
343
|
watcherScript,
|
|
@@ -310,10 +346,9 @@ export function spawnTask(prompt, options = {}) {
|
|
|
310
346
|
logFile,
|
|
311
347
|
finalArgs: commandSpec.args,
|
|
312
348
|
watcherConfig,
|
|
313
|
-
// Prompt bytes never enter argv: the rpc-stdio watcher receives them over a private pipe
|
|
314
|
-
//
|
|
315
|
-
|
|
316
|
-
...(isRpcStdioLane(providerName)
|
|
349
|
+
// Prompt bytes never enter argv: the rpc-stdio watcher receives them over a private pipe,
|
|
350
|
+
// while the SDK watcher receives only the path to its owner-only request file.
|
|
351
|
+
...(isRpcStdioInvoke(prepared.invoke)
|
|
317
352
|
? { rpcPrompt: buildOmpPrompt(prompt, prepared.options || {}) }
|
|
318
353
|
: {}),
|
|
319
354
|
});
|
|
@@ -323,20 +358,40 @@ export function spawnTask(prompt, options = {}) {
|
|
|
323
358
|
|
|
324
359
|
export function prepareTaskProviderCommand(prompt, options = {}) {
|
|
325
360
|
const outputFormat = resolveOutputFormat(options);
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
361
|
+
const jsonSchema = resolveJsonSchema(options, outputFormat);
|
|
362
|
+
const settings = loadSettings();
|
|
363
|
+
const providerName = normalizeProviderName(
|
|
364
|
+
options.provider || settings.defaultProvider || getDefaultProviderId()
|
|
365
|
+
);
|
|
366
|
+
const providerOutputFormat =
|
|
367
|
+
providerName === 'omp' &&
|
|
368
|
+
resolveOmpTransport(settings) === 'sdk' &&
|
|
369
|
+
outputFormat === 'stream-json' &&
|
|
370
|
+
jsonSchema === null
|
|
371
|
+
? 'text'
|
|
372
|
+
: outputFormat;
|
|
373
|
+
return prepareTaskProviderCommandFromResolved(
|
|
374
|
+
prompt,
|
|
375
|
+
options,
|
|
376
|
+
{
|
|
377
|
+
outputFormat: providerOutputFormat,
|
|
378
|
+
jsonSchema,
|
|
379
|
+
cwd: options.cwd || process.cwd(),
|
|
380
|
+
},
|
|
381
|
+
settings
|
|
382
|
+
);
|
|
331
383
|
}
|
|
332
384
|
|
|
333
|
-
function prepareTaskProviderCommandFromResolved(prompt, options, runtime) {
|
|
385
|
+
function prepareTaskProviderCommandFromResolved(prompt, options, runtime, settings) {
|
|
334
386
|
const modelSelection = resolveRequestedModelSelection(options);
|
|
335
|
-
return prepareSingleAgentProviderCommand(
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
387
|
+
return prepareSingleAgentProviderCommand(
|
|
388
|
+
{
|
|
389
|
+
provider: options.provider || null,
|
|
390
|
+
context: prompt,
|
|
391
|
+
options: buildProviderOptions(options, runtime, modelSelection),
|
|
392
|
+
},
|
|
393
|
+
settings
|
|
394
|
+
);
|
|
340
395
|
}
|
|
341
396
|
|
|
342
397
|
function resolveOutputFormat(options) {
|
|
@@ -358,6 +413,7 @@ function buildProviderOptions(options, runtime, modelSelection) {
|
|
|
358
413
|
outputFormat: runtime.outputFormat,
|
|
359
414
|
jsonSchema: runtime.jsonSchema,
|
|
360
415
|
cwd: runtime.cwd,
|
|
416
|
+
executionContext: 'detached',
|
|
361
417
|
autoApprove: !structuredOutputRecovery,
|
|
362
418
|
...(modelSelection === undefined ? {} : { modelSpec: modelSelection.modelSpec }),
|
|
363
419
|
...(structuredOutputRecovery ? {} : mcpConfigOption(options)),
|
|
@@ -490,14 +546,27 @@ export function buildTaskRecord({
|
|
|
490
546
|
};
|
|
491
547
|
}
|
|
492
548
|
|
|
493
|
-
function
|
|
494
|
-
return
|
|
549
|
+
function isRpcStdioInvoke(invoke) {
|
|
550
|
+
return invoke.lane === 'rpc-stdio';
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function isOmpSdkInvoke(invoke) {
|
|
554
|
+
return invoke.parser === 'omp-sdk-ndjson';
|
|
495
555
|
}
|
|
496
556
|
|
|
497
557
|
// The returned object is JSON-serialized into the detached watcher's argv, so it must never carry
|
|
498
558
|
// prompt or other task content: `ps` and /proc/<pid>/cmdline expose argv to every local user for
|
|
499
559
|
// the whole lifetime of the watcher. Partition paths, ids, and digests are not secret.
|
|
500
|
-
function buildWatcherConfig(
|
|
560
|
+
function buildWatcherConfig(
|
|
561
|
+
outputFormat,
|
|
562
|
+
jsonSchema,
|
|
563
|
+
options,
|
|
564
|
+
providerName,
|
|
565
|
+
prepared,
|
|
566
|
+
commandSpec,
|
|
567
|
+
ompPlan
|
|
568
|
+
) {
|
|
569
|
+
const protocolInvoke = isRpcStdioInvoke(prepared.invoke) || isOmpSdkInvoke(prepared.invoke);
|
|
501
570
|
return {
|
|
502
571
|
outputFormat,
|
|
503
572
|
jsonSchema,
|
|
@@ -506,7 +575,20 @@ function buildWatcherConfig(outputFormat, jsonSchema, options, providerName, com
|
|
|
506
575
|
provider: providerName,
|
|
507
576
|
command: commandSpec.binary,
|
|
508
577
|
env: commandSpec.env || {},
|
|
509
|
-
commandSpec: buildWatcherCommandSpec(commandSpec,
|
|
578
|
+
commandSpec: buildWatcherCommandSpec(commandSpec, protocolInvoke),
|
|
579
|
+
...(isOmpSdkInvoke(prepared.invoke)
|
|
580
|
+
? {
|
|
581
|
+
sdkPrepared: {
|
|
582
|
+
invoke: prepared.invoke,
|
|
583
|
+
environmentPolicy: prepared.environmentPolicy,
|
|
584
|
+
credentialNames: prepared.credentialNames,
|
|
585
|
+
privateArtifacts: prepared.privateArtifacts,
|
|
586
|
+
executionIdentity: prepared.executionIdentity,
|
|
587
|
+
semanticIdentity: prepared.semanticIdentity,
|
|
588
|
+
containmentRequirement: prepared.containmentRequirement,
|
|
589
|
+
},
|
|
590
|
+
}
|
|
591
|
+
: {}),
|
|
510
592
|
...(ompPlan
|
|
511
593
|
? {
|
|
512
594
|
ompSession: ompPlan.session,
|
|
@@ -532,7 +614,7 @@ export function shouldUseAttachableWatcher(options, providerName) {
|
|
|
532
614
|
|
|
533
615
|
// The rpc-stdio lane owns bidirectional correlated RPC over stdio itself (see
|
|
534
616
|
// omp-rpc-driver.ts) and always uses rpc-watcher.js instead of the attachable PTY watcher.
|
|
535
|
-
if (
|
|
617
|
+
if (getProviderRegistryEntry(providerName).invoke.lane === 'rpc-stdio') {
|
|
536
618
|
return false;
|
|
537
619
|
}
|
|
538
620
|
|
|
@@ -543,10 +625,9 @@ export function shouldUseAttachableWatcher(options, providerName) {
|
|
|
543
625
|
return !(providerName === 'claude' && options.jsonSchema);
|
|
544
626
|
}
|
|
545
627
|
|
|
546
|
-
function resolveWatcherScript(options, providerName) {
|
|
547
|
-
if (
|
|
548
|
-
|
|
549
|
-
}
|
|
628
|
+
function resolveWatcherScript(options, providerName, invoke) {
|
|
629
|
+
if (isOmpSdkInvoke(invoke)) return join(__dirname, 'sdk-watcher.js');
|
|
630
|
+
if (isRpcStdioInvoke(invoke)) return join(__dirname, 'rpc-watcher.js');
|
|
550
631
|
const useAttachable = shouldUseAttachableWatcher(options, providerName);
|
|
551
632
|
return useAttachable ? join(__dirname, 'attachable-watcher.js') : join(__dirname, 'watcher.js');
|
|
552
633
|
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Detached watcher for the pinned OMP SDK lane. The parent passes only runtime metadata and the
|
|
5
|
+
* path to the owner-only request; prompt bytes remain in that private file and never enter argv.
|
|
6
|
+
*/
|
|
7
|
+
import { appendFileSync } from 'fs';
|
|
8
|
+
import { getTask, updateTask } from './store.js';
|
|
9
|
+
import { createCommandSpecCleanup } from './command-spec-cleanup.js';
|
|
10
|
+
import {
|
|
11
|
+
completePendingWatcherCancellation,
|
|
12
|
+
completeWatcherFailure,
|
|
13
|
+
completeWatcherTask,
|
|
14
|
+
} from './watcher-output-runtime.js';
|
|
15
|
+
import { createRequire } from 'module';
|
|
16
|
+
|
|
17
|
+
const require = createRequire(import.meta.url);
|
|
18
|
+
const { spawnOmpSdkProcess } = require('./omp-sdk-runtime.js');
|
|
19
|
+
|
|
20
|
+
const [, , taskId, , logFile, , configJson] = process.argv;
|
|
21
|
+
const config = configJson ? JSON.parse(configJson) : {};
|
|
22
|
+
const commandSpec = config.commandSpec || {};
|
|
23
|
+
|
|
24
|
+
function log(message) {
|
|
25
|
+
appendFileSync(logFile, message);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function emergencyLog(message) {
|
|
29
|
+
try {
|
|
30
|
+
log(message);
|
|
31
|
+
} catch {
|
|
32
|
+
process.stderr.write(message);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const commandCleanup = createCommandSpecCleanup(commandSpec, (cleanupPath, error) => {
|
|
37
|
+
emergencyLog(`[${Date.now()}][CLEANUP] Failed to delete ${cleanupPath}: ${error.message}\n`);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
let crashStarted = false;
|
|
41
|
+
let running = null;
|
|
42
|
+
let terminalResult = null;
|
|
43
|
+
|
|
44
|
+
function preparedInvocation() {
|
|
45
|
+
if (!config.sdkPrepared || typeof config.sdkPrepared !== 'object') {
|
|
46
|
+
throw new Error('OMP SDK watcher is missing its prepared invocation metadata.');
|
|
47
|
+
}
|
|
48
|
+
return { ...config.sdkPrepared, commandSpec };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function resultError(result) {
|
|
52
|
+
if (result.terminal.type === 'error') {
|
|
53
|
+
const { code, category } = result.terminal.frame.error;
|
|
54
|
+
return `OMP SDK ${code} (${category})`;
|
|
55
|
+
}
|
|
56
|
+
if (result.terminal.event.success === false) {
|
|
57
|
+
return result.terminal.event.error || 'OMP SDK turn failed';
|
|
58
|
+
}
|
|
59
|
+
if (result.cleanupAttestation.clean !== true) return 'OMP SDK cleanup was not attested';
|
|
60
|
+
return result.exitCode === 0 ? null : `OMP SDK supervisor exited with code ${result.exitCode}`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function completionFor(result) {
|
|
64
|
+
const error = resultError(result);
|
|
65
|
+
const cancelled =
|
|
66
|
+
result.terminal.type === 'error' && result.terminal.frame.error.category === 'cancelled';
|
|
67
|
+
const success = error === null;
|
|
68
|
+
return {
|
|
69
|
+
status: success ? 'completed' : cancelled ? 'killed' : 'failed',
|
|
70
|
+
resolvedCode: success ? 0 : cancelled ? 143 : result.exitCode === 0 ? 1 : result.exitCode || 1,
|
|
71
|
+
error,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function logTerminal(result) {
|
|
76
|
+
for (const frame of result.progress) log(`[${Date.now()}]${JSON.stringify(frame)}\n`);
|
|
77
|
+
const terminal =
|
|
78
|
+
result.terminal.type === 'result' ? result.terminal.event : result.terminal.frame;
|
|
79
|
+
log(`[${Date.now()}]${JSON.stringify(terminal)}\n`);
|
|
80
|
+
if (result.diagnosticStderr) {
|
|
81
|
+
log(`[${Date.now()}][SDK-DIAGNOSTIC] ${result.diagnosticStderr}\n`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function terminateOwnedProviderBoundary() {
|
|
86
|
+
if (terminalResult) return terminalResult.cleanupAttestation.clean === true;
|
|
87
|
+
if (!running) return true;
|
|
88
|
+
running.cancel();
|
|
89
|
+
try {
|
|
90
|
+
terminalResult = await running.result;
|
|
91
|
+
return terminalResult.cleanupAttestation.clean === true;
|
|
92
|
+
} catch {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async function crashWithError(error, source) {
|
|
98
|
+
if (crashStarted) return;
|
|
99
|
+
crashStarted = true;
|
|
100
|
+
await completeWatcherFailure({
|
|
101
|
+
taskId,
|
|
102
|
+
error,
|
|
103
|
+
source,
|
|
104
|
+
commandCleanup,
|
|
105
|
+
terminateProvider: terminateOwnedProviderBoundary,
|
|
106
|
+
updateTask,
|
|
107
|
+
emergencyLog,
|
|
108
|
+
});
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
process.on('uncaughtException', (error) => {
|
|
113
|
+
void crashWithError(error, 'uncaughtException');
|
|
114
|
+
});
|
|
115
|
+
process.on('unhandledRejection', (reason) => {
|
|
116
|
+
void crashWithError(reason, 'unhandledRejection');
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
if (
|
|
120
|
+
await completePendingWatcherCancellation({
|
|
121
|
+
taskId,
|
|
122
|
+
getTask,
|
|
123
|
+
commandCleanup,
|
|
124
|
+
terminateProvider: () => true,
|
|
125
|
+
updateTask,
|
|
126
|
+
emergencyLog,
|
|
127
|
+
})
|
|
128
|
+
) {
|
|
129
|
+
process.exit(0);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
running = await spawnOmpSdkProcess(preparedInvocation());
|
|
134
|
+
updateTask(taskId, {
|
|
135
|
+
pid: running.pid,
|
|
136
|
+
processGroupId: null,
|
|
137
|
+
terminationStrategy: 'process',
|
|
138
|
+
});
|
|
139
|
+
if (getTask(taskId)?.cancelRequested) running.cancel();
|
|
140
|
+
|
|
141
|
+
terminalResult = await running.result;
|
|
142
|
+
logTerminal(terminalResult);
|
|
143
|
+
await completeWatcherTask({
|
|
144
|
+
taskId,
|
|
145
|
+
completion: completionFor(terminalResult),
|
|
146
|
+
commandCleanup,
|
|
147
|
+
terminateProvider: terminateOwnedProviderBoundary,
|
|
148
|
+
updateTask,
|
|
149
|
+
emergencyLog,
|
|
150
|
+
});
|
|
151
|
+
process.exit(0);
|
|
152
|
+
} catch (error) {
|
|
153
|
+
await crashWithError(error, 'OMP SDK watcher');
|
|
154
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"omp-release.d.ts","sourceRoot":"","sources":["../../src/agent-cli-provider/omp-release.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,EAAG,QAAiB,CAAC;AACvD,eAAO,MAAM,gBAAgB,EAAG,2BAAoC,CAAC;AACrE,eAAO,MAAM,eAAe,EAAG,KAAc,CAAC;AAoB9C,eAAO,MAAM,mBAAmB,mDACwC,CAAC;AACzE,eAAO,MAAM,qBAAqB,EAAG,aAAsB,CAAC;AAC5D,eAAO,MAAM,eAAe,2IACgH,CAAC;AAE7I,eAAO,MAAM,6BAA6B,iEACkD,CAAC;AAE7F,MAAM,MAAM,kBAAkB,GAC1B,cAAc,GACd,YAAY,GACZ,aAAa,GACb,kBAAkB,GAClB,gBAAgB,GAChB,WAAW,CAAC;AAEhB,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAGD,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EA+BxD,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAEjF;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAEzE;AAKD,eAAO,MAAM,mBAAmB,EAAG,aAAsB,CAAC;AAC1D,eAAO,MAAM,2BAA2B,aAAoD,CAAC;AAe7F,eAAO,MAAM,0BAA0B,EAAE,MAKsD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"omp-release.js","sourceRoot":"","sources":["../../src/agent-cli-provider/omp-release.ts"],"names":[],"mappings":";;;AA+EA,kDAEC;AAED,gEAEC;AArFY,QAAA,qBAAqB,GAAG,QAAiB,CAAC;AAC1C,QAAA,gBAAgB,GAAG,2BAAoC,CAAC;AACxD,QAAA,eAAe,GAAG,KAAc,CAAC;AAE9C,8FAA8F;AAC9F,0FAA0F;AAC1F,6FAA6F;AAC7F,gGAAgG;AAChG,8FAA8F;AAC9F,EAAE;AACF,mGAAmG;AACnG,kGAAkG;AAClG,2FAA2F;AAC3F,8DAA8D;AAC9D,uEAAuE;AACvE,6FAA6F;AAC7F,kGAAkG;AAClG,mGAAmG;AACnG,8FAA8F;AAC9F,+FAA+F;AAC/F,iGAAiG;AACjG,oBAAoB;AACP,QAAA,mBAAmB,GAC9B,kBAAkB,wBAAgB,IAAI,6BAAqB,EAAW,CAAC;AAC5D,QAAA,qBAAqB,GAAG,aAAsB,CAAC;AAC/C,QAAA,eAAe,GAC1B,yCAAyC,2BAAmB,2CAA2C,6BAAqB,KAAc,CAAC;AAEhI,QAAA,6BAA6B,GACxC,0DAA0D,6BAAqB,EAAW,CAAC;AAgB7F,uGAAuG;AAC1F,QAAA,kBAAkB,GAA+B;IAC5D;QACE,IAAI,EAAE,kBAAkB;QACxB,QAAQ,EAAE,cAAc;QACxB,MAAM,EAAE,kEAAkE;KAC3E;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,QAAQ,EAAE,YAAY;QACtB,MAAM,EAAE,kEAAkE;KAC3E;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,aAAa;QACvB,MAAM,EAAE,kEAAkE;KAC3E;IACD;QACE,IAAI,EAAE,sBAAsB;QAC5B,QAAQ,EAAE,kBAAkB;QAC5B,MAAM,EAAE,kEAAkE;KAC3E;IACD;QACE,IAAI,EAAE,oBAAoB;QAC1B,QAAQ,EAAE,gBAAgB;QAC1B,MAAM,EAAE,kEAAkE;KAC3E;IACD;QACE,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,kEAAkE;KAC3E;CACF,CAAC;AAEF,SAAgB,mBAAmB,CAAC,QAAgB;IAClD,OAAO,0BAAkB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;AACzE,CAAC;AAED,SAAgB,0BAA0B,CAAC,KAAsB;IAC/D,OAAO,GAAG,qCAA6B,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;AAC1D,CAAC;AAED,wFAAwF;AACxF,0FAA0F;AAC1F,mEAAmE;AACtD,QAAA,mBAAmB,GAAG,aAAsB,CAAC;AAC7C,QAAA,2BAA2B,GAAG,WAAiD,CAAC;AAE7F,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,mCAA2B,CAAC,CAAC;AAClF,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAC9B,MAAM,IAAI,KAAK,CACb,mDAAmD,mCAA2B,GAAG,CAClF,CAAC;AACJ,CAAC;AAED,MAAM,sBAAsB,GAAG,0BAA0B,CAAC,wBAAwB,CAAC,CAAC;AACpF,MAAM,yBAAyB,GAAG,wBAAwB,CAAC,MAAM,CAAC;AAElE,iGAAiG;AACjG,2FAA2F;AAC3F,8CAA8C;AACjC,QAAA,0BAA0B,GACrC,8CAA8C,sBAAsB,KAAK;IACzE,6BAA6B,yBAAyB,sBAAsB;IAC5E,+DAA+D;IAC/D,wDAAwD;IACxD,aAAa,6BAAqB,2DAA2D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"omp-rpc-bounds.d.ts","sourceRoot":"","sources":["../../src/agent-cli-provider/omp-rpc-bounds.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAIvC,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAI7C,eAAO,MAAM,2BAA2B,QAAkB,CAAC;AAI3D,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAM1C,eAAO,MAAM,cAAc,OAAO,CAAC;AACnC,eAAO,MAAM,aAAa,OAAO,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"omp-rpc-bounds.js","sourceRoot":"","sources":["../../src/agent-cli-provider/omp-rpc-bounds.ts"],"names":[],"mappings":";AAAA,iGAAiG;AACjG,mFAAmF;;;AAEnF,gGAAgG;AAChG,+FAA+F;AAC/F,6FAA6F;AAC7F,8FAA8F;AAC9F,yBAAyB;AACZ,QAAA,oBAAoB,GAAG,EAAE,CAAC;AAEvC,iGAAiG;AACjG,0FAA0F;AAC7E,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAE7C,iGAAiG;AACjG,kFAAkF;AACrE,QAAA,2BAA2B,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3D,mGAAmG;AACnG,aAAa;AACA,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAE1C,iGAAiG;AACjG,8FAA8F;AAC9F,gGAAgG;AAChG,4EAA4E;AAC/D,QAAA,cAAc,GAAG,IAAI,CAAC;AACtB,QAAA,aAAa,GAAG,IAAI,CAAC"}
|