@opendatalabs/personal-server-ts-core 0.0.1-canary.052d47e → 0.0.1-canary.0620a9a
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/dist/additions/budget.d.ts +34 -0
- package/dist/additions/budget.d.ts.map +1 -0
- package/dist/additions/budget.js +144 -0
- package/dist/additions/budget.js.map +1 -0
- package/dist/additions/durable.d.ts +94 -0
- package/dist/additions/durable.d.ts.map +1 -0
- package/dist/additions/durable.js +823 -0
- package/dist/additions/durable.js.map +1 -0
- package/dist/additions/first-added.d.ts +204 -0
- package/dist/additions/first-added.d.ts.map +1 -0
- package/dist/additions/first-added.js +598 -0
- package/dist/additions/first-added.js.map +1 -0
- package/dist/additions/index.d.ts +9 -0
- package/dist/additions/index.d.ts.map +1 -0
- package/dist/additions/index.js +9 -0
- package/dist/additions/index.js.map +1 -0
- package/dist/additions/ledger-store.d.ts +69 -0
- package/dist/additions/ledger-store.d.ts.map +1 -0
- package/dist/additions/ledger-store.js +407 -0
- package/dist/additions/ledger-store.js.map +1 -0
- package/dist/additions/record-rules.d.ts +54 -0
- package/dist/additions/record-rules.d.ts.map +1 -0
- package/dist/additions/record-rules.js +198 -0
- package/dist/additions/record-rules.js.map +1 -0
- package/dist/additions/scope-lock.d.ts +14 -0
- package/dist/additions/scope-lock.d.ts.map +1 -0
- package/dist/additions/scope-lock.js +32 -0
- package/dist/additions/scope-lock.js.map +1 -0
- package/dist/additions/summary.d.ts +143 -0
- package/dist/additions/summary.d.ts.map +1 -0
- package/dist/additions/summary.js +279 -0
- package/dist/additions/summary.js.map +1 -0
- package/dist/additions/version-inventory.d.ts +86 -0
- package/dist/additions/version-inventory.d.ts.map +1 -0
- package/dist/additions/version-inventory.js +244 -0
- package/dist/additions/version-inventory.js.map +1 -0
- package/dist/api/index.d.ts +192 -8
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1227 -153
- package/dist/api/index.js.map +1 -1
- package/dist/api/oura-collection-requirements.d.ts +16 -0
- package/dist/api/oura-collection-requirements.d.ts.map +1 -0
- package/dist/api/oura-collection-requirements.js +70 -0
- package/dist/api/oura-collection-requirements.js.map +1 -0
- package/dist/api/raw-envelope.d.ts +3 -0
- package/dist/api/raw-envelope.d.ts.map +1 -0
- package/dist/api/raw-envelope.js +215 -0
- package/dist/api/raw-envelope.js.map +1 -0
- package/dist/api/scope-upload-batches.d.ts +18 -0
- package/dist/api/scope-upload-batches.d.ts.map +1 -0
- package/dist/api/scope-upload-batches.js +71 -0
- package/dist/api/scope-upload-batches.js.map +1 -0
- package/dist/api/scope-uploads.d.ts +112 -0
- package/dist/api/scope-uploads.d.ts.map +1 -0
- package/dist/api/scope-uploads.js +369 -0
- package/dist/api/scope-uploads.js.map +1 -0
- package/dist/auth/index.d.ts +3 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +3 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/proof-id.d.ts +8 -0
- package/dist/auth/proof-id.d.ts.map +1 -0
- package/dist/auth/proof-id.js +29 -0
- package/dist/auth/proof-id.js.map +1 -0
- package/dist/auth/request.d.ts +24 -0
- package/dist/auth/request.d.ts.map +1 -1
- package/dist/auth/request.js +99 -4
- package/dist/auth/request.js.map +1 -1
- package/dist/client.d.ts +70 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -0
- package/dist/client.js.map +1 -1
- package/dist/contracts/auth-device.d.ts +10 -0
- package/dist/contracts/auth-device.d.ts.map +1 -1
- package/dist/contracts/auth-device.js +2 -0
- package/dist/contracts/auth-device.js.map +1 -1
- package/dist/contracts/data.d.ts +102 -8
- package/dist/contracts/data.d.ts.map +1 -1
- package/dist/contracts/data.js +320 -47
- package/dist/contracts/data.js.map +1 -1
- package/dist/contracts/grants.d.ts.map +1 -1
- package/dist/contracts/grants.js +7 -0
- package/dist/contracts/grants.js.map +1 -1
- package/dist/contracts/index.d.ts +4 -2
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +3 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/oura-collection-requirements.d.ts +17 -0
- package/dist/contracts/oura-collection-requirements.d.ts.map +1 -0
- package/dist/contracts/oura-collection-requirements.js +49 -0
- package/dist/contracts/oura-collection-requirements.js.map +1 -0
- package/dist/contracts/sync.d.ts.map +1 -1
- package/dist/contracts/sync.js +1 -0
- package/dist/contracts/sync.js.map +1 -1
- package/dist/derivatives/answer-shape.d.ts +83 -0
- package/dist/derivatives/answer-shape.d.ts.map +1 -0
- package/dist/derivatives/answer-shape.js +320 -0
- package/dist/derivatives/answer-shape.js.map +1 -0
- package/dist/derivatives/api.d.ts +1 -1
- package/dist/derivatives/api.d.ts.map +1 -1
- package/dist/derivatives/api.js +8 -0
- package/dist/derivatives/api.js.map +1 -1
- package/dist/derivatives/compute.d.ts +9 -3
- package/dist/derivatives/compute.d.ts.map +1 -1
- package/dist/derivatives/compute.js +68 -6
- package/dist/derivatives/compute.js.map +1 -1
- package/dist/derivatives/index.d.ts +2 -1
- package/dist/derivatives/index.d.ts.map +1 -1
- package/dist/derivatives/index.js +2 -1
- package/dist/derivatives/index.js.map +1 -1
- package/dist/derivatives/prompt.d.ts +35 -0
- package/dist/derivatives/prompt.d.ts.map +1 -1
- package/dist/derivatives/prompt.js +96 -8
- package/dist/derivatives/prompt.js.map +1 -1
- package/dist/derivatives/registration.d.ts +6 -9
- package/dist/derivatives/registration.d.ts.map +1 -1
- package/dist/derivatives/registration.js +14 -6
- package/dist/derivatives/registration.js.map +1 -1
- package/dist/derivatives/scheduler.d.ts +39 -9
- package/dist/derivatives/scheduler.d.ts.map +1 -1
- package/dist/derivatives/scheduler.js +99 -8
- package/dist/derivatives/scheduler.js.map +1 -1
- package/dist/derivatives/store.d.ts.map +1 -1
- package/dist/derivatives/store.js +2 -0
- package/dist/derivatives/store.js.map +1 -1
- package/dist/derivatives/types.d.ts +13 -3
- package/dist/derivatives/types.d.ts.map +1 -1
- package/dist/derivatives/types.js +2 -0
- package/dist/derivatives/types.js.map +1 -1
- package/dist/errors/pdpp-catalog.d.ts +36 -0
- package/dist/errors/pdpp-catalog.d.ts.map +1 -0
- package/dist/errors/pdpp-catalog.js +86 -0
- package/dist/errors/pdpp-catalog.js.map +1 -0
- package/dist/grants/index.d.ts +2 -0
- package/dist/grants/index.d.ts.map +1 -1
- package/dist/grants/index.js +4 -0
- package/dist/grants/index.js.map +1 -1
- package/dist/grants/pdpp-binding-store.d.ts +89 -0
- package/dist/grants/pdpp-binding-store.d.ts.map +1 -0
- package/dist/grants/pdpp-binding-store.js +112 -0
- package/dist/grants/pdpp-binding-store.js.map +1 -0
- package/dist/grants/pdpp-binding.d.ts +169 -0
- package/dist/grants/pdpp-binding.d.ts.map +1 -0
- package/dist/grants/pdpp-binding.js +236 -0
- package/dist/grants/pdpp-binding.js.map +1 -0
- package/dist/legacy-projection/bindings.d.ts +31 -0
- package/dist/legacy-projection/bindings.d.ts.map +1 -0
- package/dist/legacy-projection/bindings.js +4512 -0
- package/dist/legacy-projection/bindings.js.map +1 -0
- package/dist/legacy-projection/claude-source-record.d.ts +22 -0
- package/dist/legacy-projection/claude-source-record.d.ts.map +1 -0
- package/dist/legacy-projection/claude-source-record.js +360 -0
- package/dist/legacy-projection/claude-source-record.js.map +1 -0
- package/dist/legacy-projection/declared-text.d.ts +41 -0
- package/dist/legacy-projection/declared-text.d.ts.map +1 -0
- package/dist/legacy-projection/declared-text.js +199 -0
- package/dist/legacy-projection/declared-text.js.map +1 -0
- package/dist/legacy-projection/github-browser-bindings.d.ts +3 -0
- package/dist/legacy-projection/github-browser-bindings.d.ts.map +1 -0
- package/dist/legacy-projection/github-browser-bindings.js +212 -0
- package/dist/legacy-projection/github-browser-bindings.js.map +1 -0
- package/dist/legacy-projection/github-legacy-fields.d.ts +6 -0
- package/dist/legacy-projection/github-legacy-fields.d.ts.map +1 -0
- package/dist/legacy-projection/github-legacy-fields.js +202 -0
- package/dist/legacy-projection/github-legacy-fields.js.map +1 -0
- package/dist/legacy-projection/index.d.ts +38 -0
- package/dist/legacy-projection/index.d.ts.map +1 -0
- package/dist/legacy-projection/index.js +231 -0
- package/dist/legacy-projection/index.js.map +1 -0
- package/dist/legacy-projection/meta-040-bindings.d.ts +3 -0
- package/dist/legacy-projection/meta-040-bindings.d.ts.map +1 -0
- package/dist/legacy-projection/meta-040-bindings.js +112 -0
- package/dist/legacy-projection/meta-040-bindings.js.map +1 -0
- package/dist/legacy-projection/oura-browser-bindings.d.ts +5 -0
- package/dist/legacy-projection/oura-browser-bindings.d.ts.map +1 -0
- package/dist/legacy-projection/oura-browser-bindings.js +141 -0
- package/dist/legacy-projection/oura-browser-bindings.js.map +1 -0
- package/dist/legacy-projection/provenance.d.ts +57 -0
- package/dist/legacy-projection/provenance.d.ts.map +1 -0
- package/dist/legacy-projection/provenance.js +2 -0
- package/dist/legacy-projection/provenance.js.map +1 -0
- package/dist/legacy-projection/strava-browser-bindings.d.ts +3 -0
- package/dist/legacy-projection/strava-browser-bindings.d.ts.map +1 -0
- package/dist/legacy-projection/strava-browser-bindings.js +32 -0
- package/dist/legacy-projection/strava-browser-bindings.js.map +1 -0
- package/dist/legacy-projection/test-debris.d.ts +2 -0
- package/dist/legacy-projection/test-debris.d.ts.map +1 -0
- package/dist/legacy-projection/test-debris.js +49 -0
- package/dist/legacy-projection/test-debris.js.map +1 -0
- package/dist/legacy-projection/types.d.ts +235 -0
- package/dist/legacy-projection/types.d.ts.map +1 -0
- package/dist/legacy-projection/types.js +2 -0
- package/dist/legacy-projection/types.js.map +1 -0
- package/dist/mcp/approval-url.d.ts +68 -0
- package/dist/mcp/approval-url.d.ts.map +1 -0
- package/dist/mcp/approval-url.js +95 -0
- package/dist/mcp/approval-url.js.map +1 -0
- package/dist/mcp/connection-api.d.ts +187 -3
- package/dist/mcp/connection-api.d.ts.map +1 -1
- package/dist/mcp/connection-api.js +600 -26
- package/dist/mcp/connection-api.js.map +1 -1
- package/dist/mcp/grantee.d.ts +1 -1
- package/dist/mcp/grantee.d.ts.map +1 -1
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +4 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/oauth-redirect.d.ts +14 -0
- package/dist/mcp/oauth-redirect.d.ts.map +1 -0
- package/dist/mcp/oauth-redirect.js +51 -0
- package/dist/mcp/oauth-redirect.js.map +1 -0
- package/dist/mcp/read-client.d.ts +5 -1
- package/dist/mcp/read-client.d.ts.map +1 -1
- package/dist/mcp/read-client.js +18 -4
- package/dist/mcp/read-client.js.map +1 -1
- package/dist/mcp/resources.d.ts.map +1 -1
- package/dist/mcp/resources.js +3 -0
- package/dist/mcp/resources.js.map +1 -1
- package/dist/mcp/server.d.ts +30 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +172 -17
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts +1 -1
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +17 -3
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/store.d.ts +10 -1
- package/dist/mcp/store.d.ts.map +1 -1
- package/dist/mcp/store.js +72 -0
- package/dist/mcp/store.js.map +1 -1
- package/dist/mcp/token-expiry.d.ts +48 -0
- package/dist/mcp/token-expiry.d.ts.map +1 -0
- package/dist/mcp/token-expiry.js +69 -0
- package/dist/mcp/token-expiry.js.map +1 -0
- package/dist/mcp/tools.d.ts +92 -3
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +513 -28
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/types.d.ts +103 -4
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/mcp/types.js +13 -1
- package/dist/mcp/types.js.map +1 -1
- package/dist/mcp/write-client.d.ts +81 -0
- package/dist/mcp/write-client.d.ts.map +1 -0
- package/dist/mcp/write-client.js +140 -0
- package/dist/mcp/write-client.js.map +1 -0
- package/dist/oura/history-policy.d.ts +12 -0
- package/dist/oura/history-policy.d.ts.map +1 -0
- package/dist/oura/history-policy.js +54 -0
- package/dist/oura/history-policy.js.map +1 -0
- package/dist/oura/index.d.ts +51 -0
- package/dist/oura/index.d.ts.map +1 -0
- package/dist/oura/index.js +315 -0
- package/dist/oura/index.js.map +1 -0
- package/dist/payment/own-app.d.ts +8 -0
- package/dist/payment/own-app.d.ts.map +1 -0
- package/dist/payment/own-app.js +47 -0
- package/dist/payment/own-app.js.map +1 -0
- package/dist/pdpp/approval.d.ts +271 -0
- package/dist/pdpp/approval.d.ts.map +1 -0
- package/dist/pdpp/approval.js +486 -0
- package/dist/pdpp/approval.js.map +1 -0
- package/dist/pdpp/client-identity.d.ts +88 -0
- package/dist/pdpp/client-identity.d.ts.map +1 -0
- package/dist/pdpp/client-identity.js +196 -0
- package/dist/pdpp/client-identity.js.map +1 -0
- package/dist/pdpp/client-metadata.d.ts +95 -0
- package/dist/pdpp/client-metadata.d.ts.map +1 -0
- package/dist/pdpp/client-metadata.js +96 -0
- package/dist/pdpp/client-metadata.js.map +1 -0
- package/dist/pdpp/commitments.d.ts +75 -0
- package/dist/pdpp/commitments.d.ts.map +1 -0
- package/dist/pdpp/commitments.js +113 -0
- package/dist/pdpp/commitments.js.map +1 -0
- package/dist/pdpp/declaration-limits.d.ts +7 -0
- package/dist/pdpp/declaration-limits.d.ts.map +1 -0
- package/dist/pdpp/declaration-limits.js +7 -0
- package/dist/pdpp/declaration-limits.js.map +1 -0
- package/dist/pdpp/declaration.d.ts +119 -0
- package/dist/pdpp/declaration.d.ts.map +1 -0
- package/dist/pdpp/declaration.js +837 -0
- package/dist/pdpp/declaration.js.map +1 -0
- package/dist/pdpp/index.d.ts +38 -0
- package/dist/pdpp/index.d.ts.map +1 -0
- package/dist/pdpp/index.js +24 -0
- package/dist/pdpp/index.js.map +1 -0
- package/dist/pdpp/issuance.d.ts +126 -0
- package/dist/pdpp/issuance.d.ts.map +1 -0
- package/dist/pdpp/issuance.js +184 -0
- package/dist/pdpp/issuance.js.map +1 -0
- package/dist/pdpp/pkce.d.ts +53 -0
- package/dist/pdpp/pkce.d.ts.map +1 -0
- package/dist/pdpp/pkce.js +109 -0
- package/dist/pdpp/pkce.js.map +1 -0
- package/dist/pdpp/redirect.d.ts +60 -0
- package/dist/pdpp/redirect.d.ts.map +1 -0
- package/dist/pdpp/redirect.js +125 -0
- package/dist/pdpp/redirect.js.map +1 -0
- package/dist/pdpp/resolve.d.ts +120 -0
- package/dist/pdpp/resolve.d.ts.map +1 -0
- package/dist/pdpp/resolve.js +491 -0
- package/dist/pdpp/resolve.js.map +1 -0
- package/dist/pdpp/review.d.ts +280 -0
- package/dist/pdpp/review.d.ts.map +1 -0
- package/dist/pdpp/review.js +205 -0
- package/dist/pdpp/review.js.map +1 -0
- package/dist/pdpp/selection.d.ts +79 -0
- package/dist/pdpp/selection.d.ts.map +1 -0
- package/dist/pdpp/selection.js +493 -0
- package/dist/pdpp/selection.js.map +1 -0
- package/dist/pdpp/store.d.ts +228 -0
- package/dist/pdpp/store.d.ts.map +1 -0
- package/dist/pdpp/store.js +542 -0
- package/dist/pdpp/store.js.map +1 -0
- package/dist/pdpp/time.d.ts +39 -0
- package/dist/pdpp/time.d.ts.map +1 -0
- package/dist/pdpp/time.js +173 -0
- package/dist/pdpp/time.js.map +1 -0
- package/dist/pdpp/tokens.d.ts +181 -0
- package/dist/pdpp/tokens.d.ts.map +1 -0
- package/dist/pdpp/tokens.js +421 -0
- package/dist/pdpp/tokens.js.map +1 -0
- package/dist/pdpp/types.d.ts +457 -0
- package/dist/pdpp/types.d.ts.map +1 -0
- package/dist/pdpp/types.js +68 -0
- package/dist/pdpp/types.js.map +1 -0
- package/dist/pdpp-version.d.ts +28 -0
- package/dist/pdpp-version.d.ts.map +1 -0
- package/dist/pdpp-version.js +28 -0
- package/dist/pdpp-version.js.map +1 -0
- package/dist/policy/data-read.d.ts +52 -1
- package/dist/policy/data-read.d.ts.map +1 -1
- package/dist/policy/data-read.js +157 -3
- package/dist/policy/data-read.js.map +1 -1
- package/dist/policy/data-write.d.ts.map +1 -1
- package/dist/policy/data-write.js +18 -1
- package/dist/policy/data-write.js.map +1 -1
- package/dist/policy/index.d.ts +2 -1
- package/dist/policy/index.d.ts.map +1 -1
- package/dist/policy/index.js +2 -1
- package/dist/policy/index.js.map +1 -1
- package/dist/policy/reserved-scopes.d.ts +10 -0
- package/dist/policy/reserved-scopes.d.ts.map +1 -0
- package/dist/policy/reserved-scopes.js +16 -0
- package/dist/policy/reserved-scopes.js.map +1 -0
- package/dist/ports/index.d.ts +266 -5
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/pdpp-auth.d.ts +119 -0
- package/dist/ports/pdpp-auth.d.ts.map +1 -0
- package/dist/ports/pdpp-auth.js +46 -0
- package/dist/ports/pdpp-auth.js.map +1 -0
- package/dist/ports/pdpp-auth.test-utils.d.ts +9 -0
- package/dist/ports/pdpp-auth.test-utils.d.ts.map +1 -0
- package/dist/ports/pdpp-auth.test-utils.js +18 -0
- package/dist/ports/pdpp-auth.test-utils.js.map +1 -0
- package/dist/publication/publish.d.ts +109 -0
- package/dist/publication/publish.d.ts.map +1 -0
- package/dist/publication/publish.js +263 -0
- package/dist/publication/publish.js.map +1 -0
- package/dist/replication/completion.d.ts +20 -0
- package/dist/replication/completion.d.ts.map +1 -0
- package/dist/replication/completion.js +73 -0
- package/dist/replication/completion.js.map +1 -0
- package/dist/replication/coordinator-state.d.ts +29 -0
- package/dist/replication/coordinator-state.d.ts.map +1 -0
- package/dist/replication/coordinator-state.js +88 -0
- package/dist/replication/coordinator-state.js.map +1 -0
- package/dist/replication/coordinator-state.test-utils.d.ts +32 -0
- package/dist/replication/coordinator-state.test-utils.d.ts.map +1 -0
- package/dist/replication/coordinator-state.test-utils.js +113 -0
- package/dist/replication/coordinator-state.test-utils.js.map +1 -0
- package/dist/replication/coordinator.d.ts +264 -0
- package/dist/replication/coordinator.d.ts.map +1 -0
- package/dist/replication/coordinator.js +499 -0
- package/dist/replication/coordinator.js.map +1 -0
- package/dist/replication/copies.d.ts +126 -0
- package/dist/replication/copies.d.ts.map +1 -0
- package/dist/replication/copies.js +437 -0
- package/dist/replication/copies.js.map +1 -0
- package/dist/replication/copy-promotion.d.ts +132 -0
- package/dist/replication/copy-promotion.d.ts.map +1 -0
- package/dist/replication/copy-promotion.js +126 -0
- package/dist/replication/copy-promotion.js.map +1 -0
- package/dist/replication/door.d.ts +33 -0
- package/dist/replication/door.d.ts.map +1 -0
- package/dist/replication/door.js +10 -0
- package/dist/replication/door.js.map +1 -0
- package/dist/replication/dpv2.d.ts +141 -0
- package/dist/replication/dpv2.d.ts.map +1 -0
- package/dist/replication/dpv2.js +320 -0
- package/dist/replication/dpv2.js.map +1 -0
- package/dist/replication/effects.d.ts +68 -0
- package/dist/replication/effects.d.ts.map +1 -0
- package/dist/replication/effects.js +89 -0
- package/dist/replication/effects.js.map +1 -0
- package/dist/replication/engine.d.ts +378 -0
- package/dist/replication/engine.d.ts.map +1 -0
- package/dist/replication/engine.js +3197 -0
- package/dist/replication/engine.js.map +1 -0
- package/dist/replication/envelope.d.ts +481 -0
- package/dist/replication/envelope.d.ts.map +1 -0
- package/dist/replication/envelope.js +192 -0
- package/dist/replication/envelope.js.map +1 -0
- package/dist/replication/evidence.d.ts +118 -0
- package/dist/replication/evidence.d.ts.map +1 -0
- package/dist/replication/evidence.js +198 -0
- package/dist/replication/evidence.js.map +1 -0
- package/dist/replication/finality.d.ts +16 -0
- package/dist/replication/finality.d.ts.map +1 -0
- package/dist/replication/finality.js +11 -0
- package/dist/replication/finality.js.map +1 -0
- package/dist/replication/fixtures.d.ts +16 -0
- package/dist/replication/fixtures.d.ts.map +1 -0
- package/dist/replication/fixtures.js +47 -0
- package/dist/replication/fixtures.js.map +1 -0
- package/dist/replication/host-config.d.ts +52 -0
- package/dist/replication/host-config.d.ts.map +1 -0
- package/dist/replication/host-config.js +111 -0
- package/dist/replication/host-config.js.map +1 -0
- package/dist/replication/host-driver.d.ts +95 -0
- package/dist/replication/host-driver.d.ts.map +1 -0
- package/dist/replication/host-driver.js +202 -0
- package/dist/replication/host-driver.js.map +1 -0
- package/dist/replication/host-ports.d.ts +48 -0
- package/dist/replication/host-ports.d.ts.map +1 -0
- package/dist/replication/host-ports.js +69 -0
- package/dist/replication/host-ports.js.map +1 -0
- package/dist/replication/identity.d.ts +13 -0
- package/dist/replication/identity.d.ts.map +1 -0
- package/dist/replication/identity.js +22 -0
- package/dist/replication/identity.js.map +1 -0
- package/dist/replication/limits.d.ts +124 -0
- package/dist/replication/limits.d.ts.map +1 -0
- package/dist/replication/limits.js +182 -0
- package/dist/replication/limits.js.map +1 -0
- package/dist/replication/merge-plan.d.ts +92 -0
- package/dist/replication/merge-plan.d.ts.map +1 -0
- package/dist/replication/merge-plan.js +229 -0
- package/dist/replication/merge-plan.js.map +1 -0
- package/dist/replication/namespace.d.ts +4 -0
- package/dist/replication/namespace.d.ts.map +1 -0
- package/dist/replication/namespace.js +7 -0
- package/dist/replication/namespace.js.map +1 -0
- package/dist/replication/outcome.d.ts +178 -0
- package/dist/replication/outcome.d.ts.map +1 -0
- package/dist/replication/outcome.js +83 -0
- package/dist/replication/outcome.js.map +1 -0
- package/dist/replication/payload.d.ts +39 -0
- package/dist/replication/payload.d.ts.map +1 -0
- package/dist/replication/payload.js +137 -0
- package/dist/replication/payload.js.map +1 -0
- package/dist/replication/preparation.d.ts +42 -0
- package/dist/replication/preparation.d.ts.map +1 -0
- package/dist/replication/preparation.js +118 -0
- package/dist/replication/preparation.js.map +1 -0
- package/dist/replication/rebaseline.d.ts +33 -0
- package/dist/replication/rebaseline.d.ts.map +1 -0
- package/dist/replication/rebaseline.js +40 -0
- package/dist/replication/rebaseline.js.map +1 -0
- package/dist/replication/rebinding.d.ts +43 -0
- package/dist/replication/rebinding.d.ts.map +1 -0
- package/dist/replication/rebinding.js +52 -0
- package/dist/replication/rebinding.js.map +1 -0
- package/dist/replication/receive.d.ts +57 -0
- package/dist/replication/receive.d.ts.map +1 -0
- package/dist/replication/receive.js +114 -0
- package/dist/replication/receive.js.map +1 -0
- package/dist/replication/record-reducer.d.ts +16 -0
- package/dist/replication/record-reducer.d.ts.map +1 -0
- package/dist/replication/record-reducer.js +52 -0
- package/dist/replication/record-reducer.js.map +1 -0
- package/dist/replication/revision.d.ts +24 -0
- package/dist/replication/revision.d.ts.map +1 -0
- package/dist/replication/revision.js +35 -0
- package/dist/replication/revision.js.map +1 -0
- package/dist/replication/roster.d.ts +53 -0
- package/dist/replication/roster.d.ts.map +1 -0
- package/dist/replication/roster.js +115 -0
- package/dist/replication/roster.js.map +1 -0
- package/dist/replication/schedule.d.ts +73 -0
- package/dist/replication/schedule.d.ts.map +1 -0
- package/dist/replication/schedule.js +182 -0
- package/dist/replication/schedule.js.map +1 -0
- package/dist/replication/stream.d.ts +73 -0
- package/dist/replication/stream.d.ts.map +1 -0
- package/dist/replication/stream.js +542 -0
- package/dist/replication/stream.js.map +1 -0
- package/dist/replication/transport.d.ts +236 -0
- package/dist/replication/transport.d.ts.map +1 -0
- package/dist/replication/transport.js +440 -0
- package/dist/replication/transport.js.map +1 -0
- package/dist/replication/visibility-engine.d.ts +337 -0
- package/dist/replication/visibility-engine.d.ts.map +1 -0
- package/dist/replication/visibility-engine.js +602 -0
- package/dist/replication/visibility-engine.js.map +1 -0
- package/dist/replication/visibility-policy.d.ts +26 -0
- package/dist/replication/visibility-policy.d.ts.map +1 -0
- package/dist/replication/visibility-policy.js +33 -0
- package/dist/replication/visibility-policy.js.map +1 -0
- package/dist/replication/writer-identity-store.d.ts +100 -0
- package/dist/replication/writer-identity-store.d.ts.map +1 -0
- package/dist/replication/writer-identity-store.js +218 -0
- package/dist/replication/writer-identity-store.js.map +1 -0
- package/dist/replication/writer-identity.d.ts +252 -0
- package/dist/replication/writer-identity.d.ts.map +1 -0
- package/dist/replication/writer-identity.js +281 -0
- package/dist/replication/writer-identity.js.map +1 -0
- package/dist/replication/writer-identity.test-utils.d.ts +24 -0
- package/dist/replication/writer-identity.test-utils.d.ts.map +1 -0
- package/dist/replication/writer-identity.test-utils.js +86 -0
- package/dist/replication/writer-identity.test-utils.js.map +1 -0
- package/dist/schemas/server-config.d.ts +71 -0
- package/dist/schemas/server-config.d.ts.map +1 -1
- package/dist/schemas/server-config.js +151 -0
- package/dist/schemas/server-config.js.map +1 -1
- package/dist/signing/request-signer.d.ts +2 -0
- package/dist/signing/request-signer.d.ts.map +1 -1
- package/dist/signing/request-signer.js +1 -0
- package/dist/signing/request-signer.js.map +1 -1
- package/dist/storage/adapters/index.d.ts +3 -1
- package/dist/storage/adapters/index.d.ts.map +1 -1
- package/dist/storage/adapters/index.js +2 -0
- package/dist/storage/adapters/index.js.map +1 -1
- package/dist/storage/adapters/interface.d.ts +21 -1
- package/dist/storage/adapters/interface.d.ts.map +1 -1
- package/dist/storage/adapters/interface.js +13 -1
- package/dist/storage/adapters/interface.js.map +1 -1
- package/dist/storage/adapters/sdk.d.ts +2 -1
- package/dist/storage/adapters/sdk.d.ts.map +1 -1
- package/dist/storage/adapters/sdk.js +21 -3
- package/dist/storage/adapters/sdk.js.map +1 -1
- package/dist/storage/adapters/vana-audience.d.ts +24 -0
- package/dist/storage/adapters/vana-audience.d.ts.map +1 -0
- package/dist/storage/adapters/vana-audience.js +87 -0
- package/dist/storage/adapters/vana-audience.js.map +1 -0
- package/dist/storage/adapters/vana.d.ts +5 -3
- package/dist/storage/adapters/vana.d.ts.map +1 -1
- package/dist/storage/adapters/vana.js +69 -23
- package/dist/storage/adapters/vana.js.map +1 -1
- package/dist/storage/blocks/cursor.d.ts +5 -1
- package/dist/storage/blocks/cursor.d.ts.map +1 -1
- package/dist/storage/blocks/cursor.js +13 -1
- package/dist/storage/blocks/cursor.js.map +1 -1
- package/dist/storage/blocks/page.d.ts +18 -0
- package/dist/storage/blocks/page.d.ts.map +1 -0
- package/dist/storage/blocks/page.js +113 -0
- package/dist/storage/blocks/page.js.map +1 -0
- package/dist/storage/canonical-legacy-projection.d.ts +262 -0
- package/dist/storage/canonical-legacy-projection.d.ts.map +1 -0
- package/dist/storage/canonical-legacy-projection.js +759 -0
- package/dist/storage/canonical-legacy-projection.js.map +1 -0
- package/dist/storage/hierarchy/paths.d.ts.map +1 -1
- package/dist/storage/hierarchy/paths.js +9 -2
- package/dist/storage/hierarchy/paths.js.map +1 -1
- package/dist/storage/index/manager.d.ts +30 -3
- package/dist/storage/index/manager.d.ts.map +1 -1
- package/dist/storage/index/schema.d.ts +1 -1
- package/dist/storage/index/schema.js +1 -1
- package/dist/storage/index/types.d.ts +7 -1
- package/dist/storage/index/types.d.ts.map +1 -1
- package/dist/storage/legacy-projection.d.ts +88 -0
- package/dist/storage/legacy-projection.d.ts.map +1 -0
- package/dist/storage/legacy-projection.js +755 -0
- package/dist/storage/legacy-projection.js.map +1 -0
- package/dist/storage/legacy-scope-coverage-exceptions.d.ts +13 -0
- package/dist/storage/legacy-scope-coverage-exceptions.d.ts.map +1 -0
- package/dist/storage/legacy-scope-coverage-exceptions.js +14 -0
- package/dist/storage/legacy-scope-coverage-exceptions.js.map +1 -0
- package/dist/storage/legacy-scope-coverage.d.ts +53 -0
- package/dist/storage/legacy-scope-coverage.d.ts.map +1 -0
- package/dist/storage/legacy-scope-coverage.js +416 -0
- package/dist/storage/legacy-scope-coverage.js.map +1 -0
- package/dist/storage/legacy-scope-entity-keys.d.ts +17 -0
- package/dist/storage/legacy-scope-entity-keys.d.ts.map +1 -0
- package/dist/storage/legacy-scope-entity-keys.js +109 -0
- package/dist/storage/legacy-scope-entity-keys.js.map +1 -0
- package/dist/storage/legacy-scope-view.d.ts +206 -0
- package/dist/storage/legacy-scope-view.d.ts.map +1 -0
- package/dist/storage/legacy-scope-view.js +1061 -0
- package/dist/storage/legacy-scope-view.js.map +1 -0
- package/dist/storage/pdpp-records/completion.d.ts +91 -0
- package/dist/storage/pdpp-records/completion.d.ts.map +1 -0
- package/dist/storage/pdpp-records/completion.js +170 -0
- package/dist/storage/pdpp-records/completion.js.map +1 -0
- package/dist/storage/pdpp-records/cursor.d.ts +86 -0
- package/dist/storage/pdpp-records/cursor.d.ts.map +1 -0
- package/dist/storage/pdpp-records/cursor.js +56 -0
- package/dist/storage/pdpp-records/cursor.js.map +1 -0
- package/dist/storage/pdpp-records/declaration-witness.d.ts +58 -0
- package/dist/storage/pdpp-records/declaration-witness.d.ts.map +1 -0
- package/dist/storage/pdpp-records/declaration-witness.js +230 -0
- package/dist/storage/pdpp-records/declaration-witness.js.map +1 -0
- package/dist/storage/pdpp-records/enforcement.d.ts +39 -0
- package/dist/storage/pdpp-records/enforcement.d.ts.map +1 -0
- package/dist/storage/pdpp-records/enforcement.js +143 -0
- package/dist/storage/pdpp-records/enforcement.js.map +1 -0
- package/dist/storage/pdpp-records/index.d.ts +7 -0
- package/dist/storage/pdpp-records/index.d.ts.map +1 -0
- package/dist/storage/pdpp-records/index.js +6 -0
- package/dist/storage/pdpp-records/index.js.map +1 -0
- package/dist/storage/pdpp-records/ingest-plan.d.ts +39 -0
- package/dist/storage/pdpp-records/ingest-plan.d.ts.map +1 -0
- package/dist/storage/pdpp-records/ingest-plan.js +103 -0
- package/dist/storage/pdpp-records/ingest-plan.js.map +1 -0
- package/dist/storage/pdpp-records/interface.d.ts +111 -0
- package/dist/storage/pdpp-records/interface.d.ts.map +1 -0
- package/dist/storage/pdpp-records/interface.js +2 -0
- package/dist/storage/pdpp-records/interface.js.map +1 -0
- package/dist/storage/pdpp-records/list-page.d.ts +35 -0
- package/dist/storage/pdpp-records/list-page.d.ts.map +1 -0
- package/dist/storage/pdpp-records/list-page.js +106 -0
- package/dist/storage/pdpp-records/list-page.js.map +1 -0
- package/dist/storage/pdpp-records/memory-store.d.ts +9 -0
- package/dist/storage/pdpp-records/memory-store.d.ts.map +1 -0
- package/dist/storage/pdpp-records/memory-store.js +462 -0
- package/dist/storage/pdpp-records/memory-store.js.map +1 -0
- package/dist/storage/pdpp-records/portable.d.ts +12 -0
- package/dist/storage/pdpp-records/portable.d.ts.map +1 -0
- package/dist/storage/pdpp-records/portable.js +11 -0
- package/dist/storage/pdpp-records/portable.js.map +1 -0
- package/dist/storage/pdpp-records/read-port.d.ts +44 -0
- package/dist/storage/pdpp-records/read-port.d.ts.map +1 -0
- package/dist/storage/pdpp-records/read-port.js +22 -0
- package/dist/storage/pdpp-records/read-port.js.map +1 -0
- package/dist/storage/pdpp-records/record-key.d.ts +52 -0
- package/dist/storage/pdpp-records/record-key.d.ts.map +1 -0
- package/dist/storage/pdpp-records/record-key.js +97 -0
- package/dist/storage/pdpp-records/record-key.js.map +1 -0
- package/dist/storage/pdpp-records/replication-journal.d.ts +20 -0
- package/dist/storage/pdpp-records/replication-journal.d.ts.map +1 -0
- package/dist/storage/pdpp-records/replication-journal.js +2 -0
- package/dist/storage/pdpp-records/replication-journal.js.map +1 -0
- package/dist/storage/pdpp-records/schema.d.ts +41 -0
- package/dist/storage/pdpp-records/schema.d.ts.map +1 -0
- package/dist/storage/pdpp-records/schema.js +153 -0
- package/dist/storage/pdpp-records/schema.js.map +1 -0
- package/dist/storage/pdpp-records/stream-declaration.d.ts +86 -0
- package/dist/storage/pdpp-records/stream-declaration.d.ts.map +1 -0
- package/dist/storage/pdpp-records/stream-declaration.js +48 -0
- package/dist/storage/pdpp-records/stream-declaration.js.map +1 -0
- package/dist/storage/pdpp-records/sync-selection.d.ts +4 -0
- package/dist/storage/pdpp-records/sync-selection.d.ts.map +1 -0
- package/dist/storage/pdpp-records/sync-selection.js +37 -0
- package/dist/storage/pdpp-records/sync-selection.js.map +1 -0
- package/dist/storage/pdpp-records/types.d.ts +202 -0
- package/dist/storage/pdpp-records/types.d.ts.map +1 -0
- package/dist/storage/pdpp-records/types.js +38 -0
- package/dist/storage/pdpp-records/types.js.map +1 -0
- package/dist/stream-sync/artifacts.d.ts +31 -0
- package/dist/stream-sync/artifacts.d.ts.map +1 -0
- package/dist/stream-sync/artifacts.js +106 -0
- package/dist/stream-sync/artifacts.js.map +1 -0
- package/dist/stream-sync/blobs.d.ts +11 -0
- package/dist/stream-sync/blobs.d.ts.map +1 -0
- package/dist/stream-sync/blobs.js +34 -0
- package/dist/stream-sync/blobs.js.map +1 -0
- package/dist/stream-sync/crypto.d.ts +21 -0
- package/dist/stream-sync/crypto.d.ts.map +1 -0
- package/dist/stream-sync/crypto.js +45 -0
- package/dist/stream-sync/crypto.js.map +1 -0
- package/dist/stream-sync/home.d.ts +46 -0
- package/dist/stream-sync/home.d.ts.map +1 -0
- package/dist/stream-sync/home.js +37 -0
- package/dist/stream-sync/home.js.map +1 -0
- package/dist/stream-sync/index.d.ts +14 -0
- package/dist/stream-sync/index.d.ts.map +1 -0
- package/dist/stream-sync/index.js +14 -0
- package/dist/stream-sync/index.js.map +1 -0
- package/dist/stream-sync/intake.d.ts +165 -0
- package/dist/stream-sync/intake.d.ts.map +1 -0
- package/dist/stream-sync/intake.js +467 -0
- package/dist/stream-sync/intake.js.map +1 -0
- package/dist/stream-sync/io-barrier.d.ts +39 -0
- package/dist/stream-sync/io-barrier.d.ts.map +1 -0
- package/dist/stream-sync/io-barrier.js +130 -0
- package/dist/stream-sync/io-barrier.js.map +1 -0
- package/dist/stream-sync/memory-files.d.ts +6 -0
- package/dist/stream-sync/memory-files.d.ts.map +1 -0
- package/dist/stream-sync/memory-files.js +50 -0
- package/dist/stream-sync/memory-files.js.map +1 -0
- package/dist/stream-sync/ports.d.ts +134 -0
- package/dist/stream-sync/ports.d.ts.map +1 -0
- package/dist/stream-sync/ports.js +26 -0
- package/dist/stream-sync/ports.js.map +1 -0
- package/dist/stream-sync/publish-plan.d.ts +157 -0
- package/dist/stream-sync/publish-plan.d.ts.map +1 -0
- package/dist/stream-sync/publish-plan.js +212 -0
- package/dist/stream-sync/publish-plan.js.map +1 -0
- package/dist/stream-sync/registry.d.ts +19 -0
- package/dist/stream-sync/registry.d.ts.map +1 -0
- package/dist/stream-sync/registry.js +125 -0
- package/dist/stream-sync/registry.js.map +1 -0
- package/dist/stream-sync/scope-routing.d.ts +17 -0
- package/dist/stream-sync/scope-routing.d.ts.map +1 -0
- package/dist/stream-sync/scope-routing.js +24 -0
- package/dist/stream-sync/scope-routing.js.map +1 -0
- package/dist/stream-sync/spool.d.ts +69 -0
- package/dist/stream-sync/spool.d.ts.map +1 -0
- package/dist/stream-sync/spool.js +197 -0
- package/dist/stream-sync/spool.js.map +1 -0
- package/dist/stream-sync/writer-overlay.d.ts +19 -0
- package/dist/stream-sync/writer-overlay.d.ts.map +1 -0
- package/dist/stream-sync/writer-overlay.js +55 -0
- package/dist/stream-sync/writer-overlay.js.map +1 -0
- package/dist/stream-sync/writer.d.ts +404 -0
- package/dist/stream-sync/writer.d.ts.map +1 -0
- package/dist/stream-sync/writer.js +1994 -0
- package/dist/stream-sync/writer.js.map +1 -0
- package/dist/stream-sync-read/fold.d.ts +69 -0
- package/dist/stream-sync-read/fold.d.ts.map +1 -0
- package/dist/stream-sync-read/fold.js +83 -0
- package/dist/stream-sync-read/fold.js.map +1 -0
- package/dist/stream-sync-read/importer.d.ts +81 -0
- package/dist/stream-sync-read/importer.d.ts.map +1 -0
- package/dist/stream-sync-read/importer.js +226 -0
- package/dist/stream-sync-read/importer.js.map +1 -0
- package/dist/stream-sync-read/index.d.ts +8 -0
- package/dist/stream-sync-read/index.d.ts.map +1 -0
- package/dist/stream-sync-read/index.js +5 -0
- package/dist/stream-sync-read/index.js.map +1 -0
- package/dist/stream-sync-read/keys.d.ts +16 -0
- package/dist/stream-sync-read/keys.d.ts.map +1 -0
- package/dist/stream-sync-read/keys.js +48 -0
- package/dist/stream-sync-read/keys.js.map +1 -0
- package/dist/stream-sync-read/lines.d.ts +37 -0
- package/dist/stream-sync-read/lines.d.ts.map +1 -0
- package/dist/stream-sync-read/lines.js +98 -0
- package/dist/stream-sync-read/lines.js.map +1 -0
- package/dist/stream-sync-read/memory-files.d.ts +6 -0
- package/dist/stream-sync-read/memory-files.d.ts.map +1 -0
- package/dist/stream-sync-read/memory-files.js +34 -0
- package/dist/stream-sync-read/memory-files.js.map +1 -0
- package/dist/stream-sync-read/mirror.d.ts +80 -0
- package/dist/stream-sync-read/mirror.d.ts.map +1 -0
- package/dist/stream-sync-read/mirror.js +189 -0
- package/dist/stream-sync-read/mirror.js.map +1 -0
- package/dist/stream-sync-read/ports.d.ts +155 -0
- package/dist/stream-sync-read/ports.d.ts.map +1 -0
- package/dist/stream-sync-read/ports.js +9 -0
- package/dist/stream-sync-read/ports.js.map +1 -0
- package/dist/stream-sync-read/projection.d.ts +47 -0
- package/dist/stream-sync-read/projection.d.ts.map +1 -0
- package/dist/stream-sync-read/projection.js +338 -0
- package/dist/stream-sync-read/projection.js.map +1 -0
- package/dist/stream-sync-read/routing.d.ts +27 -0
- package/dist/stream-sync-read/routing.d.ts.map +1 -0
- package/dist/stream-sync-read/routing.js +49 -0
- package/dist/stream-sync-read/routing.js.map +1 -0
- package/dist/stream-sync-read/service-fixture.d.ts +94 -0
- package/dist/stream-sync-read/service-fixture.d.ts.map +1 -0
- package/dist/stream-sync-read/service-fixture.js +227 -0
- package/dist/stream-sync-read/service-fixture.js.map +1 -0
- package/dist/stream-sync-read/service.d.ts +260 -0
- package/dist/stream-sync-read/service.d.ts.map +1 -0
- package/dist/stream-sync-read/service.js +975 -0
- package/dist/stream-sync-read/service.js.map +1 -0
- package/dist/stream-sync-read/testing.d.ts +54 -0
- package/dist/stream-sync-read/testing.d.ts.map +1 -0
- package/dist/stream-sync-read/testing.js +80 -0
- package/dist/stream-sync-read/testing.js.map +1 -0
- package/dist/stream-sync-read/view-store.d.ts +98 -0
- package/dist/stream-sync-read/view-store.d.ts.map +1 -0
- package/dist/stream-sync-read/view-store.js +278 -0
- package/dist/stream-sync-read/view-store.js.map +1 -0
- package/dist/stream-sync-read/writer-rig.d.ts +122 -0
- package/dist/stream-sync-read/writer-rig.d.ts.map +1 -0
- package/dist/stream-sync-read/writer-rig.js +301 -0
- package/dist/stream-sync-read/writer-rig.js.map +1 -0
- package/dist/sync/data-point-feed.d.ts +3 -0
- package/dist/sync/data-point-feed.d.ts.map +1 -1
- package/dist/sync/data-point-feed.js +20 -1
- package/dist/sync/data-point-feed.js.map +1 -1
- package/dist/sync/delete-data-port.d.ts +19 -0
- package/dist/sync/delete-data-port.d.ts.map +1 -1
- package/dist/sync/delete-data-port.js +42 -9
- package/dist/sync/delete-data-port.js.map +1 -1
- package/dist/sync/engine/sync-manager.d.ts +21 -1
- package/dist/sync/engine/sync-manager.d.ts.map +1 -1
- package/dist/sync/engine/sync-manager.js +140 -11
- package/dist/sync/engine/sync-manager.js.map +1 -1
- package/dist/sync/index.d.ts +6 -2
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +7 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/pdpp-import.d.ts +192 -0
- package/dist/sync/pdpp-import.d.ts.map +1 -0
- package/dist/sync/pdpp-import.js +441 -0
- package/dist/sync/pdpp-import.js.map +1 -0
- package/dist/sync/pending-blob-deletions.d.ts +18 -2
- package/dist/sync/pending-blob-deletions.d.ts.map +1 -1
- package/dist/sync/pending-blob-deletions.js +97 -23
- package/dist/sync/pending-blob-deletions.js.map +1 -1
- package/dist/sync/scope-deletions.d.ts +12 -0
- package/dist/sync/scope-deletions.d.ts.map +1 -1
- package/dist/sync/scope-deletions.js +99 -25
- package/dist/sync/scope-deletions.js.map +1 -1
- package/dist/sync/tombstone-finality.d.ts +36 -0
- package/dist/sync/tombstone-finality.d.ts.map +1 -0
- package/dist/sync/tombstone-finality.js +142 -0
- package/dist/sync/tombstone-finality.js.map +1 -0
- package/dist/sync/tombstone-resubmits.d.ts +61 -0
- package/dist/sync/tombstone-resubmits.d.ts.map +1 -0
- package/dist/sync/tombstone-resubmits.js +85 -0
- package/dist/sync/tombstone-resubmits.js.map +1 -0
- package/dist/sync/types.d.ts +10 -0
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/workers/delete.d.ts +54 -5
- package/dist/sync/workers/delete.d.ts.map +1 -1
- package/dist/sync/workers/delete.js +594 -170
- package/dist/sync/workers/delete.js.map +1 -1
- package/dist/sync/workers/download.d.ts +42 -1
- package/dist/sync/workers/download.d.ts.map +1 -1
- package/dist/sync/workers/download.js +344 -24
- package/dist/sync/workers/download.js.map +1 -1
- package/dist/sync/workers/lost-data-points.d.ts +38 -0
- package/dist/sync/workers/lost-data-points.d.ts.map +1 -0
- package/dist/sync/workers/lost-data-points.js +72 -0
- package/dist/sync/workers/lost-data-points.js.map +1 -0
- package/dist/sync/workers/upload.d.ts +27 -6
- package/dist/sync/workers/upload.d.ts.map +1 -1
- package/dist/sync/workers/upload.js +169 -274
- package/dist/sync/workers/upload.js.map +1 -1
- package/dist/test-utils/memory-storage.d.ts +1 -1
- package/dist/test-utils/memory-storage.d.ts.map +1 -1
- package/dist/test-utils/memory-storage.js +83 -17
- package/dist/test-utils/memory-storage.js.map +1 -1
- package/dist/write/attribution.d.ts.map +1 -1
- package/dist/write/attribution.js +8 -4
- package/dist/write/attribution.js.map +1 -1
- package/dist/write/route.d.ts.map +1 -1
- package/dist/write/route.js +9 -10
- package/dist/write/route.js.map +1 -1
- package/dist/write/session.d.ts.map +1 -1
- package/dist/write/session.js +13 -0
- package/dist/write/session.js.map +1 -1
- package/package.json +103 -3
|
@@ -7,18 +7,83 @@
|
|
|
7
7
|
* POST /v1/mcp/connections/:id/approve
|
|
8
8
|
* DELETE /v1/mcp/connections/:id
|
|
9
9
|
*
|
|
10
|
+
* plus the server-signed answer to an MCP client's `request_scope_access`:
|
|
11
|
+
*
|
|
12
|
+
* POST /v1/mcp/connections/:id/scope-request/approve
|
|
13
|
+
* POST /v1/mcp/connections/:id/scope-request/deny
|
|
14
|
+
*
|
|
15
|
+
* and one read that is NOT owner-signed, because the owner's page needs it
|
|
16
|
+
* before it asks for any signature:
|
|
17
|
+
*
|
|
18
|
+
* GET /v1/mcp/connections/:id/scope-request
|
|
19
|
+
* (header `X-Vana-Scope-Request-Token`, from the approval link)
|
|
20
|
+
*
|
|
10
21
|
* These endpoints DO NOT read user data. They only manage connection records
|
|
11
22
|
* — create the per-connection grantee/token, store grant ids after the user
|
|
12
23
|
* approves them, and mark connections revoked.
|
|
13
24
|
*/
|
|
14
25
|
import { generateMcpGrantee } from "./grantee.js";
|
|
15
26
|
import { createGrantContract } from "../contracts/index.js";
|
|
27
|
+
import { isWriteScopeEntry, WRITE_SCOPE_PREFIX } from "../policy/data-write.js";
|
|
28
|
+
import { isMemoryScope, isSystemScope } from "../policy/reserved-scopes.js";
|
|
29
|
+
import { isPhysicalScope, streamReadScope, } from "../stream-sync-read/routing.js";
|
|
30
|
+
import { ScopeSchema, } from "@opendatalabs/vana-sdk/browser";
|
|
16
31
|
import { appUrlFromOAuthRedirectUri, ensureMcpGranteeRegistered, McpGranteeRegistrationError, } from "./builder-registration.js";
|
|
32
|
+
import { MCP_SCOPE_ACCESS_REQUEST_LIMIT } from "./types.js";
|
|
33
|
+
import { isAllowedOAuthRedirectUri } from "./oauth-redirect.js";
|
|
34
|
+
import { isMcpRefreshExpired, MCP_TOKEN_TTL_MS, mcpRefreshExpiry, mcpTokenExpiry, } from "./token-expiry.js";
|
|
17
35
|
const TOKEN_BYTES = 32;
|
|
18
36
|
const OAUTH_AUTHORIZATION_TTL_MS = 10 * 60 * 1000;
|
|
37
|
+
const pendingOAuthReplacements = new WeakMap();
|
|
38
|
+
/**
|
|
39
|
+
* Default lifetime of a grant the server signs itself for an MCP connection
|
|
40
|
+
* (OAuth approve, or a scope-request approve with no live grant to inherit
|
|
41
|
+
* an expiry from): 0, a perpetual grant, as before this option existed.
|
|
42
|
+
* Hosts opt into a dated grant with `mcpGrantTtlSeconds`, for example
|
|
43
|
+
* 365 * 24 * 60 * 60 for one year from signing.
|
|
44
|
+
*/
|
|
45
|
+
export const DEFAULT_MCP_GRANT_TTL_SECONDS = 0;
|
|
46
|
+
/**
|
|
47
|
+
* Unix-seconds expiry for a freshly signed MCP grant, or undefined for a
|
|
48
|
+
* perpetual one (ttl 0).
|
|
49
|
+
*/
|
|
50
|
+
export function mcpGrantDefaultExpiry(ttlSeconds, now) {
|
|
51
|
+
const ttl = ttlSeconds ?? DEFAULT_MCP_GRANT_TTL_SECONDS;
|
|
52
|
+
if (!Number.isFinite(ttl) || ttl < 0) {
|
|
53
|
+
throw new RangeError(`mcpGrantTtlSeconds must be a non-negative number, got ${ttlSeconds}`);
|
|
54
|
+
}
|
|
55
|
+
if (ttl === 0)
|
|
56
|
+
return undefined;
|
|
57
|
+
return Math.floor(nowMs(now) / 1000) + Math.floor(ttl);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Request header carrying the scope-request read token. The token travels in
|
|
61
|
+
* the approval link's URL fragment, so the page reads it client-side and
|
|
62
|
+
* sends it here; it never reaches a web server log or a Referer.
|
|
63
|
+
*/
|
|
64
|
+
export const MCP_SCOPE_REQUEST_TOKEN_HEADER = "X-Vana-Scope-Request-Token";
|
|
65
|
+
/**
|
|
66
|
+
* errorCode for every failed token read: unknown connection, nothing
|
|
67
|
+
* pending, wrong, missing or expired token. One answer for all of them, so
|
|
68
|
+
* the route does not reveal which connections or requests exist.
|
|
69
|
+
*/
|
|
70
|
+
export const MCP_SCOPE_REQUEST_NOT_FOUND = "MCP_SCOPE_REQUEST_NOT_FOUND";
|
|
71
|
+
/** How long an approval link can load its request without a signature. */
|
|
72
|
+
export const MCP_SCOPE_REQUEST_READ_TOKEN_TTL_MS = 24 * 60 * 60 * 1000;
|
|
73
|
+
/** 32 random bytes encode to 43 base64url chars; anything far longer is junk. */
|
|
74
|
+
const MAX_READ_TOKEN_CHARS = 128;
|
|
75
|
+
/** Store patch that drops every refresh token a connection still answers to. */
|
|
76
|
+
const CLEARED_REFRESH_FAMILY = {
|
|
77
|
+
refreshTokenHash: undefined,
|
|
78
|
+
previousRefreshTokenHash: undefined,
|
|
79
|
+
refreshExpiresAt: undefined,
|
|
80
|
+
};
|
|
19
81
|
function nowIso(now) {
|
|
20
82
|
return (now ? now() : new Date()).toISOString();
|
|
21
83
|
}
|
|
84
|
+
function nowMs(now) {
|
|
85
|
+
return (now ? now() : new Date()).getTime();
|
|
86
|
+
}
|
|
22
87
|
function randomBytes(byteLength) {
|
|
23
88
|
const bytes = new Uint8Array(byteLength);
|
|
24
89
|
globalThis.crypto.getRandomValues(bytes);
|
|
@@ -48,6 +113,11 @@ function randomToken() {
|
|
|
48
113
|
return bytesToBase64Url(randomBytes(TOKEN_BYTES));
|
|
49
114
|
}
|
|
50
115
|
export async function createMcpConnection(input, options) {
|
|
116
|
+
const { record, output } = await buildMcpConnection(input, options);
|
|
117
|
+
await options.store.create(record);
|
|
118
|
+
return output;
|
|
119
|
+
}
|
|
120
|
+
async function buildMcpConnection(input, options) {
|
|
51
121
|
const grantee = generateMcpGrantee();
|
|
52
122
|
const token = randomToken();
|
|
53
123
|
const tokenHash = await hashConnectionToken(token);
|
|
@@ -60,17 +130,22 @@ export async function createMcpConnection(input, options) {
|
|
|
60
130
|
granteePublicKey: grantee.key.publicKey,
|
|
61
131
|
encryptedGranteePrivateKey: grantee.key.encryptedPrivateKey,
|
|
62
132
|
tokenHash,
|
|
133
|
+
tokenExpiresAt: mcpTokenExpiry(nowMs(options.now)),
|
|
63
134
|
status: "pending",
|
|
64
135
|
grants: [],
|
|
65
136
|
createdAt,
|
|
137
|
+
...(input.ingress ? { ingress: input.ingress } : {}),
|
|
138
|
+
...(input.clientId ? { clientId: input.clientId } : {}),
|
|
66
139
|
};
|
|
67
|
-
await options.store.create(record);
|
|
68
140
|
return {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
141
|
+
record,
|
|
142
|
+
output: {
|
|
143
|
+
connectionId: id,
|
|
144
|
+
granteeAddress: grantee.key.address,
|
|
145
|
+
connectionToken: token,
|
|
146
|
+
mcpUrl: buildMcpUrl(options.publicOrigin, token),
|
|
147
|
+
createdAt,
|
|
148
|
+
},
|
|
74
149
|
};
|
|
75
150
|
}
|
|
76
151
|
export function buildMcpUrl(publicOrigin, token) {
|
|
@@ -91,6 +166,13 @@ export function buildMcpProtectedResourceMetadataUrl(publicOrigin) {
|
|
|
91
166
|
: publicOrigin;
|
|
92
167
|
return `${base}/.well-known/oauth-protected-resource/mcp`;
|
|
93
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* errorCode for an unknown connection id on the single-connection and
|
|
171
|
+
* scope-request routes. Distinct from the generic `NOT_FOUND` a server
|
|
172
|
+
* answers for a route it does not have, so a caller (Vana Web) can tell
|
|
173
|
+
* "this request is gone" from "this server predates the route".
|
|
174
|
+
*/
|
|
175
|
+
export const MCP_CONNECTION_NOT_FOUND = "MCP_CONNECTION_NOT_FOUND";
|
|
94
176
|
export class McpConnectionNotFoundError extends Error {
|
|
95
177
|
connectionId;
|
|
96
178
|
constructor(connectionId) {
|
|
@@ -110,25 +192,368 @@ export class McpConnectionStateError extends Error {
|
|
|
110
192
|
}
|
|
111
193
|
}
|
|
112
194
|
export async function approveMcpConnection(input, options) {
|
|
113
|
-
const existing = await options.store.getById(input.connectionId);
|
|
114
|
-
if (!existing)
|
|
115
|
-
throw new McpConnectionNotFoundError(input.connectionId);
|
|
116
|
-
if (existing.status === "revoked") {
|
|
117
|
-
throw new McpConnectionStateError(input.connectionId, existing.status, "pending or approved");
|
|
118
|
-
}
|
|
119
195
|
if (!input.grants.length) {
|
|
120
196
|
throw new Error("approveMcpConnection requires at least one grant; the consent flow must mint grants first");
|
|
121
197
|
}
|
|
122
198
|
const approvedAt = nowIso(options.now);
|
|
123
|
-
const updated = await options.store.
|
|
124
|
-
status
|
|
125
|
-
|
|
126
|
-
|
|
199
|
+
const updated = await options.store.mutate(input.connectionId, (existing) => {
|
|
200
|
+
if (existing.status === "revoked") {
|
|
201
|
+
throw new McpConnectionStateError(input.connectionId, existing.status, "pending or approved");
|
|
202
|
+
}
|
|
203
|
+
const pendingRequest = existing.scopeAccessRequest;
|
|
204
|
+
const remainingRequestScopes = pendingRequest?.scopes.filter((scope) => !input.grants.some((grant) => grantCoversScope(grant, scope)));
|
|
205
|
+
// A narrowed request is a different request: its old link stops loading
|
|
206
|
+
// it (the read token is dropped) and the page falls back to a signed read.
|
|
207
|
+
return {
|
|
208
|
+
...existing,
|
|
209
|
+
status: "approved",
|
|
210
|
+
grants: input.grants,
|
|
211
|
+
approvedAt,
|
|
212
|
+
scopeAccessRequest: pendingRequest &&
|
|
213
|
+
remainingRequestScopes &&
|
|
214
|
+
remainingRequestScopes.length > 0
|
|
215
|
+
? {
|
|
216
|
+
...toMcpScopeAccessRequestView(pendingRequest),
|
|
217
|
+
scopes: remainingRequestScopes,
|
|
218
|
+
}
|
|
219
|
+
: undefined,
|
|
220
|
+
};
|
|
221
|
+
});
|
|
222
|
+
if (!updated)
|
|
223
|
+
throw new McpConnectionNotFoundError(input.connectionId);
|
|
224
|
+
return updated;
|
|
225
|
+
}
|
|
226
|
+
function grantCoversScope(grant, scope) {
|
|
227
|
+
// A `write:` request is covered only by the same exact write entry: not by
|
|
228
|
+
// a read wildcard such as `*`, and not by a write wildcard, which `remember`
|
|
229
|
+
// ignores (the agent must still be able to ask for the exact grant).
|
|
230
|
+
if (isWriteScopeEntry(scope))
|
|
231
|
+
return grant.scopes.includes(scope);
|
|
232
|
+
return grant.scopes.some((granted) => granted === "*" ||
|
|
233
|
+
granted === scope ||
|
|
234
|
+
(granted.endsWith(".*") && scope.startsWith(granted.slice(0, -1))));
|
|
235
|
+
}
|
|
236
|
+
export async function requestMcpScopeAccess(input, options) {
|
|
237
|
+
const requestedAt = nowIso(options.now);
|
|
238
|
+
const readToken = randomToken();
|
|
239
|
+
const readTokenHash = await hashConnectionToken(readToken);
|
|
240
|
+
const readTokenExpiresAt = new Date(nowMs(options.now) + MCP_SCOPE_REQUEST_READ_TOKEN_TTL_MS).toISOString();
|
|
241
|
+
const inputScopes = Array.from(new Set(input.scopes.map((scope) => scope.trim()).filter(Boolean))).sort();
|
|
242
|
+
const updated = await options.store.mutate(input.connectionId, (existing) => {
|
|
243
|
+
if (existing.status !== "approved") {
|
|
244
|
+
throw new McpConnectionStateError(input.connectionId, existing.status, "approved");
|
|
245
|
+
}
|
|
246
|
+
const scopes = Array.from(new Set([...(existing.scopeAccessRequest?.scopes ?? []), ...inputScopes]
|
|
247
|
+
.map((scope) => scope.trim())
|
|
248
|
+
.filter((scope) => scope.length > 0 &&
|
|
249
|
+
!existing.grants.some((grant) => grantCoversScope(grant, scope))))).sort();
|
|
250
|
+
if (scopes.length === 0)
|
|
251
|
+
return existing;
|
|
252
|
+
if (scopes.length > MCP_SCOPE_ACCESS_REQUEST_LIMIT)
|
|
253
|
+
return existing;
|
|
254
|
+
const reason = input.reason?.trim() || existing.scopeAccessRequest?.reason;
|
|
255
|
+
const request = {
|
|
256
|
+
scopes,
|
|
257
|
+
...(reason ? { reason } : {}),
|
|
258
|
+
requestedAt,
|
|
259
|
+
readTokenHash,
|
|
260
|
+
readTokenExpiresAt,
|
|
261
|
+
};
|
|
262
|
+
return { ...existing, scopeAccessRequest: request };
|
|
263
|
+
});
|
|
264
|
+
if (!updated)
|
|
265
|
+
throw new McpConnectionNotFoundError(input.connectionId);
|
|
266
|
+
const missingInputScopes = inputScopes.filter((scope) => !updated.grants.some((grant) => grantCoversScope(grant, scope)));
|
|
267
|
+
return {
|
|
268
|
+
connection: updated,
|
|
269
|
+
requestRecorded: missingInputScopes.length > 0 &&
|
|
270
|
+
missingInputScopes.every((scope) => updated.scopeAccessRequest?.scopes.includes(scope)),
|
|
271
|
+
...(updated.scopeAccessRequest?.readTokenHash === readTokenHash
|
|
272
|
+
? { readToken }
|
|
273
|
+
: {}),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
/** Constant-time equality for two hex digests of the same algorithm. */
|
|
277
|
+
function digestsEqual(a, b) {
|
|
278
|
+
let diff = a.length ^ b.length;
|
|
279
|
+
const length = Math.max(a.length, b.length);
|
|
280
|
+
for (let i = 0; i < length; i += 1) {
|
|
281
|
+
diff |= (a.charCodeAt(i) | 0) ^ (b.charCodeAt(i) | 0);
|
|
282
|
+
}
|
|
283
|
+
return diff === 0;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Load one pending scope request with the read token from its approval link.
|
|
287
|
+
* Returns null for an unknown or non-approved connection, no pending request,
|
|
288
|
+
* a request without a token, a wrong or missing token, or an expired one, so
|
|
289
|
+
* a caller can answer all of them the same way.
|
|
290
|
+
*/
|
|
291
|
+
export async function readMcpScopeRequestWithToken(input, options) {
|
|
292
|
+
const token = input.token?.trim() ?? "";
|
|
293
|
+
if (!token || token.length > MAX_READ_TOKEN_CHARS || !input.connectionId) {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
const presentedHash = await hashConnectionToken(token);
|
|
297
|
+
const record = await options.store.getById(input.connectionId);
|
|
298
|
+
const request = record?.scopeAccessRequest;
|
|
299
|
+
if (!record || record.status !== "approved" || !request)
|
|
300
|
+
return null;
|
|
301
|
+
if (!request.readTokenHash || !request.readTokenExpiresAt)
|
|
302
|
+
return null;
|
|
303
|
+
if (!digestsEqual(presentedHash, request.readTokenHash))
|
|
304
|
+
return null;
|
|
305
|
+
const expiresAt = Date.parse(request.readTokenExpiresAt);
|
|
306
|
+
if (!Number.isFinite(expiresAt) || expiresAt <= nowMs(options.now)) {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
if (request.scopes.length === 0)
|
|
310
|
+
return null;
|
|
311
|
+
return {
|
|
312
|
+
id: record.id,
|
|
313
|
+
displayName: record.displayName,
|
|
314
|
+
scopeAccessRequest: toMcpScopeAccessRequestView(request),
|
|
315
|
+
grantedScopes: sortedUnique(record.grants.flatMap((grant) => grant.scopes)),
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
/** A scope-request answer the owner cannot give in the connection's state. */
|
|
319
|
+
export class McpScopeRequestError extends Error {
|
|
320
|
+
code;
|
|
321
|
+
status;
|
|
322
|
+
body;
|
|
323
|
+
constructor(code, message, status = 400, body) {
|
|
324
|
+
super(message);
|
|
325
|
+
this.code = code;
|
|
326
|
+
this.status = status;
|
|
327
|
+
this.body = body;
|
|
328
|
+
this.name = "McpScopeRequestError";
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Owner approves (part of) a pending `request_scope_access` without an
|
|
333
|
+
* external signer: the server signs the grant itself, as the OAuth approve
|
|
334
|
+
* path does.
|
|
335
|
+
*
|
|
336
|
+
* The gateway keeps ONE grant per (owner, grantee) and a new registration
|
|
337
|
+
* replaces its scopes, so the grant is re-signed over the union of every
|
|
338
|
+
* scope the connection already holds plus the approved ones. Signing only
|
|
339
|
+
* the new scopes would silently revoke the old ones.
|
|
340
|
+
*/
|
|
341
|
+
export async function approveMcpScopeAccessRequest(input, options) {
|
|
342
|
+
const connection = await options.store.getById(input.connectionId);
|
|
343
|
+
if (!connection)
|
|
344
|
+
throw new McpConnectionNotFoundError(input.connectionId);
|
|
345
|
+
const pending = requirePendingScopeRequest(connection);
|
|
346
|
+
const approvedScopes = parseApprovedScopes(input.scopes, pending);
|
|
347
|
+
const live = await readLiveGrantState(connection, options.gateway);
|
|
348
|
+
const grantedScopes = sortedUnique([...live.scopes, ...approvedScopes]);
|
|
349
|
+
// Keep the live grant's expiry so approval never extends it (a perpetual
|
|
350
|
+
// live grant stays perpetual). Only a connection with no live grant gets
|
|
351
|
+
// the default lifetime from now.
|
|
352
|
+
const expiresAt = live.expiry.kind === "inherit"
|
|
353
|
+
? live.expiry.expiresAt
|
|
354
|
+
: mcpGrantDefaultExpiry(options.grantTtlSeconds, options.now);
|
|
355
|
+
let grantResult;
|
|
356
|
+
try {
|
|
357
|
+
grantResult = await createGrantContract({
|
|
358
|
+
gateway: options.gateway,
|
|
359
|
+
serverOwner: options.serverOwner,
|
|
360
|
+
serverSigner: options.serverSigner,
|
|
361
|
+
body: {
|
|
362
|
+
granteeAddress: connection.granteeAddress,
|
|
363
|
+
scopes: grantedScopes,
|
|
364
|
+
grantVersion: live.nextGrantVersion,
|
|
365
|
+
...(expiresAt !== undefined ? { expiresAt } : {}),
|
|
366
|
+
},
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
catch (err) {
|
|
370
|
+
throw new McpScopeRequestError("GRANT_CREATION_FAILED", err instanceof Error ? err.message : String(err), 502);
|
|
371
|
+
}
|
|
372
|
+
if (!grantResult.ok) {
|
|
373
|
+
throw new McpScopeRequestError("GRANT_CREATION_FAILED", extractGrantErrorMessage(grantResult.body), grantResult.status >= 500 ? 502 : grantResult.status === 409 ? 409 : 400, grantResult.body);
|
|
374
|
+
}
|
|
375
|
+
const grantId = grantResult.body.grantId;
|
|
376
|
+
if (!grantId) {
|
|
377
|
+
throw new McpScopeRequestError("GRANT_CREATION_FAILED", "Gateway did not return a grant id.", 502, grantResult.body);
|
|
378
|
+
}
|
|
379
|
+
const decidedAt = nowIso(options.now);
|
|
380
|
+
const deniedScopes = pending.scopes.filter((scope) => !approvedScopes.includes(scope));
|
|
381
|
+
const updated = await options.store.mutate(input.connectionId, (latest) => {
|
|
382
|
+
// The grant above was signed from the state read before the gateway
|
|
383
|
+
// round trip; refuse to store it over a change made in between.
|
|
384
|
+
requirePendingScopeRequest(latest);
|
|
385
|
+
if (JSON.stringify(latest.grants) !== JSON.stringify(connection.grants)) {
|
|
386
|
+
throw new McpScopeRequestError("CONCURRENT_UPDATE", "The connection's grants changed during approval; retry.", 409);
|
|
387
|
+
}
|
|
388
|
+
const decision = {
|
|
389
|
+
decision: "approved",
|
|
390
|
+
approvedScopes,
|
|
391
|
+
deniedScopes,
|
|
392
|
+
requestedAt: pending.requestedAt,
|
|
393
|
+
decidedAt,
|
|
394
|
+
};
|
|
395
|
+
return {
|
|
396
|
+
...latest,
|
|
397
|
+
grants: [{ grantId, scopes: grantedScopes }],
|
|
398
|
+
scopeAccessRequest: undefined,
|
|
399
|
+
scopeAccessDecision: decision,
|
|
400
|
+
};
|
|
401
|
+
});
|
|
402
|
+
if (!updated)
|
|
403
|
+
throw new McpConnectionNotFoundError(input.connectionId);
|
|
404
|
+
return {
|
|
405
|
+
connection: updated,
|
|
406
|
+
grantId,
|
|
407
|
+
grantedScopes,
|
|
408
|
+
approvedScopes,
|
|
409
|
+
deniedScopes,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
/** Owner declines the pending request; the decision stays for the client. */
|
|
413
|
+
export async function denyMcpScopeAccessRequest(input, options) {
|
|
414
|
+
const decidedAt = nowIso(options.now);
|
|
415
|
+
const updated = await options.store.mutate(input.connectionId, (latest) => {
|
|
416
|
+
const pending = requirePendingScopeRequest(latest);
|
|
417
|
+
const decision = {
|
|
418
|
+
decision: "denied",
|
|
419
|
+
approvedScopes: [],
|
|
420
|
+
deniedScopes: pending.scopes,
|
|
421
|
+
requestedAt: pending.requestedAt,
|
|
422
|
+
decidedAt,
|
|
423
|
+
};
|
|
424
|
+
return {
|
|
425
|
+
...latest,
|
|
426
|
+
scopeAccessRequest: undefined,
|
|
427
|
+
scopeAccessDecision: decision,
|
|
428
|
+
};
|
|
127
429
|
});
|
|
128
430
|
if (!updated)
|
|
129
431
|
throw new McpConnectionNotFoundError(input.connectionId);
|
|
130
432
|
return updated;
|
|
131
433
|
}
|
|
434
|
+
function requirePendingScopeRequest(connection) {
|
|
435
|
+
if (connection.status !== "approved") {
|
|
436
|
+
throw new McpConnectionStateError(connection.id, connection.status, "approved");
|
|
437
|
+
}
|
|
438
|
+
const pending = connection.scopeAccessRequest;
|
|
439
|
+
if (!pending || pending.scopes.length === 0) {
|
|
440
|
+
throw new McpScopeRequestError("NO_PENDING_REQUEST", `mcp connection ${connection.id} has no pending scope request`, 409);
|
|
441
|
+
}
|
|
442
|
+
return pending;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* A scope the owner may approve on a connection: a read scope the SDK accepts,
|
|
446
|
+
* or `write:` plus one concrete agent-memory scope (`memory.<app>`, never a
|
|
447
|
+
* wildcard). MCP clients only ever write memories.
|
|
448
|
+
*/
|
|
449
|
+
function isApprovableScope(scope) {
|
|
450
|
+
if (isPhysicalScope(scope))
|
|
451
|
+
return false;
|
|
452
|
+
if (!isWriteScopeEntry(scope)) {
|
|
453
|
+
return (ScopeSchema.safeParse(scope).success || streamReadScope(scope) === scope);
|
|
454
|
+
}
|
|
455
|
+
const target = scope.slice(WRITE_SCOPE_PREFIX.length);
|
|
456
|
+
return (!target.includes("*") &&
|
|
457
|
+
!isSystemScope(target) &&
|
|
458
|
+
isMemoryScope(target) &&
|
|
459
|
+
ScopeSchema.safeParse(target).success);
|
|
460
|
+
}
|
|
461
|
+
function parseApprovedScopes(value, pending) {
|
|
462
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
463
|
+
throw new McpScopeRequestError("SCOPES_REQUIRED", "Approve requires a non-empty scopes array; use deny to decline all.");
|
|
464
|
+
}
|
|
465
|
+
const scopes = [];
|
|
466
|
+
for (const raw of value) {
|
|
467
|
+
const scope = typeof raw === "string" ? raw.trim() : "";
|
|
468
|
+
if (!isApprovableScope(scope)) {
|
|
469
|
+
throw new McpScopeRequestError("INVALID_SCOPE", `Invalid scope: ${JSON.stringify(raw)}`);
|
|
470
|
+
}
|
|
471
|
+
if (!pending.scopes.includes(scope)) {
|
|
472
|
+
throw new McpScopeRequestError("SCOPE_NOT_REQUESTED", `Scope ${scope} is not part of the pending request`);
|
|
473
|
+
}
|
|
474
|
+
if (!scopes.includes(scope))
|
|
475
|
+
scopes.push(scope);
|
|
476
|
+
}
|
|
477
|
+
return scopes.sort();
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Read what the gateway holds for this connection's grantee: the scopes the
|
|
481
|
+
* replacement grant must keep, the version counter it must advance past, and
|
|
482
|
+
* the expiry it must not outlive. A revoked grant contributes its version but
|
|
483
|
+
* no scopes, so approval never resurrects access the owner already pulled.
|
|
484
|
+
*/
|
|
485
|
+
async function readLiveGrantState(connection, gateway) {
|
|
486
|
+
const grantIds = sortedUnique(connection.grants.map((grant) => grant.grantId));
|
|
487
|
+
const revoked = new Set();
|
|
488
|
+
const scopes = new Set();
|
|
489
|
+
let maxVersion = 0n;
|
|
490
|
+
let anyLive = false;
|
|
491
|
+
let anyPerpetual = false;
|
|
492
|
+
let expiresAt;
|
|
493
|
+
for (const grantId of grantIds) {
|
|
494
|
+
let live;
|
|
495
|
+
try {
|
|
496
|
+
live = await gateway.getGrant(grantId);
|
|
497
|
+
}
|
|
498
|
+
catch (err) {
|
|
499
|
+
throw new McpScopeRequestError("GATEWAY_UNAVAILABLE", `Could not read grant ${grantId}: ${err instanceof Error ? err.message : String(err)}`, 502);
|
|
500
|
+
}
|
|
501
|
+
if (!live)
|
|
502
|
+
continue;
|
|
503
|
+
const version = parseUint(live.grantVersion);
|
|
504
|
+
if (version !== null && version > maxVersion)
|
|
505
|
+
maxVersion = version;
|
|
506
|
+
if (live.revokedAt) {
|
|
507
|
+
revoked.add(grantId);
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
for (const scope of live.scopes)
|
|
511
|
+
scopes.add(scope);
|
|
512
|
+
anyLive = true;
|
|
513
|
+
const liveExpiry = parseExpirySeconds(live.expiresAt);
|
|
514
|
+
if (liveExpiry === undefined) {
|
|
515
|
+
anyPerpetual = true;
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
expiresAt =
|
|
519
|
+
expiresAt === undefined ? liveExpiry : Math.max(expiresAt, liveExpiry);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
for (const grant of connection.grants) {
|
|
523
|
+
if (revoked.has(grant.grantId))
|
|
524
|
+
continue;
|
|
525
|
+
for (const scope of grant.scopes)
|
|
526
|
+
scopes.add(scope);
|
|
527
|
+
}
|
|
528
|
+
return {
|
|
529
|
+
scopes: sortedUnique(scopes),
|
|
530
|
+
nextGrantVersion: (maxVersion + 1n).toString(),
|
|
531
|
+
expiry: !anyLive
|
|
532
|
+
? { kind: "none" }
|
|
533
|
+
: anyPerpetual
|
|
534
|
+
? { kind: "inherit" }
|
|
535
|
+
: { kind: "inherit", expiresAt },
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
function parseUint(value) {
|
|
539
|
+
if (typeof value !== "string" || !/^\d+$/u.test(value))
|
|
540
|
+
return null;
|
|
541
|
+
return BigInt(value);
|
|
542
|
+
}
|
|
543
|
+
/** Gateway expiry may be unix seconds or an ISO date; 0/null means perpetual. */
|
|
544
|
+
function parseExpirySeconds(value) {
|
|
545
|
+
if (!value)
|
|
546
|
+
return undefined;
|
|
547
|
+
if (/^\d+$/u.test(value)) {
|
|
548
|
+
const seconds = Number(value);
|
|
549
|
+
return seconds > 0 ? seconds : undefined;
|
|
550
|
+
}
|
|
551
|
+
const ms = Date.parse(value);
|
|
552
|
+
return Number.isFinite(ms) ? Math.floor(ms / 1000) : undefined;
|
|
553
|
+
}
|
|
554
|
+
function sortedUnique(values) {
|
|
555
|
+
return Array.from(new Set(values)).sort();
|
|
556
|
+
}
|
|
132
557
|
export async function revokeMcpConnection(connectionId, options) {
|
|
133
558
|
const existing = await options.store.getById(connectionId);
|
|
134
559
|
if (!existing)
|
|
@@ -136,14 +561,25 @@ export async function revokeMcpConnection(connectionId, options) {
|
|
|
136
561
|
if (existing.status === "revoked")
|
|
137
562
|
return existing;
|
|
138
563
|
const revokedAt = nowIso(options.now);
|
|
564
|
+
// The refresh token outlives the access token by weeks, so a revoke that
|
|
565
|
+
// left it in place would hand the holder a fresh bearer minutes later.
|
|
139
566
|
const updated = await options.store.update(connectionId, {
|
|
140
567
|
status: "revoked",
|
|
141
568
|
revokedAt,
|
|
569
|
+
...CLEARED_REFRESH_FAMILY,
|
|
142
570
|
});
|
|
143
571
|
if (!updated)
|
|
144
572
|
throw new McpConnectionNotFoundError(connectionId);
|
|
145
573
|
return updated;
|
|
146
574
|
}
|
|
575
|
+
/** A scope request without its read token, for anything that leaves the server. */
|
|
576
|
+
export function toMcpScopeAccessRequestView(request) {
|
|
577
|
+
return {
|
|
578
|
+
scopes: request.scopes,
|
|
579
|
+
...(request.reason !== undefined ? { reason: request.reason } : {}),
|
|
580
|
+
requestedAt: request.requestedAt,
|
|
581
|
+
};
|
|
582
|
+
}
|
|
147
583
|
export function toMcpConnectionView(record) {
|
|
148
584
|
return {
|
|
149
585
|
id: record.id,
|
|
@@ -151,16 +587,30 @@ export function toMcpConnectionView(record) {
|
|
|
151
587
|
granteeAddress: record.granteeAddress,
|
|
152
588
|
status: record.status,
|
|
153
589
|
grants: record.grants,
|
|
590
|
+
grantedScopes: sortedUnique(record.grants.flatMap((grant) => grant.scopes)),
|
|
591
|
+
scopeAccessRequest: record.scopeAccessRequest
|
|
592
|
+
? toMcpScopeAccessRequestView(record.scopeAccessRequest)
|
|
593
|
+
: undefined,
|
|
594
|
+
scopeAccessDecision: record.scopeAccessDecision,
|
|
154
595
|
createdAt: record.createdAt,
|
|
155
596
|
approvedAt: record.approvedAt,
|
|
156
597
|
revokedAt: record.revokedAt,
|
|
157
598
|
lastUsedAt: record.lastUsedAt,
|
|
158
599
|
};
|
|
159
600
|
}
|
|
601
|
+
/** One connection as the owner sees it; throws when the id is unknown. */
|
|
602
|
+
export async function getMcpConnectionView(connectionId, store) {
|
|
603
|
+
const record = await store.getById(connectionId);
|
|
604
|
+
if (!record)
|
|
605
|
+
throw new McpConnectionNotFoundError(connectionId);
|
|
606
|
+
return toMcpConnectionView(record);
|
|
607
|
+
}
|
|
160
608
|
export async function listMcpConnectionViews(store) {
|
|
161
609
|
const records = await store.list();
|
|
162
610
|
return records.map(toMcpConnectionView);
|
|
163
611
|
}
|
|
612
|
+
/** Connection label when the client never told this server its name. */
|
|
613
|
+
const DEFAULT_MCP_CLIENT_NAME = "MCP client";
|
|
164
614
|
export class McpOAuthAuthorizationError extends Error {
|
|
165
615
|
code;
|
|
166
616
|
status;
|
|
@@ -180,6 +630,9 @@ export async function createMcpOAuthAuthorization(input, options) {
|
|
|
180
630
|
if (!input.redirectUri.trim()) {
|
|
181
631
|
throw new McpOAuthAuthorizationError("invalid_request", "redirect_uri is required");
|
|
182
632
|
}
|
|
633
|
+
if (!isAllowedOAuthRedirectUri(input.redirectUri)) {
|
|
634
|
+
throw new McpOAuthAuthorizationError("invalid_request", "redirect_uri is not an allowed redirect URI");
|
|
635
|
+
}
|
|
183
636
|
if (!input.codeChallenge.trim()) {
|
|
184
637
|
throw new McpOAuthAuthorizationError("invalid_request", "code_challenge is required");
|
|
185
638
|
}
|
|
@@ -188,15 +641,21 @@ export async function createMcpOAuthAuthorization(input, options) {
|
|
|
188
641
|
}
|
|
189
642
|
const now = options.now ? options.now() : new Date();
|
|
190
643
|
const expiresAt = new Date(now.getTime() + OAUTH_AUTHORIZATION_TTL_MS).toISOString();
|
|
191
|
-
const
|
|
192
|
-
|
|
644
|
+
const { record: connection, output: created } = await buildMcpConnection({
|
|
645
|
+
displayName: input.clientName ?? DEFAULT_MCP_CLIENT_NAME,
|
|
646
|
+
ingress: input.ingress,
|
|
647
|
+
clientId: input.clientId,
|
|
648
|
+
}, {
|
|
193
649
|
publicOrigin: options.publicOrigin,
|
|
194
650
|
now: () => now,
|
|
195
651
|
});
|
|
652
|
+
await replacePendingOAuthConnections(options.connectionStore, input.clientId, now.getTime() - OAUTH_AUTHORIZATION_TTL_MS, connection);
|
|
196
653
|
const authorizationId = randomId();
|
|
197
654
|
const record = {
|
|
198
655
|
id: authorizationId,
|
|
199
656
|
clientId: input.clientId,
|
|
657
|
+
...(input.clientName ? { clientName: input.clientName } : {}),
|
|
658
|
+
...(input.clientUri ? { clientUri: input.clientUri } : {}),
|
|
200
659
|
redirectUri: input.redirectUri,
|
|
201
660
|
codeChallenge: input.codeChallenge,
|
|
202
661
|
codeChallengeMethod: "S256",
|
|
@@ -216,10 +675,45 @@ export async function createMcpOAuthAuthorization(input, options) {
|
|
|
216
675
|
expiresAt,
|
|
217
676
|
};
|
|
218
677
|
}
|
|
678
|
+
async function replacePendingOAuthConnections(store, clientId, expiredBefore, replacement) {
|
|
679
|
+
if (store.replacePendingOAuthConnections) {
|
|
680
|
+
await store.replacePendingOAuthConnections(clientId, expiredBefore, replacement);
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
const previous = pendingOAuthReplacements.get(store) ?? Promise.resolve();
|
|
684
|
+
const operation = previous.then(async () => {
|
|
685
|
+
for (const connection of await store.list()) {
|
|
686
|
+
const expired = Date.parse(connection.createdAt) <= expiredBefore;
|
|
687
|
+
if (connection.status !== "pending" ||
|
|
688
|
+
!connection.clientId ||
|
|
689
|
+
(connection.clientId !== clientId && !expired)) {
|
|
690
|
+
continue;
|
|
691
|
+
}
|
|
692
|
+
await store.mutate(connection.id, (latest) => latest.status === "pending"
|
|
693
|
+
? {
|
|
694
|
+
...latest,
|
|
695
|
+
status: "revoked",
|
|
696
|
+
revokedAt: replacement.createdAt,
|
|
697
|
+
}
|
|
698
|
+
: latest);
|
|
699
|
+
}
|
|
700
|
+
await store.create(replacement);
|
|
701
|
+
});
|
|
702
|
+
pendingOAuthReplacements.set(store, operation.then(() => undefined, () => undefined));
|
|
703
|
+
await operation;
|
|
704
|
+
}
|
|
705
|
+
/** A superseded or removed authorization has a revoked connection; refuse it. */
|
|
706
|
+
function requireLive(connection) {
|
|
707
|
+
if (connection?.status !== "revoked")
|
|
708
|
+
return;
|
|
709
|
+
throw new McpOAuthAuthorizationError("invalid_state", "MCP OAuth authorization was superseded or removed; connect again");
|
|
710
|
+
}
|
|
219
711
|
export function toMcpOAuthAuthorizationView(record) {
|
|
220
712
|
return {
|
|
221
713
|
id: record.id,
|
|
222
714
|
clientId: record.clientId,
|
|
715
|
+
...(record.clientName ? { clientName: record.clientName } : {}),
|
|
716
|
+
...(record.clientUri ? { clientUri: record.clientUri } : {}),
|
|
223
717
|
redirectUri: record.redirectUri,
|
|
224
718
|
...(record.scope ? { scope: record.scope } : {}),
|
|
225
719
|
...(record.state ? { state: record.state } : {}),
|
|
@@ -245,6 +739,7 @@ export async function approveMcpOAuthAuthorization(input, options) {
|
|
|
245
739
|
if (input.grants.length === 0) {
|
|
246
740
|
throw new McpOAuthAuthorizationError("grants_required", "Approve requires at least one grant");
|
|
247
741
|
}
|
|
742
|
+
requireLive(await options.connectionStore.getById(record.connectionId));
|
|
248
743
|
await approveMcpConnection({ connectionId: record.connectionId, grants: input.grants }, { store: options.connectionStore, now: options.now });
|
|
249
744
|
const authorizationCode = randomToken();
|
|
250
745
|
const authorizationCodeHash = await hashMcpOAuthAuthorizationCode(authorizationCode);
|
|
@@ -269,10 +764,20 @@ export async function approveMcpOAuthAuthorizationWithScopes(input, options) {
|
|
|
269
764
|
if (!Array.isArray(input.scopes) || input.scopes.length === 0) {
|
|
270
765
|
throw new McpOAuthAuthorizationError("scopes_required", "Approve requires at least one scope");
|
|
271
766
|
}
|
|
767
|
+
// Read entries are signed as before. A `write:` entry follows the same rule
|
|
768
|
+
// as a scope-request approval: one concrete scope, never a wildcard, since
|
|
769
|
+
// `remember` makes a write grant on this connection usable.
|
|
770
|
+
const badWrite = input.scopes.find((scope) => typeof scope === "string" &&
|
|
771
|
+
isWriteScopeEntry(scope) &&
|
|
772
|
+
!isApprovableScope(scope));
|
|
773
|
+
if (badWrite !== undefined) {
|
|
774
|
+
throw new McpOAuthAuthorizationError("invalid_scope", `Invalid write scope: ${JSON.stringify(badWrite)}`);
|
|
775
|
+
}
|
|
272
776
|
const connection = await options.connectionStore.getById(record.connectionId);
|
|
273
777
|
if (!connection) {
|
|
274
778
|
throw new McpOAuthAuthorizationError("connection_not_found", `mcp connection ${record.connectionId} not found`, 404);
|
|
275
779
|
}
|
|
780
|
+
requireLive(connection);
|
|
276
781
|
try {
|
|
277
782
|
await ensureMcpGranteeRegistered({
|
|
278
783
|
connection,
|
|
@@ -289,6 +794,8 @@ export async function approveMcpOAuthAuthorizationWithScopes(input, options) {
|
|
|
289
794
|
}
|
|
290
795
|
throw err;
|
|
291
796
|
}
|
|
797
|
+
const expiresAt = input.expiresAt ??
|
|
798
|
+
mcpGrantDefaultExpiry(options.grantTtlSeconds, options.now);
|
|
292
799
|
const grantResult = await createGrantContract({
|
|
293
800
|
gateway: options.gateway,
|
|
294
801
|
serverOwner: options.serverOwner,
|
|
@@ -296,7 +803,7 @@ export async function approveMcpOAuthAuthorizationWithScopes(input, options) {
|
|
|
296
803
|
body: {
|
|
297
804
|
granteeAddress: connection.granteeAddress,
|
|
298
805
|
scopes: input.scopes,
|
|
299
|
-
...(
|
|
806
|
+
...(expiresAt !== undefined ? { expiresAt } : {}),
|
|
300
807
|
...(input.nonce !== undefined ? { nonce: input.nonce } : {}),
|
|
301
808
|
},
|
|
302
809
|
});
|
|
@@ -337,12 +844,12 @@ export async function redeemMcpOAuthAuthorizationCode(input, options) {
|
|
|
337
844
|
}))) {
|
|
338
845
|
throw new McpOAuthAuthorizationError("invalid_grant", "PKCE verification failed");
|
|
339
846
|
}
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
});
|
|
345
|
-
if (!
|
|
847
|
+
const issued = await issueMcpTokenPair({
|
|
848
|
+
connectionId: record.connectionId,
|
|
849
|
+
clientId: record.clientId,
|
|
850
|
+
issuedAtMs: nowMs(options.now),
|
|
851
|
+
}, options.connectionStore);
|
|
852
|
+
if (!issued) {
|
|
346
853
|
throw new McpOAuthAuthorizationError("invalid_grant", "MCP connection for authorization no longer exists");
|
|
347
854
|
}
|
|
348
855
|
await options.authorizationStore.update(record.id, {
|
|
@@ -350,10 +857,77 @@ export async function redeemMcpOAuthAuthorizationCode(input, options) {
|
|
|
350
857
|
redeemedAt: (options.now ? options.now() : new Date()).toISOString(),
|
|
351
858
|
});
|
|
352
859
|
return {
|
|
353
|
-
|
|
860
|
+
...issued,
|
|
354
861
|
...(record.scope ? { scope: record.scope } : {}),
|
|
355
862
|
};
|
|
356
863
|
}
|
|
864
|
+
/**
|
|
865
|
+
* RFC 6749 §6 refresh grant with RFC 9700 §4.14.2 rotation: every exchange
|
|
866
|
+
* mints a new pair and retires the presented refresh token, so the MCP client
|
|
867
|
+
* renews silently instead of re-consenting once an hour.
|
|
868
|
+
*/
|
|
869
|
+
export async function refreshMcpOAuthToken(input, options) {
|
|
870
|
+
const presentedHash = await hashMcpRefreshToken(input.refreshToken);
|
|
871
|
+
const connection = await options.connectionStore.getByRefreshTokenHash(presentedHash);
|
|
872
|
+
if (!connection) {
|
|
873
|
+
throw new McpOAuthAuthorizationError("invalid_grant", "Unknown MCP refresh token");
|
|
874
|
+
}
|
|
875
|
+
// Reuse detection. A rotated-out token still matching means two holders have
|
|
876
|
+
// the family — the legitimate client and a thief — and we cannot tell which
|
|
877
|
+
// one is calling, so the whole family dies. The access token keeps its own
|
|
878
|
+
// expiry: cutting it short would only punish the client that behaved.
|
|
879
|
+
if (connection.refreshTokenHash !== presentedHash) {
|
|
880
|
+
await options.connectionStore.update(connection.id, CLEARED_REFRESH_FAMILY);
|
|
881
|
+
throw new McpOAuthAuthorizationError("invalid_grant", "MCP refresh token was already rotated; the refresh family is revoked");
|
|
882
|
+
}
|
|
883
|
+
if (connection.status !== "approved") {
|
|
884
|
+
throw new McpOAuthAuthorizationError("invalid_grant", "MCP connection is not approved");
|
|
885
|
+
}
|
|
886
|
+
if (connection.clientId !== input.clientId) {
|
|
887
|
+
throw new McpOAuthAuthorizationError("invalid_grant", "client_id does not match the issued refresh token");
|
|
888
|
+
}
|
|
889
|
+
if (isMcpRefreshExpired(connection, nowMs(options.now))) {
|
|
890
|
+
throw new McpOAuthAuthorizationError("invalid_grant", "MCP refresh token expired");
|
|
891
|
+
}
|
|
892
|
+
const issued = await issueMcpTokenPair({
|
|
893
|
+
connectionId: connection.id,
|
|
894
|
+
clientId: input.clientId,
|
|
895
|
+
issuedAtMs: nowMs(options.now),
|
|
896
|
+
retiredRefreshHash: presentedHash,
|
|
897
|
+
}, options.connectionStore);
|
|
898
|
+
if (!issued) {
|
|
899
|
+
throw new McpOAuthAuthorizationError("invalid_grant", "MCP connection no longer exists");
|
|
900
|
+
}
|
|
901
|
+
return issued;
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* Mint one access/refresh pair. The rotation is a single store `update`, so a
|
|
905
|
+
* concurrent refresh either sees the old pair or the new one — never a
|
|
906
|
+
* connection with the old refresh already dead and no new one issued.
|
|
907
|
+
*/
|
|
908
|
+
async function issueMcpTokenPair(input, store) {
|
|
909
|
+
const accessToken = randomToken();
|
|
910
|
+
const refreshToken = randomToken();
|
|
911
|
+
const updated = await store.update(input.connectionId, {
|
|
912
|
+
clientId: input.clientId,
|
|
913
|
+
tokenHash: await hashConnectionToken(accessToken),
|
|
914
|
+
tokenExpiresAt: mcpTokenExpiry(input.issuedAtMs),
|
|
915
|
+
refreshTokenHash: await hashMcpRefreshToken(refreshToken),
|
|
916
|
+
previousRefreshTokenHash: input.retiredRefreshHash,
|
|
917
|
+
refreshExpiresAt: mcpRefreshExpiry(input.issuedAtMs),
|
|
918
|
+
});
|
|
919
|
+
if (!updated)
|
|
920
|
+
return null;
|
|
921
|
+
return {
|
|
922
|
+
accessToken,
|
|
923
|
+
refreshToken,
|
|
924
|
+
expiresIn: Math.floor(MCP_TOKEN_TTL_MS / 1000),
|
|
925
|
+
};
|
|
926
|
+
}
|
|
927
|
+
/** Domain-separated so a refresh token can never resolve as a bearer. */
|
|
928
|
+
async function hashMcpRefreshToken(token) {
|
|
929
|
+
return hashConnectionToken(`mcp-oauth-refresh:${token}`);
|
|
930
|
+
}
|
|
357
931
|
async function hashMcpOAuthAuthorizationCode(code) {
|
|
358
932
|
return hashConnectionToken(`mcp-oauth-code:${code}`);
|
|
359
933
|
}
|