stitchkit 0.93.0 → 0.94.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +198 -0
- package/README.md +5 -2
- package/dist/agent-runtime/children-control.d.ts +6 -0
- package/dist/agent-runtime/children-control.d.ts.map +1 -0
- package/dist/agent-runtime/children-spawn.d.ts +6 -0
- package/dist/agent-runtime/children-spawn.d.ts.map +1 -0
- package/dist/agent-runtime/children-state.d.ts +46 -0
- package/dist/agent-runtime/children-state.d.ts.map +1 -0
- package/dist/agent-runtime/children-usage.d.ts +8 -0
- package/dist/agent-runtime/children-usage.d.ts.map +1 -0
- package/dist/agent-runtime/children.d.ts +11 -14
- package/dist/agent-runtime/children.d.ts.map +1 -1
- package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-contract.d.ts +2 -1
- package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
- package/dist/agent-runtime/contained-darwin.d.ts +38 -0
- package/dist/agent-runtime/contained-darwin.d.ts.map +1 -0
- package/dist/agent-runtime/contained-files.d.ts +11 -26
- package/dist/agent-runtime/contained-files.d.ts.map +1 -1
- package/dist/agent-runtime/contained-scan.d.ts +21 -0
- package/dist/agent-runtime/contained-scan.d.ts.map +1 -0
- package/dist/agent-runtime/contained-write.d.ts +9 -0
- package/dist/agent-runtime/contained-write.d.ts.map +1 -0
- package/dist/agent-runtime/deferred-tool-types.d.ts +4 -3
- package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
- package/dist/agent-runtime/events.d.ts +1 -1
- package/dist/agent-runtime/events.d.ts.map +1 -1
- package/dist/agent-runtime/harness-control.d.ts +0 -1
- package/dist/agent-runtime/harness-control.d.ts.map +1 -1
- package/dist/agent-runtime/harness.d.ts +0 -5
- package/dist/agent-runtime/harness.d.ts.map +1 -1
- package/dist/agent-runtime/managed-tools.d.ts +3 -2
- package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
- package/dist/agent-runtime/observability.d.ts +1 -1
- package/dist/agent-runtime/observability.d.ts.map +1 -1
- package/dist/agent-runtime/openrouter.d.ts +29 -0
- package/dist/agent-runtime/openrouter.d.ts.map +1 -0
- package/dist/agent-runtime/projections.d.ts +1 -1
- package/dist/agent-runtime/projections.d.ts.map +1 -1
- package/dist/agent-runtime/run-acquisition.d.ts +17 -0
- package/dist/agent-runtime/run-acquisition.d.ts.map +1 -0
- package/dist/agent-runtime/run-execution-state.d.ts +133 -0
- package/dist/agent-runtime/run-execution-state.d.ts.map +1 -0
- package/dist/agent-runtime/run-execution.d.ts +17 -33
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/run-failure.d.ts +18 -0
- package/dist/agent-runtime/run-failure.d.ts.map +1 -0
- package/dist/agent-runtime/run-model-attempts.d.ts +6 -0
- package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -0
- package/dist/agent-runtime/run-prompt-history.d.ts +58 -0
- package/dist/agent-runtime/run-prompt-history.d.ts.map +1 -0
- package/dist/agent-runtime/run-provider-ledger.d.ts +26 -0
- package/dist/agent-runtime/run-provider-ledger.d.ts.map +1 -0
- package/dist/agent-runtime/run-stream-parts.d.ts +17 -0
- package/dist/agent-runtime/run-stream-parts.d.ts.map +1 -0
- package/dist/agent-runtime/run-terminal.d.ts +11 -0
- package/dist/agent-runtime/run-terminal.d.ts.map +1 -0
- package/dist/agent-runtime/run-turn-preparation.d.ts +22 -0
- package/dist/agent-runtime/run-turn-preparation.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-admission-gate.d.ts +29 -0
- package/dist/agent-runtime/runtime-admission-gate.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-control.d.ts +9 -0
- package/dist/agent-runtime/runtime-control.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-recovery.d.ts +10 -0
- package/dist/agent-runtime/runtime-recovery.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-state.d.ts +36 -0
- package/dist/agent-runtime/runtime-state.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-submit.d.ts +5 -0
- package/dist/agent-runtime/runtime-submit.d.ts.map +1 -0
- package/dist/agent-runtime/runtime.d.ts +10 -5
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/schedule-records.d.ts +34 -0
- package/dist/agent-runtime/schedule-records.d.ts.map +1 -0
- package/dist/agent-runtime/schedules.d.ts +34 -0
- package/dist/agent-runtime/schedules.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite-bun.d.ts +12 -0
- package/dist/agent-runtime/sqlite-bun.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-events.d.ts +5 -0
- package/dist/agent-runtime/sqlite-events.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-history.d.ts +7 -0
- package/dist/agent-runtime/sqlite-history.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-ledger.d.ts +7 -0
- package/dist/agent-runtime/sqlite-ledger.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-node.d.ts +12 -0
- package/dist/agent-runtime/sqlite-node.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-reads.d.ts +14 -0
- package/dist/agent-runtime/sqlite-reads.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-rows.d.ts +178 -0
- package/dist/agent-runtime/sqlite-rows.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-schema.d.ts +7 -0
- package/dist/agent-runtime/sqlite-schema.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-transactions.d.ts +25 -0
- package/dist/agent-runtime/sqlite-transactions.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite.d.ts +10 -6
- package/dist/agent-runtime/sqlite.d.ts.map +1 -1
- package/dist/agent-runtime/store-archive.d.ts +16 -0
- package/dist/agent-runtime/store-archive.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +434 -0
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-ordering.d.ts +18 -0
- package/dist/agent-runtime/store-conformance-ordering.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-support.d.ts +130 -0
- package/dist/agent-runtime/store-conformance-support.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-terminal.d.ts +12 -0
- package/dist/agent-runtime/store-conformance-terminal.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance.d.ts +40 -0
- package/dist/agent-runtime/store-conformance.d.ts.map +1 -0
- package/dist/agent-runtime/store-create.d.ts +11 -0
- package/dist/agent-runtime/store-create.d.ts.map +1 -0
- package/dist/agent-runtime/store-driver-contract.d.ts +814 -0
- package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -0
- package/dist/agent-runtime/store-events.d.ts +7 -89
- package/dist/agent-runtime/store-events.d.ts.map +1 -1
- package/dist/agent-runtime/store-memory.d.ts +4 -0
- package/dist/agent-runtime/store-memory.d.ts.map +1 -0
- package/dist/agent-runtime/store-mutate.d.ts +13 -0
- package/dist/agent-runtime/store-mutate.d.ts.map +1 -0
- package/dist/agent-runtime/store-purge.d.ts +1 -1
- package/dist/agent-runtime/store-purge.d.ts.map +1 -1
- package/dist/agent-runtime/store-reads.d.ts +29 -0
- package/dist/agent-runtime/store-reads.d.ts.map +1 -0
- package/dist/agent-runtime/store-reduce-history.d.ts +10 -0
- package/dist/agent-runtime/store-reduce-history.d.ts.map +1 -0
- package/dist/agent-runtime/store-reduce-run.d.ts +14 -0
- package/dist/agent-runtime/store-reduce-run.d.ts.map +1 -0
- package/dist/agent-runtime/store-reduce-shared.d.ts +76 -0
- package/dist/agent-runtime/store-reduce-shared.d.ts.map +1 -0
- package/dist/agent-runtime/store-reduce-terminal.d.ts +6 -0
- package/dist/agent-runtime/store-reduce-terminal.d.ts.map +1 -0
- package/dist/agent-runtime/store-reducer.d.ts +24 -0
- package/dist/agent-runtime/store-reducer.d.ts.map +1 -0
- package/dist/agent-runtime/store-snapshot.d.ts +19 -0
- package/dist/agent-runtime/store-snapshot.d.ts.map +1 -0
- package/dist/agent-runtime/store.d.ts +1 -1
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/application/admission-rate.d.ts +21 -0
- package/dist/application/admission-rate.d.ts.map +1 -0
- package/dist/application/admission-run.d.ts +8 -0
- package/dist/application/admission-run.d.ts.map +1 -0
- package/dist/application/admission.d.ts +1 -1
- package/dist/application/admission.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-lock.d.ts +9 -34
- package/dist/application/diagnostic-journal-lock.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
- package/dist/application/events.d.ts +1 -1
- package/dist/application/events.d.ts.map +1 -1
- package/dist/application/file-state-store.d.ts +23 -0
- package/dist/application/file-state-store.d.ts.map +1 -0
- package/dist/application/health.d.ts +1 -1
- package/dist/application/health.d.ts.map +1 -1
- package/dist/application/kernel-admission.d.ts +8 -0
- package/dist/application/kernel-admission.d.ts.map +1 -0
- package/dist/application/kernel-contract.d.ts +142 -0
- package/dist/application/kernel-contract.d.ts.map +1 -0
- package/dist/application/kernel-resource-context.d.ts +24 -0
- package/dist/application/kernel-resource-context.d.ts.map +1 -0
- package/dist/application/kernel-restart.d.ts +5 -0
- package/dist/application/kernel-restart.d.ts.map +1 -0
- package/dist/application/kernel-rollback.d.ts +4 -0
- package/dist/application/kernel-rollback.d.ts.map +1 -0
- package/dist/application/kernel-shutdown.d.ts +6 -0
- package/dist/application/kernel-shutdown.d.ts.map +1 -0
- package/dist/application/kernel-start.d.ts +20 -0
- package/dist/application/kernel-start.d.ts.map +1 -0
- package/dist/application/kernel-state.d.ts +116 -0
- package/dist/application/kernel-state.d.ts.map +1 -0
- package/dist/application/kernel.d.ts +9 -140
- package/dist/application/kernel.d.ts.map +1 -1
- package/dist/application/latest-sink.d.ts +1 -1
- package/dist/application/latest-sink.d.ts.map +1 -1
- package/dist/application/notification-outbox.d.ts.map +1 -1
- package/dist/application/opentelemetry.d.ts +1 -1
- package/dist/application/opentelemetry.d.ts.map +1 -1
- package/dist/application/schedule.d.ts +0 -1
- package/dist/application/schedule.d.ts.map +1 -1
- package/dist/application/watch-hub-core.d.ts +122 -0
- package/dist/application/watch-hub-core.d.ts.map +1 -0
- package/dist/application/watch-hub.d.ts +3 -3
- package/dist/application/watch-hub.d.ts.map +1 -1
- package/dist/browser/client-executors.d.ts +14 -0
- package/dist/browser/client-executors.d.ts.map +1 -0
- package/dist/browser/client-multipart.d.ts +1 -1
- package/dist/browser/client-multipart.d.ts.map +1 -1
- package/dist/browser/client-url.d.ts +1 -1
- package/dist/browser/client-url.d.ts.map +1 -1
- package/dist/browser/client.d.ts +3 -2
- package/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/contract-stream.d.ts +1 -1
- package/dist/browser/contract-stream.d.ts.map +1 -1
- package/dist/browser/http-fetch.d.ts +22 -0
- package/dist/browser/http-fetch.d.ts.map +1 -0
- package/dist/browser/http.d.ts +2 -4
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/live-state-core.d.ts +63 -0
- package/dist/browser/live-state-core.d.ts.map +1 -0
- package/dist/browser/live-state.d.ts.map +1 -1
- package/dist/browser/realtime-client.d.ts +26 -0
- package/dist/browser/realtime-client.d.ts.map +1 -0
- package/dist/browser/resumable.d.ts +1 -28
- package/dist/browser/resumable.d.ts.map +1 -1
- package/dist/browser/retained.d.ts.map +1 -0
- package/dist/browser/socket-io-connection.d.ts +82 -0
- package/dist/browser/socket-io-connection.d.ts.map +1 -0
- package/dist/browser/socket-io-peer.d.ts +20 -0
- package/dist/browser/socket-io-peer.d.ts.map +1 -0
- package/dist/browser/socket-io-trace.d.ts +31 -0
- package/dist/browser/socket-io-trace.d.ts.map +1 -0
- package/dist/browser/socket-io.d.ts +24 -18
- package/dist/browser/socket-io.d.ts.map +1 -1
- package/dist/browser/stream.d.ts +14 -2
- package/dist/browser/stream.d.ts.map +1 -1
- package/dist/contract/client-types.d.ts +134 -0
- package/dist/contract/client-types.d.ts.map +1 -0
- package/dist/contract/define-validation.d.ts +30 -0
- package/dist/contract/define-validation.d.ts.map +1 -0
- package/dist/contract/define.d.ts +47 -394
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/normalize.d.ts +56 -0
- package/dist/contract/normalize.d.ts.map +1 -0
- package/dist/contract/runtime-context.d.ts +131 -0
- package/dist/contract/runtime-context.d.ts.map +1 -0
- package/dist/contract/tool-options.d.ts +105 -0
- package/dist/contract/tool-options.d.ts.map +1 -0
- package/dist/contract/tool-view.d.ts +148 -0
- package/dist/contract/tool-view.d.ts.map +1 -0
- package/dist/declaration/declaration.d.ts.map +1 -0
- package/dist/durability/contract.d.ts +259 -0
- package/dist/durability/contract.d.ts.map +1 -0
- package/dist/durability/effect.d.ts +24 -0
- package/dist/durability/effect.d.ts.map +1 -0
- package/dist/durability/engine.d.ts +14 -0
- package/dist/durability/engine.d.ts.map +1 -0
- package/dist/durability/events.d.ts +103 -0
- package/dist/durability/events.d.ts.map +1 -0
- package/dist/durability/json.d.ts +3 -0
- package/dist/durability/json.d.ts.map +1 -0
- package/dist/durability/ledger.d.ts +27 -0
- package/dist/durability/ledger.d.ts.map +1 -0
- package/dist/durability/parks.d.ts +22 -0
- package/dist/durability/parks.d.ts.map +1 -0
- package/dist/durability/scheduler.d.ts +30 -0
- package/dist/durability/scheduler.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/browser.d.ts +5 -0
- package/dist/entrypoints/agent-runtime/browser.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/browser.js +124 -0
- package/dist/entrypoints/agent-runtime/coding-tools.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/coding-tools.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/coding-tools.js +22 -0
- package/dist/entrypoints/agent-runtime/harness.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/harness.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/harness.js +739 -0
- package/dist/entrypoints/agent-runtime/openrouter.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/openrouter.js +270 -0
- package/dist/entrypoints/agent-runtime/sandbox.d.ts +5 -0
- package/dist/entrypoints/agent-runtime/sandbox.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/sandbox.js +797 -0
- package/dist/entrypoints/agent-runtime/sqlite/bun.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/sqlite/bun.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +44 -0
- package/dist/entrypoints/agent-runtime/sqlite/node.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/sqlite/node.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/sqlite/node.js +46 -0
- package/dist/entrypoints/agent-runtime/testing.d.ts +4 -0
- package/dist/entrypoints/agent-runtime/testing.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/testing.js +1116 -0
- package/dist/entrypoints/agent-runtime.d.ts +42 -0
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime.js +2670 -0
- package/dist/entrypoints/application/diagnostic-journal.d.ts +21 -0
- package/dist/entrypoints/application/diagnostic-journal.d.ts.map +1 -0
- package/dist/entrypoints/application/diagnostic-journal.js +492 -0
- package/dist/entrypoints/application/grammy.d.ts +2 -0
- package/dist/entrypoints/application/grammy.d.ts.map +1 -0
- package/dist/entrypoints/application/grammy.js +169 -0
- package/dist/entrypoints/application/opentelemetry.d.ts +2 -0
- package/dist/entrypoints/application/opentelemetry.d.ts.map +1 -0
- package/dist/entrypoints/application/opentelemetry.js +250 -0
- package/dist/entrypoints/application/schemas.d.ts +15 -0
- package/dist/entrypoints/application/schemas.d.ts.map +1 -0
- package/dist/entrypoints/application/schemas.js +27 -0
- package/dist/entrypoints/application.d.ts +23 -0
- package/dist/entrypoints/application.d.ts.map +1 -0
- package/dist/entrypoints/application.js +2016 -0
- package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -0
- package/dist/entrypoints/bin/upgrade-cli.js +177 -0
- package/dist/entrypoints/cli.d.ts +44 -0
- package/dist/entrypoints/cli.d.ts.map +1 -0
- package/dist/entrypoints/cli.js +773 -0
- package/dist/entrypoints/contract.d.ts +12 -0
- package/dist/entrypoints/contract.d.ts.map +1 -0
- package/dist/entrypoints/contract.js +64 -0
- package/dist/entrypoints/declaration.d.ts +2 -0
- package/dist/entrypoints/declaration.d.ts.map +1 -0
- package/dist/entrypoints/declaration.js +183 -0
- package/dist/entrypoints/files.d.ts +5 -0
- package/dist/entrypoints/files.d.ts.map +1 -0
- package/dist/entrypoints/files.js +111 -0
- package/dist/entrypoints/geo.d.ts +3 -0
- package/dist/entrypoints/geo.d.ts.map +1 -0
- package/dist/entrypoints/geo.js +245 -0
- package/dist/entrypoints/google.d.ts +2 -0
- package/dist/entrypoints/google.d.ts.map +1 -0
- package/dist/entrypoints/google.js +175 -0
- package/dist/entrypoints/index.d.ts +17 -0
- package/dist/entrypoints/index.d.ts.map +1 -0
- package/dist/entrypoints/index.js +764 -0
- package/dist/entrypoints/live.d.ts +19 -0
- package/dist/entrypoints/live.d.ts.map +1 -0
- package/dist/entrypoints/live.js +302 -0
- package/dist/entrypoints/node.d.ts +19 -0
- package/dist/entrypoints/node.d.ts.map +1 -0
- package/dist/entrypoints/node.js +308 -0
- package/dist/entrypoints/oauth.d.ts +2 -0
- package/dist/entrypoints/oauth.d.ts.map +1 -0
- package/dist/entrypoints/oauth.js +170 -0
- package/dist/entrypoints/observability.d.ts +19 -0
- package/dist/entrypoints/observability.d.ts.map +1 -0
- package/dist/entrypoints/observability.js +567 -0
- package/dist/entrypoints/primitives.d.ts +3 -0
- package/dist/entrypoints/primitives.d.ts.map +1 -0
- package/dist/entrypoints/primitives.js +749 -0
- package/dist/entrypoints/react.d.ts +5 -0
- package/dist/entrypoints/react.d.ts.map +1 -0
- package/dist/entrypoints/react.js +403 -0
- package/dist/entrypoints/release.d.ts +15 -0
- package/dist/entrypoints/release.d.ts.map +1 -0
- package/dist/entrypoints/release.js +196 -0
- package/dist/entrypoints/remote.d.ts +9 -0
- package/dist/entrypoints/remote.d.ts.map +1 -0
- package/dist/entrypoints/remote.js +66 -0
- package/dist/entrypoints/server.d.ts +39 -0
- package/dist/entrypoints/server.d.ts.map +1 -0
- package/dist/entrypoints/server.js +2009 -0
- package/dist/entrypoints/telegram.d.ts +3 -0
- package/dist/entrypoints/telegram.d.ts.map +1 -0
- package/dist/entrypoints/telegram.js +224 -0
- package/dist/entrypoints/testing.d.ts +10 -0
- package/dist/entrypoints/testing.d.ts.map +1 -0
- package/dist/entrypoints/testing.js +1377 -0
- package/dist/entrypoints/tools/connections.d.ts +19 -0
- package/dist/entrypoints/tools/connections.d.ts.map +1 -0
- package/dist/entrypoints/tools/connections.js +1110 -0
- package/dist/entrypoints/tools/contract.d.ts +29 -0
- package/dist/entrypoints/tools/contract.d.ts.map +1 -0
- package/dist/entrypoints/tools/contract.js +24 -0
- package/dist/entrypoints/tools/invoker.d.ts +9 -0
- package/dist/entrypoints/tools/invoker.d.ts.map +1 -0
- package/dist/entrypoints/tools/invoker.js +20 -0
- package/dist/entrypoints/tools.d.ts +54 -0
- package/dist/entrypoints/tools.d.ts.map +1 -0
- package/dist/entrypoints/tools.js +3009 -0
- package/dist/entrypoints/tracking/server.d.ts +15 -0
- package/dist/entrypoints/tracking/server.d.ts.map +1 -0
- package/dist/entrypoints/tracking.d.ts +24 -0
- package/dist/entrypoints/tracking.d.ts.map +1 -0
- package/dist/entrypoints/tracking.js +1140 -0
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files/file-io.d.ts +14 -0
- package/dist/files/file-io.d.ts.map +1 -0
- package/dist/google/google.d.ts.map +1 -0
- package/dist/index-0b1ess5e.js +38 -0
- package/dist/index-1j8pm5t0.js +412 -0
- package/dist/index-1zbbzgfh.js +89 -0
- package/dist/index-2bxbyab0.js +47 -0
- package/dist/index-2gxzjvyr.js +266 -0
- package/dist/index-35mh5bhj.js +177 -0
- package/dist/index-48ffdxgk.js +6 -0
- package/dist/index-4gcnakhx.js +82 -0
- package/dist/index-55hkhm67.js +343 -0
- package/dist/index-79z7m7dt.js +675 -0
- package/dist/index-7f68ghdn.js +3618 -0
- package/dist/index-7p1f0vp2.js +154 -0
- package/dist/index-83bdg97s.js +16 -0
- package/dist/index-863ea9jb.js +154 -0
- package/dist/index-8p52kd5p.js +242 -0
- package/dist/index-d9pk3td4.js +326 -0
- package/dist/index-dce5wxcq.js +63 -0
- package/dist/index-e01r054k.js +105 -0
- package/dist/index-ensd0r74.js +595 -0
- package/dist/index-eqqvgdb3.js +46 -0
- package/dist/index-gxrt5h6v.js +341 -0
- package/dist/index-h6eeys1v.js +211 -0
- package/dist/index-ham5sz8m.js +734 -0
- package/dist/index-het2he5g.js +1387 -0
- package/dist/index-hffjpmq9.js +30 -0
- package/dist/index-hmp4800j.js +51 -0
- package/dist/index-k30h66yd.js +317 -0
- package/dist/index-k5hsfc3j.js +31 -0
- package/dist/index-khtgb21r.js +92 -0
- package/dist/index-m9zn6cpq.js +51 -0
- package/dist/index-ndddxtyx.js +324 -0
- package/dist/index-ngfhvfpd.js +30 -0
- package/dist/index-np4m8hd3.js +1205 -0
- package/dist/index-p3vsv1fb.js +3493 -0
- package/dist/index-p5r7qpdd.js +85 -0
- package/dist/index-p9e0w8hs.js +1084 -0
- package/dist/index-p9sh0xx4.js +64 -0
- package/dist/index-paz6sgdp.js +371 -0
- package/dist/index-px2gm2jp.js +448 -0
- package/dist/index-qwhynv6x.js +103 -0
- package/dist/index-s812ycat.js +65 -0
- package/dist/index-sp1tzwnb.js +281 -0
- package/dist/index-t9rhjr9f.js +2306 -0
- package/dist/index-v260df89.js +342 -0
- package/dist/index-w906953s.js +946 -0
- package/dist/index-wdkt63w3.js +214 -0
- package/dist/index-wqgjfstn.js +18 -0
- package/dist/index-wsm5w4ee.js +1023 -0
- package/dist/index-xw3s75nj.js +100 -0
- package/dist/index-yw4fzmdz.js +268 -0
- package/dist/index-zfrhfn82.js +85 -0
- package/dist/index-znfs20ss.js +98 -0
- package/dist/internal/atomic-file.d.ts +23 -2
- package/dist/internal/atomic-file.d.ts.map +1 -1
- package/dist/internal/backoff.d.ts +29 -0
- package/dist/internal/backoff.d.ts.map +1 -0
- package/dist/internal/canonical-json.d.ts +21 -11
- package/dist/internal/canonical-json.d.ts.map +1 -1
- package/dist/internal/channel.d.ts.map +1 -0
- package/dist/internal/exclusive-lock.d.ts +51 -0
- package/dist/internal/exclusive-lock.d.ts.map +1 -0
- package/dist/internal/logger.d.ts.map +1 -0
- package/dist/internal/process-identity.d.ts +47 -0
- package/dist/internal/process-identity.d.ts.map +1 -0
- package/dist/internal/request.d.ts.map +1 -0
- package/dist/internal/stable-digest.d.ts +0 -43
- package/dist/internal/stable-digest.d.ts.map +1 -1
- package/dist/internal/typed.d.ts +0 -8
- package/dist/internal/typed.d.ts.map +1 -1
- package/dist/internal/with-exclusive-lock.d.ts +67 -0
- package/dist/internal/with-exclusive-lock.d.ts.map +1 -0
- package/dist/internal/zod-issues.d.ts +38 -0
- package/dist/internal/zod-issues.d.ts.map +1 -0
- package/dist/json-schema/dialect.d.ts +17 -0
- package/dist/json-schema/dialect.d.ts.map +1 -0
- package/dist/json-schema/json-schema.d.ts.map +1 -0
- package/dist/live/watch-client.d.ts.map +1 -1
- package/dist/live/watch-delta.d.ts.map +1 -1
- package/dist/oauth/authorization-code.d.ts +57 -0
- package/dist/oauth/authorization-code.d.ts.map +1 -0
- package/dist/observability/audit.d.ts +3 -3
- package/dist/observability/audit.d.ts.map +1 -1
- package/dist/observability/bounded-logger.d.ts +1 -1
- package/dist/observability/bounded-logger.d.ts.map +1 -1
- package/dist/observability/bounded-sink.d.ts +81 -0
- package/dist/observability/bounded-sink.d.ts.map +1 -0
- package/dist/observability/context.d.ts +1 -1
- package/dist/observability/context.d.ts.map +1 -1
- package/dist/observability/event.d.ts +2 -1
- package/dist/observability/event.d.ts.map +1 -1
- package/dist/observability/work.d.ts +1 -1
- package/dist/observability/work.d.ts.map +1 -1
- package/dist/primitives/audit.d.ts +1 -1
- package/dist/primitives/audit.d.ts.map +1 -1
- package/dist/primitives/export-operation.d.ts +4 -2
- package/dist/primitives/export-operation.d.ts.map +1 -1
- package/dist/realtime/registry.d.ts +0 -5
- package/dist/realtime/registry.d.ts.map +1 -1
- package/dist/realtime/socket.d.ts +1 -1
- package/dist/realtime/socket.d.ts.map +1 -1
- package/dist/server/bun.d.ts +0 -1
- package/dist/server/bun.d.ts.map +1 -1
- package/dist/server/context-contribution.d.ts +1 -1
- package/dist/server/context-contribution.d.ts.map +1 -1
- package/dist/server/context.d.ts +2 -2
- package/dist/server/context.d.ts.map +1 -1
- package/dist/server/contract-method.d.ts +15 -0
- package/dist/server/contract-method.d.ts.map +1 -0
- package/dist/server/contract-stream.d.ts +1 -1
- package/dist/server/contract-stream.d.ts.map +1 -1
- package/dist/server/create.d.ts +8 -0
- package/dist/server/create.d.ts.map +1 -1
- package/dist/server/endpoint-dispatch.d.ts +10 -0
- package/dist/server/endpoint-dispatch.d.ts.map +1 -0
- package/dist/server/endpoint-response.d.ts +19 -0
- package/dist/server/endpoint-response.d.ts.map +1 -0
- package/dist/server/error-dispatch.d.ts +17 -1
- package/dist/server/error-dispatch.d.ts.map +1 -1
- package/dist/server/error-hook.d.ts +2 -2
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/server/handler-state.d.ts +44 -0
- package/dist/server/handler-state.d.ts.map +1 -0
- package/dist/server/implement-registry.d.ts +54 -0
- package/dist/server/implement-registry.d.ts.map +1 -0
- package/dist/server/implement.d.ts +9 -55
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/middleware/auth.d.ts +1 -31
- package/dist/server/middleware/auth.d.ts.map +1 -1
- package/dist/server/middleware/cors.d.ts +17 -0
- package/dist/server/middleware/cors.d.ts.map +1 -1
- package/dist/server/middleware/jwt.d.ts +31 -0
- package/dist/server/middleware/jwt.d.ts.map +1 -0
- package/dist/server/middleware/trust-fence.d.ts +1 -1
- package/dist/server/middleware/trust-fence.d.ts.map +1 -1
- package/dist/server/multipart-reader.d.ts +22 -0
- package/dist/server/multipart-reader.d.ts.map +1 -0
- package/dist/server/multipart.d.ts +1 -1
- package/dist/server/multipart.d.ts.map +1 -1
- package/dist/server/oauth/cimd.d.ts +88 -0
- package/dist/server/oauth/cimd.d.ts.map +1 -0
- package/dist/server/oauth/endpoints.d.ts +39 -0
- package/dist/server/oauth/endpoints.d.ts.map +1 -0
- package/dist/server/oauth/metadata.d.ts +28 -0
- package/dist/server/oauth/metadata.d.ts.map +1 -0
- package/dist/server/oauth/provider.d.ts +117 -0
- package/dist/server/oauth/provider.d.ts.map +1 -0
- package/dist/server/realtime.d.ts +1 -1
- package/dist/server/realtime.d.ts.map +1 -1
- package/dist/server/request-completion.d.ts +16 -0
- package/dist/server/request-completion.d.ts.map +1 -0
- package/dist/server/response-metadata.d.ts +1 -1
- package/dist/server/response-metadata.d.ts.map +1 -1
- package/dist/server/route-table.d.ts +9 -0
- package/dist/server/route-table.d.ts.map +1 -0
- package/dist/server/stream.d.ts +0 -13
- package/dist/server/stream.d.ts.map +1 -1
- package/dist/server/streaming-pump.d.ts +66 -0
- package/dist/server/streaming-pump.d.ts.map +1 -0
- package/dist/server/streaming-route.d.ts +12 -5
- package/dist/server/streaming-route.d.ts.map +1 -1
- package/dist/server/types.d.ts +10 -4
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/unix-client-bun.d.ts.map +1 -1
- package/dist/server/unix-client-http1.d.ts +76 -0
- package/dist/server/unix-client-http1.d.ts.map +1 -0
- package/dist/server/unix-client.d.ts.map +1 -1
- package/dist/testing/handler-clients.d.ts +32 -0
- package/dist/testing/handler-clients.d.ts.map +1 -0
- package/dist/testing/managed-resource-conformance-scenarios.d.ts.map +1 -1
- package/dist/testing/realtime-probe.d.ts +33 -0
- package/dist/testing/realtime-probe.d.ts.map +1 -0
- package/dist/testing/surface-conformance.d.ts +2 -32
- package/dist/testing/surface-conformance.d.ts.map +1 -1
- package/dist/testing/surface-manifest-digest.d.ts +44 -0
- package/dist/testing/surface-manifest-digest.d.ts.map +1 -0
- package/dist/testing/surface-manifest.d.ts +30 -4
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/tools/agent.d.ts +1 -1
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/cli/args-fields.d.ts +31 -0
- package/dist/tools/cli/args-fields.d.ts.map +1 -0
- package/dist/tools/cli/args-route.d.ts +42 -0
- package/dist/tools/cli/args-route.d.ts.map +1 -0
- package/dist/tools/cli/args-view.d.ts +32 -0
- package/dist/tools/cli/args-view.d.ts.map +1 -0
- package/dist/tools/cli/args.d.ts +80 -0
- package/dist/tools/cli/args.d.ts.map +1 -0
- package/dist/tools/cli/argument-error.d.ts +5 -0
- package/dist/tools/cli/argument-error.d.ts.map +1 -0
- package/dist/tools/cli/checkpoint.d.ts +24 -0
- package/dist/tools/cli/checkpoint.d.ts.map +1 -0
- package/dist/tools/cli/command.d.ts +70 -0
- package/dist/tools/cli/command.d.ts.map +1 -0
- package/dist/tools/cli/config.d.ts +90 -0
- package/dist/tools/cli/config.d.ts.map +1 -0
- package/dist/tools/cli/create-cli.d.ts +36 -0
- package/dist/tools/cli/create-cli.d.ts.map +1 -0
- package/dist/tools/cli/download.d.ts +8 -0
- package/dist/tools/cli/download.d.ts.map +1 -0
- package/dist/tools/cli/format.d.ts +50 -0
- package/dist/tools/cli/format.d.ts.map +1 -0
- package/dist/tools/cli/help.d.ts +24 -0
- package/dist/tools/cli/help.d.ts.map +1 -0
- package/dist/tools/cli/installer.d.ts +34 -0
- package/dist/tools/cli/installer.d.ts.map +1 -0
- package/dist/tools/cli/invoke.d.ts +144 -0
- package/dist/tools/cli/invoke.d.ts.map +1 -0
- package/dist/tools/cli/io.d.ts +10 -0
- package/dist/tools/cli/io.d.ts.map +1 -0
- package/dist/tools/cli/managed-surface.d.ts +30 -0
- package/dist/tools/cli/managed-surface.d.ts.map +1 -0
- package/dist/tools/cli/manifest.d.ts +80 -0
- package/dist/tools/cli/manifest.d.ts.map +1 -0
- package/dist/tools/cli/policy.d.ts +27 -0
- package/dist/tools/cli/policy.d.ts.map +1 -0
- package/dist/tools/cli/prepare.d.ts +14 -0
- package/dist/tools/cli/prepare.d.ts.map +1 -0
- package/dist/tools/cli/profile.d.ts +40 -0
- package/dist/tools/cli/profile.d.ts.map +1 -0
- package/dist/tools/cli/run-managed.d.ts +5 -0
- package/dist/tools/cli/run-managed.d.ts.map +1 -0
- package/dist/tools/cli/run-native.d.ts +9 -0
- package/dist/tools/cli/run-native.d.ts.map +1 -0
- package/dist/tools/cli/session.d.ts +40 -0
- package/dist/tools/cli/session.d.ts.map +1 -0
- package/dist/tools/cli/signature.d.ts +81 -0
- package/dist/tools/cli/signature.d.ts.map +1 -0
- package/dist/tools/cli/stream.d.ts +93 -0
- package/dist/tools/cli/stream.d.ts.map +1 -0
- package/dist/tools/cli/update.d.ts +145 -0
- package/dist/tools/cli/update.d.ts.map +1 -0
- package/dist/tools/cli/view.d.ts +12 -0
- package/dist/tools/cli/view.d.ts.map +1 -0
- package/dist/tools/cli/wait.d.ts +54 -0
- package/dist/tools/cli/wait.d.ts.map +1 -0
- package/dist/tools/connections/runtime.d.ts +1 -1
- package/dist/tools/connections/runtime.d.ts.map +1 -1
- package/dist/tools/connections/types.d.ts +3 -3
- package/dist/tools/connections/types.d.ts.map +1 -1
- package/dist/tools/durability-context.d.ts +1 -1
- package/dist/tools/durability-context.d.ts.map +1 -1
- package/dist/tools/execute-args.d.ts +23 -0
- package/dist/tools/execute-args.d.ts.map +1 -0
- package/dist/tools/execute-hooks.d.ts +146 -0
- package/dist/tools/execute-hooks.d.ts.map +1 -0
- package/dist/tools/execute-result.d.ts +40 -0
- package/dist/tools/execute-result.d.ts.map +1 -0
- package/dist/tools/execute.d.ts +31 -193
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/internal/surface-projector.d.ts +9 -6
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/internal/tool-view.d.ts +41 -0
- package/dist/tools/internal/tool-view.d.ts.map +1 -0
- package/dist/tools/invoker.d.ts +13 -4
- package/dist/tools/invoker.d.ts.map +1 -1
- package/dist/tools/lifecycle.d.ts +1 -1
- package/dist/tools/lifecycle.d.ts.map +1 -1
- package/dist/tools/list-names.d.ts +3 -3
- package/dist/tools/list-names.d.ts.map +1 -1
- package/dist/tools/manifest.d.ts +2 -2
- package/dist/tools/manifest.d.ts.map +1 -1
- package/dist/tools/mcp/app.d.ts +62 -0
- package/dist/tools/mcp/app.d.ts.map +1 -0
- package/dist/tools/mcp/catalog.d.ts +68 -0
- package/dist/tools/mcp/catalog.d.ts.map +1 -0
- package/dist/tools/mcp/handler.d.ts +46 -0
- package/dist/tools/mcp/handler.d.ts.map +1 -0
- package/dist/tools/mcp/mount.d.ts +152 -0
- package/dist/tools/mcp/mount.d.ts.map +1 -0
- package/dist/tools/mcp/prepare.d.ts +76 -0
- package/dist/tools/mcp/prepare.d.ts.map +1 -0
- package/dist/tools/mcp/progress.d.ts +46 -0
- package/dist/tools/mcp/progress.d.ts.map +1 -0
- package/dist/tools/mcp/register.d.ts +36 -0
- package/dist/tools/mcp/register.d.ts.map +1 -0
- package/dist/tools/mcp/round-context.d.ts +38 -0
- package/dist/tools/mcp/round-context.d.ts.map +1 -0
- package/dist/tools/mcp/round-policy.d.ts +33 -0
- package/dist/tools/mcp/round-policy.d.ts.map +1 -0
- package/dist/tools/mcp/round.d.ts +53 -0
- package/dist/tools/mcp/round.d.ts.map +1 -0
- package/dist/tools/mcp/runtime-tools.d.ts +25 -0
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -0
- package/dist/tools/mcp/stdio-signals.d.ts +33 -0
- package/dist/tools/mcp/stdio-signals.d.ts.map +1 -0
- package/dist/tools/mcp/stdio.d.ts +20 -0
- package/dist/tools/mcp/stdio.d.ts.map +1 -0
- package/dist/tools/mcp/trace.d.ts +12 -0
- package/dist/tools/mcp/trace.d.ts.map +1 -0
- package/dist/tools/mount.d.ts +14 -7
- package/dist/tools/mount.d.ts.map +1 -1
- package/dist/tools/native-definition.d.ts +4 -3
- package/dist/tools/native-definition.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-binding-types.d.ts +127 -0
- package/dist/tools/operations/async-operation-binding-types.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-binding.d.ts +28 -0
- package/dist/tools/operations/async-operation-binding.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-canonical-types.d.ts +110 -0
- package/dist/tools/operations/async-operation-canonical-types.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-canonical.d.ts +7 -0
- package/dist/tools/operations/async-operation-canonical.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-contract.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-id.d.ts +23 -0
- package/dist/tools/operations/async-operation-id.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-runtime-tools.d.ts +41 -0
- package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-runtime-types.d.ts +69 -0
- package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-runtime.d.ts +5 -0
- package/dist/tools/operations/async-operation-runtime.d.ts.map +1 -0
- package/dist/tools/operations/define-wait-tool.d.ts +22 -0
- package/dist/tools/operations/define-wait-tool.d.ts.map +1 -0
- package/dist/tools/operations/mount-wait.d.ts.map +1 -0
- package/dist/tools/operations/wait-core.d.ts.map +1 -0
- package/dist/tools/remote.d.ts +1 -1
- package/dist/tools/remote.d.ts.map +1 -1
- package/dist/tools/runtime-tool.d.ts +13 -4
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools/schema/coerce.d.ts.map +1 -0
- package/dist/tools/schema/flatten-join.d.ts.map +1 -0
- package/dist/tools/schema/flatten.d.ts.map +1 -0
- package/dist/tools/schema/portable-formats.d.ts.map +1 -0
- package/dist/tools/schema/presentation.d.ts +24 -0
- package/dist/tools/schema/presentation.d.ts.map +1 -0
- package/dist/tools/schema/schema.d.ts.map +1 -0
- package/dist/tools/schema/untyped-properties.d.ts.map +1 -0
- package/dist/tools/surface.d.ts +2 -3
- package/dist/tools/surface.d.ts.map +1 -1
- package/dist/tools/tool-logger.d.ts +1 -1
- package/dist/tools/tool-logger.d.ts.map +1 -1
- package/dist/tools/toolkit.d.ts +4 -4
- package/dist/tools/toolkit.d.ts.map +1 -1
- package/dist/tools/transfer/define-download-tool.d.ts +18 -0
- package/dist/tools/transfer/define-download-tool.d.ts.map +1 -0
- package/dist/tools/transfer/define-upload-tool.d.ts +16 -0
- package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -0
- package/dist/tools/transfer/define-view-file-tool.d.ts +10 -0
- package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -0
- package/dist/tools/transfer/download-core.d.ts +20 -0
- package/dist/tools/transfer/download-core.d.ts.map +1 -0
- package/dist/tools/transfer/managed-file-error.d.ts +6 -0
- package/dist/tools/transfer/managed-file-error.d.ts.map +1 -0
- package/dist/tools/transfer/mount-download.d.ts +41 -0
- package/dist/tools/transfer/mount-download.d.ts.map +1 -0
- package/dist/tools/transfer/mount-upload.d.ts +21 -0
- package/dist/tools/transfer/mount-upload.d.ts.map +1 -0
- package/dist/tools/transfer/native-result.d.ts.map +1 -0
- package/dist/tools/transfer/upload-core.d.ts +4 -0
- package/dist/tools/transfer/upload-core.d.ts.map +1 -0
- package/dist/tools/transfer/view-file-contract.d.ts.map +1 -0
- package/dist/tools/transfer/view-file.d.ts +62 -0
- package/dist/tools/transfer/view-file.d.ts.map +1 -0
- package/dist/tools/transports.d.ts +1 -1
- package/dist/tools/transports.d.ts.map +1 -1
- package/dist/tracking/client-listeners.d.ts +30 -0
- package/dist/tracking/client-listeners.d.ts.map +1 -0
- package/dist/tracking/client-visit.d.ts +61 -0
- package/dist/tracking/client-visit.d.ts.map +1 -0
- package/dist/tracking/client.d.ts +3 -2
- package/dist/tracking/client.d.ts.map +1 -1
- package/dist/tracking/contract.d.ts +1 -1
- package/dist/tracking/contract.d.ts.map +1 -1
- package/llms/agent-runtime-browser.txt +33 -0
- package/llms/agent-runtime-coding-tools.txt +58 -0
- package/llms/agent-runtime-harness.txt +45 -0
- package/llms/agent-runtime-openrouter.txt +22 -0
- package/llms/agent-runtime-sandbox.txt +159 -0
- package/llms/agent-runtime-sqlite-bun.txt +29 -0
- package/llms/agent-runtime-sqlite-node.txt +26 -0
- package/llms/agent-runtime-testing.txt +30 -0
- package/llms/agent-runtime.2.txt +550 -0
- package/llms/agent-runtime.3.txt +311 -0
- package/llms/agent-runtime.txt +893 -0
- package/llms/application-diagnostic-journal.txt +30 -0
- package/llms/application-grammy.txt +27 -0
- package/llms/application-opentelemetry.txt +27 -0
- package/llms/application-schemas.txt +42 -0
- package/llms/application.2.txt +487 -0
- package/llms/application.txt +886 -0
- package/llms/cli.2.txt +80 -0
- package/llms/cli.txt +948 -0
- package/llms/contract.txt +606 -0
- package/llms/declaration.txt +286 -0
- package/llms/files.txt +33 -0
- package/llms/geo.txt +114 -0
- package/llms/google.txt +27 -0
- package/llms/live.txt +471 -0
- package/llms/node.txt +43 -0
- package/llms/oauth.txt +136 -0
- package/llms/observability.txt +893 -0
- package/llms/primitives.txt +158 -0
- package/llms/react.txt +184 -0
- package/llms/release.txt +176 -0
- package/llms/remote.txt +25 -0
- package/llms/server.2.txt +361 -0
- package/llms/server.3.txt +1031 -0
- package/llms/server.4.txt +905 -0
- package/llms/server.5.txt +250 -0
- package/llms/server.txt +996 -0
- package/llms/stitchkit.2.txt +836 -0
- package/llms/stitchkit.3.txt +147 -0
- package/llms/stitchkit.txt +260 -0
- package/llms/telegram.txt +30 -0
- package/llms/testing.txt +676 -0
- package/llms/tools-connections.txt +45 -0
- package/llms/tools-contract.txt +9 -0
- package/llms/tools-invoker.txt +9 -0
- package/llms/tools.2.txt +647 -0
- package/llms/tools.3.txt +288 -0
- package/llms/tools.txt +966 -0
- package/llms/tracking-server.txt +32 -0
- package/llms/tracking.txt +263 -0
- package/llms/upgrading-0.37.0-0.50.0.txt +947 -0
- package/llms/upgrading-0.53.0-0.67.0.txt +1174 -0
- package/llms/upgrading-0.68.0-0.94.0.txt +1159 -0
- package/llms/upgrading.txt +215 -0
- package/llms-full.txt +312 -77
- package/llms.txt +54 -5
- package/package.json +84 -83
- package/dist/agent-runtime/durability-contract.d.ts +0 -176
- package/dist/agent-runtime/durability-contract.d.ts.map +0 -1
- package/dist/agent-runtime/durability-json.d.ts +0 -3
- package/dist/agent-runtime/durability-json.d.ts.map +0 -1
- package/dist/agent-runtime/durability-ledger.d.ts +0 -16
- package/dist/agent-runtime/durability-ledger.d.ts.map +0 -1
- package/dist/agent-runtime/durability-scheduler.d.ts +0 -29
- package/dist/agent-runtime/durability-scheduler.d.ts.map +0 -1
- package/dist/agent-runtime/durability.d.ts +0 -14
- package/dist/agent-runtime/durability.d.ts.map +0 -1
- package/dist/agent-runtime/store-driver.d.ts +0 -814
- package/dist/agent-runtime/store-driver.d.ts.map +0 -1
- package/dist/agent-runtime-browser.d.ts +0 -5
- package/dist/agent-runtime-browser.d.ts.map +0 -1
- package/dist/agent-runtime-browser.js +0 -124
- package/dist/agent-runtime-coding-tools.d.ts +0 -2
- package/dist/agent-runtime-coding-tools.d.ts.map +0 -1
- package/dist/agent-runtime-coding-tools.js +0 -23
- package/dist/agent-runtime-harness.d.ts +0 -2
- package/dist/agent-runtime-harness.d.ts.map +0 -1
- package/dist/agent-runtime-harness.js +0 -729
- package/dist/agent-runtime-openrouter.d.ts +0 -29
- package/dist/agent-runtime-openrouter.d.ts.map +0 -1
- package/dist/agent-runtime-openrouter.js +0 -270
- package/dist/agent-runtime-sandbox.d.ts +0 -5
- package/dist/agent-runtime-sandbox.d.ts.map +0 -1
- package/dist/agent-runtime-sandbox.js +0 -798
- package/dist/agent-runtime-sqlite-bun.d.ts +0 -11
- package/dist/agent-runtime-sqlite-bun.d.ts.map +0 -1
- package/dist/agent-runtime-sqlite-bun.js +0 -42
- package/dist/agent-runtime-sqlite-node.d.ts +0 -11
- package/dist/agent-runtime-sqlite-node.d.ts.map +0 -1
- package/dist/agent-runtime-sqlite-node.js +0 -44
- package/dist/agent-runtime-testing.d.ts +0 -3
- package/dist/agent-runtime-testing.d.ts.map +0 -1
- package/dist/agent-runtime-testing.js +0 -156
- package/dist/agent-runtime.d.ts +0 -38
- package/dist/agent-runtime.d.ts.map +0 -1
- package/dist/agent-runtime.js +0 -2607
- package/dist/application/channel.d.ts.map +0 -1
- package/dist/application-diagnostic-journal.d.ts +0 -21
- package/dist/application-diagnostic-journal.d.ts.map +0 -1
- package/dist/application-diagnostic-journal.js +0 -632
- package/dist/application-grammy.d.ts +0 -2
- package/dist/application-grammy.d.ts.map +0 -1
- package/dist/application-grammy.js +0 -169
- package/dist/application-opentelemetry.d.ts +0 -2
- package/dist/application-opentelemetry.d.ts.map +0 -1
- package/dist/application-opentelemetry.js +0 -250
- package/dist/application-schemas.d.ts +0 -15
- package/dist/application-schemas.d.ts.map +0 -1
- package/dist/application-schemas.js +0 -27
- package/dist/application.d.ts +0 -22
- package/dist/application.d.ts.map +0 -1
- package/dist/application.js +0 -1977
- package/dist/cli.d.ts +0 -41
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -753
- package/dist/contract/index.d.ts +0 -8
- package/dist/contract/index.d.ts.map +0 -1
- package/dist/contract/index.js +0 -55
- package/dist/declaration.d.ts.map +0 -1
- package/dist/declaration.js +0 -183
- package/dist/files.d.ts +0 -3
- package/dist/files.d.ts.map +0 -1
- package/dist/files.js +0 -15
- package/dist/geo.d.ts +0 -3
- package/dist/geo.d.ts.map +0 -1
- package/dist/geo.js +0 -245
- package/dist/google.d.ts.map +0 -1
- package/dist/google.js +0 -175
- package/dist/index-0a349c33.js +0 -470
- package/dist/index-0j3vcp5m.js +0 -28
- package/dist/index-2c2bjw3s.js +0 -51
- package/dist/index-2na0qrfn.js +0 -214
- package/dist/index-2qzskm8h.js +0 -63
- package/dist/index-3bmnp41g.js +0 -2169
- package/dist/index-3xwxfj4z.js +0 -334
- package/dist/index-4fpa9dy2.js +0 -51
- package/dist/index-6kyksz9y.js +0 -268
- package/dist/index-77fekveh.js +0 -44
- package/dist/index-7gnkny4z.js +0 -326
- package/dist/index-7zbps32p.js +0 -89
- package/dist/index-9f8ztey6.js +0 -588
- package/dist/index-a11g2kry.js +0 -866
- package/dist/index-a916km3r.js +0 -45
- package/dist/index-actkayzn.js +0 -367
- package/dist/index-bn2cjajt.js +0 -524
- package/dist/index-bx75zwt7.js +0 -63
- package/dist/index-cby4ar3v.js +0 -46
- package/dist/index-cnyk6te3.js +0 -77
- package/dist/index-cxqhvq21.js +0 -413
- package/dist/index-e0znv5gn.js +0 -176
- package/dist/index-e42wzzz5.js +0 -154
- package/dist/index-f477k430.js +0 -324
- package/dist/index-f9mb610r.js +0 -177
- package/dist/index-fadnxwna.js +0 -1046
- package/dist/index-fq77yfzc.js +0 -1303
- package/dist/index-h9etkkyk.js +0 -1126
- package/dist/index-hrbajay7.js +0 -1196
- package/dist/index-kw9t5ayn.js +0 -507
- package/dist/index-mzvgxp0n.js +0 -80
- package/dist/index-n0f51dfn.js +0 -3170
- package/dist/index-p13mwz16.js +0 -16
- package/dist/index-s8cnx02s.js +0 -90
- package/dist/index-sr93cwf9.js +0 -325
- package/dist/index-tmwcrptx.js +0 -85
- package/dist/index-v5573g1k.js +0 -142
- package/dist/index-vjpvjqpn.js +0 -86
- package/dist/index-vk3kq9sb.js +0 -3344
- package/dist/index-wc4x00bn.js +0 -103
- package/dist/index-wnfk50r0.js +0 -211
- package/dist/index-yewwh1w4.js +0 -647
- package/dist/index-yn8remb1.js +0 -290
- package/dist/index-ywd0y6m1.js +0 -394
- package/dist/index-zwkgfq1s.js +0 -345
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -632
- package/dist/internal/errors.d.ts +0 -92
- package/dist/internal/errors.d.ts.map +0 -1
- package/dist/internal/observability-sink.d.ts +0 -81
- package/dist/internal/observability-sink.d.ts.map +0 -1
- package/dist/live.d.ts +0 -19
- package/dist/live.d.ts.map +0 -1
- package/dist/live.js +0 -282
- package/dist/logger.d.ts.map +0 -1
- package/dist/node.d.ts +0 -18
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -303
- package/dist/oauth.d.ts +0 -57
- package/dist/oauth.d.ts.map +0 -1
- package/dist/oauth.js +0 -170
- package/dist/observability/index.d.ts +0 -19
- package/dist/observability/index.d.ts.map +0 -1
- package/dist/observability/index.js +0 -569
- package/dist/primitives.d.ts +0 -3
- package/dist/primitives.d.ts.map +0 -1
- package/dist/primitives.js +0 -754
- package/dist/react.d.ts +0 -5
- package/dist/react.d.ts.map +0 -1
- package/dist/react.js +0 -403
- package/dist/release.d.ts +0 -15
- package/dist/release.d.ts.map +0 -1
- package/dist/release.js +0 -196
- package/dist/remote.d.ts +0 -9
- package/dist/remote.d.ts.map +0 -1
- package/dist/remote.js +0 -88
- package/dist/retained.d.ts.map +0 -1
- package/dist/server/file-state-store.d.ts +0 -23
- package/dist/server/file-state-store.d.ts.map +0 -1
- package/dist/server/index.d.ts +0 -36
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js +0 -1745
- package/dist/server/request.d.ts.map +0 -1
- package/dist/telegram.d.ts +0 -3
- package/dist/telegram.d.ts.map +0 -1
- package/dist/telegram.js +0 -224
- package/dist/testing/agent-store-conformance.d.ts +0 -40
- package/dist/testing/agent-store-conformance.d.ts.map +0 -1
- package/dist/testing.d.ts +0 -39
- package/dist/testing.d.ts.map +0 -1
- package/dist/testing.js +0 -2209
- package/dist/tool-invoker.d.ts +0 -9
- package/dist/tool-invoker.d.ts.map +0 -1
- package/dist/tool-invoker.js +0 -21
- package/dist/tools/async-operation-contract.d.ts.map +0 -1
- package/dist/tools/async-operation.d.ts +0 -332
- package/dist/tools/async-operation.d.ts.map +0 -1
- package/dist/tools/cli-args.d.ts +0 -143
- package/dist/tools/cli-args.d.ts.map +0 -1
- package/dist/tools/cli-checkpoint.d.ts +0 -24
- package/dist/tools/cli-checkpoint.d.ts.map +0 -1
- package/dist/tools/cli-command.d.ts +0 -70
- package/dist/tools/cli-command.d.ts.map +0 -1
- package/dist/tools/cli-format.d.ts +0 -49
- package/dist/tools/cli-format.d.ts.map +0 -1
- package/dist/tools/cli-installer.d.ts +0 -34
- package/dist/tools/cli-installer.d.ts.map +0 -1
- package/dist/tools/cli-invoke.d.ts +0 -143
- package/dist/tools/cli-invoke.d.ts.map +0 -1
- package/dist/tools/cli-manifest.d.ts +0 -80
- package/dist/tools/cli-manifest.d.ts.map +0 -1
- package/dist/tools/cli-policy.d.ts +0 -27
- package/dist/tools/cli-policy.d.ts.map +0 -1
- package/dist/tools/cli-profile.d.ts +0 -40
- package/dist/tools/cli-profile.d.ts.map +0 -1
- package/dist/tools/cli-signature.d.ts +0 -81
- package/dist/tools/cli-signature.d.ts.map +0 -1
- package/dist/tools/cli-stream.d.ts +0 -93
- package/dist/tools/cli-stream.d.ts.map +0 -1
- package/dist/tools/cli-update.d.ts +0 -126
- package/dist/tools/cli-update.d.ts.map +0 -1
- package/dist/tools/cli-view.d.ts +0 -12
- package/dist/tools/cli-view.d.ts.map +0 -1
- package/dist/tools/cli-wait.d.ts +0 -54
- package/dist/tools/cli-wait.d.ts.map +0 -1
- package/dist/tools/cli.d.ts +0 -94
- package/dist/tools/cli.d.ts.map +0 -1
- package/dist/tools/coerce.d.ts.map +0 -1
- package/dist/tools/connections/index.d.ts +0 -20
- package/dist/tools/connections/index.d.ts.map +0 -1
- package/dist/tools/connections/index.js +0 -1107
- package/dist/tools/define-download-tool.d.ts +0 -18
- package/dist/tools/define-download-tool.d.ts.map +0 -1
- package/dist/tools/define-upload-tool.d.ts +0 -16
- package/dist/tools/define-upload-tool.d.ts.map +0 -1
- package/dist/tools/define-view-file-tool.d.ts +0 -10
- package/dist/tools/define-view-file-tool.d.ts.map +0 -1
- package/dist/tools/define-wait-tool.d.ts +0 -22
- package/dist/tools/define-wait-tool.d.ts.map +0 -1
- package/dist/tools/download-core.d.ts +0 -20
- package/dist/tools/download-core.d.ts.map +0 -1
- package/dist/tools/flatten-join.d.ts.map +0 -1
- package/dist/tools/flatten.d.ts.map +0 -1
- package/dist/tools/json-schema-dialect.d.ts +0 -17
- package/dist/tools/json-schema-dialect.d.ts.map +0 -1
- package/dist/tools/json-schema.d.ts.map +0 -1
- package/dist/tools/managed-file-error.d.ts +0 -6
- package/dist/tools/managed-file-error.d.ts.map +0 -1
- package/dist/tools/mcp-app.d.ts +0 -62
- package/dist/tools/mcp-app.d.ts.map +0 -1
- package/dist/tools/mcp-catalog.d.ts +0 -68
- package/dist/tools/mcp-catalog.d.ts.map +0 -1
- package/dist/tools/mcp-handler.d.ts +0 -46
- package/dist/tools/mcp-handler.d.ts.map +0 -1
- package/dist/tools/mcp-prepare.d.ts +0 -75
- package/dist/tools/mcp-prepare.d.ts.map +0 -1
- package/dist/tools/mcp-progress.d.ts +0 -46
- package/dist/tools/mcp-progress.d.ts.map +0 -1
- package/dist/tools/mcp-round-policy.d.ts +0 -33
- package/dist/tools/mcp-round-policy.d.ts.map +0 -1
- package/dist/tools/mcp-round.d.ts +0 -61
- package/dist/tools/mcp-round.d.ts.map +0 -1
- package/dist/tools/mcp-stdio-signals.d.ts +0 -33
- package/dist/tools/mcp-stdio-signals.d.ts.map +0 -1
- package/dist/tools/mcp-stdio.d.ts +0 -20
- package/dist/tools/mcp-stdio.d.ts.map +0 -1
- package/dist/tools/mcp-trace.d.ts +0 -12
- package/dist/tools/mcp-trace.d.ts.map +0 -1
- package/dist/tools/mcp.d.ts +0 -152
- package/dist/tools/mcp.d.ts.map +0 -1
- package/dist/tools/mount-download.d.ts +0 -41
- package/dist/tools/mount-download.d.ts.map +0 -1
- package/dist/tools/mount-upload.d.ts +0 -21
- package/dist/tools/mount-upload.d.ts.map +0 -1
- package/dist/tools/mount-wait.d.ts.map +0 -1
- package/dist/tools/native-mcp.d.ts +0 -20
- package/dist/tools/native-mcp.d.ts.map +0 -1
- package/dist/tools/native-result.d.ts.map +0 -1
- package/dist/tools/oauth-metadata.d.ts +0 -28
- package/dist/tools/oauth-metadata.d.ts.map +0 -1
- package/dist/tools/oauth-provider.d.ts +0 -184
- package/dist/tools/oauth-provider.d.ts.map +0 -1
- package/dist/tools/portable-formats.d.ts.map +0 -1
- package/dist/tools/presentation.d.ts +0 -22
- package/dist/tools/presentation.d.ts.map +0 -1
- package/dist/tools/schema.d.ts.map +0 -1
- package/dist/tools/untyped-properties.d.ts.map +0 -1
- package/dist/tools/upload-core.d.ts +0 -4
- package/dist/tools/upload-core.d.ts.map +0 -1
- package/dist/tools/view-file-contract.d.ts.map +0 -1
- package/dist/tools/view-file.d.ts +0 -62
- package/dist/tools/view-file.d.ts.map +0 -1
- package/dist/tools/wait-core.d.ts.map +0 -1
- package/dist/tools-contract.d.ts +0 -29
- package/dist/tools-contract.d.ts.map +0 -1
- package/dist/tools-contract.js +0 -24
- package/dist/tools.d.ts +0 -50
- package/dist/tools.d.ts.map +0 -1
- package/dist/tools.js +0 -2930
- package/dist/tracking-server.d.ts +0 -15
- package/dist/tracking-server.d.ts.map +0 -1
- package/dist/tracking.d.ts +0 -24
- package/dist/tracking.d.ts.map +0 -1
- package/dist/tracking.js +0 -1092
- package/dist/upgrade-cli.d.ts.map +0 -1
- package/dist/upgrade-cli.js +0 -177
- /package/dist/{retained.d.ts → browser/retained.d.ts} +0 -0
- /package/dist/{declaration.d.ts → declaration/declaration.d.ts} +0 -0
- /package/dist/{upgrade-cli.d.ts → entrypoints/bin/upgrade-cli.d.ts} +0 -0
- /package/dist/{tracking-server.js → entrypoints/tracking/server.js} +0 -0
- /package/dist/{google.d.ts → google/google.d.ts} +0 -0
- /package/dist/{index-pq95qkbf.js → index-5jm36zv1.js} +0 -0
- /package/dist/{application → internal}/channel.d.ts +0 -0
- /package/dist/{logger.d.ts → internal/logger.d.ts} +0 -0
- /package/dist/{server → internal}/request.d.ts +0 -0
- /package/dist/{tools → json-schema}/json-schema.d.ts +0 -0
- /package/dist/tools/{async-operation-contract.d.ts → operations/async-operation-contract.d.ts} +0 -0
- /package/dist/tools/{mount-wait.d.ts → operations/mount-wait.d.ts} +0 -0
- /package/dist/tools/{wait-core.d.ts → operations/wait-core.d.ts} +0 -0
- /package/dist/tools/{coerce.d.ts → schema/coerce.d.ts} +0 -0
- /package/dist/tools/{flatten-join.d.ts → schema/flatten-join.d.ts} +0 -0
- /package/dist/tools/{flatten.d.ts → schema/flatten.d.ts} +0 -0
- /package/dist/tools/{portable-formats.d.ts → schema/portable-formats.d.ts} +0 -0
- /package/dist/tools/{schema.d.ts → schema/schema.d.ts} +0 -0
- /package/dist/tools/{untyped-properties.d.ts → schema/untyped-properties.d.ts} +0 -0
- /package/dist/tools/{native-result.d.ts → transfer/native-result.d.ts} +0 -0
- /package/dist/tools/{view-file-contract.d.ts → transfer/view-file-contract.d.ts} +0 -0
package/dist/index-a11g2kry.js
DELETED
|
@@ -1,866 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ApplicationIdSchema,
|
|
3
|
-
ApplicationShutdownResultSchema,
|
|
4
|
-
ApplicationSnapshotSchema
|
|
5
|
-
} from "./index-3gye9wzb.js";
|
|
6
|
-
import {
|
|
7
|
-
managedResourceDependencyId
|
|
8
|
-
} from "./index-2k4yrqkc.js";
|
|
9
|
-
import {
|
|
10
|
-
ShutdownOptionsSchema
|
|
11
|
-
} from "./index-3z73fh2c.js";
|
|
12
|
-
import {
|
|
13
|
-
AppError
|
|
14
|
-
} from "./index-2vtcmrj9.js";
|
|
15
|
-
|
|
16
|
-
// src/application/kernel.ts
|
|
17
|
-
import { z } from "zod";
|
|
18
|
-
|
|
19
|
-
// src/application/graph.ts
|
|
20
|
-
function resolveResourceGraph(resources) {
|
|
21
|
-
const entries = resources.map((resource, declarationIndex) => ({
|
|
22
|
-
resource,
|
|
23
|
-
id: ApplicationIdSchema.parse(resource.id),
|
|
24
|
-
dependsOn: [...resource.dependsOn ?? []].map((dependency) => ApplicationIdSchema.parse(managedResourceDependencyId(dependency))),
|
|
25
|
-
required: resource.required ?? true,
|
|
26
|
-
declarationIndex
|
|
27
|
-
}));
|
|
28
|
-
const byId = new Map;
|
|
29
|
-
for (const entry of entries) {
|
|
30
|
-
if (byId.has(entry.id)) {
|
|
31
|
-
throw new Error(`[stitchkit] createApplication: duplicate resource id "${entry.id}"`);
|
|
32
|
-
}
|
|
33
|
-
byId.set(entry.id, entry);
|
|
34
|
-
}
|
|
35
|
-
for (const entry of entries) {
|
|
36
|
-
for (const dependencyId of entry.dependsOn) {
|
|
37
|
-
const dependency = byId.get(dependencyId);
|
|
38
|
-
if (!dependency) {
|
|
39
|
-
throw new Error(`[stitchkit] createApplication: resource "${entry.id}" depends on missing resource "${dependencyId}"`);
|
|
40
|
-
}
|
|
41
|
-
if (entry.required && !dependency.required) {
|
|
42
|
-
throw new Error(`[stitchkit] createApplication: required resource "${entry.id}" cannot depend on optional resource "${dependencyId}"`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const pending = new Map(entries.map((entry) => [entry.id, entry]));
|
|
47
|
-
const resolved = new Set;
|
|
48
|
-
const ordered = [];
|
|
49
|
-
while (pending.size > 0) {
|
|
50
|
-
const ready = [...pending.values()].filter((entry) => entry.dependsOn.every((id) => resolved.has(id))).sort((left, right) => left.declarationIndex - right.declarationIndex);
|
|
51
|
-
if (ready.length === 0) {
|
|
52
|
-
throw new Error(`[stitchkit] createApplication: resource dependency cycle: ${[...pending.keys()].join(", ")}`);
|
|
53
|
-
}
|
|
54
|
-
for (const entry of ready) {
|
|
55
|
-
pending.delete(entry.id);
|
|
56
|
-
resolved.add(entry.id);
|
|
57
|
-
ordered.push(entry);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return ordered;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// src/application/kernel.ts
|
|
64
|
-
class ResourceCompletionBeforeReadyError extends Error {
|
|
65
|
-
constructor(resourceId, cause) {
|
|
66
|
-
super(`[stitchkit] resource "${resourceId}" completed before reaching readiness`, {
|
|
67
|
-
...cause !== undefined && { cause }
|
|
68
|
-
});
|
|
69
|
-
this.name = "ResourceCompletionBeforeReadyError";
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
class ApplicationStartupInterruptedError extends Error {
|
|
74
|
-
constructor() {
|
|
75
|
-
super("[stitchkit] application startup interrupted by shutdown");
|
|
76
|
-
this.name = "ApplicationStartupInterruptedError";
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
var ApplicationShutdownOptionsSchema = ShutdownOptionsSchema.pick({
|
|
80
|
-
gracePeriodMs: true,
|
|
81
|
-
forceTimeoutMs: true,
|
|
82
|
-
signal: true
|
|
83
|
-
});
|
|
84
|
-
var ApplicationShutdownBudgetSchema = ShutdownOptionsSchema.pick({
|
|
85
|
-
gracePeriodMs: true,
|
|
86
|
-
forceTimeoutMs: true
|
|
87
|
-
});
|
|
88
|
-
var ApplicationRestartInputSchema = z.object({
|
|
89
|
-
resourceId: z.string().min(1),
|
|
90
|
-
gracePeriodMs: z.number().int().nonnegative().optional(),
|
|
91
|
-
forceTimeoutMs: z.number().int().nonnegative().optional()
|
|
92
|
-
}).strict().readonly();
|
|
93
|
-
var ApplicationRestartOutcomeSchema = z.enum(["restarted", "failed", "refused"]);
|
|
94
|
-
var ApplicationRestartResultSchema = z.object({
|
|
95
|
-
resourceId: z.string(),
|
|
96
|
-
affected: z.array(z.string()).readonly(),
|
|
97
|
-
outcome: ApplicationRestartOutcomeSchema,
|
|
98
|
-
reason: z.string().optional(),
|
|
99
|
-
durationMs: z.number().int().nonnegative()
|
|
100
|
-
}).strict().readonly();
|
|
101
|
-
|
|
102
|
-
class ApplicationAdmissionError extends AppError {
|
|
103
|
-
constructor() {
|
|
104
|
-
super("APPLICATION_NOT_ACCEPTING", "Application is not accepting new operations", 503);
|
|
105
|
-
this.name = "ApplicationAdmissionError";
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
function isStartResult(value) {
|
|
109
|
-
return typeof value === "object" && value !== null;
|
|
110
|
-
}
|
|
111
|
-
function waitForAbort(signal) {
|
|
112
|
-
if (signal.aborted)
|
|
113
|
-
return Promise.resolve();
|
|
114
|
-
return new Promise((resolve) => signal.addEventListener("abort", () => resolve(), { once: true }));
|
|
115
|
-
}
|
|
116
|
-
async function untilDeadline(work, signal) {
|
|
117
|
-
const result = await Promise.race([
|
|
118
|
-
work.then((value) => ({ settled: true, value }), (error) => ({ settled: true, error })),
|
|
119
|
-
waitForAbort(signal).then(() => ({ settled: false }))
|
|
120
|
-
]);
|
|
121
|
-
return result;
|
|
122
|
-
}
|
|
123
|
-
function createApplication(config) {
|
|
124
|
-
const id = ApplicationIdSchema.parse(config.id);
|
|
125
|
-
const ordered = resolveResourceGraph(config.resources ?? []);
|
|
126
|
-
const shutdownBudget = ApplicationShutdownBudgetSchema.parse(config.shutdown ?? {});
|
|
127
|
-
const reverse = [...ordered].reverse();
|
|
128
|
-
const reportFailure = (resourceId, phase, error) => {
|
|
129
|
-
if (!config.onResourceFailure)
|
|
130
|
-
return;
|
|
131
|
-
try {
|
|
132
|
-
Promise.resolve(config.onResourceFailure({ resourceId, phase, error })).catch(() => {
|
|
133
|
-
return;
|
|
134
|
-
});
|
|
135
|
-
} catch {}
|
|
136
|
-
};
|
|
137
|
-
const published = new Map;
|
|
138
|
-
const records = new Map;
|
|
139
|
-
for (const entry of ordered) {
|
|
140
|
-
records.set(entry.id, {
|
|
141
|
-
entry,
|
|
142
|
-
state: "registered",
|
|
143
|
-
health: "unknown",
|
|
144
|
-
healthReported: false,
|
|
145
|
-
everHealthy: false,
|
|
146
|
-
attempted: false,
|
|
147
|
-
activated: false,
|
|
148
|
-
closeInvoked: false,
|
|
149
|
-
closed: false,
|
|
150
|
-
failures: []
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
const epoch = crypto.randomUUID();
|
|
154
|
-
const listeners = new Set;
|
|
155
|
-
const lifetimeAbort = new AbortController;
|
|
156
|
-
const startupAbort = new AbortController;
|
|
157
|
-
let lifecycle = "created";
|
|
158
|
-
let revision = 0;
|
|
159
|
-
let changedAt = new Date().toISOString();
|
|
160
|
-
let accepting = false;
|
|
161
|
-
let accepted = 0;
|
|
162
|
-
let completed = 0;
|
|
163
|
-
let pending = 0;
|
|
164
|
-
let startPromise;
|
|
165
|
-
let shutdownPromise;
|
|
166
|
-
let shutdownRequested = false;
|
|
167
|
-
let activationComplete = false;
|
|
168
|
-
const pendingWaiters = new Set;
|
|
169
|
-
const aggregateHealth = () => {
|
|
170
|
-
if (lifecycle === "created" || lifecycle === "starting")
|
|
171
|
-
return "unknown";
|
|
172
|
-
let optionalUnhealthy = false;
|
|
173
|
-
for (const record of records.values()) {
|
|
174
|
-
if (record.entry.required && (record.state !== "ready" || record.health !== "healthy")) {
|
|
175
|
-
return "unhealthy";
|
|
176
|
-
}
|
|
177
|
-
if (!record.entry.required && (record.state !== "ready" || record.health !== "healthy")) {
|
|
178
|
-
optionalUnhealthy = true;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return optionalUnhealthy ? "degraded" : "healthy";
|
|
182
|
-
};
|
|
183
|
-
const isReady = () => lifecycle === "ready" && [...records.values()].every((record) => !record.entry.required || record.state === "ready" && record.health === "healthy");
|
|
184
|
-
let restartingIds = [];
|
|
185
|
-
const snapshot = () => ApplicationSnapshotSchema.parse({
|
|
186
|
-
id,
|
|
187
|
-
epoch,
|
|
188
|
-
revision,
|
|
189
|
-
lifecycle,
|
|
190
|
-
health: aggregateHealth(),
|
|
191
|
-
ready: isReady(),
|
|
192
|
-
capturedAt: new Date().toISOString(),
|
|
193
|
-
changedAt,
|
|
194
|
-
admission: { accepting, accepted, completed, pending },
|
|
195
|
-
restarting: [...restartingIds],
|
|
196
|
-
resources: ordered.map((entry) => {
|
|
197
|
-
const record = records.get(entry.id);
|
|
198
|
-
if (!record)
|
|
199
|
-
throw new Error("Managed resource record disappeared");
|
|
200
|
-
return {
|
|
201
|
-
id: entry.id,
|
|
202
|
-
required: entry.required,
|
|
203
|
-
dependsOn: entry.dependsOn,
|
|
204
|
-
state: record.state,
|
|
205
|
-
health: record.health,
|
|
206
|
-
ready: record.state === "ready" && record.health === "healthy"
|
|
207
|
-
};
|
|
208
|
-
})
|
|
209
|
-
});
|
|
210
|
-
const publish = () => {
|
|
211
|
-
revision += 1;
|
|
212
|
-
changedAt = new Date().toISOString();
|
|
213
|
-
const value = snapshot();
|
|
214
|
-
for (const listener of listeners) {
|
|
215
|
-
try {
|
|
216
|
-
listener(value);
|
|
217
|
-
} catch {}
|
|
218
|
-
}
|
|
219
|
-
if (config.onSnapshot) {
|
|
220
|
-
Promise.resolve().then(() => config.onSnapshot?.(value)).catch(() => {});
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
const contextFor = (record, options = {}) => ({
|
|
224
|
-
applicationId: id,
|
|
225
|
-
signal: options.signal ?? lifetimeAbort.signal,
|
|
226
|
-
...options.deadlineAt !== undefined && { deadlineAt: options.deadlineAt },
|
|
227
|
-
...options.forceDeadlineAt !== undefined && {
|
|
228
|
-
forceDeadlineAt: options.forceDeadlineAt
|
|
229
|
-
},
|
|
230
|
-
now: () => performance.now(),
|
|
231
|
-
use(resource) {
|
|
232
|
-
const dependencyId = resource?.id;
|
|
233
|
-
if (typeof dependencyId !== "string" || dependencyId.length === 0) {
|
|
234
|
-
throw new Error(`[stitchkit] resource "${record.entry.id}": use() takes a managed resource, and this one has no id`);
|
|
235
|
-
}
|
|
236
|
-
if (!record.entry.dependsOn.includes(dependencyId)) {
|
|
237
|
-
throw new Error(`[stitchkit] resource "${record.entry.id}" used "${dependencyId}" without declaring it in dependsOn`);
|
|
238
|
-
}
|
|
239
|
-
if (!published.has(dependencyId)) {
|
|
240
|
-
throw new Error(`[stitchkit] resource "${record.entry.id}" used "${dependencyId}", which published no value from start()`);
|
|
241
|
-
}
|
|
242
|
-
return published.get(dependencyId);
|
|
243
|
-
},
|
|
244
|
-
reportHealth(health) {
|
|
245
|
-
if (record.state === "stopped")
|
|
246
|
-
return;
|
|
247
|
-
record.health = health;
|
|
248
|
-
record.healthReported = true;
|
|
249
|
-
if (health === "healthy")
|
|
250
|
-
record.everHealthy = true;
|
|
251
|
-
accepting = activationComplete && !shutdownRequested && isReady();
|
|
252
|
-
publish();
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
const markLateCompletion = (record, failure) => {
|
|
256
|
-
if (shutdownRequested || record.state === "stopping" || record.state === "stopped")
|
|
257
|
-
return;
|
|
258
|
-
if (failure) {
|
|
259
|
-
record.failures.push("completion");
|
|
260
|
-
reportFailure(record.entry.id, "completion", failure.error);
|
|
261
|
-
}
|
|
262
|
-
record.state = "failed";
|
|
263
|
-
record.health = "unhealthy";
|
|
264
|
-
accepting = activationComplete && isReady();
|
|
265
|
-
publish();
|
|
266
|
-
};
|
|
267
|
-
const closeAttempted = async () => {
|
|
268
|
-
const errors = [];
|
|
269
|
-
const rollbackStartedAt = performance.now();
|
|
270
|
-
const rollbackDeadlineAt = rollbackStartedAt + shutdownBudget.gracePeriodMs;
|
|
271
|
-
const rollbackForceDeadlineAt = rollbackDeadlineAt + shutdownBudget.forceTimeoutMs;
|
|
272
|
-
const rollbackAbort = new AbortController;
|
|
273
|
-
const rollbackTimer = setTimeout(() => rollbackAbort.abort(), Math.max(0, rollbackForceDeadlineAt - performance.now()));
|
|
274
|
-
try {
|
|
275
|
-
await closeEachAttempted(rollbackAbort.signal, errors, {
|
|
276
|
-
deadlineAt: rollbackDeadlineAt,
|
|
277
|
-
forceDeadlineAt: rollbackForceDeadlineAt
|
|
278
|
-
});
|
|
279
|
-
} finally {
|
|
280
|
-
clearTimeout(rollbackTimer);
|
|
281
|
-
}
|
|
282
|
-
return errors;
|
|
283
|
-
};
|
|
284
|
-
const closeEachAttempted = async (bound, errors, deadlines) => {
|
|
285
|
-
for (const entry of reverse) {
|
|
286
|
-
const record = records.get(entry.id);
|
|
287
|
-
if (!record?.attempted || record.closed)
|
|
288
|
-
continue;
|
|
289
|
-
record.state = "stopping";
|
|
290
|
-
try {
|
|
291
|
-
record.closeInvoked = true;
|
|
292
|
-
const settled = await untilDeadline(Promise.resolve(entry.resource.close?.(contextFor(record, { signal: startupAbort.signal, ...deadlines }))), bound);
|
|
293
|
-
if (!settled.settled) {
|
|
294
|
-
record.failures.push("close");
|
|
295
|
-
record.state = "failed";
|
|
296
|
-
const timedOut = new Error(`[stitchkit] resource "${entry.id}" did not finish closing during rollback`);
|
|
297
|
-
reportFailure(entry.id, "close", timedOut);
|
|
298
|
-
errors.push(timedOut);
|
|
299
|
-
publish();
|
|
300
|
-
break;
|
|
301
|
-
}
|
|
302
|
-
if (settled.error !== undefined)
|
|
303
|
-
throw settled.error;
|
|
304
|
-
record.closed = true;
|
|
305
|
-
record.state = "stopped";
|
|
306
|
-
} catch (error) {
|
|
307
|
-
record.failures.push("close");
|
|
308
|
-
record.state = "failed";
|
|
309
|
-
reportFailure(entry.id, "close", error);
|
|
310
|
-
errors.push(error);
|
|
311
|
-
}
|
|
312
|
-
publish();
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
const startEach = async (entries, signal) => {
|
|
316
|
-
for (const entry of entries) {
|
|
317
|
-
if (shutdownRequested || signal.aborted) {
|
|
318
|
-
throw new ApplicationStartupInterruptedError;
|
|
319
|
-
}
|
|
320
|
-
const record = records.get(entry.id);
|
|
321
|
-
if (!record)
|
|
322
|
-
throw new Error("Managed resource record disappeared");
|
|
323
|
-
const dependencyFailed = entry.dependsOn.some((dependencyId) => records.get(dependencyId)?.state !== "ready");
|
|
324
|
-
if (dependencyFailed) {
|
|
325
|
-
record.state = "failed";
|
|
326
|
-
record.health = "unhealthy";
|
|
327
|
-
record.failures.push("start");
|
|
328
|
-
publish();
|
|
329
|
-
if (entry.required) {
|
|
330
|
-
throw new Error(`[stitchkit] required resource "${entry.id}" has an unavailable dependency`);
|
|
331
|
-
}
|
|
332
|
-
continue;
|
|
333
|
-
}
|
|
334
|
-
record.attempted = true;
|
|
335
|
-
record.state = "starting";
|
|
336
|
-
publish();
|
|
337
|
-
try {
|
|
338
|
-
const started = await entry.resource.start(contextFor(record, { signal }));
|
|
339
|
-
if (shutdownRequested || signal.aborted) {
|
|
340
|
-
throw new ApplicationStartupInterruptedError;
|
|
341
|
-
}
|
|
342
|
-
if (isStartResult(started)) {
|
|
343
|
-
record.runtime = started;
|
|
344
|
-
if (started.value !== undefined)
|
|
345
|
-
published.set(entry.id, started.value);
|
|
346
|
-
let resourceReady = started.ready === undefined;
|
|
347
|
-
let completionSettled = false;
|
|
348
|
-
let completionFailure;
|
|
349
|
-
const completion = started.completion?.then(() => {
|
|
350
|
-
completionSettled = true;
|
|
351
|
-
if (resourceReady)
|
|
352
|
-
markLateCompletion(record);
|
|
353
|
-
}, (error) => {
|
|
354
|
-
completionSettled = true;
|
|
355
|
-
completionFailure = error;
|
|
356
|
-
if (resourceReady)
|
|
357
|
-
markLateCompletion(record, { error });
|
|
358
|
-
});
|
|
359
|
-
if (started.ready && completion) {
|
|
360
|
-
const readiness = started.ready.then(() => "ready");
|
|
361
|
-
const completionBeforeReady = completion.then(() => "completion");
|
|
362
|
-
const first = await Promise.race([readiness, completionBeforeReady]);
|
|
363
|
-
if (first === "completion") {
|
|
364
|
-
throw new ResourceCompletionBeforeReadyError(entry.id, completionFailure);
|
|
365
|
-
}
|
|
366
|
-
resourceReady = true;
|
|
367
|
-
if (completionSettled) {
|
|
368
|
-
throw new ResourceCompletionBeforeReadyError(entry.id, completionFailure);
|
|
369
|
-
}
|
|
370
|
-
} else if (started.ready) {
|
|
371
|
-
await started.ready;
|
|
372
|
-
resourceReady = true;
|
|
373
|
-
} else if (completion) {}
|
|
374
|
-
}
|
|
375
|
-
if (shutdownRequested || signal.aborted) {
|
|
376
|
-
throw new ApplicationStartupInterruptedError;
|
|
377
|
-
}
|
|
378
|
-
record.state = "ready";
|
|
379
|
-
if (!record.healthReported) {
|
|
380
|
-
record.health = "healthy";
|
|
381
|
-
record.everHealthy = true;
|
|
382
|
-
}
|
|
383
|
-
publish();
|
|
384
|
-
} catch (error) {
|
|
385
|
-
const interrupted = shutdownRequested || signal.aborted;
|
|
386
|
-
if (!(error instanceof ApplicationStartupInterruptedError)) {
|
|
387
|
-
record.failures.push(error instanceof ResourceCompletionBeforeReadyError ? "completion" : record.runtime?.ready ? "ready" : "start");
|
|
388
|
-
record.state = "failed";
|
|
389
|
-
record.health = "unhealthy";
|
|
390
|
-
reportFailure(entry.id, record.failures[record.failures.length - 1] ?? "start", error);
|
|
391
|
-
publish();
|
|
392
|
-
}
|
|
393
|
-
if (interrupted || entry.required)
|
|
394
|
-
throw error;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
const activateEach = async (entries, signal) => {
|
|
399
|
-
for (const entry of entries) {
|
|
400
|
-
if (shutdownRequested || signal.aborted) {
|
|
401
|
-
throw new ApplicationStartupInterruptedError;
|
|
402
|
-
}
|
|
403
|
-
const record = records.get(entry.id);
|
|
404
|
-
if (record?.state !== "ready")
|
|
405
|
-
continue;
|
|
406
|
-
const dependencyUnavailable = entry.dependsOn.some((dependencyId) => {
|
|
407
|
-
const dependency = records.get(dependencyId);
|
|
408
|
-
return dependency?.state !== "ready" || !dependency.activated;
|
|
409
|
-
});
|
|
410
|
-
if (dependencyUnavailable) {
|
|
411
|
-
record.failures.push("start");
|
|
412
|
-
record.state = "failed";
|
|
413
|
-
record.health = "unhealthy";
|
|
414
|
-
publish();
|
|
415
|
-
if (entry.required) {
|
|
416
|
-
throw new Error(`[stitchkit] required resource "${entry.id}" has an unavailable activation dependency`);
|
|
417
|
-
}
|
|
418
|
-
continue;
|
|
419
|
-
}
|
|
420
|
-
try {
|
|
421
|
-
await entry.resource.activate?.(contextFor(record));
|
|
422
|
-
if (shutdownRequested || signal.aborted) {
|
|
423
|
-
throw new ApplicationStartupInterruptedError;
|
|
424
|
-
}
|
|
425
|
-
record.activated = true;
|
|
426
|
-
if (entry.required && (record.state !== "ready" || record.health !== "healthy")) {
|
|
427
|
-
const observed = `${record.state}/${record.health}`;
|
|
428
|
-
throw new Error(record.everHealthy ? `[stitchkit] required resource "${entry.id}" lost readiness during activation (${observed})` : `[stitchkit] required resource "${entry.id}" is not healthy (${observed}). A required resource must be healthy for the application to be ready; a resource that is expected to start degraded belongs behind \`required: false\`.`);
|
|
429
|
-
}
|
|
430
|
-
} catch (error) {
|
|
431
|
-
const interrupted = shutdownRequested || signal.aborted;
|
|
432
|
-
if (!(error instanceof ApplicationStartupInterruptedError)) {
|
|
433
|
-
record.failures.push("start");
|
|
434
|
-
record.state = "failed";
|
|
435
|
-
record.health = "unhealthy";
|
|
436
|
-
reportFailure(entry.id, "start", error);
|
|
437
|
-
publish();
|
|
438
|
-
}
|
|
439
|
-
if (interrupted || entry.required)
|
|
440
|
-
throw error;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
|
-
const subtreeOf = (resourceId) => {
|
|
445
|
-
const affected = new Set([resourceId]);
|
|
446
|
-
for (const entry of ordered) {
|
|
447
|
-
if (entry.dependsOn.some((dependencyId) => affected.has(dependencyId))) {
|
|
448
|
-
affected.add(entry.id);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
return ordered.filter((entry) => affected.has(entry.id));
|
|
452
|
-
};
|
|
453
|
-
const closeOne = async (entry, record, signal, deadlines) => {
|
|
454
|
-
const context = () => contextFor(record, { ...deadlines, signal });
|
|
455
|
-
if (record.attempted && !record.closed) {
|
|
456
|
-
const phase = async (work, what) => {
|
|
457
|
-
const settled = await untilDeadline(Promise.resolve(work), signal);
|
|
458
|
-
if (!settled.settled) {
|
|
459
|
-
throw new Error(`[stitchkit] resource "${entry.id}" did not ${what} within the restart budget`);
|
|
460
|
-
}
|
|
461
|
-
if (settled.error !== undefined)
|
|
462
|
-
throw settled.error;
|
|
463
|
-
};
|
|
464
|
-
await phase(entry.resource.stopAdmission?.(context()), "stop admitting");
|
|
465
|
-
await phase(entry.resource.drain?.(context()), "drain");
|
|
466
|
-
record.closeInvoked = true;
|
|
467
|
-
await phase(entry.resource.close?.(context()), "close");
|
|
468
|
-
}
|
|
469
|
-
record.closed = false;
|
|
470
|
-
record.closeInvoked = false;
|
|
471
|
-
record.attempted = false;
|
|
472
|
-
record.activated = false;
|
|
473
|
-
record.state = "registered";
|
|
474
|
-
record.health = "unknown";
|
|
475
|
-
record.healthReported = false;
|
|
476
|
-
record.runtime = undefined;
|
|
477
|
-
published.delete(entry.id);
|
|
478
|
-
};
|
|
479
|
-
let restarting = Promise.resolve();
|
|
480
|
-
const runRestart = async (input) => {
|
|
481
|
-
const startedAt = Date.now();
|
|
482
|
-
const parsed = ApplicationRestartInputSchema.parse(input);
|
|
483
|
-
const affected = subtreeOf(parsed.resourceId);
|
|
484
|
-
const affectedIds = affected.map((entry) => entry.id);
|
|
485
|
-
const refuse = (reason) => ({
|
|
486
|
-
resourceId: parsed.resourceId,
|
|
487
|
-
affected: affectedIds,
|
|
488
|
-
outcome: "refused",
|
|
489
|
-
reason,
|
|
490
|
-
durationMs: Date.now() - startedAt
|
|
491
|
-
});
|
|
492
|
-
if (!records.has(parsed.resourceId)) {
|
|
493
|
-
return refuse(`no resource is registered as "${parsed.resourceId}"`);
|
|
494
|
-
}
|
|
495
|
-
if (shutdownRequested) {
|
|
496
|
-
return refuse("the application is shutting down");
|
|
497
|
-
}
|
|
498
|
-
if (lifecycle !== "ready") {
|
|
499
|
-
return refuse(`the application is ${lifecycle}, not ready`);
|
|
500
|
-
}
|
|
501
|
-
const budget = {
|
|
502
|
-
gracePeriodMs: parsed.gracePeriodMs ?? shutdownBudget.gracePeriodMs,
|
|
503
|
-
forceTimeoutMs: parsed.forceTimeoutMs ?? shutdownBudget.forceTimeoutMs
|
|
504
|
-
};
|
|
505
|
-
const closeDeadlineAt = performance.now() + budget.gracePeriodMs;
|
|
506
|
-
const deadlines = {
|
|
507
|
-
deadlineAt: closeDeadlineAt,
|
|
508
|
-
forceDeadlineAt: closeDeadlineAt + budget.forceTimeoutMs
|
|
509
|
-
};
|
|
510
|
-
restartingIds = affectedIds;
|
|
511
|
-
const restartAbort = new AbortController;
|
|
512
|
-
const closeTimer = setTimeout(() => restartAbort.abort(), Math.max(0, deadlines.forceDeadlineAt - performance.now()));
|
|
513
|
-
const stillFailed = () => affectedIds.filter((id2) => records.get(id2)?.state === "failed");
|
|
514
|
-
try {
|
|
515
|
-
for (const entry of [...affected].reverse()) {
|
|
516
|
-
const record = records.get(entry.id);
|
|
517
|
-
if (record)
|
|
518
|
-
await closeOne(entry, record, restartAbort.signal, deadlines);
|
|
519
|
-
}
|
|
520
|
-
publish();
|
|
521
|
-
await startEach(affected, restartAbort.signal);
|
|
522
|
-
await activateEach(affected, restartAbort.signal);
|
|
523
|
-
publish();
|
|
524
|
-
const failed = stillFailed();
|
|
525
|
-
if (failed.length > 0) {
|
|
526
|
-
return {
|
|
527
|
-
resourceId: parsed.resourceId,
|
|
528
|
-
affected: affectedIds,
|
|
529
|
-
outcome: "failed",
|
|
530
|
-
reason: `did not come back: ${failed.join(", ")}`,
|
|
531
|
-
durationMs: Date.now() - startedAt
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
return {
|
|
535
|
-
resourceId: parsed.resourceId,
|
|
536
|
-
affected: affectedIds,
|
|
537
|
-
outcome: "restarted",
|
|
538
|
-
durationMs: Date.now() - startedAt
|
|
539
|
-
};
|
|
540
|
-
} catch (error) {
|
|
541
|
-
restartAbort.abort();
|
|
542
|
-
publish();
|
|
543
|
-
return {
|
|
544
|
-
resourceId: parsed.resourceId,
|
|
545
|
-
affected: affectedIds,
|
|
546
|
-
outcome: "failed",
|
|
547
|
-
reason: error instanceof Error ? error.message : String(error),
|
|
548
|
-
durationMs: Date.now() - startedAt
|
|
549
|
-
};
|
|
550
|
-
} finally {
|
|
551
|
-
restartingIds = [];
|
|
552
|
-
clearTimeout(closeTimer);
|
|
553
|
-
publish();
|
|
554
|
-
}
|
|
555
|
-
};
|
|
556
|
-
const runStart = async () => {
|
|
557
|
-
lifecycle = "starting";
|
|
558
|
-
publish();
|
|
559
|
-
let startFailure;
|
|
560
|
-
try {
|
|
561
|
-
await startEach(ordered, startupAbort.signal);
|
|
562
|
-
lifecycle = "ready";
|
|
563
|
-
publish();
|
|
564
|
-
await activateEach(ordered, startupAbort.signal);
|
|
565
|
-
if (shutdownRequested) {
|
|
566
|
-
throw new ApplicationStartupInterruptedError;
|
|
567
|
-
}
|
|
568
|
-
if (!isReady()) {
|
|
569
|
-
const blocking = [...records.values()].filter((record) => record.entry.required && (record.state !== "ready" || record.health !== "healthy")).map((record) => `${record.entry.id} (${record.state}/${record.health})`);
|
|
570
|
-
if (blocking.length === 0)
|
|
571
|
-
blocking.push("(none identified)");
|
|
572
|
-
const chosen = [...records.values()].some((record) => record.entry.required && record.health !== "healthy" && !record.everHealthy);
|
|
573
|
-
throw new Error(`[stitchkit] the application is not ready after startup — required ${blocking.length === 1 ? "resource" : "resources"} ${blocking.join(", ")}. A required resource must be healthy for the application to be ready; ${chosen ? "a resource that is expected to start degraded belongs behind `required: false`." : "this one was healthy and stopped being so — read `onResourceFailure` for the cause."}`);
|
|
574
|
-
}
|
|
575
|
-
activationComplete = true;
|
|
576
|
-
accepting = isReady();
|
|
577
|
-
publish();
|
|
578
|
-
return snapshot();
|
|
579
|
-
} catch (error) {
|
|
580
|
-
startFailure = error;
|
|
581
|
-
}
|
|
582
|
-
if (!shutdownRequested) {
|
|
583
|
-
const rollbackErrors = await closeAttempted();
|
|
584
|
-
lifecycle = "failed";
|
|
585
|
-
accepting = false;
|
|
586
|
-
publish();
|
|
587
|
-
if (rollbackErrors.length > 0) {
|
|
588
|
-
throw new AggregateError([startFailure, ...rollbackErrors], "[stitchkit] application startup and rollback failed", { cause: startFailure });
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
throw startFailure;
|
|
592
|
-
};
|
|
593
|
-
const start = () => {
|
|
594
|
-
if (startPromise)
|
|
595
|
-
return startPromise;
|
|
596
|
-
if (lifecycle !== "created") {
|
|
597
|
-
return Promise.reject(new Error(`[stitchkit] application cannot start from lifecycle "${lifecycle}"`));
|
|
598
|
-
}
|
|
599
|
-
startPromise = runStart();
|
|
600
|
-
startPromise.catch(() => {
|
|
601
|
-
return;
|
|
602
|
-
});
|
|
603
|
-
return startPromise;
|
|
604
|
-
};
|
|
605
|
-
const acquire = () => {
|
|
606
|
-
if (!accepting || !isReady())
|
|
607
|
-
return null;
|
|
608
|
-
accepted += 1;
|
|
609
|
-
pending += 1;
|
|
610
|
-
publish();
|
|
611
|
-
let released = false;
|
|
612
|
-
return {
|
|
613
|
-
get released() {
|
|
614
|
-
return released;
|
|
615
|
-
},
|
|
616
|
-
release() {
|
|
617
|
-
if (released)
|
|
618
|
-
return;
|
|
619
|
-
released = true;
|
|
620
|
-
pending -= 1;
|
|
621
|
-
completed += 1;
|
|
622
|
-
if (pending === 0) {
|
|
623
|
-
for (const waiter of pendingWaiters)
|
|
624
|
-
waiter();
|
|
625
|
-
pendingWaiters.clear();
|
|
626
|
-
}
|
|
627
|
-
publish();
|
|
628
|
-
}
|
|
629
|
-
};
|
|
630
|
-
};
|
|
631
|
-
const run = async (work) => {
|
|
632
|
-
const lease = acquire();
|
|
633
|
-
if (!lease)
|
|
634
|
-
throw new ApplicationAdmissionError;
|
|
635
|
-
try {
|
|
636
|
-
return await work();
|
|
637
|
-
} finally {
|
|
638
|
-
lease.release();
|
|
639
|
-
}
|
|
640
|
-
};
|
|
641
|
-
const waitForPending = () => {
|
|
642
|
-
if (pending === 0)
|
|
643
|
-
return Promise.resolve();
|
|
644
|
-
return new Promise((resolve) => pendingWaiters.add(resolve));
|
|
645
|
-
};
|
|
646
|
-
const shutdown = (options) => {
|
|
647
|
-
if (shutdownPromise)
|
|
648
|
-
return shutdownPromise;
|
|
649
|
-
const requested = options ?? {};
|
|
650
|
-
const parsed = ApplicationShutdownOptionsSchema.parse({
|
|
651
|
-
gracePeriodMs: requested.gracePeriodMs ?? shutdownBudget.gracePeriodMs,
|
|
652
|
-
forceTimeoutMs: requested.forceTimeoutMs ?? shutdownBudget.forceTimeoutMs,
|
|
653
|
-
...requested.signal !== undefined && { signal: requested.signal }
|
|
654
|
-
});
|
|
655
|
-
const startedAt = performance.now();
|
|
656
|
-
const graceDeadlineAt = startedAt + parsed.gracePeriodMs;
|
|
657
|
-
const forceDeadlineAt = graceDeadlineAt + parsed.forceTimeoutMs;
|
|
658
|
-
shutdownRequested = true;
|
|
659
|
-
accepting = false;
|
|
660
|
-
startupAbort.abort();
|
|
661
|
-
lifecycle = lifecycle === "created" ? "stopping" : "draining";
|
|
662
|
-
publish();
|
|
663
|
-
shutdownPromise = (async () => {
|
|
664
|
-
const gracefulAbort = new AbortController;
|
|
665
|
-
let forcedReason;
|
|
666
|
-
let gracefulFailed = [...records.values()].some((record) => record.attempted && record.closeInvoked && !record.closed);
|
|
667
|
-
const force = (reason) => {
|
|
668
|
-
if (forcedReason)
|
|
669
|
-
return;
|
|
670
|
-
forcedReason = reason;
|
|
671
|
-
gracefulAbort.abort();
|
|
672
|
-
lifetimeAbort.abort();
|
|
673
|
-
};
|
|
674
|
-
const graceTimer = setTimeout(() => force("deadline"), Math.max(0, graceDeadlineAt - performance.now()));
|
|
675
|
-
const onExternalAbort = () => force("signal");
|
|
676
|
-
parsed.signal?.addEventListener("abort", onExternalAbort, { once: true });
|
|
677
|
-
if (parsed.signal?.aborted)
|
|
678
|
-
force("signal");
|
|
679
|
-
if (startPromise) {
|
|
680
|
-
await untilDeadline(startPromise.catch(() => {
|
|
681
|
-
return;
|
|
682
|
-
}), gracefulAbort.signal);
|
|
683
|
-
}
|
|
684
|
-
const gracefulContext = (record) => contextFor(record, {
|
|
685
|
-
signal: gracefulAbort.signal,
|
|
686
|
-
deadlineAt: graceDeadlineAt,
|
|
687
|
-
forceDeadlineAt
|
|
688
|
-
});
|
|
689
|
-
for (const entry of reverse) {
|
|
690
|
-
if (gracefulAbort.signal.aborted)
|
|
691
|
-
break;
|
|
692
|
-
const record = records.get(entry.id);
|
|
693
|
-
if (!record?.attempted || record.closed)
|
|
694
|
-
continue;
|
|
695
|
-
try {
|
|
696
|
-
const result = await untilDeadline(Promise.resolve(entry.resource.stopAdmission?.(gracefulContext(record))), gracefulAbort.signal);
|
|
697
|
-
if (!result.settled)
|
|
698
|
-
break;
|
|
699
|
-
if (result.error !== undefined)
|
|
700
|
-
throw result.error;
|
|
701
|
-
} catch (error) {
|
|
702
|
-
record.failures.push("admission");
|
|
703
|
-
reportFailure(entry.id, "admission", error);
|
|
704
|
-
gracefulFailed = true;
|
|
705
|
-
lifetimeAbort.abort();
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
if (!gracefulAbort.signal.aborted && !gracefulFailed) {
|
|
709
|
-
const result = await untilDeadline(waitForPending(), gracefulAbort.signal);
|
|
710
|
-
if (!result.settled)
|
|
711
|
-
force("deadline");
|
|
712
|
-
}
|
|
713
|
-
for (const entry of reverse) {
|
|
714
|
-
if (gracefulAbort.signal.aborted || gracefulFailed)
|
|
715
|
-
break;
|
|
716
|
-
const record = records.get(entry.id);
|
|
717
|
-
if (!record?.attempted || record.closed)
|
|
718
|
-
continue;
|
|
719
|
-
record.state = "stopping";
|
|
720
|
-
publish();
|
|
721
|
-
try {
|
|
722
|
-
const drained = await untilDeadline(Promise.resolve(entry.resource.drain?.(gracefulContext(record))), gracefulAbort.signal);
|
|
723
|
-
if (!drained.settled) {
|
|
724
|
-
force("deadline");
|
|
725
|
-
break;
|
|
726
|
-
}
|
|
727
|
-
if (drained.error !== undefined)
|
|
728
|
-
throw drained.error;
|
|
729
|
-
} catch (error) {
|
|
730
|
-
record.failures.push("drain");
|
|
731
|
-
reportFailure(entry.id, "drain", error);
|
|
732
|
-
gracefulFailed = true;
|
|
733
|
-
lifetimeAbort.abort();
|
|
734
|
-
break;
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
lifecycle = "stopping";
|
|
738
|
-
publish();
|
|
739
|
-
for (const entry of reverse) {
|
|
740
|
-
if (gracefulAbort.signal.aborted || gracefulFailed)
|
|
741
|
-
break;
|
|
742
|
-
const record = records.get(entry.id);
|
|
743
|
-
if (!record?.attempted || record.closed || record.closeInvoked)
|
|
744
|
-
continue;
|
|
745
|
-
try {
|
|
746
|
-
record.closeInvoked = true;
|
|
747
|
-
const closed = await untilDeadline(Promise.resolve(entry.resource.close?.(gracefulContext(record))), gracefulAbort.signal);
|
|
748
|
-
if (!closed.settled) {
|
|
749
|
-
force("deadline");
|
|
750
|
-
break;
|
|
751
|
-
}
|
|
752
|
-
if (closed.error !== undefined)
|
|
753
|
-
throw closed.error;
|
|
754
|
-
record.closed = true;
|
|
755
|
-
record.state = "stopped";
|
|
756
|
-
publish();
|
|
757
|
-
} catch (error) {
|
|
758
|
-
record.failures.push("close");
|
|
759
|
-
reportFailure(entry.id, "close", error);
|
|
760
|
-
record.state = "failed";
|
|
761
|
-
gracefulFailed = true;
|
|
762
|
-
lifetimeAbort.abort();
|
|
763
|
-
publish();
|
|
764
|
-
break;
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
clearTimeout(graceTimer);
|
|
768
|
-
parsed.signal?.removeEventListener("abort", onExternalAbort);
|
|
769
|
-
const mustForce = forcedReason !== undefined || gracefulFailed;
|
|
770
|
-
const pendingOperationsAtForce = mustForce ? pending : 0;
|
|
771
|
-
if (mustForce) {
|
|
772
|
-
lifetimeAbort.abort();
|
|
773
|
-
const forceAbort = new AbortController;
|
|
774
|
-
const forceTimer = setTimeout(() => forceAbort.abort(), Math.max(0, forceDeadlineAt - performance.now()));
|
|
775
|
-
await Promise.all(reverse.map(async (entry) => {
|
|
776
|
-
const record = records.get(entry.id);
|
|
777
|
-
if (!record?.attempted || record.closed)
|
|
778
|
-
return;
|
|
779
|
-
try {
|
|
780
|
-
let cleanup;
|
|
781
|
-
if (entry.resource.force) {
|
|
782
|
-
cleanup = Promise.resolve(entry.resource.force(contextFor(record, {
|
|
783
|
-
signal: forceAbort.signal,
|
|
784
|
-
deadlineAt: graceDeadlineAt,
|
|
785
|
-
forceDeadlineAt
|
|
786
|
-
})));
|
|
787
|
-
} else if (entry.resource.close && !record.closeInvoked) {
|
|
788
|
-
record.closeInvoked = true;
|
|
789
|
-
cleanup = Promise.resolve(entry.resource.close(contextFor(record, {
|
|
790
|
-
signal: forceAbort.signal,
|
|
791
|
-
deadlineAt: graceDeadlineAt,
|
|
792
|
-
forceDeadlineAt
|
|
793
|
-
})));
|
|
794
|
-
} else if (entry.resource.close) {
|
|
795
|
-
record.failures.push("force");
|
|
796
|
-
reportFailure(entry.id, "force", new Error(`[stitchkit] resource "${entry.id}" was already closing and did not settle before the force deadline`));
|
|
797
|
-
return;
|
|
798
|
-
}
|
|
799
|
-
const forced = await untilDeadline(cleanup ?? Promise.resolve(), forceAbort.signal);
|
|
800
|
-
if (!forced.settled || forced.error !== undefined) {
|
|
801
|
-
record.failures.push("force");
|
|
802
|
-
reportFailure(entry.id, "force", forced.settled ? forced.error : new Error("[stitchkit] forced cleanup did not settle in time"));
|
|
803
|
-
return;
|
|
804
|
-
}
|
|
805
|
-
record.closed = true;
|
|
806
|
-
record.state = "stopped";
|
|
807
|
-
} catch (error) {
|
|
808
|
-
record.failures.push("force");
|
|
809
|
-
reportFailure(entry.id, "force", error);
|
|
810
|
-
}
|
|
811
|
-
}));
|
|
812
|
-
clearTimeout(forceTimer);
|
|
813
|
-
}
|
|
814
|
-
const cleanupComplete = [...records.values()].every((record) => !record.attempted || record.closed);
|
|
815
|
-
lifecycle = cleanupComplete ? "stopped" : "failed";
|
|
816
|
-
publish();
|
|
817
|
-
return ApplicationShutdownResultSchema.parse({
|
|
818
|
-
outcome: mustForce ? "forced" : "clean",
|
|
819
|
-
...forcedReason && { reason: forcedReason },
|
|
820
|
-
cleanupComplete,
|
|
821
|
-
acceptedOperations: accepted,
|
|
822
|
-
completedOperations: completed,
|
|
823
|
-
pendingOperations: pending,
|
|
824
|
-
pendingOperationsAtForce,
|
|
825
|
-
resources: ordered.map((entry) => {
|
|
826
|
-
const record = records.get(entry.id);
|
|
827
|
-
if (!record)
|
|
828
|
-
throw new Error("Managed resource record disappeared");
|
|
829
|
-
return {
|
|
830
|
-
id: entry.id,
|
|
831
|
-
state: !record.attempted ? "not-started" : record.closed ? "closed" : "force-failed",
|
|
832
|
-
failures: record.failures
|
|
833
|
-
};
|
|
834
|
-
}),
|
|
835
|
-
durationMs: performance.now() - startedAt
|
|
836
|
-
});
|
|
837
|
-
})();
|
|
838
|
-
shutdownPromise.catch(() => {
|
|
839
|
-
return;
|
|
840
|
-
});
|
|
841
|
-
return shutdownPromise;
|
|
842
|
-
};
|
|
843
|
-
return {
|
|
844
|
-
id,
|
|
845
|
-
admission: { acquire, run },
|
|
846
|
-
start,
|
|
847
|
-
getSnapshot: snapshot,
|
|
848
|
-
subscribe(listener) {
|
|
849
|
-
listeners.add(listener);
|
|
850
|
-
listener(snapshot());
|
|
851
|
-
return () => listeners.delete(listener);
|
|
852
|
-
},
|
|
853
|
-
shutdown,
|
|
854
|
-
restart(input) {
|
|
855
|
-
const queued = restarting.then(() => runRestart(input));
|
|
856
|
-
restarting = queued.then(() => {
|
|
857
|
-
return;
|
|
858
|
-
}, () => {
|
|
859
|
-
return;
|
|
860
|
-
});
|
|
861
|
-
return queued;
|
|
862
|
-
}
|
|
863
|
-
};
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
export { ApplicationShutdownOptionsSchema, ApplicationShutdownBudgetSchema, ApplicationRestartInputSchema, ApplicationRestartOutcomeSchema, ApplicationRestartResultSchema, ApplicationAdmissionError, createApplication };
|