stitchkit 0.93.0 → 0.94.1
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/CHANGELOG.md +198 -0
- package/README.md +5 -2
- package/dist/agent-runtime/children-control.d.ts +6 -0
- package/dist/agent-runtime/children-control.d.ts.map +1 -0
- package/dist/agent-runtime/children-spawn.d.ts +6 -0
- package/dist/agent-runtime/children-spawn.d.ts.map +1 -0
- package/dist/agent-runtime/children-state.d.ts +46 -0
- package/dist/agent-runtime/children-state.d.ts.map +1 -0
- package/dist/agent-runtime/children-usage.d.ts +8 -0
- package/dist/agent-runtime/children-usage.d.ts.map +1 -0
- package/dist/agent-runtime/children.d.ts +11 -14
- package/dist/agent-runtime/children.d.ts.map +1 -1
- package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-contract.d.ts +2 -1
- package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
- package/dist/agent-runtime/contained-darwin.d.ts +38 -0
- package/dist/agent-runtime/contained-darwin.d.ts.map +1 -0
- package/dist/agent-runtime/contained-files.d.ts +11 -26
- package/dist/agent-runtime/contained-files.d.ts.map +1 -1
- package/dist/agent-runtime/contained-scan.d.ts +21 -0
- package/dist/agent-runtime/contained-scan.d.ts.map +1 -0
- package/dist/agent-runtime/contained-write.d.ts +9 -0
- package/dist/agent-runtime/contained-write.d.ts.map +1 -0
- package/dist/agent-runtime/deferred-tool-types.d.ts +4 -3
- package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
- package/dist/agent-runtime/events.d.ts +1 -1
- package/dist/agent-runtime/events.d.ts.map +1 -1
- package/dist/agent-runtime/harness-control.d.ts +0 -1
- package/dist/agent-runtime/harness-control.d.ts.map +1 -1
- package/dist/agent-runtime/harness.d.ts +0 -5
- package/dist/agent-runtime/harness.d.ts.map +1 -1
- package/dist/agent-runtime/managed-tools.d.ts +3 -2
- package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
- package/dist/agent-runtime/observability.d.ts +1 -1
- package/dist/agent-runtime/observability.d.ts.map +1 -1
- package/dist/agent-runtime/openrouter.d.ts +29 -0
- package/dist/agent-runtime/openrouter.d.ts.map +1 -0
- package/dist/agent-runtime/projections.d.ts +1 -1
- package/dist/agent-runtime/projections.d.ts.map +1 -1
- package/dist/agent-runtime/run-acquisition.d.ts +17 -0
- package/dist/agent-runtime/run-acquisition.d.ts.map +1 -0
- package/dist/agent-runtime/run-execution-state.d.ts +133 -0
- package/dist/agent-runtime/run-execution-state.d.ts.map +1 -0
- package/dist/agent-runtime/run-execution.d.ts +17 -33
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/run-failure.d.ts +18 -0
- package/dist/agent-runtime/run-failure.d.ts.map +1 -0
- package/dist/agent-runtime/run-model-attempts.d.ts +6 -0
- package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -0
- package/dist/agent-runtime/run-prompt-history.d.ts +58 -0
- package/dist/agent-runtime/run-prompt-history.d.ts.map +1 -0
- package/dist/agent-runtime/run-provider-ledger.d.ts +26 -0
- package/dist/agent-runtime/run-provider-ledger.d.ts.map +1 -0
- package/dist/agent-runtime/run-stream-parts.d.ts +17 -0
- package/dist/agent-runtime/run-stream-parts.d.ts.map +1 -0
- package/dist/agent-runtime/run-terminal.d.ts +11 -0
- package/dist/agent-runtime/run-terminal.d.ts.map +1 -0
- package/dist/agent-runtime/run-turn-preparation.d.ts +22 -0
- package/dist/agent-runtime/run-turn-preparation.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-admission-gate.d.ts +29 -0
- package/dist/agent-runtime/runtime-admission-gate.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-control.d.ts +9 -0
- package/dist/agent-runtime/runtime-control.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-recovery.d.ts +10 -0
- package/dist/agent-runtime/runtime-recovery.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-state.d.ts +36 -0
- package/dist/agent-runtime/runtime-state.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-submit.d.ts +5 -0
- package/dist/agent-runtime/runtime-submit.d.ts.map +1 -0
- package/dist/agent-runtime/runtime.d.ts +10 -5
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/schedule-records.d.ts +34 -0
- package/dist/agent-runtime/schedule-records.d.ts.map +1 -0
- package/dist/agent-runtime/schedules.d.ts +34 -0
- package/dist/agent-runtime/schedules.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite-bun.d.ts +12 -0
- package/dist/agent-runtime/sqlite-bun.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-events.d.ts +5 -0
- package/dist/agent-runtime/sqlite-events.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-history.d.ts +7 -0
- package/dist/agent-runtime/sqlite-history.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-ledger.d.ts +7 -0
- package/dist/agent-runtime/sqlite-ledger.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-node.d.ts +12 -0
- package/dist/agent-runtime/sqlite-node.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-reads.d.ts +14 -0
- package/dist/agent-runtime/sqlite-reads.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-rows.d.ts +178 -0
- package/dist/agent-runtime/sqlite-rows.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-schema.d.ts +7 -0
- package/dist/agent-runtime/sqlite-schema.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-transactions.d.ts +25 -0
- package/dist/agent-runtime/sqlite-transactions.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite.d.ts +10 -6
- package/dist/agent-runtime/sqlite.d.ts.map +1 -1
- package/dist/agent-runtime/store-archive.d.ts +16 -0
- package/dist/agent-runtime/store-archive.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +434 -0
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-ordering.d.ts +18 -0
- package/dist/agent-runtime/store-conformance-ordering.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-support.d.ts +130 -0
- package/dist/agent-runtime/store-conformance-support.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-terminal.d.ts +12 -0
- package/dist/agent-runtime/store-conformance-terminal.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance.d.ts +40 -0
- package/dist/agent-runtime/store-conformance.d.ts.map +1 -0
- package/dist/agent-runtime/store-create.d.ts +11 -0
- package/dist/agent-runtime/store-create.d.ts.map +1 -0
- package/dist/agent-runtime/store-driver-contract.d.ts +814 -0
- package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -0
- package/dist/agent-runtime/store-events.d.ts +7 -89
- package/dist/agent-runtime/store-events.d.ts.map +1 -1
- package/dist/agent-runtime/store-memory.d.ts +4 -0
- package/dist/agent-runtime/store-memory.d.ts.map +1 -0
- package/dist/agent-runtime/store-mutate.d.ts +13 -0
- package/dist/agent-runtime/store-mutate.d.ts.map +1 -0
- package/dist/agent-runtime/store-purge.d.ts +1 -1
- package/dist/agent-runtime/store-purge.d.ts.map +1 -1
- package/dist/agent-runtime/store-reads.d.ts +29 -0
- package/dist/agent-runtime/store-reads.d.ts.map +1 -0
- package/dist/agent-runtime/store-reduce-history.d.ts +10 -0
- package/dist/agent-runtime/store-reduce-history.d.ts.map +1 -0
- package/dist/agent-runtime/store-reduce-run.d.ts +14 -0
- package/dist/agent-runtime/store-reduce-run.d.ts.map +1 -0
- package/dist/agent-runtime/store-reduce-shared.d.ts +76 -0
- package/dist/agent-runtime/store-reduce-shared.d.ts.map +1 -0
- package/dist/agent-runtime/store-reduce-terminal.d.ts +6 -0
- package/dist/agent-runtime/store-reduce-terminal.d.ts.map +1 -0
- package/dist/agent-runtime/store-reducer.d.ts +24 -0
- package/dist/agent-runtime/store-reducer.d.ts.map +1 -0
- package/dist/agent-runtime/store-snapshot.d.ts +19 -0
- package/dist/agent-runtime/store-snapshot.d.ts.map +1 -0
- package/dist/agent-runtime/store.d.ts +1 -1
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/application/admission-rate.d.ts +21 -0
- package/dist/application/admission-rate.d.ts.map +1 -0
- package/dist/application/admission-run.d.ts +8 -0
- package/dist/application/admission-run.d.ts.map +1 -0
- package/dist/application/admission.d.ts +1 -1
- package/dist/application/admission.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-lock.d.ts +9 -34
- package/dist/application/diagnostic-journal-lock.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
- package/dist/application/events.d.ts +1 -1
- package/dist/application/events.d.ts.map +1 -1
- package/dist/application/file-state-store.d.ts +23 -0
- package/dist/application/file-state-store.d.ts.map +1 -0
- package/dist/application/health.d.ts +1 -1
- package/dist/application/health.d.ts.map +1 -1
- package/dist/application/kernel-admission.d.ts +8 -0
- package/dist/application/kernel-admission.d.ts.map +1 -0
- package/dist/application/kernel-contract.d.ts +142 -0
- package/dist/application/kernel-contract.d.ts.map +1 -0
- package/dist/application/kernel-resource-context.d.ts +24 -0
- package/dist/application/kernel-resource-context.d.ts.map +1 -0
- package/dist/application/kernel-restart.d.ts +5 -0
- package/dist/application/kernel-restart.d.ts.map +1 -0
- package/dist/application/kernel-rollback.d.ts +4 -0
- package/dist/application/kernel-rollback.d.ts.map +1 -0
- package/dist/application/kernel-shutdown.d.ts +6 -0
- package/dist/application/kernel-shutdown.d.ts.map +1 -0
- package/dist/application/kernel-start.d.ts +20 -0
- package/dist/application/kernel-start.d.ts.map +1 -0
- package/dist/application/kernel-state.d.ts +116 -0
- package/dist/application/kernel-state.d.ts.map +1 -0
- package/dist/application/kernel.d.ts +9 -140
- package/dist/application/kernel.d.ts.map +1 -1
- package/dist/application/latest-sink.d.ts +1 -1
- package/dist/application/latest-sink.d.ts.map +1 -1
- package/dist/application/notification-outbox.d.ts.map +1 -1
- package/dist/application/opentelemetry.d.ts +1 -1
- package/dist/application/opentelemetry.d.ts.map +1 -1
- package/dist/application/schedule.d.ts +0 -1
- package/dist/application/schedule.d.ts.map +1 -1
- package/dist/application/watch-hub-core.d.ts +122 -0
- package/dist/application/watch-hub-core.d.ts.map +1 -0
- package/dist/application/watch-hub.d.ts +3 -3
- package/dist/application/watch-hub.d.ts.map +1 -1
- package/dist/browser/client-executors.d.ts +14 -0
- package/dist/browser/client-executors.d.ts.map +1 -0
- package/dist/browser/client-multipart.d.ts +1 -1
- package/dist/browser/client-multipart.d.ts.map +1 -1
- package/dist/browser/client-url.d.ts +1 -1
- package/dist/browser/client-url.d.ts.map +1 -1
- package/dist/browser/client.d.ts +3 -2
- package/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/contract-stream.d.ts +1 -1
- package/dist/browser/contract-stream.d.ts.map +1 -1
- package/dist/browser/http-fetch.d.ts +22 -0
- package/dist/browser/http-fetch.d.ts.map +1 -0
- package/dist/browser/http.d.ts +2 -4
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/live-state-core.d.ts +63 -0
- package/dist/browser/live-state-core.d.ts.map +1 -0
- package/dist/browser/live-state.d.ts.map +1 -1
- package/dist/browser/realtime-client.d.ts +26 -0
- package/dist/browser/realtime-client.d.ts.map +1 -0
- package/dist/browser/resumable.d.ts +1 -28
- package/dist/browser/resumable.d.ts.map +1 -1
- package/dist/browser/retained.d.ts.map +1 -0
- package/dist/browser/socket-io-connection.d.ts +82 -0
- package/dist/browser/socket-io-connection.d.ts.map +1 -0
- package/dist/browser/socket-io-peer.d.ts +20 -0
- package/dist/browser/socket-io-peer.d.ts.map +1 -0
- package/dist/browser/socket-io-trace.d.ts +31 -0
- package/dist/browser/socket-io-trace.d.ts.map +1 -0
- package/dist/browser/socket-io.d.ts +24 -18
- package/dist/browser/socket-io.d.ts.map +1 -1
- package/dist/browser/stream.d.ts +14 -2
- package/dist/browser/stream.d.ts.map +1 -1
- package/dist/contract/client-types.d.ts +134 -0
- package/dist/contract/client-types.d.ts.map +1 -0
- package/dist/contract/define-validation.d.ts +30 -0
- package/dist/contract/define-validation.d.ts.map +1 -0
- package/dist/contract/define.d.ts +47 -394
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/normalize.d.ts +56 -0
- package/dist/contract/normalize.d.ts.map +1 -0
- package/dist/contract/runtime-context.d.ts +131 -0
- package/dist/contract/runtime-context.d.ts.map +1 -0
- package/dist/contract/tool-options.d.ts +105 -0
- package/dist/contract/tool-options.d.ts.map +1 -0
- package/dist/contract/tool-view.d.ts +148 -0
- package/dist/contract/tool-view.d.ts.map +1 -0
- package/dist/declaration/declaration.d.ts.map +1 -0
- package/dist/durability/contract.d.ts +259 -0
- package/dist/durability/contract.d.ts.map +1 -0
- package/dist/durability/effect.d.ts +24 -0
- package/dist/durability/effect.d.ts.map +1 -0
- package/dist/durability/engine.d.ts +14 -0
- package/dist/durability/engine.d.ts.map +1 -0
- package/dist/durability/events.d.ts +103 -0
- package/dist/durability/events.d.ts.map +1 -0
- package/dist/durability/json.d.ts +3 -0
- package/dist/durability/json.d.ts.map +1 -0
- package/dist/durability/ledger.d.ts +27 -0
- package/dist/durability/ledger.d.ts.map +1 -0
- package/dist/durability/parks.d.ts +22 -0
- package/dist/durability/parks.d.ts.map +1 -0
- package/dist/durability/scheduler.d.ts +30 -0
- package/dist/durability/scheduler.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/browser.d.ts +5 -0
- package/dist/entrypoints/agent-runtime/browser.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/browser.js +124 -0
- package/dist/entrypoints/agent-runtime/coding-tools.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/coding-tools.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/coding-tools.js +22 -0
- package/dist/entrypoints/agent-runtime/harness.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/harness.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/harness.js +739 -0
- package/dist/entrypoints/agent-runtime/openrouter.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/openrouter.js +270 -0
- package/dist/entrypoints/agent-runtime/sandbox.d.ts +5 -0
- package/dist/entrypoints/agent-runtime/sandbox.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/sandbox.js +797 -0
- package/dist/entrypoints/agent-runtime/sqlite/bun.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/sqlite/bun.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +44 -0
- package/dist/entrypoints/agent-runtime/sqlite/node.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/sqlite/node.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/sqlite/node.js +46 -0
- package/dist/entrypoints/agent-runtime/testing.d.ts +4 -0
- package/dist/entrypoints/agent-runtime/testing.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/testing.js +1116 -0
- package/dist/entrypoints/agent-runtime.d.ts +42 -0
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime.js +2670 -0
- package/dist/entrypoints/application/diagnostic-journal.d.ts +21 -0
- package/dist/entrypoints/application/diagnostic-journal.d.ts.map +1 -0
- package/dist/entrypoints/application/diagnostic-journal.js +492 -0
- package/dist/entrypoints/application/grammy.d.ts +2 -0
- package/dist/entrypoints/application/grammy.d.ts.map +1 -0
- package/dist/entrypoints/application/grammy.js +169 -0
- package/dist/entrypoints/application/opentelemetry.d.ts +2 -0
- package/dist/entrypoints/application/opentelemetry.d.ts.map +1 -0
- package/dist/entrypoints/application/opentelemetry.js +250 -0
- package/dist/entrypoints/application/schemas.d.ts +15 -0
- package/dist/entrypoints/application/schemas.d.ts.map +1 -0
- package/dist/entrypoints/application/schemas.js +27 -0
- package/dist/entrypoints/application.d.ts +23 -0
- package/dist/entrypoints/application.d.ts.map +1 -0
- package/dist/entrypoints/application.js +2016 -0
- package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -0
- package/dist/entrypoints/bin/upgrade-cli.js +177 -0
- package/dist/entrypoints/cli.d.ts +44 -0
- package/dist/entrypoints/cli.d.ts.map +1 -0
- package/dist/entrypoints/cli.js +773 -0
- package/dist/entrypoints/contract.d.ts +12 -0
- package/dist/entrypoints/contract.d.ts.map +1 -0
- package/dist/entrypoints/contract.js +64 -0
- package/dist/entrypoints/declaration.d.ts +2 -0
- package/dist/entrypoints/declaration.d.ts.map +1 -0
- package/dist/entrypoints/declaration.js +183 -0
- package/dist/entrypoints/files.d.ts +5 -0
- package/dist/entrypoints/files.d.ts.map +1 -0
- package/dist/entrypoints/files.js +111 -0
- package/dist/entrypoints/geo.d.ts +3 -0
- package/dist/entrypoints/geo.d.ts.map +1 -0
- package/dist/entrypoints/geo.js +245 -0
- package/dist/entrypoints/google.d.ts +2 -0
- package/dist/entrypoints/google.d.ts.map +1 -0
- package/dist/entrypoints/google.js +175 -0
- package/dist/entrypoints/index.d.ts +17 -0
- package/dist/entrypoints/index.d.ts.map +1 -0
- package/dist/entrypoints/index.js +764 -0
- package/dist/entrypoints/live.d.ts +19 -0
- package/dist/entrypoints/live.d.ts.map +1 -0
- package/dist/entrypoints/live.js +302 -0
- package/dist/entrypoints/node.d.ts +19 -0
- package/dist/entrypoints/node.d.ts.map +1 -0
- package/dist/entrypoints/node.js +308 -0
- package/dist/entrypoints/oauth.d.ts +2 -0
- package/dist/entrypoints/oauth.d.ts.map +1 -0
- package/dist/entrypoints/oauth.js +170 -0
- package/dist/entrypoints/observability.d.ts +19 -0
- package/dist/entrypoints/observability.d.ts.map +1 -0
- package/dist/entrypoints/observability.js +567 -0
- package/dist/entrypoints/primitives.d.ts +3 -0
- package/dist/entrypoints/primitives.d.ts.map +1 -0
- package/dist/entrypoints/primitives.js +749 -0
- package/dist/entrypoints/react.d.ts +5 -0
- package/dist/entrypoints/react.d.ts.map +1 -0
- package/dist/entrypoints/react.js +403 -0
- package/dist/entrypoints/release.d.ts +15 -0
- package/dist/entrypoints/release.d.ts.map +1 -0
- package/dist/entrypoints/release.js +196 -0
- package/dist/entrypoints/remote.d.ts +9 -0
- package/dist/entrypoints/remote.d.ts.map +1 -0
- package/dist/entrypoints/remote.js +66 -0
- package/dist/entrypoints/server.d.ts +39 -0
- package/dist/entrypoints/server.d.ts.map +1 -0
- package/dist/entrypoints/server.js +2009 -0
- package/dist/entrypoints/telegram.d.ts +3 -0
- package/dist/entrypoints/telegram.d.ts.map +1 -0
- package/dist/entrypoints/telegram.js +224 -0
- package/dist/entrypoints/testing.d.ts +10 -0
- package/dist/entrypoints/testing.d.ts.map +1 -0
- package/dist/entrypoints/testing.js +1377 -0
- package/dist/entrypoints/tools/connections.d.ts +19 -0
- package/dist/entrypoints/tools/connections.d.ts.map +1 -0
- package/dist/entrypoints/tools/connections.js +1110 -0
- package/dist/entrypoints/tools/contract.d.ts +29 -0
- package/dist/entrypoints/tools/contract.d.ts.map +1 -0
- package/dist/entrypoints/tools/contract.js +24 -0
- package/dist/entrypoints/tools/invoker.d.ts +9 -0
- package/dist/entrypoints/tools/invoker.d.ts.map +1 -0
- package/dist/entrypoints/tools/invoker.js +20 -0
- package/dist/entrypoints/tools.d.ts +54 -0
- package/dist/entrypoints/tools.d.ts.map +1 -0
- package/dist/entrypoints/tools.js +3009 -0
- package/dist/entrypoints/tracking/server.d.ts +15 -0
- package/dist/entrypoints/tracking/server.d.ts.map +1 -0
- package/dist/entrypoints/tracking.d.ts +24 -0
- package/dist/entrypoints/tracking.d.ts.map +1 -0
- package/dist/entrypoints/tracking.js +1140 -0
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files/file-io.d.ts +14 -0
- package/dist/files/file-io.d.ts.map +1 -0
- package/dist/google/google.d.ts.map +1 -0
- package/dist/index-0b1ess5e.js +38 -0
- package/dist/index-1j8pm5t0.js +412 -0
- package/dist/index-1zbbzgfh.js +89 -0
- package/dist/index-2bxbyab0.js +47 -0
- package/dist/index-2gxzjvyr.js +266 -0
- package/dist/index-35mh5bhj.js +177 -0
- package/dist/index-48ffdxgk.js +6 -0
- package/dist/index-4gcnakhx.js +82 -0
- package/dist/index-55hkhm67.js +343 -0
- package/dist/index-79z7m7dt.js +675 -0
- package/dist/index-7f68ghdn.js +3618 -0
- package/dist/index-7p1f0vp2.js +154 -0
- package/dist/index-83bdg97s.js +16 -0
- package/dist/index-863ea9jb.js +154 -0
- package/dist/index-8p52kd5p.js +242 -0
- package/dist/index-d9pk3td4.js +326 -0
- package/dist/index-dce5wxcq.js +63 -0
- package/dist/index-e01r054k.js +105 -0
- package/dist/index-ensd0r74.js +595 -0
- package/dist/index-eqqvgdb3.js +46 -0
- package/dist/index-gxrt5h6v.js +341 -0
- package/dist/index-h6eeys1v.js +211 -0
- package/dist/index-ham5sz8m.js +734 -0
- package/dist/index-het2he5g.js +1387 -0
- package/dist/index-hffjpmq9.js +30 -0
- package/dist/index-hmp4800j.js +51 -0
- package/dist/index-k30h66yd.js +317 -0
- package/dist/index-k5hsfc3j.js +31 -0
- package/dist/index-khtgb21r.js +92 -0
- package/dist/index-m9zn6cpq.js +51 -0
- package/dist/index-ndddxtyx.js +324 -0
- package/dist/index-ngfhvfpd.js +30 -0
- package/dist/index-np4m8hd3.js +1205 -0
- package/dist/index-p3vsv1fb.js +3493 -0
- package/dist/index-p5r7qpdd.js +85 -0
- package/dist/index-p9e0w8hs.js +1084 -0
- package/dist/index-p9sh0xx4.js +64 -0
- package/dist/index-paz6sgdp.js +371 -0
- package/dist/index-px2gm2jp.js +448 -0
- package/dist/index-qwhynv6x.js +103 -0
- package/dist/index-s812ycat.js +65 -0
- package/dist/index-sp1tzwnb.js +281 -0
- package/dist/index-t9rhjr9f.js +2306 -0
- package/dist/index-v260df89.js +342 -0
- package/dist/index-w906953s.js +946 -0
- package/dist/index-wdkt63w3.js +214 -0
- package/dist/index-wqgjfstn.js +18 -0
- package/dist/index-wsm5w4ee.js +1023 -0
- package/dist/index-xw3s75nj.js +100 -0
- package/dist/index-yw4fzmdz.js +268 -0
- package/dist/index-zfrhfn82.js +85 -0
- package/dist/index-znfs20ss.js +98 -0
- package/dist/internal/atomic-file.d.ts +23 -2
- package/dist/internal/atomic-file.d.ts.map +1 -1
- package/dist/internal/backoff.d.ts +29 -0
- package/dist/internal/backoff.d.ts.map +1 -0
- package/dist/internal/canonical-json.d.ts +21 -11
- package/dist/internal/canonical-json.d.ts.map +1 -1
- package/dist/internal/channel.d.ts.map +1 -0
- package/dist/internal/exclusive-lock.d.ts +51 -0
- package/dist/internal/exclusive-lock.d.ts.map +1 -0
- package/dist/internal/logger.d.ts.map +1 -0
- package/dist/internal/process-identity.d.ts +47 -0
- package/dist/internal/process-identity.d.ts.map +1 -0
- package/dist/internal/request.d.ts.map +1 -0
- package/dist/internal/stable-digest.d.ts +0 -43
- package/dist/internal/stable-digest.d.ts.map +1 -1
- package/dist/internal/typed.d.ts +0 -8
- package/dist/internal/typed.d.ts.map +1 -1
- package/dist/internal/with-exclusive-lock.d.ts +67 -0
- package/dist/internal/with-exclusive-lock.d.ts.map +1 -0
- package/dist/internal/zod-issues.d.ts +38 -0
- package/dist/internal/zod-issues.d.ts.map +1 -0
- package/dist/json-schema/dialect.d.ts +17 -0
- package/dist/json-schema/dialect.d.ts.map +1 -0
- package/dist/json-schema/json-schema.d.ts.map +1 -0
- package/dist/live/watch-client.d.ts.map +1 -1
- package/dist/live/watch-delta.d.ts.map +1 -1
- package/dist/oauth/authorization-code.d.ts +57 -0
- package/dist/oauth/authorization-code.d.ts.map +1 -0
- package/dist/observability/audit.d.ts +3 -3
- package/dist/observability/audit.d.ts.map +1 -1
- package/dist/observability/bounded-logger.d.ts +1 -1
- package/dist/observability/bounded-logger.d.ts.map +1 -1
- package/dist/observability/bounded-sink.d.ts +81 -0
- package/dist/observability/bounded-sink.d.ts.map +1 -0
- package/dist/observability/context.d.ts +1 -1
- package/dist/observability/context.d.ts.map +1 -1
- package/dist/observability/event.d.ts +2 -1
- package/dist/observability/event.d.ts.map +1 -1
- package/dist/observability/work.d.ts +1 -1
- package/dist/observability/work.d.ts.map +1 -1
- package/dist/primitives/audit.d.ts +1 -1
- package/dist/primitives/audit.d.ts.map +1 -1
- package/dist/primitives/export-operation.d.ts +4 -2
- package/dist/primitives/export-operation.d.ts.map +1 -1
- package/dist/realtime/registry.d.ts +0 -5
- package/dist/realtime/registry.d.ts.map +1 -1
- package/dist/realtime/socket.d.ts +1 -1
- package/dist/realtime/socket.d.ts.map +1 -1
- package/dist/server/bun.d.ts +0 -1
- package/dist/server/bun.d.ts.map +1 -1
- package/dist/server/context-contribution.d.ts +1 -1
- package/dist/server/context-contribution.d.ts.map +1 -1
- package/dist/server/context.d.ts +2 -2
- package/dist/server/context.d.ts.map +1 -1
- package/dist/server/contract-method.d.ts +15 -0
- package/dist/server/contract-method.d.ts.map +1 -0
- package/dist/server/contract-stream.d.ts +1 -1
- package/dist/server/contract-stream.d.ts.map +1 -1
- package/dist/server/create.d.ts +8 -0
- package/dist/server/create.d.ts.map +1 -1
- package/dist/server/endpoint-dispatch.d.ts +10 -0
- package/dist/server/endpoint-dispatch.d.ts.map +1 -0
- package/dist/server/endpoint-response.d.ts +19 -0
- package/dist/server/endpoint-response.d.ts.map +1 -0
- package/dist/server/error-dispatch.d.ts +17 -1
- package/dist/server/error-dispatch.d.ts.map +1 -1
- package/dist/server/error-hook.d.ts +2 -2
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/server/handler-state.d.ts +44 -0
- package/dist/server/handler-state.d.ts.map +1 -0
- package/dist/server/implement-registry.d.ts +54 -0
- package/dist/server/implement-registry.d.ts.map +1 -0
- package/dist/server/implement.d.ts +9 -55
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/middleware/auth.d.ts +1 -31
- package/dist/server/middleware/auth.d.ts.map +1 -1
- package/dist/server/middleware/cors.d.ts +17 -0
- package/dist/server/middleware/cors.d.ts.map +1 -1
- package/dist/server/middleware/jwt.d.ts +31 -0
- package/dist/server/middleware/jwt.d.ts.map +1 -0
- package/dist/server/middleware/trust-fence.d.ts +1 -1
- package/dist/server/middleware/trust-fence.d.ts.map +1 -1
- package/dist/server/multipart-reader.d.ts +22 -0
- package/dist/server/multipart-reader.d.ts.map +1 -0
- package/dist/server/multipart.d.ts +1 -1
- package/dist/server/multipart.d.ts.map +1 -1
- package/dist/server/oauth/cimd.d.ts +88 -0
- package/dist/server/oauth/cimd.d.ts.map +1 -0
- package/dist/server/oauth/endpoints.d.ts +39 -0
- package/dist/server/oauth/endpoints.d.ts.map +1 -0
- package/dist/server/oauth/metadata.d.ts +28 -0
- package/dist/server/oauth/metadata.d.ts.map +1 -0
- package/dist/server/oauth/provider.d.ts +117 -0
- package/dist/server/oauth/provider.d.ts.map +1 -0
- package/dist/server/realtime.d.ts +1 -1
- package/dist/server/realtime.d.ts.map +1 -1
- package/dist/server/request-completion.d.ts +16 -0
- package/dist/server/request-completion.d.ts.map +1 -0
- package/dist/server/response-metadata.d.ts +1 -1
- package/dist/server/response-metadata.d.ts.map +1 -1
- package/dist/server/route-table.d.ts +9 -0
- package/dist/server/route-table.d.ts.map +1 -0
- package/dist/server/stream.d.ts +0 -13
- package/dist/server/stream.d.ts.map +1 -1
- package/dist/server/streaming-pump.d.ts +66 -0
- package/dist/server/streaming-pump.d.ts.map +1 -0
- package/dist/server/streaming-route.d.ts +12 -5
- package/dist/server/streaming-route.d.ts.map +1 -1
- package/dist/server/types.d.ts +10 -4
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/unix-client-bun.d.ts.map +1 -1
- package/dist/server/unix-client-http1.d.ts +76 -0
- package/dist/server/unix-client-http1.d.ts.map +1 -0
- package/dist/server/unix-client.d.ts.map +1 -1
- package/dist/testing/handler-clients.d.ts +32 -0
- package/dist/testing/handler-clients.d.ts.map +1 -0
- package/dist/testing/managed-resource-conformance-scenarios.d.ts.map +1 -1
- package/dist/testing/realtime-probe.d.ts +33 -0
- package/dist/testing/realtime-probe.d.ts.map +1 -0
- package/dist/testing/surface-conformance.d.ts +2 -32
- package/dist/testing/surface-conformance.d.ts.map +1 -1
- package/dist/testing/surface-manifest-digest.d.ts +44 -0
- package/dist/testing/surface-manifest-digest.d.ts.map +1 -0
- package/dist/testing/surface-manifest.d.ts +30 -4
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/tools/agent.d.ts +1 -1
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/cli/args-fields.d.ts +31 -0
- package/dist/tools/cli/args-fields.d.ts.map +1 -0
- package/dist/tools/cli/args-route.d.ts +42 -0
- package/dist/tools/cli/args-route.d.ts.map +1 -0
- package/dist/tools/cli/args-view.d.ts +32 -0
- package/dist/tools/cli/args-view.d.ts.map +1 -0
- package/dist/tools/cli/args.d.ts +80 -0
- package/dist/tools/cli/args.d.ts.map +1 -0
- package/dist/tools/cli/argument-error.d.ts +5 -0
- package/dist/tools/cli/argument-error.d.ts.map +1 -0
- package/dist/tools/cli/checkpoint.d.ts +24 -0
- package/dist/tools/cli/checkpoint.d.ts.map +1 -0
- package/dist/tools/cli/command.d.ts +70 -0
- package/dist/tools/cli/command.d.ts.map +1 -0
- package/dist/tools/cli/config.d.ts +90 -0
- package/dist/tools/cli/config.d.ts.map +1 -0
- package/dist/tools/cli/create-cli.d.ts +36 -0
- package/dist/tools/cli/create-cli.d.ts.map +1 -0
- package/dist/tools/cli/download.d.ts +8 -0
- package/dist/tools/cli/download.d.ts.map +1 -0
- package/dist/tools/cli/format.d.ts +50 -0
- package/dist/tools/cli/format.d.ts.map +1 -0
- package/dist/tools/cli/help.d.ts +24 -0
- package/dist/tools/cli/help.d.ts.map +1 -0
- package/dist/tools/cli/installer.d.ts +34 -0
- package/dist/tools/cli/installer.d.ts.map +1 -0
- package/dist/tools/cli/invoke.d.ts +144 -0
- package/dist/tools/cli/invoke.d.ts.map +1 -0
- package/dist/tools/cli/io.d.ts +10 -0
- package/dist/tools/cli/io.d.ts.map +1 -0
- package/dist/tools/cli/managed-surface.d.ts +30 -0
- package/dist/tools/cli/managed-surface.d.ts.map +1 -0
- package/dist/tools/cli/manifest.d.ts +80 -0
- package/dist/tools/cli/manifest.d.ts.map +1 -0
- package/dist/tools/cli/policy.d.ts +27 -0
- package/dist/tools/cli/policy.d.ts.map +1 -0
- package/dist/tools/cli/prepare.d.ts +14 -0
- package/dist/tools/cli/prepare.d.ts.map +1 -0
- package/dist/tools/cli/profile.d.ts +40 -0
- package/dist/tools/cli/profile.d.ts.map +1 -0
- package/dist/tools/cli/run-managed.d.ts +5 -0
- package/dist/tools/cli/run-managed.d.ts.map +1 -0
- package/dist/tools/cli/run-native.d.ts +9 -0
- package/dist/tools/cli/run-native.d.ts.map +1 -0
- package/dist/tools/cli/session.d.ts +40 -0
- package/dist/tools/cli/session.d.ts.map +1 -0
- package/dist/tools/cli/signature.d.ts +81 -0
- package/dist/tools/cli/signature.d.ts.map +1 -0
- package/dist/tools/cli/stream.d.ts +93 -0
- package/dist/tools/cli/stream.d.ts.map +1 -0
- package/dist/tools/cli/update.d.ts +145 -0
- package/dist/tools/cli/update.d.ts.map +1 -0
- package/dist/tools/cli/view.d.ts +12 -0
- package/dist/tools/cli/view.d.ts.map +1 -0
- package/dist/tools/cli/wait.d.ts +54 -0
- package/dist/tools/cli/wait.d.ts.map +1 -0
- package/dist/tools/connections/runtime.d.ts +1 -1
- package/dist/tools/connections/runtime.d.ts.map +1 -1
- package/dist/tools/connections/types.d.ts +3 -3
- package/dist/tools/connections/types.d.ts.map +1 -1
- package/dist/tools/durability-context.d.ts +1 -1
- package/dist/tools/durability-context.d.ts.map +1 -1
- package/dist/tools/execute-args.d.ts +23 -0
- package/dist/tools/execute-args.d.ts.map +1 -0
- package/dist/tools/execute-hooks.d.ts +146 -0
- package/dist/tools/execute-hooks.d.ts.map +1 -0
- package/dist/tools/execute-result.d.ts +40 -0
- package/dist/tools/execute-result.d.ts.map +1 -0
- package/dist/tools/execute.d.ts +31 -193
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/internal/surface-projector.d.ts +9 -6
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/internal/tool-view.d.ts +41 -0
- package/dist/tools/internal/tool-view.d.ts.map +1 -0
- package/dist/tools/invoker.d.ts +13 -4
- package/dist/tools/invoker.d.ts.map +1 -1
- package/dist/tools/lifecycle.d.ts +1 -1
- package/dist/tools/lifecycle.d.ts.map +1 -1
- package/dist/tools/list-names.d.ts +3 -3
- package/dist/tools/list-names.d.ts.map +1 -1
- package/dist/tools/manifest.d.ts +2 -2
- package/dist/tools/manifest.d.ts.map +1 -1
- package/dist/tools/mcp/app.d.ts +62 -0
- package/dist/tools/mcp/app.d.ts.map +1 -0
- package/dist/tools/mcp/catalog.d.ts +68 -0
- package/dist/tools/mcp/catalog.d.ts.map +1 -0
- package/dist/tools/mcp/handler.d.ts +46 -0
- package/dist/tools/mcp/handler.d.ts.map +1 -0
- package/dist/tools/mcp/mount.d.ts +152 -0
- package/dist/tools/mcp/mount.d.ts.map +1 -0
- package/dist/tools/mcp/prepare.d.ts +76 -0
- package/dist/tools/mcp/prepare.d.ts.map +1 -0
- package/dist/tools/mcp/progress.d.ts +46 -0
- package/dist/tools/mcp/progress.d.ts.map +1 -0
- package/dist/tools/mcp/register.d.ts +36 -0
- package/dist/tools/mcp/register.d.ts.map +1 -0
- package/dist/tools/mcp/round-context.d.ts +38 -0
- package/dist/tools/mcp/round-context.d.ts.map +1 -0
- package/dist/tools/mcp/round-policy.d.ts +33 -0
- package/dist/tools/mcp/round-policy.d.ts.map +1 -0
- package/dist/tools/mcp/round.d.ts +53 -0
- package/dist/tools/mcp/round.d.ts.map +1 -0
- package/dist/tools/mcp/runtime-tools.d.ts +25 -0
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -0
- package/dist/tools/mcp/stdio-signals.d.ts +33 -0
- package/dist/tools/mcp/stdio-signals.d.ts.map +1 -0
- package/dist/tools/mcp/stdio.d.ts +20 -0
- package/dist/tools/mcp/stdio.d.ts.map +1 -0
- package/dist/tools/mcp/trace.d.ts +12 -0
- package/dist/tools/mcp/trace.d.ts.map +1 -0
- package/dist/tools/mount.d.ts +14 -7
- package/dist/tools/mount.d.ts.map +1 -1
- package/dist/tools/native-definition.d.ts +4 -3
- package/dist/tools/native-definition.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-binding-types.d.ts +127 -0
- package/dist/tools/operations/async-operation-binding-types.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-binding.d.ts +28 -0
- package/dist/tools/operations/async-operation-binding.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-canonical-types.d.ts +110 -0
- package/dist/tools/operations/async-operation-canonical-types.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-canonical.d.ts +7 -0
- package/dist/tools/operations/async-operation-canonical.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-contract.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-id.d.ts +23 -0
- package/dist/tools/operations/async-operation-id.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-runtime-tools.d.ts +41 -0
- package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-runtime-types.d.ts +69 -0
- package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-runtime.d.ts +5 -0
- package/dist/tools/operations/async-operation-runtime.d.ts.map +1 -0
- package/dist/tools/operations/define-wait-tool.d.ts +22 -0
- package/dist/tools/operations/define-wait-tool.d.ts.map +1 -0
- package/dist/tools/operations/mount-wait.d.ts.map +1 -0
- package/dist/tools/operations/wait-core.d.ts.map +1 -0
- package/dist/tools/remote.d.ts +1 -1
- package/dist/tools/remote.d.ts.map +1 -1
- package/dist/tools/runtime-tool.d.ts +13 -4
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools/schema/coerce.d.ts.map +1 -0
- package/dist/tools/schema/flatten-join.d.ts.map +1 -0
- package/dist/tools/schema/flatten.d.ts.map +1 -0
- package/dist/tools/schema/portable-formats.d.ts.map +1 -0
- package/dist/tools/schema/presentation.d.ts +24 -0
- package/dist/tools/schema/presentation.d.ts.map +1 -0
- package/dist/tools/schema/schema.d.ts.map +1 -0
- package/dist/tools/schema/untyped-properties.d.ts.map +1 -0
- package/dist/tools/surface.d.ts +2 -3
- package/dist/tools/surface.d.ts.map +1 -1
- package/dist/tools/tool-logger.d.ts +1 -1
- package/dist/tools/tool-logger.d.ts.map +1 -1
- package/dist/tools/toolkit.d.ts +4 -4
- package/dist/tools/toolkit.d.ts.map +1 -1
- package/dist/tools/transfer/define-download-tool.d.ts +18 -0
- package/dist/tools/transfer/define-download-tool.d.ts.map +1 -0
- package/dist/tools/transfer/define-upload-tool.d.ts +16 -0
- package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -0
- package/dist/tools/transfer/define-view-file-tool.d.ts +10 -0
- package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -0
- package/dist/tools/transfer/download-core.d.ts +20 -0
- package/dist/tools/transfer/download-core.d.ts.map +1 -0
- package/dist/tools/transfer/managed-file-error.d.ts +6 -0
- package/dist/tools/transfer/managed-file-error.d.ts.map +1 -0
- package/dist/tools/transfer/mount-download.d.ts +41 -0
- package/dist/tools/transfer/mount-download.d.ts.map +1 -0
- package/dist/tools/transfer/mount-upload.d.ts +21 -0
- package/dist/tools/transfer/mount-upload.d.ts.map +1 -0
- package/dist/tools/transfer/native-result.d.ts.map +1 -0
- package/dist/tools/transfer/upload-core.d.ts +4 -0
- package/dist/tools/transfer/upload-core.d.ts.map +1 -0
- package/dist/tools/transfer/view-file-contract.d.ts.map +1 -0
- package/dist/tools/transfer/view-file.d.ts +62 -0
- package/dist/tools/transfer/view-file.d.ts.map +1 -0
- package/dist/tools/transports.d.ts +1 -1
- package/dist/tools/transports.d.ts.map +1 -1
- package/dist/tracking/client-listeners.d.ts +30 -0
- package/dist/tracking/client-listeners.d.ts.map +1 -0
- package/dist/tracking/client-visit.d.ts +61 -0
- package/dist/tracking/client-visit.d.ts.map +1 -0
- package/dist/tracking/client.d.ts +3 -2
- package/dist/tracking/client.d.ts.map +1 -1
- package/dist/tracking/contract.d.ts +1 -1
- package/dist/tracking/contract.d.ts.map +1 -1
- package/llms/agent-runtime-browser.txt +33 -0
- package/llms/agent-runtime-coding-tools.txt +58 -0
- package/llms/agent-runtime-harness.txt +45 -0
- package/llms/agent-runtime-openrouter.txt +22 -0
- package/llms/agent-runtime-sandbox.txt +159 -0
- package/llms/agent-runtime-sqlite-bun.txt +29 -0
- package/llms/agent-runtime-sqlite-node.txt +26 -0
- package/llms/agent-runtime-testing.txt +30 -0
- package/llms/agent-runtime.2.txt +550 -0
- package/llms/agent-runtime.3.txt +311 -0
- package/llms/agent-runtime.txt +893 -0
- package/llms/application-diagnostic-journal.txt +30 -0
- package/llms/application-grammy.txt +27 -0
- package/llms/application-opentelemetry.txt +27 -0
- package/llms/application-schemas.txt +42 -0
- package/llms/application.2.txt +487 -0
- package/llms/application.txt +886 -0
- package/llms/cli.2.txt +80 -0
- package/llms/cli.txt +948 -0
- package/llms/contract.txt +606 -0
- package/llms/declaration.txt +286 -0
- package/llms/files.txt +33 -0
- package/llms/geo.txt +114 -0
- package/llms/google.txt +27 -0
- package/llms/live.txt +471 -0
- package/llms/node.txt +43 -0
- package/llms/oauth.txt +136 -0
- package/llms/observability.txt +893 -0
- package/llms/primitives.txt +158 -0
- package/llms/react.txt +184 -0
- package/llms/release.txt +176 -0
- package/llms/remote.txt +25 -0
- package/llms/server.2.txt +361 -0
- package/llms/server.3.txt +1031 -0
- package/llms/server.4.txt +905 -0
- package/llms/server.5.txt +250 -0
- package/llms/server.txt +996 -0
- package/llms/stitchkit.2.txt +836 -0
- package/llms/stitchkit.3.txt +147 -0
- package/llms/stitchkit.txt +260 -0
- package/llms/telegram.txt +30 -0
- package/llms/testing.txt +676 -0
- package/llms/tools-connections.txt +45 -0
- package/llms/tools-contract.txt +9 -0
- package/llms/tools-invoker.txt +9 -0
- package/llms/tools.2.txt +647 -0
- package/llms/tools.3.txt +288 -0
- package/llms/tools.txt +966 -0
- package/llms/tracking-server.txt +32 -0
- package/llms/tracking.txt +263 -0
- package/llms/upgrading-0.37.0-0.50.0.txt +947 -0
- package/llms/upgrading-0.53.0-0.67.0.txt +1174 -0
- package/llms/upgrading-0.68.0-0.94.0.txt +1159 -0
- package/llms/upgrading.txt +215 -0
- package/llms-full.txt +312 -77
- package/llms.txt +54 -5
- package/package.json +84 -83
- package/dist/agent-runtime/durability-contract.d.ts +0 -176
- package/dist/agent-runtime/durability-contract.d.ts.map +0 -1
- package/dist/agent-runtime/durability-json.d.ts +0 -3
- package/dist/agent-runtime/durability-json.d.ts.map +0 -1
- package/dist/agent-runtime/durability-ledger.d.ts +0 -16
- package/dist/agent-runtime/durability-ledger.d.ts.map +0 -1
- package/dist/agent-runtime/durability-scheduler.d.ts +0 -29
- package/dist/agent-runtime/durability-scheduler.d.ts.map +0 -1
- package/dist/agent-runtime/durability.d.ts +0 -14
- package/dist/agent-runtime/durability.d.ts.map +0 -1
- package/dist/agent-runtime/store-driver.d.ts +0 -814
- package/dist/agent-runtime/store-driver.d.ts.map +0 -1
- package/dist/agent-runtime-browser.d.ts +0 -5
- package/dist/agent-runtime-browser.d.ts.map +0 -1
- package/dist/agent-runtime-browser.js +0 -124
- package/dist/agent-runtime-coding-tools.d.ts +0 -2
- package/dist/agent-runtime-coding-tools.d.ts.map +0 -1
- package/dist/agent-runtime-coding-tools.js +0 -23
- package/dist/agent-runtime-harness.d.ts +0 -2
- package/dist/agent-runtime-harness.d.ts.map +0 -1
- package/dist/agent-runtime-harness.js +0 -729
- package/dist/agent-runtime-openrouter.d.ts +0 -29
- package/dist/agent-runtime-openrouter.d.ts.map +0 -1
- package/dist/agent-runtime-openrouter.js +0 -270
- package/dist/agent-runtime-sandbox.d.ts +0 -5
- package/dist/agent-runtime-sandbox.d.ts.map +0 -1
- package/dist/agent-runtime-sandbox.js +0 -798
- package/dist/agent-runtime-sqlite-bun.d.ts +0 -11
- package/dist/agent-runtime-sqlite-bun.d.ts.map +0 -1
- package/dist/agent-runtime-sqlite-bun.js +0 -42
- package/dist/agent-runtime-sqlite-node.d.ts +0 -11
- package/dist/agent-runtime-sqlite-node.d.ts.map +0 -1
- package/dist/agent-runtime-sqlite-node.js +0 -44
- package/dist/agent-runtime-testing.d.ts +0 -3
- package/dist/agent-runtime-testing.d.ts.map +0 -1
- package/dist/agent-runtime-testing.js +0 -156
- package/dist/agent-runtime.d.ts +0 -38
- package/dist/agent-runtime.d.ts.map +0 -1
- package/dist/agent-runtime.js +0 -2607
- package/dist/application/channel.d.ts.map +0 -1
- package/dist/application-diagnostic-journal.d.ts +0 -21
- package/dist/application-diagnostic-journal.d.ts.map +0 -1
- package/dist/application-diagnostic-journal.js +0 -632
- package/dist/application-grammy.d.ts +0 -2
- package/dist/application-grammy.d.ts.map +0 -1
- package/dist/application-grammy.js +0 -169
- package/dist/application-opentelemetry.d.ts +0 -2
- package/dist/application-opentelemetry.d.ts.map +0 -1
- package/dist/application-opentelemetry.js +0 -250
- package/dist/application-schemas.d.ts +0 -15
- package/dist/application-schemas.d.ts.map +0 -1
- package/dist/application-schemas.js +0 -27
- package/dist/application.d.ts +0 -22
- package/dist/application.d.ts.map +0 -1
- package/dist/application.js +0 -1977
- package/dist/cli.d.ts +0 -41
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -753
- package/dist/contract/index.d.ts +0 -8
- package/dist/contract/index.d.ts.map +0 -1
- package/dist/contract/index.js +0 -55
- package/dist/declaration.d.ts.map +0 -1
- package/dist/declaration.js +0 -183
- package/dist/files.d.ts +0 -3
- package/dist/files.d.ts.map +0 -1
- package/dist/files.js +0 -15
- package/dist/geo.d.ts +0 -3
- package/dist/geo.d.ts.map +0 -1
- package/dist/geo.js +0 -245
- package/dist/google.d.ts.map +0 -1
- package/dist/google.js +0 -175
- package/dist/index-0a349c33.js +0 -470
- package/dist/index-0j3vcp5m.js +0 -28
- package/dist/index-2c2bjw3s.js +0 -51
- package/dist/index-2na0qrfn.js +0 -214
- package/dist/index-2qzskm8h.js +0 -63
- package/dist/index-3bmnp41g.js +0 -2169
- package/dist/index-3xwxfj4z.js +0 -334
- package/dist/index-4fpa9dy2.js +0 -51
- package/dist/index-6kyksz9y.js +0 -268
- package/dist/index-77fekveh.js +0 -44
- package/dist/index-7gnkny4z.js +0 -326
- package/dist/index-7zbps32p.js +0 -89
- package/dist/index-9f8ztey6.js +0 -588
- package/dist/index-a11g2kry.js +0 -866
- package/dist/index-a916km3r.js +0 -45
- package/dist/index-actkayzn.js +0 -367
- package/dist/index-bn2cjajt.js +0 -524
- package/dist/index-bx75zwt7.js +0 -63
- package/dist/index-cby4ar3v.js +0 -46
- package/dist/index-cnyk6te3.js +0 -77
- package/dist/index-cxqhvq21.js +0 -413
- package/dist/index-e0znv5gn.js +0 -176
- package/dist/index-e42wzzz5.js +0 -154
- package/dist/index-f477k430.js +0 -324
- package/dist/index-f9mb610r.js +0 -177
- package/dist/index-fadnxwna.js +0 -1046
- package/dist/index-fq77yfzc.js +0 -1303
- package/dist/index-h9etkkyk.js +0 -1126
- package/dist/index-hrbajay7.js +0 -1196
- package/dist/index-kw9t5ayn.js +0 -507
- package/dist/index-mzvgxp0n.js +0 -80
- package/dist/index-n0f51dfn.js +0 -3170
- package/dist/index-p13mwz16.js +0 -16
- package/dist/index-s8cnx02s.js +0 -90
- package/dist/index-sr93cwf9.js +0 -325
- package/dist/index-tmwcrptx.js +0 -85
- package/dist/index-v5573g1k.js +0 -142
- package/dist/index-vjpvjqpn.js +0 -86
- package/dist/index-vk3kq9sb.js +0 -3344
- package/dist/index-wc4x00bn.js +0 -103
- package/dist/index-wnfk50r0.js +0 -211
- package/dist/index-yewwh1w4.js +0 -647
- package/dist/index-yn8remb1.js +0 -290
- package/dist/index-ywd0y6m1.js +0 -394
- package/dist/index-zwkgfq1s.js +0 -345
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -632
- package/dist/internal/errors.d.ts +0 -92
- package/dist/internal/errors.d.ts.map +0 -1
- package/dist/internal/observability-sink.d.ts +0 -81
- package/dist/internal/observability-sink.d.ts.map +0 -1
- package/dist/live.d.ts +0 -19
- package/dist/live.d.ts.map +0 -1
- package/dist/live.js +0 -282
- package/dist/logger.d.ts.map +0 -1
- package/dist/node.d.ts +0 -18
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -303
- package/dist/oauth.d.ts +0 -57
- package/dist/oauth.d.ts.map +0 -1
- package/dist/oauth.js +0 -170
- package/dist/observability/index.d.ts +0 -19
- package/dist/observability/index.d.ts.map +0 -1
- package/dist/observability/index.js +0 -569
- package/dist/primitives.d.ts +0 -3
- package/dist/primitives.d.ts.map +0 -1
- package/dist/primitives.js +0 -754
- package/dist/react.d.ts +0 -5
- package/dist/react.d.ts.map +0 -1
- package/dist/react.js +0 -403
- package/dist/release.d.ts +0 -15
- package/dist/release.d.ts.map +0 -1
- package/dist/release.js +0 -196
- package/dist/remote.d.ts +0 -9
- package/dist/remote.d.ts.map +0 -1
- package/dist/remote.js +0 -88
- package/dist/retained.d.ts.map +0 -1
- package/dist/server/file-state-store.d.ts +0 -23
- package/dist/server/file-state-store.d.ts.map +0 -1
- package/dist/server/index.d.ts +0 -36
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js +0 -1745
- package/dist/server/request.d.ts.map +0 -1
- package/dist/telegram.d.ts +0 -3
- package/dist/telegram.d.ts.map +0 -1
- package/dist/telegram.js +0 -224
- package/dist/testing/agent-store-conformance.d.ts +0 -40
- package/dist/testing/agent-store-conformance.d.ts.map +0 -1
- package/dist/testing.d.ts +0 -39
- package/dist/testing.d.ts.map +0 -1
- package/dist/testing.js +0 -2209
- package/dist/tool-invoker.d.ts +0 -9
- package/dist/tool-invoker.d.ts.map +0 -1
- package/dist/tool-invoker.js +0 -21
- package/dist/tools/async-operation-contract.d.ts.map +0 -1
- package/dist/tools/async-operation.d.ts +0 -332
- package/dist/tools/async-operation.d.ts.map +0 -1
- package/dist/tools/cli-args.d.ts +0 -143
- package/dist/tools/cli-args.d.ts.map +0 -1
- package/dist/tools/cli-checkpoint.d.ts +0 -24
- package/dist/tools/cli-checkpoint.d.ts.map +0 -1
- package/dist/tools/cli-command.d.ts +0 -70
- package/dist/tools/cli-command.d.ts.map +0 -1
- package/dist/tools/cli-format.d.ts +0 -49
- package/dist/tools/cli-format.d.ts.map +0 -1
- package/dist/tools/cli-installer.d.ts +0 -34
- package/dist/tools/cli-installer.d.ts.map +0 -1
- package/dist/tools/cli-invoke.d.ts +0 -143
- package/dist/tools/cli-invoke.d.ts.map +0 -1
- package/dist/tools/cli-manifest.d.ts +0 -80
- package/dist/tools/cli-manifest.d.ts.map +0 -1
- package/dist/tools/cli-policy.d.ts +0 -27
- package/dist/tools/cli-policy.d.ts.map +0 -1
- package/dist/tools/cli-profile.d.ts +0 -40
- package/dist/tools/cli-profile.d.ts.map +0 -1
- package/dist/tools/cli-signature.d.ts +0 -81
- package/dist/tools/cli-signature.d.ts.map +0 -1
- package/dist/tools/cli-stream.d.ts +0 -93
- package/dist/tools/cli-stream.d.ts.map +0 -1
- package/dist/tools/cli-update.d.ts +0 -126
- package/dist/tools/cli-update.d.ts.map +0 -1
- package/dist/tools/cli-view.d.ts +0 -12
- package/dist/tools/cli-view.d.ts.map +0 -1
- package/dist/tools/cli-wait.d.ts +0 -54
- package/dist/tools/cli-wait.d.ts.map +0 -1
- package/dist/tools/cli.d.ts +0 -94
- package/dist/tools/cli.d.ts.map +0 -1
- package/dist/tools/coerce.d.ts.map +0 -1
- package/dist/tools/connections/index.d.ts +0 -20
- package/dist/tools/connections/index.d.ts.map +0 -1
- package/dist/tools/connections/index.js +0 -1107
- package/dist/tools/define-download-tool.d.ts +0 -18
- package/dist/tools/define-download-tool.d.ts.map +0 -1
- package/dist/tools/define-upload-tool.d.ts +0 -16
- package/dist/tools/define-upload-tool.d.ts.map +0 -1
- package/dist/tools/define-view-file-tool.d.ts +0 -10
- package/dist/tools/define-view-file-tool.d.ts.map +0 -1
- package/dist/tools/define-wait-tool.d.ts +0 -22
- package/dist/tools/define-wait-tool.d.ts.map +0 -1
- package/dist/tools/download-core.d.ts +0 -20
- package/dist/tools/download-core.d.ts.map +0 -1
- package/dist/tools/flatten-join.d.ts.map +0 -1
- package/dist/tools/flatten.d.ts.map +0 -1
- package/dist/tools/json-schema-dialect.d.ts +0 -17
- package/dist/tools/json-schema-dialect.d.ts.map +0 -1
- package/dist/tools/json-schema.d.ts.map +0 -1
- package/dist/tools/managed-file-error.d.ts +0 -6
- package/dist/tools/managed-file-error.d.ts.map +0 -1
- package/dist/tools/mcp-app.d.ts +0 -62
- package/dist/tools/mcp-app.d.ts.map +0 -1
- package/dist/tools/mcp-catalog.d.ts +0 -68
- package/dist/tools/mcp-catalog.d.ts.map +0 -1
- package/dist/tools/mcp-handler.d.ts +0 -46
- package/dist/tools/mcp-handler.d.ts.map +0 -1
- package/dist/tools/mcp-prepare.d.ts +0 -75
- package/dist/tools/mcp-prepare.d.ts.map +0 -1
- package/dist/tools/mcp-progress.d.ts +0 -46
- package/dist/tools/mcp-progress.d.ts.map +0 -1
- package/dist/tools/mcp-round-policy.d.ts +0 -33
- package/dist/tools/mcp-round-policy.d.ts.map +0 -1
- package/dist/tools/mcp-round.d.ts +0 -61
- package/dist/tools/mcp-round.d.ts.map +0 -1
- package/dist/tools/mcp-stdio-signals.d.ts +0 -33
- package/dist/tools/mcp-stdio-signals.d.ts.map +0 -1
- package/dist/tools/mcp-stdio.d.ts +0 -20
- package/dist/tools/mcp-stdio.d.ts.map +0 -1
- package/dist/tools/mcp-trace.d.ts +0 -12
- package/dist/tools/mcp-trace.d.ts.map +0 -1
- package/dist/tools/mcp.d.ts +0 -152
- package/dist/tools/mcp.d.ts.map +0 -1
- package/dist/tools/mount-download.d.ts +0 -41
- package/dist/tools/mount-download.d.ts.map +0 -1
- package/dist/tools/mount-upload.d.ts +0 -21
- package/dist/tools/mount-upload.d.ts.map +0 -1
- package/dist/tools/mount-wait.d.ts.map +0 -1
- package/dist/tools/native-mcp.d.ts +0 -20
- package/dist/tools/native-mcp.d.ts.map +0 -1
- package/dist/tools/native-result.d.ts.map +0 -1
- package/dist/tools/oauth-metadata.d.ts +0 -28
- package/dist/tools/oauth-metadata.d.ts.map +0 -1
- package/dist/tools/oauth-provider.d.ts +0 -184
- package/dist/tools/oauth-provider.d.ts.map +0 -1
- package/dist/tools/portable-formats.d.ts.map +0 -1
- package/dist/tools/presentation.d.ts +0 -22
- package/dist/tools/presentation.d.ts.map +0 -1
- package/dist/tools/schema.d.ts.map +0 -1
- package/dist/tools/untyped-properties.d.ts.map +0 -1
- package/dist/tools/upload-core.d.ts +0 -4
- package/dist/tools/upload-core.d.ts.map +0 -1
- package/dist/tools/view-file-contract.d.ts.map +0 -1
- package/dist/tools/view-file.d.ts +0 -62
- package/dist/tools/view-file.d.ts.map +0 -1
- package/dist/tools/wait-core.d.ts.map +0 -1
- package/dist/tools-contract.d.ts +0 -29
- package/dist/tools-contract.d.ts.map +0 -1
- package/dist/tools-contract.js +0 -24
- package/dist/tools.d.ts +0 -50
- package/dist/tools.d.ts.map +0 -1
- package/dist/tools.js +0 -2930
- package/dist/tracking-server.d.ts +0 -15
- package/dist/tracking-server.d.ts.map +0 -1
- package/dist/tracking.d.ts +0 -24
- package/dist/tracking.d.ts.map +0 -1
- package/dist/tracking.js +0 -1092
- package/dist/upgrade-cli.d.ts.map +0 -1
- package/dist/upgrade-cli.js +0 -177
- /package/dist/{retained.d.ts → browser/retained.d.ts} +0 -0
- /package/dist/{declaration.d.ts → declaration/declaration.d.ts} +0 -0
- /package/dist/{upgrade-cli.d.ts → entrypoints/bin/upgrade-cli.d.ts} +0 -0
- /package/dist/{tracking-server.js → entrypoints/tracking/server.js} +0 -0
- /package/dist/{google.d.ts → google/google.d.ts} +0 -0
- /package/dist/{index-pq95qkbf.js → index-5jm36zv1.js} +0 -0
- /package/dist/{application → internal}/channel.d.ts +0 -0
- /package/dist/{logger.d.ts → internal/logger.d.ts} +0 -0
- /package/dist/{server → internal}/request.d.ts +0 -0
- /package/dist/{tools → json-schema}/json-schema.d.ts +0 -0
- /package/dist/tools/{async-operation-contract.d.ts → operations/async-operation-contract.d.ts} +0 -0
- /package/dist/tools/{mount-wait.d.ts → operations/mount-wait.d.ts} +0 -0
- /package/dist/tools/{wait-core.d.ts → operations/wait-core.d.ts} +0 -0
- /package/dist/tools/{coerce.d.ts → schema/coerce.d.ts} +0 -0
- /package/dist/tools/{flatten-join.d.ts → schema/flatten-join.d.ts} +0 -0
- /package/dist/tools/{flatten.d.ts → schema/flatten.d.ts} +0 -0
- /package/dist/tools/{portable-formats.d.ts → schema/portable-formats.d.ts} +0 -0
- /package/dist/tools/{schema.d.ts → schema/schema.d.ts} +0 -0
- /package/dist/tools/{untyped-properties.d.ts → schema/untyped-properties.d.ts} +0 -0
- /package/dist/tools/{native-result.d.ts → transfer/native-result.d.ts} +0 -0
- /package/dist/tools/{view-file-contract.d.ts → transfer/view-file-contract.d.ts} +0 -0
package/dist/index-fq77yfzc.js
DELETED
|
@@ -1,1303 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assertContainedFileCurrent,
|
|
3
|
-
assertContainedParentCurrent,
|
|
4
|
-
containedEntryMetadata,
|
|
5
|
-
listContainedDirectory,
|
|
6
|
-
missingContainedDirectories,
|
|
7
|
-
openContainedFile,
|
|
8
|
-
openContainedParent,
|
|
9
|
-
openContainedParentFile,
|
|
10
|
-
readContainedUtf8Handle,
|
|
11
|
-
scanContainedFiles,
|
|
12
|
-
writeContainedFile
|
|
13
|
-
} from "./index-bn2cjajt.js";
|
|
14
|
-
import {
|
|
15
|
-
codingPathRefusal,
|
|
16
|
-
codingRefusal,
|
|
17
|
-
missingSandboxRestrictions,
|
|
18
|
-
probeAgentProcessSandbox,
|
|
19
|
-
refuseMissingCodingPath
|
|
20
|
-
} from "./index-qmy6zq75.js";
|
|
21
|
-
import {
|
|
22
|
-
defineRuntimeTool
|
|
23
|
-
} from "./index-vjpvjqpn.js";
|
|
24
|
-
import {
|
|
25
|
-
conflict,
|
|
26
|
-
forbidden
|
|
27
|
-
} from "./index-2vtcmrj9.js";
|
|
28
|
-
|
|
29
|
-
// src/agent-runtime/coding-tool-contract.ts
|
|
30
|
-
import { z } from "zod";
|
|
31
|
-
var AgentCodingToolLimitsSchema = z.object({
|
|
32
|
-
maxPathBytes: z.int().positive(),
|
|
33
|
-
maxReadBytes: z.int().positive(),
|
|
34
|
-
maxWriteBytes: z.int().positive(),
|
|
35
|
-
maxShellArguments: z.int().positive(),
|
|
36
|
-
maxShellArgumentBytes: z.int().positive(),
|
|
37
|
-
maxShellOutputBytes: z.int().positive(),
|
|
38
|
-
maxArtifactBytes: z.int().positive(),
|
|
39
|
-
maxListEntries: z.int().positive(),
|
|
40
|
-
maxSearchResults: z.int().positive(),
|
|
41
|
-
maxSearchFiles: z.int().positive(),
|
|
42
|
-
maxSearchDepth: z.int().nonnegative(),
|
|
43
|
-
shellTimeoutMs: z.int().positive(),
|
|
44
|
-
shellTerminationGraceMs: z.int().positive()
|
|
45
|
-
}).strict();
|
|
46
|
-
var AgentCodingToolAuthorizationSchema = z.discriminatedUnion("operation", [
|
|
47
|
-
z.object({ operation: z.literal("read"), path: z.string().min(1) }).strict(),
|
|
48
|
-
z.object({
|
|
49
|
-
operation: z.literal("write"),
|
|
50
|
-
path: z.string().min(1),
|
|
51
|
-
bytes: z.int().nonnegative(),
|
|
52
|
-
overwrite: z.boolean(),
|
|
53
|
-
createsDirectories: z.array(z.string().min(1))
|
|
54
|
-
}).strict(),
|
|
55
|
-
z.object({
|
|
56
|
-
operation: z.literal("search"),
|
|
57
|
-
query: z.string().min(1),
|
|
58
|
-
mode: z.enum(["path", "content"])
|
|
59
|
-
}).strict(),
|
|
60
|
-
z.object({
|
|
61
|
-
operation: z.literal("edit"),
|
|
62
|
-
path: z.string().min(1),
|
|
63
|
-
baseSha256: z.string().length(64),
|
|
64
|
-
resultSha256: z.string().length(64),
|
|
65
|
-
resultBytes: z.int().nonnegative(),
|
|
66
|
-
replacements: z.int().positive(),
|
|
67
|
-
dryRun: z.boolean()
|
|
68
|
-
}).strict(),
|
|
69
|
-
z.object({ operation: z.literal("list"), path: z.string().min(1) }).strict(),
|
|
70
|
-
z.object({
|
|
71
|
-
operation: z.literal("glob"),
|
|
72
|
-
pattern: z.string().min(1),
|
|
73
|
-
path: z.string().min(1)
|
|
74
|
-
}).strict(),
|
|
75
|
-
z.object({
|
|
76
|
-
operation: z.literal("artifact-read"),
|
|
77
|
-
reference: z.string().min(1),
|
|
78
|
-
offset: z.int().nonnegative(),
|
|
79
|
-
maxBytes: z.int().positive()
|
|
80
|
-
}).strict(),
|
|
81
|
-
z.object({
|
|
82
|
-
operation: z.literal("artifact-search"),
|
|
83
|
-
reference: z.string().min(1),
|
|
84
|
-
query: z.string().min(1),
|
|
85
|
-
maxMatches: z.int().positive()
|
|
86
|
-
}).strict(),
|
|
87
|
-
z.object({
|
|
88
|
-
operation: z.literal("shell"),
|
|
89
|
-
executable: z.string().min(1),
|
|
90
|
-
args: z.array(z.string()),
|
|
91
|
-
cwd: z.string().min(1)
|
|
92
|
-
}).strict()
|
|
93
|
-
]);
|
|
94
|
-
var AgentCodingToolPathAuthorizationSchema = z.object({ path: z.string().min(1) }).strict();
|
|
95
|
-
var CodingDeniedEntrySchema = z.object({
|
|
96
|
-
path: z.string().min(1),
|
|
97
|
-
kind: z.enum(["file", "directory", "symlink", "other"])
|
|
98
|
-
}).strict();
|
|
99
|
-
var FileReadInputSchema = z.object({
|
|
100
|
-
path: z.string().min(1),
|
|
101
|
-
offset: z.int().nonnegative().default(0),
|
|
102
|
-
maxBytes: z.int().positive().optional()
|
|
103
|
-
}).strict();
|
|
104
|
-
var FileReadOutputSchema = z.object({
|
|
105
|
-
path: z.string().min(1),
|
|
106
|
-
text: z.string(),
|
|
107
|
-
bytes: z.int().nonnegative(),
|
|
108
|
-
sha256: z.string().length(64),
|
|
109
|
-
truncated: z.boolean(),
|
|
110
|
-
nextOffset: z.int().nonnegative().optional()
|
|
111
|
-
}).strict();
|
|
112
|
-
var FileWriteInputSchema = z.object({
|
|
113
|
-
path: z.string().min(1),
|
|
114
|
-
content: z.string(),
|
|
115
|
-
overwrite: z.boolean().default(false)
|
|
116
|
-
}).strict();
|
|
117
|
-
var FileWriteOutputSchema = z.object({
|
|
118
|
-
path: z.string().min(1),
|
|
119
|
-
bytes: z.int().nonnegative(),
|
|
120
|
-
createdDirectories: z.array(z.string().min(1))
|
|
121
|
-
}).strict();
|
|
122
|
-
function createShellInputSchema(executableNames) {
|
|
123
|
-
if (executableNames.length === 0) {
|
|
124
|
-
throw new Error("A command tool requires at least one executable alias");
|
|
125
|
-
}
|
|
126
|
-
return z.object({
|
|
127
|
-
executable: z.enum(executableNames),
|
|
128
|
-
args: z.array(z.string()).default([]),
|
|
129
|
-
cwd: z.string().min(1).default(".")
|
|
130
|
-
}).strict();
|
|
131
|
-
}
|
|
132
|
-
var ShellInputSchema = z.object({
|
|
133
|
-
executable: z.string().min(1),
|
|
134
|
-
args: z.array(z.string()).default([]),
|
|
135
|
-
cwd: z.string().min(1).default(".")
|
|
136
|
-
}).strict();
|
|
137
|
-
var ShellOutputSchema = z.object({
|
|
138
|
-
executable: z.string().min(1),
|
|
139
|
-
exitCode: z.int().nullable(),
|
|
140
|
-
signal: z.string().nullable(),
|
|
141
|
-
stdout: z.string(),
|
|
142
|
-
stderr: z.string(),
|
|
143
|
-
outcome: z.enum(["exited", "timeout", "output-limit", "cancelled"]),
|
|
144
|
-
artifact: z.object({
|
|
145
|
-
reference: z.string().min(1),
|
|
146
|
-
bytes: z.int().nonnegative(),
|
|
147
|
-
truncated: z.boolean(),
|
|
148
|
-
headBytes: z.int().nonnegative(),
|
|
149
|
-
tailBytes: z.int().nonnegative(),
|
|
150
|
-
omittedBytes: z.int().nonnegative()
|
|
151
|
-
}).strict().optional()
|
|
152
|
-
}).strict();
|
|
153
|
-
var DEFAULT_LIMITS = {
|
|
154
|
-
maxPathBytes: 4096,
|
|
155
|
-
maxReadBytes: 262144,
|
|
156
|
-
maxWriteBytes: 262144,
|
|
157
|
-
maxShellArguments: 128,
|
|
158
|
-
maxShellArgumentBytes: 65536,
|
|
159
|
-
maxShellOutputBytes: 262144,
|
|
160
|
-
maxArtifactBytes: 4194304,
|
|
161
|
-
maxListEntries: 500,
|
|
162
|
-
maxSearchResults: 100,
|
|
163
|
-
maxSearchFiles: 1e4,
|
|
164
|
-
maxSearchDepth: 32,
|
|
165
|
-
shellTimeoutMs: 30000,
|
|
166
|
-
shellTerminationGraceMs: 250
|
|
167
|
-
};
|
|
168
|
-
function resolveCodingToolLimits(input) {
|
|
169
|
-
return AgentCodingToolLimitsSchema.parse({ ...DEFAULT_LIMITS, ...input });
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// src/agent-runtime/coding-tools.ts
|
|
173
|
-
import path4 from "node:path";
|
|
174
|
-
import { z as z4 } from "zod";
|
|
175
|
-
|
|
176
|
-
// src/agent-runtime/coding-tool-files.ts
|
|
177
|
-
import { createHash } from "node:crypto";
|
|
178
|
-
import { realpath as realpath2 } from "node:fs/promises";
|
|
179
|
-
|
|
180
|
-
// src/agent-runtime/coding-tool-paths.ts
|
|
181
|
-
import { lstat, realpath } from "node:fs/promises";
|
|
182
|
-
import path from "node:path";
|
|
183
|
-
function within(root, target) {
|
|
184
|
-
const relative = path.relative(root, target);
|
|
185
|
-
return relative === "" || !relative.startsWith(`..${path.sep}`) && relative !== ".." && !path.isAbsolute(relative);
|
|
186
|
-
}
|
|
187
|
-
function inputPath(root, requested, maxPathBytes) {
|
|
188
|
-
if (new TextEncoder().encode(requested).byteLength > maxPathBytes) {
|
|
189
|
-
codingRefusal("BAD_REQUEST", `Path exceeds the ${maxPathBytes}-byte limit`, {
|
|
190
|
-
details: { maxPathBytes },
|
|
191
|
-
hint: "Use a shorter workspace-relative path."
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
if (path.isAbsolute(requested)) {
|
|
195
|
-
const relative = path.relative(root, requested);
|
|
196
|
-
const recoveryPath = within(root, requested) ? relative.split(path.sep).join("/") || "." : undefined;
|
|
197
|
-
codingRefusal("BAD_REQUEST", "Paths must be relative to the workspace root", {
|
|
198
|
-
details: { path: requested, ...recoveryPath && { recoveryPath } },
|
|
199
|
-
hint: recoveryPath ? `Use the workspace-relative path \`${recoveryPath}\`.` : "Pass a path relative to the workspace root; absolute paths outside it have no workspace-relative equivalent."
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
const resolved = path.resolve(root, requested);
|
|
203
|
-
if (!within(root, resolved)) {
|
|
204
|
-
codingRefusal("FORBIDDEN", "Path escapes the workspace root", {
|
|
205
|
-
details: { path: requested },
|
|
206
|
-
hint: "Stay inside the workspace; `..` segments that leave the root are refused."
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
return resolved;
|
|
210
|
-
}
|
|
211
|
-
function boundedCodingRelativePath(root, requested, maxPathBytes) {
|
|
212
|
-
if (path.isAbsolute(requested))
|
|
213
|
-
inputPath(root, requested, maxPathBytes);
|
|
214
|
-
if (requested.includes("\\")) {
|
|
215
|
-
codingRefusal("FORBIDDEN", "Path separators must be `/`", {
|
|
216
|
-
details: { path: requested },
|
|
217
|
-
hint: "Use `/` between segments; a backslash is refused because the workspace walk reads it as a separator."
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
const segments = requested.split("/");
|
|
221
|
-
if (segments.some((segment) => segment === "" || segment === "." || segment === "..")) {
|
|
222
|
-
codingRefusal("FORBIDDEN", "Path segments must name real entries under the root", {
|
|
223
|
-
details: { path: requested },
|
|
224
|
-
hint: "Pass a plain workspace-relative path — `.`, `..` and empty segments are refused."
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
inputPath(root, requested, maxPathBytes);
|
|
228
|
-
return requested;
|
|
229
|
-
}
|
|
230
|
-
async function existingCodingPath(root, requested, maxPathBytes) {
|
|
231
|
-
const resolved = await realpath(inputPath(root, requested, maxPathBytes));
|
|
232
|
-
if (!within(root, resolved))
|
|
233
|
-
throw new Error("Coding tool path resolves outside its root");
|
|
234
|
-
return { absolute: resolved, relative: path.relative(root, resolved) || "." };
|
|
235
|
-
}
|
|
236
|
-
async function authorizeCodingTool(config, request) {
|
|
237
|
-
const parsed = AgentCodingToolAuthorizationSchema.parse(request);
|
|
238
|
-
if (!await config.authorize(parsed))
|
|
239
|
-
forbidden("Coding tool permission denied");
|
|
240
|
-
}
|
|
241
|
-
async function isCodingPathAuthorized(config, path2) {
|
|
242
|
-
if (!config.authorizePath)
|
|
243
|
-
return true;
|
|
244
|
-
const parsed = AgentCodingToolPathAuthorizationSchema.parse({ path: path2 });
|
|
245
|
-
return await config.authorizePath(parsed);
|
|
246
|
-
}
|
|
247
|
-
async function authorizeCodingPath(config, path2) {
|
|
248
|
-
if (!await isCodingPathAuthorized(config, path2)) {
|
|
249
|
-
codingRefusal("FORBIDDEN", "Coding tool path permission denied", {
|
|
250
|
-
details: { path: path2 },
|
|
251
|
-
hint: "The host policy refused this path or a directory above it."
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
async function authorizeCodingPathChain(config, relative) {
|
|
256
|
-
if (!config.authorizePath)
|
|
257
|
-
return;
|
|
258
|
-
const segments = relative === "." ? ["."] : relative.split("/");
|
|
259
|
-
for (let depth = 1;depth <= segments.length; depth += 1) {
|
|
260
|
-
await authorizeCodingPath(config, segments.slice(0, depth).join("/"));
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
var codingPathLocks = new Map;
|
|
264
|
-
async function withCodingPathLock(target, work) {
|
|
265
|
-
const previous = codingPathLocks.get(target) ?? Promise.resolve();
|
|
266
|
-
let release = () => {
|
|
267
|
-
return;
|
|
268
|
-
};
|
|
269
|
-
const current = new Promise((resolve) => {
|
|
270
|
-
release = resolve;
|
|
271
|
-
});
|
|
272
|
-
const queued = previous.then(() => current);
|
|
273
|
-
codingPathLocks.set(target, queued);
|
|
274
|
-
await previous;
|
|
275
|
-
try {
|
|
276
|
-
return await work();
|
|
277
|
-
} finally {
|
|
278
|
-
release();
|
|
279
|
-
if (codingPathLocks.get(target) === queued)
|
|
280
|
-
codingPathLocks.delete(target);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
function textOccurrences(source, search) {
|
|
284
|
-
let count = 0;
|
|
285
|
-
let offset = 0;
|
|
286
|
-
while (offset <= source.length - search.length) {
|
|
287
|
-
const found = source.indexOf(search, offset);
|
|
288
|
-
if (found < 0)
|
|
289
|
-
break;
|
|
290
|
-
count += 1;
|
|
291
|
-
offset = found + search.length;
|
|
292
|
-
}
|
|
293
|
-
return count;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// src/agent-runtime/coding-tool-utf8.ts
|
|
297
|
-
function sequenceLength(lead) {
|
|
298
|
-
if (lead < 128)
|
|
299
|
-
return 1;
|
|
300
|
-
if ((lead & 224) === 192)
|
|
301
|
-
return 2;
|
|
302
|
-
if ((lead & 240) === 224)
|
|
303
|
-
return 3;
|
|
304
|
-
if ((lead & 248) === 240)
|
|
305
|
-
return 4;
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
function utf8AlignedEnd(data, start, limit) {
|
|
309
|
-
const safe = Math.max(start, Math.min(start + limit, data.byteLength));
|
|
310
|
-
for (let back = 1;back <= 4 && safe - back >= start; back += 1) {
|
|
311
|
-
const byte = data[safe - back];
|
|
312
|
-
if ((byte & 192) === 128)
|
|
313
|
-
continue;
|
|
314
|
-
const length = sequenceLength(byte);
|
|
315
|
-
if (length === undefined)
|
|
316
|
-
return safe;
|
|
317
|
-
if (back >= length)
|
|
318
|
-
return safe;
|
|
319
|
-
const sequenceEnd = safe - back + length;
|
|
320
|
-
return sequenceEnd <= data.byteLength ? sequenceEnd : safe - back;
|
|
321
|
-
}
|
|
322
|
-
return safe;
|
|
323
|
-
}
|
|
324
|
-
function utf8AlignedStart(data, start, end) {
|
|
325
|
-
let safe = Math.max(0, Math.min(start, end));
|
|
326
|
-
while (safe < end && (data[safe] & 192) === 128)
|
|
327
|
-
safe += 1;
|
|
328
|
-
return safe;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// src/agent-runtime/coding-tool-files.ts
|
|
332
|
-
async function digestFile(handle, size) {
|
|
333
|
-
const hash = createHash("sha256");
|
|
334
|
-
const chunk = Buffer.alloc(Math.min(64 * 1024, Math.max(1, size)));
|
|
335
|
-
for (let position = 0;position < size; ) {
|
|
336
|
-
const length = Math.min(chunk.byteLength, size - position);
|
|
337
|
-
const { bytesRead } = await handle.read(chunk, 0, length, position);
|
|
338
|
-
if (bytesRead === 0)
|
|
339
|
-
break;
|
|
340
|
-
hash.update(chunk.subarray(0, bytesRead));
|
|
341
|
-
position += bytesRead;
|
|
342
|
-
}
|
|
343
|
-
return hash.digest("hex");
|
|
344
|
-
}
|
|
345
|
-
function createFileCodingTools(config, limits) {
|
|
346
|
-
const read = defineRuntimeTool({
|
|
347
|
-
name: "read_file",
|
|
348
|
-
description: "Read a bounded UTF-8 slice from a host-authorized workspace file.",
|
|
349
|
-
identity: { serviceName: "coding", action: "read-file", method: "POST" },
|
|
350
|
-
input: FileReadInputSchema,
|
|
351
|
-
output: FileReadOutputSchema,
|
|
352
|
-
transports: ["AGENT"],
|
|
353
|
-
handler: async ({ input }) => {
|
|
354
|
-
const root = await realpath2(config.root);
|
|
355
|
-
const relative = boundedCodingRelativePath(root, input.path, limits.maxPathBytes);
|
|
356
|
-
await authorizeCodingPathChain(config, relative);
|
|
357
|
-
const handle = await openContainedFile(root, relative).catch((error) => refuseMissingCodingPath(error, relative));
|
|
358
|
-
const maximum = Math.min(input.maxBytes ?? limits.maxReadBytes, limits.maxReadBytes);
|
|
359
|
-
let selected;
|
|
360
|
-
let start = input.offset;
|
|
361
|
-
let size;
|
|
362
|
-
let sha256;
|
|
363
|
-
try {
|
|
364
|
-
await authorizeCodingTool(config, { operation: "read", path: relative });
|
|
365
|
-
await assertContainedFileCurrent(root, relative, handle);
|
|
366
|
-
const metadata = await handle.stat();
|
|
367
|
-
if (!metadata.isFile()) {
|
|
368
|
-
codingPathRefusal("BAD_REQUEST", "This path is not a regular file", relative, {
|
|
369
|
-
hint: "Use list_directory to see what is here."
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
size = metadata.size;
|
|
373
|
-
const length = Math.min(maximum + 4, Math.max(0, size - input.offset));
|
|
374
|
-
selected = Buffer.alloc(length);
|
|
375
|
-
const { bytesRead } = await handle.read(selected, 0, length, input.offset);
|
|
376
|
-
selected = selected.subarray(0, bytesRead);
|
|
377
|
-
if (input.offset > 0) {
|
|
378
|
-
const aligned = utf8AlignedStart(selected, 0, selected.byteLength);
|
|
379
|
-
start = input.offset + aligned;
|
|
380
|
-
selected = selected.subarray(aligned);
|
|
381
|
-
}
|
|
382
|
-
if (selected.byteLength > maximum) {
|
|
383
|
-
selected = selected.subarray(0, utf8AlignedEnd(selected, 0, maximum));
|
|
384
|
-
}
|
|
385
|
-
sha256 = await digestFile(handle, size);
|
|
386
|
-
} finally {
|
|
387
|
-
await handle.close();
|
|
388
|
-
}
|
|
389
|
-
let text;
|
|
390
|
-
try {
|
|
391
|
-
text = new TextDecoder("utf-8", { fatal: true }).decode(selected);
|
|
392
|
-
} catch {
|
|
393
|
-
codingPathRefusal("BAD_REQUEST", "The selected file bytes are not valid UTF-8", relative, {
|
|
394
|
-
details: { reason: "invalid_utf8" },
|
|
395
|
-
hint: "Use a binary-capable reader or convert the file to UTF-8."
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
const end = start + selected.byteLength;
|
|
399
|
-
const truncated = end < size;
|
|
400
|
-
return {
|
|
401
|
-
path: relative,
|
|
402
|
-
text,
|
|
403
|
-
bytes: selected.byteLength,
|
|
404
|
-
sha256,
|
|
405
|
-
truncated,
|
|
406
|
-
...truncated && { nextOffset: end }
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
const write = defineRuntimeTool({
|
|
411
|
-
name: "write_file",
|
|
412
|
-
description: "Write bounded UTF-8 content to a host-authorized workspace file.",
|
|
413
|
-
identity: { serviceName: "coding", action: "write-file", method: "POST" },
|
|
414
|
-
input: FileWriteInputSchema,
|
|
415
|
-
output: FileWriteOutputSchema,
|
|
416
|
-
transports: ["AGENT"],
|
|
417
|
-
handler: async ({ input }) => {
|
|
418
|
-
const root = await realpath2(config.root);
|
|
419
|
-
const relative = boundedCodingRelativePath(root, input.path, limits.maxPathBytes);
|
|
420
|
-
await authorizeCodingPathChain(config, relative);
|
|
421
|
-
const bytes = Buffer.byteLength(input.content);
|
|
422
|
-
if (bytes > limits.maxWriteBytes) {
|
|
423
|
-
codingPathRefusal("BAD_REQUEST", `The content is ${bytes} bytes, over the ${limits.maxWriteBytes}-byte limit`, relative, {
|
|
424
|
-
details: { bytes, maxWriteBytes: limits.maxWriteBytes },
|
|
425
|
-
hint: "Write a smaller file, or split it."
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
const createsDirectories = await missingContainedDirectories(root, relative).catch((error) => {
|
|
429
|
-
if (error.code === "ENOTDIR") {
|
|
430
|
-
codingPathRefusal("CONFLICT", "A segment of this path is not a directory", relative, {
|
|
431
|
-
hint: "Write under a different path, or remove the file blocking it."
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
throw error;
|
|
435
|
-
});
|
|
436
|
-
await authorizeCodingTool(config, {
|
|
437
|
-
operation: "write",
|
|
438
|
-
path: relative,
|
|
439
|
-
bytes,
|
|
440
|
-
overwrite: input.overwrite,
|
|
441
|
-
createsDirectories
|
|
442
|
-
});
|
|
443
|
-
const parent = await openContainedParent(root, relative, { create: true }).catch((error) => {
|
|
444
|
-
const code = error.code;
|
|
445
|
-
if (code === "ENOTDIR" || error instanceof Error && error.message.includes("ancestor is not a directory")) {
|
|
446
|
-
codingPathRefusal("CONFLICT", "A segment of this path is not a directory", relative, {
|
|
447
|
-
details: { createsDirectories },
|
|
448
|
-
hint: "Write under a different path, or remove the file blocking it."
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
throw error;
|
|
452
|
-
});
|
|
453
|
-
try {
|
|
454
|
-
await assertContainedParentCurrent(root, relative, parent.handle);
|
|
455
|
-
const current = await containedEntryMetadata(parent);
|
|
456
|
-
if (input.overwrite) {
|
|
457
|
-
if (current?.isSymbolicLink()) {
|
|
458
|
-
codingPathRefusal("FORBIDDEN", "This path is a symlink", relative, {
|
|
459
|
-
hint: "Coding tools never write through symlinks; write to the target directly."
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
await writeContainedFile({
|
|
463
|
-
parent,
|
|
464
|
-
content: input.content,
|
|
465
|
-
replace: true,
|
|
466
|
-
...current && { mode: current.mode }
|
|
467
|
-
});
|
|
468
|
-
} else {
|
|
469
|
-
if (current) {
|
|
470
|
-
codingPathRefusal("CONFLICT", "This file already exists", relative, {
|
|
471
|
-
hint: "Pass overwrite: true to replace it, or edit_file to change part of it."
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
|
-
await writeContainedFile({ parent, content: input.content, replace: false });
|
|
475
|
-
}
|
|
476
|
-
} finally {
|
|
477
|
-
await parent.handle.close();
|
|
478
|
-
}
|
|
479
|
-
return { path: relative, bytes, createdDirectories: createsDirectories };
|
|
480
|
-
}
|
|
481
|
-
});
|
|
482
|
-
return [read, write];
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// src/agent-runtime/coding-tool-listing.ts
|
|
486
|
-
import { realpath as realpath3 } from "node:fs/promises";
|
|
487
|
-
import path2 from "node:path";
|
|
488
|
-
import { z as z2 } from "zod";
|
|
489
|
-
var DEFAULT_EXCLUDED_DIRECTORIES = [
|
|
490
|
-
".git",
|
|
491
|
-
".next",
|
|
492
|
-
".stitchkit",
|
|
493
|
-
"build",
|
|
494
|
-
"coverage",
|
|
495
|
-
"dist",
|
|
496
|
-
"node_modules"
|
|
497
|
-
];
|
|
498
|
-
var ListInputSchema = z2.object({ path: z2.string().min(1).default(".") }).strict();
|
|
499
|
-
var ListOutputSchema = z2.object({
|
|
500
|
-
path: z2.string().min(1),
|
|
501
|
-
entries: z2.array(z2.object({
|
|
502
|
-
name: z2.string().min(1),
|
|
503
|
-
kind: z2.enum(["file", "directory", "symlink", "other"]),
|
|
504
|
-
bytes: z2.int().nonnegative().optional(),
|
|
505
|
-
excluded: z2.boolean().optional()
|
|
506
|
-
}).strict()),
|
|
507
|
-
truncated: z2.boolean(),
|
|
508
|
-
denied: z2.array(CodingDeniedEntrySchema).optional(),
|
|
509
|
-
deniedTruncated: z2.boolean().optional()
|
|
510
|
-
}).strict();
|
|
511
|
-
var GlobInputSchema = z2.object({ pattern: z2.string().min(1), path: z2.string().min(1).default(".") }).strict();
|
|
512
|
-
var GlobOutputSchema = z2.object({
|
|
513
|
-
paths: z2.array(z2.string().min(1)),
|
|
514
|
-
truncated: z2.boolean(),
|
|
515
|
-
resultTruncated: z2.boolean(),
|
|
516
|
-
skippedDirectories: z2.int().nonnegative(),
|
|
517
|
-
scannedFiles: z2.int().nonnegative(),
|
|
518
|
-
denied: z2.array(CodingDeniedEntrySchema).optional(),
|
|
519
|
-
deniedTruncated: z2.boolean().optional()
|
|
520
|
-
}).strict();
|
|
521
|
-
function compileWorkspaceGlob(pattern) {
|
|
522
|
-
let source = "";
|
|
523
|
-
for (let index = 0;index < pattern.length; index += 1) {
|
|
524
|
-
const character = pattern[index];
|
|
525
|
-
if (character === "*") {
|
|
526
|
-
if (pattern[index + 1] === "*") {
|
|
527
|
-
if (pattern[index + 2] === "/") {
|
|
528
|
-
source += "(?:[^/]+/)*";
|
|
529
|
-
index += 2;
|
|
530
|
-
continue;
|
|
531
|
-
}
|
|
532
|
-
source += ".*";
|
|
533
|
-
index += 1;
|
|
534
|
-
continue;
|
|
535
|
-
}
|
|
536
|
-
source += "[^/]*";
|
|
537
|
-
continue;
|
|
538
|
-
}
|
|
539
|
-
if (character === "?") {
|
|
540
|
-
source += "[^/]";
|
|
541
|
-
continue;
|
|
542
|
-
}
|
|
543
|
-
source += character?.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") ?? "";
|
|
544
|
-
}
|
|
545
|
-
return new RegExp(`^${source}$`);
|
|
546
|
-
}
|
|
547
|
-
function createListingCodingTools(config, limits) {
|
|
548
|
-
const excluded = new Set(config.search?.excludeDirectories ?? DEFAULT_EXCLUDED_DIRECTORIES);
|
|
549
|
-
const list = defineRuntimeTool({
|
|
550
|
-
name: "list_directory",
|
|
551
|
-
description: "List the direct entries of one workspace directory.",
|
|
552
|
-
identity: { serviceName: "coding", action: "list-directory", method: "POST" },
|
|
553
|
-
input: ListInputSchema,
|
|
554
|
-
output: ListOutputSchema,
|
|
555
|
-
transports: ["AGENT"],
|
|
556
|
-
handler: async ({ input }) => {
|
|
557
|
-
const root = await realpath3(config.root);
|
|
558
|
-
const relative = input.path === "." ? "." : boundedCodingRelativePath(root, input.path, limits.maxPathBytes);
|
|
559
|
-
await authorizeCodingPathChain(config, relative);
|
|
560
|
-
await authorizeCodingTool(config, { operation: "list", path: relative });
|
|
561
|
-
const listing = await listContainedDirectory(root, relative, limits.maxListEntries, (candidate) => isCodingPathAuthorized(config, candidate)).catch((error) => {
|
|
562
|
-
if (error instanceof Error && error.message.includes("ancestor is not a directory")) {
|
|
563
|
-
codingPathRefusal("BAD_REQUEST", "This path is not a directory", relative, {
|
|
564
|
-
hint: "Pass a directory; use read_file for a file."
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
if (error.code === "ENOENT") {
|
|
568
|
-
codingPathRefusal("NOT_FOUND", "This directory does not exist", relative, {
|
|
569
|
-
hint: "List a parent directory to see what is there."
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
return refuseMissingCodingPath(error, relative);
|
|
573
|
-
});
|
|
574
|
-
return {
|
|
575
|
-
path: relative,
|
|
576
|
-
entries: listing.entries.map((entry) => ({
|
|
577
|
-
...entry,
|
|
578
|
-
...entry.kind === "directory" && excluded.has(entry.name) && { excluded: true }
|
|
579
|
-
})),
|
|
580
|
-
truncated: listing.truncated,
|
|
581
|
-
...listing.denied.length > 0 && {
|
|
582
|
-
denied: listing.denied.map((entry) => ({
|
|
583
|
-
path: relative === "." ? entry.name : path2.join(relative, entry.name),
|
|
584
|
-
kind: entry.kind
|
|
585
|
-
})),
|
|
586
|
-
deniedTruncated: listing.deniedTruncated
|
|
587
|
-
}
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
});
|
|
591
|
-
const glob = defineRuntimeTool({
|
|
592
|
-
name: "glob",
|
|
593
|
-
description: "List workspace files matching a `**`/`*`/`?` pattern.",
|
|
594
|
-
identity: { serviceName: "coding", action: "glob", method: "POST" },
|
|
595
|
-
input: GlobInputSchema,
|
|
596
|
-
output: GlobOutputSchema,
|
|
597
|
-
transports: ["AGENT"],
|
|
598
|
-
handler: async ({ input }) => {
|
|
599
|
-
const root = await realpath3(config.root);
|
|
600
|
-
const relative = input.path === "." ? "." : boundedCodingRelativePath(root, input.path, limits.maxPathBytes);
|
|
601
|
-
await authorizeCodingPathChain(config, relative);
|
|
602
|
-
await authorizeCodingTool(config, {
|
|
603
|
-
operation: "glob",
|
|
604
|
-
pattern: input.pattern,
|
|
605
|
-
path: relative
|
|
606
|
-
});
|
|
607
|
-
let matcher;
|
|
608
|
-
try {
|
|
609
|
-
matcher = compileWorkspaceGlob(input.pattern);
|
|
610
|
-
} catch {
|
|
611
|
-
codingRefusal("BAD_REQUEST", "This glob pattern could not be compiled", {
|
|
612
|
-
details: { pattern: input.pattern },
|
|
613
|
-
hint: "Use only `**`, `*` and `?`."
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
const scan = await scanContainedFiles({
|
|
617
|
-
root,
|
|
618
|
-
maxDepth: limits.maxSearchDepth,
|
|
619
|
-
maxFiles: limits.maxSearchFiles,
|
|
620
|
-
symlinks: "skip",
|
|
621
|
-
excludeDirectory: (directory) => directory.split(path2.sep).some((segment) => excluded.has(segment)),
|
|
622
|
-
authorizePath: (candidate) => isCodingPathAuthorized(config, candidate)
|
|
623
|
-
});
|
|
624
|
-
const prefix = relative === "." ? "" : `${relative}${path2.sep}`;
|
|
625
|
-
const matched = scan.files.filter((file) => file.relative.startsWith(prefix)).map((file) => file.relative).filter((candidate) => matcher.test(candidate.slice(prefix.length))).sort();
|
|
626
|
-
const paths = matched.slice(0, limits.maxSearchResults);
|
|
627
|
-
const scopedDenied = scan.denied.filter((entry) => entry.relative.startsWith(prefix));
|
|
628
|
-
const denied = scopedDenied.slice(0, limits.maxSearchResults).map((entry) => ({
|
|
629
|
-
path: entry.relative,
|
|
630
|
-
kind: entry.kind
|
|
631
|
-
}));
|
|
632
|
-
return {
|
|
633
|
-
paths,
|
|
634
|
-
truncated: scan.truncated,
|
|
635
|
-
resultTruncated: matched.length > paths.length,
|
|
636
|
-
skippedDirectories: scan.skippedDirectories,
|
|
637
|
-
scannedFiles: scan.files.length,
|
|
638
|
-
...denied.length > 0 && {
|
|
639
|
-
denied,
|
|
640
|
-
deniedTruncated: scan.deniedTruncated || scopedDenied.length > denied.length
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
|
-
});
|
|
645
|
-
return [list, glob];
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
// src/agent-runtime/coding-tool-search-patch.ts
|
|
649
|
-
import { createHash as createHash2 } from "node:crypto";
|
|
650
|
-
import { realpath as realpath4 } from "node:fs/promises";
|
|
651
|
-
import path3 from "node:path";
|
|
652
|
-
import { z as z3 } from "zod";
|
|
653
|
-
var SearchInputSchema = z3.object({
|
|
654
|
-
query: z3.string().min(1),
|
|
655
|
-
mode: z3.enum(["path", "content"]).default("content"),
|
|
656
|
-
regex: z3.boolean().default(false),
|
|
657
|
-
context: z3.int().nonnegative().max(10).default(0),
|
|
658
|
-
include: z3.string().min(1).describe("Anchored `**`/`*`/`?` pattern matched against the whole workspace-relative path. `*` does not cross `/`; use `**/` to include matching files in subdirectories.").optional()
|
|
659
|
-
}).strict();
|
|
660
|
-
var SearchOutputSchema = z3.object({
|
|
661
|
-
matches: z3.array(z3.object({
|
|
662
|
-
path: z3.string().min(1),
|
|
663
|
-
line: z3.int().positive().optional(),
|
|
664
|
-
text: z3.string().optional(),
|
|
665
|
-
before: z3.array(z3.string()).optional(),
|
|
666
|
-
after: z3.array(z3.string()).optional()
|
|
667
|
-
}).strict()),
|
|
668
|
-
truncated: z3.boolean(),
|
|
669
|
-
scannedFiles: z3.int().nonnegative().describe("Files admitted by include and host authorization that reached path or content comparison."),
|
|
670
|
-
skippedDirectories: z3.int().nonnegative(),
|
|
671
|
-
skippedSymlinks: z3.int().nonnegative(),
|
|
672
|
-
denied: z3.array(CodingDeniedEntrySchema).optional(),
|
|
673
|
-
deniedTruncated: z3.boolean().optional(),
|
|
674
|
-
hint: z3.string().min(1).optional()
|
|
675
|
-
}).strict();
|
|
676
|
-
function compileSearchRegex(pattern) {
|
|
677
|
-
if (/\\[1-9]/.test(pattern) || /\(\?<?[=!]/.test(pattern)) {
|
|
678
|
-
codingRefusal("BAD_REQUEST", "This pattern uses a construct search does not allow", {
|
|
679
|
-
details: { pattern },
|
|
680
|
-
hint: "Backreferences and lookaround are refused because they cannot be bounded. Rewrite without them."
|
|
681
|
-
});
|
|
682
|
-
}
|
|
683
|
-
try {
|
|
684
|
-
return new RegExp(pattern);
|
|
685
|
-
} catch (error) {
|
|
686
|
-
codingRefusal("BAD_REQUEST", "This pattern is not a valid regular expression", {
|
|
687
|
-
details: { pattern, reason: error instanceof Error ? error.message : "unknown" },
|
|
688
|
-
hint: "Fix the expression, or pass regex: false to search for it literally."
|
|
689
|
-
});
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
var MAX_SEARCHED_LINE_BYTES = 8192;
|
|
693
|
-
var EditInputSchema = z3.object({
|
|
694
|
-
path: z3.string().min(1),
|
|
695
|
-
oldText: z3.string().min(1),
|
|
696
|
-
newText: z3.string(),
|
|
697
|
-
replaceAll: z3.boolean().default(false),
|
|
698
|
-
expectedSha256: z3.string().length(64).optional(),
|
|
699
|
-
dryRun: z3.boolean().default(false)
|
|
700
|
-
}).strict();
|
|
701
|
-
var EditOutputSchema = z3.object({
|
|
702
|
-
path: z3.string().min(1),
|
|
703
|
-
baseSha256: z3.string().length(64),
|
|
704
|
-
sha256: z3.string().length(64),
|
|
705
|
-
replacements: z3.int().positive(),
|
|
706
|
-
bytes: z3.int().nonnegative(),
|
|
707
|
-
applied: z3.boolean()
|
|
708
|
-
}).strict();
|
|
709
|
-
function sha256(value) {
|
|
710
|
-
return createHash2("sha256").update(value).digest("hex");
|
|
711
|
-
}
|
|
712
|
-
function createSearchAndPatchCodingTools(config, limits) {
|
|
713
|
-
const search = defineRuntimeTool({
|
|
714
|
-
name: "search_files",
|
|
715
|
-
description: "Search bounded relative paths or UTF-8 file content under the workspace root.",
|
|
716
|
-
identity: { serviceName: "coding", action: "search", method: "POST" },
|
|
717
|
-
input: SearchInputSchema,
|
|
718
|
-
output: SearchOutputSchema,
|
|
719
|
-
transports: ["AGENT"],
|
|
720
|
-
handler: async ({ input }) => {
|
|
721
|
-
await authorizeCodingTool(config, {
|
|
722
|
-
operation: "search",
|
|
723
|
-
query: input.query,
|
|
724
|
-
mode: input.mode
|
|
725
|
-
});
|
|
726
|
-
const root = await realpath4(config.root);
|
|
727
|
-
await authorizeCodingPath(config, ".");
|
|
728
|
-
const excluded = new Set(config.search?.excludeDirectories ?? DEFAULT_EXCLUDED_DIRECTORIES);
|
|
729
|
-
const included = input.include ? compileWorkspaceGlob(input.include) : null;
|
|
730
|
-
let rejectedByInclude = 0;
|
|
731
|
-
const scan = await scanContainedFiles({
|
|
732
|
-
root,
|
|
733
|
-
maxDepth: limits.maxSearchDepth,
|
|
734
|
-
maxFiles: limits.maxSearchFiles,
|
|
735
|
-
symlinks: "skip",
|
|
736
|
-
...input.mode === "content" && {
|
|
737
|
-
readMaxBytes: limits.maxReadBytes,
|
|
738
|
-
skipUnreadable: true
|
|
739
|
-
},
|
|
740
|
-
excludeDirectory: (relative) => relative.split(path3.sep).some((segment) => excluded.has(segment)),
|
|
741
|
-
includeFile: (candidate) => {
|
|
742
|
-
if (included && !included.test(candidate)) {
|
|
743
|
-
rejectedByInclude += 1;
|
|
744
|
-
return false;
|
|
745
|
-
}
|
|
746
|
-
return true;
|
|
747
|
-
},
|
|
748
|
-
authorizePath: (candidate) => isCodingPathAuthorized(config, candidate)
|
|
749
|
-
});
|
|
750
|
-
const matcher = input.regex ? compileSearchRegex(input.query) : null;
|
|
751
|
-
const hit = (line) => {
|
|
752
|
-
if (line.length > MAX_SEARCHED_LINE_BYTES)
|
|
753
|
-
return false;
|
|
754
|
-
if (matcher) {
|
|
755
|
-
matcher.lastIndex = 0;
|
|
756
|
-
return matcher.test(line);
|
|
757
|
-
}
|
|
758
|
-
return line.includes(input.query);
|
|
759
|
-
};
|
|
760
|
-
const matches = [];
|
|
761
|
-
let truncated = false;
|
|
762
|
-
for (const file of scan.files) {
|
|
763
|
-
if (input.mode === "path") {
|
|
764
|
-
if (hit(file.relative))
|
|
765
|
-
matches.push({ path: file.relative });
|
|
766
|
-
} else {
|
|
767
|
-
const text = file.content?.text;
|
|
768
|
-
if (text === undefined)
|
|
769
|
-
continue;
|
|
770
|
-
const lines = text.split(`
|
|
771
|
-
`);
|
|
772
|
-
for (let index = 0;index < lines.length; index += 1) {
|
|
773
|
-
const line = lines[index];
|
|
774
|
-
if (line === undefined || !hit(line))
|
|
775
|
-
continue;
|
|
776
|
-
matches.push({
|
|
777
|
-
path: file.relative,
|
|
778
|
-
line: index + 1,
|
|
779
|
-
text: line,
|
|
780
|
-
...input.context > 0 && {
|
|
781
|
-
before: lines.slice(Math.max(0, index - input.context), index),
|
|
782
|
-
after: lines.slice(index + 1, index + 1 + input.context)
|
|
783
|
-
}
|
|
784
|
-
});
|
|
785
|
-
if (matches.length >= limits.maxSearchResults)
|
|
786
|
-
break;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
if (matches.length >= limits.maxSearchResults) {
|
|
790
|
-
truncated = true;
|
|
791
|
-
break;
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
return {
|
|
795
|
-
matches,
|
|
796
|
-
truncated: truncated || scan.truncated,
|
|
797
|
-
scannedFiles: scan.files.length,
|
|
798
|
-
skippedDirectories: scan.skippedDirectories,
|
|
799
|
-
skippedSymlinks: scan.skippedSymlinks,
|
|
800
|
-
...scan.denied.length > 0 && {
|
|
801
|
-
denied: scan.denied.slice(0, limits.maxSearchResults).map(({ relative, kind }) => ({ path: relative, kind })),
|
|
802
|
-
deniedTruncated: scan.deniedTruncated || scan.denied.length > limits.maxSearchResults
|
|
803
|
-
},
|
|
804
|
-
...input.include && scan.files.length === 0 && rejectedByInclude > 0 && {
|
|
805
|
-
hint: `The anchored include pattern \`${input.include}\` rejected all ${rejectedByInclude} ${rejectedByInclude === 1 ? "file" : "files"} the scan reached. \`*\` does not cross \`/\`; use a pattern such as \`**/*.ts\` for matching files in subdirectories.`
|
|
806
|
-
}
|
|
807
|
-
};
|
|
808
|
-
}
|
|
809
|
-
});
|
|
810
|
-
const edit = defineRuntimeTool({
|
|
811
|
-
name: "edit_file",
|
|
812
|
-
description: "Replace an exact snippet in one workspace file.",
|
|
813
|
-
identity: { serviceName: "coding", action: "edit-file", method: "POST" },
|
|
814
|
-
input: EditInputSchema,
|
|
815
|
-
output: EditOutputSchema,
|
|
816
|
-
transports: ["AGENT"],
|
|
817
|
-
handler: async ({ input }) => {
|
|
818
|
-
const root = await realpath4(config.root);
|
|
819
|
-
const relative = boundedCodingRelativePath(root, input.path, limits.maxPathBytes);
|
|
820
|
-
await authorizeCodingPathChain(config, relative);
|
|
821
|
-
const parent = await openContainedParent(root, relative).catch((error) => refuseMissingCodingPath(error, relative));
|
|
822
|
-
try {
|
|
823
|
-
return await withCodingPathLock(`${root}:${relative}`, async () => {
|
|
824
|
-
const handle = await openContainedParentFile(parent).catch((error) => refuseMissingCodingPath(error, relative));
|
|
825
|
-
const read = await readContainedUtf8Handle(handle, limits.maxWriteBytes).finally(() => handle.close());
|
|
826
|
-
const source = read.text;
|
|
827
|
-
const baseSha256 = sha256(source);
|
|
828
|
-
if (input.expectedSha256 !== undefined && baseSha256 !== input.expectedSha256) {
|
|
829
|
-
conflict("The file changed since it was read", {
|
|
830
|
-
message: "The file changed since it was read",
|
|
831
|
-
path: relative,
|
|
832
|
-
expectedSha256: input.expectedSha256,
|
|
833
|
-
actualSha256: baseSha256
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
const count = textOccurrences(source, input.oldText);
|
|
837
|
-
if (count === 0) {
|
|
838
|
-
codingPathRefusal("NOT_FOUND", "oldText does not appear in this file", relative, {
|
|
839
|
-
details: { occurrences: 0 },
|
|
840
|
-
hint: "Read the file and copy the snippet exactly, including indentation."
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
if (!input.replaceAll && count !== 1) {
|
|
844
|
-
codingPathRefusal("CONFLICT", `oldText appears ${count} times, so the edit is ambiguous`, relative, {
|
|
845
|
-
details: { occurrences: count },
|
|
846
|
-
hint: "Lengthen the snippet until it is unique, or pass replaceAll: true."
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
const replacements = input.replaceAll ? count : 1;
|
|
850
|
-
const changed = input.replaceAll ? source.replaceAll(input.oldText, input.newText) : source.replace(input.oldText, () => input.newText);
|
|
851
|
-
const bytes = Buffer.byteLength(changed);
|
|
852
|
-
const resultSha256 = sha256(changed);
|
|
853
|
-
if (bytes > limits.maxWriteBytes) {
|
|
854
|
-
codingPathRefusal("BAD_REQUEST", `The result would be ${bytes} bytes, over the ${limits.maxWriteBytes}-byte limit`, relative, {
|
|
855
|
-
details: { bytes, maxWriteBytes: limits.maxWriteBytes },
|
|
856
|
-
hint: "Make a smaller edit, or split the file."
|
|
857
|
-
});
|
|
858
|
-
}
|
|
859
|
-
await authorizeCodingTool(config, {
|
|
860
|
-
operation: "edit",
|
|
861
|
-
path: relative,
|
|
862
|
-
baseSha256,
|
|
863
|
-
resultSha256,
|
|
864
|
-
resultBytes: bytes,
|
|
865
|
-
replacements,
|
|
866
|
-
dryRun: input.dryRun
|
|
867
|
-
});
|
|
868
|
-
await assertContainedParentCurrent(root, relative, parent.handle);
|
|
869
|
-
if (!input.dryRun) {
|
|
870
|
-
await writeContainedFile({
|
|
871
|
-
parent,
|
|
872
|
-
content: changed,
|
|
873
|
-
replace: true,
|
|
874
|
-
mode: read.mode
|
|
875
|
-
});
|
|
876
|
-
}
|
|
877
|
-
return {
|
|
878
|
-
path: relative,
|
|
879
|
-
baseSha256,
|
|
880
|
-
sha256: resultSha256,
|
|
881
|
-
replacements,
|
|
882
|
-
bytes,
|
|
883
|
-
applied: !input.dryRun
|
|
884
|
-
};
|
|
885
|
-
});
|
|
886
|
-
} finally {
|
|
887
|
-
await parent.handle.close();
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
});
|
|
891
|
-
return [search, edit];
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
// src/agent-runtime/coding-tool-shell.ts
|
|
895
|
-
import { realpath as realpath5, stat } from "node:fs/promises";
|
|
896
|
-
|
|
897
|
-
// src/agent-runtime/coding-shell-process.ts
|
|
898
|
-
import { spawn } from "node:child_process";
|
|
899
|
-
async function runCodingShell(input) {
|
|
900
|
-
const preview = (data, budget) => {
|
|
901
|
-
if (data.byteLength <= budget) {
|
|
902
|
-
return { data, headBytes: data.byteLength, tailBytes: 0, omittedBytes: 0 };
|
|
903
|
-
}
|
|
904
|
-
const headEnd = utf8AlignedEnd(data, 0, Math.ceil(budget / 2));
|
|
905
|
-
const tailStart = Math.max(headEnd, utf8AlignedStart(data, data.byteLength - Math.floor(budget / 2), data.byteLength));
|
|
906
|
-
const tailBytes = data.byteLength - tailStart;
|
|
907
|
-
return {
|
|
908
|
-
data: Buffer.concat([data.subarray(0, headEnd), data.subarray(tailStart)]),
|
|
909
|
-
headBytes: headEnd,
|
|
910
|
-
tailBytes,
|
|
911
|
-
omittedBytes: data.byteLength - headEnd - tailBytes
|
|
912
|
-
};
|
|
913
|
-
};
|
|
914
|
-
const retainedPreview = (data) => {
|
|
915
|
-
const end = utf8AlignedEnd(data, 0, data.byteLength);
|
|
916
|
-
return {
|
|
917
|
-
data: data.subarray(0, end),
|
|
918
|
-
headBytes: end,
|
|
919
|
-
tailBytes: 0,
|
|
920
|
-
omittedBytes: data.byteLength - end
|
|
921
|
-
};
|
|
922
|
-
};
|
|
923
|
-
const stdoutHeader = Buffer.from(`--- stdout ---
|
|
924
|
-
`);
|
|
925
|
-
const stderrHeader = Buffer.from(`
|
|
926
|
-
--- stderr ---
|
|
927
|
-
`);
|
|
928
|
-
const artifactPayloadLimit = input.maxArtifactBytes - stdoutHeader.byteLength - stderrHeader.byteLength;
|
|
929
|
-
if (input.artifacts && artifactPayloadLimit < 0)
|
|
930
|
-
throw new Error("maxArtifactBytes is smaller than the shell artifact envelope");
|
|
931
|
-
if (input.signal?.aborted) {
|
|
932
|
-
return ShellOutputSchema.parse({
|
|
933
|
-
executable: input.executableName,
|
|
934
|
-
exitCode: null,
|
|
935
|
-
signal: null,
|
|
936
|
-
stdout: "",
|
|
937
|
-
stderr: "",
|
|
938
|
-
outcome: "cancelled"
|
|
939
|
-
});
|
|
940
|
-
}
|
|
941
|
-
return await new Promise((resolve, reject) => {
|
|
942
|
-
const ownsProcessGroup = process.platform !== "win32";
|
|
943
|
-
const child = input.spawn ? input.spawn() : spawn(input.executable, input.args, {
|
|
944
|
-
cwd: input.cwd,
|
|
945
|
-
env: input.environment,
|
|
946
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
947
|
-
detached: ownsProcessGroup
|
|
948
|
-
});
|
|
949
|
-
const stdout = [];
|
|
950
|
-
const stderr = [];
|
|
951
|
-
const artifactStdout = [];
|
|
952
|
-
const artifactStderr = [];
|
|
953
|
-
let retained = 0;
|
|
954
|
-
let artifactBytes = 0;
|
|
955
|
-
let outcome = "exited";
|
|
956
|
-
let settled = false;
|
|
957
|
-
let settlementTimer;
|
|
958
|
-
const cancel = () => terminate("cancelled");
|
|
959
|
-
const cleanup = () => {
|
|
960
|
-
clearTimeout(timer);
|
|
961
|
-
if (settlementTimer)
|
|
962
|
-
clearTimeout(settlementTimer);
|
|
963
|
-
input.signal?.removeEventListener("abort", cancel);
|
|
964
|
-
};
|
|
965
|
-
const persistAndResolve = async (exitCode, signal) => {
|
|
966
|
-
if (settled)
|
|
967
|
-
return;
|
|
968
|
-
settled = true;
|
|
969
|
-
cleanup();
|
|
970
|
-
try {
|
|
971
|
-
const hasArtifact = input.artifacts && artifactBytes > input.maxOutputBytes;
|
|
972
|
-
const completeStdout = Buffer.concat(artifactStdout);
|
|
973
|
-
const completeStderr = Buffer.concat(artifactStderr);
|
|
974
|
-
const artifactData = hasArtifact ? Buffer.concat([stdoutHeader, completeStdout, stderrHeader, completeStderr]) : undefined;
|
|
975
|
-
const stdoutBudget = completeStderr.byteLength === 0 ? input.maxOutputBytes : Math.ceil(input.maxOutputBytes / 2);
|
|
976
|
-
const stderrBudget = completeStdout.byteLength === 0 ? input.maxOutputBytes : Math.floor(input.maxOutputBytes / 2);
|
|
977
|
-
const stdoutPreview = hasArtifact ? preview(completeStdout, stdoutBudget) : retainedPreview(Buffer.concat(stdout));
|
|
978
|
-
const stderrPreview = hasArtifact ? preview(completeStderr, stderrBudget) : retainedPreview(Buffer.concat(stderr));
|
|
979
|
-
const persisted = hasArtifact ? await input.artifacts?.write({
|
|
980
|
-
mediaType: "text/plain; charset=utf-8",
|
|
981
|
-
data: artifactData ?? new Uint8Array,
|
|
982
|
-
...input.authorization && { authorization: input.authorization }
|
|
983
|
-
}) : undefined;
|
|
984
|
-
resolve(ShellOutputSchema.parse({
|
|
985
|
-
executable: input.executableName,
|
|
986
|
-
exitCode,
|
|
987
|
-
signal,
|
|
988
|
-
stdout: stdoutPreview.data.toString("utf8"),
|
|
989
|
-
stderr: stderrPreview.data.toString("utf8"),
|
|
990
|
-
outcome,
|
|
991
|
-
...persisted && {
|
|
992
|
-
artifact: {
|
|
993
|
-
reference: persisted.reference,
|
|
994
|
-
bytes: artifactData?.byteLength ?? 0,
|
|
995
|
-
truncated: outcome === "output-limit",
|
|
996
|
-
headBytes: stdoutPreview.headBytes + stderrPreview.headBytes,
|
|
997
|
-
tailBytes: stdoutPreview.tailBytes + stderrPreview.tailBytes,
|
|
998
|
-
omittedBytes: stdoutPreview.omittedBytes + stderrPreview.omittedBytes
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
}));
|
|
1002
|
-
} catch (error) {
|
|
1003
|
-
reject(error);
|
|
1004
|
-
}
|
|
1005
|
-
};
|
|
1006
|
-
const killOwnedProcessGroup = () => {
|
|
1007
|
-
if (!ownsProcessGroup || child.pid === undefined)
|
|
1008
|
-
return false;
|
|
1009
|
-
try {
|
|
1010
|
-
process.kill(-child.pid, "SIGKILL");
|
|
1011
|
-
return true;
|
|
1012
|
-
} catch {
|
|
1013
|
-
return false;
|
|
1014
|
-
}
|
|
1015
|
-
};
|
|
1016
|
-
const boundStreamSettlement = () => {
|
|
1017
|
-
if (settlementTimer)
|
|
1018
|
-
return;
|
|
1019
|
-
settlementTimer = setTimeout(() => {
|
|
1020
|
-
child.stdout.destroy();
|
|
1021
|
-
child.stderr.destroy();
|
|
1022
|
-
persistAndResolve(child.exitCode, child.signalCode);
|
|
1023
|
-
}, input.terminationGraceMs);
|
|
1024
|
-
};
|
|
1025
|
-
const terminate = (reason) => {
|
|
1026
|
-
if (settled || outcome !== "exited")
|
|
1027
|
-
return;
|
|
1028
|
-
outcome = reason;
|
|
1029
|
-
if (!killOwnedProcessGroup())
|
|
1030
|
-
child.kill("SIGKILL");
|
|
1031
|
-
boundStreamSettlement();
|
|
1032
|
-
};
|
|
1033
|
-
const timer = setTimeout(() => terminate("timeout"), input.timeoutMs);
|
|
1034
|
-
timer.unref();
|
|
1035
|
-
const retain = (target, artifactTarget, chunk) => {
|
|
1036
|
-
const remaining = Math.max(0, input.maxOutputBytes - retained);
|
|
1037
|
-
if (remaining > 0) {
|
|
1038
|
-
const kept = chunk.subarray(0, remaining);
|
|
1039
|
-
target.push(kept);
|
|
1040
|
-
retained += kept.byteLength;
|
|
1041
|
-
}
|
|
1042
|
-
if (input.artifacts) {
|
|
1043
|
-
const artifactRemaining = Math.max(0, artifactPayloadLimit - artifactBytes);
|
|
1044
|
-
if (artifactRemaining > 0) {
|
|
1045
|
-
const kept = chunk.subarray(0, artifactRemaining);
|
|
1046
|
-
artifactTarget.push(kept);
|
|
1047
|
-
artifactBytes += kept.byteLength;
|
|
1048
|
-
}
|
|
1049
|
-
if (chunk.byteLength > artifactRemaining)
|
|
1050
|
-
terminate("output-limit");
|
|
1051
|
-
} else if (chunk.byteLength > remaining)
|
|
1052
|
-
terminate("output-limit");
|
|
1053
|
-
};
|
|
1054
|
-
child.stdout.on("data", (chunk) => retain(stdout, artifactStdout, Buffer.from(chunk)));
|
|
1055
|
-
child.stderr.on("data", (chunk) => retain(stderr, artifactStderr, Buffer.from(chunk)));
|
|
1056
|
-
child.on("error", (error) => {
|
|
1057
|
-
if (settled)
|
|
1058
|
-
return;
|
|
1059
|
-
settled = true;
|
|
1060
|
-
cleanup();
|
|
1061
|
-
reject(error);
|
|
1062
|
-
});
|
|
1063
|
-
child.on("exit", (exitCode, signal) => {
|
|
1064
|
-
if (outcome === "exited")
|
|
1065
|
-
killOwnedProcessGroup();
|
|
1066
|
-
boundStreamSettlement();
|
|
1067
|
-
if (child.stdout.destroyed && child.stderr.destroyed) {
|
|
1068
|
-
persistAndResolve(exitCode, signal);
|
|
1069
|
-
}
|
|
1070
|
-
});
|
|
1071
|
-
child.on("close", (exitCode, signal) => void persistAndResolve(exitCode, signal));
|
|
1072
|
-
input.signal?.addEventListener("abort", cancel, { once: true });
|
|
1073
|
-
if (input.signal?.aborted)
|
|
1074
|
-
cancel();
|
|
1075
|
-
});
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
// src/agent-runtime/coding-tool-shell.ts
|
|
1079
|
-
function createShellCodingTool(config, limits) {
|
|
1080
|
-
const executables = config.executables ?? {};
|
|
1081
|
-
const executableNames = Object.keys(executables).sort();
|
|
1082
|
-
return defineRuntimeTool({
|
|
1083
|
-
name: "run_command",
|
|
1084
|
-
description: "Run a finite host-declared executable with bounded arguments, time and output.",
|
|
1085
|
-
identity: { serviceName: "coding", action: "shell", method: "POST" },
|
|
1086
|
-
input: createShellInputSchema(executableNames),
|
|
1087
|
-
output: ShellOutputSchema,
|
|
1088
|
-
transports: ["AGENT"],
|
|
1089
|
-
handler: async ({ input, signal }) => {
|
|
1090
|
-
if (input.args.length > limits.maxShellArguments) {
|
|
1091
|
-
throw new Error("Coding tool shell arguments exceed maxShellArguments");
|
|
1092
|
-
}
|
|
1093
|
-
const argumentBytes = input.args.reduce((total, argument) => total + Buffer.byteLength(argument), 0);
|
|
1094
|
-
if (argumentBytes > limits.maxShellArgumentBytes) {
|
|
1095
|
-
throw new Error("Coding tool shell arguments exceed maxShellArgumentBytes");
|
|
1096
|
-
}
|
|
1097
|
-
const executable = executables[input.executable];
|
|
1098
|
-
if (!executable)
|
|
1099
|
-
throw new Error("Coding tool executable is not declared");
|
|
1100
|
-
const root = await realpath5(config.root);
|
|
1101
|
-
const cwd = await existingCodingPath(root, input.cwd === "." ? "." : boundedCodingRelativePath(root, input.cwd, limits.maxPathBytes), limits.maxPathBytes);
|
|
1102
|
-
if (!(await stat(cwd.absolute)).isDirectory()) {
|
|
1103
|
-
throw new Error("Coding tool cwd is not a directory");
|
|
1104
|
-
}
|
|
1105
|
-
const shellAuthorization = {
|
|
1106
|
-
operation: "shell",
|
|
1107
|
-
executable: input.executable,
|
|
1108
|
-
args: input.args,
|
|
1109
|
-
cwd: cwd.relative
|
|
1110
|
-
};
|
|
1111
|
-
await authorizeCodingTool(config, shellAuthorization);
|
|
1112
|
-
let executablePath = executable;
|
|
1113
|
-
let executableArgs = input.args;
|
|
1114
|
-
let environment = config.environment ?? {};
|
|
1115
|
-
if (config.sandbox) {
|
|
1116
|
-
const grade = await probeAgentProcessSandbox(config.sandbox.adapter);
|
|
1117
|
-
if (grade.grade === "unavailable") {
|
|
1118
|
-
codingRefusal("SANDBOX_UNAVAILABLE", "The configured process sandbox is unavailable", {
|
|
1119
|
-
details: { reason: grade.reason }
|
|
1120
|
-
});
|
|
1121
|
-
}
|
|
1122
|
-
const missing = missingSandboxRestrictions(grade, config.sandbox.required);
|
|
1123
|
-
if (missing.length > 0) {
|
|
1124
|
-
codingRefusal("SANDBOX_INSUFFICIENT", "The process sandbox lacks required restrictions", {
|
|
1125
|
-
details: { missing, grade: grade.grade }
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
try {
|
|
1129
|
-
const prepared = await config.sandbox.adapter.prepare({
|
|
1130
|
-
required: config.sandbox.required,
|
|
1131
|
-
executable,
|
|
1132
|
-
args: input.args,
|
|
1133
|
-
cwd: cwd.absolute,
|
|
1134
|
-
environment
|
|
1135
|
-
});
|
|
1136
|
-
executablePath = prepared.executable;
|
|
1137
|
-
executableArgs = [...prepared.args];
|
|
1138
|
-
environment = prepared.environment ?? environment;
|
|
1139
|
-
} catch (error) {
|
|
1140
|
-
const refreshed = await probeAgentProcessSandbox(config.sandbox.adapter, {
|
|
1141
|
-
refresh: true
|
|
1142
|
-
});
|
|
1143
|
-
codingRefusal("SANDBOX_UNAVAILABLE", "The process sandbox failed while preparing a command", {
|
|
1144
|
-
details: {
|
|
1145
|
-
grade: refreshed.grade,
|
|
1146
|
-
reason: error instanceof Error ? error.message : "unknown sandbox error"
|
|
1147
|
-
}
|
|
1148
|
-
});
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
return runCodingShell({
|
|
1152
|
-
...config.sandbox?.adapter.spawn && {
|
|
1153
|
-
spawn: () => {
|
|
1154
|
-
const adapter = config.sandbox?.adapter;
|
|
1155
|
-
if (!adapter?.spawn)
|
|
1156
|
-
throw new Error("Sandbox launcher is unavailable");
|
|
1157
|
-
return adapter.spawn({
|
|
1158
|
-
executable: executablePath,
|
|
1159
|
-
args: executableArgs,
|
|
1160
|
-
cwd: cwd.absolute,
|
|
1161
|
-
environment
|
|
1162
|
-
});
|
|
1163
|
-
}
|
|
1164
|
-
},
|
|
1165
|
-
executableName: input.executable,
|
|
1166
|
-
executable: executablePath,
|
|
1167
|
-
args: executableArgs,
|
|
1168
|
-
cwd: cwd.absolute,
|
|
1169
|
-
environment,
|
|
1170
|
-
...signal && { signal },
|
|
1171
|
-
timeoutMs: limits.shellTimeoutMs,
|
|
1172
|
-
terminationGraceMs: limits.shellTerminationGraceMs,
|
|
1173
|
-
maxOutputBytes: limits.maxShellOutputBytes,
|
|
1174
|
-
maxArtifactBytes: limits.maxArtifactBytes,
|
|
1175
|
-
...config.artifacts && { artifacts: config.artifacts },
|
|
1176
|
-
authorization: shellAuthorization
|
|
1177
|
-
});
|
|
1178
|
-
}
|
|
1179
|
-
});
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
// src/agent-runtime/coding-tools.ts
|
|
1183
|
-
var AGENT_CODING_TOOL_NAMES = {
|
|
1184
|
-
editFile: "edit_file",
|
|
1185
|
-
glob: "glob",
|
|
1186
|
-
listDirectory: "list_directory",
|
|
1187
|
-
readFile: "read_file",
|
|
1188
|
-
readOutput: "read_output",
|
|
1189
|
-
searchOutput: "search_output",
|
|
1190
|
-
runCommand: "run_command",
|
|
1191
|
-
searchFiles: "search_files",
|
|
1192
|
-
writeFile: "write_file"
|
|
1193
|
-
};
|
|
1194
|
-
function createAgentCodingTools(config) {
|
|
1195
|
-
if (!path4.isAbsolute(config.root))
|
|
1196
|
-
throw new Error("Coding tool root must be absolute");
|
|
1197
|
-
for (const executable of Object.values(config.executables ?? {})) {
|
|
1198
|
-
if (!path4.isAbsolute(executable)) {
|
|
1199
|
-
throw new Error("Coding tool executables must be absolute paths");
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
const limits = resolveCodingToolLimits(config.limits);
|
|
1203
|
-
const artifactTools = [];
|
|
1204
|
-
if (config.artifacts) {
|
|
1205
|
-
const artifacts = config.artifacts;
|
|
1206
|
-
artifactTools.push(defineRuntimeTool({
|
|
1207
|
-
name: AGENT_CODING_TOOL_NAMES.readOutput,
|
|
1208
|
-
description: "Read a bounded byte slice from one opaque coding output artifact.",
|
|
1209
|
-
identity: { serviceName: "coding", action: "read-artifact", method: "POST" },
|
|
1210
|
-
input: z4.object({
|
|
1211
|
-
reference: z4.string().min(1),
|
|
1212
|
-
offset: z4.int().nonnegative().default(0),
|
|
1213
|
-
maxBytes: z4.int().positive().optional()
|
|
1214
|
-
}).strict(),
|
|
1215
|
-
output: z4.object({
|
|
1216
|
-
reference: z4.string().min(1),
|
|
1217
|
-
offset: z4.int().nonnegative(),
|
|
1218
|
-
text: z4.string(),
|
|
1219
|
-
bytes: z4.int().nonnegative(),
|
|
1220
|
-
totalBytes: z4.int().nonnegative().optional()
|
|
1221
|
-
}).strict(),
|
|
1222
|
-
transports: ["AGENT"],
|
|
1223
|
-
handler: async ({ input }) => {
|
|
1224
|
-
const maxBytes = Math.min(input.maxBytes ?? limits.maxReadBytes, limits.maxReadBytes);
|
|
1225
|
-
await authorizeCodingTool(config, {
|
|
1226
|
-
operation: "artifact-read",
|
|
1227
|
-
reference: input.reference,
|
|
1228
|
-
offset: input.offset,
|
|
1229
|
-
maxBytes
|
|
1230
|
-
});
|
|
1231
|
-
const originAuthorization = await artifacts.authorization?.(input.reference);
|
|
1232
|
-
if (originAuthorization)
|
|
1233
|
-
await authorizeCodingTool(config, originAuthorization);
|
|
1234
|
-
const result = await artifacts.read({
|
|
1235
|
-
reference: input.reference,
|
|
1236
|
-
offset: input.offset,
|
|
1237
|
-
maxBytes
|
|
1238
|
-
});
|
|
1239
|
-
if (result.data.byteLength > maxBytes)
|
|
1240
|
-
throw new Error("Coding artifact store exceeded the requested byte budget");
|
|
1241
|
-
if (result.totalBytes !== undefined && result.totalBytes < input.offset + result.data.byteLength) {
|
|
1242
|
-
throw new Error("Coding artifact store returned inconsistent totalBytes");
|
|
1243
|
-
}
|
|
1244
|
-
return {
|
|
1245
|
-
reference: input.reference,
|
|
1246
|
-
offset: input.offset,
|
|
1247
|
-
text: new TextDecoder("utf-8", { fatal: true }).decode(result.data),
|
|
1248
|
-
bytes: result.data.byteLength,
|
|
1249
|
-
...result.totalBytes !== undefined && { totalBytes: result.totalBytes }
|
|
1250
|
-
};
|
|
1251
|
-
}
|
|
1252
|
-
}));
|
|
1253
|
-
if (artifacts.search) {
|
|
1254
|
-
const search = artifacts.search;
|
|
1255
|
-
artifactTools.push(defineRuntimeTool({
|
|
1256
|
-
name: AGENT_CODING_TOOL_NAMES.searchOutput,
|
|
1257
|
-
description: "Search a durable spilled output without loading it into context.",
|
|
1258
|
-
identity: { serviceName: "coding", action: "search-artifact", method: "POST" },
|
|
1259
|
-
input: z4.object({
|
|
1260
|
-
reference: z4.string().min(1),
|
|
1261
|
-
query: z4.string().min(1),
|
|
1262
|
-
maxMatches: z4.int().positive().max(limits.maxSearchResults).default(20)
|
|
1263
|
-
}).strict(),
|
|
1264
|
-
output: z4.object({
|
|
1265
|
-
reference: z4.string(),
|
|
1266
|
-
matches: z4.array(z4.object({ line: z4.int().positive(), text: z4.string() }))
|
|
1267
|
-
}).strict(),
|
|
1268
|
-
transports: ["AGENT"],
|
|
1269
|
-
handler: async ({ input }) => {
|
|
1270
|
-
await authorizeCodingTool(config, {
|
|
1271
|
-
operation: "artifact-search",
|
|
1272
|
-
reference: input.reference,
|
|
1273
|
-
query: input.query,
|
|
1274
|
-
maxMatches: input.maxMatches
|
|
1275
|
-
});
|
|
1276
|
-
const originAuthorization = await artifacts.authorization?.(input.reference);
|
|
1277
|
-
if (originAuthorization)
|
|
1278
|
-
await authorizeCodingTool(config, originAuthorization);
|
|
1279
|
-
return {
|
|
1280
|
-
reference: input.reference,
|
|
1281
|
-
matches: [
|
|
1282
|
-
...await search({
|
|
1283
|
-
reference: input.reference,
|
|
1284
|
-
query: input.query,
|
|
1285
|
-
maxMatches: input.maxMatches
|
|
1286
|
-
})
|
|
1287
|
-
]
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
|
-
}));
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
const commandTools = Object.keys(config.executables ?? {}).length ? [createShellCodingTool(config, limits)] : [];
|
|
1294
|
-
return [
|
|
1295
|
-
...createFileCodingTools(config, limits),
|
|
1296
|
-
...createListingCodingTools(config, limits),
|
|
1297
|
-
...createSearchAndPatchCodingTools(config, limits),
|
|
1298
|
-
...commandTools,
|
|
1299
|
-
...artifactTools
|
|
1300
|
-
];
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
export { AgentCodingToolLimitsSchema, AgentCodingToolAuthorizationSchema, AgentCodingToolPathAuthorizationSchema, createAgentCodingTools };
|