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
|
@@ -0,0 +1,893 @@
|
|
|
1
|
+
# stitchkit/agent-runtime — stitchkit docs slice, part 1 of 3
|
|
2
|
+
|
|
3
|
+
> Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
|
|
4
|
+
> `llms.txt` in this package.
|
|
5
|
+
> Continues in `llms/agent-runtime.2.txt`.
|
|
6
|
+
|
|
7
|
+
Parts of this slice:
|
|
8
|
+
- `llms/agent-runtime.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
9
|
+
- `llms/agent-runtime.2.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
10
|
+
- `llms/agent-runtime.3.txt`: API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
|
|
11
|
+
|
|
12
|
+
==============================================================================
|
|
13
|
+
# Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
14
|
+
==============================================================================
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
title: "Agent application runtime"
|
|
18
|
+
description: Configure Stitchkit's optional durable history, stream loop, run coordination and managed-tool fencing.
|
|
19
|
+
type: architecture
|
|
20
|
+
status: active
|
|
21
|
+
created: 2026-08-22
|
|
22
|
+
updated: 2026-08-29
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# Agent application runtime
|
|
26
|
+
|
|
27
|
+
> **Maturity: evolving.** This surface is still finding its shape and may be
|
|
28
|
+
> redefined in any minor release — always with a `### ⚠️ Breaking changes` entry
|
|
29
|
+
> and a migration section, never silently. If your application already owns the
|
|
30
|
+
> conversation loop, `mountAgent` from `stitchkit/tools` is the stable path.
|
|
31
|
+
|
|
32
|
+
`stitchkit/agent-runtime` is the server-only, opinionated layer above
|
|
33
|
+
`mountAgent`. Use it when the application wants Stitchkit to own conversation
|
|
34
|
+
mechanics: durable acceptance, history projection, the AI SDK stream loop,
|
|
35
|
+
checkpoints, keyed interruption, terminal commit and stable application events.
|
|
36
|
+
|
|
37
|
+
If the application already owns that loop, continue importing `mountAgent` from
|
|
38
|
+
`stitchkit/tools`. `stitchkit/tools` does not depend on this entrypoint at all;
|
|
39
|
+
this entrypoint uses the tool executor from it, but pulls no MCP peer, so
|
|
40
|
+
choosing `mountAgent` alone costs you nothing from here.
|
|
41
|
+
|
|
42
|
+
UI and shared DTO code must import canonical records and delivery validation from
|
|
43
|
+
`stitchkit/agent-runtime/browser`, not from the server runtime barrel:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import {
|
|
47
|
+
AgentRunSchema,
|
|
48
|
+
AgentRuntimeEventSchema,
|
|
49
|
+
advanceAgentRuntimeEventCursor,
|
|
50
|
+
} from 'stitchkit/agent-runtime/browser'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This browser-safe entrypoint re-exports the same schemas and inferred types used
|
|
54
|
+
by the runtime. It intentionally excludes model construction, execution,
|
|
55
|
+
persistence, event sinks and every Node context dependency.
|
|
56
|
+
|
|
57
|
+
## Install
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
bun add stitchkit ai zod
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`mountAgent` from `stitchkit/tools` — used in the composition below — additionally
|
|
64
|
+
needs the MCP peer, which that entrypoint imports statically:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
bun add @modelcontextprotocol/server
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
OpenRouter is isolated so other runtime users do not resolve its package:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
bun add @openrouter/ai-sdk-provider
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Minimal composition
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { z } from 'zod'
|
|
80
|
+
import {
|
|
81
|
+
AgentContextOverflowError,
|
|
82
|
+
composeAgentPrompt,
|
|
83
|
+
createAgentRuntime,
|
|
84
|
+
createMemoryAgentRuntimeStore,
|
|
85
|
+
defineAgentProtocol,
|
|
86
|
+
defineModelRegistry,
|
|
87
|
+
} from 'stitchkit/agent-runtime'
|
|
88
|
+
import { openRouterProvider } from 'stitchkit/agent-runtime/openrouter'
|
|
89
|
+
import { composeToolLifecycle, mountAgent } from 'stitchkit/tools'
|
|
90
|
+
|
|
91
|
+
const protocol = defineAgentProtocol({
|
|
92
|
+
context: z.object({ userId: z.string() }),
|
|
93
|
+
inputMetadata: z.object({}),
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const models = defineModelRegistry({
|
|
97
|
+
providers: {
|
|
98
|
+
openrouter: openRouterProvider({ apiKey: env.OPENROUTER_API_KEY }),
|
|
99
|
+
},
|
|
100
|
+
models: {
|
|
101
|
+
fast: {
|
|
102
|
+
provider: 'openrouter',
|
|
103
|
+
modelId: 'provider/model',
|
|
104
|
+
contextWindow: 128_000,
|
|
105
|
+
capabilities: ['tools'],
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
const prompt = composeAgentPrompt<{ userId: string }>([
|
|
111
|
+
{
|
|
112
|
+
name: 'product',
|
|
113
|
+
stability: 'stable',
|
|
114
|
+
render: ({ context }) => `Help user ${context.userId}.`,
|
|
115
|
+
},
|
|
116
|
+
])
|
|
117
|
+
|
|
118
|
+
const runtime = createAgentRuntime({
|
|
119
|
+
protocol,
|
|
120
|
+
store: createMemoryAgentRuntimeStore(),
|
|
121
|
+
models: {
|
|
122
|
+
preflight: () => models.preflight('fast', ['tools']),
|
|
123
|
+
resolve: () => models.resolve('fast', ['tools']),
|
|
124
|
+
},
|
|
125
|
+
prompt: ({ context, signal, model }) =>
|
|
126
|
+
prompt({
|
|
127
|
+
context,
|
|
128
|
+
signal,
|
|
129
|
+
budget: {
|
|
130
|
+
contextWindow: model.descriptor.contextWindow,
|
|
131
|
+
reservedOutput: 8_000,
|
|
132
|
+
toolSchemas: { provenance: 'unavailable' },
|
|
133
|
+
attachments: { value: 0, provenance: 'measured' },
|
|
134
|
+
providerOverhead: { provenance: 'unavailable' },
|
|
135
|
+
},
|
|
136
|
+
}),
|
|
137
|
+
tools: ({ context, toolFenceLifecycle }) =>
|
|
138
|
+
mountAgent(service, {
|
|
139
|
+
context,
|
|
140
|
+
lifecycle: composeToolLifecycle(authLifecycle, toolFenceLifecycle),
|
|
141
|
+
}),
|
|
142
|
+
runs: { inputPolicy: 'interrupt', coalescePending: true },
|
|
143
|
+
loop: {
|
|
144
|
+
idleTimeoutMs: 60_000,
|
|
145
|
+
prepareStep: ({ context, steps }) => ({
|
|
146
|
+
activeTools: steps.some((step) => step.toolCalls.length > 0)
|
|
147
|
+
? ['lookup']
|
|
148
|
+
: ['lookup', 'discover'],
|
|
149
|
+
instructions: `Current account: ${context.userId}`,
|
|
150
|
+
}),
|
|
151
|
+
stopPolicies: [
|
|
152
|
+
{
|
|
153
|
+
name: 'repeated-tool-error',
|
|
154
|
+
when: ({ steps }) => hasRepeatedToolError(steps),
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
const ticket = runtime.submit({
|
|
161
|
+
conversationId: 'conversation-id',
|
|
162
|
+
idempotencyKey: 'request-id',
|
|
163
|
+
context: { userId: 'user-id' },
|
|
164
|
+
parts: [{ type: 'text', text: 'Hello' }],
|
|
165
|
+
recordIds: {
|
|
166
|
+
inputMessageId: 'user-message-id',
|
|
167
|
+
runId: 'run-id',
|
|
168
|
+
assistantMessageId: 'assistant-message-id',
|
|
169
|
+
},
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
const admission = await ticket.admission
|
|
173
|
+
await ticket.accepted
|
|
174
|
+
const terminal = await ticket.result
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Bounded deferred tool catalogs
|
|
178
|
+
|
|
179
|
+
Use `createDeferredAgentToolSurface` when a measured large catalog makes
|
|
180
|
+
sending every schema on every provider step expensive. The controller mounts
|
|
181
|
+
the complete executable surface in process, but initially advertises only its
|
|
182
|
+
search tool, explicit `alwaysOn` tools and bounded policy pins:
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
import { createDeferredAgentToolSurface } from 'stitchkit/agent-runtime'
|
|
186
|
+
import { composeToolLifecycle } from 'stitchkit/tools'
|
|
187
|
+
|
|
188
|
+
const deferred = createDeferredAgentToolSurface({
|
|
189
|
+
surfaces: {
|
|
190
|
+
member: { services: memberServices, runtimeTools, alwaysOn: ['ask_user'] },
|
|
191
|
+
broadcast: { services: broadcastServices, runtimeTools },
|
|
192
|
+
},
|
|
193
|
+
selectSurface: ({ context }) => context.mode,
|
|
194
|
+
pins: ({ context }) => context.skillTools,
|
|
195
|
+
search: {
|
|
196
|
+
name: 'tool_search',
|
|
197
|
+
maxQueryBytes: 1_024,
|
|
198
|
+
maxResults: 8,
|
|
199
|
+
maxResultBytes: 8_192,
|
|
200
|
+
select: ({ query, manifest }) => rankCatalog(query, manifest),
|
|
201
|
+
},
|
|
202
|
+
activation: {
|
|
203
|
+
maxSelectedTools: 8,
|
|
204
|
+
maxActiveTools: 16,
|
|
205
|
+
maxSchemaBytes: 32_768,
|
|
206
|
+
},
|
|
207
|
+
observe: event => recordDeferredToolEvidence(event),
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
const runtime = createAgentRuntime({
|
|
211
|
+
// protocol, store, models and prompt...
|
|
212
|
+
tools: runContext => deferred.mount(runContext, {
|
|
213
|
+
context: runContext.context,
|
|
214
|
+
lifecycle: composeToolLifecycle(authLifecycle, runContext.toolFenceLifecycle),
|
|
215
|
+
}),
|
|
216
|
+
loop: { prepareStep: deferred.prepareStep(applicationPrepareStep) },
|
|
217
|
+
})
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
The built-in selector deterministically ranks exact name, prefix/token and
|
|
221
|
+
description matches. A custom async selector returns names only; unknown and
|
|
222
|
+
duplicate output is removed against the local canonical manifest. Search never
|
|
223
|
+
executes the selected operation and never returns its schema. A later provider
|
|
224
|
+
step receives the real selected tools by name, so their direct lifecycle,
|
|
225
|
+
fencing, hooks, errors and `present.agent` output remain unchanged.
|
|
226
|
+
|
|
227
|
+
Selection is a versioned receipt in the ordinary durable tool-result history.
|
|
228
|
+
The latest valid same-run search replaces the earlier selection; parallel
|
|
229
|
+
searches in one step merge in call order. Recovery reconstructs it, while a
|
|
230
|
+
different run or finite surface cannot inherit it. Known inactive calls take a
|
|
231
|
+
recoverable `SEARCH_REQUIRED` search round; unknown names still fail.
|
|
232
|
+
|
|
233
|
+
Every ceiling is required. `maxSchemaBytes` measures UTF-8 bytes over canonical
|
|
234
|
+
name, description and presentation schema. It is useful for before/after
|
|
235
|
+
comparison, but provider serialization and tokenization differ: use existing
|
|
236
|
+
provider-reported input usage and cost to decide whether the extra search round
|
|
237
|
+
is beneficial. Controller evidence intentionally omits query text, prompts,
|
|
238
|
+
arguments and application context. → ADR 0129.
|
|
239
|
+
|
|
240
|
+
### Published headless harness and structured runner
|
|
241
|
+
|
|
242
|
+
`stitchkit/agent-runtime/harness` publishes the resource-aware composition over
|
|
243
|
+
`createAgentRuntime`. `createHeadlessAgentHarness` accepts the existing protocol and store,
|
|
244
|
+
caller-provided model resolution, bounded instruction/skill/resource loading, direct tools and a
|
|
245
|
+
prompt-budget callback. Resource names are unique; count, UTF-8 bytes and diagnostics are bounded.
|
|
246
|
+
Invalid resources fail before a provider request. Diagnostics are evidence for the caller: their
|
|
247
|
+
observer is isolated, and the loader decides whether a reported condition is fatal.
|
|
248
|
+
|
|
249
|
+
`createAgentHarnessFileResources` is the optional filesystem implementation. It reads only
|
|
250
|
+
caller-declared absolute roots, refuses symlinks and reports provenance as
|
|
251
|
+
`rootId:relative/path`. Instructions enter the prompt immediately. Skills and ordinary resources
|
|
252
|
+
enter as bounded name/description summaries; `read_resource` loads one exact body later as
|
|
253
|
+
a normal direct typed tool. Custom loaders remain supported unchanged.
|
|
254
|
+
|
|
255
|
+
Each run may resolve a different provider adapter without changing the harness. The
|
|
256
|
+
`profile-applied` observation records the actual `AgentModelDescriptor`, resource kind/name/
|
|
257
|
+
provenance and sorted direct tool names; it intentionally contains no resource text, prompts,
|
|
258
|
+
arguments or credentials. Observer failure never changes the canonical run outcome.
|
|
259
|
+
|
|
260
|
+
[`packages/core/examples/agent-runtime/headless-agent-runner.ts`](../../packages/core/examples/agent-runtime/headless-agent-runner.ts)
|
|
261
|
+
is a reference structured control loop for `submit`, `interrupt`, `snapshot` and bounded `close`.
|
|
262
|
+
It starts no process and chooses no framing, authentication or transport. Importing either example
|
|
263
|
+
has no side effect; an external supervisor owns process placement and restart.
|
|
264
|
+
|
|
265
|
+
| Concern | Public Stitchkit composition | Boundary |
|
|
266
|
+
| --- | --- | --- |
|
|
267
|
+
| execution loop | `createAgentRuntime` | already available; do not copy a second loop |
|
|
268
|
+
| model choice | `defineModelRegistry` and `models.resolve` | provider credentials/discovery stay application-owned |
|
|
269
|
+
| resources | `createHeadlessAgentHarness` → `composeAgentPrompt` | paths, trust, precedence and watching stay application-owned |
|
|
270
|
+
| tools | `mountAgent` + `createAgentToolFenceLifecycle` | auth and domain effects stay application-owned |
|
|
271
|
+
| follow-up | `runs.inputPolicy: 'queue'` | durable FIFO after the current run |
|
|
272
|
+
| interrupt | `interrupt` or `interrupt-next` | `interrupt-next` terminates the active run and gives the new durable admission next priority |
|
|
273
|
+
| recovery | `runtime.recover` + `scanRecoverable` | replay safety and context reconstruction are explicit callbacks |
|
|
274
|
+
| reconnect | canonical snapshot + `advanceAgentMultiSessionCursor` | conversation/run-scoped gaps require resync |
|
|
275
|
+
| persistence | memory reference, public driver, or SQLite leaf | product rows/outbox remain outside the runtime store |
|
|
276
|
+
| executable lifecycle | structured runner example | framing, auth, process placement, restart and OS isolation stay host-owned |
|
|
277
|
+
|
|
278
|
+
`createAgentHarnessControlServer` adds transport-neutral correlated requests, shared observers and
|
|
279
|
+
one exclusive controller lease per conversation. `close()` on a connection detaches only that
|
|
280
|
+
client; it never closes the harness. Normal `event` delivery stays serialized. A bounded slow
|
|
281
|
+
consumer is detached and receives `resync-required` through the required synchronous
|
|
282
|
+
`onOverflow` callback; that callback closes/aborts the underlying transport, which then reconnects
|
|
283
|
+
and requests a fresh snapshot. It never writes a second frame concurrently with a blocked
|
|
284
|
+
`deliver`. Browser code uses `createAgentControlView`,
|
|
285
|
+
`reduceAgentControlSnapshot` and `reduceAgentControlEvent`; the reducer owns no renderer and marks a
|
|
286
|
+
conversation `resyncRequired` after a transient sequence gap.
|
|
287
|
+
|
|
288
|
+
Configure `loop.toolApproval` to use the installed AI SDK approval policy and
|
|
289
|
+
`loop.toolApprovalSecret` to sign exact requests. A request is stored on the terminal assistant
|
|
290
|
+
before any effect. `pendingApprovals()` derives unresolved requests from canonical messages;
|
|
291
|
+
`respondToApproval()` writes one tool-role approval response and queues a successor. The SDK
|
|
292
|
+
revalidates the signature/tool call/input before the original direct tool reaches its existing
|
|
293
|
+
fence. Reconnect and SQLite reopen require no promise registry. Remembered policy and a stronger
|
|
294
|
+
cross-crash exactly-once guarantee remain application concerns.
|
|
295
|
+
|
|
296
|
+
Approval requests suspend a call; they do not settle its result. History carries exact call and
|
|
297
|
+
approval identity across assistant/tool records, so an approved result can precede the next signed
|
|
298
|
+
request in a successor run. Automatic decisions follow the same chronology. Unknown/duplicate
|
|
299
|
+
responses and results with a different call or tool name are invalid; dropping an invalid active
|
|
300
|
+
approval input fails the run with a private diagnostic rather than starting a fresh model turn.
|
|
301
|
+
|
|
302
|
+
`stitchkit/agent-runtime/coding-tools` returns ordinary direct runtime tools named `read_file`,
|
|
303
|
+
`write_file`, `edit_file`, `list_directory`, `glob`, `search_files`, `run_command` and optional
|
|
304
|
+
`read_output`. Every call passes a required host authorization callback. An optional async/sync
|
|
305
|
+
`authorizePath({ path })` is the one operation-independent policy for direct file access and
|
|
306
|
+
discovery: direct read/write/edit refuses a denied path, while listing, glob and search omit it.
|
|
307
|
+
Denial is recursive on every surface — direct access and discovery base paths ask about `.` and each
|
|
308
|
+
ancestor, outermost first, stopping at the first refusal, so denying `credentials` denies everything
|
|
309
|
+
under it. The comparison is segment-wise, so it does not deny `credentials-backup`, and a path of
|
|
310
|
+
depth N costs N+1 questions. Directory decisions happen before descent; file decisions and
|
|
311
|
+
`search_files.include` happen before opening content. Requested paths use `/`: a backslash is
|
|
312
|
+
refused rather than normalised, because the workspace walk reads it as a separator and every
|
|
313
|
+
authorization callback would otherwise be asked about a different decomposition than the one opened. File paths are relative, bounded and contained after
|
|
314
|
+
descriptor-relative resolution: each ancestor is opened without following symlinks and remains
|
|
315
|
+
pinned through authorization and the filesystem effect. Reads revalidate the pinned file identity;
|
|
316
|
+
writes and patches revalidate the pinned parent identity; search and resource discovery descend
|
|
317
|
+
only through opened directories. Linux traverses `/proc/self/fd`; macOS uses the package's
|
|
318
|
+
architecture-specific Node-API `openat` backend. Unsupported platforms, including FreeBSD until a
|
|
319
|
+
real backend is qualified, fail closed. The package needs no install-time compiler or script.
|
|
320
|
+
Other platforms fail these filesystem operations closed because Node exposes no equivalent
|
|
321
|
+
portable directory-handle-relative API. Writes/edits reject symlink targets, content is strict
|
|
322
|
+
UTF-8 and retained bytes are finite. Shell accepts a finite alias mapped by the host to an absolute executable plus an
|
|
323
|
+
argument array — never a shell command string — and uses only the explicitly supplied environment.
|
|
324
|
+
Arguments, output and time are bounded, while cancellation terminates the child. The configured
|
|
325
|
+
root and cwd are path boundaries, not a security sandbox: isolate the process when an executable
|
|
326
|
+
must not access the rest of the machine. Path admission does not constrain `run_command`; an
|
|
327
|
+
executable requires process isolation for that guarantee. → ADR 0172
|
|
328
|
+
|
|
329
|
+
An absolute path is still refused. When it is inside the canonical workspace root, the refusal
|
|
330
|
+
includes the exact workspace-relative `recoveryPath`; an absolute path outside the root has no
|
|
331
|
+
suggested replacement. Applying the suggestion still passes the same descriptor-relative
|
|
332
|
+
containment and symlink checks.
|
|
333
|
+
|
|
334
|
+
`edit_file` replaces one exact snippet. `oldText` is itself the freshness guard for the region it
|
|
335
|
+
changes, so the digest is the optional `expectedSha256` and an edit is one call; pass the digest
|
|
336
|
+
`read_file` returned when you want the whole-file guarantee, and read the `sha256` it returns to
|
|
337
|
+
chain the next edit without re-reading. The read, the occurrence count and the construction of the
|
|
338
|
+
new content all happen inside one per-target lock, so two concurrent edits of different snippets in
|
|
339
|
+
one file cannot each build a file from the same base and have the second erase the first — the lock
|
|
340
|
+
is process-local, which covers many agents in one process and not two processes over one workspace.
|
|
341
|
+
It authorizes the exact replacement count, result digest and byte size, and deliberately does not
|
|
342
|
+
claim multi-file atomicity.
|
|
343
|
+
|
|
344
|
+
`write_file` creates missing parent directories inside the root and names them in
|
|
345
|
+
`createdDirectories`; the walk that finds them runs before authorization and reports them in the
|
|
346
|
+
authorization payload, so no directory is created before a host approves it.
|
|
347
|
+
|
|
348
|
+
**Every ordinary outcome is a refusal a model can act on** — a missing file is `NOT_FOUND`, an
|
|
349
|
+
existing file without `overwrite` is `CONFLICT`, an ambiguous snippet is `CONFLICT` carrying its
|
|
350
|
+
occurrence count, a path outside the root is `FORBIDDEN`, an unknown spilled-output reference is
|
|
351
|
+
`SPILL_REFERENCE_UNKNOWN` — each with a `hint` naming the next move.
|
|
352
|
+
Host-level causes stay scrubbed to `INTERNAL_SERVER_ERROR` and name nothing outside the workspace.
|
|
353
|
+
Every refusal code is a member of `STITCH_ERROR_STATUS`, so its status survives an envelope that
|
|
354
|
+
crosses a process boundary and is rebuilt from the wire.
|
|
355
|
+
→ ADR 0139
|
|
356
|
+
|
|
357
|
+
`list_directory` marks excluded directories rather than hiding them, and `glob` reports
|
|
358
|
+
`skippedDirectories` beside its matches: an empty result from a tree whose files all live under an
|
|
359
|
+
excluded directory is not "no files", and a model told only "nothing found" concludes the wrong
|
|
360
|
+
thing. `search_files` takes `regex`, `context` lines and an anchored `include` pattern matched
|
|
361
|
+
against the whole workspace-relative path. `*` does not cross `/`, so files in subdirectories need
|
|
362
|
+
`**/`; `scannedFiles` counts files admitted by both that filter and host authorization. A `hint`
|
|
363
|
+
explains the zero only when the filter produced it, rejecting every file the scan reached; an empty
|
|
364
|
+
tree and a host refusal return the same empty result without blaming the pattern. Regex is bounded by
|
|
365
|
+
refusing backreferences and lookaround and capping line length rather than by a timeout, because a
|
|
366
|
+
JavaScript `RegExp` cannot be interrupted once it starts backtracking. With an optional `AgentCodingArtifactStore`, shell output beyond the inline
|
|
367
|
+
preview continues into an opaque bounded artifact and `read_output` reads slices without
|
|
368
|
+
exposing a host path. Without a store, the previous finite output-limit behavior is unchanged.
|
|
369
|
+
|
|
370
|
+
`run_command` treats every invocation as finite. `shellTimeoutMs` bounds normal execution and
|
|
371
|
+
`shellTerminationGraceMs` bounds settlement after timeout, caller cancellation, output overflow or
|
|
372
|
+
parent exit. POSIX hosts launch a dedicated process group and kill every descendant remaining in
|
|
373
|
+
that group; a process that deliberately escapes the group is outside the guarantee. Node's
|
|
374
|
+
portable Windows child-process API cannot kill a complete descendant tree without invoking a
|
|
375
|
+
second host executable, so Windows kills the direct child, destroys retained pipes at the grace
|
|
376
|
+
deadline and makes no descendant-cleanup claim. A signal already aborted before execution returns
|
|
377
|
+
`cancelled` without spawning.
|
|
378
|
+
|
|
379
|
+
One `createAgentHarnessFileResources` instance represents one immutable discovery generation:
|
|
380
|
+
concurrent and repeated `load()` calls share it, so a direct resource read cannot cross into a
|
|
381
|
+
new catalog unexpectedly. Discovery uses the same descriptor-anchored traversal as coding search;
|
|
382
|
+
construct a new loader to refresh after filesystem changes.
|
|
383
|
+
|
|
384
|
+
Runtime events preserve reasoning/text/tool lifecycle order. Durable admission,
|
|
385
|
+
checkpoint, run-state and terminal events carry stable identities; transient
|
|
386
|
+
deltas carry one runtime epoch and monotonic sequence. On a transient gap,
|
|
387
|
+
reload the canonical snapshot and resume from the durable record instead of
|
|
388
|
+
persisting deltas as a second history.
|
|
389
|
+
|
|
390
|
+
Prompt `contextWindow` budgeting is a pre-request decision over the assembled
|
|
391
|
+
context. `AgentRun.usage` is cumulative measured/provider-reported execution
|
|
392
|
+
evidence across attempts and compaction. They answer different questions and
|
|
393
|
+
must not be substituted for each other. TTFT and throughput require timestamps
|
|
394
|
+
from the actual provider stream plus a provider-reported or tokenizer-measured
|
|
395
|
+
token count; character counts cannot produce exact token or throughput figures.
|
|
396
|
+
|
|
397
|
+
`recordIds` is optional. Supply stable application record IDs when an accepted-response transport must
|
|
398
|
+
return durable placeholders before the run finishes. `ticket.admission` resolves after the store
|
|
399
|
+
acceptance CAS and reports the canonical committed `input`, assigned `run`, a typed `pending`
|
|
400
|
+
assistant projection, compatibility IDs and snapshot version.
|
|
401
|
+
Those assigned IDs can differ from the proposal when an input coalesces into an existing queued
|
|
402
|
+
successor. Reuse the same `inputMessageId` for retries carrying the same idempotency key; input
|
|
403
|
+
identity is caller-stable, while the receipt reports the run/assistant identities that assignment
|
|
404
|
+
may change. Await `admission` first on the immediate accepted-response path. `ticket.accepted`
|
|
405
|
+
remains the signal-only compatibility surface and additionally waits for admission publication.
|
|
406
|
+
|
|
407
|
+
The in-memory store is a reference adapter and has process-local durability
|
|
408
|
+
only. Production applications normally call `createAgentRuntimeStore()` and
|
|
409
|
+
provide one database transaction driver:
|
|
410
|
+
|
|
411
|
+
```ts
|
|
412
|
+
const store = createAgentRuntimeStore({
|
|
413
|
+
transaction: (work, options) =>
|
|
414
|
+
options?.access === 'read'
|
|
415
|
+
? db.readTransaction(tx => work(tx))
|
|
416
|
+
: db.writeTransaction(tx => work(tx)),
|
|
417
|
+
head: {
|
|
418
|
+
load: (tx, conversationId) => loadRuntimeHead(tx, conversationId),
|
|
419
|
+
compareAndSwap: (tx, operation) => casRuntimeHead(tx, operation),
|
|
420
|
+
},
|
|
421
|
+
runs: {
|
|
422
|
+
load: (tx, identity) => loadRun(tx, identity),
|
|
423
|
+
loadByAssistantMessageId: (tx, identity) => loadRunByAssistant(tx, identity),
|
|
424
|
+
loadMany: (tx, identities) => loadRuns(tx, identities),
|
|
425
|
+
listActive: (tx, conversationId) => listActiveRuns(tx, conversationId),
|
|
426
|
+
save: (tx, record) => saveRun(tx, record),
|
|
427
|
+
},
|
|
428
|
+
admissions: {
|
|
429
|
+
load: (tx, identity) => loadAdmission(tx, identity),
|
|
430
|
+
loadByInputMessageId: (tx, identity) => loadAdmissionByInput(tx, identity),
|
|
431
|
+
create: (tx, receipt) => createAdmission(tx, receipt),
|
|
432
|
+
},
|
|
433
|
+
history: {
|
|
434
|
+
load: (tx, conversationId) => loadCanonicalMessages(tx, conversationId),
|
|
435
|
+
apply: (tx, mutation) => applyCanonicalHistoryMutation(tx, mutation),
|
|
436
|
+
},
|
|
437
|
+
scanRecoverable: page => scanRecoverableRuns(page),
|
|
438
|
+
})
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
Prompt budgeting keeps reservation deficits signed. If instructions,
|
|
442
|
+
`reservedOutput`, tool schemas, attachments and provider overhead already exceed
|
|
443
|
+
`contextWindow`, `composeAgentPrompt` returns `contextDecision: 'oversized'`
|
|
444
|
+
and a negative `availableHistoryTokens` even when history is empty. A `compact`
|
|
445
|
+
policy is returned only when removing history could actually make the prompt
|
|
446
|
+
fit. Exact equality (including a zero window with zero reservations/history)
|
|
447
|
+
fits; any unavailable component keeps the decision `unavailable`.
|
|
448
|
+
|
|
449
|
+
The same opaque `tx` reaches head, run, admission and history callbacks. The adapter maps rows
|
|
450
|
+
and supplies atomicity; Stitchkit owns transition validation and revision
|
|
451
|
+
arithmetic. The executable reference is
|
|
452
|
+
[`examples/agent-store-prisma/adapter.ts`](../../examples/agent-store-prisma/adapter.ts).
|
|
453
|
+
`compareAndSwap` returns either `{ outcome: 'applied' }` or
|
|
454
|
+
`{ outcome: 'conflict', actualVersion }`. Decide that outcome by reading the
|
|
455
|
+
version, comparing it and then writing unconditionally — inside the transaction
|
|
456
|
+
the adapter supplies, that is atomic. A conditional upsert is the shorter thing
|
|
457
|
+
to write and it is wrong twice: `ON CONFLICT ... WHERE` guards the update branch
|
|
458
|
+
only, so the first write to a conversation applies whatever `expectedVersion` it
|
|
459
|
+
was given, and the affected-row count that would report the outcome is the
|
|
460
|
+
driver's, which need not be the rows the statement moved. The head contains only
|
|
461
|
+
schema version, conversation identity and monotonic version. Runs and admission receipts are normalized records;
|
|
462
|
+
recovery queries active run states directly instead of maintaining a second projection.
|
|
463
|
+
An admission receipt retains its canonical input, and a terminal run retains its canonical
|
|
464
|
+
assistant, so physical product-history compaction cannot break idempotent retries.
|
|
465
|
+
|
|
466
|
+
### Built-in SQLite persistence
|
|
467
|
+
|
|
468
|
+
Use the runtime-specific leaf; the neutral agent runtime never imports either
|
|
469
|
+
SQLite built-in:
|
|
470
|
+
|
|
471
|
+
```ts
|
|
472
|
+
// Bun
|
|
473
|
+
import { createBunSqliteAgentRuntimeStore } from 'stitchkit/agent-runtime/sqlite/bun'
|
|
474
|
+
|
|
475
|
+
const sqlite = createBunSqliteAgentRuntimeStore({ filename: './agent-runtime.sqlite' })
|
|
476
|
+
const runtime = createAgentRuntime({ ...config, store: sqlite.store })
|
|
477
|
+
|
|
478
|
+
await runtime.close()
|
|
479
|
+
await sqlite.close()
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
```ts
|
|
483
|
+
// Node 22.5+
|
|
484
|
+
import { createNodeSqliteAgentRuntimeStore } from 'stitchkit/agent-runtime/sqlite/node'
|
|
485
|
+
|
|
486
|
+
const sqlite = createNodeSqliteAgentRuntimeStore({ filename: './agent-runtime.sqlite' })
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
Initialization creates only `stitchkit_agent_runtime_*` tables and records
|
|
490
|
+
schema version 2 in `stitchkit_agent_runtime_meta`; it does not use
|
|
491
|
+
`PRAGMA user_version` or mutate application tables. An unknown schema version or
|
|
492
|
+
unversioned partial Stitchkit schema is refused. The connection is owned by the
|
|
493
|
+
returned handle and closes only after accepted operations drain.
|
|
494
|
+
|
|
495
|
+
Each handle serializes its transactions. Separate connections use
|
|
496
|
+
`busy_timeout = 0`: a competing synchronous writer fails promptly with
|
|
497
|
+
SQLite's lock error, so an awaited transaction can resume and commit or roll
|
|
498
|
+
back. Retry that explicit error with an application-owned bounded policy; do
|
|
499
|
+
not configure a blocking busy timeout on the same JavaScript thread.
|
|
500
|
+
|
|
501
|
+
Aggregate reads and catalog pages use `BEGIN`, so a WAL writer may remain active
|
|
502
|
+
while the reader sees one committed snapshot. Mutations and purge use
|
|
503
|
+
`BEGIN IMMEDIATE`: they reserve the writer slot before reading state for CAS and
|
|
504
|
+
never attempt a deferred read-to-write upgrade. A custom driver may inspect the
|
|
505
|
+
additive `transaction` option `{ access: 'read' }`; ignoring it preserves the
|
|
506
|
+
previous write-safe behavior.
|
|
507
|
+
|
|
508
|
+
The adapter proves canonical durability across reopen and process restart. It
|
|
509
|
+
does not make external tool effects exactly once, join application projections
|
|
510
|
+
atomically or replace an application outbox. If a product row must commit with
|
|
511
|
+
an agent transition, implement `AgentRuntimeStoreDriver` over the application's
|
|
512
|
+
own transaction boundary instead.
|
|
513
|
+
|
|
514
|
+
Opening a version 1 store migrates it in one transaction, forward only — back
|
|
515
|
+
the file up first, a 0.85.x package refuses a migrated file. Existing
|
|
516
|
+
normalized state becomes one `runtime/baseline` event per conversation, dated
|
|
517
|
+
when the migration ran and carrying `asOf` for the last message it describes;
|
|
518
|
+
search and projections address that pre-migration history as one snapshot at
|
|
519
|
+
`seq 1`. New transitions continue the monotonic conversation sequence. Version
|
|
520
|
+
2 requires SQLite FTS5 because event search is an advertised capability, so a
|
|
521
|
+
build without FTS5 is a startup error (`requires FTS5 support`) rather than an
|
|
522
|
+
empty search result; check with
|
|
523
|
+
`SELECT sqlite_compileoption_used('ENABLE_FTS5')`.
|
|
524
|
+
|
|
525
|
+
The handle returned by `createBunSqliteAgentRuntimeStore` /
|
|
526
|
+
`createNodeSqliteAgentRuntimeStore` is `{ store, conversations, database,
|
|
527
|
+
transaction, close }`. `database` is the shared connection and `transaction`
|
|
528
|
+
is one write transaction in the store's own serialization: the SQLite
|
|
529
|
+
companions — `createSqliteAgentProjectionStore`, `createSqliteAgentSpillStore`,
|
|
530
|
+
`createSqliteAgentChildManager`, `createAgentScheduleService` — take `{ sqlite }`
|
|
531
|
+
and write their rows and events through it, so a row and its event land
|
|
532
|
+
together or not at all.
|
|
533
|
+
|
|
534
|
+
`conversations.messages` pages the model's history: what compaction removed is
|
|
535
|
+
not in it, which is the point of compaction. A person reading back their own
|
|
536
|
+
conversation needs the other view, and asks for it explicitly:
|
|
537
|
+
|
|
538
|
+
```ts
|
|
539
|
+
const page = await conversations.messages({
|
|
540
|
+
conversationId,
|
|
541
|
+
limit: 50,
|
|
542
|
+
direction: 'after',
|
|
543
|
+
includeCompacted: true,
|
|
544
|
+
})
|
|
545
|
+
const removed = new Set(page.compacted)
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
`items` stays one sequence in the order it happened, and `compacted` names the
|
|
549
|
+
ids inside it that the model no longer sees — the boundary is a mark on the
|
|
550
|
+
conversation, not a second list. A compaction summary sits at the position of
|
|
551
|
+
the last message it replaced, so the block reads through and the summary
|
|
552
|
+
arrives after it, where it was written; in the model's history, where every
|
|
553
|
+
replaced message is gone, it occupies the block's place either way. Without
|
|
554
|
+
the flag the page is exactly what it was, `compacted`
|
|
555
|
+
empty. The v1 → v2 migration baseline records the same thing: the whole
|
|
556
|
+
sequence, with `compacted` naming what had been folded away. A file migrated
|
|
557
|
+
by 0.86.0 has a baseline built from the active history only — the messages
|
|
558
|
+
themselves are still in the store and this read reaches them, but that one
|
|
559
|
+
event cannot be rewritten after the fact.
|
|
560
|
+
|
|
561
|
+
### Retried provider streams
|
|
562
|
+
|
|
563
|
+
With `loop.retry` set, a provider stream that fails before any tool call in the
|
|
564
|
+
attempt is retried at the step boundary. Subscribers see `attempt-reset` for the
|
|
565
|
+
run before the next attempt's first delta and drop what the failed attempt
|
|
566
|
+
streamed; the durable draft is checkpointed after that output is discarded; an
|
|
567
|
+
input injected into the failed attempt is taken again by the retry; and the
|
|
568
|
+
failed attempt's reported usage stays in the run's spend. Transient events —
|
|
569
|
+
deltas, reasoning, `attempt-reset` — are numbered from 1 per run, counting only
|
|
570
|
+
what was published, so a cursor sees no gap on an ordinary stream.
|
|
571
|
+
|
|
572
|
+
### Event ledger, projections and durable capabilities
|
|
573
|
+
|
|
574
|
+
`AgentRuntimeStore` exposes bounded `readEvents`, declared `appendEvent`, canonical
|
|
575
|
+
`exportConversation` and empty-target `importConversation`. Runtime transitions, exact provider
|
|
576
|
+
requests and completed provider response identities enter the same append-only ledger. A
|
|
577
|
+
`provider/response` payload binds `response: { id, provider? }` to its `runId`, retry `attempt` and
|
|
578
|
+
`stepNumber`; `step-finished.response` projects the same object to the operator sink. The optional
|
|
579
|
+
upstream name comes from the model provider's own `resolveResponseProvider` — `openRouterProvider`
|
|
580
|
+
supplies it — so the runtime carries the fact without learning any gateway's metadata key. The normalized
|
|
581
|
+
head/run/message tables remain the fast operational projection.
|
|
582
|
+
|
|
583
|
+
Use `defineAgentProjection` with `createSqliteAgentProjectionStore` for a
|
|
584
|
+
deterministic versioned fold. Every value reports `uptoSeq`, so a caller can
|
|
585
|
+
distinguish current data from a projection that still has events to consume.
|
|
586
|
+
Changing the projection version folds from sequence one.
|
|
587
|
+
|
|
588
|
+
The built-ins are `agentSummaryProjection`, `agentUsageProjection` and
|
|
589
|
+
`agentOutlineProjection`; focused card, state-slot and schedule projections are
|
|
590
|
+
also available. `list(projection)` reads all materialized conversation rows in
|
|
591
|
+
one SQLite query instead of reopening their event logs.
|
|
592
|
+
|
|
593
|
+
Durable state is declared once and injected on every provider request:
|
|
594
|
+
|
|
595
|
+
```ts
|
|
596
|
+
const goal = defineStateSlot({
|
|
597
|
+
name: 'goal',
|
|
598
|
+
schema: z.object({ objective: z.string(), status: z.string() }),
|
|
599
|
+
})
|
|
600
|
+
|
|
601
|
+
const slots = createAgentStateSlotStore({ store: sqlite.store, definitions: [goal] })
|
|
602
|
+
await slots.set({
|
|
603
|
+
conversationId,
|
|
604
|
+
name: 'goal',
|
|
605
|
+
value: { objective: 'finish migration', status: 'active' },
|
|
606
|
+
actor: 'human',
|
|
607
|
+
})
|
|
608
|
+
|
|
609
|
+
const runtime = createAgentRuntime({ ...config, store: sqlite.store, stateSlots: [goal] })
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
`createAgentStateTools` binds `create_goal`, `update_goal`, `get_goal` and
|
|
613
|
+
`todo_write` to one conversation. Human changes call the same slot store with
|
|
614
|
+
`actor: 'human'`; they remain structured `state/set` facts rather than forged
|
|
615
|
+
chat messages.
|
|
616
|
+
|
|
617
|
+
`createSqliteAgentSpillStore` persists oversized output separately and records
|
|
618
|
+
its locator, hash and lifecycle in the ledger. `read_output` and
|
|
619
|
+
`search_output` re-run both locator authorization and the originating tool
|
|
620
|
+
authorization before reading bytes. A reference the store does not hold is a
|
|
621
|
+
refusal like any other — `SPILL_REFERENCE_UNKNOWN` / 404, naming the reference
|
|
622
|
+
and pointing at the one the spilling command returned. The lookup is scoped by
|
|
623
|
+
conversation, so a reference belonging to another conversation is absent rather
|
|
624
|
+
than forbidden, and the refusal cannot tell a model that it exists elsewhere. `createSqliteAgentEventSearch` returns the
|
|
625
|
+
exact conversation and event sequence; cross-conversation results are denied
|
|
626
|
+
unless `authorizeConversation` approves each target.
|
|
627
|
+
`createAgentEventSearchTools` supplies `session_search`, `session_trace` and
|
|
628
|
+
`session_event` over the same bounded APIs.
|
|
629
|
+
|
|
630
|
+
For credential-free failure tests, import `createFaultProviderServer` and
|
|
631
|
+
`createReplayAgentProvider` from `stitchkit/agent-runtime/testing`. Runtime
|
|
632
|
+
`loop.retry` applies an explicit `AgentRetryPolicy`: each decision is recorded
|
|
633
|
+
as `retry/scheduled`, each new attempt as `retry/started`, and an attempt that
|
|
634
|
+
has invoked a tool is never automatically replayed.
|
|
635
|
+
|
|
636
|
+
`createAgentScheduleService` persists `at`, `after` and `every` input. Repeating
|
|
637
|
+
schedules require an explicit IANA time zone. Dispatch uses a stable
|
|
638
|
+
`schedule:<id>:<occurrence>` idempotency key, and restart lateness is recorded.
|
|
639
|
+
`createAgentScheduleTools` exposes the exact `schedule_after`, `schedule_at`,
|
|
640
|
+
`schedule_every`, `schedule_list` and `schedule_cancel` surface.
|
|
641
|
+
|
|
642
|
+
`createSqliteAgentChildManager` seeds a child from the parent's ledger through
|
|
643
|
+
an exact sequence, stores the graph, clamps requested limits to a durable parent
|
|
644
|
+
remainder and stops budget overruns at the next step boundary as
|
|
645
|
+
`policy_stop`. That enforcement runs inside the child's own runtime: the host that spawns it gives the child
|
|
646
|
+
`loop.stopPolicies: [agentChildBudgetStopPolicy({ manager, childConversationId })]`, which
|
|
647
|
+
calls `recordStepUsage` at every step boundary; `recordStepUsage` alone measures and decides,
|
|
648
|
+
and reports `enforced: false` when the deciding process holds no handle to stop. Given to `createAgentRuntime` as `children`, the manager stops the parent's children after the parent's terminal is durable — interrupted, cancelled, timed out or shut down; a successful, policy-stopped, superseded or failed parent leaves them to the conversation (ADR 0175 carries the table); without `children` nothing cascades; an unreachable child is recorded
|
|
649
|
+
as `lost`, not misreported as a provider failure.
|
|
650
|
+
`createAgentChildTools` adds `subagent`, `subagent_fork`, `list_agents`,
|
|
651
|
+
`send_message` and `interrupt_agent`; final output stays behind its bounded
|
|
652
|
+
result locator.
|
|
653
|
+
|
|
654
|
+
## Durable order
|
|
655
|
+
|
|
656
|
+
`acceptInputAndAssignRun` is one atomic operation. It is followed by ownership
|
|
657
|
+
acquisition, revision-checked assistant checkpoints and one terminal CAS. The
|
|
658
|
+
process-local coordinator releases its lane only after terminal commit.
|
|
659
|
+
|
|
660
|
+
A queued admission is durable immediately, even if its predecessor is still awaiting ownership
|
|
661
|
+
or its first checkpoint. Snapshots expose causal turn order rather than physical append order:
|
|
662
|
+
the predecessor's assigned input(s) and assistant come before the successor input(s). Execution
|
|
663
|
+
uses the same run boundary, so neither `prompt({ snapshot })` nor default/custom history
|
|
664
|
+
projection can see inputs assigned to a later run. `inject` remains the explicit path that moves
|
|
665
|
+
a successor input into the run already in flight.
|
|
666
|
+
|
|
667
|
+
```text
|
|
668
|
+
input + queued run → running → execution settled → terminal CAS → successor
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
## What happens to a run when new input arrives
|
|
672
|
+
|
|
673
|
+
`runs.inputPolicy` decides. It takes five values, or a function returning one:
|
|
674
|
+
|
|
675
|
+
| policy | the run in flight | what it already produced |
|
|
676
|
+
|--------|-------------------|--------------------------|
|
|
677
|
+
| `queue` (default) | finishes first | kept |
|
|
678
|
+
| `inject` | continues, and answers the new input too | kept, and built on |
|
|
679
|
+
| `interrupt` | ends | kept, and marked as cut off |
|
|
680
|
+
| `interrupt-next` | ends; this input runs before ordinary queued work | kept, and marked as cut off |
|
|
681
|
+
| `supersede` | ends | discarded from the prompt, kept in the record |
|
|
682
|
+
|
|
683
|
+
`interrupt-next` is the explicit priority path for an urgent input. If A is
|
|
684
|
+
running, ordinary B is queued, and urgent C arrives, the coordinator aborts A,
|
|
685
|
+
waits for A to settle and then runs C before B. B keeps its durable identity and
|
|
686
|
+
eventually runs. Urgent inputs remain FIFO among themselves. They do not
|
|
687
|
+
coalesce into an ordinary pending run: that would erase the priority boundary.
|
|
688
|
+
|
|
689
|
+
`interrupt` and `supersede` differ in exactly one thing, and the question that
|
|
690
|
+
picks between them is **not** "was the run interrupted" but **"did anyone see
|
|
691
|
+
what it produced"**:
|
|
692
|
+
|
|
693
|
+
- The user pressed **stop**. The partial answer was streamed to their screen and
|
|
694
|
+
they read it. It belongs in the conversation — dropping it makes the history
|
|
695
|
+
lie to the model about what the human has seen. That is `interrupt`.
|
|
696
|
+
- A newer message **superseded** the run. Whether the partial reached anyone
|
|
697
|
+
depends on the delivery surface: a token stream shows it as it is produced, a
|
|
698
|
+
surface that sends nothing until the run is done never showed it at all. When
|
|
699
|
+
it reached nobody, it is not part of the conversation. That is `supersede`.
|
|
700
|
+
|
|
701
|
+
**Stitchkit cannot answer that question for you** — delivery belongs to the
|
|
702
|
+
transport, and the runtime sees an abort, not a screen. Hence a declared policy
|
|
703
|
+
(→ ADR 0108), and hence `inputPolicy` accepting a function, so one application
|
|
704
|
+
can hold two surfaces with different rules without the core learning which is
|
|
705
|
+
which:
|
|
706
|
+
|
|
707
|
+
```ts
|
|
708
|
+
runs: {
|
|
709
|
+
inputPolicy: (input) =>
|
|
710
|
+
protocol.parseContext(input.context).surface === 'operator' ? 'queue' : 'supersede',
|
|
711
|
+
}
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
`input.context` is the **raw** context here — admission runs before the runtime
|
|
715
|
+
parses it, so the callback narrows it itself with the protocol it already has.
|
|
716
|
+
|
|
717
|
+
A superseded run ends with `terminalReason: 'superseded'`, run state
|
|
718
|
+
`'superseded'` and an assistant message of status `'superseded'`. **The record
|
|
719
|
+
is kept** — excluded from the projection, not deleted — so an operator can see
|
|
720
|
+
what was thrown away, and run identity, admission receipts and the terminal CAS
|
|
721
|
+
keep the row they depend on. Compaction leaves it alone for the same reason: a
|
|
722
|
+
turn whose answer is never spoken is not a turn that may be summarised into one,
|
|
723
|
+
because that would both feed the discarded text to the summariser and drop the
|
|
724
|
+
record in `replacedMessageIds`.
|
|
725
|
+
|
|
726
|
+
It is also outside the token budget. `selectAgentHistory` removes it with reason
|
|
727
|
+
`'superseded'` and does not count it, so an abandoned fragment cannot push a
|
|
728
|
+
real turn out of a context it never occupies.
|
|
729
|
+
|
|
730
|
+
### How an interrupted turn reaches the model
|
|
731
|
+
|
|
732
|
+
An interrupted turn is projected, and says so:
|
|
733
|
+
|
|
734
|
+
```text
|
|
735
|
+
{ role: 'assistant', content: [
|
|
736
|
+
{ type: 'text', text: 'We are the team, where would you like' },
|
|
737
|
+
{ type: 'text', text: '[interrupted: this turn was cut off before it finished]' },
|
|
738
|
+
]}
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
`history.interruptedAssistant` chooses the form, and the difference between the
|
|
742
|
+
first two is structural rather than cosmetic. **An assistant turn in provider
|
|
743
|
+
history is a commitment**: the model reads its own previous turn as something it
|
|
744
|
+
said and stays consistent with it. A system line is context.
|
|
745
|
+
|
|
746
|
+
| value | form | right when |
|
|
747
|
+
|-------|------|-----------|
|
|
748
|
+
| `assistant-marked` (default) | assistant turn plus a marker | the human read the text |
|
|
749
|
+
| `system-note` | `[interrupted] partial response: …` as a system line | the fragment reached nobody |
|
|
750
|
+
| `omit` | not projected at all | you want it gone from the request |
|
|
751
|
+
|
|
752
|
+
There is deliberately no value that reproduces what the projection used to do,
|
|
753
|
+
which was to send the partial as an ordinary assistant turn and drop its
|
|
754
|
+
`control` marker on the way. That was the defect, not a behaviour to stay
|
|
755
|
+
compatible with.
|
|
756
|
+
|
|
757
|
+
`projectAgentHistoryDetailed` reports what reached the provider, including part
|
|
758
|
+
types that no projected content stands for:
|
|
759
|
+
|
|
760
|
+
```ts
|
|
761
|
+
const { decisions } = await projectAgentHistoryDetailed(snapshot.messages)
|
|
762
|
+
// → { messageId: 'assistant-2', action: 'projected', reason: 'projected',
|
|
763
|
+
// omittedParts: ['source', 'provider'] }
|
|
764
|
+
// → { messageId: 'assistant-1', action: 'omitted', reason: 'superseded' }
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
`runtime.stop(key, 'supersede')` is the same decision taken by hand: the
|
|
768
|
+
process-local escape hatch chooses the reason, so a caller that knows the answer
|
|
769
|
+
was never delivered can discard it without a newer input arriving.
|
|
770
|
+
|
|
771
|
+
### An input that joins a run in flight
|
|
772
|
+
|
|
773
|
+
`inject` is right when the new input **refines** rather than redirects, and the
|
|
774
|
+
steps already taken are still worth something: *"summarise this thread… actually,
|
|
775
|
+
in bullet points"* should not throw away the reading the first message paid for.
|
|
776
|
+
|
|
777
|
+
What happens:
|
|
778
|
+
|
|
779
|
+
1. The input is admitted exactly like any other — a committed user message and a
|
|
780
|
+
**queued run**, durable before anything else happens.
|
|
781
|
+
2. At the running loop's next step boundary, that input joins its prompt. Only
|
|
782
|
+
that input: an unrelated queued submission is never carried in.
|
|
783
|
+
3. When the run finishes, its terminal commit — **one transaction** — records
|
|
784
|
+
the input as one the run answered and settles the queued successor with
|
|
785
|
+
`terminalReason: 'absorbed'` and `absorbedIntoRunId` naming the run that
|
|
786
|
+
answered it. Every ticket for that successor resolves to the same answer.
|
|
787
|
+
|
|
788
|
+
Nothing durable happens between 1 and 3, and that is the design (→ ADR 0113).
|
|
789
|
+
A run that crashes, is closed, or is interrupted after taking an input on
|
|
790
|
+
commits no absorption at all, so what is left behind is an ordinary queued
|
|
791
|
+
successor — the state every other policy already produces and recovery already
|
|
792
|
+
handles. **There is no ordering in which an accepted input becomes
|
|
793
|
+
unanswerable.** Only a run that *completes* may absorb; an interrupted one took
|
|
794
|
+
the input into its prompt and then stopped, and does not get to say it answered
|
|
795
|
+
it.
|
|
796
|
+
|
|
797
|
+
An absorbed run has **no assistant message of its own** — it produced none, and
|
|
798
|
+
writing an empty one would be a record claiming otherwise. Its answer is
|
|
799
|
+
reachable through `absorbedIntoRunId`, and the store follows that pointer itself
|
|
800
|
+
when a submission arrives on the absorbed run's idempotency key, so a retry
|
|
801
|
+
after a restart returns the answer rather than an empty terminal record.
|
|
802
|
+
|
|
803
|
+
It does publish one more `run-state` event, carrying `'superseded'`. It never
|
|
804
|
+
enters the run executor, so that event is the only thing that tells a delivery
|
|
805
|
+
surface following its `runId` that it is no longer queued.
|
|
806
|
+
|
|
807
|
+
With `coalescePending`, one successor can carry several inputs, and an
|
|
808
|
+
absorption covers a successor **whole or not at all** — a partial one would
|
|
809
|
+
leave a terminal run with inputs nobody answered. Inputs that coalesce before
|
|
810
|
+
the absorbing run's last step boundary join the same absorption. One that
|
|
811
|
+
arrives after it cancels the absorption: the successor then answers all of its
|
|
812
|
+
inputs itself, and the absorbing run has answered one of them too. A duplicate
|
|
813
|
+
answer, never a missing one.
|
|
814
|
+
|
|
815
|
+
(0.63.0 shipped a version of this that committed the absorption at the step
|
|
816
|
+
boundary, before the answer existed, and it was withdrawn in 0.65.0. ADR 0113
|
|
817
|
+
records what that ordering broke.)
|
|
818
|
+
|
|
819
|
+
With `runs.coalescePending: true`, an active lane has at most one queued
|
|
820
|
+
successor. Every later accepted input is atomically appended to that successor;
|
|
821
|
+
its `AgentRun.inputMessageIds` records the whole batch and every input ticket
|
|
822
|
+
resolves to the same terminal run. Coalescing never mutates the active run.
|
|
823
|
+
|
|
824
|
+
`AbortSignal.aborted` is only a cooperation request. A successor does not begin
|
|
825
|
+
while the predecessor still owns managed callbacks. A hung predecessor blocks
|
|
826
|
+
the lane in the first version.
|
|
827
|
+
|
|
828
|
+
Shutdown is two-phase, and both budgets carry the names they carry everywhere
|
|
829
|
+
else in Stitchkit:
|
|
830
|
+
|
|
831
|
+
```ts
|
|
832
|
+
const closed = await runtime.close({ gracePeriodMs: 30_000, forceTimeoutMs: 5_000 })
|
|
833
|
+
if (!closed.settled) {
|
|
834
|
+
console.warn(`exiting with ${closed.remaining} run(s) still in flight`)
|
|
835
|
+
}
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
`close` first rejects new process-local admissions and gives active runs
|
|
839
|
+
`gracePeriodMs` to finish on their own. Only after that budget expires does it
|
|
840
|
+
abort them with reason `shutdown`; `forceTimeoutMs` then bounds the settlement
|
|
841
|
+
wait for a non-cooperative model or tool, measured from the abort — the two
|
|
842
|
+
budgets add up rather than overlapping.
|
|
843
|
+
|
|
844
|
+
**`close()` reports what it achieved rather than promising an outcome it cannot
|
|
845
|
+
reach.** The result is `{ settled, timedOut, remaining }`: `settled` when every
|
|
846
|
+
in-flight run finished, `timedOut` with a `remaining` count when the force
|
|
847
|
+
budget expired first. There is no combination of budgets that is both bounded
|
|
848
|
+
and guaranteed to leave nothing in flight — that is the trade the budgets exist
|
|
849
|
+
to make, and the result is where you read which side of it you got:
|
|
850
|
+
|
|
851
|
+
| budgets | behaviour | can return with a run in flight |
|
|
852
|
+
|---------|-----------|---------------------------------|
|
|
853
|
+
| neither | aborts immediately, waits for settlement | no — unbounded wait |
|
|
854
|
+
| `gracePeriodMs` only | waits, aborts, then waits for settlement | no — unbounded wait |
|
|
855
|
+
| `forceTimeoutMs` only | aborts immediately, waits at most that long | **yes** — `timedOut` |
|
|
856
|
+
| both | waits, aborts, waits at most that long | **yes** — `timedOut` |
|
|
857
|
+
|
|
858
|
+
A caller that wants the old shape still writes `await runtime.close(…)` and
|
|
859
|
+
ignores the result. A caller deciding whether to exit the process reads it.
|
|
860
|
+
Durably queued records rejected from the local queue remain recoverable through
|
|
861
|
+
`scanRecoverable`; close never marks them terminal on its own.
|
|
862
|
+
|
|
863
|
+
Use `await runtime.interrupt({ conversationId, runId })` when the interruption
|
|
864
|
+
must be durable: it first commits `interrupt_requested`, then aborts the local
|
|
865
|
+
coordinator signal. If provider completion races that revision change, the terminal path reloads
|
|
866
|
+
the canonical snapshot. An already-terminal winner settles the ticket directly; a still-owned
|
|
867
|
+
`interrupt_requested` run is committed as `interrupted`, and unrelated aggregate-head conflicts
|
|
868
|
+
remain retriable while the run is active with the same owner and fencing token. A stale owner or
|
|
869
|
+
fencing token remains a conflict. Only the execution that applies the terminal mutation publishes the
|
|
870
|
+
**delivery** `terminal` event — a loser settles from canonical state without republishing the turn,
|
|
871
|
+
and its `AgentRuntimeResult.metrics` is `undefined`. The **operator** `run-terminal` event is not
|
|
872
|
+
gated that way: a losing execution still ran, and still spent whatever it spent, so it reports its
|
|
873
|
+
own usage. The two channels answer to different readers — delivering a turn twice is a user's
|
|
874
|
+
problem, and omitting a run's cost is an operator's.
|
|
875
|
+
`runtime.stop(key)` is the process-local signal-only escape hatch.
|
|
876
|
+
|
|
877
|
+
When an operator has positive evidence that another process owning one known
|
|
878
|
+
run is gone, close that run through the runtime boundary rather than updating
|
|
879
|
+
an adapter table or JSON payload directly:
|
|
880
|
+
|
|
881
|
+
```ts
|
|
882
|
+
await runtime.abandon({
|
|
883
|
+
conversationId,
|
|
884
|
+
runId,
|
|
885
|
+
expectedRevision: run.revision,
|
|
886
|
+
staleOwner: true,
|
|
887
|
+
})
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
The revision protects against stale operator evidence. The mutation updates the
|
|
891
|
+
canonical run and failed assistant atomically, removes the run from recovery
|
|
892
|
+
indexes, and publishes the resulting `run-state`. A run that moved since it was
|
|
893
|
+
read returns a conflict; `staleOwner: true` is mandatory evidence, not a default.
|