stitchkit 0.126.0 → 0.128.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1767 -0
- package/README.md +12 -4
- package/dist/agent-executor/acp/scenarios.d.ts +4 -0
- package/dist/agent-executor/acp/scenarios.d.ts.map +1 -0
- package/dist/agent-executor/acp/v1-connect.d.ts +97 -0
- package/dist/agent-executor/acp/v1-connect.d.ts.map +1 -0
- package/dist/agent-executor/acp/v1-driver.d.ts +37 -0
- package/dist/agent-executor/acp/v1-driver.d.ts.map +1 -0
- package/dist/agent-executor/acp/v1-map.d.ts +41 -0
- package/dist/agent-executor/acp/v1-map.d.ts.map +1 -0
- package/dist/agent-executor/acp/v1-protocol.d.ts +270 -0
- package/dist/agent-executor/acp/v1-protocol.d.ts.map +1 -0
- package/dist/agent-executor/acp/v1-session.d.ts +30 -0
- package/dist/agent-executor/acp/v1-session.d.ts.map +1 -0
- package/dist/agent-executor/acp/v1-turn.d.ts +25 -0
- package/dist/agent-executor/acp/v1-turn.d.ts.map +1 -0
- package/dist/agent-executor/claude/classify.d.ts +54 -0
- package/dist/agent-executor/claude/classify.d.ts.map +1 -0
- package/dist/agent-executor/claude/cli-driver.d.ts +31 -0
- package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -0
- package/dist/agent-executor/claude/limits.d.ts +8 -0
- package/dist/agent-executor/claude/limits.d.ts.map +1 -0
- package/dist/agent-executor/claude/protocol.d.ts +206 -0
- package/dist/agent-executor/claude/protocol.d.ts.map +1 -0
- package/dist/agent-executor/claude/scenarios.d.ts +4 -0
- package/dist/agent-executor/claude/scenarios.d.ts.map +1 -0
- package/dist/agent-executor/claude/session.d.ts +23 -0
- package/dist/agent-executor/claude/session.d.ts.map +1 -0
- package/dist/agent-executor/claude/transcript.d.ts +36 -0
- package/dist/agent-executor/claude/transcript.d.ts.map +1 -0
- package/dist/agent-executor/claude-sdk/driver.d.ts +35 -0
- package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -0
- package/dist/agent-executor/claude-sdk/session.d.ts +10 -0
- package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -0
- package/dist/agent-executor/codex/classify.d.ts +28 -0
- package/dist/agent-executor/codex/classify.d.ts.map +1 -0
- package/dist/agent-executor/codex/driver.d.ts +27 -0
- package/dist/agent-executor/codex/driver.d.ts.map +1 -0
- package/dist/agent-executor/codex/limits.d.ts +4 -0
- package/dist/agent-executor/codex/limits.d.ts.map +1 -0
- package/dist/agent-executor/codex/protocol.d.ts +176 -0
- package/dist/agent-executor/codex/protocol.d.ts.map +1 -0
- package/dist/agent-executor/codex/scenarios.d.ts +4 -0
- package/dist/agent-executor/codex/scenarios.d.ts.map +1 -0
- package/dist/agent-executor/codex/session.d.ts +43 -0
- package/dist/agent-executor/codex/session.d.ts.map +1 -0
- package/dist/agent-executor/contract.d.ts +454 -0
- package/dist/agent-executor/contract.d.ts.map +1 -0
- package/dist/agent-executor/dispatch.d.ts +41 -0
- package/dist/agent-executor/dispatch.d.ts.map +1 -0
- package/dist/agent-executor/engine-process.d.ts +45 -0
- package/dist/agent-executor/engine-process.d.ts.map +1 -0
- package/dist/agent-executor/engine-requests.d.ts +63 -0
- package/dist/agent-executor/engine-requests.d.ts.map +1 -0
- package/dist/agent-executor/engine.d.ts +64 -0
- package/dist/agent-executor/engine.d.ts.map +1 -0
- package/dist/agent-executor/executor-contract.d.ts +387 -0
- package/dist/agent-executor/executor-contract.d.ts.map +1 -0
- package/dist/agent-executor/executor-machine.d.ts +50 -0
- package/dist/agent-executor/executor-machine.d.ts.map +1 -0
- package/dist/agent-executor/hello.d.ts +235 -0
- package/dist/agent-executor/hello.d.ts.map +1 -0
- package/dist/agent-executor/image-input.d.ts +71 -0
- package/dist/agent-executor/image-input.d.ts.map +1 -0
- package/dist/agent-executor/json-rpc-peer.d.ts +48 -0
- package/dist/agent-executor/json-rpc-peer.d.ts.map +1 -0
- package/dist/agent-executor/leases.d.ts +159 -0
- package/dist/agent-executor/leases.d.ts.map +1 -0
- package/dist/agent-executor/plan-limits.d.ts +25 -0
- package/dist/agent-executor/plan-limits.d.ts.map +1 -0
- package/dist/agent-executor/profile.d.ts +52 -0
- package/dist/agent-executor/profile.d.ts.map +1 -0
- package/dist/agent-executor/projection.d.ts +14 -0
- package/dist/agent-executor/projection.d.ts.map +1 -0
- package/dist/agent-executor/session-primitives.d.ts +69 -0
- package/dist/agent-executor/session-primitives.d.ts.map +1 -0
- package/dist/agent-executor/testing/conformance.d.ts +55 -0
- package/dist/agent-executor/testing/conformance.d.ts.map +1 -0
- package/dist/agent-executor/testing/fake-claude-engine.d.ts +18 -0
- package/dist/agent-executor/testing/fake-claude-engine.d.ts.map +1 -0
- package/dist/agent-executor/testing/fake-engine.d.ts +52 -0
- package/dist/agent-executor/testing/fake-engine.d.ts.map +1 -0
- package/dist/agent-executor/turn-phases.d.ts +10 -0
- package/dist/agent-executor/turn-phases.d.ts.map +1 -0
- package/dist/agent-executor/vocabulary.d.ts +353 -0
- package/dist/agent-executor/vocabulary.d.ts.map +1 -0
- package/dist/agent-parts/parts.d.ts +160 -0
- package/dist/agent-parts/parts.d.ts.map +1 -0
- package/dist/agent-runtime/agent-tool.d.ts +22 -8
- package/dist/agent-runtime/agent-tool.d.ts.map +1 -1
- package/dist/agent-runtime/archive-projection.d.ts +5 -0
- package/dist/agent-runtime/archive-projection.d.ts.map +1 -1
- package/dist/agent-runtime/branch-contract.d.ts +60 -2
- package/dist/agent-runtime/branch-contract.d.ts.map +1 -1
- package/dist/agent-runtime/branch-events.d.ts +7 -0
- package/dist/agent-runtime/branch-events.d.ts.map +1 -1
- package/dist/agent-runtime/branch-identities.d.ts +43 -6
- package/dist/agent-runtime/branch-identities.d.ts.map +1 -1
- package/dist/agent-runtime/branch-messages.d.ts +11 -29
- package/dist/agent-runtime/branch-messages.d.ts.map +1 -1
- package/dist/agent-runtime/branch-observations.d.ts +153 -30
- package/dist/agent-runtime/branch-observations.d.ts.map +1 -1
- package/dist/agent-runtime/branch-provider.d.ts +43 -56
- package/dist/agent-runtime/branch-provider.d.ts.map +1 -1
- package/dist/agent-runtime/branch-refusal.d.ts +60 -0
- package/dist/agent-runtime/branch-refusal.d.ts.map +1 -0
- package/dist/agent-runtime/branch-runtime-tools.d.ts +14 -0
- package/dist/agent-runtime/branch-runtime-tools.d.ts.map +1 -0
- package/dist/agent-runtime/branch-source.d.ts +19 -2
- package/dist/agent-runtime/branch-source.d.ts.map +1 -1
- package/dist/agent-runtime/branch-transitions.d.ts.map +1 -1
- package/dist/agent-runtime/browser-control-contract.d.ts +2 -2
- package/dist/agent-runtime/browser-controller.d.ts.map +1 -1
- package/dist/agent-runtime/child-blocking.d.ts +17 -6
- package/dist/agent-runtime/child-blocking.d.ts.map +1 -1
- package/dist/agent-runtime/child-budget-policy.d.ts +4 -9
- package/dist/agent-runtime/child-budget-policy.d.ts.map +1 -1
- package/dist/agent-runtime/child-tools.d.ts +82 -7
- package/dist/agent-runtime/child-tools.d.ts.map +1 -1
- package/dist/agent-runtime/children-contract.d.ts +84 -3
- package/dist/agent-runtime/children-contract.d.ts.map +1 -1
- package/dist/agent-runtime/children-control.d.ts +23 -2
- package/dist/agent-runtime/children-control.d.ts.map +1 -1
- package/dist/agent-runtime/children-spawn.d.ts +9 -0
- package/dist/agent-runtime/children-spawn.d.ts.map +1 -1
- package/dist/agent-runtime/children-state.d.ts +121 -19
- package/dist/agent-runtime/children-state.d.ts.map +1 -1
- package/dist/agent-runtime/children-usage.d.ts +10 -1
- package/dist/agent-runtime/children-usage.d.ts.map +1 -1
- package/dist/agent-runtime/children.d.ts +3 -3
- package/dist/agent-runtime/children.d.ts.map +1 -1
- package/dist/agent-runtime/{sandbox-coding.d.ts → coding-sandbox.d.ts} +2 -9
- package/dist/agent-runtime/coding-sandbox.d.ts.map +1 -0
- package/dist/agent-runtime/coding-shell-process.d.ts +2 -0
- package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-contract.d.ts +32 -1
- package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tools.d.ts.map +1 -1
- package/dist/agent-runtime/compaction.d.ts.map +1 -1
- package/dist/agent-runtime/companion-host.d.ts +38 -0
- package/dist/agent-runtime/companion-host.d.ts.map +1 -0
- package/dist/agent-runtime/context-issue.d.ts +5 -0
- package/dist/agent-runtime/context-issue.d.ts.map +1 -0
- package/dist/agent-runtime/control-schema.d.ts +2 -2
- package/dist/agent-runtime/control-schema.d.ts.map +1 -1
- package/dist/agent-runtime/conversations.d.ts.map +1 -1
- package/dist/agent-runtime/coordinator.d.ts.map +1 -1
- package/dist/agent-runtime/deferred-tool-types.d.ts +17 -5
- package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
- package/dist/agent-runtime/deferred-tools-internal.d.ts +2 -0
- package/dist/agent-runtime/deferred-tools-internal.d.ts.map +1 -1
- package/dist/agent-runtime/deferred-tools.d.ts.map +1 -1
- package/dist/agent-runtime/event-durability.d.ts +8 -0
- package/dist/agent-runtime/event-durability.d.ts.map +1 -0
- package/dist/agent-runtime/event-schema.d.ts +13 -5
- package/dist/agent-runtime/event-schema.d.ts.map +1 -1
- package/dist/agent-runtime/event-search-postgres.d.ts +38 -0
- package/dist/agent-runtime/event-search-postgres.d.ts.map +1 -0
- package/dist/agent-runtime/event-search-terms.d.ts +37 -0
- package/dist/agent-runtime/event-search-terms.d.ts.map +1 -0
- package/dist/agent-runtime/event-search-tools.d.ts +141 -4
- package/dist/agent-runtime/event-search-tools.d.ts.map +1 -1
- package/dist/agent-runtime/event-search.d.ts +16 -3
- package/dist/agent-runtime/event-search.d.ts.map +1 -1
- package/dist/agent-runtime/fault-bench.d.ts.map +1 -1
- package/dist/agent-runtime/harness-control.d.ts +8 -0
- package/dist/agent-runtime/harness-control.d.ts.map +1 -1
- package/dist/agent-runtime/harness-realtime.d.ts +0 -2
- package/dist/agent-runtime/harness-realtime.d.ts.map +1 -1
- package/dist/agent-runtime/invocation-attempt.d.ts +1 -1
- package/dist/agent-runtime/invocation-attempt.d.ts.map +1 -1
- package/dist/agent-runtime/invocation-payload.d.ts +12 -0
- package/dist/agent-runtime/invocation-payload.d.ts.map +1 -1
- package/dist/agent-runtime/invocation-read.d.ts +6 -3
- package/dist/agent-runtime/invocation-read.d.ts.map +1 -1
- package/dist/agent-runtime/invocation-schema.d.ts +70 -5
- package/dist/agent-runtime/invocation-schema.d.ts.map +1 -1
- package/dist/agent-runtime/invocation-spend.d.ts +9 -0
- package/dist/agent-runtime/invocation-spend.d.ts.map +1 -0
- package/dist/agent-runtime/invocations.d.ts +20 -9
- package/dist/agent-runtime/invocations.d.ts.map +1 -1
- package/dist/agent-runtime/managed-tools.d.ts +2 -2
- package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
- package/dist/agent-runtime/observability.d.ts +42 -4
- package/dist/agent-runtime/observability.d.ts.map +1 -1
- package/dist/agent-runtime/openrouter-admission.d.ts +81 -0
- package/dist/agent-runtime/openrouter-admission.d.ts.map +1 -0
- package/dist/agent-runtime/openrouter-catalog.d.ts +83 -0
- package/dist/agent-runtime/openrouter-catalog.d.ts.map +1 -0
- package/dist/agent-runtime/openrouter-models.d.ts +66 -0
- package/dist/agent-runtime/openrouter-models.d.ts.map +1 -0
- package/dist/agent-runtime/openrouter-options.d.ts +106 -0
- package/dist/agent-runtime/openrouter-options.d.ts.map +1 -0
- package/dist/agent-runtime/openrouter-route.d.ts +50 -0
- package/dist/agent-runtime/openrouter-route.d.ts.map +1 -0
- package/dist/agent-runtime/openrouter-spend.d.ts +24 -0
- package/dist/agent-runtime/openrouter-spend.d.ts.map +1 -0
- package/dist/agent-runtime/openrouter.d.ts +23 -2
- package/dist/agent-runtime/openrouter.d.ts.map +1 -1
- package/dist/agent-runtime/owned-provider-stream.d.ts.map +1 -1
- package/dist/agent-runtime/postgres-schema.d.ts +34 -0
- package/dist/agent-runtime/postgres-schema.d.ts.map +1 -0
- package/dist/agent-runtime/postgres-transactions.d.ts +54 -0
- package/dist/agent-runtime/postgres-transactions.d.ts.map +1 -0
- package/dist/agent-runtime/postgres.d.ts +72 -0
- package/dist/agent-runtime/postgres.d.ts.map +1 -0
- package/dist/agent-runtime/projections.d.ts +57 -17
- package/dist/agent-runtime/projections.d.ts.map +1 -1
- package/dist/agent-runtime/provider-journal.d.ts +57 -0
- package/dist/agent-runtime/provider-journal.d.ts.map +1 -1
- package/dist/agent-runtime/purge.d.ts.map +1 -1
- package/dist/agent-runtime/retry-policy.d.ts +6 -0
- package/dist/agent-runtime/retry-policy.d.ts.map +1 -1
- package/dist/agent-runtime/run-acquisition.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution-state.d.ts +26 -2
- package/dist/agent-runtime/run-execution-state.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/run-failure.d.ts.map +1 -1
- package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -1
- package/dist/agent-runtime/run-provider-ledger.d.ts +2 -0
- package/dist/agent-runtime/run-provider-ledger.d.ts.map +1 -1
- package/dist/agent-runtime/run-step-barriers.d.ts +72 -0
- package/dist/agent-runtime/run-step-barriers.d.ts.map +1 -0
- package/dist/agent-runtime/run-step-spend.d.ts +319 -0
- package/dist/agent-runtime/run-step-spend.d.ts.map +1 -0
- package/dist/agent-runtime/run-stream-parts.d.ts +2 -0
- package/dist/agent-runtime/run-stream-parts.d.ts.map +1 -1
- package/dist/agent-runtime/{tool-progress.d.ts → run-tool-progress.d.ts} +1 -1
- package/dist/agent-runtime/run-tool-progress.d.ts.map +1 -0
- package/dist/agent-runtime/run-turn-preparation.d.ts +3 -1
- package/dist/agent-runtime/run-turn-preparation.d.ts.map +1 -1
- package/dist/agent-runtime/runtime-admission-gate.d.ts +0 -14
- package/dist/agent-runtime/runtime-admission-gate.d.ts.map +1 -1
- package/dist/agent-runtime/runtime-internals.d.ts +6 -0
- package/dist/agent-runtime/runtime-internals.d.ts.map +1 -1
- package/dist/agent-runtime/runtime-state.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +31 -2
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-binding.d.ts +10 -0
- package/dist/agent-runtime/sandbox-binding.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-bubblewrap-storage.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-contract.d.ts +1 -1
- package/dist/agent-runtime/sandbox-contract.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox.d.ts +5 -0
- package/dist/agent-runtime/sandbox.d.ts.map +1 -1
- package/dist/agent-runtime/schedule-contract.d.ts +3 -2
- package/dist/agent-runtime/schedule-contract.d.ts.map +1 -1
- package/dist/agent-runtime/schedule-dispatch.d.ts +3 -2
- package/dist/agent-runtime/schedule-dispatch.d.ts.map +1 -1
- package/dist/agent-runtime/schedule-records.d.ts +6 -6
- package/dist/agent-runtime/schedule-records.d.ts.map +1 -1
- package/dist/agent-runtime/schedule-tools.d.ts +49 -8
- package/dist/agent-runtime/schedule-tools.d.ts.map +1 -1
- package/dist/agent-runtime/schedules.d.ts +13 -3
- package/dist/agent-runtime/schedules.d.ts.map +1 -1
- package/dist/agent-runtime/schemas-invocation-payload.d.ts +48 -0
- package/dist/agent-runtime/schemas-invocation-payload.d.ts.map +1 -0
- package/dist/agent-runtime/schemas-message.d.ts +118 -0
- package/dist/agent-runtime/schemas-message.d.ts.map +1 -0
- package/dist/agent-runtime/schemas-provider.d.ts +8 -0
- package/dist/agent-runtime/schemas-provider.d.ts.map +1 -0
- package/dist/agent-runtime/schemas-records.d.ts +5 -0
- package/dist/agent-runtime/schemas-records.d.ts.map +1 -0
- package/dist/agent-runtime/schemas-run.d.ts +487 -0
- package/dist/agent-runtime/schemas-run.d.ts.map +1 -0
- package/dist/agent-runtime/schemas-usage.d.ts +129 -0
- package/dist/agent-runtime/schemas-usage.d.ts.map +1 -0
- package/dist/agent-runtime/schemas.d.ts +11 -886
- package/dist/agent-runtime/schemas.d.ts.map +1 -1
- package/dist/agent-runtime/spill.d.ts +9 -7
- package/dist/agent-runtime/spill.d.ts.map +1 -1
- package/dist/agent-runtime/sql-events.d.ts +6 -0
- package/dist/agent-runtime/sql-events.d.ts.map +1 -0
- package/dist/agent-runtime/sql-history.d.ts +8 -0
- package/dist/agent-runtime/sql-history.d.ts.map +1 -0
- package/dist/agent-runtime/sql-ledger.d.ts +5 -0
- package/dist/agent-runtime/sql-ledger.d.ts.map +1 -0
- package/dist/agent-runtime/sql-purge.d.ts +13 -0
- package/dist/agent-runtime/sql-purge.d.ts.map +1 -0
- package/dist/agent-runtime/sql-reads.d.ts +16 -0
- package/dist/agent-runtime/sql-reads.d.ts.map +1 -0
- package/dist/agent-runtime/{sqlite-rows.d.ts → sql-rows.d.ts} +24 -10
- package/dist/agent-runtime/sql-rows.d.ts.map +1 -0
- package/dist/agent-runtime/sql-session.d.ts +82 -0
- package/dist/agent-runtime/sql-session.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-bun.d.ts +1 -1
- package/dist/agent-runtime/sqlite-bun.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite-node.d.ts +1 -1
- package/dist/agent-runtime/sqlite-node.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite-purge.d.ts +2 -3
- package/dist/agent-runtime/sqlite-purge.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite-schema.d.ts +1 -1
- package/dist/agent-runtime/sqlite-schema.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite-transactions.d.ts +10 -6
- package/dist/agent-runtime/sqlite-transactions.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite.d.ts +10 -29
- package/dist/agent-runtime/sqlite.d.ts.map +1 -1
- package/dist/agent-runtime/state-tools.d.ts +63 -4
- package/dist/agent-runtime/state-tools.d.ts.map +1 -1
- package/dist/agent-runtime/store-archive.d.ts.map +1 -1
- package/dist/agent-runtime/store-branch.d.ts +6 -1
- package/dist/agent-runtime/store-branch.d.ts.map +1 -1
- package/dist/agent-runtime/store-capabilities.d.ts +42 -0
- package/dist/agent-runtime/store-capabilities.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-branch.d.ts +5 -2
- package/dist/agent-runtime/store-conformance-branch.d.ts.map +1 -1
- package/dist/agent-runtime/store-conformance-capabilities.d.ts +6 -0
- package/dist/agent-runtime/store-conformance-capabilities.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-event-once.d.ts +12 -0
- package/dist/agent-runtime/store-conformance-event-once.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-seed.d.ts +8 -0
- package/dist/agent-runtime/store-conformance-seed.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
- package/dist/agent-runtime/store-conformance.d.ts +31 -8
- package/dist/agent-runtime/store-conformance.d.ts.map +1 -1
- package/dist/agent-runtime/store-create.d.ts +1 -1
- package/dist/agent-runtime/store-create.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver-contract.d.ts +27 -8
- package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -1
- package/dist/agent-runtime/store-event-once.d.ts.map +1 -1
- package/dist/agent-runtime/store-events.d.ts +114 -0
- package/dist/agent-runtime/store-events.d.ts.map +1 -1
- package/dist/agent-runtime/store-memory-archive.d.ts +2 -0
- package/dist/agent-runtime/store-memory-archive.d.ts.map +1 -1
- package/dist/agent-runtime/store-memory-events.d.ts.map +1 -1
- package/dist/agent-runtime/store-memory.d.ts +2 -2
- package/dist/agent-runtime/store-memory.d.ts.map +1 -1
- package/dist/agent-runtime/store-mutate.d.ts.map +1 -1
- package/dist/agent-runtime/store-reduce-shared.d.ts +2 -1
- package/dist/agent-runtime/store-reduce-shared.d.ts.map +1 -1
- package/dist/agent-runtime/store-reducer.d.ts.map +1 -1
- package/dist/agent-runtime/store-replay.d.ts.map +1 -1
- package/dist/agent-runtime/store.d.ts +22 -2
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/agent-runtime/terminal-commit.d.ts +10 -10
- package/dist/application/admission-run.d.ts.map +1 -1
- package/dist/application/admission.d.ts.map +1 -1
- package/dist/application/change-subscription.d.ts.map +1 -1
- package/dist/application/decisions.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-lock-format.d.ts +9 -0
- package/dist/application/diagnostic-journal-lock-format.d.ts.map +1 -0
- package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
- package/dist/application/directory-inbox-delivery.d.ts.map +1 -1
- package/dist/application/grammy-update-admission.d.ts.map +1 -1
- package/dist/application/health.d.ts.map +1 -1
- package/dist/application/kernel-admission.d.ts.map +1 -1
- package/dist/application/kernel-contract.d.ts.map +1 -1
- package/dist/application/kernel-restart.d.ts.map +1 -1
- package/dist/application/kernel-rollback.d.ts.map +1 -1
- package/dist/application/kernel-shutdown.d.ts.map +1 -1
- package/dist/application/kernel-state.d.ts.map +1 -1
- package/dist/application/notification-outbox-state.d.ts.map +1 -1
- package/dist/application/notification-outbox.d.ts +1 -1
- package/dist/application/notification-outbox.d.ts.map +1 -1
- package/dist/application/revision-signal.d.ts.map +1 -1
- package/dist/application/schedule-run.d.ts.map +1 -1
- package/dist/application/schedule.d.ts.map +1 -1
- package/dist/application/sqlite-migrations.d.ts +104 -0
- package/dist/application/sqlite-migrations.d.ts.map +1 -0
- package/dist/application/watch-hub-core.d.ts.map +1 -1
- package/dist/browser/bridge-errors.d.ts +24 -0
- package/dist/browser/bridge-errors.d.ts.map +1 -0
- package/dist/browser/bridge-fetch.d.ts +30 -0
- package/dist/browser/bridge-fetch.d.ts.map +1 -0
- package/dist/browser/bridge-inbound.d.ts +28 -0
- package/dist/browser/bridge-inbound.d.ts.map +1 -0
- package/dist/browser/cancellation.d.ts +10 -2
- package/dist/browser/cancellation.d.ts.map +1 -1
- package/dist/browser/chunked-upload.d.ts +1 -1
- package/dist/browser/chunked-upload.d.ts.map +1 -1
- package/dist/browser/client-call-arguments.d.ts +31 -0
- package/dist/browser/client-call-arguments.d.ts.map +1 -0
- package/dist/browser/client-executors.d.ts +6 -0
- package/dist/browser/client-executors.d.ts.map +1 -1
- package/dist/browser/client.d.ts +9 -0
- package/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/http.d.ts +17 -2
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/realtime-client.d.ts +0 -5
- package/dist/browser/realtime-client.d.ts.map +1 -1
- package/dist/browser/session-credentials-storage.d.ts +48 -0
- package/dist/browser/session-credentials-storage.d.ts.map +1 -0
- package/dist/browser/session-credentials.d.ts +26 -5
- package/dist/browser/session-credentials.d.ts.map +1 -1
- package/dist/browser/session-refresh-policy.d.ts +124 -0
- package/dist/browser/session-refresh-policy.d.ts.map +1 -0
- package/dist/browser/session-refresh-timer.d.ts +30 -0
- package/dist/browser/session-refresh-timer.d.ts.map +1 -0
- package/dist/browser/session.d.ts.map +1 -1
- package/dist/browser/socket-io-connection.d.ts.map +1 -1
- package/dist/browser/socket-io-explicit-peer.d.ts +0 -1
- package/dist/browser/socket-io-explicit-peer.d.ts.map +1 -1
- package/dist/browser/stream.d.ts +1 -1
- package/dist/browser/stream.d.ts.map +1 -1
- package/dist/browser/upload-progress.d.ts +3 -0
- package/dist/browser/upload-progress.d.ts.map +1 -1
- package/dist/contract/bridge-envelope.d.ts +155 -0
- package/dist/contract/bridge-envelope.d.ts.map +1 -0
- package/dist/contract/define-validation.d.ts +2 -0
- package/dist/contract/define-validation.d.ts.map +1 -1
- package/dist/contract/define.d.ts +3 -0
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/errors.d.ts +4 -4
- package/dist/contract/errors.d.ts.map +1 -1
- package/dist/contract/normalize.d.ts +3 -1
- package/dist/contract/normalize.d.ts.map +1 -1
- package/dist/contract/operation-effect.d.ts +29 -0
- package/dist/contract/operation-effect.d.ts.map +1 -0
- package/dist/contract/runtime-context.d.ts +2 -0
- package/dist/contract/runtime-context.d.ts.map +1 -1
- package/dist/contract/tool-options.d.ts +7 -0
- package/dist/contract/tool-options.d.ts.map +1 -1
- package/dist/declaration/command.d.ts +26 -0
- package/dist/declaration/command.d.ts.map +1 -0
- package/dist/declaration/declaration.d.ts +10 -25
- package/dist/declaration/declaration.d.ts.map +1 -1
- package/dist/declaration/machine-names.d.ts +11 -0
- package/dist/declaration/machine-names.d.ts.map +1 -0
- package/dist/durability/effect.d.ts.map +1 -1
- package/dist/durability/engine.d.ts.map +1 -1
- package/dist/durability/events.d.ts +5 -8
- package/dist/durability/events.d.ts.map +1 -1
- package/dist/durability/parks.d.ts +0 -5
- package/dist/durability/parks.d.ts.map +1 -1
- package/dist/durability/scheduler.d.ts +5 -0
- package/dist/durability/scheduler.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/acp.d.ts +4 -0
- package/dist/entrypoints/agent-executor/acp.d.ts.map +1 -0
- package/dist/entrypoints/agent-executor/acp.js +921 -0
- package/dist/entrypoints/agent-executor/claude-sdk.d.ts +2 -0
- package/dist/entrypoints/agent-executor/claude-sdk.d.ts.map +1 -0
- package/dist/entrypoints/agent-executor/claude-sdk.js +325 -0
- package/dist/entrypoints/agent-executor/claude.d.ts +5 -0
- package/dist/entrypoints/agent-executor/claude.d.ts.map +1 -0
- package/dist/entrypoints/agent-executor/claude.js +422 -0
- package/dist/entrypoints/agent-executor/codex.d.ts +4 -0
- package/dist/entrypoints/agent-executor/codex.d.ts.map +1 -0
- package/dist/entrypoints/agent-executor/codex.js +858 -0
- package/dist/entrypoints/agent-executor/testing.d.ts +4 -0
- package/dist/entrypoints/agent-executor/testing.d.ts.map +1 -0
- package/dist/entrypoints/agent-executor/testing.js +375 -0
- package/dist/entrypoints/agent-executor.d.ts +15 -0
- package/dist/entrypoints/agent-executor.d.ts.map +1 -0
- package/dist/entrypoints/agent-executor.js +455 -0
- package/dist/entrypoints/agent-runtime/browser.d.ts +1 -0
- package/dist/entrypoints/agent-runtime/browser.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/browser.js +60 -30
- package/dist/entrypoints/agent-runtime/coding-tools.js +9 -12
- package/dist/entrypoints/agent-runtime/harness.js +34 -22
- package/dist/entrypoints/agent-runtime/openrouter.d.ts +6 -0
- package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/openrouter.js +675 -45
- package/dist/entrypoints/agent-runtime/postgres.d.ts +4 -0
- package/dist/entrypoints/agent-runtime/postgres.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/postgres.js +335 -0
- package/dist/entrypoints/agent-runtime/realtime.js +46 -49
- package/dist/entrypoints/agent-runtime/sandbox.d.ts +3 -1
- package/dist/entrypoints/agent-runtime/sandbox.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/sandbox.js +74 -67
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +18 -18
- package/dist/entrypoints/agent-runtime/sqlite/node.js +18 -18
- package/dist/entrypoints/agent-runtime/testing.d.ts +1 -1
- package/dist/entrypoints/agent-runtime/testing.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/testing.js +394 -95
- package/dist/entrypoints/agent-runtime.d.ts +26 -16
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime.js +1439 -1198
- package/dist/entrypoints/application/diagnostic-journal.js +16 -11
- package/dist/entrypoints/application/directory-inbox.js +20 -14
- package/dist/entrypoints/application/grammy.js +11 -8
- package/dist/entrypoints/application/opentelemetry.js +3 -3
- package/dist/entrypoints/application.d.ts +4 -2
- package/dist/entrypoints/application.d.ts.map +1 -1
- package/dist/entrypoints/application.js +409 -108
- package/dist/entrypoints/bin/upgrade-cli.d.ts +0 -12
- package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -1
- package/dist/entrypoints/bin/upgrade-cli.js +11 -7
- package/dist/entrypoints/cli/publish.js +10 -9
- package/dist/entrypoints/cli.d.ts +10 -3
- package/dist/entrypoints/cli.d.ts.map +1 -1
- package/dist/entrypoints/cli.js +92 -29
- package/dist/entrypoints/contract.d.ts +2 -1
- package/dist/entrypoints/contract.d.ts.map +1 -1
- package/dist/entrypoints/contract.js +13 -7
- package/dist/entrypoints/declaration.d.ts +2 -0
- package/dist/entrypoints/declaration.d.ts.map +1 -1
- package/dist/entrypoints/declaration.js +54 -44
- package/dist/entrypoints/files/packaging.js +8 -5
- package/dist/entrypoints/files.d.ts +5 -0
- package/dist/entrypoints/files.d.ts.map +1 -1
- package/dist/entrypoints/files.js +259 -47
- package/dist/entrypoints/geo.js +9 -4
- package/dist/entrypoints/google.js +14 -13
- package/dist/entrypoints/handler.d.ts +12 -0
- package/dist/entrypoints/handler.d.ts.map +1 -0
- package/dist/entrypoints/handler.js +350 -0
- package/dist/entrypoints/http.d.ts +4 -0
- package/dist/entrypoints/http.d.ts.map +1 -1
- package/dist/entrypoints/http.js +411 -5
- package/dist/entrypoints/index.d.ts +2 -0
- package/dist/entrypoints/index.d.ts.map +1 -1
- package/dist/entrypoints/index.js +664 -91
- package/dist/entrypoints/live.js +22 -12
- package/dist/entrypoints/node.d.ts +2 -1
- package/dist/entrypoints/node.d.ts.map +1 -1
- package/dist/entrypoints/node.js +34 -25
- package/dist/entrypoints/observability.d.ts +2 -0
- package/dist/entrypoints/observability.d.ts.map +1 -1
- package/dist/entrypoints/observability.js +205 -131
- package/dist/entrypoints/primitives.js +152 -14
- package/dist/entrypoints/process/owner-loss.js +2 -2
- package/dist/entrypoints/process.js +18 -92
- package/dist/entrypoints/react.js +6 -5
- package/dist/entrypoints/realtime.d.ts +1 -0
- package/dist/entrypoints/realtime.d.ts.map +1 -1
- package/dist/entrypoints/realtime.js +6 -3
- package/dist/entrypoints/release.js +4 -0
- package/dist/entrypoints/remote.js +7 -6
- package/dist/entrypoints/server.d.ts +3 -1
- package/dist/entrypoints/server.d.ts.map +1 -1
- package/dist/entrypoints/server.js +295 -194
- package/dist/entrypoints/service-host/macos.d.ts +16 -0
- package/dist/entrypoints/service-host/macos.d.ts.map +1 -0
- package/dist/entrypoints/service-host/macos.js +1998 -0
- package/dist/entrypoints/service-host.d.ts +26 -0
- package/dist/entrypoints/service-host.d.ts.map +1 -0
- package/dist/entrypoints/service-host.js +3155 -0
- package/dist/entrypoints/spend/testing.d.ts +2 -0
- package/dist/entrypoints/spend/testing.d.ts.map +1 -0
- package/dist/entrypoints/spend/testing.js +442 -0
- package/dist/entrypoints/spend.d.ts +8 -0
- package/dist/entrypoints/spend.d.ts.map +1 -0
- package/dist/entrypoints/spend.js +593 -0
- package/dist/entrypoints/sync/postgres.d.ts +12 -0
- package/dist/entrypoints/sync/postgres.d.ts.map +1 -0
- package/dist/entrypoints/sync/postgres.js +737 -0
- package/dist/entrypoints/sync.d.ts +12 -0
- package/dist/entrypoints/sync.d.ts.map +1 -0
- package/dist/entrypoints/sync.js +782 -0
- package/dist/entrypoints/telegram/grammy.js +5 -5
- package/dist/entrypoints/telegram/html.d.ts +2 -0
- package/dist/entrypoints/telegram/html.d.ts.map +1 -1
- package/dist/entrypoints/telegram/html.js +839 -2
- package/dist/entrypoints/telegram/screens.js +13 -15
- package/dist/entrypoints/telegram.d.ts +1 -1
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +286 -76
- package/dist/entrypoints/testing.js +33 -41
- package/dist/entrypoints/tools/agent.js +13 -9
- package/dist/entrypoints/tools/connections.js +664 -63
- package/dist/entrypoints/tools/contract.d.ts +2 -2
- package/dist/entrypoints/tools/contract.js +4 -1
- package/dist/entrypoints/tools/invoker.js +10 -7
- package/dist/entrypoints/tools/mcp.js +17 -13
- package/dist/entrypoints/tools/toolkit.js +22 -18
- package/dist/entrypoints/tools.d.ts +4 -2
- package/dist/entrypoints/tools.d.ts.map +1 -1
- package/dist/entrypoints/tools.js +105 -90
- package/dist/entrypoints/tracking/contract.js +2 -1
- package/dist/entrypoints/tracking/performance.js +4 -0
- package/dist/entrypoints/tracking.js +6 -1
- package/dist/entrypoints/voice.js +3 -3
- package/dist/entrypoints/xlsx.js +1 -1
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files/chunk-spool.d.ts +27 -0
- package/dist/files/chunk-spool.d.ts.map +1 -1
- package/dist/files/directory-appearance.d.ts +55 -0
- package/dist/files/directory-appearance.d.ts.map +1 -0
- package/dist/files/file-io.d.ts.map +1 -1
- package/dist/files/file-stamp.d.ts +35 -0
- package/dist/files/file-stamp.d.ts.map +1 -0
- package/dist/files/json-file-reading.d.ts +37 -0
- package/dist/files/json-file-reading.d.ts.map +1 -0
- package/dist/files/native-packaging.d.ts.map +1 -1
- package/dist/files/polled-json.d.ts +121 -0
- package/dist/files/polled-json.d.ts.map +1 -0
- package/dist/files/regular-file.d.ts +135 -0
- package/dist/files/regular-file.d.ts.map +1 -0
- package/dist/geo/index.d.ts +2 -1
- package/dist/geo/index.d.ts.map +1 -1
- package/dist/geo/resolver.d.ts.map +1 -1
- package/dist/geo/types.d.ts +0 -1
- package/dist/geo/types.d.ts.map +1 -1
- package/dist/google/google.d.ts +6 -0
- package/dist/google/google.d.ts.map +1 -1
- package/dist/{index-w0eqdhyd.js → index-09f7w2qq.js} +6 -1
- package/dist/index-0gqs8ght.js +558 -0
- package/dist/{index-t05a2ry4.js → index-0p0s5hrj.js} +8 -14
- package/dist/{index-1c945ten.js → index-0r15pkjq.js} +1 -1
- package/dist/{index-v1swr26p.js → index-0tyt97nk.js} +2 -2
- package/dist/{index-332d0m9g.js → index-0x4mnwg5.js} +4 -0
- package/dist/index-118aebbg.js +48 -0
- package/dist/index-13dnv6d0.js +296 -0
- package/dist/index-1q0n6zek.js +184 -0
- package/dist/index-1qwrczr1.js +405 -0
- package/dist/index-27hck3z2.js +307 -0
- package/dist/index-2c5w2d1d.js +107 -0
- package/dist/{index-fvd6pvw3.js → index-2nwvn7m2.js} +2 -2
- package/dist/index-2rf33y2h.js +77 -0
- package/dist/index-360j58vb.js +63 -0
- package/dist/{index-tt30h7mr.js → index-39n02e0q.js} +1 -1
- package/dist/{index-mfntvj58.js → index-3dq8466w.js} +1 -1
- package/dist/index-3tnwtz38.js +725 -0
- package/dist/{index-x2d51zay.js → index-3ypvpkwr.js} +309 -345
- package/dist/index-4gk6k3zc.js +248 -0
- package/dist/{index-kxff9e9w.js → index-4j8efqr3.js} +5 -4
- package/dist/index-4qvyhn23.js +40 -0
- package/dist/index-4ynw5ktx.js +78 -0
- package/dist/index-5awtbyns.js +19 -0
- package/dist/{index-nz06qw5a.js → index-5jyjb4s0.js} +1 -1
- package/dist/{index-7zksb1ty.js → index-5ptwb6ka.js} +1 -1
- package/dist/{index-w3nv6kr8.js → index-5q0qpw3v.js} +54 -9
- package/dist/{index-mm89hd8v.js → index-5t4fpdct.js} +1 -1
- package/dist/index-5v5vg85s.js +108 -0
- package/dist/{index-0v9xb8pz.js → index-5y7j383h.js} +5 -5
- package/dist/{index-bqzgaj57.js → index-673drwkn.js} +198 -61
- package/dist/{index-v62cpkx3.js → index-6g85s734.js} +1 -1
- package/dist/{index-sqc6ezrb.js → index-6kec3b14.js} +17 -4
- package/dist/{index-cvjddnvd.js → index-6wp4dn9d.js} +17 -8
- package/dist/{index-kqnd6a85.js → index-7416mhyh.js} +1 -1
- package/dist/{index-m0wsfmrc.js → index-7csn6pva.js} +37 -24
- package/dist/{index-dqpesdck.js → index-7grgs8cx.js} +25 -5
- package/dist/{index-jjvr9f15.js → index-7kfcb576.js} +129 -39
- package/dist/{index-ss67fxhj.js → index-877e9y8r.js} +7 -7
- package/dist/{index-aw6kx2e6.js → index-8gmmdz7k.js} +1 -1
- package/dist/index-8x22nprv.js +1461 -0
- package/dist/{index-rz3z13e9.js → index-97q9kykw.js} +1 -1
- package/dist/index-97rp94ff.js +8 -0
- package/dist/{index-0w0hxp7n.js → index-9pv126eh.js} +3 -9
- package/dist/{index-egg0yp2j.js → index-9xr44d2g.js} +86 -210
- package/dist/{index-b2sey031.js → index-9y0afd5f.js} +24 -23
- package/dist/{index-nmaqxdx7.js → index-ac5rj3d4.js} +203 -90
- package/dist/{index-wqzw3qg9.js → index-agy5fqgf.js} +32 -13
- package/dist/{index-ndjzbt2v.js → index-akf0xkrm.js} +4 -3
- package/dist/index-akfgymyr.js +8 -0
- package/dist/index-apv5xfef.js +13 -0
- package/dist/index-bh4pmtr9.js +317 -0
- package/dist/{index-fa53vygr.js → index-bmaz3jzy.js} +3 -3
- package/dist/{index-8kzct1d6.js → index-bn2baakz.js} +143 -143
- package/dist/{index-m8ddk770.js → index-brhhaygm.js} +1 -1
- package/dist/index-bz3gn6cs.js +407 -0
- package/dist/index-c5gp2gh6.js +51 -0
- package/dist/index-cbhxhma2.js +90 -0
- package/dist/index-cfnmvcq8.js +11 -0
- package/dist/index-cv9b7fz2.js +42 -0
- package/dist/index-d4svrknj.js +156 -0
- package/dist/{index-1szhrfsf.js → index-d54npte7.js} +7 -5
- package/dist/{index-ne4j9998.js → index-e06z0tkb.js} +123 -94
- package/dist/index-emgrmavr.js +1193 -0
- package/dist/{index-99nnsz39.js → index-en8e5zsj.js} +15 -135
- package/dist/{index-20hn8pbh.js → index-fmzg39a8.js} +1 -1
- package/dist/{index-ft2wvst5.js → index-g3e57qj6.js} +1928 -414
- package/dist/index-g56ht6qf.js +98 -0
- package/dist/{index-7cn66qdk.js → index-gf92hc87.js} +15 -7
- package/dist/{index-f56ct5gb.js → index-gj1rjf78.js} +4 -3
- package/dist/{index-g6a3na27.js → index-gnjgkecx.js} +7 -3
- package/dist/index-gzny6zsw.js +487 -0
- package/dist/{index-n6hvd1r2.js → index-hj1zq7mh.js} +26 -13
- package/dist/index-hy4653g4.js +345 -0
- package/dist/{index-t8jz0e20.js → index-j903yhp4.js} +30 -38
- package/dist/{index-9ypczvpj.js → index-jb4m241t.js} +2 -0
- package/dist/{index-wt6rw7rf.js → index-jfecdk1e.js} +29 -21
- package/dist/{index-cjzaj7ev.js → index-jxtg307y.js} +23 -21
- package/dist/{index-3ymcmpa9.js → index-ke02kxsr.js} +33 -163
- package/dist/{index-bz9cmnqq.js → index-kt6dh1n6.js} +4 -4
- package/dist/index-ky3ardqn.js +80 -0
- package/dist/index-kyejf658.js +14 -0
- package/dist/{index-zyc64nbh.js → index-kynwa08q.js} +52 -47
- package/dist/index-kzavdze2.js +15 -0
- package/dist/{index-48acz7z0.js → index-m18xm96h.js} +93 -46
- package/dist/{index-m200b8hs.js → index-mbd92r1w.js} +5 -3
- package/dist/index-mxt0wfjy.js +58 -0
- package/dist/{index-9cxxfkhb.js → index-n20tybgk.js} +14 -9
- package/dist/{index-1v3k5zgx.js → index-n7f89hjw.js} +610 -1168
- package/dist/index-ngwf1s3c.js +51 -0
- package/dist/{index-zfncctjp.js → index-nk0cy9g1.js} +5 -4
- package/dist/{index-hs76yzt7.js → index-paff5y0r.js} +17 -11
- package/dist/index-pn5b11ce.js +40 -0
- package/dist/{index-qaet40b2.js → index-prf6ayhf.js} +5 -7
- package/dist/{index-hkxgennw.js → index-ps3djm8d.js} +7 -1
- package/dist/index-pwskmywy.js +195 -0
- package/dist/{index-3bzk2645.js → index-r9kq5ark.js} +1 -1
- package/dist/{index-hkw233vx.js → index-rbd2rq3z.js} +2 -2
- package/dist/{index-r0xr7y4m.js → index-rhb33thr.js} +138 -33
- package/dist/{index-kffm4r8w.js → index-rj32hkkp.js} +2 -2
- package/dist/index-rptj3qnc.js +96 -0
- package/dist/{index-hqsbtvta.js → index-rpyn7geq.js} +11 -3
- package/dist/{index-x2rvpbtj.js → index-rxnyygke.js} +151 -17
- package/dist/index-rzeezh79.js +508 -0
- package/dist/index-s2e3h616.js +351 -0
- package/dist/{index-m9hb9wnk.js → index-sfzfd2m2.js} +2 -2
- package/dist/{index-sqkttz7z.js → index-sv5svtq7.js} +1 -1
- package/dist/{index-srs8hj9c.js → index-sx3g49y2.js} +5 -1
- package/dist/{index-9mjrnqxs.js → index-t1a2jrg7.js} +21 -91
- package/dist/index-t7wa7k12.js +221 -0
- package/dist/{index-a6w6mwda.js → index-tazm4dxf.js} +1 -1
- package/dist/{index-b51tzcgh.js → index-tf70nm22.js} +2 -2
- package/dist/index-ttexdtjj.js +28 -0
- package/dist/{index-btjwc7xr.js → index-v1mxss62.js} +15 -14
- package/dist/{index-103dp7fz.js → index-v37b2cd6.js} +1956 -3151
- package/dist/{index-0ndz5r8z.js → index-v59pxmf1.js} +17 -9
- package/dist/{index-rfkh44ss.js → index-vgytj9wp.js} +1 -1
- package/dist/index-vgzhw2zk.js +304 -0
- package/dist/index-vmbxj75t.js +177 -0
- package/dist/{index-tnnmekgb.js → index-wa6h4tz6.js} +3 -3
- package/dist/{index-pa9bhefy.js → index-waa6t4zx.js} +83 -10
- package/dist/{index-4efxzrht.js → index-wavv538x.js} +211 -196
- package/dist/index-werjqesf.js +43 -0
- package/dist/{index-7qyv50r4.js → index-wv8dqy7q.js} +2 -2
- package/dist/index-wz392jyz.js +10 -0
- package/dist/{index-1d7s7da0.js → index-x6sp5vpa.js} +36 -5
- package/dist/index-xgae0bn7.js +37 -0
- package/dist/index-xmr47znh.js +160 -0
- package/dist/{index-ftk3838x.js → index-xq4s9mka.js} +7 -2
- package/dist/{index-ww3gss55.js → index-xrgn784x.js} +1 -1
- package/dist/{index-fpwbskp2.js → index-xtby8rj3.js} +1 -1
- package/dist/index-xv9jb84s.js +929 -0
- package/dist/{index-v7rbjatr.js → index-y065r8g5.js} +1881 -1156
- package/dist/{index-yex7eg1v.js → index-y7sy1xdp.js} +6 -2
- package/dist/{index-a7ebd769.js → index-zwgwyvdt.js} +3 -3
- package/dist/internal/abort-error.d.ts +9 -0
- package/dist/internal/abort-error.d.ts.map +1 -0
- package/dist/internal/abort-race.d.ts +47 -4
- package/dist/internal/abort-race.d.ts.map +1 -1
- package/dist/internal/atomic-file.d.ts +19 -0
- package/dist/internal/atomic-file.d.ts.map +1 -1
- package/dist/internal/backoff.d.ts.map +1 -1
- package/dist/internal/bounded-body.d.ts +37 -1
- package/dist/internal/bounded-body.d.ts.map +1 -1
- package/dist/internal/bounded-file-confirm.d.ts +32 -0
- package/dist/internal/bounded-file-confirm.d.ts.map +1 -0
- package/dist/internal/bounded-file-read.d.ts +34 -15
- package/dist/internal/bounded-file-read.d.ts.map +1 -1
- package/dist/internal/bun-command.d.ts +11 -0
- package/dist/internal/bun-command.d.ts.map +1 -1
- package/dist/internal/channel.d.ts.map +1 -1
- package/dist/internal/darwin-binding-error.d.ts.map +1 -1
- package/dist/internal/darwin-binding.d.ts +10 -0
- package/dist/internal/darwin-binding.d.ts.map +1 -1
- package/dist/internal/deadline.d.ts +22 -2
- package/dist/internal/deadline.d.ts.map +1 -1
- package/dist/internal/exclusive-lock-owner.d.ts +20 -1
- package/dist/internal/exclusive-lock-owner.d.ts.map +1 -1
- package/dist/internal/exclusive-lock-read.d.ts +2 -0
- package/dist/internal/exclusive-lock-read.d.ts.map +1 -1
- package/dist/internal/exclusive-lock.d.ts +26 -0
- package/dist/internal/exclusive-lock.d.ts.map +1 -1
- package/dist/internal/file-observation.d.ts +53 -0
- package/dist/internal/file-observation.d.ts.map +1 -1
- package/dist/internal/json-response.d.ts +10 -0
- package/dist/internal/json-response.d.ts.map +1 -0
- package/dist/internal/open-descriptors.d.ts +5 -0
- package/dist/internal/open-descriptors.d.ts.map +1 -1
- package/dist/internal/optional-peer.d.ts.map +1 -1
- package/dist/internal/pinned-http.d.ts.map +1 -1
- package/dist/internal/positive-integer.d.ts +14 -6
- package/dist/internal/positive-integer.d.ts.map +1 -1
- package/dist/internal/postgres-query.d.ts +16 -0
- package/dist/internal/postgres-query.d.ts.map +1 -0
- package/dist/internal/process-identity.d.ts +21 -1
- package/dist/internal/process-identity.d.ts.map +1 -1
- package/dist/internal/process-instance.d.ts +14 -0
- package/dist/internal/process-instance.d.ts.map +1 -1
- package/dist/internal/request.d.ts +4 -0
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/secret-equal.d.ts +11 -0
- package/dist/internal/secret-equal.d.ts.map +1 -0
- package/dist/internal/secure-fetch.d.ts.map +1 -1
- package/dist/internal/sqlite.d.ts +8 -0
- package/dist/internal/sqlite.d.ts.map +1 -1
- package/dist/internal/timers.d.ts +20 -0
- package/dist/internal/timers.d.ts.map +1 -1
- package/dist/internal/typed.d.ts +11 -0
- package/dist/internal/typed.d.ts.map +1 -1
- package/dist/internal/unix-client-error.d.ts +21 -0
- package/dist/internal/unix-client-error.d.ts.map +1 -0
- package/dist/internal/unix-socket-lock.d.ts +23 -0
- package/dist/internal/unix-socket-lock.d.ts.map +1 -0
- package/dist/internal/unix-socket.d.ts +62 -0
- package/dist/internal/unix-socket.d.ts.map +1 -1
- package/dist/internal/upgrade-affects.d.ts +3 -3
- package/dist/internal/upgrade-affects.d.ts.map +1 -1
- package/dist/internal/upgrade-plan.d.ts.map +1 -1
- package/dist/json-schema/dialect.d.ts +0 -6
- package/dist/json-schema/dialect.d.ts.map +1 -1
- package/dist/json-schema/keywords.d.ts +116 -0
- package/dist/json-schema/keywords.d.ts.map +1 -0
- package/dist/json-schema/string-format.d.ts.map +1 -1
- package/dist/live/events.d.ts.map +1 -1
- package/dist/live/watch-client.d.ts.map +1 -1
- package/dist/observability/bounded-logger.d.ts +3 -0
- package/dist/observability/bounded-logger.d.ts.map +1 -1
- package/dist/observability/bounded-sink.d.ts.map +1 -1
- package/dist/observability/context.d.ts +12 -2
- package/dist/observability/context.d.ts.map +1 -1
- package/dist/observability/event-loop-delay.d.ts +62 -0
- package/dist/observability/event-loop-delay.d.ts.map +1 -0
- package/dist/observability/json-logger.d.ts.map +1 -1
- package/dist/observability/log-repeat.d.ts +44 -0
- package/dist/observability/log-repeat.d.ts.map +1 -0
- package/dist/observability/spool-core.d.ts +95 -0
- package/dist/observability/spool-core.d.ts.map +1 -0
- package/dist/observability/spool-file.d.ts +46 -0
- package/dist/observability/spool-file.d.ts.map +1 -0
- package/dist/observability/spool.d.ts +14 -8
- package/dist/observability/spool.d.ts.map +1 -1
- package/dist/observability/trace.d.ts.map +1 -1
- package/dist/observability/work.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/order-key.d.ts +37 -0
- package/dist/primitives/order-key.d.ts.map +1 -0
- package/dist/process/bun-child.d.ts.map +1 -1
- package/dist/process/command-owner.d.ts.map +1 -1
- package/dist/process/contract.d.ts +4 -3
- package/dist/process/contract.d.ts.map +1 -1
- package/dist/process/group-presence.d.ts.map +1 -1
- package/dist/process/group.d.ts +5 -1
- package/dist/process/group.d.ts.map +1 -1
- package/dist/process/launch.d.ts +5 -3
- package/dist/process/launch.d.ts.map +1 -1
- package/dist/process/owner-loss-guard.d.ts.map +1 -1
- package/dist/react/cache-bridge.d.ts.map +1 -1
- package/dist/release/watcher.d.ts.map +1 -1
- package/dist/server/bridge-host.d.ts +51 -0
- package/dist/server/bridge-host.d.ts.map +1 -0
- package/dist/server/bun.d.ts +4 -4
- package/dist/server/bun.d.ts.map +1 -1
- package/dist/server/context-contribution.d.ts.map +1 -1
- package/dist/server/contract-method.d.ts.map +1 -1
- package/dist/server/create.d.ts +1 -0
- package/dist/server/create.d.ts.map +1 -1
- package/dist/server/endpoint-dispatch.d.ts.map +1 -1
- package/dist/server/endpoint-response.d.ts.map +1 -1
- package/dist/server/error-dispatch.d.ts +2 -0
- package/dist/server/error-dispatch.d.ts.map +1 -1
- package/dist/server/error-hook.d.ts +2 -0
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/server/handler-state.d.ts +13 -2
- package/dist/server/handler-state.d.ts.map +1 -1
- package/dist/server/implement.d.ts +1 -0
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/local-host.d.ts +47 -0
- package/dist/server/local-host.d.ts.map +1 -0
- package/dist/server/logger.d.ts +20 -3
- package/dist/server/logger.d.ts.map +1 -1
- package/dist/server/logging.d.ts +2 -1
- package/dist/server/logging.d.ts.map +1 -1
- package/dist/server/middleware/cors.d.ts +1 -0
- package/dist/server/middleware/cors.d.ts.map +1 -1
- package/dist/server/middleware/signed-link.d.ts +42 -0
- package/dist/server/middleware/signed-link.d.ts.map +1 -0
- package/dist/server/multipart-reader.d.ts +3 -1
- package/dist/server/multipart-reader.d.ts.map +1 -1
- package/dist/server/multipart.d.ts.map +1 -1
- package/dist/server/oauth/cimd.d.ts.map +1 -1
- package/dist/server/oauth/endpoints.d.ts.map +1 -1
- package/dist/server/openapi.d.ts.map +1 -1
- package/dist/server/protocol-outcome.d.ts +17 -0
- package/dist/server/protocol-outcome.d.ts.map +1 -0
- package/dist/server/raw.d.ts.map +1 -1
- package/dist/server/request-completion.d.ts +3 -1
- package/dist/server/request-completion.d.ts.map +1 -1
- package/dist/server/shutdown.d.ts.map +1 -1
- package/dist/server/socket-io-config.d.ts +1 -1
- package/dist/server/socket-io-config.d.ts.map +1 -1
- package/dist/server/streaming-route.d.ts.map +1 -1
- package/dist/server/types.d.ts +13 -10
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/unix-client-body.d.ts +4 -1
- package/dist/server/unix-client-body.d.ts.map +1 -1
- package/dist/server/unix-client-bun.d.ts.map +1 -1
- package/dist/server/unix-client.d.ts +8 -1
- package/dist/server/unix-client.d.ts.map +1 -1
- package/dist/service-host/artifact-activation.d.ts +58 -0
- package/dist/service-host/artifact-activation.d.ts.map +1 -0
- package/dist/service-host/artifact-manifest.d.ts +68 -0
- package/dist/service-host/artifact-manifest.d.ts.map +1 -0
- package/dist/service-host/artifact.d.ts +43 -0
- package/dist/service-host/artifact.d.ts.map +1 -0
- package/dist/service-host/config-reloader-contract.d.ts +66 -0
- package/dist/service-host/config-reloader-contract.d.ts.map +1 -0
- package/dist/service-host/config-reloader-helpers.d.ts +32 -0
- package/dist/service-host/config-reloader-helpers.d.ts.map +1 -0
- package/dist/service-host/config-reloader-source.d.ts +47 -0
- package/dist/service-host/config-reloader-source.d.ts.map +1 -0
- package/dist/service-host/config-reloader.d.ts +6 -0
- package/dist/service-host/config-reloader.d.ts.map +1 -0
- package/dist/service-host/host-adapter.d.ts +72 -0
- package/dist/service-host/host-adapter.d.ts.map +1 -0
- package/dist/service-host/identity-unix-socket.d.ts +101 -0
- package/dist/service-host/identity-unix-socket.d.ts.map +1 -0
- package/dist/service-host/identity.d.ts +117 -0
- package/dist/service-host/identity.d.ts.map +1 -0
- package/dist/service-host/launchd-plist.d.ts +77 -0
- package/dist/service-host/launchd-plist.d.ts.map +1 -0
- package/dist/service-host/launchd-render.d.ts +91 -0
- package/dist/service-host/launchd-render.d.ts.map +1 -0
- package/dist/service-host/launchd.d.ts +82 -0
- package/dist/service-host/launchd.d.ts.map +1 -0
- package/dist/service-host/macos/bundle-plist.d.ts +50 -0
- package/dist/service-host/macos/bundle-plist.d.ts.map +1 -0
- package/dist/service-host/macos/bundle.d.ts +66 -0
- package/dist/service-host/macos/bundle.d.ts.map +1 -0
- package/dist/service-host/macos/codesign.d.ts +95 -0
- package/dist/service-host/macos/codesign.d.ts.map +1 -0
- package/dist/service-host/macos/icon.d.ts +93 -0
- package/dist/service-host/macos/icon.d.ts.map +1 -0
- package/dist/service-host/macos/launch-services.d.ts +88 -0
- package/dist/service-host/macos/launch-services.d.ts.map +1 -0
- package/dist/service-host/macos/launcher.d.ts +59 -0
- package/dist/service-host/macos/launcher.d.ts.map +1 -0
- package/dist/service-host/macos/responsibility.d.ts +90 -0
- package/dist/service-host/macos/responsibility.d.ts.map +1 -0
- package/dist/service-host/macos/runner.d.ts +69 -0
- package/dist/service-host/macos/runner.d.ts.map +1 -0
- package/dist/service-host/plist-xml.d.ts +48 -0
- package/dist/service-host/plist-xml.d.ts.map +1 -0
- package/dist/service-host/process-evidence.d.ts +17 -0
- package/dist/service-host/process-evidence.d.ts.map +1 -0
- package/dist/service-host/systemd-inspect.d.ts +128 -0
- package/dist/service-host/systemd-inspect.d.ts.map +1 -0
- package/dist/service-host/systemd-links.d.ts +23 -0
- package/dist/service-host/systemd-links.d.ts.map +1 -0
- package/dist/service-host/systemd-render-shared.d.ts +64 -0
- package/dist/service-host/systemd-render-shared.d.ts.map +1 -0
- package/dist/service-host/systemd-render.d.ts +98 -0
- package/dist/service-host/systemd-render.d.ts.map +1 -0
- package/dist/service-host/systemd-timer-render.d.ts +31 -0
- package/dist/service-host/systemd-timer-render.d.ts.map +1 -0
- package/dist/service-host/systemd-timer-rollback.d.ts +26 -0
- package/dist/service-host/systemd-timer-rollback.d.ts.map +1 -0
- package/dist/service-host/systemd-timer.d.ts +82 -0
- package/dist/service-host/systemd-timer.d.ts.map +1 -0
- package/dist/service-host/systemd-unit-ops.d.ts +26 -0
- package/dist/service-host/systemd-unit-ops.d.ts.map +1 -0
- package/dist/service-host/systemd.d.ts +50 -0
- package/dist/service-host/systemd.d.ts.map +1 -0
- package/dist/spend/attribution.d.ts +17 -0
- package/dist/spend/attribution.d.ts.map +1 -0
- package/dist/spend/coverage-guard.d.ts +60 -0
- package/dist/spend/coverage-guard.d.ts.map +1 -0
- package/dist/spend/coverage-lexer.d.ts +20 -0
- package/dist/spend/coverage-lexer.d.ts.map +1 -0
- package/dist/spend/facts.d.ts +23 -0
- package/dist/spend/facts.d.ts.map +1 -0
- package/dist/spend/gateway-stream.d.ts +25 -0
- package/dist/spend/gateway-stream.d.ts.map +1 -0
- package/dist/spend/gateway.d.ts +64 -0
- package/dist/spend/gateway.d.ts.map +1 -0
- package/dist/spend/receipt-merge.d.ts +13 -0
- package/dist/spend/receipt-merge.d.ts.map +1 -0
- package/dist/spend/receipt-spool.d.ts +35 -0
- package/dist/spend/receipt-spool.d.ts.map +1 -0
- package/dist/spend/reconcile.d.ts +45 -0
- package/dist/spend/reconcile.d.ts.map +1 -0
- package/dist/spend/schemas.d.ts +249 -0
- package/dist/spend/schemas.d.ts.map +1 -0
- package/dist/sync/outbox.d.ts +131 -0
- package/dist/sync/outbox.d.ts.map +1 -0
- package/dist/sync/overlay.d.ts +59 -0
- package/dist/sync/overlay.d.ts.map +1 -0
- package/dist/sync/protocol.d.ts +132 -0
- package/dist/sync/protocol.d.ts.map +1 -0
- package/dist/sync/server-store-check.d.ts +10 -0
- package/dist/sync/server-store-check.d.ts.map +1 -0
- package/dist/sync/server-store-memory.d.ts +14 -0
- package/dist/sync/server-store-memory.d.ts.map +1 -0
- package/dist/sync/server-store-postgres.d.ts +25 -0
- package/dist/sync/server-store-postgres.d.ts.map +1 -0
- package/dist/sync/server-store.d.ts +139 -0
- package/dist/sync/server-store.d.ts.map +1 -0
- package/dist/sync/session-machine.d.ts +79 -0
- package/dist/sync/session-machine.d.ts.map +1 -0
- package/dist/sync/session-snapshot.d.ts +19 -0
- package/dist/sync/session-snapshot.d.ts.map +1 -0
- package/dist/sync/session-steps.d.ts +15 -0
- package/dist/sync/session-steps.d.ts.map +1 -0
- package/dist/sync/session.d.ts +142 -0
- package/dist/sync/session.d.ts.map +1 -0
- package/dist/sync/tombstones.d.ts +53 -0
- package/dist/sync/tombstones.d.ts.map +1 -0
- package/dist/telegram/bot-api.d.ts.map +1 -1
- package/dist/telegram/broadcast-failure.d.ts.map +1 -1
- package/dist/telegram/budget-transformer.d.ts.map +1 -1
- package/dist/telegram/crypto.d.ts +2 -10
- package/dist/telegram/crypto.d.ts.map +1 -1
- package/dist/telegram/html/markdown-inline.d.ts +19 -0
- package/dist/telegram/html/markdown-inline.d.ts.map +1 -0
- package/dist/telegram/html/markdown-lines.d.ts +51 -0
- package/dist/telegram/html/markdown-lines.d.ts.map +1 -0
- package/dist/telegram/html/markdown-split.d.ts +49 -0
- package/dist/telegram/html/markdown-split.d.ts.map +1 -0
- package/dist/telegram/html/markdown.d.ts +14 -0
- package/dist/telegram/html/markdown.d.ts.map +1 -0
- package/dist/telegram/html/nodes.d.ts +26 -4
- package/dist/telegram/html/nodes.d.ts.map +1 -1
- package/dist/telegram/html/parse.d.ts.map +1 -1
- package/dist/telegram/html/render.d.ts.map +1 -1
- package/dist/telegram/init-data.d.ts.map +1 -1
- package/dist/telegram/local-files.d.ts.map +1 -1
- package/dist/telegram/operator-channel.d.ts +15 -2
- package/dist/telegram/operator-channel.d.ts.map +1 -1
- package/dist/telegram/outbound-budget.d.ts.map +1 -1
- package/dist/telegram/outbound-cost.d.ts +9 -1
- package/dist/telegram/outbound-cost.d.ts.map +1 -1
- package/dist/telegram/outbound-queue.d.ts +2 -1
- package/dist/telegram/outbound-queue.d.ts.map +1 -1
- package/dist/telegram/screens/outcome.d.ts.map +1 -1
- package/dist/telegram/send-failure.d.ts.map +1 -1
- package/dist/telegram/transport-connect.d.ts.map +1 -1
- package/dist/telegram/transport.d.ts.map +1 -1
- package/dist/telegram/update-intake.d.ts.map +1 -1
- package/dist/telegram/update-store-postgres.d.ts +2 -2
- package/dist/telegram/update-store-postgres.d.ts.map +1 -1
- package/dist/telegram/webhook.d.ts.map +1 -1
- package/dist/testing/managed-resource-conformance.d.ts.map +1 -1
- package/dist/testing/surface-conformance.d.ts.map +1 -1
- package/dist/testing/surface-manifest.d.ts +2 -0
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/tools/access.d.ts +63 -0
- package/dist/tools/access.d.ts.map +1 -0
- package/dist/tools/agent.d.ts +14 -6
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/cli/args-classify.d.ts +154 -0
- package/dist/tools/cli/args-classify.d.ts.map +1 -0
- package/dist/tools/cli/args-fields.d.ts +14 -7
- package/dist/tools/cli/args-fields.d.ts.map +1 -1
- package/dist/tools/cli/args-json.d.ts +1 -1
- package/dist/tools/cli/args-json.d.ts.map +1 -1
- package/dist/tools/cli/args-route.d.ts +4 -48
- package/dist/tools/cli/args-route.d.ts.map +1 -1
- package/dist/tools/cli/args-scan.d.ts +75 -0
- package/dist/tools/cli/args-scan.d.ts.map +1 -0
- package/dist/tools/cli/args-tokens.d.ts +2 -1
- package/dist/tools/cli/args-tokens.d.ts.map +1 -1
- package/dist/tools/cli/args.d.ts +37 -19
- package/dist/tools/cli/args.d.ts.map +1 -1
- package/dist/tools/cli/checkpoint.d.ts.map +1 -1
- package/dist/tools/cli/command-shape.d.ts +5 -0
- package/dist/tools/cli/command-shape.d.ts.map +1 -1
- package/dist/tools/cli/command.d.ts +57 -2
- package/dist/tools/cli/command.d.ts.map +1 -1
- package/dist/tools/cli/config.d.ts +15 -58
- package/dist/tools/cli/config.d.ts.map +1 -1
- package/dist/tools/cli/create-cli.d.ts +7 -3
- package/dist/tools/cli/create-cli.d.ts.map +1 -1
- package/dist/tools/cli/format.d.ts.map +1 -1
- package/dist/tools/cli/help.d.ts.map +1 -1
- package/dist/tools/cli/invoke.d.ts +71 -20
- package/dist/tools/cli/invoke.d.ts.map +1 -1
- package/dist/tools/cli/io.d.ts.map +1 -1
- package/dist/tools/cli/managed-surface.d.ts.map +1 -1
- package/dist/tools/cli/notices.d.ts.map +1 -1
- package/dist/tools/cli/policy.d.ts +66 -10
- package/dist/tools/cli/policy.d.ts.map +1 -1
- package/dist/tools/cli/prepare.d.ts +5 -4
- package/dist/tools/cli/prepare.d.ts.map +1 -1
- package/dist/tools/cli/run-managed.d.ts.map +1 -1
- package/dist/tools/cli/run-native.d.ts.map +1 -1
- package/dist/tools/cli/run-stream.d.ts.map +1 -1
- package/dist/tools/cli/runner.d.ts +28 -0
- package/dist/tools/cli/runner.d.ts.map +1 -0
- package/dist/tools/cli/session.d.ts +12 -6
- package/dist/tools/cli/session.d.ts.map +1 -1
- package/dist/tools/cli/stream-surface.d.ts.map +1 -1
- package/dist/tools/cli/stream.d.ts.map +1 -1
- package/dist/tools/cli/unavailable.d.ts +2 -0
- package/dist/tools/cli/unavailable.d.ts.map +1 -1
- package/dist/tools/cli/unix-outcome.d.ts +8 -0
- package/dist/tools/cli/unix-outcome.d.ts.map +1 -0
- package/dist/tools/cli/update.d.ts.map +1 -1
- package/dist/tools/cli/view-columns.d.ts +18 -0
- package/dist/tools/cli/view-columns.d.ts.map +1 -0
- package/dist/tools/cli/view.d.ts.map +1 -1
- package/dist/tools/connections/define.d.ts.map +1 -1
- package/dist/tools/connections/foreign-schema-join.d.ts +28 -0
- package/dist/tools/connections/foreign-schema-join.d.ts.map +1 -0
- package/dist/tools/connections/foreign-schema.d.ts +9 -0
- package/dist/tools/connections/foreign-schema.d.ts.map +1 -0
- package/dist/tools/connections/limits.d.ts +1 -1
- package/dist/tools/connections/limits.d.ts.map +1 -1
- package/dist/tools/connections/mcp-client.d.ts.map +1 -1
- package/dist/tools/connections/mcp.d.ts.map +1 -1
- package/dist/tools/connections/openapi.d.ts.map +1 -1
- package/dist/tools/connections/runtime.d.ts +18 -6
- package/dist/tools/connections/runtime.d.ts.map +1 -1
- package/dist/tools/connections/sse-session.d.ts.map +1 -1
- package/dist/tools/connections/types.d.ts +12 -2
- package/dist/tools/connections/types.d.ts.map +1 -1
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/internal/expose.d.ts +6 -0
- package/dist/tools/internal/expose.d.ts.map +1 -0
- package/dist/tools/internal/json-projection.d.ts +17 -0
- package/dist/tools/internal/json-projection.d.ts.map +1 -0
- package/dist/tools/internal/surface-projector.d.ts +18 -4
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/invoker.d.ts +10 -2
- package/dist/tools/invoker.d.ts.map +1 -1
- package/dist/tools/lifecycle.d.ts +8 -2
- package/dist/tools/lifecycle.d.ts.map +1 -1
- package/dist/tools/list-names.d.ts +3 -4
- package/dist/tools/list-names.d.ts.map +1 -1
- package/dist/tools/manifest.d.ts +4 -3
- package/dist/tools/manifest.d.ts.map +1 -1
- package/dist/tools/mcp/handler.d.ts.map +1 -1
- package/dist/tools/mcp/mount.d.ts +26 -14
- package/dist/tools/mcp/mount.d.ts.map +1 -1
- package/dist/tools/mcp/prepare.d.ts +2 -0
- package/dist/tools/mcp/prepare.d.ts.map +1 -1
- package/dist/tools/mcp/register.d.ts +2 -1
- package/dist/tools/mcp/register.d.ts.map +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
- package/dist/tools/mcp/stdio.d.ts.map +1 -1
- package/dist/tools/mount.d.ts +7 -2
- package/dist/tools/mount.d.ts.map +1 -1
- package/dist/tools/native-definition.d.ts +1 -1
- package/dist/tools/native-definition.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-runtime-tools.d.ts +2 -2
- package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-runtime-types.d.ts +1 -1
- package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
- package/dist/tools/operations/define-wait-tool.d.ts.map +1 -1
- package/dist/tools/operations/mount-wait.d.ts.map +1 -1
- package/dist/tools/operations/wait-core.d.ts.map +1 -1
- package/dist/tools/read-operation.d.ts +6 -4
- package/dist/tools/read-operation.d.ts.map +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/runtime-tool-declaration.d.ts +4 -1
- package/dist/tools/runtime-tool-declaration.d.ts.map +1 -1
- package/dist/tools/runtime-tool.d.ts +6 -1
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools/schema/coerce.d.ts.map +1 -1
- package/dist/tools/schema/inline-references.d.ts +7 -0
- package/dist/tools/schema/inline-references.d.ts.map +1 -0
- package/dist/tools/schema/json-schema-origin.d.ts +1 -1
- package/dist/tools/schema/json-schema-origin.d.ts.map +1 -1
- package/dist/tools/schema/presentation.d.ts +6 -0
- package/dist/tools/schema/presentation.d.ts.map +1 -1
- package/dist/tools/schema/schema.d.ts +2 -0
- package/dist/tools/schema/schema.d.ts.map +1 -1
- package/dist/tools/schema/untyped-properties.d.ts.map +1 -1
- package/dist/tools/surface.d.ts.map +1 -1
- package/dist/tools/toolkit.d.ts +6 -3
- package/dist/tools/toolkit.d.ts.map +1 -1
- package/dist/tools/transfer/define-download-tool.d.ts.map +1 -1
- package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -1
- package/dist/tools/transfer/define-view-file-tool.d.ts +2 -1
- package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -1
- package/dist/tools/transfer/mount-download.d.ts.map +1 -1
- package/dist/tools/transfer/view-file-contract.d.ts +2 -2
- package/dist/tools/transfer/view-file.d.ts +1 -2
- package/dist/tools/transfer/view-file.d.ts.map +1 -1
- package/dist/tracking/client.d.ts +0 -13
- package/dist/tracking/client.d.ts.map +1 -1
- package/dist/tracking/delivery.d.ts.map +1 -1
- package/dist/tracking/performance/collector.d.ts.map +1 -1
- package/llms/agent-executor-acp.txt +55 -0
- package/llms/agent-executor-claude-sdk.txt +31 -0
- package/llms/agent-executor-claude.txt +29 -0
- package/llms/agent-executor-codex.txt +25 -0
- package/llms/agent-executor-testing.txt +26 -0
- package/llms/agent-executor.txt +40 -0
- package/llms/agent-runtime-harness.txt +68 -5
- package/llms/agent-runtime-openrouter.txt +8 -2
- package/llms/agent-runtime-postgres.txt +30 -0
- package/llms/agent-runtime-react.txt +1 -1
- package/llms/agent-runtime-realtime.txt +1 -1
- package/llms/agent-runtime-sandbox.txt +5 -2
- package/llms/agent-runtime-sqlite-bun.txt +2 -2
- package/llms/agent-runtime-sqlite-node.txt +2 -2
- package/llms/agent-runtime-testing.txt +2 -1
- package/llms/agent-runtime.2.txt +450 -501
- package/llms/agent-runtime.3.txt +229 -267
- package/llms/agent-runtime.4.txt +39 -246
- package/llms/agent-runtime.5.txt +1 -1
- package/llms/agent-runtime.txt +551 -2
- package/llms/application-diagnostic-journal.txt +2 -0
- package/llms/application.2.txt +3 -0
- package/llms/application.3.txt +21 -4
- package/llms/application.txt +4 -1
- package/llms/cli.2.txt +259 -99
- package/llms/cli.3.txt +90 -0
- package/llms/cli.txt +96 -184
- package/llms/contract.txt +7 -6
- package/llms/declaration.txt +3 -3
- package/llms/files.txt +11 -0
- package/llms/handler.txt +25 -0
- package/llms/http.txt +18 -1
- package/llms/node.txt +5 -4
- package/llms/observability.2.txt +105 -0
- package/llms/observability.txt +14 -90
- package/llms/primitives.txt +27 -0
- package/llms/process.2.txt +2 -2
- package/llms/process.txt +10 -9
- package/llms/realtime.txt +11 -0
- package/llms/server.2.txt +355 -0
- package/llms/server.4.txt +45 -6
- package/llms/server.5.txt +8 -3
- package/llms/server.txt +143 -256
- package/llms/service-host-macos.txt +53 -0
- package/llms/service-host.txt +69 -0
- package/llms/spend-testing.txt +21 -0
- package/llms/spend.txt +173 -0
- package/llms/stitchkit.2.txt +368 -42
- package/llms/stitchkit.3.txt +164 -13
- package/llms/stitchkit.txt +99 -417
- package/llms/sync-postgres.txt +31 -0
- package/llms/sync.txt +396 -0
- package/llms/telegram-html.txt +4 -1
- package/llms/telegram.2.txt +4 -4
- package/llms/telegram.txt +105 -14
- package/llms/testing.txt +4 -3
- package/llms/tools-connections.txt +4 -4
- package/llms/tools.2.txt +78 -17
- package/llms/tools.3.txt +14 -9
- package/llms/tools.txt +85 -78
- package/llms/upgrading-0.127.0.txt +1059 -0
- package/llms/upgrading-0.128.0.txt +147 -0
- package/llms/upgrading.txt +2 -0
- package/llms-full.txt +3727 -542
- package/llms.txt +44 -27
- package/native/darwin-arm64.node +0 -0
- package/native/darwin-x64.node +0 -0
- package/native-assets.json +4 -4
- package/package.json +67 -9
- package/dist/agent-runtime/sandbox-coding.d.ts.map +0 -1
- package/dist/agent-runtime/sqlite-events.d.ts +0 -5
- package/dist/agent-runtime/sqlite-events.d.ts.map +0 -1
- package/dist/agent-runtime/sqlite-history.d.ts +0 -7
- package/dist/agent-runtime/sqlite-history.d.ts.map +0 -1
- package/dist/agent-runtime/sqlite-ledger.d.ts +0 -7
- package/dist/agent-runtime/sqlite-ledger.d.ts.map +0 -1
- package/dist/agent-runtime/sqlite-reads.d.ts +0 -14
- package/dist/agent-runtime/sqlite-reads.d.ts.map +0 -1
- package/dist/agent-runtime/sqlite-rows.d.ts.map +0 -1
- package/dist/agent-runtime/tool-progress.d.ts.map +0 -1
- package/dist/entrypoints/application/schemas.d.ts +0 -15
- package/dist/entrypoints/application/schemas.d.ts.map +0 -1
- package/dist/entrypoints/application/schemas.js +0 -27
- package/dist/index-0s4xebbg.js +0 -8
- package/dist/index-57ppvpw0.js +0 -1150
- package/dist/index-5dmk54h9.js +0 -256
- package/dist/index-8x0q6yfb.js +0 -247
- package/dist/index-a3z56mtn.js +0 -48
- package/dist/index-a5qr2rj6.js +0 -26
- package/dist/index-b0kddvzw.js +0 -35
- package/dist/index-drcjjhy1.js +0 -40
- package/dist/index-eemvahkc.js +0 -21
- package/dist/index-gfk7nrht.js +0 -0
- package/dist/index-jp2qd9jb.js +0 -108
- package/dist/index-nx6eazt0.js +0 -160
- package/dist/index-wxadzdb7.js +0 -55
- package/dist/internal/until-aborted.d.ts +0 -9
- package/dist/internal/until-aborted.d.ts.map +0 -1
- package/dist/server/unix-client-error.d.ts +0 -9
- package/dist/server/unix-client-error.d.ts.map +0 -1
- package/llms/application-schemas.txt +0 -42
|
@@ -0,0 +1,1193 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentRecordIdSchema2,
|
|
3
|
+
AgentJsonObjectSchema2,
|
|
4
|
+
AgentMessageSchema2,
|
|
5
|
+
AgentUsageSchema2
|
|
6
|
+
} from "./index-bn2baakz.js";
|
|
7
|
+
import {
|
|
8
|
+
AgentMessagePartSchema2
|
|
9
|
+
} from "./index-2rf33y2h.js";
|
|
10
|
+
import {
|
|
11
|
+
AgentProviderResponseSchema2
|
|
12
|
+
} from "./index-97rp94ff.js";
|
|
13
|
+
import {
|
|
14
|
+
InvocationPayloadSchema,
|
|
15
|
+
ModelInvocationTraceSchema2,
|
|
16
|
+
assistantStatus
|
|
17
|
+
} from "./index-vgzhw2zk.js";
|
|
18
|
+
import {
|
|
19
|
+
agentDurableEventId2
|
|
20
|
+
} from "./index-paff5y0r.js";
|
|
21
|
+
import {
|
|
22
|
+
serializeCanonicalJson
|
|
23
|
+
} from "./index-fmzg39a8.js";
|
|
24
|
+
import {
|
|
25
|
+
withDeadline
|
|
26
|
+
} from "./index-agy5fqgf.js";
|
|
27
|
+
import {
|
|
28
|
+
linkAbortSignals
|
|
29
|
+
} from "./index-rptj3qnc.js";
|
|
30
|
+
|
|
31
|
+
// src/agent-runtime/run-step-spend.ts
|
|
32
|
+
import { z as z2 } from "zod";
|
|
33
|
+
|
|
34
|
+
// src/agent-runtime/runtime-internals.ts
|
|
35
|
+
import { z } from "zod";
|
|
36
|
+
|
|
37
|
+
// src/agent-runtime/run-store-retry.ts
|
|
38
|
+
var STORE_RETRY_DELAYS_MS = [25, 100, 400];
|
|
39
|
+
function storeRetryDelay(failures) {
|
|
40
|
+
return STORE_RETRY_DELAYS_MS[failures];
|
|
41
|
+
}
|
|
42
|
+
async function withStoreRetries(work) {
|
|
43
|
+
for (let failures = 0;; failures += 1) {
|
|
44
|
+
try {
|
|
45
|
+
return await work();
|
|
46
|
+
} catch (error) {
|
|
47
|
+
const delay = storeRetryDelay(failures);
|
|
48
|
+
if (delay === undefined)
|
|
49
|
+
throw error;
|
|
50
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/agent-runtime/terminal-commit.ts
|
|
56
|
+
class AgentRuntimeConflictError2 extends Error {
|
|
57
|
+
constructor(operation) {
|
|
58
|
+
super(`Agent runtime store conflict during ${operation}`);
|
|
59
|
+
this.name = "AgentRuntimeConflictError";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
class AgentRunUnsettledError2 extends Error {
|
|
64
|
+
run;
|
|
65
|
+
ownerId;
|
|
66
|
+
constructor(run, ownerId, cause) {
|
|
67
|
+
const reason = cause instanceof Error ? cause.message : String(cause);
|
|
68
|
+
super(`Agent run ${run.id} is still ${run.state} with no executor: ${reason}`, { cause });
|
|
69
|
+
this.name = "AgentRunUnsettledError";
|
|
70
|
+
this.run = run;
|
|
71
|
+
this.ownerId = ownerId;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function appliedSnapshot(result, operation) {
|
|
75
|
+
if (result.outcome === "applied" || result.outcome === "duplicate")
|
|
76
|
+
return result.snapshot;
|
|
77
|
+
throw new AgentRuntimeConflictError2(operation);
|
|
78
|
+
}
|
|
79
|
+
function viewOfSnapshot(snapshot, runId, retainedAssistant) {
|
|
80
|
+
const run = snapshot.runs.find((candidate) => candidate.id === runId);
|
|
81
|
+
const assistant = snapshot.messages.find((message) => message.id === run?.assistantMessageId) ?? retainedAssistant;
|
|
82
|
+
return {
|
|
83
|
+
snapshotVersion: snapshot.version,
|
|
84
|
+
conversationId: snapshot.conversationId,
|
|
85
|
+
...run && { run },
|
|
86
|
+
...assistant && { assistant }
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function terminalOfSnapshot(snapshot, runId) {
|
|
90
|
+
return canonicalTerminal(viewOfSnapshot(snapshot, runId));
|
|
91
|
+
}
|
|
92
|
+
function terminalOfRunView(view, conversationId) {
|
|
93
|
+
return canonicalTerminal(viewOfRun(view, conversationId));
|
|
94
|
+
}
|
|
95
|
+
function viewOfRun(view, conversationId) {
|
|
96
|
+
return {
|
|
97
|
+
snapshotVersion: view.snapshotVersion,
|
|
98
|
+
conversationId,
|
|
99
|
+
run: view.run,
|
|
100
|
+
...view.assistant && { assistant: view.assistant }
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function canonicalTerminal(view) {
|
|
104
|
+
const { run, assistant } = view;
|
|
105
|
+
if (!run?.terminalReason)
|
|
106
|
+
return;
|
|
107
|
+
if (view.conversationId !== run.conversationId || !assistant || assistant.id !== run.assistantMessageId || assistant.conversationId !== run.conversationId || assistant.runId !== run.id || assistant.role !== "assistant" || assistant.status !== assistantStatus(run.terminalReason)) {
|
|
108
|
+
throw new AgentRuntimeConflictError2("terminal result projection");
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
snapshotVersion: view.snapshotVersion,
|
|
112
|
+
run,
|
|
113
|
+
assistant,
|
|
114
|
+
reason: run.terminalReason,
|
|
115
|
+
committedByCaller: false,
|
|
116
|
+
...run.terminalPolicyName && { policyName: run.terminalPolicyName },
|
|
117
|
+
...run.usage && { usage: run.usage }
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function interruptedCandidate(candidate, run, now) {
|
|
121
|
+
const reason = candidate.reason === "superseded" ? "superseded" : "interrupted";
|
|
122
|
+
const hasInterruptControl = candidate.assistant.parts.some((part) => part.type === "control" && part.reason === "run-interrupted");
|
|
123
|
+
const parts = hasInterruptControl ? candidate.assistant.parts : [
|
|
124
|
+
...candidate.assistant.parts,
|
|
125
|
+
AgentMessagePartSchema2.parse({ type: "control", reason: "run-interrupted" })
|
|
126
|
+
];
|
|
127
|
+
return {
|
|
128
|
+
...candidate.usage && { usage: candidate.usage },
|
|
129
|
+
run,
|
|
130
|
+
assistant: AgentMessageSchema2.parse({
|
|
131
|
+
...candidate.assistant,
|
|
132
|
+
status: assistantStatus(reason),
|
|
133
|
+
parts,
|
|
134
|
+
updatedAt: now().toISOString()
|
|
135
|
+
}),
|
|
136
|
+
reason
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function canRetryTerminal(current, previous, runtimeEpoch) {
|
|
140
|
+
return (current.state === "running" || current.state === "interrupt_requested") && current.ownerId === runtimeEpoch && current.fencingToken === previous.fencingToken;
|
|
141
|
+
}
|
|
142
|
+
var TERMINAL_COMMIT_ATTEMPTS = 32;
|
|
143
|
+
async function attemptTerminalCommit(input, candidate) {
|
|
144
|
+
const committed = await input.store.commitRunTerminal({
|
|
145
|
+
conversationId: candidate.run.conversationId,
|
|
146
|
+
runId: candidate.run.id,
|
|
147
|
+
expectedRevision: candidate.run.revision,
|
|
148
|
+
ownerId: input.runtimeEpoch,
|
|
149
|
+
...candidate.run.fencingToken !== undefined && {
|
|
150
|
+
fencingToken: candidate.run.fencingToken
|
|
151
|
+
},
|
|
152
|
+
assistant: candidate.assistant,
|
|
153
|
+
reason: candidate.reason,
|
|
154
|
+
...candidate.policyName && { policyName: candidate.policyName },
|
|
155
|
+
...candidate.usage && { usage: candidate.usage },
|
|
156
|
+
...candidate.absorb?.length && { absorb: candidate.absorb }
|
|
157
|
+
});
|
|
158
|
+
if (committed.outcome === "applied") {
|
|
159
|
+
const terminal = canonicalTerminal(viewOfSnapshot(committed.snapshot, candidate.run.id));
|
|
160
|
+
if (!terminal)
|
|
161
|
+
throw new AgentRuntimeConflictError2("terminal result projection");
|
|
162
|
+
const absorbed = committed.snapshot.runs.filter((run) => run.absorbedIntoRunId === candidate.run.id);
|
|
163
|
+
return {
|
|
164
|
+
settled: {
|
|
165
|
+
...terminal,
|
|
166
|
+
committedByCaller: true,
|
|
167
|
+
...absorbed.length > 0 && { absorbed }
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
if (committed.outcome === "duplicate") {
|
|
172
|
+
const terminal = canonicalTerminal(viewOfSnapshot(committed.snapshot, candidate.run.id, committed.assistant));
|
|
173
|
+
if (!terminal)
|
|
174
|
+
throw new AgentRuntimeConflictError2("terminal result projection");
|
|
175
|
+
return { settled: terminal };
|
|
176
|
+
}
|
|
177
|
+
if (committed.outcome !== "conflict") {
|
|
178
|
+
throw new AgentRuntimeConflictError2("terminal commit");
|
|
179
|
+
}
|
|
180
|
+
const latest = await input.store.loadRun({
|
|
181
|
+
conversationId: candidate.run.conversationId,
|
|
182
|
+
runId: candidate.run.id
|
|
183
|
+
});
|
|
184
|
+
const terminal = latest ? canonicalTerminal(viewOfRun(latest, candidate.run.conversationId)) : undefined;
|
|
185
|
+
if (terminal)
|
|
186
|
+
return { settled: terminal };
|
|
187
|
+
const current = latest?.run;
|
|
188
|
+
if (!current || !canRetryTerminal(current, candidate.run, input.runtimeEpoch)) {
|
|
189
|
+
throw new AgentRuntimeConflictError2("terminal commit");
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
candidate: current.state === "interrupt_requested" ? interruptedCandidate(candidate, current, input.now) : { ...candidate, run: current }
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
async function absorbedBy(store, candidate) {
|
|
196
|
+
const views = await Promise.all((candidate.absorb ?? []).map(({ runId }) => store.loadRun({ conversationId: candidate.run.conversationId, runId }).catch(() => {
|
|
197
|
+
return;
|
|
198
|
+
})));
|
|
199
|
+
return views.flatMap((view) => view?.run.absorbedIntoRunId === candidate.run.id ? [view.run] : []);
|
|
200
|
+
}
|
|
201
|
+
async function commitAgentRunTerminal(input) {
|
|
202
|
+
let candidate = input.candidate;
|
|
203
|
+
let storeFailures = 0;
|
|
204
|
+
for (let attempt = 0;attempt < TERMINAL_COMMIT_ATTEMPTS; attempt += 1) {
|
|
205
|
+
try {
|
|
206
|
+
const round = await attemptTerminalCommit(input, candidate);
|
|
207
|
+
if (!round.settled) {
|
|
208
|
+
candidate = round.candidate;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
const owned = storeFailures > 0 && round.settled.run.ownerId === input.runtimeEpoch && round.settled.run.fencingToken === candidate.run.fencingToken;
|
|
212
|
+
if (!owned)
|
|
213
|
+
return round.settled;
|
|
214
|
+
const absorbed = await absorbedBy(input.store, candidate);
|
|
215
|
+
return {
|
|
216
|
+
...round.settled,
|
|
217
|
+
committedByCaller: true,
|
|
218
|
+
...absorbed.length > 0 && { absorbed }
|
|
219
|
+
};
|
|
220
|
+
} catch (error) {
|
|
221
|
+
if (error instanceof AgentRuntimeConflictError2)
|
|
222
|
+
throw error;
|
|
223
|
+
const delay = storeRetryDelay(storeFailures);
|
|
224
|
+
if (delay === undefined)
|
|
225
|
+
throw error;
|
|
226
|
+
storeFailures += 1;
|
|
227
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
throw new AgentRuntimeConflictError2("terminal commit");
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// src/agent-runtime/runtime-internals.ts
|
|
234
|
+
function findRun(runs, runId) {
|
|
235
|
+
const run = runs.find((candidate) => candidate.id === runId);
|
|
236
|
+
if (!run)
|
|
237
|
+
throw new AgentRuntimeConflictError2("run lookup");
|
|
238
|
+
return run;
|
|
239
|
+
}
|
|
240
|
+
function jsonValue(value) {
|
|
241
|
+
const parsed = z.json().safeParse(value);
|
|
242
|
+
return parsed.success ? parsed.data : { message: "Non-JSON tool output omitted" };
|
|
243
|
+
}
|
|
244
|
+
function providerEnvelope(value) {
|
|
245
|
+
const parsed = AgentJsonObjectSchema2.safeParse(value);
|
|
246
|
+
if (!parsed.success)
|
|
247
|
+
return;
|
|
248
|
+
return { schemaVersion: 1, provider: "ai-sdk", data: parsed.data };
|
|
249
|
+
}
|
|
250
|
+
function providerResponseIdentity(id, provider) {
|
|
251
|
+
return AgentProviderResponseSchema2.parse({
|
|
252
|
+
id,
|
|
253
|
+
...typeof provider === "string" && provider.length > 0 ? { provider } : {}
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function appendText(parts, text) {
|
|
257
|
+
const previous = parts.at(-1);
|
|
258
|
+
if (previous?.type === "text") {
|
|
259
|
+
const next = AgentMessagePartSchema2.parse({ ...previous, text: previous.text + text });
|
|
260
|
+
parts.splice(parts.length - 1, 1, next);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
parts.push(AgentMessagePartSchema2.parse({ type: "text", text }));
|
|
264
|
+
}
|
|
265
|
+
function abortTerminalReason(signal) {
|
|
266
|
+
if (signal.reason === "shutdown")
|
|
267
|
+
return "shutdown";
|
|
268
|
+
if (signal.reason === "timeout")
|
|
269
|
+
return "timeout";
|
|
270
|
+
if (signal.reason === "supersede")
|
|
271
|
+
return "superseded";
|
|
272
|
+
return "interrupted";
|
|
273
|
+
}
|
|
274
|
+
function addUsage(total, step) {
|
|
275
|
+
const sum = (left, right) => {
|
|
276
|
+
if (left?.value === undefined && right?.value === undefined) {
|
|
277
|
+
return { provenance: "unavailable" };
|
|
278
|
+
}
|
|
279
|
+
if (left?.value === undefined)
|
|
280
|
+
return { ...right, provenance: "computed" };
|
|
281
|
+
if (right?.value === undefined)
|
|
282
|
+
return { ...left, provenance: "computed" };
|
|
283
|
+
return { value: left.value + right.value, provenance: "computed" };
|
|
284
|
+
};
|
|
285
|
+
const sumCost = (left, right) => {
|
|
286
|
+
if (left?.value === undefined || right?.value === undefined) {
|
|
287
|
+
return { provenance: "unavailable" };
|
|
288
|
+
}
|
|
289
|
+
if (left.currency !== right.currency)
|
|
290
|
+
return { provenance: "unavailable" };
|
|
291
|
+
return {
|
|
292
|
+
value: left.value + right.value,
|
|
293
|
+
...left.currency && { currency: left.currency },
|
|
294
|
+
provenance: "computed"
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
if (!total)
|
|
298
|
+
return step;
|
|
299
|
+
const cost = sumCost(total.cost, step.cost);
|
|
300
|
+
return {
|
|
301
|
+
inputTokens: sum(total.inputTokens, step.inputTokens),
|
|
302
|
+
outputTokens: sum(total.outputTokens, step.outputTokens),
|
|
303
|
+
reasoningTokens: sum(total.reasoningTokens, step.reasoningTokens),
|
|
304
|
+
cacheReadTokens: sum(total.cacheReadTokens, step.cacheReadTokens),
|
|
305
|
+
cacheWriteTokens: sum(total.cacheWriteTokens, step.cacheWriteTokens),
|
|
306
|
+
...cost && { cost }
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function mergeModelTotals(sdkTotal, accumulated) {
|
|
310
|
+
const pick = (total, ours) => {
|
|
311
|
+
if (ours?.provenance === "unavailable")
|
|
312
|
+
return ours;
|
|
313
|
+
return total?.value !== undefined ? { value: total.value, provenance: "computed" } : ours ?? { provenance: "unavailable" };
|
|
314
|
+
};
|
|
315
|
+
return {
|
|
316
|
+
inputTokens: pick(sdkTotal.inputTokens, accumulated?.inputTokens),
|
|
317
|
+
outputTokens: pick(sdkTotal.outputTokens, accumulated?.outputTokens),
|
|
318
|
+
reasoningTokens: pick(sdkTotal.reasoningTokens, accumulated?.reasoningTokens),
|
|
319
|
+
cacheReadTokens: pick(sdkTotal.cacheReadTokens, accumulated?.cacheReadTokens),
|
|
320
|
+
cacheWriteTokens: pick(sdkTotal.cacheWriteTokens, accumulated?.cacheWriteTokens),
|
|
321
|
+
cost: accumulated?.cost ?? { provenance: "unavailable" }
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function statedUsage(usage) {
|
|
325
|
+
const stated = (value) => value ?? { provenance: "unavailable" };
|
|
326
|
+
if (!usage)
|
|
327
|
+
return unknownUsage();
|
|
328
|
+
return {
|
|
329
|
+
inputTokens: stated(usage.inputTokens),
|
|
330
|
+
outputTokens: stated(usage.outputTokens),
|
|
331
|
+
reasoningTokens: stated(usage.reasoningTokens),
|
|
332
|
+
cacheReadTokens: stated(usage.cacheReadTokens),
|
|
333
|
+
cacheWriteTokens: stated(usage.cacheWriteTokens),
|
|
334
|
+
cost: stated(usage.cost)
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
function unknownUsage() {
|
|
338
|
+
const nothing = { provenance: "unavailable" };
|
|
339
|
+
return {
|
|
340
|
+
inputTokens: nothing,
|
|
341
|
+
outputTokens: nothing,
|
|
342
|
+
reasoningTokens: nothing,
|
|
343
|
+
cacheReadTokens: nothing,
|
|
344
|
+
cacheWriteTokens: nothing,
|
|
345
|
+
cost: nothing
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function normalizeSdkUsage(value) {
|
|
349
|
+
const reported = (tokens) => tokens === undefined || !Number.isSafeInteger(tokens) || tokens < 0 ? { provenance: "unavailable" } : { value: tokens, provenance: "provider-reported" };
|
|
350
|
+
return {
|
|
351
|
+
inputTokens: reported(value.inputTokens),
|
|
352
|
+
outputTokens: reported(value.outputTokens),
|
|
353
|
+
reasoningTokens: reported(value.outputTokenDetails.reasoningTokens),
|
|
354
|
+
cacheReadTokens: reported(value.inputTokenDetails.cacheReadTokens),
|
|
355
|
+
cacheWriteTokens: reported(value.inputTokenDetails.cacheWriteTokens)
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function createIdleDeadline(parent, timeoutMs) {
|
|
359
|
+
if (timeoutMs === undefined) {
|
|
360
|
+
const noop = () => {
|
|
361
|
+
return;
|
|
362
|
+
};
|
|
363
|
+
return {
|
|
364
|
+
signal: parent,
|
|
365
|
+
touch: noop,
|
|
366
|
+
start: noop,
|
|
367
|
+
stop: noop,
|
|
368
|
+
suspend: noop,
|
|
369
|
+
resume: noop,
|
|
370
|
+
dispose: noop,
|
|
371
|
+
release: noop
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
const controller = new AbortController;
|
|
375
|
+
const link = linkAbortSignals(parent, controller.signal);
|
|
376
|
+
let timer;
|
|
377
|
+
let active = false;
|
|
378
|
+
let suspended = 0;
|
|
379
|
+
const clear = () => {
|
|
380
|
+
if (timer !== undefined)
|
|
381
|
+
clearTimeout(timer);
|
|
382
|
+
timer = undefined;
|
|
383
|
+
};
|
|
384
|
+
const touch = () => {
|
|
385
|
+
clear();
|
|
386
|
+
if (!active || suspended > 0 || controller.signal.aborted)
|
|
387
|
+
return;
|
|
388
|
+
timer = setTimeout(() => controller.abort("timeout"), timeoutMs);
|
|
389
|
+
};
|
|
390
|
+
return {
|
|
391
|
+
signal: link.signal,
|
|
392
|
+
touch,
|
|
393
|
+
start() {
|
|
394
|
+
active = true;
|
|
395
|
+
touch();
|
|
396
|
+
},
|
|
397
|
+
stop() {
|
|
398
|
+
active = false;
|
|
399
|
+
clear();
|
|
400
|
+
},
|
|
401
|
+
suspend() {
|
|
402
|
+
suspended += 1;
|
|
403
|
+
clear();
|
|
404
|
+
},
|
|
405
|
+
resume() {
|
|
406
|
+
suspended = Math.max(0, suspended - 1);
|
|
407
|
+
touch();
|
|
408
|
+
},
|
|
409
|
+
dispose() {
|
|
410
|
+
active = false;
|
|
411
|
+
clear();
|
|
412
|
+
},
|
|
413
|
+
release: link.release
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// src/agent-runtime/run-execution-state.ts
|
|
418
|
+
function adoptSnapshot(state, next) {
|
|
419
|
+
state.snapshot = next;
|
|
420
|
+
state.observedVersion = next.version;
|
|
421
|
+
state.run = findRun(next.runs, state.run.id);
|
|
422
|
+
}
|
|
423
|
+
function transientSequence(state) {
|
|
424
|
+
state.sequence += 1;
|
|
425
|
+
return state.sequence;
|
|
426
|
+
}
|
|
427
|
+
function billedUsage(state) {
|
|
428
|
+
return state.abandonedUsage && state.modelUsage ? addUsage(state.abandonedUsage, state.modelUsage) : state.abandonedUsage ?? state.modelUsage;
|
|
429
|
+
}
|
|
430
|
+
function runUsage(state) {
|
|
431
|
+
const billed = billedUsage(state);
|
|
432
|
+
return state.nonModelUsage && billed ? addUsage(state.nonModelUsage, billed) : billed ?? state.nonModelUsage;
|
|
433
|
+
}
|
|
434
|
+
function updateReasoning(state, text, metadata) {
|
|
435
|
+
const { parts } = state;
|
|
436
|
+
const provider = providerEnvelope(metadata);
|
|
437
|
+
if (state.reasoningPartIndex === undefined) {
|
|
438
|
+
state.reasoningPartIndex = parts.length;
|
|
439
|
+
parts.push(AgentMessagePartSchema2.parse({
|
|
440
|
+
type: "reasoning",
|
|
441
|
+
text,
|
|
442
|
+
...provider && { provider }
|
|
443
|
+
}));
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
const current = parts[state.reasoningPartIndex];
|
|
447
|
+
if (current?.type !== "reasoning") {
|
|
448
|
+
throw new AgentRuntimeConflictError2("reasoning accumulator");
|
|
449
|
+
}
|
|
450
|
+
parts.splice(state.reasoningPartIndex, 1, AgentMessagePartSchema2.parse({
|
|
451
|
+
...current,
|
|
452
|
+
text: current.text + text,
|
|
453
|
+
...provider && { provider }
|
|
454
|
+
}));
|
|
455
|
+
}
|
|
456
|
+
function checkpoint(execution, toolStatus) {
|
|
457
|
+
const { config, runtimeEpoch, publish, now } = execution.dependencies;
|
|
458
|
+
const { state } = execution;
|
|
459
|
+
return execution.serialize(async () => {
|
|
460
|
+
state.assistant = AgentMessageSchema2.parse({
|
|
461
|
+
...state.assistant,
|
|
462
|
+
parts: state.parts,
|
|
463
|
+
updatedAt: now().toISOString()
|
|
464
|
+
});
|
|
465
|
+
const run = state.run;
|
|
466
|
+
adoptSnapshot(state, appliedSnapshot(await config.store.checkpointRunAssistant({
|
|
467
|
+
conversationId: run.conversationId,
|
|
468
|
+
runId: run.id,
|
|
469
|
+
expectedRevision: run.revision,
|
|
470
|
+
ownerId: runtimeEpoch,
|
|
471
|
+
...run.fencingToken !== undefined && { fencingToken: run.fencingToken },
|
|
472
|
+
assistant: state.assistant,
|
|
473
|
+
usage: statedUsage(state.usage)
|
|
474
|
+
}), "assistant checkpoint"));
|
|
475
|
+
const checkpointMetrics = {
|
|
476
|
+
partial: true,
|
|
477
|
+
durationMs: performance.now() - execution.runStartedAt,
|
|
478
|
+
usage: statedUsage(state.usage),
|
|
479
|
+
...state.firstOutputAt !== undefined && {
|
|
480
|
+
ttftMs: state.firstOutputAt - execution.runStartedAt
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
await publish({
|
|
484
|
+
type: "assistant-checkpoint",
|
|
485
|
+
eventId: agentDurableEventId2("assistant-checkpoint", state.run.id, state.observedVersion),
|
|
486
|
+
conversationId: state.run.conversationId,
|
|
487
|
+
runId: state.run.id,
|
|
488
|
+
snapshotVersion: state.observedVersion,
|
|
489
|
+
message: state.assistant,
|
|
490
|
+
metrics: checkpointMetrics,
|
|
491
|
+
emittedAt: now().toISOString()
|
|
492
|
+
});
|
|
493
|
+
if (toolStatus)
|
|
494
|
+
await publish({
|
|
495
|
+
type: "tool-status",
|
|
496
|
+
eventId: agentDurableEventId2("tool-status", state.run.id, state.observedVersion, `${toolStatus.callId}:${toolStatus.status}`),
|
|
497
|
+
conversationId: state.run.conversationId,
|
|
498
|
+
runId: state.run.id,
|
|
499
|
+
snapshotVersion: state.observedVersion,
|
|
500
|
+
...toolStatus,
|
|
501
|
+
emittedAt: now().toISOString()
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// src/agent-runtime/run-step-spend.ts
|
|
507
|
+
var DEFAULT_STEP_SPEND_TIMEOUT_MS = 5000;
|
|
508
|
+
var AgentStepSpendPhaseSchema2 = z2.enum(["step", "abandoned-attempt", "compaction"]);
|
|
509
|
+
var AgentStepSpendProviderSchema = z2.strictObject({
|
|
510
|
+
key: z2.string().min(1),
|
|
511
|
+
upstream: z2.string().min(1).optional()
|
|
512
|
+
});
|
|
513
|
+
var StepSpendBaseShape = {
|
|
514
|
+
conversationId: AgentRecordIdSchema2,
|
|
515
|
+
runId: AgentRecordIdSchema2,
|
|
516
|
+
step: z2.int().nonnegative(),
|
|
517
|
+
attempt: z2.int().nonnegative(),
|
|
518
|
+
usage: AgentUsageSchema2,
|
|
519
|
+
trace: ModelInvocationTraceSchema2.optional()
|
|
520
|
+
};
|
|
521
|
+
var ModelStepSpendShape = {
|
|
522
|
+
...StepSpendBaseShape,
|
|
523
|
+
model: z2.string().min(1),
|
|
524
|
+
provider: AgentStepSpendProviderSchema,
|
|
525
|
+
response: AgentProviderResponseSchema2
|
|
526
|
+
};
|
|
527
|
+
var AgentStepSpendSchema2 = z2.discriminatedUnion("phase", [
|
|
528
|
+
z2.strictObject({ ...ModelStepSpendShape, phase: z2.literal("step") }),
|
|
529
|
+
z2.strictObject({ ...ModelStepSpendShape, phase: z2.literal("abandoned-attempt") }),
|
|
530
|
+
z2.strictObject({ ...StepSpendBaseShape, phase: z2.literal("compaction") })
|
|
531
|
+
]);
|
|
532
|
+
function normalizeStepUsage(selectedModel, usage, providerMetadata) {
|
|
533
|
+
return selectedModel?.normalizeUsage?.({
|
|
534
|
+
usage,
|
|
535
|
+
providerMetadata
|
|
536
|
+
}) ?? normalizeSdkUsage(usage);
|
|
537
|
+
}
|
|
538
|
+
async function callStepSpendHook(name, timeoutMs, call) {
|
|
539
|
+
let pending;
|
|
540
|
+
try {
|
|
541
|
+
pending = Promise.resolve(call());
|
|
542
|
+
} catch (error) {
|
|
543
|
+
return { code: "hook_error", cause: error };
|
|
544
|
+
}
|
|
545
|
+
try {
|
|
546
|
+
if ((await withDeadline(pending, timeoutMs)).settled)
|
|
547
|
+
return;
|
|
548
|
+
} catch (error) {
|
|
549
|
+
return { code: "hook_error", cause: error };
|
|
550
|
+
}
|
|
551
|
+
pending.catch(() => {
|
|
552
|
+
return;
|
|
553
|
+
});
|
|
554
|
+
return {
|
|
555
|
+
code: "hook_timeout",
|
|
556
|
+
cause: new Error(`Agent ${name} hook timed out after ${timeoutMs}ms`)
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
async function recordStepSpend(execution, input) {
|
|
560
|
+
const { config, generateId, now } = execution.dependencies;
|
|
561
|
+
const { state, trace } = execution;
|
|
562
|
+
const base = {
|
|
563
|
+
conversationId: state.run.conversationId,
|
|
564
|
+
runId: state.run.id,
|
|
565
|
+
step: state.step,
|
|
566
|
+
attempt: input.attempt,
|
|
567
|
+
...execution.invocationTrace !== undefined && { trace: execution.invocationTrace }
|
|
568
|
+
};
|
|
569
|
+
let spend;
|
|
570
|
+
if (input.phase === "compaction") {
|
|
571
|
+
const usage = statedUsage(input.usage);
|
|
572
|
+
state.nonModelUsage = addUsage(state.nonModelUsage, usage);
|
|
573
|
+
spend = AgentStepSpendSchema2.parse({ ...base, phase: input.phase, usage });
|
|
574
|
+
} else {
|
|
575
|
+
const usage = statedUsage(normalizeStepUsage(input.selectedModel, input.part.usage, input.part.providerMetadata));
|
|
576
|
+
const response = await input.ledger.recordResponse({
|
|
577
|
+
id: input.part.response.id,
|
|
578
|
+
providerMetadata: input.part.providerMetadata,
|
|
579
|
+
stepNumber: state.step,
|
|
580
|
+
attempt: input.attempt,
|
|
581
|
+
usage
|
|
582
|
+
});
|
|
583
|
+
if (input.phase === "step") {
|
|
584
|
+
state.lastPromptTokens = usage.inputTokens;
|
|
585
|
+
state.modelUsage = addUsage(state.modelUsage, usage);
|
|
586
|
+
} else {
|
|
587
|
+
state.abandonedUsage = state.abandonedUsage ? addUsage(state.abandonedUsage, usage) : usage;
|
|
588
|
+
}
|
|
589
|
+
spend = AgentStepSpendSchema2.parse({
|
|
590
|
+
...base,
|
|
591
|
+
phase: input.phase,
|
|
592
|
+
model: input.selectedModel.descriptor.modelId,
|
|
593
|
+
provider: {
|
|
594
|
+
key: input.selectedModel.descriptor.provider,
|
|
595
|
+
...response.provider !== undefined && { upstream: response.provider }
|
|
596
|
+
},
|
|
597
|
+
response,
|
|
598
|
+
usage
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
state.usage = runUsage(state);
|
|
602
|
+
const { stepSpendTimeoutMs } = execution.dependencies;
|
|
603
|
+
const hook = config.onStepSpend;
|
|
604
|
+
const runtimeContext = execution.runtimeContext;
|
|
605
|
+
let spendHookError = hook && runtimeContext ? await callStepSpendHook("onStepSpend", stepSpendTimeoutMs, () => hook({ ...runtimeContext, ...spend })) : undefined;
|
|
606
|
+
const report = config.onStepSpendError;
|
|
607
|
+
if (spendHookError !== undefined && report !== undefined) {
|
|
608
|
+
const error = spendHookError.cause;
|
|
609
|
+
const reportFailure = await callStepSpendHook("onStepSpendError", stepSpendTimeoutMs, () => report({ spend, error }));
|
|
610
|
+
if (reportFailure !== undefined)
|
|
611
|
+
spendHookError = {
|
|
612
|
+
...spendHookError,
|
|
613
|
+
reportFailed: true,
|
|
614
|
+
reportError: reportFailure.cause
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
const stepTrace = trace ? config.observe?.rootTrace(trace) : undefined;
|
|
618
|
+
config.observe?.emit({
|
|
619
|
+
schemaVersion: 1,
|
|
620
|
+
eventId: generateId(),
|
|
621
|
+
type: "step-finished",
|
|
622
|
+
conversationId: spend.conversationId,
|
|
623
|
+
runId: spend.runId,
|
|
624
|
+
traceId: stepTrace?.traceId ?? trace?.traceId ?? generateId(),
|
|
625
|
+
spanId: stepTrace?.spanId ?? generateId(),
|
|
626
|
+
...stepTrace?.parentSpanId && { parentSpanId: stepTrace.parentSpanId },
|
|
627
|
+
state: state.run.state,
|
|
628
|
+
step: spend.step,
|
|
629
|
+
attempt: spend.attempt,
|
|
630
|
+
phase: spend.phase,
|
|
631
|
+
...spend.phase !== "compaction" && {
|
|
632
|
+
modelId: spend.model,
|
|
633
|
+
provider: spend.provider,
|
|
634
|
+
response: spend.response
|
|
635
|
+
},
|
|
636
|
+
usage: spend.usage,
|
|
637
|
+
...spendHookError !== undefined && { spendHookError },
|
|
638
|
+
emittedAt: now().toISOString()
|
|
639
|
+
});
|
|
640
|
+
return spend;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// src/agent-runtime/invocation-attempt.ts
|
|
644
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
645
|
+
import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
|
|
646
|
+
import { wrapLanguageModel } from "ai";
|
|
647
|
+
|
|
648
|
+
// src/agent-runtime/invocation-failure.ts
|
|
649
|
+
class InvocationReceiptError extends Error {
|
|
650
|
+
constructor(cause) {
|
|
651
|
+
super("Model invocation receipt could not be recorded", { cause });
|
|
652
|
+
this.name = "InvocationReceiptError";
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
async function invocationAudit(work) {
|
|
656
|
+
try {
|
|
657
|
+
return await work();
|
|
658
|
+
} catch (error) {
|
|
659
|
+
throw error instanceof InvocationReceiptError ? error : new InvocationReceiptError(error);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// src/agent-runtime/invocation-payload.ts
|
|
664
|
+
import {
|
|
665
|
+
createCipheriv,
|
|
666
|
+
createDecipheriv,
|
|
667
|
+
createHash,
|
|
668
|
+
randomBytes,
|
|
669
|
+
randomUUID
|
|
670
|
+
} from "node:crypto";
|
|
671
|
+
import { z as z3 } from "zod";
|
|
672
|
+
function invocationJson(value) {
|
|
673
|
+
const errors = new WeakSet;
|
|
674
|
+
return z3.json().parse(JSON.parse(JSON.stringify(value, (_key, item) => {
|
|
675
|
+
if (item instanceof Uint8Array)
|
|
676
|
+
return { base64: Buffer.from(item).toString("base64") };
|
|
677
|
+
if (item instanceof ArrayBuffer)
|
|
678
|
+
return { base64: Buffer.from(item).toString("base64") };
|
|
679
|
+
if (item instanceof Error) {
|
|
680
|
+
if (errors.has(item))
|
|
681
|
+
return { name: item.name, message: item.message };
|
|
682
|
+
errors.add(item);
|
|
683
|
+
return { name: item.name, message: item.message, cause: item.cause };
|
|
684
|
+
}
|
|
685
|
+
return item;
|
|
686
|
+
})));
|
|
687
|
+
}
|
|
688
|
+
function invocationHash(value) {
|
|
689
|
+
return createHash("sha256").update(serializeCanonicalJson(invocationJson(value))).digest("hex");
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
class InvocationPayloadTooLargeError2 extends RangeError {
|
|
693
|
+
bytes;
|
|
694
|
+
maxBytes;
|
|
695
|
+
sha256;
|
|
696
|
+
constructor(bytes, maxBytes, sha256) {
|
|
697
|
+
super(`Invocation payload (${bytes} bytes) exceeds maxPayloadBytes (${maxBytes})`);
|
|
698
|
+
this.name = "InvocationPayloadTooLargeError";
|
|
699
|
+
this.bytes = bytes;
|
|
700
|
+
this.maxBytes = maxBytes;
|
|
701
|
+
this.sha256 = sha256;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
function createInvocationPayloads(store, key, maxBytes) {
|
|
705
|
+
if (key.byteLength !== 32)
|
|
706
|
+
throw new TypeError("Invocation payload key must contain 32 bytes");
|
|
707
|
+
const encryptionKey = Uint8Array.from(key);
|
|
708
|
+
return {
|
|
709
|
+
maxBytes,
|
|
710
|
+
async write(identity, value) {
|
|
711
|
+
const data = Buffer.from(serializeCanonicalJson(invocationJson(value)));
|
|
712
|
+
const sha256 = createHash("sha256").update(data).digest("hex");
|
|
713
|
+
if (data.byteLength > maxBytes) {
|
|
714
|
+
throw new InvocationPayloadTooLargeError2(data.byteLength, maxBytes, sha256);
|
|
715
|
+
}
|
|
716
|
+
const artifactId = randomUUID();
|
|
717
|
+
const iv = randomBytes(12);
|
|
718
|
+
const cipher = createCipheriv("aes-256-gcm", encryptionKey, iv);
|
|
719
|
+
cipher.setAAD(Buffer.from(JSON.stringify([identity.conversationId, identity.invocationId, artifactId])));
|
|
720
|
+
const ciphertext = Buffer.concat([cipher.update(data), cipher.final()]);
|
|
721
|
+
const { conversationId } = identity;
|
|
722
|
+
if (!store.appendEventOnce)
|
|
723
|
+
throw new TypeError("Invocation payloads require atomic store.appendEventOnce");
|
|
724
|
+
await store.appendEventOnce({
|
|
725
|
+
conversationId,
|
|
726
|
+
kind: "provider/payload",
|
|
727
|
+
payload: {
|
|
728
|
+
...identity,
|
|
729
|
+
artifactId,
|
|
730
|
+
sha256,
|
|
731
|
+
bytes: data.byteLength,
|
|
732
|
+
iv: iv.toString("base64"),
|
|
733
|
+
tag: cipher.getAuthTag().toString("base64"),
|
|
734
|
+
ciphertext: ciphertext.toString("base64")
|
|
735
|
+
}
|
|
736
|
+
}, artifactId);
|
|
737
|
+
return { artifactId, sha256 };
|
|
738
|
+
},
|
|
739
|
+
decrypt(conversationId, value) {
|
|
740
|
+
const payload = InvocationPayloadSchema.parse(value);
|
|
741
|
+
if (payload.bytes > maxBytes || payload.ciphertext.length > Math.ceil(maxBytes / 3) * 4) {
|
|
742
|
+
throw new RangeError("Invocation payload exceeds maxPayloadBytes");
|
|
743
|
+
}
|
|
744
|
+
const decipher = createDecipheriv("aes-256-gcm", encryptionKey, Buffer.from(payload.iv, "base64"));
|
|
745
|
+
decipher.setAAD(Buffer.from(JSON.stringify([conversationId, payload.invocationId, payload.artifactId])));
|
|
746
|
+
decipher.setAuthTag(Buffer.from(payload.tag, "base64"));
|
|
747
|
+
const data = Buffer.concat([
|
|
748
|
+
decipher.update(Buffer.from(payload.ciphertext, "base64")),
|
|
749
|
+
decipher.final()
|
|
750
|
+
]);
|
|
751
|
+
if (data.length !== payload.bytes || createHash("sha256").update(data).digest("hex") !== payload.sha256) {
|
|
752
|
+
throw new Error("Invocation payload integrity mismatch");
|
|
753
|
+
}
|
|
754
|
+
return z3.json().parse(JSON.parse(data.toString("utf8")));
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
// src/agent-runtime/provider-origin.ts
|
|
760
|
+
import {
|
|
761
|
+
InvalidToolApprovalError,
|
|
762
|
+
InvalidToolApprovalSignatureError,
|
|
763
|
+
ToolCallNotFoundForApprovalError
|
|
764
|
+
} from "ai";
|
|
765
|
+
var providerOrigin = new WeakSet;
|
|
766
|
+
function isOwnInputRefusal(error) {
|
|
767
|
+
return InvalidToolApprovalSignatureError.isInstance(error) || InvalidToolApprovalError.isInstance(error) || ToolCallNotFoundForApprovalError.isInstance(error);
|
|
768
|
+
}
|
|
769
|
+
function markProviderOrigin(error) {
|
|
770
|
+
if (typeof error === "object" && error !== null)
|
|
771
|
+
providerOrigin.add(error);
|
|
772
|
+
return error;
|
|
773
|
+
}
|
|
774
|
+
function hasProviderOrigin(error) {
|
|
775
|
+
return typeof error === "object" && error !== null && providerOrigin.has(error);
|
|
776
|
+
}
|
|
777
|
+
function markProviderStream(stream) {
|
|
778
|
+
const reader = stream.getReader();
|
|
779
|
+
return new ReadableStream({
|
|
780
|
+
async pull(controller) {
|
|
781
|
+
let read;
|
|
782
|
+
try {
|
|
783
|
+
read = await reader.read();
|
|
784
|
+
} catch (error) {
|
|
785
|
+
controller.error(isOwnInputRefusal(error) ? error : markProviderOrigin(error));
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
if (read.done)
|
|
789
|
+
controller.close();
|
|
790
|
+
else
|
|
791
|
+
controller.enqueue(read.value);
|
|
792
|
+
},
|
|
793
|
+
cancel(reason) {
|
|
794
|
+
return reader.cancel(reason);
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// src/agent-runtime/invocation-attempt.ts
|
|
800
|
+
var currentAttempt = new AsyncLocalStorage;
|
|
801
|
+
function currentModelInvocationAttempt2() {
|
|
802
|
+
const value = currentAttempt.getStore();
|
|
803
|
+
return value && { ...value };
|
|
804
|
+
}
|
|
805
|
+
function wrapInvocationModel(writer, selected, step, model = selected.model) {
|
|
806
|
+
if (typeof model === "string")
|
|
807
|
+
throw new TypeError("Invocation receipts require a resolved model object");
|
|
808
|
+
const begin = async (params) => invocationAudit(async () => {
|
|
809
|
+
const context = { ...writer.identity, step, attemptId: randomUUID2() };
|
|
810
|
+
const { headers: _headers, abortSignal: _signal, ...payload } = params;
|
|
811
|
+
let artifact;
|
|
812
|
+
let omittedSha256;
|
|
813
|
+
try {
|
|
814
|
+
artifact = await writer.payloads.write(writer.identity, payload);
|
|
815
|
+
} catch (error) {
|
|
816
|
+
if (!(error instanceof InvocationPayloadTooLargeError2))
|
|
817
|
+
throw error;
|
|
818
|
+
writer.receiptErrors.push(error);
|
|
819
|
+
omittedSha256 = error.sha256;
|
|
820
|
+
}
|
|
821
|
+
await writer.append({
|
|
822
|
+
...writer.identity,
|
|
823
|
+
type: "provider/request",
|
|
824
|
+
attemptId: context.attemptId,
|
|
825
|
+
step,
|
|
826
|
+
executingProcess: writer.process,
|
|
827
|
+
requested: {
|
|
828
|
+
modelId: selected.descriptor.modelId,
|
|
829
|
+
provider: selected.descriptor.provider
|
|
830
|
+
},
|
|
831
|
+
sent: {
|
|
832
|
+
modelId: model.modelId,
|
|
833
|
+
provider: model.provider,
|
|
834
|
+
payloadSha256: artifact ? artifact.sha256 : omittedSha256 ?? "",
|
|
835
|
+
...artifact ? { artifactId: artifact.artifactId } : { payloadOmitted: "max-payload-bytes" },
|
|
836
|
+
tools: params.tools?.length ?? 0
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
try {
|
|
840
|
+
await writer.onAttempt?.({ ...context });
|
|
841
|
+
} catch (error) {
|
|
842
|
+
await finish(context, "failed", { phase: "transport-audit", error });
|
|
843
|
+
throw error;
|
|
844
|
+
}
|
|
845
|
+
return context;
|
|
846
|
+
});
|
|
847
|
+
const finish = (...args) => recordResponse(...args).catch((error) => {
|
|
848
|
+
writer.receiptErrors.push(error);
|
|
849
|
+
});
|
|
850
|
+
const recordResponse = async (context, status, payload, usage, response, providerMetadata) => invocationAudit(async () => {
|
|
851
|
+
let artifact;
|
|
852
|
+
let omittedSha256;
|
|
853
|
+
try {
|
|
854
|
+
artifact = await writer.payloads.write(writer.identity, boundedEvidence(payload, Math.floor(writer.payloads.maxBytes / 2)));
|
|
855
|
+
} catch (error) {
|
|
856
|
+
if (!(error instanceof InvocationPayloadTooLargeError2))
|
|
857
|
+
throw error;
|
|
858
|
+
writer.receiptErrors.push(error);
|
|
859
|
+
omittedSha256 = error.sha256;
|
|
860
|
+
}
|
|
861
|
+
await writer.append({
|
|
862
|
+
...writer.identity,
|
|
863
|
+
type: "provider/response",
|
|
864
|
+
attemptId: context.attemptId,
|
|
865
|
+
step,
|
|
866
|
+
status,
|
|
867
|
+
effective: {
|
|
868
|
+
provider: selected.resolveResponseProvider?.({ providerMetadata }) ?? null,
|
|
869
|
+
modelId: response?.modelId ?? null,
|
|
870
|
+
responseId: response?.id ?? null
|
|
871
|
+
},
|
|
872
|
+
usage: reportedUsage(selected, usage, providerMetadata),
|
|
873
|
+
...artifact ? { artifactId: artifact.artifactId } : { payloadOmitted: "max-payload-bytes" },
|
|
874
|
+
payloadSha256: artifact ? artifact.sha256 : omittedSha256 ?? ""
|
|
875
|
+
});
|
|
876
|
+
});
|
|
877
|
+
return wrapLanguageModel({
|
|
878
|
+
model,
|
|
879
|
+
middleware: {
|
|
880
|
+
specificationVersion: "v4",
|
|
881
|
+
async wrapGenerate({ doGenerate, params }) {
|
|
882
|
+
const context = await begin(params);
|
|
883
|
+
let result;
|
|
884
|
+
try {
|
|
885
|
+
result = await currentAttempt.run(context, doGenerate);
|
|
886
|
+
} catch (error) {
|
|
887
|
+
await finish(context, params.abortSignal?.aborted ? "cancelled" : "failed", {
|
|
888
|
+
error
|
|
889
|
+
});
|
|
890
|
+
throw markProviderOrigin(error);
|
|
891
|
+
}
|
|
892
|
+
await finish(context, result.finishReason.unified === "error" ? "failed" : "succeeded", {
|
|
893
|
+
content: result.content,
|
|
894
|
+
usage: result.usage,
|
|
895
|
+
response: result.response,
|
|
896
|
+
providerMetadata: result.providerMetadata
|
|
897
|
+
}, result.usage, result.response, result.providerMetadata);
|
|
898
|
+
if (result.finishReason.unified === "error") {
|
|
899
|
+
throw markProviderOrigin(new Error("Provider returned an error finish reason"));
|
|
900
|
+
}
|
|
901
|
+
return result;
|
|
902
|
+
},
|
|
903
|
+
async wrapStream({ doStream, params }) {
|
|
904
|
+
const context = await begin(params);
|
|
905
|
+
let result;
|
|
906
|
+
try {
|
|
907
|
+
result = await currentAttempt.run(context, doStream);
|
|
908
|
+
} catch (error) {
|
|
909
|
+
await finish(context, params.abortSignal?.aborted ? "cancelled" : "failed", {
|
|
910
|
+
error
|
|
911
|
+
});
|
|
912
|
+
throw markProviderOrigin(error);
|
|
913
|
+
}
|
|
914
|
+
return wrapInvocationStreamResult(result, {
|
|
915
|
+
context,
|
|
916
|
+
abortSignal: params.abortSignal,
|
|
917
|
+
maxEvidenceBytes: Math.floor(writer.payloads.maxBytes / 2),
|
|
918
|
+
finish
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
function wrapInvocationStreamResult(result, options) {
|
|
925
|
+
const { context, abortSignal, maxEvidenceBytes, finish } = options;
|
|
926
|
+
const reader = result.stream.getReader();
|
|
927
|
+
let ended = false;
|
|
928
|
+
let failed = false;
|
|
929
|
+
let response;
|
|
930
|
+
const evidence = streamEvidence(maxEvidenceBytes);
|
|
931
|
+
const end = async (status, value, usage, metadata) => {
|
|
932
|
+
if (ended)
|
|
933
|
+
return;
|
|
934
|
+
ended = true;
|
|
935
|
+
await finish(context, status, evidence.payload(value), usage, response, metadata);
|
|
936
|
+
};
|
|
937
|
+
return {
|
|
938
|
+
...result,
|
|
939
|
+
stream: new ReadableStream({
|
|
940
|
+
async pull(controller) {
|
|
941
|
+
let next;
|
|
942
|
+
try {
|
|
943
|
+
next = await currentAttempt.run(context, () => reader.read());
|
|
944
|
+
} catch (error) {
|
|
945
|
+
await end(abortSignal?.aborted ? "cancelled" : "failed", { error });
|
|
946
|
+
controller.error(markProviderOrigin(error));
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
if (next.done) {
|
|
950
|
+
await end("failed", { reason: "stream-ended-without-finish" });
|
|
951
|
+
controller.close();
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
const part = next.value;
|
|
955
|
+
if (part.type === "response-metadata")
|
|
956
|
+
response = part;
|
|
957
|
+
if (part.type === "finish") {
|
|
958
|
+
await end(failed || part.finishReason.unified === "error" ? "failed" : "succeeded", part, part.usage, part.providerMetadata);
|
|
959
|
+
} else {
|
|
960
|
+
if (part.type === "error")
|
|
961
|
+
failed = true;
|
|
962
|
+
evidence.record(part);
|
|
963
|
+
}
|
|
964
|
+
controller.enqueue(part);
|
|
965
|
+
},
|
|
966
|
+
async cancel(reason) {
|
|
967
|
+
try {
|
|
968
|
+
await currentAttempt.run(context, () => reader.cancel(reason));
|
|
969
|
+
} finally {
|
|
970
|
+
await end("cancelled", { reason: "consumer-cancelled" });
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
})
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
function boundedEvidence(payload, limit) {
|
|
977
|
+
const serialized = JSON.stringify(invocationJson(payload));
|
|
978
|
+
const bytes = Buffer.byteLength(serialized);
|
|
979
|
+
if (bytes <= limit)
|
|
980
|
+
return payload;
|
|
981
|
+
return {
|
|
982
|
+
truncated: { bytes, sha256: createHash2("sha256").update(serialized).digest("hex") }
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
function streamEvidence(limit) {
|
|
986
|
+
const output = [];
|
|
987
|
+
const whole = createHash2("sha256");
|
|
988
|
+
let bytes = 0;
|
|
989
|
+
let parts = 0;
|
|
990
|
+
let truncated = false;
|
|
991
|
+
return {
|
|
992
|
+
record(part) {
|
|
993
|
+
const json = invocationJson(part);
|
|
994
|
+
const serialized = JSON.stringify(json);
|
|
995
|
+
whole.update(serialized).update(`
|
|
996
|
+
`);
|
|
997
|
+
parts += 1;
|
|
998
|
+
const size = Buffer.byteLength(serialized);
|
|
999
|
+
if (!truncated && bytes + size > limit)
|
|
1000
|
+
truncated = true;
|
|
1001
|
+
if (truncated)
|
|
1002
|
+
return;
|
|
1003
|
+
bytes += size;
|
|
1004
|
+
output.push(json);
|
|
1005
|
+
},
|
|
1006
|
+
payload(terminal) {
|
|
1007
|
+
return {
|
|
1008
|
+
output,
|
|
1009
|
+
terminal,
|
|
1010
|
+
...truncated && { truncated: { parts, sha256: whole.digest("hex") } }
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
function reportedUsage(selected, value, providerMetadata) {
|
|
1016
|
+
const usage = {
|
|
1017
|
+
inputTokens: value?.inputTokens.total,
|
|
1018
|
+
outputTokens: value?.outputTokens.total,
|
|
1019
|
+
totalTokens: undefined,
|
|
1020
|
+
inputTokenDetails: {
|
|
1021
|
+
noCacheTokens: value?.inputTokens.noCache,
|
|
1022
|
+
cacheReadTokens: value?.inputTokens.cacheRead,
|
|
1023
|
+
cacheWriteTokens: value?.inputTokens.cacheWrite
|
|
1024
|
+
},
|
|
1025
|
+
outputTokenDetails: {
|
|
1026
|
+
textTokens: value?.outputTokens.text,
|
|
1027
|
+
reasoningTokens: value?.outputTokens.reasoning
|
|
1028
|
+
},
|
|
1029
|
+
...value?.raw && { raw: value.raw }
|
|
1030
|
+
};
|
|
1031
|
+
return normalizeStepUsage(selected, usage, providerMetadata);
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
// src/agent-runtime/models.ts
|
|
1035
|
+
import { z as z4 } from "zod";
|
|
1036
|
+
var AgentModelCapabilitySchema2 = z4.enum(["tools", "vision", "reasoning", "files"]);
|
|
1037
|
+
var AgentModelDescriptorSchema2 = z4.object({
|
|
1038
|
+
provider: z4.string().min(1),
|
|
1039
|
+
modelId: z4.string().min(1),
|
|
1040
|
+
contextWindow: z4.int().positive(),
|
|
1041
|
+
capabilities: z4.array(AgentModelCapabilitySchema2),
|
|
1042
|
+
observedAt: z4.iso.datetime({ offset: true }).optional(),
|
|
1043
|
+
source: z4.string().min(1).optional(),
|
|
1044
|
+
availability: z4.enum(["available", "unavailable"]).optional()
|
|
1045
|
+
});
|
|
1046
|
+
var AgentModelRegistrySnapshotSchema2 = z4.object({
|
|
1047
|
+
schemaVersion: z4.literal(1),
|
|
1048
|
+
source: z4.string().min(1),
|
|
1049
|
+
observedAt: z4.iso.datetime({ offset: true }),
|
|
1050
|
+
models: z4.record(z4.string().min(1), AgentModelDescriptorSchema2)
|
|
1051
|
+
});
|
|
1052
|
+
var AgentModelPriceSchema2 = z4.object({
|
|
1053
|
+
currency: z4.string().length(3),
|
|
1054
|
+
inputPerToken: z4.string().regex(/^\d+(?:\.\d+)?$/).optional(),
|
|
1055
|
+
outputPerToken: z4.string().regex(/^\d+(?:\.\d+)?$/).optional()
|
|
1056
|
+
}).strict();
|
|
1057
|
+
var AgentModelMetricSchema2 = z4.object({
|
|
1058
|
+
metric: z4.string().min(1),
|
|
1059
|
+
value: z4.number(),
|
|
1060
|
+
unit: z4.enum(["index", "elo", "percent", "milliseconds"]),
|
|
1061
|
+
source: z4.string().min(1),
|
|
1062
|
+
observedAt: z4.iso.datetime({ offset: true })
|
|
1063
|
+
}).strict();
|
|
1064
|
+
var AgentModelPopularitySchema2 = z4.object({
|
|
1065
|
+
rank: z4.int().positive(),
|
|
1066
|
+
window: z4.literal("week"),
|
|
1067
|
+
source: z4.string().min(1),
|
|
1068
|
+
observedAt: z4.iso.datetime({ offset: true })
|
|
1069
|
+
}).strict();
|
|
1070
|
+
var AgentModelCatalogEntrySchema2 = z4.object({
|
|
1071
|
+
id: z4.string().min(1),
|
|
1072
|
+
name: z4.string().min(1),
|
|
1073
|
+
descriptor: AgentModelDescriptorSchema2,
|
|
1074
|
+
description: z4.string().optional(),
|
|
1075
|
+
price: AgentModelPriceSchema2.optional(),
|
|
1076
|
+
popularity: AgentModelPopularitySchema2.optional(),
|
|
1077
|
+
metrics: z4.array(AgentModelMetricSchema2)
|
|
1078
|
+
}).strict();
|
|
1079
|
+
var AgentModelCatalogSchema2 = z4.object({
|
|
1080
|
+
schemaVersion: z4.literal(1),
|
|
1081
|
+
source: z4.string().min(1),
|
|
1082
|
+
observedAt: z4.iso.datetime({ offset: true }),
|
|
1083
|
+
completeness: z4.enum(["complete", "partial"]),
|
|
1084
|
+
models: z4.array(AgentModelCatalogEntrySchema2),
|
|
1085
|
+
diagnostics: z4.array(z4.string())
|
|
1086
|
+
}).strict();
|
|
1087
|
+
var AgentModelSelectionSchema2 = z4.object({
|
|
1088
|
+
modelId: z4.string().min(1),
|
|
1089
|
+
selectedAt: z4.iso.datetime({ offset: true })
|
|
1090
|
+
}).strict();
|
|
1091
|
+
var AgentModelSearchInputSchema2 = z4.object({ query: z4.string().max(256).default(""), limit: z4.int().positive().max(200) }).strict();
|
|
1092
|
+
var AgentModelSearchResultSchema2 = z4.object({
|
|
1093
|
+
models: z4.array(AgentModelCatalogEntrySchema2),
|
|
1094
|
+
total: z4.int().nonnegative(),
|
|
1095
|
+
truncated: z4.boolean()
|
|
1096
|
+
}).strict();
|
|
1097
|
+
function searchAgentModelCatalog2(catalog, rawInput) {
|
|
1098
|
+
const input = AgentModelSearchInputSchema2.parse(rawInput);
|
|
1099
|
+
const terms = input.query.toLocaleLowerCase().trim().split(/\s+/).filter(Boolean);
|
|
1100
|
+
const matches = catalog.models.filter((model) => {
|
|
1101
|
+
const searchable = `${model.id}
|
|
1102
|
+
${model.name}
|
|
1103
|
+
${model.description ?? ""}`.toLocaleLowerCase();
|
|
1104
|
+
return terms.every((term) => searchable.includes(term));
|
|
1105
|
+
});
|
|
1106
|
+
return AgentModelSearchResultSchema2.parse({
|
|
1107
|
+
models: matches.slice(0, input.limit),
|
|
1108
|
+
total: matches.length,
|
|
1109
|
+
truncated: matches.length > input.limit
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
function createMemoryAgentModelSelectionStore2() {
|
|
1113
|
+
const selections = new Map;
|
|
1114
|
+
return {
|
|
1115
|
+
load: (conversationId) => selections.get(conversationId),
|
|
1116
|
+
save(conversationId, rawSelection) {
|
|
1117
|
+
selections.set(conversationId, AgentModelSelectionSchema2.parse(rawSelection));
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
function defineModelRegistry2(config) {
|
|
1122
|
+
const descriptors = new Map;
|
|
1123
|
+
for (const key in config.models) {
|
|
1124
|
+
const declaration = config.models[key];
|
|
1125
|
+
if (declaration)
|
|
1126
|
+
descriptors.set(key, AgentModelDescriptorSchema2.parse(declaration));
|
|
1127
|
+
}
|
|
1128
|
+
const descriptor = (key) => {
|
|
1129
|
+
const found = descriptors.get(key);
|
|
1130
|
+
if (!found)
|
|
1131
|
+
throw new Error(`Unknown agent model: ${key}`);
|
|
1132
|
+
return found;
|
|
1133
|
+
};
|
|
1134
|
+
const supports = (key, capabilities) => {
|
|
1135
|
+
const available = new Set(descriptor(key).capabilities);
|
|
1136
|
+
return capabilities.every((capability) => available.has(capability));
|
|
1137
|
+
};
|
|
1138
|
+
const preflight = (key, required = []) => {
|
|
1139
|
+
const selected = descriptor(key);
|
|
1140
|
+
if (selected.availability === "unavailable") {
|
|
1141
|
+
throw new Error(`Agent model ${key} is unavailable`);
|
|
1142
|
+
}
|
|
1143
|
+
if (!supports(key, required)) {
|
|
1144
|
+
throw new Error(`Agent model ${key} does not satisfy required capabilities`);
|
|
1145
|
+
}
|
|
1146
|
+
if (!config.providers[selected.provider]) {
|
|
1147
|
+
throw new Error(`Unknown agent model provider: ${selected.provider}`);
|
|
1148
|
+
}
|
|
1149
|
+
return selected;
|
|
1150
|
+
};
|
|
1151
|
+
return {
|
|
1152
|
+
keys: () => [...descriptors.keys()],
|
|
1153
|
+
descriptor,
|
|
1154
|
+
supports,
|
|
1155
|
+
preflight,
|
|
1156
|
+
resolve(key, required = []) {
|
|
1157
|
+
const selected = preflight(key, required);
|
|
1158
|
+
const provider = config.providers[selected.provider];
|
|
1159
|
+
if (!provider)
|
|
1160
|
+
throw new Error(`Unknown agent model provider: ${selected.provider}`);
|
|
1161
|
+
return {
|
|
1162
|
+
descriptor: selected,
|
|
1163
|
+
model: provider.create(selected.modelId),
|
|
1164
|
+
...provider.normalizeUsage && { normalizeUsage: provider.normalizeUsage },
|
|
1165
|
+
...provider.resolveResponseProvider && {
|
|
1166
|
+
resolveResponseProvider: provider.resolveResponseProvider
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1169
|
+
},
|
|
1170
|
+
snapshot(input) {
|
|
1171
|
+
return AgentModelRegistrySnapshotSchema2.parse({
|
|
1172
|
+
schemaVersion: 1,
|
|
1173
|
+
source: input.source,
|
|
1174
|
+
observedAt: input.observedAt,
|
|
1175
|
+
models: Object.fromEntries(descriptors.entries())
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
function validateAgentModelSnapshot2(input, policy) {
|
|
1181
|
+
if (!Number.isSafeInteger(policy.maxAgeMs) || policy.maxAgeMs < 0) {
|
|
1182
|
+
throw new TypeError("maxAgeMs must be a non-negative safe integer");
|
|
1183
|
+
}
|
|
1184
|
+
const snapshot = AgentModelRegistrySnapshotSchema2.parse(input);
|
|
1185
|
+
const now = policy.now?.() ?? new Date;
|
|
1186
|
+
const age = now.getTime() - new Date(snapshot.observedAt).getTime();
|
|
1187
|
+
if (age < 0 || age > policy.maxAgeMs) {
|
|
1188
|
+
throw new Error(`Agent model snapshot from ${snapshot.source} is stale`);
|
|
1189
|
+
}
|
|
1190
|
+
return snapshot;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
export { withStoreRetries, AgentRuntimeConflictError2, AgentRunUnsettledError2, appliedSnapshot, terminalOfSnapshot, terminalOfRunView, commitAgentRunTerminal, findRun, jsonValue, providerEnvelope, providerResponseIdentity, appendText, abortTerminalReason, addUsage, mergeModelTotals, statedUsage, unknownUsage, normalizeSdkUsage, createIdleDeadline, adoptSnapshot, transientSequence, runUsage, updateReasoning, checkpoint, DEFAULT_STEP_SPEND_TIMEOUT_MS, AgentStepSpendPhaseSchema2, AgentStepSpendProviderSchema, AgentStepSpendSchema2, normalizeStepUsage, recordStepSpend, InvocationReceiptError, invocationHash, InvocationPayloadTooLargeError2, createInvocationPayloads, isOwnInputRefusal, markProviderOrigin, hasProviderOrigin, markProviderStream, currentModelInvocationAttempt2, wrapInvocationModel, AgentModelCapabilitySchema2, AgentModelDescriptorSchema2, AgentModelRegistrySnapshotSchema2, AgentModelPriceSchema2, AgentModelMetricSchema2, AgentModelPopularitySchema2, AgentModelCatalogEntrySchema2, AgentModelCatalogSchema2, AgentModelSelectionSchema2, AgentModelSearchInputSchema2, AgentModelSearchResultSchema2, searchAgentModelCatalog2, createMemoryAgentModelSelectionStore2, defineModelRegistry2, validateAgentModelSnapshot2 };
|