@harrylabsj/kiwi-merchant-cloud 0.12.4 → 0.12.5
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/app/a2a/node.d.ts +5 -1
- package/app/a2a/node.js +68 -30
- package/app/a2a/node.js.map +1 -1
- package/app/a2a/server/merchant-handler.d.ts +4 -0
- package/app/a2a/server/merchant-handler.js +123 -45
- package/app/a2a/server/merchant-handler.js.map +1 -1
- package/app/a2a/server/merchant-product-facts.d.ts +32 -0
- package/app/a2a/server/merchant-product-facts.js +57 -0
- package/app/a2a/server/merchant-product-facts.js.map +1 -0
- package/app/agent/buyer/buyer-tools.js +285 -3
- package/app/agent/buyer/buyer-tools.js.map +1 -1
- package/app/agent/merchant/types.d.ts +4 -9
- package/app/agent/merchant/types.js +14 -0
- package/app/agent/merchant/types.js.map +1 -1
- package/app/buyer-core/a2a-knp.d.ts +1 -0
- package/app/buyer-core/a2a-knp.js +1 -1
- package/app/buyer-core/a2a-knp.js.map +1 -1
- package/app/buyer-core/a2a-negotiator.d.ts +2 -0
- package/app/buyer-core/a2a-negotiator.js +20 -19
- package/app/buyer-core/a2a-negotiator.js.map +1 -1
- package/app/buyer-core/a2a-quote-fetcher.d.ts +2 -0
- package/app/buyer-core/a2a-quote-fetcher.js +13 -5
- package/app/buyer-core/a2a-quote-fetcher.js.map +1 -1
- package/app/buyer-core/product-summary.d.ts +4 -0
- package/app/buyer-core/product-summary.js +6 -0
- package/app/buyer-core/product-summary.js.map +1 -1
- package/app/buyer-core/protocol-recovery.d.ts +12 -1
- package/app/buyer-core/protocol-recovery.js +59 -19
- package/app/buyer-core/protocol-recovery.js.map +1 -1
- package/app/buyer-core/receive-gate.d.ts +11 -0
- package/app/buyer-core/receive-gate.js +107 -0
- package/app/buyer-core/receive-gate.js.map +1 -0
- package/app/cloud/bootstrap.d.ts +4 -0
- package/app/cloud/bootstrap.js +69 -55
- package/app/cloud/bootstrap.js.map +1 -1
- package/app/cloud/file-listing-publication.js +6 -0
- package/app/cloud/file-listing-publication.js.map +1 -1
- package/app/cloud/main.d.ts +3 -0
- package/app/cloud/main.js +47 -11
- package/app/cloud/main.js.map +1 -1
- package/app/cloud/product-import-tabular.d.ts +1 -1
- package/app/cloud/product-import-tabular.js +263 -36
- package/app/cloud/product-import-tabular.js.map +1 -1
- package/app/cloud/product-source.d.ts +6 -1
- package/app/cloud/product-source.js +47 -15
- package/app/cloud/product-source.js.map +1 -1
- package/app/cloud-sample/products.json +3 -3
- package/app/commerce/data-source.d.ts +4 -0
- package/app/commerce/data-source.js.map +1 -1
- package/app/commerce/shopping-cli-source.js +4 -0
- package/app/commerce/shopping-cli-source.js.map +1 -1
- package/app/discovery/catalog-source/kiwi-source.d.ts +2 -0
- package/app/discovery/catalog-source/kiwi-source.js +4 -0
- package/app/discovery/catalog-source/kiwi-source.js.map +1 -1
- package/app/handoff/index.d.ts +2 -1
- package/app/handoff/index.js +1 -0
- package/app/handoff/index.js.map +1 -1
- package/app/handoff/launch-marketplace-policy.d.ts +149 -0
- package/app/handoff/launch-marketplace-policy.js +301 -0
- package/app/handoff/launch-marketplace-policy.js.map +1 -0
- package/app/handoff/marketplace-product-link.d.ts +18 -0
- package/app/handoff/marketplace-product-link.js +71 -0
- package/app/handoff/marketplace-product-link.js.map +1 -0
- package/app/handoff/transaction.d.ts +30 -0
- package/app/handoff/transaction.js +64 -0
- package/app/handoff/transaction.js.map +1 -1
- package/app/handoff/url-safety.d.ts +3 -0
- package/app/handoff/url-safety.js +4 -0
- package/app/handoff/url-safety.js.map +1 -1
- package/app/http/merchant-management/page.js +176 -45
- package/app/http/merchant-management/page.js.map +1 -1
- package/app/i18n.d.ts +1 -0
- package/app/i18n.js +3 -0
- package/app/i18n.js.map +1 -1
- package/app/lifecycle/close.d.ts +24 -0
- package/app/lifecycle/close.js +131 -0
- package/app/lifecycle/close.js.map +1 -0
- package/app/mcp/merchant-runtime-assembly.js +6 -4
- package/app/mcp/merchant-runtime-assembly.js.map +1 -1
- package/app/mcp/tools.js +17 -16
- package/app/mcp/tools.js.map +1 -1
- package/app/merchant/application/service.d.ts +4 -0
- package/app/merchant/application/service.js.map +1 -1
- package/app/merchant/stats-store.d.ts +3 -0
- package/app/merchant/stats-store.js +15 -1
- package/app/merchant/stats-store.js.map +1 -1
- package/app/merchant-core/rfq/data-source-adapter.d.ts +2 -10
- package/app/merchant-core/rfq/data-source-adapter.js +21 -9
- package/app/merchant-core/rfq/data-source-adapter.js.map +1 -1
- package/app/merchant-gateway/pinned-fetch.js +5 -2
- package/app/merchant-gateway/pinned-fetch.js.map +1 -1
- package/build-manifest.json +2901 -1966
- package/node_modules/@earendil-works/chord/CHANGELOG.md +20 -0
- package/node_modules/@earendil-works/chord/README.md +77 -194
- package/node_modules/@earendil-works/chord/dist/cell.d.ts +101 -0
- package/node_modules/@earendil-works/chord/dist/cell.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/cell.js +316 -0
- package/node_modules/@earendil-works/chord/dist/cell.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/cluster.d.ts +26 -0
- package/node_modules/@earendil-works/chord/dist/cluster.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/cluster.js +214 -0
- package/node_modules/@earendil-works/chord/dist/cluster.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/connection.d.ts +157 -0
- package/node_modules/@earendil-works/chord/dist/connection.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/connection.js +757 -0
- package/node_modules/@earendil-works/chord/dist/connection.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/context/index.d.ts +12 -1
- package/node_modules/@earendil-works/chord/dist/context/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/chord/dist/context/index.js.map +1 -1
- package/node_modules/@earendil-works/chord/dist/contract.d.ts +133 -0
- package/node_modules/@earendil-works/chord/dist/contract.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/contract.js +157 -0
- package/node_modules/@earendil-works/chord/dist/contract.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/declare.d.ts +70 -0
- package/node_modules/@earendil-works/chord/dist/declare.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/declare.js +22 -0
- package/node_modules/@earendil-works/chord/dist/declare.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/delta/apply-immutable-trusted.js.map +1 -1
- package/node_modules/@earendil-works/chord/dist/delta/diff.d.ts +1 -1
- package/node_modules/@earendil-works/chord/dist/delta/diff.d.ts.map +1 -1
- package/node_modules/@earendil-works/chord/dist/delta/diff.js.map +1 -1
- package/node_modules/@earendil-works/chord/dist/delta/index.d.ts +2 -2
- package/node_modules/@earendil-works/chord/dist/delta/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/chord/dist/delta/index.js +41 -0
- package/node_modules/@earendil-works/chord/dist/delta/index.js.map +1 -1
- package/node_modules/@earendil-works/chord/dist/delta/revision-validator.d.ts +1 -1
- package/node_modules/@earendil-works/chord/dist/delta/revision-validator.d.ts.map +1 -1
- package/node_modules/@earendil-works/chord/dist/delta/revision-validator.js.map +1 -1
- package/node_modules/@earendil-works/chord/dist/delta/tracker.d.ts +1 -1
- package/node_modules/@earendil-works/chord/dist/delta/tracker.d.ts.map +1 -1
- package/node_modules/@earendil-works/chord/dist/delta/tracker.js +40 -4
- package/node_modules/@earendil-works/chord/dist/delta/tracker.js.map +1 -1
- package/node_modules/@earendil-works/chord/dist/errors.d.ts +27 -0
- package/node_modules/@earendil-works/chord/dist/errors.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/errors.js +44 -0
- package/node_modules/@earendil-works/chord/dist/errors.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/host.d.ts +254 -0
- package/node_modules/@earendil-works/chord/dist/host.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/host.js +795 -0
- package/node_modules/@earendil-works/chord/dist/host.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/index.d.ts +17 -10
- package/node_modules/@earendil-works/chord/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/chord/dist/index.js +8 -8
- package/node_modules/@earendil-works/chord/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/chord/dist/json.d.ts +9 -1
- package/node_modules/@earendil-works/chord/dist/json.d.ts.map +1 -1
- package/node_modules/@earendil-works/chord/dist/json.js.map +1 -1
- package/node_modules/@earendil-works/chord/dist/link.d.ts +72 -0
- package/node_modules/@earendil-works/chord/dist/link.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/link.js +169 -0
- package/node_modules/@earendil-works/chord/dist/link.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/loader.d.ts +4 -0
- package/node_modules/@earendil-works/chord/dist/loader.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/loader.js +68 -0
- package/node_modules/@earendil-works/chord/dist/loader.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/manager.d.ts +115 -0
- package/node_modules/@earendil-works/chord/dist/manager.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/manager.js +319 -0
- package/node_modules/@earendil-works/chord/dist/manager.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/node.d.ts +3 -4
- package/node_modules/@earendil-works/chord/dist/node.d.ts.map +1 -1
- package/node_modules/@earendil-works/chord/dist/node.js +3 -2
- package/node_modules/@earendil-works/chord/dist/node.js.map +1 -1
- package/node_modules/@earendil-works/chord/dist/publish.d.ts +5 -0
- package/node_modules/@earendil-works/chord/dist/publish.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/publish.js +40 -0
- package/node_modules/@earendil-works/chord/dist/publish.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/record.d.ts +320 -0
- package/node_modules/@earendil-works/chord/dist/record.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/record.js +1292 -0
- package/node_modules/@earendil-works/chord/dist/record.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/registry.d.ts +25 -0
- package/node_modules/@earendil-works/chord/dist/registry.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/registry.js +6 -0
- package/node_modules/@earendil-works/chord/dist/registry.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/reload.d.ts +118 -0
- package/node_modules/@earendil-works/chord/dist/reload.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/reload.js +589 -0
- package/node_modules/@earendil-works/chord/dist/reload.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/remote.d.ts +70 -0
- package/node_modules/@earendil-works/chord/dist/remote.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/remote.js +308 -0
- package/node_modules/@earendil-works/chord/dist/remote.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/schema.d.ts +21 -0
- package/node_modules/@earendil-works/chord/dist/schema.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/schema.js +228 -0
- package/node_modules/@earendil-works/chord/dist/schema.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/state.d.ts +92 -0
- package/node_modules/@earendil-works/chord/dist/state.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/{services/state.js → state.js} +28 -138
- package/node_modules/@earendil-works/chord/dist/state.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/types.d.ts +62 -262
- package/node_modules/@earendil-works/chord/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/chord/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/chord/dist/websocket.d.ts +16 -0
- package/node_modules/@earendil-works/chord/dist/websocket.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/websocket.js +15 -0
- package/node_modules/@earendil-works/chord/dist/websocket.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/wire.d.ts +135 -0
- package/node_modules/@earendil-works/chord/dist/wire.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/wire.js +112 -0
- package/node_modules/@earendil-works/chord/dist/wire.js.map +1 -0
- package/node_modules/@earendil-works/chord/docs/guide.md +750 -0
- package/node_modules/@earendil-works/chord/docs/spec.md +261 -0
- package/node_modules/@earendil-works/chord/docs/tutorial.md +909 -0
- package/node_modules/@earendil-works/chord/package.json +10 -11
- package/node_modules/@earendil-works/chord/src/delta/README.md +5 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +9 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +2 -5
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +2 -14
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/README.md +14 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +63 -22
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-config.d.ts +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-config.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-config.js +76 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-config.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts +3 -6
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +2 -74
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +33 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.d.ts +21 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.js +98 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/lazy.js +4 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/lazy.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +31 -14
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +7 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.js +162 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.lazy.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.lazy.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.lazy.js +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.lazy.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.d.ts +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js +5 -89
- package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js +14 -6
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-chatgpt.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-chatgpt.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js +4 -4
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +16 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +51 -27
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +5 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +5 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +4 -4
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +4 -4
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js +7 -8
- package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure.js +46 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure.models.d.ts +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure.models.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure.models.js +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure.models.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.d.ts +338 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js +375 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/meta.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +25 -8
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.d.ts +91 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js +55 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai.js +12 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.d.ts +40 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.js +41 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts +11 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +52 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/radius.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/radius.js +4 -12
- package/node_modules/@earendil-works/pi-ai/dist/providers/radius.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +22 -305
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +10 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +25 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.d.ts +3 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +8 -2
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-codemode/README.md +177 -11
- package/node_modules/@earendil-works/pi-codemode/dist/cloudflare.d.ts +53 -0
- package/node_modules/@earendil-works/pi-codemode/dist/cloudflare.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-codemode/dist/cloudflare.js +64 -0
- package/node_modules/@earendil-works/pi-codemode/dist/cloudflare.js.map +1 -0
- package/node_modules/@earendil-works/pi-codemode/dist/declarations.d.ts +6 -21
- package/node_modules/@earendil-works/pi-codemode/dist/declarations.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/declarations.js +113 -127
- package/node_modules/@earendil-works/pi-codemode/dist/declarations.js.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/index.d.ts +5 -2
- package/node_modules/@earendil-works/pi-codemode/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/index.js +4 -1
- package/node_modules/@earendil-works/pi-codemode/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/portable.d.ts +15 -0
- package/node_modules/@earendil-works/pi-codemode/dist/portable.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-codemode/dist/portable.js +12 -0
- package/node_modules/@earendil-works/pi-codemode/dist/portable.js.map +1 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.d.ts +66 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.js +494 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.js.map +1 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.d.ts +8 -30
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.js +41 -283
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.js.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.d.ts +63 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.js +80 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.js.map +1 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.d.ts +9 -3
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js +122 -12
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.d.ts +47 -6
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.js +6 -1
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.js.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.d.ts +102 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.js +175 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.js.map +1 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.d.ts +24 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.js +293 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.js.map +1 -0
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/worker.js +11 -110
- package/node_modules/@earendil-works/pi-codemode/dist/runtime/worker.js.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/source.d.ts +2 -1
- package/node_modules/@earendil-works/pi-codemode/dist/source.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/source.js +8 -2
- package/node_modules/@earendil-works/pi-codemode/dist/source.js.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/types.d.ts +101 -6
- package/node_modules/@earendil-works/pi-codemode/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-codemode/package.json +15 -3
- package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +165 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic-messages-Q7SXESRX.js +6 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/azure-openai-responses-LM52U7CK.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/bedrock-converse-stream.js +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-22CYIUS4.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-3ZATHNCK.js +9 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-5GTPJSRI.js +7 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-6MWTY2OB.js +130 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-2KAZSACP.js → chunk-AKJ3ZOR3.js} +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-G7EDXK4D.js → chunk-CQ3XTLTY.js} +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-SYF2TF6W.js → chunk-D7PHKNBM.js} +29 -92
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-DOST5PQW.js +82 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-DVQEBGVL.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-ZSI3BL5Q.js → chunk-GDR5JFDJ.js} +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-HACVPRBJ.js +11 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-ITZNWD4K.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-LD2P6SFZ.js → chunk-PMRZO46Y.js} +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-ZSBPJAJ2.js → chunk-TJXZSVTD.js} +116 -99
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-BYB6ZAAQ.js → chunk-TN4NLWHF.js} +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-WBQBCFWG.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-WJUNYZC5.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-XIX7LUWI.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-ZBURYEWF.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{cli-KILDDGW3.js → cli-SWM4FQ6V.js} +4 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/cloudflare-workers-ai-system-one-UTBL2KOF.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/codemode-worker.js +117 -14
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/easter-egg-3d-OX6RUCIS.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/execute-3CFUPDLS.js +499 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/github-copilot.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{google-generative-ai-ZOK6CV7D.js → google-generative-ai-DXKP72HC.js} +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{google-vertex-VKWZQ3AY.js → google-vertex-W6SIDOVV.js} +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{llama-cpp-classify-XT44PI3C.js → llama-cpp-classify-FYN623RH.js} +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/mistral-conversations-GBMHTSYF.js +5 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-chatgpt.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex-responses-RN6B5UPP.js +10 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openai-completions-GWHGMQ3T.js → openai-completions-QW2B4SML.js} +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-decisions-WVPMQ4JD.js +5 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openai-responses-EZ7FJ2KL.js → openai-responses-KDJUSIU7.js} +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openrouter-images-ZVXWCSIM.js → openrouter-images-DUPG5DZO.js} +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{pi-messages-TM5SOOIW.js → pi-messages-YHKPQIHC.js} +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/runtime-366HE7CW.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/typesafe-system-one-ZSK3RN4B.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/virtual-modules-GI6FRNLG.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli-runtime.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/index.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts +2 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js +24 -5
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.d.ts +18 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +44 -6
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts +47 -5
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +148 -78
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +20 -13
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.js +42 -52
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/bug-report.d.ts +9 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/bug-report.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.d.ts +6 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js +7 -8
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/tool-renderer.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/tool-renderer.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts +4 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js +2 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts +44 -7
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.d.ts +6 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.js +16 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.js.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings-schema.d.ts +4 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings-schema.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings-schema.js +16 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings-schema.js.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts +198 -66
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.js +26 -23
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.d.ts +8 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.js +30 -7
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.d.ts +695 -74
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.js +16 -166
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js +13 -7
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/nested-tool-calls.d.ts +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/nested-tool-calls.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/nested-tool-calls.js +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/nested-tool-calls.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +3 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.js +2 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.d.ts +12 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.js +82 -24
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts +3 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js +9 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.d.ts +13 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +19 -6
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.d.ts +65 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.js +66 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.js.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.d.ts +15 -145
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +85 -57
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-schema.d.ts +228 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-schema.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-schema.js +287 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-schema.js.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.d.ts +4 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js +6 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.d.ts +6 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +9 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.js +4 -10
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts +13 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +18 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.d.ts +18 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.js +46 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/bash.js +7 -35
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/bash.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/edit.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/edit.js +5 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/edit.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.js +165 -48
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/index.js +3 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.d.ts +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.js +9 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.d.ts +15 -14
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.js +58 -38
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.js +34 -11
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.js +22 -31
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/index.js +188 -84
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.d.ts +5 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.js +36 -10
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.d.ts +3 -10
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.js +4 -5
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.d.ts +7 -7
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.js +26 -44
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.d.ts +4 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.js +68 -16
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/ui.d.ts +3 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/ui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/ui.js +10 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/ui.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.d.ts +0 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.js +2 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +4 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/main.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts +5 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +17 -14
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +2 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js +5 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +2 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +5 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.d.ts +3 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.js +8 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.js +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +4 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +5 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.d.ts +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.js +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +5 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +10 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +9 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +103 -40
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/program-status-reporter.d.ts +34 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/program-status-reporter.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/program-status-reporter.js +110 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/program-status-reporter.js.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/dark.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/light.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js +105 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-tokens.js +94 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +13 -16
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +22 -29
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.js +4 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +24 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.d.ts +8 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.js +30 -11
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.js +18 -12
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.d.ts +12 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js +5 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js +3 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js +9 -10
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/output-files.d.ts +15 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/output-files.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/output-files.js +30 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/output-files.js.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.js +6 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/docs/cli-integration.md +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/docs/cli.md +19 -7
- package/node_modules/@earendil-works/pi-coding-agent/docs/codemode.md +30 -9
- package/node_modules/@earendil-works/pi-coding-agent/docs/compaction.md +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/docs/environment-variables.md +3 -1
- package/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +7 -4
- package/node_modules/@earendil-works/pi-coding-agent/docs/json.md +3 -3
- package/node_modules/@earendil-works/pi-coding-agent/docs/keybindings.md +5 -4
- package/node_modules/@earendil-works/pi-coding-agent/docs/llama-cpp.md +8 -1
- package/node_modules/@earendil-works/pi-coding-agent/docs/mcp.md +4 -2
- package/node_modules/@earendil-works/pi-coding-agent/docs/message-types.md +22 -4
- package/node_modules/@earendil-works/pi-coding-agent/docs/models.md +5 -1
- package/node_modules/@earendil-works/pi-coding-agent/docs/providers.md +47 -0
- package/node_modules/@earendil-works/pi-coding-agent/docs/settings.md +6 -4
- package/node_modules/@earendil-works/pi-coding-agent/docs/terminal-setup.md +14 -0
- package/node_modules/@earendil-works/pi-coding-agent/docs/themes.md +4 -2
- package/node_modules/@earendil-works/pi-coding-agent/docs/tui.md +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/README.md +0 -3
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package-lock.json +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/overlay-test.ts +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/plan-mode/index.ts +6 -2
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package-lock.json +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package-lock.json +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/package.json +10 -21
- package/node_modules/@earendil-works/pi-coding-agent/schemas/keybindings.schema.json +393 -0
- package/node_modules/@earendil-works/pi-coding-agent/schemas/models.schema.json +1157 -0
- package/node_modules/@earendil-works/pi-coding-agent/schemas/settings.schema.json +765 -0
- package/node_modules/@earendil-works/pi-coding-agent/schemas/theme.schema.json +365 -0
- package/node_modules/@earendil-works/pi-durable/CHANGELOG.md +114 -0
- package/node_modules/@earendil-works/pi-durable/README.md +164 -12
- package/node_modules/@earendil-works/pi-durable/dist/codemode/codemode.d.ts +173 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/codemode.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/codemode.js +886 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/codemode.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/describe.d.ts +38 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/describe.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/describe.js +119 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/describe.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/index.d.ts +3 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/index.js +3 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/models.d.ts +28 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/models.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/models.js +231 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/models.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/output.d.ts +41 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/output.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/output.js +167 -0
- package/node_modules/@earendil-works/pi-durable/dist/codemode/output.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/decode.d.ts +16 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/decode.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/decode.js +28 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/decode.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/index.d.ts +197 -3
- package/node_modules/@earendil-works/pi-durable/dist/env/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/env/index.js +2 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/env/line-scan.d.ts +13 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/line-scan.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/line-scan.js +147 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/line-scan.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/node-watch.d.ts +29 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/node-watch.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/node-watch.js +485 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/node-watch.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/env/node.d.ts +11 -2
- package/node_modules/@earendil-works/pi-durable/dist/env/node.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/env/node.js +284 -21
- package/node_modules/@earendil-works/pi-durable/dist/env/node.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/errors.d.ts +20 -3
- package/node_modules/@earendil-works/pi-durable/dist/errors.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/errors.js +34 -5
- package/node_modules/@earendil-works/pi-durable/dist/errors.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/agent.d.ts +7 -3
- package/node_modules/@earendil-works/pi-durable/dist/harness/agent.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/agent.js +81 -25
- package/node_modules/@earendil-works/pi-durable/dist/harness/agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/compaction.d.ts +6 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/compaction.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/compaction.js +11 -8
- package/node_modules/@earendil-works/pi-durable/dist/harness/compaction.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/context.d.ts +29 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/context.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/context.js +125 -24
- package/node_modules/@earendil-works/pi-durable/dist/harness/context.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/events.d.ts +35 -15
- package/node_modules/@earendil-works/pi-durable/dist/harness/events.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/events.js +77 -23
- package/node_modules/@earendil-works/pi-durable/dist/harness/events.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/generation.d.ts +2 -0
- package/node_modules/@earendil-works/pi-durable/dist/harness/generation.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/generation.js +40 -16
- package/node_modules/@earendil-works/pi-durable/dist/harness/generation.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/harness.d.ts +7 -0
- package/node_modules/@earendil-works/pi-durable/dist/harness/harness.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/harness.js +56 -28
- package/node_modules/@earendil-works/pi-durable/dist/harness/harness.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/inbox.d.ts +16 -4
- package/node_modules/@earendil-works/pi-durable/dist/harness/inbox.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/inbox.js +26 -3
- package/node_modules/@earendil-works/pi-durable/dist/harness/inbox.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/live.d.ts +74 -17
- package/node_modules/@earendil-works/pi-durable/dist/harness/live.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/live.js +66 -14
- package/node_modules/@earendil-works/pi-durable/dist/harness/live.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/output.d.ts +13 -6
- package/node_modules/@earendil-works/pi-durable/dist/harness/output.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/output.js +75 -18
- package/node_modules/@earendil-works/pi-durable/dist/harness/output.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/scheduler.d.ts +18 -5
- package/node_modules/@earendil-works/pi-durable/dist/harness/scheduler.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/scheduler.js +794 -168
- package/node_modules/@earendil-works/pi-durable/dist/harness/scheduler.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/submissions.d.ts +7 -4
- package/node_modules/@earendil-works/pi-durable/dist/harness/submissions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/submissions.js +32 -13
- package/node_modules/@earendil-works/pi-durable/dist/harness/submissions.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/task-graph.d.ts +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/task-graph.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/task-graph.js +15 -10
- package/node_modules/@earendil-works/pi-durable/dist/harness/task-graph.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/tool.d.ts +45 -5
- package/node_modules/@earendil-works/pi-durable/dist/harness/tool.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/tool.js +400 -67
- package/node_modules/@earendil-works/pi-durable/dist/harness/tool.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/types.d.ts +194 -17
- package/node_modules/@earendil-works/pi-durable/dist/harness/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/util.d.ts +6 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/util.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/util.js +5 -2
- package/node_modules/@earendil-works/pi-durable/dist/harness/util.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/view.d.ts +6 -2
- package/node_modules/@earendil-works/pi-durable/dist/harness/view.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/harness/view.js +22 -12
- package/node_modules/@earendil-works/pi-durable/dist/harness/view.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/images/cloudflare.d.ts +4 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/cloudflare.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/cloudflare.js +9 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/cloudflare.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/exif.d.ts +3 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/exif.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/exif.js +71 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/exif.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/index.d.ts +18 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/index.js +125 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/node-worker.d.ts +17 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/node-worker.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/node-worker.js +16 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/node-worker.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/node.d.ts +21 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/node.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/node.js +121 -0
- package/node_modules/@earendil-works/pi-durable/dist/images/node.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/index.d.ts +7 -7
- package/node_modules/@earendil-works/pi-durable/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/index.js +4 -4
- package/node_modules/@earendil-works/pi-durable/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/search.d.ts +13 -0
- package/node_modules/@earendil-works/pi-durable/dist/search.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/search.js +85 -0
- package/node_modules/@earendil-works/pi-durable/dist/search.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/session/observation.d.ts +10 -3
- package/node_modules/@earendil-works/pi-durable/dist/session/observation.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/session/observation.js +24 -34
- package/node_modules/@earendil-works/pi-durable/dist/session/observation.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/session/session.d.ts +71 -6
- package/node_modules/@earendil-works/pi-durable/dist/session/session.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/session/session.js +463 -50
- package/node_modules/@earendil-works/pi-durable/dist/session/session.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/session/transaction.d.ts +2 -0
- package/node_modules/@earendil-works/pi-durable/dist/session/transaction.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/session/transaction.js +19 -1
- package/node_modules/@earendil-works/pi-durable/dist/session/transaction.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/storage/jsonl/storage.d.ts +8 -0
- package/node_modules/@earendil-works/pi-durable/dist/storage/jsonl/storage.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/storage/jsonl/storage.js +2 -1
- package/node_modules/@earendil-works/pi-durable/dist/storage/jsonl/storage.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/storage/memory.d.ts +2 -0
- package/node_modules/@earendil-works/pi-durable/dist/storage/memory.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/storage/memory.js +79 -27
- package/node_modules/@earendil-works/pi-durable/dist/storage/memory.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/storage/scan.d.ts +18 -0
- package/node_modules/@earendil-works/pi-durable/dist/storage/scan.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/storage/scan.js +29 -0
- package/node_modules/@earendil-works/pi-durable/dist/storage/scan.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/cloudflare.d.ts +46 -0
- package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/cloudflare.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/cloudflare.js +106 -0
- package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/cloudflare.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/storage.d.ts +2 -0
- package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/storage.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/storage.js +77 -27
- package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/storage.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/testing/env-conformance.d.ts +7 -0
- package/node_modules/@earendil-works/pi-durable/dist/testing/env-conformance.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/testing/env-conformance.js +531 -0
- package/node_modules/@earendil-works/pi-durable/dist/testing/env-conformance.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/testing/index.d.ts +3 -2
- package/node_modules/@earendil-works/pi-durable/dist/testing/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/testing/index.js +2 -1
- package/node_modules/@earendil-works/pi-durable/dist/testing/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/testing/runner.d.ts +4 -2
- package/node_modules/@earendil-works/pi-durable/dist/testing/runner.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/testing/runner.js +9 -0
- package/node_modules/@earendil-works/pi-durable/dist/testing/runner.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/testing/storage-conformance.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/testing/storage-conformance.js +61 -2
- package/node_modules/@earendil-works/pi-durable/dist/testing/storage-conformance.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/testing/types.d.ts +20 -0
- package/node_modules/@earendil-works/pi-durable/dist/testing/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/testing/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/tool-search/index.d.ts +2 -0
- package/node_modules/@earendil-works/pi-durable/dist/tool-search/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/tool-search/index.js +2 -0
- package/node_modules/@earendil-works/pi-durable/dist/tool-search/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/tool-search/tool-search.d.ts +23 -0
- package/node_modules/@earendil-works/pi-durable/dist/tool-search/tool-search.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/tool-search/tool-search.js +84 -0
- package/node_modules/@earendil-works/pi-durable/dist/tool-search/tool-search.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/tools/bash.d.ts +30 -3
- package/node_modules/@earendil-works/pi-durable/dist/tools/bash.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/tools/bash.js +105 -37
- package/node_modules/@earendil-works/pi-durable/dist/tools/bash.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/tools/edit.js +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/tools/edit.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/tools/image-processor.d.ts +47 -0
- package/node_modules/@earendil-works/pi-durable/dist/tools/image-processor.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/tools/image-processor.js +30 -0
- package/node_modules/@earendil-works/pi-durable/dist/tools/image-processor.js.map +1 -0
- package/node_modules/@earendil-works/pi-durable/dist/tools/image.d.ts +18 -0
- package/node_modules/@earendil-works/pi-durable/dist/tools/image.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/tools/image.js +86 -0
- package/node_modules/@earendil-works/pi-durable/dist/tools/image.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/tools/index.d.ts +26 -3
- package/node_modules/@earendil-works/pi-durable/dist/tools/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/tools/index.js +14 -6
- package/node_modules/@earendil-works/pi-durable/dist/tools/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/tools/read.d.ts +10 -2
- package/node_modules/@earendil-works/pi-durable/dist/tools/read.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/tools/read.js +212 -78
- package/node_modules/@earendil-works/pi-durable/dist/tools/read.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/tools/write.js +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/tools/write.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/truncate.d.ts +9 -0
- package/node_modules/@earendil-works/pi-durable/dist/truncate.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/truncate.js +12 -4
- package/node_modules/@earendil-works/pi-durable/dist/truncate.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/types.d.ts +89 -12
- package/node_modules/@earendil-works/pi-durable/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-durable/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-durable/package.json +50 -5
- package/node_modules/@earendil-works/pi-mcp/CHANGELOG.md +29 -0
- package/node_modules/@earendil-works/pi-mcp/dist/auth-provider.d.ts +4 -0
- package/node_modules/@earendil-works/pi-mcp/dist/auth-provider.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/auth-provider.js.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/client.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/client.js +9 -5
- package/node_modules/@earendil-works/pi-mcp/dist/client.js.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/discovery.d.ts +3 -0
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/discovery.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/discovery.js +8 -5
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/discovery.js.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.d.ts +3 -2
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.js +3 -1
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.js.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.d.ts +4 -0
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.js +35 -7
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.js.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/types.d.ts +5 -0
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/oauth/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/protocol/content.d.ts +2 -1
- package/node_modules/@earendil-works/pi-mcp/dist/protocol/content.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/protocol/content.js.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.d.ts +9 -2
- package/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.js +28 -19
- package/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.js.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/transports/transport.d.ts +9 -1
- package/node_modules/@earendil-works/pi-mcp/dist/transports/transport.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/dist/transports/transport.js.map +1 -1
- package/node_modules/@earendil-works/pi-mcp/package.json +2 -2
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/README.md +5 -3
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js +4 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +3 -3
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js +4 -4
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/text.js +4 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +2 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +3 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +4 -4
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +4 -4
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/keys.js +52 -20
- package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/program-status.d.ts +23 -0
- package/node_modules/@earendil-works/pi-tui/dist/program-status.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/program-status.js +43 -0
- package/node_modules/@earendil-works/pi-tui/dist/program-status.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +4 -2
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +36 -1
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +5 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +17 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +46 -2
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +2 -0
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +8 -4
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js +2 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +11 -0
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +23 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +5 -2
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/node_modules/@silvia-odwyer/photon/LICENSE.md +201 -0
- package/node_modules/@silvia-odwyer/photon/README.md +158 -0
- package/node_modules/@silvia-odwyer/photon/package.json +23 -0
- package/node_modules/@silvia-odwyer/photon/photon_rs.d.ts +3443 -0
- package/node_modules/@silvia-odwyer/photon/photon_rs.js +4572 -0
- package/node_modules/@silvia-odwyer/photon/photon_rs_bg.wasm +0 -0
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@types/node/dgram.d.ts +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/util.d.ts +6 -3
- package/node_modules/@types/node/zlib.d.ts +6 -0
- package/package.json +7 -8
- package/runtime-package.json +7 -9
- package/scripts/check-install-toolchain.mjs +64 -40
- package/shipping-sbom.cdx.json +126 -160
- package/shipping-source.json +15 -15
- package/node_modules/@earendil-works/chord/dist/api.d.ts +0 -20
- package/node_modules/@earendil-works/chord/dist/api.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/api.js +0 -77
- package/node_modules/@earendil-works/chord/dist/api.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/bundler.d.ts +0 -6
- package/node_modules/@earendil-works/chord/dist/bundler.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/bundler.js +0 -3
- package/node_modules/@earendil-works/chord/dist/bundler.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/facets/host.d.ts +0 -12
- package/node_modules/@earendil-works/chord/dist/facets/host.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/facets/host.js +0 -763
- package/node_modules/@earendil-works/chord/dist/facets/host.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/facets/loader.d.ts +0 -3
- package/node_modules/@earendil-works/chord/dist/facets/loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/facets/loader.js +0 -5
- package/node_modules/@earendil-works/chord/dist/facets/loader.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts +0 -30
- package/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/bundle-loader.js +0 -377
- package/node_modules/@earendil-works/chord/dist/node/bundle-loader.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/bundle.d.ts +0 -26
- package/node_modules/@earendil-works/chord/dist/node/bundle.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/bundle.js +0 -183
- package/node_modules/@earendil-works/chord/dist/node/bundle.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/manifest.d.ts +0 -36
- package/node_modules/@earendil-works/chord/dist/node/manifest.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/manifest.js +0 -6
- package/node_modules/@earendil-works/chord/dist/node/manifest.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/package.d.ts +0 -15
- package/node_modules/@earendil-works/chord/dist/node/package.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/package.js +0 -199
- package/node_modules/@earendil-works/chord/dist/node/package.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/consumer.d.ts +0 -11
- package/node_modules/@earendil-works/chord/dist/services/consumer.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/consumer.js +0 -585
- package/node_modules/@earendil-works/chord/dist/services/consumer.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/errors.d.ts +0 -8
- package/node_modules/@earendil-works/chord/dist/services/errors.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/errors.js +0 -22
- package/node_modules/@earendil-works/chord/dist/services/errors.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/handle.d.ts +0 -15
- package/node_modules/@earendil-works/chord/dist/services/handle.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/handle.js +0 -101
- package/node_modules/@earendil-works/chord/dist/services/handle.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/instances.d.ts +0 -26
- package/node_modules/@earendil-works/chord/dist/services/instances.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/instances.js +0 -140
- package/node_modules/@earendil-works/chord/dist/services/instances.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/loopback.d.ts +0 -5
- package/node_modules/@earendil-works/chord/dist/services/loopback.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/loopback.js +0 -15
- package/node_modules/@earendil-works/chord/dist/services/loopback.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/provider.d.ts +0 -37
- package/node_modules/@earendil-works/chord/dist/services/provider.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/provider.js +0 -521
- package/node_modules/@earendil-works/chord/dist/services/provider.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts +0 -15
- package/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/state-codec.js +0 -133
- package/node_modules/@earendil-works/chord/dist/services/state-codec.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts +0 -13
- package/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/state-internals.js +0 -10
- package/node_modules/@earendil-works/chord/dist/services/state-internals.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/state.d.ts +0 -28
- package/node_modules/@earendil-works/chord/dist/services/state.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/state.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/wire.d.ts +0 -63
- package/node_modules/@earendil-works/chord/dist/services/wire.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/wire.js +0 -186
- package/node_modules/@earendil-works/chord/dist/services/wire.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts +0 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +0 -14
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts +0 -6
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +0 -8
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +0 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic-messages-MVG2FL56.js +0 -6
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/azure-openai-responses-7AMFUIWJ.js +0 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-6FX7UEPL.js +0 -132
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-7JGR3GZN.js +0 -11
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-A3JYRWB6.js +0 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-IKZJX7ZT.js +0 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-OSKPX3Z5.js +0 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-OYBSLV7Y.js +0 -16
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-PDFMCAOZ.js +0 -19
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-U7B62NSC.js +0 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-VIV3CWXG.js +0 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-WCQZGZ6I.js +0 -82
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/cloudflare-workers-ai-system-one-X5PVWWYJ.js +0 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/easter-egg-3d-T5FFWIBR.js +0 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/execute-RYVK27GT.js +0 -388
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/mistral-conversations-7DAUEE4N.js +0 -5
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex-responses-TC3OK7B4.js +0 -10
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/runtime-D5I2NTIF.js +0 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/typesafe-system-one-A4CZTQWZ.js +0 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/virtual-modules-KVWJD3T3.js +0 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-json.d.ts +0 -85
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-json.js +0 -132
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-json.js.map +0 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -361
- package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/README.md +0 -38
- package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/package.json +0 -10
- package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
- package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/src/session.ts +0 -24
- package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
- package/node_modules/@esbuild/linux-x64/README.md +0 -3
- package/node_modules/@esbuild/linux-x64/bin/esbuild +0 -0
- package/node_modules/@esbuild/linux-x64/package.json +0 -20
- package/node_modules/esbuild/LICENSE.md +0 -21
- package/node_modules/esbuild/README.md +0 -3
- package/node_modules/esbuild/bin/esbuild +0 -223
- package/node_modules/esbuild/install.js +0 -300
- package/node_modules/esbuild/lib/main.d.ts +0 -720
- package/node_modules/esbuild/lib/main.js +0 -2536
- package/node_modules/esbuild/package.json +0 -74
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/session/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAW,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAEN,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AA4BzC,OAAO,EACN,oBAAoB,EACpB,cAAc,EAEd,qBAAqB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAuB,WAAW,EAA+C,MAA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ext, withoutAbortSignal } from \"@earendil-works/chord/context\";\nimport { type Op, track } from \"@earendil-works/chord/delta\";\nimport {\n\ttype AnyDocToken,\n\tcheckRecordScope,\n\tcheckRecordVersion,\n\tmaterializeDocument,\n\tresolveAddress,\n} from \"../documents.ts\";\nimport { StorageRejected } from \"../errors.ts\";\nimport { idFromNumber } from \"../ids.ts\";\nimport type {\n\tCommitChange,\n\tCommitPublication,\n\tConversationDocFamilyToken,\n\tConversationDocToken,\n\tConversationId,\n\tConversationRecord,\n\tDocumentAddress,\n\tDocumentCommitChange,\n\tDocumentRecord,\n\tDocumentState,\n\tDocumentWatch,\n\tEntryId,\n\tJsonObject,\n\tRewindableConversationDocFamilyToken,\n\tRewindableConversationDocToken,\n\tSeq,\n\tSession,\n\tSessionDocFamilyToken,\n\tSessionDocToken,\n\tStorage,\n\tStorageWrite,\n\tTaskDocFamilyToken,\n\tTaskDocToken,\n\tTaskId,\n\tTx,\n} from \"../types.ts\";\nimport {\n\tCommittedStateSource,\n\tCommittedWatch,\n\ttype ObservedDocumentValue,\n\tRETIREMENT_OPERATIONS,\n} from \"./observation.ts\";\nimport { type LoadedDocument, Transaction, type TransactionHost, type TransactionScope } from \"./transaction.ts\";\n\n/** Open a Session kernel over one storage backend. */\nexport function createSession(storage: Storage): Session {\n\treturn new SessionImpl(storage);\n}\n\n/**\n * Session kernel: one mutation line, the loaded document tracker cache, and committed publication.\n *\n * Only committed state is observable. Every commit callback, preparation, Storage settlement, adoption, and\n * publication enqueue runs while the line is held; listeners run later.\n */\nexport class SessionImpl implements Session {\n\treadonly #storage: Storage;\n\treadonly #documents = new Map<string, LoadedDocument>();\n\treadonly #commitListeners = new Set<(publication: CommitPublication, context: Context) => void>();\n\treadonly #closeListeners = new Set<() => void>();\n\treadonly #host: TransactionHost;\n\t#tail: Promise<void> = Promise.resolve();\n\t#closing: Promise<void> | undefined;\n\t#poison: { readonly error: unknown } | undefined;\n\n\tconstructor(storage: Storage) {\n\t\tthis.#storage = storage;\n\t\tthis.#host = {\n\t\t\tstorage,\n\t\t\tcached: (id) => this.#documents.get(id),\n\t\t\tload: (definition, addressId, address, context) => this.#loadDocument(definition, addressId, address, context),\n\t\t\tinstall: (document) => {\n\t\t\t\tthis.#documents.set(document.addressId, document);\n\t\t\t},\n\t\t\tevict: (id, recordId) => {\n\t\t\t\tif (this.#documents.get(id)?.record.id === recordId) this.#documents.delete(id);\n\t\t\t},\n\t\t\tconversationCreated: (tx, record) => this.conversationCreated(tx, record),\n\t\t};\n\t}\n\n\tcommit<T>(change: (tx: Tx) => T | Promise<T>, context: Context): Promise<T> {\n\t\treturn this.commitWith(change, context);\n\t}\n\n\t/**\n\t * Internal commit exposing the concrete transaction and its internal operations, such as the reserved-ID root\n\t * bootstrap and task replacement. `scope` sets the default `tx.createTask()` conversation and the task attributed to\n\t * appended entries.\n\t */\n\tcommitWith<T>(change: (tx: Transaction) => T | Promise<T>, context: Context, scope?: TransactionScope): Promise<T> {\n\t\ttry {\n\t\t\tthis.#assertUsable();\n\t\t} catch (error) {\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t\treturn this.#enqueue(() => this.#runCommit(change, context, scope));\n\t}\n\n\t/** Internal: run a read-only job on the mutation line so multi-read derivations observe one committed state. */\n\treadOnLine<T>(job: () => Promise<T>): Promise<T> {\n\t\ttry {\n\t\t\tthis.#assertUsable();\n\t\t} catch (error) {\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t\treturn this.#enqueue(async () => {\n\t\t\tthis.#assertHealthy();\n\t\t\treturn job();\n\t\t});\n\t}\n\n\t/**\n\t * Internal: a conversation document's current incarnation and value, for a job already running on the line (see\n\t * `readOnLine()`). Absent documents are `undefined`.\n\t */\n\tasync conversationDocumentOnLine(\n\t\ttoken: ConversationDocToken<JsonObject>,\n\t\tconversationId: ConversationId,\n\t\tcontext: Context,\n\t): Promise<{ readonly record: DocumentRecord; readonly version: number; readonly value: JsonObject } | undefined> {\n\t\tconst definition = token.definition;\n\t\tconst resolved = resolveAddress(definition, [conversationId, context]);\n\t\tconst loaded = await this.#loadDocument(definition, resolved.id, resolved.address, context);\n\t\tif (loaded === undefined) return undefined;\n\t\tcheckRecordScope(definition, loaded.record);\n\t\tcheckRecordVersion(definition, loaded.record, loaded.storedVersion);\n\t\treturn { record: loaded.record, version: loaded.valueVersion, value: loaded.tracker.value };\n\t}\n\n\tsnapshot<T extends JsonObject>(token: SessionDocToken<T>, context: Context): Promise<Readonly<T> | undefined>;\n\tsnapshot<T extends JsonObject>(\n\t\ttoken: ConversationDocToken<T>,\n\t\tconversationId: ConversationId,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tsnapshot<T extends JsonObject>(\n\t\ttoken: TaskDocToken<T>,\n\t\ttaskId: TaskId,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tsnapshot<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: SessionDocFamilyToken<T, I>,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tsnapshot<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: ConversationDocFamilyToken<T, I>,\n\t\tconversationId: ConversationId,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tsnapshot<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: TaskDocFamilyToken<T, I>,\n\t\ttaskId: TaskId,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tasync snapshot(token: AnyDocToken, ...args: readonly unknown[]): Promise<JsonObject | undefined> {\n\t\tthis.#assertUsable();\n\t\tconst definition = token.definition;\n\t\tconst resolved = resolveAddress(definition, args);\n\t\tconst context = args[resolved.nextArgument] as Context;\n\t\tconst cached = this.#documents.get(resolved.id);\n\t\tconst loaded =\n\t\t\tcached?.valueVersion === definition.version\n\t\t\t\t? cached\n\t\t\t\t: await this.#enqueue(async () => {\n\t\t\t\t\t\tthis.#assertHealthy();\n\t\t\t\t\t\treturn this.#loadDocument(definition, resolved.id, resolved.address, context);\n\t\t\t\t\t});\n\t\tif (loaded === undefined) return undefined;\n\t\tcheckRecordScope(definition, loaded.record);\n\t\tcheckRecordVersion(definition, loaded.record, loaded.storedVersion);\n\t\treturn loaded.tracker.value;\n\t}\n\n\tdocumentState<T extends JsonObject>(\n\t\ttoken: SessionDocToken<T>,\n\t\tcontext: Context,\n\t): Promise<DocumentState<T> | undefined>;\n\tdocumentState<T extends JsonObject>(\n\t\ttoken: ConversationDocToken<T>,\n\t\tconversationId: ConversationId,\n\t\tcontext: Context,\n\t): Promise<DocumentState<T> | undefined>;\n\tdocumentState<T extends JsonObject>(\n\t\ttoken: TaskDocToken<T>,\n\t\ttaskId: TaskId,\n\t\tcontext: Context,\n\t): Promise<DocumentState<T> | undefined>;\n\tdocumentState<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: SessionDocFamilyToken<T, I>,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<DocumentState<T> | undefined>;\n\tdocumentState<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: ConversationDocFamilyToken<T, I>,\n\t\tconversationId: ConversationId,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<DocumentState<T> | undefined>;\n\tdocumentState<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: TaskDocFamilyToken<T, I>,\n\t\ttaskId: TaskId,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<DocumentState<T> | undefined>;\n\tdocumentState(token: AnyDocToken, ...args: readonly unknown[]): Promise<DocumentState<JsonObject> | undefined> {\n\t\ttry {\n\t\t\tthis.#assertUsable();\n\t\t\tconst definition = token.definition;\n\t\t\tconst resolved = resolveAddress(definition, args);\n\t\t\tconst context = args[resolved.nextArgument] as Context;\n\t\t\treturn this.#enqueue(async () => {\n\t\t\t\tthis.#assertHealthy();\n\t\t\t\tconst loaded = await this.#loadDocument(definition, resolved.id, resolved.address, context);\n\t\t\t\tif (loaded === undefined) return undefined;\n\t\t\t\tconst { observer: source, detach } = this.#attachDocument(\n\t\t\t\t\tdefinition,\n\t\t\t\t\tloaded,\n\t\t\t\t\t(value, release) => new CommittedStateSource<ObservedDocumentValue>(value, release),\n\t\t\t\t);\n\t\t\t\ttry {\n\t\t\t\t\treturn replicatedState(source) as DocumentState<JsonObject>;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tdetach();\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (error) {\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t}\n\n\twatchDoc<T extends JsonObject>(token: SessionDocToken<T>, context: Context): Promise<DocumentWatch<T> | undefined>;\n\twatchDoc<T extends JsonObject>(\n\t\ttoken: ConversationDocToken<T>,\n\t\tconversationId: ConversationId,\n\t\tcontext: Context,\n\t): Promise<DocumentWatch<T> | undefined>;\n\twatchDoc<T extends JsonObject>(\n\t\ttoken: TaskDocToken<T>,\n\t\ttaskId: TaskId,\n\t\tcontext: Context,\n\t): Promise<DocumentWatch<T> | undefined>;\n\twatchDoc<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: SessionDocFamilyToken<T, I>,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<DocumentWatch<T> | undefined>;\n\twatchDoc<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: ConversationDocFamilyToken<T, I>,\n\t\tconversationId: ConversationId,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<DocumentWatch<T> | undefined>;\n\twatchDoc<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: TaskDocFamilyToken<T, I>,\n\t\ttaskId: TaskId,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<DocumentWatch<T> | undefined>;\n\tasync watchDoc(token: AnyDocToken, ...args: readonly unknown[]): Promise<DocumentWatch<JsonObject> | undefined> {\n\t\tthis.#assertUsable();\n\t\tconst definition = token.definition;\n\t\tconst resolved = resolveAddress(definition, args);\n\t\tconst context = args[resolved.nextArgument] as Context;\n\t\tconst signal = context.abortSignal;\n\t\tlet cancelled = signal?.aborted ?? false;\n\t\tconst markCancelled = (): void => {\n\t\t\tcancelled = true;\n\t\t};\n\t\tsignal?.addEventListener(\"abort\", markCancelled, { once: true });\n\t\ttry {\n\t\t\tconst watch = await this.#enqueue(async () => {\n\t\t\t\tthis.#assertHealthy();\n\t\t\t\tif (cancelled) throw cancellationError(signal!);\n\t\t\t\tconst loaded = await this.#loadDocument(definition, resolved.id, resolved.address, context);\n\t\t\t\tif (cancelled) throw cancellationError(signal!);\n\t\t\t\tif (loaded === undefined) return undefined;\n\t\t\t\treturn this.#attachDocument(\n\t\t\t\t\tdefinition,\n\t\t\t\t\tloaded,\n\t\t\t\t\t(value, release) => new CommittedWatch<ObservedDocumentValue>(value, release),\n\t\t\t\t).observer;\n\t\t\t});\n\t\t\tif (watch === undefined) return undefined;\n\t\t\tif (cancelled) {\n\t\t\t\twatch.cancel();\n\t\t\t\tthrow cancellationError(signal!);\n\t\t\t}\n\t\t\tif (signal !== undefined) watch.observeCancellation(signal);\n\t\t\treturn watch as DocumentWatch<JsonObject>;\n\t\t} finally {\n\t\t\tsignal?.removeEventListener(\"abort\", markCancelled);\n\t\t}\n\t}\n\n\tsnapshotAsOf<T extends JsonObject>(\n\t\ttoken: RewindableConversationDocToken<T>,\n\t\tconversationId: ConversationId,\n\t\tat: EntryId,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tsnapshotAsOf<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: RewindableConversationDocFamilyToken<T, I>,\n\t\tconversationId: ConversationId,\n\t\tkey: string,\n\t\tat: EntryId,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tasync snapshotAsOf(token: AnyDocToken, ...args: readonly unknown[]): Promise<JsonObject | undefined> {\n\t\tthis.#assertUsable();\n\t\tconst definition = token.definition;\n\t\tconst resolved = resolveAddress(definition, args);\n\t\tif (resolved.address.scope.kind !== \"conversation\") {\n\t\t\tthrow new TypeError(\"Session.snapshotAsOf() requires a conversation document\");\n\t\t}\n\t\tconst conversationId = resolved.address.scope.conversationId;\n\t\tconst atValue = args[resolved.nextArgument];\n\t\tif (typeof atValue !== \"number\" || !Number.isSafeInteger(atValue)) {\n\t\t\tthrow new TypeError(\"Session.snapshotAsOf() requires an entry ID\");\n\t\t}\n\t\tconst at = idFromNumber<EntryId>(atValue);\n\t\tconst context = args[resolved.nextArgument + 1] as Context;\n\t\treturn this.#enqueue(async () => {\n\t\t\tthis.#assertHealthy();\n\t\t\tconst storedEntry = await this.#storage.entry(conversationId, at, context);\n\t\t\tif (storedEntry === undefined) {\n\t\t\t\tthrow new Error(`Entry ${at} is not visible from conversation ${conversationId}`);\n\t\t\t}\n\t\t\tconst address: DocumentAddress = {\n\t\t\t\t...resolved.address,\n\t\t\t\tscope: { kind: \"conversation\", conversationId: storedEntry.entry.conversationId },\n\t\t\t};\n\t\t\tconst record = await this.#storage.findDocument(address, storedEntry.commitSeq, context);\n\t\t\tif (record === undefined) return undefined;\n\t\t\tconst stored = await this.#storage.document(record.id, storedEntry.commitSeq, context);\n\t\t\tif (stored === undefined) {\n\t\t\t\tthrow new Error(`Historical document ${record.id} (${record.kind}) cannot be read`);\n\t\t\t}\n\t\t\treturn materializeDocument(definition, stored);\n\t\t});\n\t}\n\n\tclose(context: Context): Promise<void> {\n\t\tif (this.#closing === undefined) {\n\t\t\tconst cleanup = withoutAbortSignal(context);\n\t\t\t// Seal admission before anything else runs, then stop observers; admitted work settles before Storage closes.\n\t\t\tthis.#closing = Promise.resolve()\n\t\t\t\t.then(() => this.beforeClose())\n\t\t\t\t.then(() =>\n\t\t\t\t\tthis.#enqueue(async () => {\n\t\t\t\t\t\tthis.#commitListeners.clear();\n\t\t\t\t\t\tthis.#documents.clear();\n\t\t\t\t\t\tawait this.#storage.close(cleanup);\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\tconst listeners = [...this.#closeListeners];\n\t\t\tthis.#closeListeners.clear();\n\t\t\tfor (const listener of listeners) listener();\n\t\t}\n\t\treturn awaitWithContext(this.#closing, context);\n\t}\n\n\t/**\n\t * Runs inside every transaction that creates or forks a conversation, after the conversation record is staged. A\n\t * plain Session stages nothing; a Harness stages its built-in documents.\n\t */\n\tprotected conversationCreated(_tx: Transaction, _record: ConversationRecord): Promise<void> {\n\t\treturn Promise.resolve();\n\t}\n\n\t/** Runs after close seals admission and before the line closes Storage; must not reject. */\n\tprotected beforeClose(): Promise<void> {\n\t\treturn Promise.resolve();\n\t}\n\n\t/** Register a synchronous post-adoption listener. It must not throw, block, or call Session operations. */\n\tsubscribeCommits(listener: (publication: CommitPublication, context: Context) => void): () => void {\n\t\tthis.#assertUsable();\n\t\tthis.#commitListeners.add(listener);\n\t\treturn () => this.#commitListeners.delete(listener);\n\t}\n\n\t/** Register a listener called synchronously when close begins. It must not throw, block, or call Session operations. */\n\tsubscribeClose(listener: () => void): () => void {\n\t\tthis.#assertUsable();\n\t\tthis.#closeListeners.add(listener);\n\t\treturn () => this.#closeListeners.delete(listener);\n\t}\n\n\t/** Drop every loaded tracker on the mutation line; later access cold-loads from Storage. */\n\tunloadDocuments(): Promise<void> {\n\t\treturn this.#enqueue(async () => {\n\t\t\tthis.#documents.clear();\n\t\t});\n\t}\n\n\tasync #runCommit<T>(\n\t\tchange: (tx: Transaction) => T | Promise<T>,\n\t\tcontext: Context,\n\t\tscope?: TransactionScope,\n\t): Promise<T> {\n\t\tthis.#assertHealthy();\n\t\tcontext.abortSignal?.throwIfAborted();\n\t\tconst tx = new Transaction(this.#host, context, scope);\n\t\tlet result: T;\n\t\ttry {\n\t\t\tresult = await change(tx);\n\t\t} catch (error) {\n\t\t\tawait tx.settleFailure();\n\t\t\tthrow error;\n\t\t}\n\t\tconst writes = await tx.settleSuccess();\n\t\tif (writes.length === 0) {\n\t\t\ttx.discard();\n\t\t\treturn result;\n\t\t}\n\t\tlet seq: Seq;\n\t\ttry {\n\t\t\t// Once admitted, caller cancellation does not interrupt Storage settlement.\n\t\t\tseq = await this.#storage.commit(writes, withoutAbortSignal(context));\n\t\t} catch (error) {\n\t\t\ttx.discard();\n\t\t\t// Callback errors never reach this branch; StorageRejected alone guarantees that no batch effect committed.\n\t\t\tif (!(error instanceof StorageRejected)) this.#poison = { error };\n\t\t\tthrow error;\n\t\t}\n\t\tlet documents: DocumentCommitChange[];\n\t\ttry {\n\t\t\tdocuments = tx.adopt(seq);\n\t\t} catch (error) {\n\t\t\t// Storage already committed; a failed adoption leaves memory behind durable state.\n\t\t\tthis.#poison = { error };\n\t\t\tthrow error;\n\t\t}\n\t\tthis.#publish(seq, writes, documents, context);\n\t\treturn result;\n\t}\n\n\t#publish(\n\t\tseq: Seq,\n\t\twrites: readonly StorageWrite[],\n\t\tdocuments: readonly DocumentCommitChange[],\n\t\tcontext: Context,\n\t): void {\n\t\tif (this.#commitListeners.size === 0) return;\n\t\tconst changes: CommitChange[] = [];\n\t\tfor (const write of writes) {\n\t\t\tswitch (write.type) {\n\t\t\t\tcase \"conversation\":\n\t\t\t\tcase \"entry\":\n\t\t\t\tcase \"task\":\n\t\t\t\tcase \"submission\":\n\t\t\t\t\tchanges.push(write);\n\t\t\t}\n\t\t}\n\t\tfor (const document of documents) changes.push(document);\n\t\tconst publication: CommitPublication = { seq, changes };\n\t\tfor (const listener of [...this.#commitListeners]) listener(publication, context);\n\t}\n\n\t/**\n\t * Attach an observer to one committed incarnation: check the definition, then forward this incarnation's committed\n\t * changes and close. `detach` removes both subscriptions.\n\t */\n\t#attachDocument<O extends CommittedStateSource | CommittedWatch>(\n\t\tdefinition: AnyDocToken[\"definition\"],\n\t\tloaded: LoadedDocument,\n\t\tcreate: (value: JsonObject, detach: () => void) => O,\n\t): { observer: O; detach: () => void } {\n\t\tcheckRecordScope(definition, loaded.record);\n\t\tcheckRecordVersion(definition, loaded.record, loaded.storedVersion);\n\t\tlet unsubscribeCommit = (): void => {};\n\t\tlet unsubscribeClose = (): void => {};\n\t\tconst detach = (): void => {\n\t\t\tunsubscribeCommit();\n\t\t\tunsubscribeClose();\n\t\t};\n\t\tconst observer = create(loaded.tracker.value, detach);\n\t\tconst observed = { version: loaded.valueVersion };\n\t\tunsubscribeCommit = this.subscribeCommits((publication, context) => {\n\t\t\tfor (const change of publication.changes) {\n\t\t\t\tif (change.type !== \"document\" || change.record.id !== loaded.record.id) continue;\n\t\t\t\t// A document state's frames carry no caller cancellation; a watch observes its own cancellation.\n\t\t\t\tconst frameContext = observer instanceof CommittedStateSource ? withoutAbortSignal(context) : context;\n\t\t\t\tconst ops = observedOperations(observed, change);\n\t\t\t\t// A migration-only base changes nothing for an observer of the new version.\n\t\t\t\tif (ops.length === 0) continue;\n\t\t\t\tobserver.advance(change.value, ops, frameContext);\n\t\t\t}\n\t\t});\n\t\tunsubscribeClose = this.subscribeClose(() => observer.closeSession());\n\t\treturn { observer, detach };\n\t}\n\n\tasync #loadDocument(\n\t\tdefinition: AnyDocToken[\"definition\"],\n\t\taddressId: string,\n\t\taddress: DocumentAddress,\n\t\tcontext: Context,\n\t): Promise<LoadedDocument | undefined> {\n\t\tconst cached = this.#documents.get(addressId);\n\t\t// A tracker serves only tokens of the version its value was materialized for; others reload from Storage.\n\t\tif (cached?.valueVersion === definition.version) return cached;\n\t\tif (cached !== undefined) this.#documents.delete(addressId);\n\t\tconst record = await this.#storage.findDocument(address, \"current\", context);\n\t\tif (record === undefined) return undefined;\n\t\tconst stored = await this.#storage.document(record.id, \"current\", context);\n\t\tif (stored === undefined) throw new Error(`Current document ${record.id} (${record.kind}) cannot be read`);\n\t\tconst value = materializeDocument(definition, stored);\n\t\tconst loaded: LoadedDocument = {\n\t\t\taddressId,\n\t\t\trecord: stored.record,\n\t\t\tstoredVersion: stored.version,\n\t\t\tvalueVersion: definition.version,\n\t\t\tdeltasSinceBase: stored.deltasSinceBase,\n\t\t\ttracker: track(value),\n\t\t};\n\t\tthis.#documents.set(addressId, loaded);\n\t\treturn loaded;\n\t}\n\n\t#enqueue<T>(job: () => Promise<T>): Promise<T> {\n\t\tconst run = this.#tail.then(job);\n\t\tthis.#tail = run.then(\n\t\t\t() => undefined,\n\t\t\t() => undefined,\n\t\t);\n\t\treturn run;\n\t}\n\n\t#assertUsable(): void {\n\t\tif (this.#closing !== undefined) throw new Error(\"Session is closed\");\n\t\tthis.#assertHealthy();\n\t}\n\n\t#assertHealthy(): void {\n\t\tif (this.#poison !== undefined) {\n\t\t\tthrow new Error(\"Session is poisoned by a failed commit after storage admission; reopen it\", {\n\t\t\t\tcause: this.#poison.error,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * Operations an observer applies for one committed change. An observer hydrated under another definition version holds\n * a differently shaped value, so it receives the new value as a root replacement instead of operations for that shape.\n */\nfunction observedOperations(\n\tobserved: { version: number },\n\tchange: Extract<DocumentCommitChange, { readonly type: \"document\" }>,\n): readonly Op[] {\n\tif (change.value === null) return RETIREMENT_OPERATIONS;\n\tif (change.version === observed.version) return change.ops;\n\tobserved.version = change.version!;\n\treturn [[\"r\", change.value]];\n}\n\nfunction cancellationError(signal: AbortSignal): Error {\n\treturn signal.reason instanceof Error ? signal.reason : new DOMException(\"The operation was aborted\", \"AbortError\");\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/session/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACzG,OAAO,EAAW,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAEN,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AA4CzC,OAAO,EACN,oBAAoB,EACpB,cAA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G;YACzG,MAAM,MAAM,GACX,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,YAAY,mBAAmB,IAAI,IAAI,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC,CAAC;YACpG,IAAI,CAAC,MAAM;gBAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrC,MAAM,KAAK,CAAC;QACb,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC;IACf,CAAC;IAED,cAAc;QACb,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QACpC,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,IAAI,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnE,CAAC;CACD","sourcesContent":["import { type Context, type JsonValue, replicatedState } from \"@earendil-works/chord\";\nimport { awaitWithContext, BACKGROUND_CONTEXT, withoutAbortSignal } from \"@earendil-works/chord/context\";\nimport { type Op, track } from \"@earendil-works/chord/delta\";\nimport {\n\ttype AnyDocToken,\n\taddressId,\n\tcheckRecordScope,\n\tcheckRecordVersion,\n\tmaterializeDocument,\n\tresolveAddress,\n} from \"../documents.ts\";\nimport { SessionFailed, StorageRequestError } from \"../errors.ts\";\nimport { idFromNumber } from \"../ids.ts\";\nimport type {\n\tCommitChange,\n\tCommitPublication,\n\tConversationDocFamilyToken,\n\tConversationDocToken,\n\tConversationId,\n\tConversationQuery,\n\tConversationRecord,\n\tCursor,\n\tDocumentAddress,\n\tDocumentCommitChange,\n\tDocumentId,\n\tDocumentPoint,\n\tDocumentQuery,\n\tDocumentRecord,\n\tDocumentState,\n\tDocumentWatch,\n\tEntryId,\n\tEntryQuery,\n\tEntryRecord,\n\tId,\n\tJsonObject,\n\tPage,\n\tRewindableConversationDocFamilyToken,\n\tRewindableConversationDocToken,\n\tSeq,\n\tSession,\n\tSessionDocFamilyToken,\n\tSessionDocToken,\n\tSessionEnd,\n\tStorage,\n\tStorageWrite,\n\tStoredDocument,\n\tSubmissionId,\n\tSubmissionQuery,\n\tSubmissionRecord,\n\tTaskDocFamilyToken,\n\tTaskDocToken,\n\tTaskId,\n\tTaskQuery,\n\tTaskRecord,\n\tTx,\n} from \"../types.ts\";\nimport {\n\tCommittedStateSource,\n\tCommittedWatch,\n\ttype ObservedDocumentValue,\n\tRETIREMENT_OPERATIONS,\n} from \"./observation.ts\";\nimport { type LoadedDocument, Transaction, type TransactionHost, type TransactionScope } from \"./transaction.ts\";\n\n/**\n * Open a Session kernel over one storage backend. `now` is the wall clock for task times; default `Date.now`. The first\n * error a Storage method throws fails the Session (`SessionFailed`); see `SessionImpl`.\n */\nexport function createSession(\n\tstorage: Storage,\n\toptions?: { readonly now?: () => number; readonly documentRetentionMs?: number },\n): Session {\n\tconst retention = options?.documentRetentionMs;\n\treturn new SessionImpl(storage, options?.now, retention === undefined ? undefined : () => retention);\n}\n\n/** Default document retention: ten minutes, as for kept contexts. */\nlet defaultRetention = 600_000;\n\n/** Internal, for tests: the retention of every Session that keeps the default, as a suite run with eviction at once. */\nexport function setDefaultDocumentRetention(ms: number): void {\n\tdefaultRetention = ms;\n}\n\n/**\n * A retention as given, when it is a number of milliseconds, `0` or more (`Infinity` keeps documents); otherwise the\n * default.\n */\nexport function documentRetention(ms: number | undefined): number {\n\treturn typeof ms === \"number\" && ms >= 0 ? ms : defaultRetention;\n}\n\n/** Longest delay `setTimeout` supports; a longer retention waits in several steps. */\nconst MAX_TIMER_DELAY = 2_147_483_647;\n\n/**\n * Session kernel: one mutation line, the loaded document tracker cache, and committed publication.\n *\n * The cache is bounded by use: a document with no watch or document state attached leaves it once it was not read or\n * written for the retention period, and the next access loads it from Storage. Eviction runs as a job on the mutation\n * line, so no transaction ever holds a tracker that leaves.\n *\n * Only committed state is observable. Every commit callback, preparation, Storage settlement, adoption, and\n * publication enqueue runs while the line is held; listeners run later.\n *\n * Storage failures are final. Every Storage call goes through one guard: the first error a Storage method throws, other\n * than for a cancelled caller, fails the Session, as does a commit it cannot adopt. That call gets the error; every later\n * call and every Storage call still underway gets `SessionFailed`; close listeners run at once with the error, and the\n * Session then closes itself, Storage included, and `closed` settles. Nothing retries: transient errors are the\n * Storage's to retry. Reopening recovers from what was committed.\n */\nexport class SessionImpl implements Session {\n\treadonly #storage: Storage;\n\treadonly #documents = new Map<string, LoadedDocument>();\n\t/** Cached documents with no observer attached, by address, oldest use first, with the time of that use. */\n\treadonly #idleDocuments = new Map<string, number>();\n\t/** Observers attached per document incarnation (record ID); a cached incarnation with any is never evicted. */\n\treadonly #attachedDocuments = new Map<DocumentId, number>();\n\treadonly #clock: () => number;\n\treadonly #documentRetentionMs: () => number;\n\t/** The pending eviction: a timer for the oldest idle document, or a line job when the retention is 0. */\n\t#documentSweep: { readonly at: number; readonly timer: ReturnType<typeof setTimeout> | undefined } | undefined;\n\t#sweepJobs = 0;\n\t/** Set once a timer could not be unreferenced: then none is kept, and the end of each commit evicts what expired. */\n\t#documentTimersUnavailable = false;\n\treadonly #commitListeners = new Set<(publication: CommitPublication, context: Context) => void>();\n\t/** The Session's own listeners, such as its scheduler's: they keep memory in step with storage, so a throw fails it. */\n\treadonly #internalListeners = new Set<(publication: CommitPublication, context: Context) => void>();\n\treadonly #closeListeners = new Set<() => void>();\n\treadonly #host: TransactionHost;\n\t#tail: Promise<void> = Promise.resolve();\n\t#closing: Promise<void> | undefined;\n\t#failure: { readonly error: unknown } | undefined;\n\t/** Set when close reaches the backend: calls that fail from then on fail because it closes. */\n\treadonly #failed = Promise.withResolvers<never>();\n\treadonly #closed = Promise.withResolvers<SessionEnd>();\n\n\tget closed(): Promise<SessionEnd> {\n\t\treturn this.#closed.promise;\n\t}\n\n\t/** Internal: the error that failed the Session, if one did. */\n\tget failure(): { readonly error: unknown } | undefined {\n\t\treturn this.#failure;\n\t}\n\n\t/** Internal: rejects with `SessionFailed` the moment the Session fails, before work underway has ended; never resolves. */\n\tget failed(): Promise<never> {\n\t\treturn this.#failed.promise;\n\t}\n\n\tconstructor(\n\t\tstorage: Storage,\n\t\tnow: () => number = Date.now,\n\t\tdocumentRetentionMs: () => number | undefined = () => undefined,\n\t) {\n\t\t// Waits race it; none has to.\n\t\tthis.#failed.promise.catch(() => {});\n\t\tthis.#storage = new GuardedStorage(storage, this);\n\t\t// Cache bookkeeping must never change the outcome of the operation it follows: a clock or a retention setting\n\t\t// that throws counts as now, and as the default.\n\t\tthis.#clock = () => {\n\t\t\ttry {\n\t\t\t\treturn now();\n\t\t\t} catch {\n\t\t\t\treturn Date.now();\n\t\t\t}\n\t\t};\n\t\tthis.#documentRetentionMs = () => {\n\t\t\ttry {\n\t\t\t\treturn documentRetention(documentRetentionMs());\n\t\t\t} catch {\n\t\t\t\treturn documentRetention(undefined);\n\t\t\t}\n\t\t};\n\t\tthis.#host = {\n\t\t\tstorage: this.#storage,\n\t\t\tnow,\n\t\t\tcached: (id) => {\n\t\t\t\tconst cached = this.#documents.get(id);\n\t\t\t\tif (cached !== undefined) this.#touchDocument(id);\n\t\t\t\treturn cached;\n\t\t\t},\n\t\t\tload: (definition, addressId, address, context) => this.#loadDocument(definition, addressId, address, context),\n\t\t\tinstall: (document) => {\n\t\t\t\tthis.#documents.set(document.addressId, document);\n\t\t\t\tthis.#touchDocument(document.addressId);\n\t\t\t},\n\t\t\tevict: (id, recordId) => {\n\t\t\t\tif (this.#documents.get(id)?.record.id === recordId) this.#dropDocument(id);\n\t\t\t},\n\t\t\tconversationCreated: (tx, record) => this.conversationCreated(tx, record),\n\t\t};\n\t}\n\n\t/** The Storage behind the failure guard; every component reads and writes through it. */\n\tprotected get storage(): Storage {\n\t\treturn this.#storage;\n\t}\n\n\tcommit<T>(change: (tx: Tx) => T | Promise<T>, context: Context): Promise<T> {\n\t\treturn this.commitWith(change, context);\n\t}\n\n\t/**\n\t * Internal: fail the Session with `error`, the first wins, and report it once. Admission ends, and close listeners run\n\t * now; they read the error from `failure`. The Storage guard calls this; the Harness also calls it for a throw in its\n\t * scheduler's own commits.\n\t */\n\tfail(error: unknown): void {\n\t\tif (this.#failure !== undefined) return;\n\t\tthis.#failure = { error };\n\t\tthis.#failed.reject(new SessionFailed(error));\n\t\t// Seal first, so a report handler that calls back finds the Session failed. Closing runs the close listeners\n\t\t// synchronously; a failing backend close is the caller's to see, and here nobody waits.\n\t\tthis.close(BACKGROUND_CONTEXT).catch(() => {});\n\t\tthis.report(error);\n\t}\n\n\t/**\n\t * Internal commit exposing the concrete transaction and its internal operations, such as the reserved-ID root\n\t * bootstrap and task replacement. `scope` sets the default `tx.createTask()` conversation and the task attributed to\n\t * appended entries.\n\t */\n\tcommitWith<T>(change: (tx: Transaction) => T | Promise<T>, context: Context, scope?: TransactionScope): Promise<T> {\n\t\ttry {\n\t\t\tthis.assertUsable();\n\t\t} catch (error) {\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t\treturn this.#enqueue(() => this.#runCommit(change, context, scope));\n\t}\n\n\t/** Internal: run a read-only job on the mutation line so multi-read derivations observe one committed state. */\n\treadOnLine<T>(job: () => Promise<T>): Promise<T> {\n\t\ttry {\n\t\t\tthis.assertUsable();\n\t\t} catch (error) {\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t\treturn this.#enqueue(async () => {\n\t\t\tthis.#assertHealthy();\n\t\t\treturn job();\n\t\t});\n\t}\n\n\t/**\n\t * Internal: a conversation document's current incarnation and value, for a job already running on the line (see\n\t * `readOnLine()`). Absent documents are `undefined`.\n\t */\n\tasync conversationDocumentOnLine(\n\t\ttoken: ConversationDocToken<JsonObject>,\n\t\tconversationId: ConversationId,\n\t\tcontext: Context,\n\t): Promise<{ readonly record: DocumentRecord; readonly version: number; readonly value: JsonObject } | undefined> {\n\t\tconst definition = token.definition;\n\t\tconst resolved = resolveAddress(definition, [conversationId, context]);\n\t\tconst loaded = await this.#loadDocument(definition, resolved.id, resolved.address, context);\n\t\tif (loaded === undefined) return undefined;\n\t\tcheckRecordScope(definition, loaded.record);\n\t\tcheckRecordVersion(definition, loaded.record, loaded.storedVersion);\n\t\treturn { record: loaded.record, version: loaded.valueVersion, value: loaded.tracker.value };\n\t}\n\n\tsnapshot<T extends JsonObject>(token: SessionDocToken<T>, context: Context): Promise<Readonly<T> | undefined>;\n\tsnapshot<T extends JsonObject>(\n\t\ttoken: ConversationDocToken<T>,\n\t\tconversationId: ConversationId,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tsnapshot<T extends JsonObject>(\n\t\ttoken: TaskDocToken<T>,\n\t\ttaskId: TaskId,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tsnapshot<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: SessionDocFamilyToken<T, I>,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tsnapshot<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: ConversationDocFamilyToken<T, I>,\n\t\tconversationId: ConversationId,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tsnapshot<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: TaskDocFamilyToken<T, I>,\n\t\ttaskId: TaskId,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tasync snapshot(token: AnyDocToken, ...args: readonly unknown[]): Promise<JsonObject | undefined> {\n\t\tthis.assertUsable();\n\t\tconst definition = token.definition;\n\t\tconst resolved = resolveAddress(definition, args);\n\t\tconst context = args[resolved.nextArgument] as Context;\n\t\tconst cached = this.#documents.get(resolved.id);\n\t\tif (cached?.valueVersion === definition.version) this.#touchDocument(resolved.id);\n\t\tconst loaded =\n\t\t\tcached?.valueVersion === definition.version\n\t\t\t\t? cached\n\t\t\t\t: await this.#enqueue(async () => {\n\t\t\t\t\t\tthis.#assertHealthy();\n\t\t\t\t\t\treturn this.#loadDocument(definition, resolved.id, resolved.address, context);\n\t\t\t\t\t});\n\t\tif (loaded === undefined) return undefined;\n\t\tcheckRecordScope(definition, loaded.record);\n\t\tcheckRecordVersion(definition, loaded.record, loaded.storedVersion);\n\t\treturn loaded.tracker.value;\n\t}\n\n\tdocumentState<T extends JsonObject>(\n\t\ttoken: SessionDocToken<T>,\n\t\tcontext: Context,\n\t): Promise<DocumentState<T> | undefined>;\n\tdocumentState<T extends JsonObject>(\n\t\ttoken: ConversationDocToken<T>,\n\t\tconversationId: ConversationId,\n\t\tcontext: Context,\n\t): Promise<DocumentState<T> | undefined>;\n\tdocumentState<T extends JsonObject>(\n\t\ttoken: TaskDocToken<T>,\n\t\ttaskId: TaskId,\n\t\tcontext: Context,\n\t): Promise<DocumentState<T> | undefined>;\n\tdocumentState<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: SessionDocFamilyToken<T, I>,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<DocumentState<T> | undefined>;\n\tdocumentState<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: ConversationDocFamilyToken<T, I>,\n\t\tconversationId: ConversationId,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<DocumentState<T> | undefined>;\n\tdocumentState<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: TaskDocFamilyToken<T, I>,\n\t\ttaskId: TaskId,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<DocumentState<T> | undefined>;\n\tdocumentState(token: AnyDocToken, ...args: readonly unknown[]): Promise<DocumentState<JsonObject> | undefined> {\n\t\ttry {\n\t\t\tthis.assertUsable();\n\t\t\tconst definition = token.definition;\n\t\t\tconst resolved = resolveAddress(definition, args);\n\t\t\tconst context = args[resolved.nextArgument] as Context;\n\t\t\treturn this.#enqueue(async () => {\n\t\t\t\tthis.#assertHealthy();\n\t\t\t\tconst loaded = await this.#loadDocument(definition, resolved.id, resolved.address, context);\n\t\t\t\tif (loaded === undefined) return undefined;\n\t\t\t\tconst { observer: source, detach } = this.#attachDocument(\n\t\t\t\t\tdefinition,\n\t\t\t\t\tloaded,\n\t\t\t\t\t(value, release) => new CommittedStateSource<ObservedDocumentValue>(value, release),\n\t\t\t\t);\n\t\t\t\ttry {\n\t\t\t\t\treturn replicatedState(source, { onError: (error) => this.report(error) }) as DocumentState<JsonObject>;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tdetach();\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (error) {\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t}\n\n\twatchDoc<T extends JsonObject>(token: SessionDocToken<T>, context: Context): Promise<DocumentWatch<T> | undefined>;\n\twatchDoc<T extends JsonObject>(\n\t\ttoken: ConversationDocToken<T>,\n\t\tconversationId: ConversationId,\n\t\tcontext: Context,\n\t): Promise<DocumentWatch<T> | undefined>;\n\twatchDoc<T extends JsonObject>(\n\t\ttoken: TaskDocToken<T>,\n\t\ttaskId: TaskId,\n\t\tcontext: Context,\n\t): Promise<DocumentWatch<T> | undefined>;\n\twatchDoc<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: SessionDocFamilyToken<T, I>,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<DocumentWatch<T> | undefined>;\n\twatchDoc<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: ConversationDocFamilyToken<T, I>,\n\t\tconversationId: ConversationId,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<DocumentWatch<T> | undefined>;\n\twatchDoc<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: TaskDocFamilyToken<T, I>,\n\t\ttaskId: TaskId,\n\t\tkey: string,\n\t\tcontext: Context,\n\t): Promise<DocumentWatch<T> | undefined>;\n\tasync watchDoc(token: AnyDocToken, ...args: readonly unknown[]): Promise<DocumentWatch<JsonObject> | undefined> {\n\t\tthis.assertUsable();\n\t\tconst definition = token.definition;\n\t\tconst resolved = resolveAddress(definition, args);\n\t\tconst context = args[resolved.nextArgument] as Context;\n\t\tconst signal = context.abortSignal;\n\t\tlet cancelled = signal?.aborted ?? false;\n\t\tconst markCancelled = (): void => {\n\t\t\tcancelled = true;\n\t\t};\n\t\tsignal?.addEventListener(\"abort\", markCancelled, { once: true });\n\t\ttry {\n\t\t\tconst watch = await this.#enqueue(async () => {\n\t\t\t\tthis.#assertHealthy();\n\t\t\t\tif (cancelled) throw cancellationError(signal!);\n\t\t\t\tconst loaded = await this.#loadDocument(definition, resolved.id, resolved.address, context);\n\t\t\t\tif (cancelled) throw cancellationError(signal!);\n\t\t\t\tif (loaded === undefined) return undefined;\n\t\t\t\treturn this.#attachDocument(\n\t\t\t\t\tdefinition,\n\t\t\t\t\tloaded,\n\t\t\t\t\t(value, release) =>\n\t\t\t\t\t\tnew CommittedWatch<ObservedDocumentValue>(value, release, (error) => this.report(error)),\n\t\t\t\t).observer;\n\t\t\t});\n\t\t\tif (watch === undefined) return undefined;\n\t\t\tif (cancelled) {\n\t\t\t\twatch.cancel();\n\t\t\t\tthrow cancellationError(signal!);\n\t\t\t}\n\t\t\tif (signal !== undefined) watch.observeCancellation(signal);\n\t\t\treturn watch as DocumentWatch<JsonObject>;\n\t\t} finally {\n\t\t\tsignal?.removeEventListener(\"abort\", markCancelled);\n\t\t}\n\t}\n\n\tsnapshotAsOf<T extends JsonObject>(\n\t\ttoken: RewindableConversationDocToken<T>,\n\t\tconversationId: ConversationId,\n\t\tat: EntryId,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tsnapshotAsOf<T extends JsonObject, I extends JsonValue>(\n\t\ttoken: RewindableConversationDocFamilyToken<T, I>,\n\t\tconversationId: ConversationId,\n\t\tkey: string,\n\t\tat: EntryId,\n\t\tcontext: Context,\n\t): Promise<Readonly<T> | undefined>;\n\tasync snapshotAsOf(token: AnyDocToken, ...args: readonly unknown[]): Promise<JsonObject | undefined> {\n\t\tthis.assertUsable();\n\t\tconst definition = token.definition;\n\t\tconst resolved = resolveAddress(definition, args);\n\t\tif (resolved.address.scope.kind !== \"conversation\") {\n\t\t\tthrow new TypeError(\"Session.snapshotAsOf() requires a conversation document\");\n\t\t}\n\t\tconst conversationId = resolved.address.scope.conversationId;\n\t\tconst atValue = args[resolved.nextArgument];\n\t\tif (typeof atValue !== \"number\" || !Number.isSafeInteger(atValue)) {\n\t\t\tthrow new TypeError(\"Session.snapshotAsOf() requires an entry ID\");\n\t\t}\n\t\tconst at = idFromNumber<EntryId>(atValue);\n\t\tconst context = args[resolved.nextArgument + 1] as Context;\n\t\treturn this.#enqueue(async () => {\n\t\t\tthis.#assertHealthy();\n\t\t\tconst storedEntry = await this.#storage.entry(conversationId, at, context);\n\t\t\tif (storedEntry === undefined) {\n\t\t\t\tthrow new Error(`Entry ${at} is not visible from conversation ${conversationId}`);\n\t\t\t}\n\t\t\tconst address: DocumentAddress = {\n\t\t\t\t...resolved.address,\n\t\t\t\tscope: { kind: \"conversation\", conversationId: storedEntry.entry.conversationId },\n\t\t\t};\n\t\t\tconst record = await this.#storage.findDocument(address, storedEntry.commitSeq, context);\n\t\t\tif (record === undefined) return undefined;\n\t\t\tconst stored = await this.#storage.document(record.id, storedEntry.commitSeq, context);\n\t\t\tif (stored === undefined) {\n\t\t\t\tthrow new Error(`Historical document ${record.id} (${record.kind}) cannot be read`);\n\t\t\t}\n\t\t\treturn materializeDocument(definition, stored);\n\t\t});\n\t}\n\n\tclose(context: Context): Promise<void> {\n\t\tif (this.#closing === undefined) {\n\t\t\tconst cleanup = withoutAbortSignal(context);\n\t\t\t// Seal admission before anything else runs, then stop observers; admitted work settles before Storage closes.\n\t\t\tthis.#closing = Promise.resolve()\n\t\t\t\t.then(() => this.beforeClose())\n\t\t\t\t.then(() =>\n\t\t\t\t\tthis.#enqueue(async () => {\n\t\t\t\t\t\tthis.#commitListeners.clear();\n\t\t\t\t\t\tthis.#internalListeners.clear();\n\t\t\t\t\t\tthis.#documents.clear();\n\t\t\t\t\t\tthis.#idleDocuments.clear();\n\t\t\t\t\t\tthis.#attachedDocuments.clear();\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait this.#storage.close(cleanup);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t// A Storage that cannot close is a failed one; an earlier failure stays the cause.\n\t\t\t\t\t\t\tif (this.#failure === undefined) {\n\t\t\t\t\t\t\t\tthis.#failure = { error };\n\t\t\t\t\t\t\t\tthis.report(error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.finally(() => {\n\t\t\t\t\tconst failure = this.#failure;\n\t\t\t\t\tthis.#closed.resolve(\n\t\t\t\t\t\tfailure === undefined ? { reason: \"closed\" } : { reason: \"failed\", error: failure.error },\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\tthis.#notifyClose();\n\t\t}\n\t\treturn awaitWithContext(this.#closing, context);\n\t}\n\n\t/** Run the close listeners once, each on its own: one that fails is reported, and the rest still run. */\n\t#notifyClose(): void {\n\t\tif (this.#documentSweep?.timer !== undefined) clearTimeout(this.#documentSweep.timer);\n\t\tthis.#documentSweep = undefined;\n\t\tconst listeners = [...this.#closeListeners];\n\t\tthis.#closeListeners.clear();\n\t\tfor (const listener of listeners) contained(listener, (error) => this.report(error));\n\t}\n\n\t/** Internal: the Session's failure, and errors of listeners, which never fail what ran them. A plain Session drops them. */\n\treport(_error: unknown): void {}\n\n\t/**\n\t * Runs inside every transaction that creates or forks a conversation, after the conversation record is staged. A\n\t * plain Session stages nothing; a Harness stages its built-in documents.\n\t */\n\tprotected conversationCreated(_tx: Transaction, _record: ConversationRecord): Promise<void> {\n\t\treturn Promise.resolve();\n\t}\n\n\t/** Runs after close seals admission and before the line closes Storage; must not reject. */\n\tprotected beforeClose(): Promise<void> {\n\t\treturn Promise.resolve();\n\t}\n\n\t/** Register a synchronous post-adoption listener. It must not block or call Session operations; a throw is reported. */\n\tsubscribeCommits(listener: (publication: CommitPublication, context: Context) => void): () => void {\n\t\tthis.assertUsable();\n\t\tthis.#commitListeners.add(listener);\n\t\treturn () => this.#commitListeners.delete(listener);\n\t}\n\n\t/**\n\t * Internal: `subscribeCommits()` for the Session's own components, whose state follows each commit. A throw leaves\n\t * that state behind storage, so it fails the Session instead of being reported. They run before host listeners.\n\t */\n\tobserveCommits(listener: (publication: CommitPublication, context: Context) => void): () => void {\n\t\tthis.assertUsable();\n\t\tthis.#internalListeners.add(listener);\n\t\treturn () => this.#internalListeners.delete(listener);\n\t}\n\n\t/**\n\t * Register a listener called synchronously when close begins, also when a failure closes the Session (`failure` is\n\t * then set). It must not block or call Session operations; a throw is reported.\n\t */\n\tsubscribeClose(listener: () => void): () => void {\n\t\tthis.assertUsable();\n\t\tthis.#closeListeners.add(listener);\n\t\treturn () => this.#closeListeners.delete(listener);\n\t}\n\n\t/** Drop every loaded tracker on the mutation line; later access cold-loads from Storage. */\n\tunloadDocuments(): Promise<void> {\n\t\treturn this.#enqueue(async () => {\n\t\t\tthis.#documents.clear();\n\t\t\tthis.#idleDocuments.clear();\n\t\t});\n\t}\n\n\t/**\n\t * Internal, for tests: how many documents the cache holds, how many are idle, how many incarnations are pinned, and how\n\t * many sweep jobs were queued on the line so far.\n\t */\n\tget documentCacheSizes(): {\n\t\treadonly cached: number;\n\t\treadonly idle: number;\n\t\treadonly attached: number;\n\t\treadonly sweeps: number;\n\t} {\n\t\treturn {\n\t\t\tcached: this.#documents.size,\n\t\t\tidle: this.#idleDocuments.size,\n\t\t\tattached: this.#attachedDocuments.size,\n\t\t\tsweeps: this.#sweepJobs,\n\t\t};\n\t}\n\n\t/** Note a use of a cached document: an unattached one becomes the newest idle one, and an eviction is scheduled. */\n\t#touchDocument(addressId: string): void {\n\t\tconst cached = this.#documents.get(addressId);\n\t\tif (cached === undefined || this.#attachedDocuments.has(cached.record.id)) return;\n\t\tconst now = this.#clock();\n\t\tconst since = this.#idleDocuments.get(addressId);\n\t\t// A hot document moves to the back at most once per granule, a tenth of the retention up to 1 s: it may then leave\n\t\t// up to a granule early, which costs a reload, while a commit-heavy workload skips the reordering.\n\t\tif (since !== undefined && now - since < Math.min(1_000, this.#documentRetentionMs() / 10)) return;\n\t\tthis.#idleDocuments.delete(addressId);\n\t\tthis.#idleDocuments.set(addressId, now);\n\t\t// A pending sweep for the oldest document comes first unless the retention was shortened since; then it moves up.\n\t\tif (this.#documentSweep === undefined || this.#documentSweep.at > now + this.#documentRetentionMs()) {\n\t\t\tthis.#scheduleDocumentSweep();\n\t\t}\n\t}\n\n\t#dropDocument(addressId: string): void {\n\t\tthis.#documents.delete(addressId);\n\t\tthis.#idleDocuments.delete(addressId);\n\t}\n\n\t/**\n\t * Schedule the eviction of the oldest idle document: on the line at once when the retention is 0, otherwise when it\n\t * expires, by a timer that never keeps the process alive. Where timers cannot be unreferenced, as in Cloudflare\n\t * Workers, none is kept: the end of each commit evicts what expired.\n\t */\n\t#scheduleDocumentSweep(): void {\n\t\tif (this.#closing !== undefined) return;\n\t\tconst oldest = this.#idleDocuments.values().next();\n\t\tif (oldest.done === true) return;\n\t\tconst at = oldest.value + this.#documentRetentionMs();\n\t\tif (this.#documentSweep !== undefined && this.#documentSweep.at <= at) return;\n\t\tif (this.#documentSweep?.timer !== undefined) clearTimeout(this.#documentSweep.timer);\n\t\t// The pending sweep stays set until its job runs, so touches while the line is busy queue no more.\n\t\tconst sweep = { at, timer: undefined as ReturnType<typeof setTimeout> | undefined };\n\t\tconst run = (): void => {\n\t\t\tthis.#sweepJobs++;\n\t\t\tthis.#enqueue(async () => {\n\t\t\t\tif (this.#documentSweep === sweep) this.#documentSweep = undefined;\n\t\t\t\tif (this.#closing === undefined) this.#sweepDocuments();\n\t\t\t}).catch(() => {});\n\t\t};\n\t\tconst delay = at - this.#clock();\n\t\tthis.#documentSweep = sweep;\n\t\tif (delay <= 0) {\n\t\t\tqueueMicrotask(run);\n\t\t\treturn;\n\t\t}\n\t\tif (this.#documentTimersUnavailable) {\n\t\t\tthis.#documentSweep = undefined;\n\t\t\treturn;\n\t\t}\n\t\tconst timer = setTimeout(run, Math.min(delay, MAX_TIMER_DELAY));\n\t\tconst unref = (timer as { unref?: unknown }).unref;\n\t\tif (typeof unref !== \"function\") {\n\t\t\tclearTimeout(timer);\n\t\t\tthis.#documentTimersUnavailable = true;\n\t\t\tthis.#documentSweep = undefined;\n\t\t\treturn;\n\t\t}\n\t\tunref.call(timer);\n\t\tsweep.timer = timer;\n\t}\n\n\t/** On the line: evict the idle documents whose retention passed, oldest first, then schedule the next eviction. */\n\t#sweepDocuments(): void {\n\t\tconst expired = this.#clock() - this.#documentRetentionMs();\n\t\tfor (const [addressId, since] of this.#idleDocuments) {\n\t\t\tif (since > expired) break;\n\t\t\tthis.#dropDocument(addressId);\n\t\t}\n\t\tthis.#scheduleDocumentSweep();\n\t}\n\n\t/** Pin a cached incarnation for one observer; the returned release unpins it once, idle again after the last. */\n\t#pinDocument(addressId: string, recordId: DocumentId): () => void {\n\t\tthis.#attachedDocuments.set(recordId, (this.#attachedDocuments.get(recordId) ?? 0) + 1);\n\t\tthis.#idleDocuments.delete(addressId);\n\t\tlet pinned = true;\n\t\treturn () => {\n\t\t\tif (!pinned) return;\n\t\t\tpinned = false;\n\t\t\tconst count = (this.#attachedDocuments.get(recordId) ?? 1) - 1;\n\t\t\tif (count > 0) {\n\t\t\t\tthis.#attachedDocuments.set(recordId, count);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.#attachedDocuments.delete(recordId);\n\t\t\tif (this.#documents.get(addressId)?.record.id === recordId) this.#touchDocument(addressId);\n\t\t};\n\t}\n\n\tasync #runCommit<T>(\n\t\tchange: (tx: Transaction) => T | Promise<T>,\n\t\tcontext: Context,\n\t\tscope?: TransactionScope,\n\t): Promise<T> {\n\t\tthis.#assertHealthy();\n\t\tcontext.abortSignal?.throwIfAborted();\n\t\tconst tx = new Transaction(this.#host, context, scope);\n\t\tlet result: T;\n\t\ttry {\n\t\t\tresult = await change(tx);\n\t\t\t// A callback that caught a failed read must not commit, nor succeed as if it had.\n\t\t\tthis.#assertHealthy();\n\t\t} catch (error) {\n\t\t\tawait tx.settleFailure();\n\t\t\tthis.#sweepDocuments();\n\t\t\tthrow error;\n\t\t}\n\t\tlet writes: readonly StorageWrite[];\n\t\ttry {\n\t\t\twrites = await tx.settleSuccess();\n\t\t} catch (error) {\n\t\t\t// Settlement aborted every change already.\n\t\t\tthis.#sweepDocuments();\n\t\t\tthrow error;\n\t\t}\n\t\tif (writes.length === 0) {\n\t\t\ttx.discard();\n\t\t\tthis.#sweepDocuments();\n\t\t\treturn result;\n\t\t}\n\t\tlet seq: Seq;\n\t\ttry {\n\t\t\t// Once admitted, caller cancellation does not interrupt Storage settlement.\n\t\t\tseq = await this.#storage.commit(writes, withoutAbortSignal(context));\n\t\t} catch (error) {\n\t\t\t// The guard has failed the Session.\n\t\t\ttx.discard();\n\t\t\tthrow error;\n\t\t}\n\t\tlet documents: DocumentCommitChange[];\n\t\ttry {\n\t\t\tdocuments = tx.adopt(seq);\n\t\t} catch (error) {\n\t\t\t// Storage already committed; a failed adoption leaves memory behind durable state.\n\t\t\tthis.fail(error);\n\t\t\tthrow error;\n\t\t}\n\t\tfor (const document of documents) this.#touchDocument(addressId(document.record));\n\t\tthis.#publish(seq, writes, documents, context);\n\t\tthis.#sweepDocuments();\n\t\treturn result;\n\t}\n\n\t#publish(\n\t\tseq: Seq,\n\t\twrites: readonly StorageWrite[],\n\t\tdocuments: readonly DocumentCommitChange[],\n\t\tcontext: Context,\n\t): void {\n\t\tif (this.#commitListeners.size === 0 && this.#internalListeners.size === 0) return;\n\t\tconst changes: CommitChange[] = [];\n\t\tfor (const write of writes) {\n\t\t\tswitch (write.type) {\n\t\t\t\tcase \"conversation\":\n\t\t\t\tcase \"entry\":\n\t\t\t\tcase \"task\":\n\t\t\t\tcase \"submission\":\n\t\t\t\t\tchanges.push(write);\n\t\t\t}\n\t\t}\n\t\tfor (const document of documents) changes.push(document);\n\t\tconst publication: CommitPublication = { seq, changes };\n\t\t// The commit is durable: a failing listener neither fails the commit nor skips the others.\n\t\tfor (const listener of [...this.#internalListeners]) {\n\t\t\tcontained(\n\t\t\t\t() => listener(publication, context),\n\t\t\t\t(error) => this.fail(error),\n\t\t\t);\n\t\t}\n\t\tfor (const listener of [...this.#commitListeners]) {\n\t\t\tcontained(\n\t\t\t\t() => listener(publication, context),\n\t\t\t\t(error) => this.report(error),\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Attach an observer to one committed incarnation: check the definition, then forward this incarnation's committed\n\t * changes and close. `detach` removes both subscriptions.\n\t */\n\t#attachDocument<O extends CommittedStateSource | CommittedWatch>(\n\t\tdefinition: AnyDocToken[\"definition\"],\n\t\tloaded: LoadedDocument,\n\t\tcreate: (value: JsonObject, detach: () => void) => O,\n\t): { observer: O; detach: () => void } {\n\t\tcheckRecordScope(definition, loaded.record);\n\t\tcheckRecordVersion(definition, loaded.record, loaded.storedVersion);\n\t\tlet unsubscribeCommit = (): void => {};\n\t\tlet unsubscribeClose = (): void => {};\n\t\t// Attached, the incarnation stays cached; once its last observer detaches, or it retires, it is idle again.\n\t\tconst unpin = this.#pinDocument(loaded.addressId, loaded.record.id);\n\t\tconst detach = (): void => {\n\t\t\tunsubscribeCommit();\n\t\t\tunsubscribeClose();\n\t\t\tunpin();\n\t\t};\n\t\tlet observer: O;\n\t\ttry {\n\t\t\tobserver = create(loaded.tracker.value, detach);\n\t\t} catch (error) {\n\t\t\tunpin();\n\t\t\tthrow error;\n\t\t}\n\t\tconst observed = { version: loaded.valueVersion };\n\t\tunsubscribeCommit = this.observeCommits((publication, context) => {\n\t\t\tfor (const change of publication.changes) {\n\t\t\t\tif (change.type !== \"document\" || change.record.id !== loaded.record.id) continue;\n\t\t\t\t// A document state's frames carry no caller cancellation; a watch observes its own cancellation.\n\t\t\t\tconst frameContext = observer instanceof CommittedStateSource ? withoutAbortSignal(context) : context;\n\t\t\t\tconst ops = observedOperations(observed, change);\n\t\t\t\t// A migration-only base changes nothing for an observer of the new version.\n\t\t\t\tif (ops.length === 0) continue;\n\t\t\t\t// A retired incarnation never changes again: its observers keep their last value but pin nothing.\n\t\t\t\tif (change.value === null) unpin();\n\t\t\t\tobserver.advance(change.value, ops, frameContext);\n\t\t\t}\n\t\t});\n\t\tunsubscribeClose = this.subscribeClose(() => observer.closeSession(this.#failure));\n\t\treturn { observer, detach };\n\t}\n\n\tasync #loadDocument(\n\t\tdefinition: AnyDocToken[\"definition\"],\n\t\taddressId: string,\n\t\taddress: DocumentAddress,\n\t\tcontext: Context,\n\t): Promise<LoadedDocument | undefined> {\n\t\tconst cached = this.#documents.get(addressId);\n\t\t// A tracker serves only tokens of the version its value was materialized for; others reload from Storage.\n\t\tif (cached?.valueVersion === definition.version) {\n\t\t\tthis.#touchDocument(addressId);\n\t\t\treturn cached;\n\t\t}\n\t\tif (cached !== undefined) this.#dropDocument(addressId);\n\t\tconst record = await this.#storage.findDocument(address, \"current\", context);\n\t\tif (record === undefined) return undefined;\n\t\tconst stored = await this.#storage.document(record.id, \"current\", context);\n\t\tif (stored === undefined) throw new Error(`Current document ${record.id} (${record.kind}) cannot be read`);\n\t\tconst value = materializeDocument(definition, stored);\n\t\tconst loaded: LoadedDocument = {\n\t\t\taddressId,\n\t\t\trecord: stored.record,\n\t\t\tstoredVersion: stored.version,\n\t\t\tvalueVersion: definition.version,\n\t\t\tdeltasSinceBase: stored.deltasSinceBase,\n\t\t\ttracker: track(value),\n\t\t};\n\t\tthis.#documents.set(addressId, loaded);\n\t\tthis.#touchDocument(addressId);\n\t\treturn loaded;\n\t}\n\n\t#enqueue<T>(job: () => Promise<T>): Promise<T> {\n\t\tconst run = this.#tail.then(job);\n\t\tthis.#tail = run.then(\n\t\t\t() => undefined,\n\t\t\t() => undefined,\n\t\t);\n\t\treturn run;\n\t}\n\n\t/** Internal: throw `SessionFailed` when failed, else an error when closing. */\n\tassertUsable(): void {\n\t\tthis.#assertHealthy();\n\t\tif (this.#closing !== undefined) throw new Error(\"Session is closed\");\n\t}\n\n\t#assertHealthy(): void {\n\t\tif (this.#failure !== undefined) throw new SessionFailed(this.#failure.error);\n\t}\n}\n\n/**\n * Run a host callback that must not fail its caller: a throw, or a promise it returns that rejects, goes to `onError`,\n * which is not awaited.\n */\nexport function contained(callback: () => unknown, onError: (error: unknown) => void): void {\n\ttry {\n\t\tconst result = callback();\n\t\t// Any thenable, also a promise from another realm; `Promise.resolve` adopts it with handlers of its own.\n\t\tif (typeof (result as { then?: unknown } | null)?.then === \"function\") Promise.resolve(result).catch(onError);\n\t} catch (error) {\n\t\tonError(error);\n\t}\n}\n\n/**\n * Operations an observer applies for one committed change. An observer hydrated under another definition version holds\n * a differently shaped value, so it receives the new value as a root replacement instead of operations for that shape.\n */\nfunction observedOperations(\n\tobserved: { version: number },\n\tchange: Extract<DocumentCommitChange, { readonly type: \"document\" }>,\n): readonly Op[] {\n\tif (change.value === null) return RETIREMENT_OPERATIONS;\n\tif (change.version === observed.version) return change.ops;\n\tobserved.version = change.version!;\n\treturn [[\"r\", change.value]];\n}\n\nfunction cancellationError(signal: AbortSignal): Error {\n\treturn signal.reason instanceof Error ? signal.reason : new DOMException(\"The operation was aborted\", \"AbortError\");\n}\n\n/** What the guard needs of its Session: the failure so far, and how to fail it. */\ntype FailureLatch = {\n\treadonly failure: { readonly error: unknown } | undefined;\n\tfail(error: unknown): void;\n};\n\n/**\n * The Session's Storage behind its failure guard; every component of the Session reads and writes through it. Before a\n * call, a failed Session gets `SessionFailed` without reaching the backend. A call that throws fails the Session and\n * rethrows the backend's error, unless it is a `StorageRequestError` or a read whose caller's context was aborted:\n * neither says the Storage is broken.\n * `close()` always reaches the backend, so a failed Session still closes it.\n */\nclass GuardedStorage implements Storage {\n\treadonly #storage: Storage;\n\treadonly #latch: FailureLatch;\n\t/** Backend calls underway, also those off the Session line, which close waits for before it closes the backend. */\n\treadonly #underway = new Set<Promise<unknown>>();\n\t#closing = false;\n\n\tconstructor(storage: Storage, latch: FailureLatch) {\n\t\tthis.#storage = storage;\n\t\tthis.#latch = latch;\n\t}\n\n\t/** Never exempt, whatever it throws: once admitted, whether a failed batch committed is unknown. */\n\tcommit(writes: readonly StorageWrite[], context: Context): Promise<Seq> {\n\t\treturn this.#call(undefined, () => this.#storage.commit(writes, context));\n\t}\n\n\tmintId<I extends Id<string>>(): Promise<I> {\n\t\treturn this.#call(undefined, () => this.#storage.mintId<I>());\n\t}\n\n\tconversation(id: ConversationId, context: Context): Promise<ConversationRecord | undefined> {\n\t\treturn this.#call(context, () => this.#storage.conversation(id, context));\n\t}\n\n\tscanConversations(\n\t\tquery: ConversationQuery,\n\t\tlimit: number,\n\t\tcursor: Cursor | undefined,\n\t\tcontext: Context,\n\t): Promise<Page<ConversationRecord, Cursor>> {\n\t\treturn this.#call(context, () => this.#storage.scanConversations(query, limit, cursor, context));\n\t}\n\n\tentry(id: EntryId, context: Context): Promise<{ readonly entry: EntryRecord; readonly commitSeq: Seq } | undefined>;\n\tentry(\n\t\tconversationId: ConversationId,\n\t\tid: EntryId,\n\t\tcontext: Context,\n\t): Promise<{ readonly entry: EntryRecord; readonly commitSeq: Seq } | undefined>;\n\tentry(\n\t\tfirst: EntryId | ConversationId,\n\t\tsecond: EntryId | Context,\n\t\tthird?: Context,\n\t): Promise<{ readonly entry: EntryRecord; readonly commitSeq: Seq } | undefined> {\n\t\tif (third === undefined) {\n\t\t\tconst context = second as Context;\n\t\t\treturn this.#call(context, () => this.#storage.entry(first as EntryId, context));\n\t\t}\n\t\treturn this.#call(third, () => this.#storage.entry(first as ConversationId, second as EntryId, third));\n\t}\n\n\tfindLatestHeadMarker(\n\t\tconversationId: ConversationId,\n\t\tatOrBeforeEntryId: EntryId | undefined,\n\t\tcontext: Context,\n\t): Promise<(EntryRecord & { readonly head: EntryId }) | undefined> {\n\t\treturn this.#call(context, () => this.#storage.findLatestHeadMarker(conversationId, atOrBeforeEntryId, context));\n\t}\n\n\tscanEntries(\n\t\tquery: EntryQuery,\n\t\tlimit: number,\n\t\tcursor: Cursor | undefined,\n\t\tcontext: Context,\n\t): Promise<Page<EntryRecord, Cursor>> {\n\t\treturn this.#call(context, () => this.#storage.scanEntries(query, limit, cursor, context));\n\t}\n\n\ttask(id: TaskId, context: Context): Promise<TaskRecord<JsonValue, JsonValue, JsonValue> | undefined> {\n\t\treturn this.#call(context, () => this.#storage.task(id, context));\n\t}\n\n\tscanTasks(\n\t\tquery: TaskQuery,\n\t\tlimit: number,\n\t\tcursor: Cursor | undefined,\n\t\tcontext: Context,\n\t): Promise<Page<TaskRecord<JsonValue, JsonValue, JsonValue>, Cursor>> {\n\t\treturn this.#call(context, () => this.#storage.scanTasks(query, limit, cursor, context));\n\t}\n\n\tsubmission(id: SubmissionId, context: Context): Promise<SubmissionRecord | undefined> {\n\t\treturn this.#call(context, () => this.#storage.submission(id, context));\n\t}\n\n\tscanSubmissions(\n\t\tquery: SubmissionQuery,\n\t\tlimit: number,\n\t\tcursor: Cursor | undefined,\n\t\tcontext: Context,\n\t): Promise<Page<SubmissionRecord, Cursor>> {\n\t\treturn this.#call(context, () => this.#storage.scanSubmissions(query, limit, cursor, context));\n\t}\n\n\tsubmissionByRequest(\n\t\tconversationId: ConversationId,\n\t\trequestId: string,\n\t\tcontext: Context,\n\t): Promise<SubmissionRecord | undefined> {\n\t\treturn this.#call(context, () => this.#storage.submissionByRequest(conversationId, requestId, context));\n\t}\n\n\tfindDocument(address: DocumentAddress, at: DocumentPoint, context: Context): Promise<DocumentRecord | undefined> {\n\t\treturn this.#call(context, () => this.#storage.findDocument(address, at, context));\n\t}\n\n\tdocument(id: DocumentId, at: DocumentPoint, context: Context): Promise<StoredDocument | undefined> {\n\t\treturn this.#call(context, () => this.#storage.document(id, at, context));\n\t}\n\n\tscanDocuments(\n\t\tquery: DocumentQuery,\n\t\tlimit: number,\n\t\tcursor: Cursor | undefined,\n\t\tcontext: Context,\n\t): Promise<Page<DocumentRecord, Cursor>> {\n\t\treturn this.#call(context, () => this.#storage.scanDocuments(query, limit, cursor, context));\n\t}\n\n\t/**\n\t * Close the backend once every call underway has settled, so none outlives it or fails after `closed` settles. New\n\t * calls are refused from here on: a paged read must not start its next page while the backend closes.\n\t */\n\tasync close(context: Context): Promise<void> {\n\t\tthis.#closing = true;\n\t\tawait Promise.allSettled([...this.#underway]);\n\t\treturn this.#storage.close(context);\n\t}\n\n\t/**\n\t * Run one backend call under the guard. `read` is a read's context; `commit()` and `mintId()` pass none, so nothing\n\t * exempts their errors: once a batch is admitted, whether it committed is unknown. A call still underway when another\n\t * fails the Session ends with `SessionFailed` too, whatever it returns: nothing it read or wrote is used.\n\t */\n\tasync #call<T>(read: Context | undefined, run: () => Promise<T>): Promise<T> {\n\t\tthis.#assertHealthy();\n\t\tif (this.#closing) throw new Error(\"Session is closed\");\n\t\tlet result: T;\n\t\t// An async wrapper, so a backend that throws synchronously is guarded too.\n\t\tconst call = (async () => run())();\n\t\tthis.#underway.add(call);\n\t\ttry {\n\t\t\tresult = await call;\n\t\t} catch (error) {\n\t\t\tthis.#assertHealthy();\n\t\t\t// An invalid read, or one its caller cancelled, says nothing about the Storage; it fails that call only.\n\t\t\tconst exempt =\n\t\t\t\tread !== undefined && (error instanceof StorageRequestError || read.abortSignal?.aborted === true);\n\t\t\tif (!exempt) this.#latch.fail(error);\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tthis.#underway.delete(call);\n\t\t}\n\t\tthis.#assertHealthy();\n\t\treturn result;\n\t}\n\n\t#assertHealthy(): void {\n\t\tconst failure = this.#latch.failure;\n\t\tif (failure !== undefined) throw new SessionFailed(failure.error);\n\t}\n}\n"]}
|
|
@@ -18,6 +18,8 @@ export type LoadedDocument = {
|
|
|
18
18
|
/** Session services used by a transaction while it holds the mutation line. */
|
|
19
19
|
export interface TransactionHost {
|
|
20
20
|
readonly storage: Storage;
|
|
21
|
+
/** Wall clock for task lifecycle times. */
|
|
22
|
+
now(): number;
|
|
21
23
|
/** Return the cached current incarnation without loading. */
|
|
22
24
|
cached(addressId: string): LoadedDocument | undefined;
|
|
23
25
|
/** Return the cached current incarnation, cold-loading and migrating it when necessary. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/session/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAY,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAuC,KAAK,OAAO,EAAS,MAAM,6BAA6B,CAAC;AACvG,OAAO,EACN,KAAK,gBAAgB,EASrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EACX,0BAA0B,EAC1B,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,EACN,eAAe,EACf,oBAAoB,EAGpB,UAAU,EACV,cAAc,EACd,KAAK,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,WAAW,EACX,UAAU,EACV,GAAG,EACH,qBAAqB,EACrB,eAAe,EACf,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,IAAI,EACJ,kBAAkB,EAClB,YAAY,EACZ,MAAM,EACN,WAAW,EACX,SAAS,EACT,UAAU,EACV,EAAE,EACF,UAAU,EACV,eAAe,EACf,MAAM,aAAa,CAAC;AAIrB,KAAK,aAAa,GAAG,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AA2BjE,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,8FAA8F;IAC9F,aAAa,EAAE,MAAM,CAAC;IACtB,8GAA8G;IAC9G,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,0GAA0G;IAC1G,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,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AS,SAAS,EAC9B,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAChC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAiC1B,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,EAAE,CAAC,SAAS,MAAM,EAC7D,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACtB,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/session/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAY,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAuC,KAAK,OAAO,EAAS,MAAM,6BAA6B,CAAC;AACvG,OAAO,EACN,KAAK,gBAAgB,EASrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EACX,0BAA0B,EAC1B,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,EACN,eAAe,EACf,oBAAoB,EAGpB,UAAU,EACV,cAAc,EACd,KAAK,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,WAAW,EACX,UAAU,EACV,GAAG,EACH,qBAAqB,EACrB,eAAe,EACf,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,IAAI,EACJ,kBAAkB,EAClB,YAAY,EACZ,MAAM,EACN,WAAW,EACX,SAAS,EACT,UAAU,EACV,EAAE,EACF,UAAU,EACV,eAAe,EAC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,OAAO,IAAI,IAAI,CAEd;IAED,sGAAsG;IACtG,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,oBAAoB,EAAE,CAsDtC;CAuOD"}
|
|
@@ -205,6 +205,7 @@ export class Transaction {
|
|
|
205
205
|
...(owner === undefined ? {} : { owner: owner.id }),
|
|
206
206
|
background: options.background ?? false,
|
|
207
207
|
abortRequested: false,
|
|
208
|
+
...(options.abandonOnRestart === true ? { abandonOnRestart: true } : {}),
|
|
208
209
|
state: { status: "pending", checkpoint },
|
|
209
210
|
}, TABLE_JSON_COPY_OPTIONS);
|
|
210
211
|
this.#tasksById.set(id, { write: { kind: "create", record } });
|
|
@@ -252,7 +253,7 @@ export class Transaction {
|
|
|
252
253
|
}
|
|
253
254
|
task.write = {
|
|
254
255
|
kind: task.write?.kind === "create" ? "create" : "replace",
|
|
255
|
-
record: copyJson(value, TABLE_JSON_COPY_OPTIONS),
|
|
256
|
+
record: copyJson(this.#stampTimes(value, candidate), TABLE_JSON_COPY_OPTIONS),
|
|
256
257
|
};
|
|
257
258
|
}
|
|
258
259
|
/** Internal: candidate records of the tasks this transaction created or replaced so far. */
|
|
@@ -700,6 +701,23 @@ export class Transaction {
|
|
|
700
701
|
throw new Error(`Conversation ${id} does not exist`);
|
|
701
702
|
}
|
|
702
703
|
}
|
|
704
|
+
/**
|
|
705
|
+
* Lifecycle times: `startedAt` on the first change to `running`, `endedAt` on the change to `terminal`. Once set,
|
|
706
|
+
* they carry over from the replaced record; records written before they existed lack them.
|
|
707
|
+
*/
|
|
708
|
+
#stampTimes(value, candidate) {
|
|
709
|
+
const status = value.state.status;
|
|
710
|
+
const now = (stamps) => (stamps ? this.#host.now() : undefined);
|
|
711
|
+
const startedAt = candidate?.startedAt ?? value.startedAt ?? now(status === "running");
|
|
712
|
+
const endedAt = candidate?.endedAt ?? value.endedAt ?? now(status === "terminal");
|
|
713
|
+
if (startedAt === value.startedAt && endedAt === value.endedAt)
|
|
714
|
+
return value;
|
|
715
|
+
return {
|
|
716
|
+
...value,
|
|
717
|
+
...(startedAt === undefined ? {} : { startedAt }),
|
|
718
|
+
...(endedAt === undefined ? {} : { endedAt }),
|
|
719
|
+
};
|
|
720
|
+
}
|
|
703
721
|
#taskEntry(id) {
|
|
704
722
|
let task = this.#tasksById.get(id);
|
|
705
723
|
if (task === undefined) {
|