@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
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Static, TSchema } from "typebox";
|
|
2
|
+
import type { Cell, Sources, SourceValues } from "./cell.ts";
|
|
3
|
+
import type { Ctx, Readable } from "./types.ts";
|
|
4
|
+
declare const DECL: unique symbol;
|
|
5
|
+
export interface Subscribable<E> {
|
|
6
|
+
subscribe(listener: (event: E) => void): () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface CellDecl<T> {
|
|
9
|
+
readonly [DECL]: "cell";
|
|
10
|
+
readonly schema: TSchema;
|
|
11
|
+
readonly initial: T;
|
|
12
|
+
}
|
|
13
|
+
export interface ResourceSpec<T> {
|
|
14
|
+
/** Bump to replace the resource at the next reload. */
|
|
15
|
+
readonly rev: number;
|
|
16
|
+
/** Holds or resources that must be live/open first. A change replaces the resource. */
|
|
17
|
+
readonly deps?: readonly unknown[];
|
|
18
|
+
/** Exclusive resources are replaced at the gate: old closed before new opened. */
|
|
19
|
+
readonly exclusive?: boolean;
|
|
20
|
+
open(options: {
|
|
21
|
+
readonly signal: AbortSignal;
|
|
22
|
+
}): T | Promise<T>;
|
|
23
|
+
close?(value: T): void | Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export interface ResourceDecl<T> {
|
|
26
|
+
readonly [DECL]: "resource";
|
|
27
|
+
readonly spec: ResourceSpec<T>;
|
|
28
|
+
}
|
|
29
|
+
export interface Resource<T> {
|
|
30
|
+
readonly key: string;
|
|
31
|
+
/** Throws not_ready until opened. */
|
|
32
|
+
readonly value: T;
|
|
33
|
+
}
|
|
34
|
+
export interface ListenerDecl {
|
|
35
|
+
readonly [DECL]: "listener";
|
|
36
|
+
readonly source: unknown;
|
|
37
|
+
readonly select: ((value: never) => Subscribable<unknown>) | undefined;
|
|
38
|
+
readonly fn: (event: unknown, ctx: Ctx) => void | Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
export interface DerivationDecl<T> {
|
|
41
|
+
readonly [DECL]: "derivation";
|
|
42
|
+
readonly sources: Sources;
|
|
43
|
+
readonly fn: (...values: never[]) => T;
|
|
44
|
+
}
|
|
45
|
+
/** A state cell: schema (required; there is no TypeScript at runtime) and initial value (validated). */
|
|
46
|
+
export declare const cell: <S extends TSchema>(schema: S, initial: Static<S>) => CellDecl<Static<S>>;
|
|
47
|
+
export declare const resource: <T>(spec: ResourceSpec<T>) => ResourceDecl<T>;
|
|
48
|
+
type ValueOf<S> = S extends Resource<infer T> ? T : S;
|
|
49
|
+
type EventOf<S> = S extends Resource<infer T> ? EventOf<T> : S extends Subscribable<infer E> ? E : never;
|
|
50
|
+
/**
|
|
51
|
+
* Reacts to a source once the record is live. `listener(source, fn)` subscribes to the source itself: a readable
|
|
52
|
+
* (cell, derivation, handle state member: called with each value, starting with the current one), an event source,
|
|
53
|
+
* or a resource whose value is one. `listener(source, select, fn)` subscribes to `select(value)`, where value is the
|
|
54
|
+
* opened resource for a resource source. Each event runs `fn` in a fresh root.
|
|
55
|
+
*/
|
|
56
|
+
export declare function listener<S>(source: S, fn: (event: EventOf<S>, ctx: Ctx) => void | Promise<void>): ListenerDecl;
|
|
57
|
+
export declare function listener<S, E>(source: S, select: (value: ValueOf<S>) => Subscribable<E>, fn: (event: E, ctx: Ctx) => void | Promise<void>): ListenerDecl;
|
|
58
|
+
export declare const derivation: <const S extends Sources, T>(sources: S, fn: (...values: SourceValues<S>) => T) => DerivationDecl<T>;
|
|
59
|
+
export declare const declKind: (value: unknown) => string | undefined;
|
|
60
|
+
export type Cells<D> = {
|
|
61
|
+
readonly [K in keyof D]: D[K] extends CellDecl<infer T> ? Cell<T> : never;
|
|
62
|
+
};
|
|
63
|
+
export type Resources<D> = {
|
|
64
|
+
readonly [K in keyof D]: D[K] extends ResourceDecl<infer T> ? Resource<T> : never;
|
|
65
|
+
};
|
|
66
|
+
export type Derivations<D> = {
|
|
67
|
+
readonly [K in keyof D]: D[K] extends DerivationDecl<infer T> ? Readable<T> : never;
|
|
68
|
+
};
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=declare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declare.d.ts","sourceRoot":"","sources":["../src/declare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKhD,QAAA,MAAM,IAAI,eAAuB,CAAC;AAElC,MAAM,WAAW,YAAY,CAAC,CAAC;IAC9B,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACpD;AAED,MAAM,WAAW,QAAQ,CAAC,CAAC;IAC1B,QAAQ,CAAC,CAAC,IAAI,C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C,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAC9C,YAAY,CAAC;AAWhB,eAAO,MAAM,UAAU,GAAI,KAAK,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,WAC3C,CAAC,MACN,CAAC,GAAG,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,KACnC,cAAc,CAAC,CAAC,CAAwF,CAAC;AAE5G,eAAO,MAAM,QAAQ,UAAW,OAAO,KAAG,MAAM,GAAG,SAC4C,CAAC;AAEhG,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK;CAAE,CAAC;AACrG,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK;CAAE,CAAC;AACjH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK;CAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Declaration descriptors. A factory passes them in object literals; the property name identifies the declaration
|
|
2
|
+
// across factory reruns (reload), independent of call order.
|
|
3
|
+
const DECL = Symbol("chord.decl");
|
|
4
|
+
/** A state cell: schema (required; there is no TypeScript at runtime) and initial value (validated). */
|
|
5
|
+
export const cell = (schema, initial) => ({
|
|
6
|
+
[DECL]: "cell",
|
|
7
|
+
schema,
|
|
8
|
+
initial,
|
|
9
|
+
});
|
|
10
|
+
export const resource = (spec) => ({ [DECL]: "resource", spec });
|
|
11
|
+
export function listener(source, ...rest) {
|
|
12
|
+
const [select, fn] = rest.length === 1 ? [undefined, rest[0]] : [rest[0], rest[1]];
|
|
13
|
+
return {
|
|
14
|
+
[DECL]: "listener",
|
|
15
|
+
source,
|
|
16
|
+
select: select,
|
|
17
|
+
fn: fn,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export const derivation = (sources, fn) => ({ [DECL]: "derivation", sources, fn: fn });
|
|
21
|
+
export const declKind = (value) => value !== null && typeof value === "object" ? value[DECL] : undefined;
|
|
22
|
+
//# sourceMappingURL=declare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declare.js","sourceRoot":"","sources":["../src/declare.ts"],"names":[],"mappings":"AAIA,kHAAkH;AAClH,6DAA6D;AAE7D,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AA+ClC,wGAAwG;AACxG,MAAM,CAAC,MAAM,IAAI,GAAG,CAAoB,MAAS,EAAE,OAAkB,EAAuB,EAAE,CAAC,CAAC;IAC/F,CAAC,IAAI,CAAC,EAAE,MAAM;IACd,MAAM;IACN,OAAO;CACP,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAI,IAAqB,EAAmB,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AAiBtG,MAAM,UAAU,QAAQ,CAAC,MAAe,EAAE,GAAG,IAAwB;IACpE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACnF,OAAO;QACN,CAAC,IAAI,CAAC,EAAE,UAAU;QAClB,MAAM;QACN,MAAM,EAAE,MAAgC;QACxC,EAAE,EAAE,EAAwB;KAC5B,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CACzB,OAAU,EACV,EAAqC,EACjB,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,EAA0C,EAAE,CAAC,CAAC;AAE5G,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAsB,EAAE,CAC9D,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAE,KAA6B,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["import type { Static, TSchema } from \"typebox\";\nimport type { Cell, Sources, SourceValues } from \"./cell.ts\";\nimport type { Ctx, Readable } from \"./types.ts\";\n\n// Declaration descriptors. A factory passes them in object literals; the property name identifies the declaration\n// across factory reruns (reload), independent of call order.\n\nconst DECL = Symbol(\"chord.decl\");\n\nexport interface Subscribable<E> {\n\tsubscribe(listener: (event: E) => void): () => void;\n}\n\nexport interface CellDecl<T> {\n\treadonly [DECL]: \"cell\";\n\treadonly schema: TSchema;\n\treadonly initial: T;\n}\n\nexport interface ResourceSpec<T> {\n\t/** Bump to replace the resource at the next reload. */\n\treadonly rev: number;\n\t/** Holds or resources that must be live/open first. A change replaces the resource. */\n\treadonly deps?: readonly unknown[];\n\t/** Exclusive resources are replaced at the gate: old closed before new opened. */\n\treadonly exclusive?: boolean;\n\topen(options: { readonly signal: AbortSignal }): T | Promise<T>;\n\tclose?(value: T): void | Promise<void>;\n}\n\nexport interface ResourceDecl<T> {\n\treadonly [DECL]: \"resource\";\n\treadonly spec: ResourceSpec<T>;\n}\n\nexport interface Resource<T> {\n\treadonly key: string;\n\t/** Throws not_ready until opened. */\n\treadonly value: T;\n}\n\nexport interface ListenerDecl {\n\treadonly [DECL]: \"listener\";\n\treadonly source: unknown;\n\treadonly select: ((value: never) => Subscribable<unknown>) | undefined;\n\treadonly fn: (event: unknown, ctx: Ctx) => void | Promise<void>;\n}\n\nexport interface DerivationDecl<T> {\n\treadonly [DECL]: \"derivation\";\n\treadonly sources: Sources;\n\treadonly fn: (...values: never[]) => T;\n}\n\n/** A state cell: schema (required; there is no TypeScript at runtime) and initial value (validated). */\nexport const cell = <S extends TSchema>(schema: S, initial: Static<S>): CellDecl<Static<S>> => ({\n\t[DECL]: \"cell\",\n\tschema,\n\tinitial,\n});\n\nexport const resource = <T>(spec: ResourceSpec<T>): ResourceDecl<T> => ({ [DECL]: \"resource\", spec });\n\ntype ValueOf<S> = S extends Resource<infer T> ? T : S;\ntype EventOf<S> = S extends Resource<infer T> ? EventOf<T> : S extends Subscribable<infer E> ? E : never;\n\n/**\n * Reacts to a source once the record is live. `listener(source, fn)` subscribes to the source itself: a readable\n * (cell, derivation, handle state member: called with each value, starting with the current one), an event source,\n * or a resource whose value is one. `listener(source, select, fn)` subscribes to `select(value)`, where value is the\n * opened resource for a resource source. Each event runs `fn` in a fresh root.\n */\nexport function listener<S>(source: S, fn: (event: EventOf<S>, ctx: Ctx) => void | Promise<void>): ListenerDecl;\nexport function listener<S, E>(\n\tsource: S,\n\tselect: (value: ValueOf<S>) => Subscribable<E>,\n\tfn: (event: E, ctx: Ctx) => void | Promise<void>,\n): ListenerDecl;\nexport function listener(source: unknown, ...rest: readonly unknown[]): ListenerDecl {\n\tconst [select, fn] = rest.length === 1 ? [undefined, rest[0]] : [rest[0], rest[1]];\n\treturn {\n\t\t[DECL]: \"listener\",\n\t\tsource,\n\t\tselect: select as ListenerDecl[\"select\"],\n\t\tfn: fn as ListenerDecl[\"fn\"],\n\t};\n}\n\nexport const derivation = <const S extends Sources, T>(\n\tsources: S,\n\tfn: (...values: SourceValues<S>) => T,\n): DerivationDecl<T> => ({ [DECL]: \"derivation\", sources, fn: fn as unknown as (...values: never[]) => T });\n\nexport const declKind = (value: unknown): string | undefined =>\n\tvalue !== null && typeof value === \"object\" ? (value as { [DECL]?: string })[DECL] : undefined;\n\nexport type Cells<D> = { readonly [K in keyof D]: D[K] extends CellDecl<infer T> ? Cell<T> : never };\nexport type Resources<D> = { readonly [K in keyof D]: D[K] extends ResourceDecl<infer T> ? Resource<T> : never };\nexport type Derivations<D> = { readonly [K in keyof D]: D[K] extends DerivationDecl<infer T> ? Readable<T> : never };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-immutable-trusted.js","sourceRoot":"","sources":["../../src/delta/apply-immutable-trusted.ts"],"names":[],"mappings":"AAMA,MAAM,eAAe,GAAuB;IAC3C,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;CAClB,CAAC;AAEF,wFAAwF;AACxF,MAAM,UAAU,qBAAqB,CAAI,MAAS,EAAE,UAAyB;IAC5E,IAAI,IAAI,GAAG,MAA8B,CAAC;IAC1C,MAAM,KAAK,GAAG,IAAI,OAAO,EAAU,CAAC;IACpC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACpC,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAC1B,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YACpB,SAAS;QACV,CAAC;QACD,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAClD,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACxE,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;YACnB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC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M,EAAE,KAAK,EAAE;QAAE,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAE,CAAE,CAAC;AACzG,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IAClC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AACpD,CAAC","sourcesContent":["import type { JsonValue } from \"../types.ts\";\nimport type { Op, Path, Seg } from \"./index.ts\";\n\ntype JsonContainer = JsonValue[] | Record<string, JsonValue>;\ntype CopiedPath = { root: JsonValue; target: JsonContainer };\n\nconst DATA_DESCRIPTOR: PropertyDescriptor = {\n\tvalue: undefined,\n\twritable: true,\n\tenumerable: true,\n\tconfigurable: true,\n};\n\n/** Apply self-produced trusted operations while copying each touched container once. */\nexport function applyImmutableTrusted<T>(target: T, operations: readonly Op[]): T {\n\tlet root = target as unknown as JsonValue;\n\tconst owned = new WeakSet<object>();\n\tfor (const operation of operations) {\n\t\tif (operation[0] === \"r\") {\n\t\t\troot = operation[1];\n\t\t\tcontinue;\n\t\t}\n\t\tif (operation[0] === \"p\" || operation[0] === \"m\") {\n\t\t\tconst copied = copyPath(root, operation[1], operation[1].length, owned);\n\t\t\troot = copied.root;\n\t\t\tif (!Array.isArray(copied.target)) throw new TypeError(\"Trusted array operation target is not an array\");\n\t\t\tif (operation[0] === \"p\") spliceTrusted(copied.target, operation[2], operation[3], operation[4]);\n\t\t\telse permuteTrusted(copied.target, operation[2]);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst path = operation[1];\n\t\tconst copied = copyPath(root, path, path.length - 1, owned);\n\t\troot = copied.root;\n\t\tconst key = path[path.length - 1]!;\n\t\tswitch (operation[0]) {\n\t\t\tcase \"s\":\n\t\t\t\tdefineData(copied.target, key, operation[2]);\n\t\t\t\tbreak;\n\t\t\tcase \"d\":\n\t\t\t\tif (Array.isArray(copied.target)) {\n\t\t\t\t\tif (typeof key !== \"number\") throw new TypeError(\"Trusted array deletion key is not numeric\");\n\t\t\t\t\tspliceTrusted(copied.target, key, 1, []);\n\t\t\t\t} else Reflect.deleteProperty(copied.target, key);\n\t\t\t\tbreak;\n\t\t\tcase \"a\": {\n\t\t\t\tconst current = read(copied.target, key);\n\t\t\t\tif (typeof current !== \"string\") throw new TypeError(\"Trusted append target is not a string\");\n\t\t\t\tdefineData(copied.target, key, `${current}${operation[2]}`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"t\": {\n\t\t\t\tconst current = read(copied.target, key);\n\t\t\t\tif (typeof current !== \"string\") throw new TypeError(\"Trusted truncate target is not a string\");\n\t\t\t\tdefineData(copied.target, key, current.slice(operation[2]));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn root as unknown as T;\n}\n\nfunction copyPath(root: JsonValue, path: Path, length: number, owned: WeakSet<object>): CopiedPath {\n\tif (!isContainer(root)) throw new TypeError(\"Trusted operation root is not a container\");\n\tlet copiedRoot = root;\n\tif (!owned.has(root)) {\n\t\tcopiedRoot = shallowCopy(root);\n\t\towned.add(copiedRoot);\n\t}\n\tlet destination = copiedRoot as JsonContainer;\n\tfor (let index = 0; index < length; index++) {\n\t\tconst segment = path[index]!;\n\t\tconst child = read(destination, segment);\n\t\tif (!isContainer(child)) throw new TypeError(\"Trusted operation path is not a container\");\n\t\tif (owned.has(child)) {\n\t\t\tdestination = child;\n\t\t\tcontinue;\n\t\t}\n\t\tconst copy = shallowCopy(child);\n\t\tdefineData(destination, segment, copy);\n\t\towned.add(copy);\n\t\tdestination = copy;\n\t}\n\treturn { root: copiedRoot, target: destination };\n}\n\nfunction shallowCopy(value: JsonContainer): JsonContainer {\n\tif (Array.isArray(value)) return Array.from(value);\n\tconst result = Object.create(Object.getPrototypeOf(value) === null ? null : Object.prototype) as Record<\n\t\tstring,\n\t\tJsonValue\n\t>;\n\tfor (const key of Object.keys(value)) defineData(result, key, value[key]!);\n\treturn result;\n}\n\nfunction read(target: JsonContainer, key: Seg): JsonValue {\n\treturn (target as Record<Seg, JsonValue>)[key]!;\n}\n\nfunction defineData(target: JsonContainer, key: Seg, value: JsonValue): void {\n\tDATA_DESCRIPTOR.value = value;\n\tObject.defineProperty(target, key, DATA_DESCRIPTOR);\n\tDATA_DESCRIPTOR.value = undefined;\n}\n\nfunction spliceTrusted(target: JsonValue[], start: number, remove: number, items: readonly JsonValue[]): void {\n\tconst oldLength = target.length;\n\tconst delta = items.length - remove;\n\tif (delta > 0) {\n\t\ttarget.length = oldLength + delta;\n\t\ttarget.copyWithin(start + items.length, start + remove, oldLength);\n\t} else if (delta < 0) {\n\t\ttarget.copyWithin(start + items.length, start + remove, oldLength);\n\t\ttarget.length = oldLength + delta;\n\t}\n\tfor (let index = 0; index < items.length; index++) defineData(target, start + index, items[index]!);\n}\n\nfunction permuteTrusted(target: JsonValue[], permutation: readonly number[]): void {\n\tif (target.length !== permutation.length) throw new TypeError(\"Trusted permutation length mismatch\");\n\tconst previous = target.slice();\n\tfor (let index = 0; index < permutation.length; index++) target[index] = previous[permutation[index]!]!;\n}\n\nfunction isContainer(value: unknown): value is JsonContainer {\n\treturn value !== null && typeof value === \"object\";\n}\n"]}
|
|
1
|
+
{"version":3,"file":"apply-immutable-trusted.js","sourceRoot":"","sources":["../../src/delta/apply-immutable-trusted.ts"],"names":[],"mappings":"AAMA,MAAM,eAAe,GAAuB;IAC3C,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;CAClB,CAAC;AAEF,wFAAwF;AACxF,MAAM,UAAU,qBAAqB,CAAI,MAAS,EAAE,UAAyB;IAC5E,IAAI,IAAI,GAAG,MAA8B,CAAC;IAC1C,MAAM,KAAK,GAAG,IAAI,OAAO,EAAU,CAAC;IACpC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACpC,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAC1B,IAAI,GAAG,SAAS,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EAAE;QAAE,UAAU,CAAC,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE,KAAK,CAAC,KAAK,CAAE,CAAC,CAAC;AACrG,CAAC;AAED,SAAS,cAAc,CAAC,MAAmB,EAAE,WAA8B;IAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM;QAAE,MAAM,IAAI,SAAS,CAAC,qCAAqC,CAAC,CAAC;IACrG,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;IAChC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE;QAAE,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAE,CAAE,CAAC;AACzG,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IAClC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AACpD,CAAC","sourcesContent":["import type { JsonValue } from \"../json.ts\";\nimport type { Op, Path, Seg } from \"./index.ts\";\n\ntype JsonContainer = JsonValue[] | Record<string, JsonValue>;\ntype CopiedPath = { root: JsonValue; target: JsonContainer };\n\nconst DATA_DESCRIPTOR: PropertyDescriptor = {\n\tvalue: undefined,\n\twritable: true,\n\tenumerable: true,\n\tconfigurable: true,\n};\n\n/** Apply self-produced trusted operations while copying each touched container once. */\nexport function applyImmutableTrusted<T>(target: T, operations: readonly Op[]): T {\n\tlet root = target as unknown as JsonValue;\n\tconst owned = new WeakSet<object>();\n\tfor (const operation of operations) {\n\t\tif (operation[0] === \"r\") {\n\t\t\troot = operation[1];\n\t\t\tcontinue;\n\t\t}\n\t\tif (operation[0] === \"p\" || operation[0] === \"m\") {\n\t\t\tconst copied = copyPath(root, operation[1], operation[1].length, owned);\n\t\t\troot = copied.root;\n\t\t\tif (!Array.isArray(copied.target)) throw new TypeError(\"Trusted array operation target is not an array\");\n\t\t\tif (operation[0] === \"p\") spliceTrusted(copied.target, operation[2], operation[3], operation[4]);\n\t\t\telse permuteTrusted(copied.target, operation[2]);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst path = operation[1];\n\t\tconst copied = copyPath(root, path, path.length - 1, owned);\n\t\troot = copied.root;\n\t\tconst key = path[path.length - 1]!;\n\t\tswitch (operation[0]) {\n\t\t\tcase \"s\":\n\t\t\t\tdefineData(copied.target, key, operation[2]);\n\t\t\t\tbreak;\n\t\t\tcase \"d\":\n\t\t\t\tif (Array.isArray(copied.target)) {\n\t\t\t\t\tif (typeof key !== \"number\") throw new TypeError(\"Trusted array deletion key is not numeric\");\n\t\t\t\t\tspliceTrusted(copied.target, key, 1, []);\n\t\t\t\t} else Reflect.deleteProperty(copied.target, key);\n\t\t\t\tbreak;\n\t\t\tcase \"a\": {\n\t\t\t\tconst current = read(copied.target, key);\n\t\t\t\tif (typeof current !== \"string\") throw new TypeError(\"Trusted append target is not a string\");\n\t\t\t\tdefineData(copied.target, key, `${current}${operation[2]}`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"t\": {\n\t\t\t\tconst current = read(copied.target, key);\n\t\t\t\tif (typeof current !== \"string\") throw new TypeError(\"Trusted truncate target is not a string\");\n\t\t\t\tdefineData(copied.target, key, current.slice(operation[2]));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn root as unknown as T;\n}\n\nfunction copyPath(root: JsonValue, path: Path, length: number, owned: WeakSet<object>): CopiedPath {\n\tif (!isContainer(root)) throw new TypeError(\"Trusted operation root is not a container\");\n\tlet copiedRoot = root;\n\tif (!owned.has(root)) {\n\t\tcopiedRoot = shallowCopy(root);\n\t\towned.add(copiedRoot);\n\t}\n\tlet destination = copiedRoot as JsonContainer;\n\tfor (let index = 0; index < length; index++) {\n\t\tconst segment = path[index]!;\n\t\tconst child = read(destination, segment);\n\t\tif (!isContainer(child)) throw new TypeError(\"Trusted operation path is not a container\");\n\t\tif (owned.has(child)) {\n\t\t\tdestination = child;\n\t\t\tcontinue;\n\t\t}\n\t\tconst copy = shallowCopy(child);\n\t\tdefineData(destination, segment, copy);\n\t\towned.add(copy);\n\t\tdestination = copy;\n\t}\n\treturn { root: copiedRoot, target: destination };\n}\n\nfunction shallowCopy(value: JsonContainer): JsonContainer {\n\tif (Array.isArray(value)) return Array.from(value);\n\tconst result = Object.create(Object.getPrototypeOf(value) === null ? null : Object.prototype) as Record<\n\t\tstring,\n\t\tJsonValue\n\t>;\n\tfor (const key of Object.keys(value)) defineData(result, key, value[key]!);\n\treturn result;\n}\n\nfunction read(target: JsonContainer, key: Seg): JsonValue {\n\treturn (target as Record<Seg, JsonValue>)[key]!;\n}\n\nfunction defineData(target: JsonContainer, key: Seg, value: JsonValue): void {\n\tDATA_DESCRIPTOR.value = value;\n\tObject.defineProperty(target, key, DATA_DESCRIPTOR);\n\tDATA_DESCRIPTOR.value = undefined;\n}\n\nfunction spliceTrusted(target: JsonValue[], start: number, remove: number, items: readonly JsonValue[]): void {\n\tconst oldLength = target.length;\n\tconst delta = items.length - remove;\n\tif (delta > 0) {\n\t\ttarget.length = oldLength + delta;\n\t\ttarget.copyWithin(start + items.length, start + remove, oldLength);\n\t} else if (delta < 0) {\n\t\ttarget.copyWithin(start + items.length, start + remove, oldLength);\n\t\ttarget.length = oldLength + delta;\n\t}\n\tfor (let index = 0; index < items.length; index++) defineData(target, start + index, items[index]!);\n}\n\nfunction permuteTrusted(target: JsonValue[], permutation: readonly number[]): void {\n\tif (target.length !== permutation.length) throw new TypeError(\"Trusted permutation length mismatch\");\n\tconst previous = target.slice();\n\tfor (let index = 0; index < permutation.length; index++) target[index] = previous[permutation[index]!]!;\n}\n\nfunction isContainer(value: unknown): value is JsonContainer {\n\treturn value !== null && typeof value === \"object\";\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JsonValue } from "../
|
|
1
|
+
import type { JsonValue } from "../json.ts";
|
|
2
2
|
import { type Op } from "./index.ts";
|
|
3
3
|
/** Compute a compact operation batch from two immutable JSON revisions. */
|
|
4
4
|
export declare function diffRevisions(before: JsonValue, after: JsonValue): Op[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/delta/diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/delta/diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAqB,KAAK,EAAE,EAAmD,MAAM,YAAY,CAAC;AA8fzG,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,EAAE,EAAE,CAUvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/delta/diff.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,OAAO,EAAa,iBAAiB,EAAY,MAAM,YAAY,CAAC;AAEzG,MAAM,oBAAoB,GAAG,MAAM,CAAC;AACpC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AACnC,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAQ,CAAC;AAE9C,MAAM,aAAa,GAAG,CAAC,UAAgB,EAAE,SAAa,EAAQ,EAAE;IAC/D,IAAI,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC;QAAE,OAAO;IAC9C,IAAI,UAAU,CAAC,MAAM,IAAI,oBAAoB,EAAE,CAAC;QAC/C,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO;IACR,CAAC;IACD,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,KAAgB,EAAoD,EAAE,CAC1F,KAAK,KAAK,IAAI,IAAI,OAAO,K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OAAO,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;AACF,CAAC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,UAAU,aAAa,CAAC,MAAiB,EAAE,KAAgB;IAChE,MAAM,UAAU,GAAS,EAAE,CAAC;IAC5B,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;IACzC,IAAI,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC;QAAE,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IAC7D,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG;QAAE,OAAO,UAAU,CAAC;IAC7E,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,MAAM,SAAS,IAAI,UAAU;QAAE,SAAS,IAAI,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9E,IAAI,SAAS,GAAG,MAAM;QAAE,OAAO,UAAU,CAAC;IAC1C,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,OAAO,SAAS,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;AAChE,CAAC","sourcesContent":["import type { JsonValue } from \"../types.ts\";\nimport { type NonEmptyPath, type Op, overlap, type Path, RESERVED_SEGMENTS, type Seg } from \"./index.ts\";\n\nconst DEFAULT_OVERLAP_SCAN = 65_536;\nconst MAX_DELTA_OPERATIONS = 4_096;\nconst overflowedBatches = new WeakSet<Op[]>();\n\nconst emitOperation = (operations: Op[], operation: Op): void => {\n\tif (overflowedBatches.has(operations)) return;\n\tif (operations.length >= MAX_DELTA_OPERATIONS) {\n\t\toverflowedBatches.add(operations);\n\t\treturn;\n\t}\n\toperations.push(operation);\n};\n\nconst isContainer = (value: JsonValue): value is JsonValue[] | Record<string, JsonValue> =>\n\tvalue !== null && typeof value === \"object\";\n\nconst emitSet = (path: Path, value: JsonValue, operations: Op[]): void => {\n\tif (path.length === 0) emitOperation(operations, [\"r\", value]);\n\telse emitOperation(operations, [\"s\", path as NonEmptyPath, value]);\n};\n\nconst equalJson = (left: JsonValue, right: JsonValue): boolean => {\n\tif (left === right) return true;\n\tif (!isContainer(left) || !isContainer(right) || Array.isArray(left) !== Array.isArray(right)) return false;\n\tif (Array.isArray(left)) {\n\t\tconst other = right as JsonValue[];\n\t\tif (left.length !== other.length) return false;\n\t\tfor (let index = 0; index < left.length; index++) {\n\t\t\tif (!equalJson(left[index]!, other[index]!)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tconst other = right as Record<string, JsonValue>;\n\tconst keys = Object.keys(left);\n\tif (keys.length !== Object.keys(other).length) return false;\n\tfor (const key of keys) {\n\t\tif (!Object.hasOwn(other, key) || !equalJson(left[key]!, other[key]!)) return false;\n\t}\n\treturn true;\n};\n\nconst permutation = (before: readonly JsonValue[], after: readonly JsonValue[]): number[] | undefined => {\n\tif (before.length !== after.length) return undefined;\n\tconst positions = new Map<JsonValue, { indices: number[]; used: number }>();\n\tfor (let index = 0; index < before.length; index++) {\n\t\tconst value = before[index]!;\n\t\tconst entry = positions.get(value);\n\t\tif (entry === undefined) positions.set(value, { indices: [index], used: 0 });\n\t\telse entry.indices.push(index);\n\t}\n\tconst result = new Array<number>(after.length);\n\tfor (let index = 0; index < after.length; index++) {\n\t\tconst entry = positions.get(after[index]!);\n\t\tif (entry === undefined || entry.used === entry.indices.length) return undefined;\n\t\tresult[index] = entry.indices[entry.used++]!;\n\t}\n\treturn result;\n};\n\nconst emitString = (before: string, after: string, path: NonEmptyPath, operations: Op[]): void => {\n\tif (before === after) return;\n\tif (after.length > before.length && after.slice(0, before.length) === before) {\n\t\temitOperation(operations, [\"a\", path, after.slice(before.length)]);\n\t\treturn;\n\t}\n\tconst shared = overlap(before, after, DEFAULT_OVERLAP_SCAN);\n\tif (shared === 0) {\n\t\temitOperation(operations, [\"s\", path, after]);\n\t\treturn;\n\t}\n\temitOperation(operations, [\"t\", path, before.length - shared]);\n\tif (after.length > shared) emitOperation(operations, [\"a\", path, after.slice(shared)]);\n};\n\ntype ArrayMatch = readonly [before: number, after: number];\n\ntype MatchCandidate = {\n\tbefore: number;\n\tafter: number;\n\tprevious: number;\n};\n\nconst MAX_IDENTITY_CANDIDATES = 200_000;\nconst MAX_SEMANTIC_CELLS = 65_536;\n\nconst sameValue = (left: JsonValue, right: JsonValue): boolean => left === right || equalJson(left, right);\n\nconst lcsMatches = (\n\tbefore: readonly JsonValue[],\n\tafter: readonly JsonValue[],\n\tequal: (left: JsonValue, right: JsonValue) => boolean,\n\tmaxCells: number,\n): ArrayMatch[] | undefined => {\n\tif (before.length === 0 || after.length === 0) return [];\n\tif (before.length * after.length > maxCells) return undefined;\n\tconst width = after.length + 1;\n\tconst lengths = new Uint32Array((before.length + 1) * width);\n\tfor (let left = before.length - 1; left >= 0; left--) {\n\t\tfor (let right = after.length - 1; right >= 0; right--) {\n\t\t\tconst at = left * width + right;\n\t\t\tlengths[at] = equal(before[left]!, after[right]!)\n\t\t\t\t? lengths[(left + 1) * width + right + 1]! + 1\n\t\t\t\t: Math.max(lengths[(left + 1) * width + right]!, lengths[left * width + right + 1]!);\n\t\t}\n\t}\n\tconst matches: ArrayMatch[] = [];\n\tlet left = 0;\n\tlet right = 0;\n\twhile (left < before.length && right < after.length) {\n\t\tif (\n\t\t\tequal(before[left]!, after[right]!) &&\n\t\t\tlengths[left * width + right] === lengths[(left + 1) * width + right + 1]! + 1\n\t\t) {\n\t\t\tmatches.push([left++, right++]);\n\t\t} else if (lengths[(left + 1) * width + right]! >= lengths[left * width + right + 1]!) left += 1;\n\t\telse right += 1;\n\t}\n\treturn matches;\n};\n\nconst semanticallyAligned = (left: JsonValue, right: JsonValue): boolean => {\n\tif (sameValue(left, right)) return true;\n\tif (!isContainer(left) || !isContainer(right) || Array.isArray(left) !== Array.isArray(right)) return false;\n\tif (Array.isArray(left) && Array.isArray(right)) {\n\t\tif (left.length !== right.length) return false;\n\t\treturn left.some((value, index) => isContainer(value) && value === right[index]);\n\t}\n\tconst leftObject = left as Record<string, JsonValue>;\n\tconst rightObject = right as Record<string, JsonValue>;\n\tfor (const key of Object.keys(leftObject)) {\n\t\tconst value = leftObject[key];\n\t\tif (isContainer(value) && Object.hasOwn(rightObject, key) && value === rightObject[key]) return true;\n\t}\n\treturn false;\n};\n\nconst lowerBound = (values: readonly number[], value: number): number => {\n\tlet low = 0;\n\tlet high = values.length;\n\twhile (low < high) {\n\t\tconst middle = (low + high) >>> 1;\n\t\tif (values[middle]! < value) low = middle + 1;\n\t\telse high = middle;\n\t}\n\treturn low;\n};\n\nconst identitySubsequence = (\n\tbefore: readonly JsonValue[],\n\tbeforeStart: number,\n\tbeforeEnd: number,\n\tafter: readonly JsonValue[],\n\tafterStart: number,\n\tafterEnd: number,\n): ArrayMatch[] | undefined => {\n\tconst beforeCount = beforeEnd - beforeStart;\n\tconst afterCount = afterEnd - afterStart;\n\tconst matches: ArrayMatch[] = [];\n\tif (afterCount < beforeCount) {\n\t\tlet beforeIndex = beforeStart;\n\t\tfor (let afterIndex = afterStart; afterIndex < afterEnd; afterIndex++) {\n\t\t\twhile (beforeIndex < beforeEnd && before[beforeIndex] !== after[afterIndex]) beforeIndex += 1;\n\t\t\tif (beforeIndex === beforeEnd) return undefined;\n\t\t\tmatches.push([beforeIndex++, afterIndex]);\n\t\t}\n\t\treturn matches;\n\t}\n\tif (beforeCount < afterCount) {\n\t\tlet afterIndex = afterStart;\n\t\tfor (let beforeIndex = beforeStart; beforeIndex < beforeEnd; beforeIndex++) {\n\t\t\twhile (afterIndex < afterEnd && before[beforeIndex] !== after[afterIndex]) afterIndex += 1;\n\t\t\tif (afterIndex === afterEnd) return undefined;\n\t\t\tmatches.push([beforeIndex, afterIndex++]);\n\t\t}\n\t\treturn matches;\n\t}\n\treturn undefined;\n};\n\nconst greedyIdentityAnchors = (\n\tpositions: ReadonlyMap<JsonValue, readonly number[]>,\n\tafter: readonly JsonValue[],\n\tafterStart: number,\n\tafterEnd: number,\n): ArrayMatch[] => {\n\tconst matches: ArrayMatch[] = [];\n\tlet previous = -1;\n\tfor (let afterIndex = afterStart; afterIndex < afterEnd; afterIndex++) {\n\t\tconst candidates = positions.get(after[afterIndex]!);\n\t\tif (candidates === undefined) continue;\n\t\tconst at = lowerBound(candidates, previous + 1);\n\t\tconst beforeIndex = candidates[at];\n\t\tif (beforeIndex === undefined) continue;\n\t\tmatches.push([beforeIndex, afterIndex]);\n\t\tprevious = beforeIndex;\n\t}\n\treturn matches;\n};\n\nconst identityAnchors = (\n\tbefore: readonly JsonValue[],\n\tbeforeStart: number,\n\tbeforeEnd: number,\n\tafter: readonly JsonValue[],\n\tafterStart: number,\n\tafterEnd: number,\n): ArrayMatch[] => {\n\tconst positions = new Map<JsonValue, number[]>();\n\tfor (let index = beforeStart; index < beforeEnd; index++) {\n\t\tconst value = before[index]!;\n\t\tconst existing = positions.get(value);\n\t\tif (existing === undefined) positions.set(value, [index]);\n\t\telse existing.push(index);\n\t}\n\tlet candidateCount = 0;\n\tfor (let index = afterStart; index < afterEnd; index++) {\n\t\tcandidateCount += positions.get(after[index]!)?.length ?? 0;\n\t\tif (candidateCount > MAX_IDENTITY_CANDIDATES) {\n\t\t\treturn greedyIdentityAnchors(positions, after, afterStart, afterEnd);\n\t\t}\n\t}\n\tif (candidateCount === 0) return [];\n\n\tconst candidates: MatchCandidate[] = [];\n\tconst tails: number[] = [];\n\tconst tailValues: number[] = [];\n\tfor (let afterIndex = afterStart; afterIndex < afterEnd; afterIndex++) {\n\t\tconst beforePositions = positions.get(after[afterIndex]!);\n\t\tif (beforePositions === undefined) continue;\n\t\tfor (let index = beforePositions.length - 1; index >= 0; index--) {\n\t\t\tconst beforeIndex = beforePositions[index]!;\n\t\t\tconst at = lowerBound(tailValues, beforeIndex);\n\t\t\tconst candidateIndex = candidates.length;\n\t\t\tcandidates.push({ before: beforeIndex, after: afterIndex, previous: at === 0 ? -1 : tails[at - 1]! });\n\t\t\ttails[at] = candidateIndex;\n\t\t\ttailValues[at] = beforeIndex;\n\t\t}\n\t}\n\tconst matches: ArrayMatch[] = [];\n\tlet candidateIndex = tails[tails.length - 1] ?? -1;\n\twhile (candidateIndex >= 0) {\n\t\tconst candidate = candidates[candidateIndex]!;\n\t\tmatches.push([candidate.before, candidate.after]);\n\t\tcandidateIndex = candidate.previous;\n\t}\n\tmatches.reverse();\n\treturn matches;\n};\n\nconst processArrayMatches = (\n\tbefore: JsonValue[],\n\tafter: JsonValue[],\n\tpath: Path,\n\toperations: Op[],\n\tbeforeStart: number,\n\tbeforeEnd: number,\n\tafterStart: number,\n\tafterEnd: number,\n\toutputStart: number,\n\tmatches: readonly ArrayMatch[],\n): void => {\n\tlet beforeAt = beforeStart;\n\tlet afterAt = afterStart;\n\tlet outputAt = outputStart;\n\tfor (const [beforeMatch, afterMatch] of matches) {\n\t\tif (overflowedBatches.has(operations)) return;\n\t\tdiffArrayRegion(before, after, path, operations, beforeAt, beforeMatch, afterAt, afterMatch, outputAt);\n\t\toutputAt += afterMatch - afterAt;\n\t\tif (!sameValue(before[beforeMatch]!, after[afterMatch]!)) {\n\t\t\tdiffValue(before[beforeMatch]!, after[afterMatch]!, [...path, outputAt], operations);\n\t\t}\n\t\toutputAt += 1;\n\t\tbeforeAt = beforeMatch + 1;\n\t\tafterAt = afterMatch + 1;\n\t}\n\tif (!overflowedBatches.has(operations)) {\n\t\tdiffArrayRegion(before, after, path, operations, beforeAt, beforeEnd, afterAt, afterEnd, outputAt);\n\t}\n};\n\nfunction diffArrayRegion(\n\tbefore: JsonValue[],\n\tafter: JsonValue[],\n\tpath: Path,\n\toperations: Op[],\n\tbeforeStart: number,\n\tbeforeEnd: number,\n\tafterStart: number,\n\tafterEnd: number,\n\toutputStart: number,\n): void {\n\tif (overflowedBatches.has(operations)) return;\n\twhile (beforeStart < beforeEnd && afterStart < afterEnd && sameValue(before[beforeStart]!, after[afterStart]!)) {\n\t\tbeforeStart += 1;\n\t\tafterStart += 1;\n\t\toutputStart += 1;\n\t}\n\twhile (beforeStart < beforeEnd && afterStart < afterEnd && sameValue(before[beforeEnd - 1]!, after[afterEnd - 1]!)) {\n\t\tbeforeEnd -= 1;\n\t\tafterEnd -= 1;\n\t}\n\tconst beforeCount = beforeEnd - beforeStart;\n\tconst afterCount = afterEnd - afterStart;\n\tif (beforeCount === 0 && afterCount === 0) return;\n\tif (beforeCount === 0 || afterCount === 0) {\n\t\temitOperation(operations, [\"p\", path, outputStart, beforeCount, after.slice(afterStart, afterEnd)]);\n\t\treturn;\n\t}\n\n\tif (beforeCount === afterCount) {\n\t\tconst positional: ArrayMatch[] = [];\n\t\tfor (let offset = 0; offset < beforeCount; offset++) {\n\t\t\tif (sameValue(before[beforeStart + offset]!, after[afterStart + offset]!)) {\n\t\t\t\tpositional.push([beforeStart + offset, afterStart + offset]);\n\t\t\t}\n\t\t}\n\t\tif (positional.length > 0) {\n\t\t\tprocessArrayMatches(\n\t\t\t\tbefore,\n\t\t\t\tafter,\n\t\t\t\tpath,\n\t\t\t\toperations,\n\t\t\t\tbeforeStart,\n\t\t\t\tbeforeEnd,\n\t\t\t\tafterStart,\n\t\t\t\tafterEnd,\n\t\t\t\toutputStart,\n\t\t\t\tpositional,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst subsequence = identitySubsequence(before, beforeStart, beforeEnd, after, afterStart, afterEnd);\n\tif (subsequence !== undefined && subsequence.length > 0) {\n\t\tprocessArrayMatches(\n\t\t\tbefore,\n\t\t\tafter,\n\t\t\tpath,\n\t\t\toperations,\n\t\t\tbeforeStart,\n\t\t\tbeforeEnd,\n\t\t\tafterStart,\n\t\t\tafterEnd,\n\t\t\toutputStart,\n\t\t\tsubsequence,\n\t\t);\n\t\treturn;\n\t}\n\n\tconst identity = identityAnchors(before, beforeStart, beforeEnd, after, afterStart, afterEnd);\n\tif (identity.length > 0) {\n\t\tprocessArrayMatches(\n\t\t\tbefore,\n\t\t\tafter,\n\t\t\tpath,\n\t\t\toperations,\n\t\t\tbeforeStart,\n\t\t\tbeforeEnd,\n\t\t\tafterStart,\n\t\t\tafterEnd,\n\t\t\toutputStart,\n\t\t\tidentity,\n\t\t);\n\t\treturn;\n\t}\n\n\tconst semantic = lcsMatches(\n\t\tbefore.slice(beforeStart, beforeEnd),\n\t\tafter.slice(afterStart, afterEnd),\n\t\tsemanticallyAligned,\n\t\tMAX_SEMANTIC_CELLS,\n\t);\n\tif (semantic !== undefined && semantic.length > 0) {\n\t\tconst absolute = semantic.map(\n\t\t\t([beforeIndex, afterIndex]) => [beforeStart + beforeIndex, afterStart + afterIndex] as const,\n\t\t);\n\t\tprocessArrayMatches(\n\t\t\tbefore,\n\t\t\tafter,\n\t\t\tpath,\n\t\t\toperations,\n\t\t\tbeforeStart,\n\t\t\tbeforeEnd,\n\t\t\tafterStart,\n\t\t\tafterEnd,\n\t\t\toutputStart,\n\t\t\tabsolute,\n\t\t);\n\t\treturn;\n\t}\n\n\tif (beforeCount === 1 && afterCount === 1) {\n\t\tdiffValue(before[beforeStart]!, after[afterStart]!, [...path, outputStart], operations);\n\t\treturn;\n\t}\n\temitOperation(operations, [\"p\", path, outputStart, beforeCount, after.slice(afterStart, afterEnd)]);\n}\n\nconst diffArray = (before: JsonValue[], after: JsonValue[], path: Path, operations: Op[]): void => {\n\tif (before === after || equalJson(before, after)) return;\n\tif (\n\t\tbefore.length === after.length &&\n\t\tbefore.length > 1 &&\n\t\t!sameValue(before[0]!, after[0]!) &&\n\t\t!sameValue(before[before.length - 1]!, after[after.length - 1]!)\n\t) {\n\t\tconst order = permutation(before, after);\n\t\tif (order !== undefined) {\n\t\t\temitOperation(operations, [\"m\", path, order]);\n\t\t\treturn;\n\t\t}\n\t}\n\tdiffArrayRegion(before, after, path, operations, 0, before.length, 0, after.length, 0);\n};\n\nconst diffObject = (\n\tbefore: Record<string, JsonValue>,\n\tafter: Record<string, JsonValue>,\n\tpath: Path,\n\toperations: Op[],\n): void => {\n\tconst beforeKeys = Object.keys(before);\n\tconst afterKeys = Object.keys(after);\n\tif ([...beforeKeys, ...afterKeys].some((key) => RESERVED_SEGMENTS.has(key))) {\n\t\tif (!equalJson(before, after)) emitSet(path, after, operations);\n\t\treturn;\n\t}\n\tfor (const key of afterKeys) {\n\t\tif (overflowedBatches.has(operations)) return;\n\t\tif (Object.hasOwn(before, key)) diffValue(before[key]!, after[key]!, [...path, key], operations);\n\t\telse emitSet([...path, key], after[key]!, operations);\n\t}\n\tfor (const key of beforeKeys) {\n\t\tif (overflowedBatches.has(operations)) return;\n\t\tif (!Object.hasOwn(after, key)) emitOperation(operations, [\"d\", [...path, key] as unknown as NonEmptyPath]);\n\t}\n};\n\nconst diffValue = (before: JsonValue, after: JsonValue, path: Path, operations: Op[]): void => {\n\tif (before === after || overflowedBatches.has(operations)) return;\n\tif (typeof before === \"string\" && typeof after === \"string\" && path.length > 0) {\n\t\temitString(before, after, path as NonEmptyPath, operations);\n\t\treturn;\n\t}\n\tif (Array.isArray(before) && Array.isArray(after)) {\n\t\tdiffArray(before, after, path, operations);\n\t\treturn;\n\t}\n\tif (isContainer(before) && isContainer(after) && !Array.isArray(before) && !Array.isArray(after)) {\n\t\tdiffObject(before, after, path, operations);\n\t\treturn;\n\t}\n\temitSet(path, after, operations);\n};\n\nconst jsonCost = (value: JsonValue): number => {\n\tif (value === null) return 4;\n\tif (typeof value === \"string\") return value.length + 2;\n\tif (typeof value === \"number\") return String(value).length;\n\tif (typeof value === \"boolean\") return value ? 4 : 5;\n\tif (Array.isArray(value)) {\n\t\tlet cost = 2;\n\t\tfor (let index = 0; index < value.length; index++) cost += jsonCost(value[index]!) + (index === 0 ? 0 : 1);\n\t\treturn cost;\n\t}\n\tlet cost = 2;\n\tlet index = 0;\n\tfor (const key of Object.keys(value)) {\n\t\tcost += key.length + 3 + jsonCost(value[key]!) + (index++ === 0 ? 0 : 1);\n\t}\n\treturn cost;\n};\n\nconst pathCost = (path: Path): number => {\n\tlet cost = 2;\n\tfor (let index = 0; index < path.length; index++) {\n\t\tconst segment: Seg = path[index]!;\n\t\tcost += (typeof segment === \"string\" ? segment.length + 2 : String(segment).length) + (index === 0 ? 0 : 1);\n\t}\n\treturn cost;\n};\n\nconst operationCost = (operation: Op): number => {\n\tswitch (operation[0]) {\n\t\tcase \"r\":\n\t\t\treturn 6 + jsonCost(operation[1]);\n\t\tcase \"s\":\n\t\t\treturn 7 + pathCost(operation[1]) + jsonCost(operation[2]);\n\t\tcase \"d\":\n\t\t\treturn 6 + pathCost(operation[1]);\n\t\tcase \"a\":\n\t\t\treturn 7 + pathCost(operation[1]) + operation[2].length + 2;\n\t\tcase \"t\":\n\t\t\treturn 7 + pathCost(operation[1]) + String(operation[2]).length;\n\t\tcase \"p\":\n\t\t\treturn (\n\t\t\t\t10 +\n\t\t\t\tpathCost(operation[1]) +\n\t\t\t\tString(operation[2]).length +\n\t\t\t\tString(operation[3]).length +\n\t\t\t\tjsonCost(operation[4])\n\t\t\t);\n\t\tcase \"m\":\n\t\t\treturn 7 + pathCost(operation[1]) + jsonCost(operation[2]);\n\t}\n};\n\n/** Compute a compact operation batch from two immutable JSON revisions. */\nexport function diffRevisions(before: JsonValue, after: JsonValue): Op[] {\n\tconst operations: Op[] = [];\n\tdiffValue(before, after, [], operations);\n\tif (overflowedBatches.has(operations)) return [[\"r\", after]];\n\tif (operations.length === 0 || operations[0]?.[0] === \"r\") return operations;\n\tlet deltaCost = 2;\n\tfor (const operation of operations) deltaCost += operationCost(operation) + 1;\n\tif (deltaCost < 65_536) return operations;\n\tconst snapshotCost = jsonCost(after) + 6;\n\treturn deltaCost >= snapshotCost ? [[\"r\", after]] : operations;\n}\n"]}
|
|
1
|
+
{"version":3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IAC7E,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,MAAM,SAAS,IAAI,UAAU;QAAE,SAAS,IAAI,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9E,IAAI,SAAS,GAAG,MAAM;QAAE,OAAO,UAAU,CAAC;IAC1C,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,OAAO,SAAS,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;AAChE,CAAC","sourcesContent":["import type { JsonValue } from \"../json.ts\";\nimport { type NonEmptyPath, type Op, overlap, type Path, RESERVED_SEGMENTS, type Seg } from \"./index.ts\";\n\nconst DEFAULT_OVERLAP_SCAN = 65_536;\nconst MAX_DELTA_OPERATIONS = 4_096;\nconst overflowedBatches = new WeakSet<Op[]>();\n\nconst emitOperation = (operations: Op[], operation: Op): void => {\n\tif (overflowedBatches.has(operations)) return;\n\tif (operations.length >= MAX_DELTA_OPERATIONS) {\n\t\toverflowedBatches.add(operations);\n\t\treturn;\n\t}\n\toperations.push(operation);\n};\n\nconst isContainer = (value: JsonValue): value is JsonValue[] | Record<string, JsonValue> =>\n\tvalue !== null && typeof value === \"object\";\n\nconst emitSet = (path: Path, value: JsonValue, operations: Op[]): void => {\n\tif (path.length === 0) emitOperation(operations, [\"r\", value]);\n\telse emitOperation(operations, [\"s\", path as NonEmptyPath, value]);\n};\n\nconst equalJson = (left: JsonValue, right: JsonValue): boolean => {\n\tif (left === right) return true;\n\tif (!isContainer(left) || !isContainer(right) || Array.isArray(left) !== Array.isArray(right)) return false;\n\tif (Array.isArray(left)) {\n\t\tconst other = right as JsonValue[];\n\t\tif (left.length !== other.length) return false;\n\t\tfor (let index = 0; index < left.length; index++) {\n\t\t\tif (!equalJson(left[index]!, other[index]!)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tconst other = right as Record<string, JsonValue>;\n\tconst keys = Object.keys(left);\n\tif (keys.length !== Object.keys(other).length) return false;\n\tfor (const key of keys) {\n\t\tif (!Object.hasOwn(other, key) || !equalJson(left[key]!, other[key]!)) return false;\n\t}\n\treturn true;\n};\n\nconst permutation = (before: readonly JsonValue[], after: readonly JsonValue[]): number[] | undefined => {\n\tif (before.length !== after.length) return undefined;\n\tconst positions = new Map<JsonValue, { indices: number[]; used: number }>();\n\tfor (let index = 0; index < before.length; index++) {\n\t\tconst value = before[index]!;\n\t\tconst entry = positions.get(value);\n\t\tif (entry === undefined) positions.set(value, { indices: [index], used: 0 });\n\t\telse entry.indices.push(index);\n\t}\n\tconst result = new Array<number>(after.length);\n\tfor (let index = 0; index < after.length; index++) {\n\t\tconst entry = positions.get(after[index]!);\n\t\tif (entry === undefined || entry.used === entry.indices.length) return undefined;\n\t\tresult[index] = entry.indices[entry.used++]!;\n\t}\n\treturn result;\n};\n\nconst emitString = (before: string, after: string, path: NonEmptyPath, operations: Op[]): void => {\n\tif (before === after) return;\n\tif (after.length > before.length && after.slice(0, before.length) === before) {\n\t\temitOperation(operations, [\"a\", path, after.slice(before.length)]);\n\t\treturn;\n\t}\n\tconst shared = overlap(before, after, DEFAULT_OVERLAP_SCAN);\n\tif (shared === 0) {\n\t\temitOperation(operations, [\"s\", path, after]);\n\t\treturn;\n\t}\n\temitOperation(operations, [\"t\", path, before.length - shared]);\n\tif (after.length > shared) emitOperation(operations, [\"a\", path, after.slice(shared)]);\n};\n\ntype ArrayMatch = readonly [before: number, after: number];\n\ntype MatchCandidate = {\n\tbefore: number;\n\tafter: number;\n\tprevious: number;\n};\n\nconst MAX_IDENTITY_CANDIDATES = 200_000;\nconst MAX_SEMANTIC_CELLS = 65_536;\n\nconst sameValue = (left: JsonValue, right: JsonValue): boolean => left === right || equalJson(left, right);\n\nconst lcsMatches = (\n\tbefore: readonly JsonValue[],\n\tafter: readonly JsonValue[],\n\tequal: (left: JsonValue, right: JsonValue) => boolean,\n\tmaxCells: number,\n): ArrayMatch[] | undefined => {\n\tif (before.length === 0 || after.length === 0) return [];\n\tif (before.length * after.length > maxCells) return undefined;\n\tconst width = after.length + 1;\n\tconst lengths = new Uint32Array((before.length + 1) * width);\n\tfor (let left = before.length - 1; left >= 0; left--) {\n\t\tfor (let right = after.length - 1; right >= 0; right--) {\n\t\t\tconst at = left * width + right;\n\t\t\tlengths[at] = equal(before[left]!, after[right]!)\n\t\t\t\t? lengths[(left + 1) * width + right + 1]! + 1\n\t\t\t\t: Math.max(lengths[(left + 1) * width + right]!, lengths[left * width + right + 1]!);\n\t\t}\n\t}\n\tconst matches: ArrayMatch[] = [];\n\tlet left = 0;\n\tlet right = 0;\n\twhile (left < before.length && right < after.length) {\n\t\tif (\n\t\t\tequal(before[left]!, after[right]!) &&\n\t\t\tlengths[left * width + right] === lengths[(left + 1) * width + right + 1]! + 1\n\t\t) {\n\t\t\tmatches.push([left++, right++]);\n\t\t} else if (lengths[(left + 1) * width + right]! >= lengths[left * width + right + 1]!) left += 1;\n\t\telse right += 1;\n\t}\n\treturn matches;\n};\n\nconst semanticallyAligned = (left: JsonValue, right: JsonValue): boolean => {\n\tif (sameValue(left, right)) return true;\n\tif (!isContainer(left) || !isContainer(right) || Array.isArray(left) !== Array.isArray(right)) return false;\n\tif (Array.isArray(left) && Array.isArray(right)) {\n\t\tif (left.length !== right.length) return false;\n\t\treturn left.some((value, index) => isContainer(value) && value === right[index]);\n\t}\n\tconst leftObject = left as Record<string, JsonValue>;\n\tconst rightObject = right as Record<string, JsonValue>;\n\tfor (const key of Object.keys(leftObject)) {\n\t\tconst value = leftObject[key];\n\t\tif (isContainer(value) && Object.hasOwn(rightObject, key) && value === rightObject[key]) return true;\n\t}\n\treturn false;\n};\n\nconst lowerBound = (values: readonly number[], value: number): number => {\n\tlet low = 0;\n\tlet high = values.length;\n\twhile (low < high) {\n\t\tconst middle = (low + high) >>> 1;\n\t\tif (values[middle]! < value) low = middle + 1;\n\t\telse high = middle;\n\t}\n\treturn low;\n};\n\nconst identitySubsequence = (\n\tbefore: readonly JsonValue[],\n\tbeforeStart: number,\n\tbeforeEnd: number,\n\tafter: readonly JsonValue[],\n\tafterStart: number,\n\tafterEnd: number,\n): ArrayMatch[] | undefined => {\n\tconst beforeCount = beforeEnd - beforeStart;\n\tconst afterCount = afterEnd - afterStart;\n\tconst matches: ArrayMatch[] = [];\n\tif (afterCount < beforeCount) {\n\t\tlet beforeIndex = beforeStart;\n\t\tfor (let afterIndex = afterStart; afterIndex < afterEnd; afterIndex++) {\n\t\t\twhile (beforeIndex < beforeEnd && before[beforeIndex] !== after[afterIndex]) beforeIndex += 1;\n\t\t\tif (beforeIndex === beforeEnd) return undefined;\n\t\t\tmatches.push([beforeIndex++, afterIndex]);\n\t\t}\n\t\treturn matches;\n\t}\n\tif (beforeCount < afterCount) {\n\t\tlet afterIndex = afterStart;\n\t\tfor (let beforeIndex = beforeStart; beforeIndex < beforeEnd; beforeIndex++) {\n\t\t\twhile (afterIndex < afterEnd && before[beforeIndex] !== after[afterIndex]) afterIndex += 1;\n\t\t\tif (afterIndex === afterEnd) return undefined;\n\t\t\tmatches.push([beforeIndex, afterIndex++]);\n\t\t}\n\t\treturn matches;\n\t}\n\treturn undefined;\n};\n\nconst greedyIdentityAnchors = (\n\tpositions: ReadonlyMap<JsonValue, readonly number[]>,\n\tafter: readonly JsonValue[],\n\tafterStart: number,\n\tafterEnd: number,\n): ArrayMatch[] => {\n\tconst matches: ArrayMatch[] = [];\n\tlet previous = -1;\n\tfor (let afterIndex = afterStart; afterIndex < afterEnd; afterIndex++) {\n\t\tconst candidates = positions.get(after[afterIndex]!);\n\t\tif (candidates === undefined) continue;\n\t\tconst at = lowerBound(candidates, previous + 1);\n\t\tconst beforeIndex = candidates[at];\n\t\tif (beforeIndex === undefined) continue;\n\t\tmatches.push([beforeIndex, afterIndex]);\n\t\tprevious = beforeIndex;\n\t}\n\treturn matches;\n};\n\nconst identityAnchors = (\n\tbefore: readonly JsonValue[],\n\tbeforeStart: number,\n\tbeforeEnd: number,\n\tafter: readonly JsonValue[],\n\tafterStart: number,\n\tafterEnd: number,\n): ArrayMatch[] => {\n\tconst positions = new Map<JsonValue, number[]>();\n\tfor (let index = beforeStart; index < beforeEnd; index++) {\n\t\tconst value = before[index]!;\n\t\tconst existing = positions.get(value);\n\t\tif (existing === undefined) positions.set(value, [index]);\n\t\telse existing.push(index);\n\t}\n\tlet candidateCount = 0;\n\tfor (let index = afterStart; index < afterEnd; index++) {\n\t\tcandidateCount += positions.get(after[index]!)?.length ?? 0;\n\t\tif (candidateCount > MAX_IDENTITY_CANDIDATES) {\n\t\t\treturn greedyIdentityAnchors(positions, after, afterStart, afterEnd);\n\t\t}\n\t}\n\tif (candidateCount === 0) return [];\n\n\tconst candidates: MatchCandidate[] = [];\n\tconst tails: number[] = [];\n\tconst tailValues: number[] = [];\n\tfor (let afterIndex = afterStart; afterIndex < afterEnd; afterIndex++) {\n\t\tconst beforePositions = positions.get(after[afterIndex]!);\n\t\tif (beforePositions === undefined) continue;\n\t\tfor (let index = beforePositions.length - 1; index >= 0; index--) {\n\t\t\tconst beforeIndex = beforePositions[index]!;\n\t\t\tconst at = lowerBound(tailValues, beforeIndex);\n\t\t\tconst candidateIndex = candidates.length;\n\t\t\tcandidates.push({ before: beforeIndex, after: afterIndex, previous: at === 0 ? -1 : tails[at - 1]! });\n\t\t\ttails[at] = candidateIndex;\n\t\t\ttailValues[at] = beforeIndex;\n\t\t}\n\t}\n\tconst matches: ArrayMatch[] = [];\n\tlet candidateIndex = tails[tails.length - 1] ?? -1;\n\twhile (candidateIndex >= 0) {\n\t\tconst candidate = candidates[candidateIndex]!;\n\t\tmatches.push([candidate.before, candidate.after]);\n\t\tcandidateIndex = candidate.previous;\n\t}\n\tmatches.reverse();\n\treturn matches;\n};\n\nconst processArrayMatches = (\n\tbefore: JsonValue[],\n\tafter: JsonValue[],\n\tpath: Path,\n\toperations: Op[],\n\tbeforeStart: number,\n\tbeforeEnd: number,\n\tafterStart: number,\n\tafterEnd: number,\n\toutputStart: number,\n\tmatches: readonly ArrayMatch[],\n): void => {\n\tlet beforeAt = beforeStart;\n\tlet afterAt = afterStart;\n\tlet outputAt = outputStart;\n\tfor (const [beforeMatch, afterMatch] of matches) {\n\t\tif (overflowedBatches.has(operations)) return;\n\t\tdiffArrayRegion(before, after, path, operations, beforeAt, beforeMatch, afterAt, afterMatch, outputAt);\n\t\toutputAt += afterMatch - afterAt;\n\t\tif (!sameValue(before[beforeMatch]!, after[afterMatch]!)) {\n\t\t\tdiffValue(before[beforeMatch]!, after[afterMatch]!, [...path, outputAt], operations);\n\t\t}\n\t\toutputAt += 1;\n\t\tbeforeAt = beforeMatch + 1;\n\t\tafterAt = afterMatch + 1;\n\t}\n\tif (!overflowedBatches.has(operations)) {\n\t\tdiffArrayRegion(before, after, path, operations, beforeAt, beforeEnd, afterAt, afterEnd, outputAt);\n\t}\n};\n\nfunction diffArrayRegion(\n\tbefore: JsonValue[],\n\tafter: JsonValue[],\n\tpath: Path,\n\toperations: Op[],\n\tbeforeStart: number,\n\tbeforeEnd: number,\n\tafterStart: number,\n\tafterEnd: number,\n\toutputStart: number,\n): void {\n\tif (overflowedBatches.has(operations)) return;\n\twhile (beforeStart < beforeEnd && afterStart < afterEnd && sameValue(before[beforeStart]!, after[afterStart]!)) {\n\t\tbeforeStart += 1;\n\t\tafterStart += 1;\n\t\toutputStart += 1;\n\t}\n\twhile (beforeStart < beforeEnd && afterStart < afterEnd && sameValue(before[beforeEnd - 1]!, after[afterEnd - 1]!)) {\n\t\tbeforeEnd -= 1;\n\t\tafterEnd -= 1;\n\t}\n\tconst beforeCount = beforeEnd - beforeStart;\n\tconst afterCount = afterEnd - afterStart;\n\tif (beforeCount === 0 && afterCount === 0) return;\n\tif (beforeCount === 0 || afterCount === 0) {\n\t\temitOperation(operations, [\"p\", path, outputStart, beforeCount, after.slice(afterStart, afterEnd)]);\n\t\treturn;\n\t}\n\n\tif (beforeCount === afterCount) {\n\t\tconst positional: ArrayMatch[] = [];\n\t\tfor (let offset = 0; offset < beforeCount; offset++) {\n\t\t\tif (sameValue(before[beforeStart + offset]!, after[afterStart + offset]!)) {\n\t\t\t\tpositional.push([beforeStart + offset, afterStart + offset]);\n\t\t\t}\n\t\t}\n\t\tif (positional.length > 0) {\n\t\t\tprocessArrayMatches(\n\t\t\t\tbefore,\n\t\t\t\tafter,\n\t\t\t\tpath,\n\t\t\t\toperations,\n\t\t\t\tbeforeStart,\n\t\t\t\tbeforeEnd,\n\t\t\t\tafterStart,\n\t\t\t\tafterEnd,\n\t\t\t\toutputStart,\n\t\t\t\tpositional,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst subsequence = identitySubsequence(before, beforeStart, beforeEnd, after, afterStart, afterEnd);\n\tif (subsequence !== undefined && subsequence.length > 0) {\n\t\tprocessArrayMatches(\n\t\t\tbefore,\n\t\t\tafter,\n\t\t\tpath,\n\t\t\toperations,\n\t\t\tbeforeStart,\n\t\t\tbeforeEnd,\n\t\t\tafterStart,\n\t\t\tafterEnd,\n\t\t\toutputStart,\n\t\t\tsubsequence,\n\t\t);\n\t\treturn;\n\t}\n\n\tconst identity = identityAnchors(before, beforeStart, beforeEnd, after, afterStart, afterEnd);\n\tif (identity.length > 0) {\n\t\tprocessArrayMatches(\n\t\t\tbefore,\n\t\t\tafter,\n\t\t\tpath,\n\t\t\toperations,\n\t\t\tbeforeStart,\n\t\t\tbeforeEnd,\n\t\t\tafterStart,\n\t\t\tafterEnd,\n\t\t\toutputStart,\n\t\t\tidentity,\n\t\t);\n\t\treturn;\n\t}\n\n\tconst semantic = lcsMatches(\n\t\tbefore.slice(beforeStart, beforeEnd),\n\t\tafter.slice(afterStart, afterEnd),\n\t\tsemanticallyAligned,\n\t\tMAX_SEMANTIC_CELLS,\n\t);\n\tif (semantic !== undefined && semantic.length > 0) {\n\t\tconst absolute = semantic.map(\n\t\t\t([beforeIndex, afterIndex]) => [beforeStart + beforeIndex, afterStart + afterIndex] as const,\n\t\t);\n\t\tprocessArrayMatches(\n\t\t\tbefore,\n\t\t\tafter,\n\t\t\tpath,\n\t\t\toperations,\n\t\t\tbeforeStart,\n\t\t\tbeforeEnd,\n\t\t\tafterStart,\n\t\t\tafterEnd,\n\t\t\toutputStart,\n\t\t\tabsolute,\n\t\t);\n\t\treturn;\n\t}\n\n\tif (beforeCount === 1 && afterCount === 1) {\n\t\tdiffValue(before[beforeStart]!, after[afterStart]!, [...path, outputStart], operations);\n\t\treturn;\n\t}\n\temitOperation(operations, [\"p\", path, outputStart, beforeCount, after.slice(afterStart, afterEnd)]);\n}\n\nconst diffArray = (before: JsonValue[], after: JsonValue[], path: Path, operations: Op[]): void => {\n\tif (before === after || equalJson(before, after)) return;\n\tif (\n\t\tbefore.length === after.length &&\n\t\tbefore.length > 1 &&\n\t\t!sameValue(before[0]!, after[0]!) &&\n\t\t!sameValue(before[before.length - 1]!, after[after.length - 1]!)\n\t) {\n\t\tconst order = permutation(before, after);\n\t\tif (order !== undefined) {\n\t\t\temitOperation(operations, [\"m\", path, order]);\n\t\t\treturn;\n\t\t}\n\t}\n\tdiffArrayRegion(before, after, path, operations, 0, before.length, 0, after.length, 0);\n};\n\nconst diffObject = (\n\tbefore: Record<string, JsonValue>,\n\tafter: Record<string, JsonValue>,\n\tpath: Path,\n\toperations: Op[],\n): void => {\n\tconst beforeKeys = Object.keys(before);\n\tconst afterKeys = Object.keys(after);\n\tif ([...beforeKeys, ...afterKeys].some((key) => RESERVED_SEGMENTS.has(key))) {\n\t\tif (!equalJson(before, after)) emitSet(path, after, operations);\n\t\treturn;\n\t}\n\tfor (const key of afterKeys) {\n\t\tif (overflowedBatches.has(operations)) return;\n\t\tif (Object.hasOwn(before, key)) diffValue(before[key]!, after[key]!, [...path, key], operations);\n\t\telse emitSet([...path, key], after[key]!, operations);\n\t}\n\tfor (const key of beforeKeys) {\n\t\tif (overflowedBatches.has(operations)) return;\n\t\tif (!Object.hasOwn(after, key)) emitOperation(operations, [\"d\", [...path, key] as unknown as NonEmptyPath]);\n\t}\n};\n\nconst diffValue = (before: JsonValue, after: JsonValue, path: Path, operations: Op[]): void => {\n\tif (before === after || overflowedBatches.has(operations)) return;\n\tif (typeof before === \"string\" && typeof after === \"string\" && path.length > 0) {\n\t\temitString(before, after, path as NonEmptyPath, operations);\n\t\treturn;\n\t}\n\tif (Array.isArray(before) && Array.isArray(after)) {\n\t\tdiffArray(before, after, path, operations);\n\t\treturn;\n\t}\n\tif (isContainer(before) && isContainer(after) && !Array.isArray(before) && !Array.isArray(after)) {\n\t\tdiffObject(before, after, path, operations);\n\t\treturn;\n\t}\n\temitSet(path, after, operations);\n};\n\nconst jsonCost = (value: JsonValue): number => {\n\tif (value === null) return 4;\n\tif (typeof value === \"string\") return value.length + 2;\n\tif (typeof value === \"number\") return String(value).length;\n\tif (typeof value === \"boolean\") return value ? 4 : 5;\n\tif (Array.isArray(value)) {\n\t\tlet cost = 2;\n\t\tfor (let index = 0; index < value.length; index++) cost += jsonCost(value[index]!) + (index === 0 ? 0 : 1);\n\t\treturn cost;\n\t}\n\tlet cost = 2;\n\tlet index = 0;\n\tfor (const key of Object.keys(value)) {\n\t\tcost += key.length + 3 + jsonCost(value[key]!) + (index++ === 0 ? 0 : 1);\n\t}\n\treturn cost;\n};\n\nconst pathCost = (path: Path): number => {\n\tlet cost = 2;\n\tfor (let index = 0; index < path.length; index++) {\n\t\tconst segment: Seg = path[index]!;\n\t\tcost += (typeof segment === \"string\" ? segment.length + 2 : String(segment).length) + (index === 0 ? 0 : 1);\n\t}\n\treturn cost;\n};\n\nconst operationCost = (operation: Op): number => {\n\tswitch (operation[0]) {\n\t\tcase \"r\":\n\t\t\treturn 6 + jsonCost(operation[1]);\n\t\tcase \"s\":\n\t\t\treturn 7 + pathCost(operation[1]) + jsonCost(operation[2]);\n\t\tcase \"d\":\n\t\t\treturn 6 + pathCost(operation[1]);\n\t\tcase \"a\":\n\t\t\treturn 7 + pathCost(operation[1]) + operation[2].length + 2;\n\t\tcase \"t\":\n\t\t\treturn 7 + pathCost(operation[1]) + String(operation[2]).length;\n\t\tcase \"p\":\n\t\t\treturn (\n\t\t\t\t10 +\n\t\t\t\tpathCost(operation[1]) +\n\t\t\t\tString(operation[2]).length +\n\t\t\t\tString(operation[3]).length +\n\t\t\t\tjsonCost(operation[4])\n\t\t\t);\n\t\tcase \"m\":\n\t\t\treturn 7 + pathCost(operation[1]) + jsonCost(operation[2]);\n\t}\n};\n\n/** Compute a compact operation batch from two immutable JSON revisions. */\nexport function diffRevisions(before: JsonValue, after: JsonValue): Op[] {\n\tconst operations: Op[] = [];\n\tdiffValue(before, after, [], operations);\n\tif (overflowedBatches.has(operations)) return [[\"r\", after]];\n\tif (operations.length === 0 || operations[0]?.[0] === \"r\") return operations;\n\tlet deltaCost = 2;\n\tfor (const operation of operations) deltaCost += operationCost(operation) + 1;\n\tif (deltaCost < 65_536) return operations;\n\tconst snapshotCost = jsonCost(after) + 6;\n\treturn deltaCost >= snapshotCost ? [[\"r\", after]] : operations;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { JsonValue } from "../
|
|
2
|
-
export type { JsonValue } from "../
|
|
1
|
+
import type { JsonValue } from "../json.ts";
|
|
2
|
+
export type { JsonValue } from "../json.ts";
|
|
3
3
|
export type Seg = string | number;
|
|
4
4
|
export type Path = readonly Seg[];
|
|
5
5
|
export type NonEmptyPath = readonly [Seg, ...Seg[]];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delta/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delta/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAW5C,MAAM,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1E,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC,EAAE,IAAI,MAAM,CAkEnE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAQ/C;AAuBD,qBAAa,SAAU,SAAQ,KAAK;IACnC,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;IAC7B,YAAY,IAAI,EAAE,IAAI,GAAG,MAAM,EAI9B;CACD;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,CAAC,CAErE;AAgFD,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,CAAC,CAE9E;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,CAAC,CAsBnG;AAiHD,MAAM,WAAW,OAAO;IACvB,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC;CACrC;AAED;;;GAGG;AACH,wBAAgB,OAAO,IAAI,OAAO,CA6FjC;AAED,MAAM,WAAW,OAAO;IACvB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;CACtC;AAED,wBAAgB,OAAO,IAAI,OAAO,CAwEjC"}
|
|
@@ -388,12 +388,53 @@ export function applyImmutableBatches(target, batches) {
|
|
|
388
388
|
root = op[1];
|
|
389
389
|
continue;
|
|
390
390
|
}
|
|
391
|
+
if (op[0] === "p") {
|
|
392
|
+
const appended = appendCopy(root, op, owned);
|
|
393
|
+
if (appended !== undefined) {
|
|
394
|
+
root = appended;
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
391
398
|
root = copyContainers(root, op[0] === "p" || op[0] === "m" ? op[1] : op[1].slice(0, -1), owned);
|
|
392
399
|
root = applyOps(root, [op]);
|
|
393
400
|
}
|
|
394
401
|
}
|
|
395
402
|
return root;
|
|
396
403
|
}
|
|
404
|
+
/**
|
|
405
|
+
* An append to an array not yet copied in this replay, built as one copy with the items (`concat`) instead of a copy that
|
|
406
|
+
* the insert then grows, which copies it again. `undefined` for any other splice and for any path that is not a plain
|
|
407
|
+
* walk over own properties, which takes the general path and so fails with its errors.
|
|
408
|
+
*/
|
|
409
|
+
function appendCopy(root, op, owned) {
|
|
410
|
+
const [, path, index, deleteCount, items] = op;
|
|
411
|
+
if (deleteCount !== 0)
|
|
412
|
+
return undefined;
|
|
413
|
+
let target = root;
|
|
414
|
+
for (const segment of path) {
|
|
415
|
+
const valid = typeof segment === "string"
|
|
416
|
+
? !RESERVED_SEGMENTS.has(segment) && isObj(target) && !Array.isArray(target)
|
|
417
|
+
: Number.isInteger(segment) && segment >= 0 && Array.isArray(target);
|
|
418
|
+
if (!valid || !Object.hasOwn(target, segment))
|
|
419
|
+
return undefined;
|
|
420
|
+
target = target[segment];
|
|
421
|
+
}
|
|
422
|
+
if (!Array.isArray(target) || owned.has(target) || index !== target.length)
|
|
423
|
+
return undefined;
|
|
424
|
+
const appended = target.concat(items);
|
|
425
|
+
owned.add(appended);
|
|
426
|
+
if (path.length === 0)
|
|
427
|
+
return appended;
|
|
428
|
+
const parentPath = path.slice(0, -1);
|
|
429
|
+
const copiedRoot = copyContainers(root, parentPath, owned);
|
|
430
|
+
Object.defineProperty(resolve(copiedRoot, parentPath), path[path.length - 1], {
|
|
431
|
+
value: appended,
|
|
432
|
+
writable: true,
|
|
433
|
+
enumerable: true,
|
|
434
|
+
configurable: true,
|
|
435
|
+
});
|
|
436
|
+
return copiedRoot;
|
|
437
|
+
}
|
|
397
438
|
function copyContainers(root, path, owned) {
|
|
398
439
|
const copy = (value) => {
|
|
399
440
|
if (Array.isArray(value))
|