@opendatalabs/personal-server-ts-core 0.0.1-canary.052d47e → 0.0.1-canary.05cdd81
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/account-storage-mode.d.ts +77 -0
- package/dist/api/account-storage-mode.d.ts.map +1 -0
- package/dist/api/account-storage-mode.js +72 -0
- package/dist/api/account-storage-mode.js.map +1 -0
- package/dist/api/index.d.ts +320 -10
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1758 -181
- package/dist/api/index.js.map +1 -1
- package/dist/api/legacy-write-gate.d.ts +51 -0
- package/dist/api/legacy-write-gate.d.ts.map +1 -0
- package/dist/api/legacy-write-gate.js +88 -0
- package/dist/api/legacy-write-gate.js.map +1 -0
- 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/owner-connector-delete.d.ts +79 -0
- package/dist/api/owner-connector-delete.d.ts.map +1 -0
- package/dist/api/owner-connector-delete.js +109 -0
- package/dist/api/owner-connector-delete.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/api/switched-delete-refusal.d.ts +16 -0
- package/dist/api/switched-delete-refusal.d.ts.map +1 -0
- package/dist/api/switched-delete-refusal.js +30 -0
- package/dist/api/switched-delete-refusal.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 +78 -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 +326 -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 +9 -1
- package/dist/contracts/sync.d.ts.map +1 -1
- package/dist/contracts/sync.js +7 -2
- 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 +87 -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 +92 -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/keys/index.d.ts +1 -0
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +1 -0
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/owner-master-key.d.ts +37 -0
- package/dist/keys/owner-master-key.d.ts.map +1 -0
- package/dist/keys/owner-master-key.js +45 -0
- package/dist/keys/owner-master-key.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/erase-connector.d.ts +18 -0
- package/dist/legacy-projection/erase-connector.d.ts.map +1 -0
- package/dist/legacy-projection/erase-connector.js +29 -0
- package/dist/legacy-projection/erase-connector.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 +48 -0
- package/dist/legacy-projection/index.d.ts.map +1 -0
- package/dist/legacy-projection/index.js +255 -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/lineage/gateway.d.ts +3 -1
- package/dist/lineage/gateway.d.ts.map +1 -1
- package/dist/lineage/gateway.js +2 -1
- package/dist/lineage/gateway.js.map +1 -1
- package/dist/localdb/apply.d.ts +13 -0
- package/dist/localdb/apply.d.ts.map +1 -0
- package/dist/localdb/apply.js +565 -0
- package/dist/localdb/apply.js.map +1 -0
- package/dist/localdb/batch-commit.d.ts +67 -0
- package/dist/localdb/batch-commit.d.ts.map +1 -0
- package/dist/localdb/batch-commit.js +121 -0
- package/dist/localdb/batch-commit.js.map +1 -0
- package/dist/localdb/blobs.d.ts +71 -0
- package/dist/localdb/blobs.d.ts.map +1 -0
- package/dist/localdb/blobs.js +306 -0
- package/dist/localdb/blobs.js.map +1 -0
- package/dist/localdb/bootstrap.d.ts +20 -0
- package/dist/localdb/bootstrap.d.ts.map +1 -0
- package/dist/localdb/bootstrap.js +157 -0
- package/dist/localdb/bootstrap.js.map +1 -0
- package/dist/localdb/connection-link.d.ts +12 -0
- package/dist/localdb/connection-link.d.ts.map +1 -0
- package/dist/localdb/connection-link.js +72 -0
- package/dist/localdb/connection-link.js.map +1 -0
- package/dist/localdb/cycle.d.ts +32 -0
- package/dist/localdb/cycle.d.ts.map +1 -0
- package/dist/localdb/cycle.js +46 -0
- package/dist/localdb/cycle.js.map +1 -0
- package/dist/localdb/delete-batch.d.ts +51 -0
- package/dist/localdb/delete-batch.d.ts.map +1 -0
- package/dist/localdb/delete-batch.js +132 -0
- package/dist/localdb/delete-batch.js.map +1 -0
- package/dist/localdb/delete.d.ts +81 -0
- package/dist/localdb/delete.d.ts.map +1 -0
- package/dist/localdb/delete.js +736 -0
- package/dist/localdb/delete.js.map +1 -0
- package/dist/localdb/deps.d.ts +54 -0
- package/dist/localdb/deps.d.ts.map +1 -0
- package/dist/localdb/deps.js +10 -0
- package/dist/localdb/deps.js.map +1 -0
- package/dist/localdb/driver.d.ts +67 -0
- package/dist/localdb/driver.d.ts.map +1 -0
- package/dist/localdb/driver.js +3 -0
- package/dist/localdb/driver.js.map +1 -0
- package/dist/localdb/encode.d.ts +217 -0
- package/dist/localdb/encode.d.ts.map +1 -0
- package/dist/localdb/encode.js +502 -0
- package/dist/localdb/encode.js.map +1 -0
- package/dist/localdb/fence.d.ts +31 -0
- package/dist/localdb/fence.d.ts.map +1 -0
- package/dist/localdb/fence.js +69 -0
- package/dist/localdb/fence.js.map +1 -0
- package/dist/localdb/history.d.ts +74 -0
- package/dist/localdb/history.d.ts.map +1 -0
- package/dist/localdb/history.js +266 -0
- package/dist/localdb/history.js.map +1 -0
- package/dist/localdb/import-fingerprint.d.ts +8 -0
- package/dist/localdb/import-fingerprint.d.ts.map +1 -0
- package/dist/localdb/import-fingerprint.js +35 -0
- package/dist/localdb/import-fingerprint.js.map +1 -0
- package/dist/localdb/import-ledger.d.ts +27 -0
- package/dist/localdb/import-ledger.d.ts.map +1 -0
- package/dist/localdb/import-ledger.js +197 -0
- package/dist/localdb/import-ledger.js.map +1 -0
- package/dist/localdb/import-readback.d.ts +8 -0
- package/dist/localdb/import-readback.d.ts.map +1 -0
- package/dist/localdb/import-readback.js +69 -0
- package/dist/localdb/import-readback.js.map +1 -0
- package/dist/localdb/import-snapshot.d.ts +21 -0
- package/dist/localdb/import-snapshot.d.ts.map +1 -0
- package/dist/localdb/import-snapshot.js +94 -0
- package/dist/localdb/import-snapshot.js.map +1 -0
- package/dist/localdb/index.d.ts +39 -0
- package/dist/localdb/index.d.ts.map +1 -0
- package/dist/localdb/index.js +36 -0
- package/dist/localdb/index.js.map +1 -0
- package/dist/localdb/legacy-import-types.d.ts +110 -0
- package/dist/localdb/legacy-import-types.d.ts.map +1 -0
- package/dist/localdb/legacy-import-types.js +2 -0
- package/dist/localdb/legacy-import-types.js.map +1 -0
- package/dist/localdb/legacy-import.d.ts +36 -0
- package/dist/localdb/legacy-import.d.ts.map +1 -0
- package/dist/localdb/legacy-import.js +288 -0
- package/dist/localdb/legacy-import.js.map +1 -0
- package/dist/localdb/legacy-retire.d.ts +26 -0
- package/dist/localdb/legacy-retire.d.ts.map +1 -0
- package/dist/localdb/legacy-retire.js +93 -0
- package/dist/localdb/legacy-retire.js.map +1 -0
- package/dist/localdb/lifetime-boundary.d.ts +49 -0
- package/dist/localdb/lifetime-boundary.d.ts.map +1 -0
- package/dist/localdb/lifetime-boundary.js +74 -0
- package/dist/localdb/lifetime-boundary.js.map +1 -0
- package/dist/localdb/listing.d.ts +51 -0
- package/dist/localdb/listing.d.ts.map +1 -0
- package/dist/localdb/listing.js +231 -0
- package/dist/localdb/listing.js.map +1 -0
- package/dist/localdb/merge.d.ts +95 -0
- package/dist/localdb/merge.d.ts.map +1 -0
- package/dist/localdb/merge.js +282 -0
- package/dist/localdb/merge.js.map +1 -0
- package/dist/localdb/migrate.d.ts +10 -0
- package/dist/localdb/migrate.d.ts.map +1 -0
- package/dist/localdb/migrate.js +27 -0
- package/dist/localdb/migrate.js.map +1 -0
- package/dist/localdb/name.d.ts +3 -0
- package/dist/localdb/name.d.ts.map +1 -0
- package/dist/localdb/name.js +8 -0
- package/dist/localdb/name.js.map +1 -0
- package/dist/localdb/older-versions.d.ts +49 -0
- package/dist/localdb/older-versions.d.ts.map +1 -0
- package/dist/localdb/older-versions.js +172 -0
- package/dist/localdb/older-versions.js.map +1 -0
- package/dist/localdb/open.d.ts +19 -0
- package/dist/localdb/open.d.ts.map +1 -0
- package/dist/localdb/open.js +46 -0
- package/dist/localdb/open.js.map +1 -0
- package/dist/localdb/part-layout.d.ts +74 -0
- package/dist/localdb/part-layout.d.ts.map +1 -0
- package/dist/localdb/part-layout.js +203 -0
- package/dist/localdb/part-layout.js.map +1 -0
- package/dist/localdb/publish-meter.d.ts +45 -0
- package/dist/localdb/publish-meter.d.ts.map +1 -0
- package/dist/localdb/publish-meter.js +62 -0
- package/dist/localdb/publish-meter.js.map +1 -0
- package/dist/localdb/publish.d.ts +47 -0
- package/dist/localdb/publish.d.ts.map +1 -0
- package/dist/localdb/publish.js +2100 -0
- package/dist/localdb/publish.js.map +1 -0
- package/dist/localdb/purge.d.ts +23 -0
- package/dist/localdb/purge.d.ts.map +1 -0
- package/dist/localdb/purge.js +75 -0
- package/dist/localdb/purge.js.map +1 -0
- package/dist/localdb/query.d.ts +69 -0
- package/dist/localdb/query.d.ts.map +1 -0
- package/dist/localdb/query.js +306 -0
- package/dist/localdb/query.js.map +1 -0
- package/dist/localdb/queue.d.ts +10 -0
- package/dist/localdb/queue.d.ts.map +1 -0
- package/dist/localdb/queue.js +31 -0
- package/dist/localdb/queue.js.map +1 -0
- package/dist/localdb/read-selection.d.ts +103 -0
- package/dist/localdb/read-selection.d.ts.map +1 -0
- package/dist/localdb/read-selection.js +141 -0
- package/dist/localdb/read-selection.js.map +1 -0
- package/dist/localdb/registry-view.d.ts +65 -0
- package/dist/localdb/registry-view.d.ts.map +1 -0
- package/dist/localdb/registry-view.js +73 -0
- package/dist/localdb/registry-view.js.map +1 -0
- package/dist/localdb/replace.d.ts +33 -0
- package/dist/localdb/replace.d.ts.map +1 -0
- package/dist/localdb/replace.js +22 -0
- package/dist/localdb/replace.js.map +1 -0
- package/dist/localdb/requirements.d.ts +35 -0
- package/dist/localdb/requirements.d.ts.map +1 -0
- package/dist/localdb/requirements.js +66 -0
- package/dist/localdb/requirements.js.map +1 -0
- package/dist/localdb/resolve.d.ts +43 -0
- package/dist/localdb/resolve.d.ts.map +1 -0
- package/dist/localdb/resolve.js +265 -0
- package/dist/localdb/resolve.js.map +1 -0
- package/dist/localdb/run-end.d.ts +19 -0
- package/dist/localdb/run-end.d.ts.map +1 -0
- package/dist/localdb/run-end.js +283 -0
- package/dist/localdb/run-end.js.map +1 -0
- package/dist/localdb/run-intake.d.ts +16 -0
- package/dist/localdb/run-intake.d.ts.map +1 -0
- package/dist/localdb/run-intake.js +441 -0
- package/dist/localdb/run-intake.js.map +1 -0
- package/dist/localdb/run-receipts.d.ts +19 -0
- package/dist/localdb/run-receipts.d.ts.map +1 -0
- package/dist/localdb/run-receipts.js +151 -0
- package/dist/localdb/run-receipts.js.map +1 -0
- package/dist/localdb/schema.d.ts +7 -0
- package/dist/localdb/schema.d.ts.map +1 -0
- package/dist/localdb/schema.js +312 -0
- package/dist/localdb/schema.js.map +1 -0
- package/dist/localdb/seed.d.ts +39 -0
- package/dist/localdb/seed.d.ts.map +1 -0
- package/dist/localdb/seed.js +188 -0
- package/dist/localdb/seed.js.map +1 -0
- package/dist/localdb/slot.d.ts +9 -0
- package/dist/localdb/slot.d.ts.map +1 -0
- package/dist/localdb/slot.js +15 -0
- package/dist/localdb/slot.js.map +1 -0
- package/dist/localdb/sync.d.ts +53 -0
- package/dist/localdb/sync.d.ts.map +1 -0
- package/dist/localdb/sync.js +211 -0
- package/dist/localdb/sync.js.map +1 -0
- package/dist/localdb/transfer-memory.d.ts +17 -0
- package/dist/localdb/transfer-memory.d.ts.map +1 -0
- package/dist/localdb/transfer-memory.js +17 -0
- package/dist/localdb/transfer-memory.js.map +1 -0
- package/dist/localdb/unwrite.d.ts +22 -0
- package/dist/localdb/unwrite.d.ts.map +1 -0
- package/dist/localdb/unwrite.js +46 -0
- package/dist/localdb/unwrite.js.map +1 -0
- package/dist/localdb/upload-wave.d.ts +34 -0
- package/dist/localdb/upload-wave.d.ts.map +1 -0
- package/dist/localdb/upload-wave.js +30 -0
- package/dist/localdb/upload-wave.js.map +1 -0
- package/dist/localdb/verified-heads.d.ts +13 -0
- package/dist/localdb/verified-heads.d.ts.map +1 -0
- package/dist/localdb/verified-heads.js +56 -0
- package/dist/localdb/verified-heads.js.map +1 -0
- package/dist/localdb/view-changes.d.ts +58 -0
- package/dist/localdb/view-changes.d.ts.map +1 -0
- package/dist/localdb/view-changes.js +174 -0
- package/dist/localdb/view-changes.js.map +1 -0
- package/dist/mcp/approval-url.d.ts +100 -0
- package/dist/mcp/approval-url.d.ts.map +1 -0
- package/dist/mcp/approval-url.js +171 -0
- package/dist/mcp/approval-url.js.map +1 -0
- package/dist/mcp/connection-api.d.ts +239 -3
- package/dist/mcp/connection-api.d.ts.map +1 -1
- package/dist/mcp/connection-api.js +792 -27
- package/dist/mcp/connection-api.js.map +1 -1
- package/dist/mcp/grant-registration.d.ts +15 -0
- package/dist/mcp/grant-registration.d.ts.map +1 -0
- package/dist/mcp/grant-registration.js +44 -0
- package/dist/mcp/grant-registration.js.map +1 -0
- package/dist/mcp/grantee.d.ts +1 -1
- package/dist/mcp/grantee.d.ts.map +1 -1
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +5 -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 +27 -3
- package/dist/mcp/read-client.d.ts.map +1 -1
- package/dist/mcp/read-client.js +325 -19
- package/dist/mcp/read-client.js.map +1 -1
- package/dist/mcp/resources.d.ts +3 -1
- package/dist/mcp/resources.d.ts.map +1 -1
- package/dist/mcp/resources.js +14 -2
- package/dist/mcp/resources.js.map +1 -1
- package/dist/mcp/server.d.ts +47 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +219 -17
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts +3 -1
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +58 -11
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/store.d.ts +23 -1
- package/dist/mcp/store.d.ts.map +1 -1
- package/dist/mcp/store.js +102 -1
- 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 +154 -3
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +660 -39
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/types.d.ts +105 -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 +330 -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 +19 -0
- package/dist/policy/reserved-scopes.js.map +1 -0
- package/dist/ports/index.d.ts +323 -10
- 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 +137 -0
- package/dist/publication/publish.d.ts.map +1 -0
- package/dist/publication/publish.js +278 -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 +81 -0
- package/dist/schemas/server-config.d.ts.map +1 -1
- package/dist/schemas/server-config.js +179 -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 +33 -3
- 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/rate-limit-policy.d.ts +66 -0
- package/dist/storage/adapters/rate-limit-policy.d.ts.map +1 -0
- package/dist/storage/adapters/rate-limit-policy.js +103 -0
- package/dist/storage/adapters/rate-limit-policy.js.map +1 -0
- package/dist/storage/adapters/sdk.d.ts +9 -1
- package/dist/storage/adapters/sdk.d.ts.map +1 -1
- package/dist/storage/adapters/sdk.js +32 -8
- package/dist/storage/adapters/sdk.js.map +1 -1
- package/dist/storage/adapters/throttle.d.ts +30 -0
- package/dist/storage/adapters/throttle.d.ts.map +1 -0
- package/dist/storage/adapters/throttle.js +94 -0
- package/dist/storage/adapters/throttle.js.map +1 -0
- package/dist/storage/adapters/vana-audience.d.ts +27 -0
- package/dist/storage/adapters/vana-audience.d.ts.map +1 -0
- package/dist/storage/adapters/vana-audience.js +99 -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 +128 -18
- 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 +46 -5
- 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 +201 -0
- package/dist/storage/legacy-scope-view.d.ts.map +1 -0
- package/dist/storage/legacy-scope-view.js +1044 -0
- package/dist/storage/legacy-scope-view.js.map +1 -0
- package/dist/storage/legacy-write-seal.d.ts +73 -0
- package/dist/storage/legacy-write-seal.d.ts.map +1 -0
- package/dist/storage/legacy-write-seal.js +71 -0
- package/dist/storage/legacy-write-seal.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 +204 -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 +38 -0
- package/dist/stream-sync/artifacts.d.ts.map +1 -0
- package/dist/stream-sync/artifacts.js +141 -0
- package/dist/stream-sync/artifacts.js.map +1 -0
- package/dist/stream-sync/blobs.d.ts +18 -0
- package/dist/stream-sync/blobs.d.ts.map +1 -0
- package/dist/stream-sync/blobs.js +83 -0
- package/dist/stream-sync/blobs.js.map +1 -0
- package/dist/stream-sync/crypto-port.d.ts +20 -0
- package/dist/stream-sync/crypto-port.d.ts.map +1 -0
- package/dist/stream-sync/crypto-port.js +19 -0
- package/dist/stream-sync/crypto-port.js.map +1 -0
- package/dist/stream-sync/crypto.d.ts +27 -0
- package/dist/stream-sync/crypto.d.ts.map +1 -0
- package/dist/stream-sync/crypto.js +67 -0
- package/dist/stream-sync/crypto.js.map +1 -0
- package/dist/stream-sync/delete-metadata.d.ts +23 -0
- package/dist/stream-sync/delete-metadata.d.ts.map +1 -0
- package/dist/stream-sync/delete-metadata.js +40 -0
- package/dist/stream-sync/delete-metadata.js.map +1 -0
- package/dist/stream-sync/index.d.ts +13 -0
- package/dist/stream-sync/index.d.ts.map +1 -0
- package/dist/stream-sync/index.js +13 -0
- package/dist/stream-sync/index.js.map +1 -0
- package/dist/stream-sync/intake.d.ts +185 -0
- package/dist/stream-sync/intake.d.ts.map +1 -0
- package/dist/stream-sync/intake.js +36 -0
- package/dist/stream-sync/intake.js.map +1 -0
- package/dist/stream-sync/memory-registry.d.ts +58 -0
- package/dist/stream-sync/memory-registry.d.ts.map +1 -0
- package/dist/stream-sync/memory-registry.js +119 -0
- package/dist/stream-sync/memory-registry.js.map +1 -0
- package/dist/stream-sync/ports.d.ts +363 -0
- package/dist/stream-sync/ports.d.ts.map +1 -0
- package/dist/stream-sync/ports.js +68 -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 +217 -0
- package/dist/stream-sync/publish-plan.js.map +1 -0
- package/dist/stream-sync/registry.d.ts +24 -0
- package/dist/stream-sync/registry.d.ts.map +1 -0
- package/dist/stream-sync/registry.js +389 -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/seed-staging.d.ts +85 -0
- package/dist/stream-sync/seed-staging.d.ts.map +1 -0
- package/dist/stream-sync/seed-staging.js +325 -0
- package/dist/stream-sync/seed-staging.js.map +1 -0
- package/dist/stream-sync/send-gate.d.ts +149 -0
- package/dist/stream-sync/send-gate.d.ts.map +1 -0
- package/dist/stream-sync/send-gate.js +382 -0
- package/dist/stream-sync/send-gate.js.map +1 -0
- package/dist/stream-sync/storage-retry.d.ts +210 -0
- package/dist/stream-sync/storage-retry.d.ts.map +1 -0
- package/dist/stream-sync/storage-retry.js +314 -0
- package/dist/stream-sync/storage-retry.js.map +1 -0
- package/dist/stream-sync/stream-aead.d.ts +33 -0
- package/dist/stream-sync/stream-aead.d.ts.map +1 -0
- package/dist/stream-sync/stream-aead.js +183 -0
- package/dist/stream-sync/stream-aead.js.map +1 -0
- package/dist/stream-sync-read/index.d.ts +4 -0
- package/dist/stream-sync-read/index.d.ts.map +1 -0
- package/dist/stream-sync-read/index.js +3 -0
- package/dist/stream-sync-read/index.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.d.ts +196 -0
- package/dist/stream-sync-read/service.d.ts.map +1 -0
- package/dist/stream-sync-read/service.js +17 -0
- package/dist/stream-sync-read/service.js.map +1 -0
- package/dist/sync/account-mode/authority.d.ts +56 -0
- package/dist/sync/account-mode/authority.d.ts.map +1 -0
- package/dist/sync/account-mode/authority.js +145 -0
- package/dist/sync/account-mode/authority.js.map +1 -0
- package/dist/sync/account-mode/evidence-wire.d.ts +23 -0
- package/dist/sync/account-mode/evidence-wire.d.ts.map +1 -0
- package/dist/sync/account-mode/evidence-wire.js +37 -0
- package/dist/sync/account-mode/evidence-wire.js.map +1 -0
- package/dist/sync/account-mode/import-waker.d.ts +36 -0
- package/dist/sync/account-mode/import-waker.d.ts.map +1 -0
- package/dist/sync/account-mode/import-waker.js +55 -0
- package/dist/sync/account-mode/import-waker.js.map +1 -0
- package/dist/sync/account-mode/index.d.ts +10 -0
- package/dist/sync/account-mode/index.d.ts.map +1 -0
- package/dist/sync/account-mode/index.js +10 -0
- package/dist/sync/account-mode/index.js.map +1 -0
- package/dist/sync/account-mode/port.d.ts +11 -0
- package/dist/sync/account-mode/port.d.ts.map +1 -0
- package/dist/sync/account-mode/port.js +21 -0
- package/dist/sync/account-mode/port.js.map +1 -0
- package/dist/sync/account-mode/record.d.ts +52 -0
- package/dist/sync/account-mode/record.d.ts.map +1 -0
- package/dist/sync/account-mode/record.js +60 -0
- package/dist/sync/account-mode/record.js.map +1 -0
- package/dist/sync/account-mode/rw-lock.d.ts +14 -0
- package/dist/sync/account-mode/rw-lock.d.ts.map +1 -0
- package/dist/sync/account-mode/rw-lock.js +59 -0
- package/dist/sync/account-mode/rw-lock.js.map +1 -0
- package/dist/sync/cancellable-gateway.d.ts +25 -0
- package/dist/sync/cancellable-gateway.d.ts.map +1 -0
- package/dist/sync/cancellable-gateway.js +64 -0
- package/dist/sync/cancellable-gateway.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/change-probe.d.ts +42 -0
- package/dist/sync/engine/change-probe.d.ts.map +1 -0
- package/dist/sync/engine/change-probe.js +79 -0
- package/dist/sync/engine/change-probe.js.map +1 -0
- package/dist/sync/engine/change-push.d.ts +53 -0
- package/dist/sync/engine/change-push.d.ts.map +1 -0
- package/dist/sync/engine/change-push.js +153 -0
- package/dist/sync/engine/change-push.js.map +1 -0
- package/dist/sync/engine/sync-manager.d.ts +181 -2
- package/dist/sync/engine/sync-manager.d.ts.map +1 -1
- package/dist/sync/engine/sync-manager.js +642 -19
- package/dist/sync/engine/sync-manager.js.map +1 -1
- package/dist/sync/index.d.ts +11 -3
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +11 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/pdpp-import.d.ts +202 -0
- package/dist/sync/pdpp-import.d.ts.map +1 -0
- package/dist/sync/pdpp-import.js +466 -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 +26 -0
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/upload-attempts.d.ts +218 -0
- package/dist/sync/upload-attempts.d.ts.map +1 -0
- package/dist/sync/upload-attempts.js +500 -0
- package/dist/sync/upload-attempts.js.map +1 -0
- package/dist/sync/upload-state.d.ts +163 -0
- package/dist/sync/upload-state.d.ts.map +1 -0
- package/dist/sync/upload-state.js +239 -0
- package/dist/sync/upload-state.js.map +1 -0
- package/dist/sync/workers/delete.d.ts +63 -6
- package/dist/sync/workers/delete.d.ts.map +1 -1
- package/dist/sync/workers/delete.js +621 -168
- package/dist/sync/workers/delete.js.map +1 -1
- package/dist/sync/workers/download.d.ts +27 -1
- package/dist/sync/workers/download.d.ts.map +1 -1
- package/dist/sync/workers/download.js +368 -27
- 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 +97 -8
- package/dist/sync/workers/upload.d.ts.map +1 -1
- package/dist/sync/workers/upload.js +498 -277
- package/dist/sync/workers/upload.js.map +1 -1
- package/dist/test-support/memory-oracle.calibration.d.ts +16 -0
- package/dist/test-support/memory-oracle.calibration.d.ts.map +1 -0
- package/dist/test-support/memory-oracle.calibration.js +43 -0
- package/dist/test-support/memory-oracle.calibration.js.map +1 -0
- package/dist/test-support/memory-oracle.d.ts +82 -0
- package/dist/test-support/memory-oracle.d.ts.map +1 -0
- package/dist/test-support/memory-oracle.js +104 -0
- package/dist/test-support/memory-oracle.js.map +1 -0
- package/dist/test-utils/account-mode.d.ts +36 -0
- package/dist/test-utils/account-mode.d.ts.map +1 -0
- package/dist/test-utils/account-mode.js +77 -0
- package/dist/test-utils/account-mode.js.map +1 -0
- package/dist/test-utils/index.d.ts +2 -0
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +2 -0
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/legacy-write-seal.d.ts +16 -0
- package/dist/test-utils/legacy-write-seal.d.ts.map +1 -0
- package/dist/test-utils/legacy-write-seal.js +20 -0
- package/dist/test-utils/legacy-write-seal.js.map +1 -0
- package/dist/test-utils/live-grants.d.ts +24 -0
- package/dist/test-utils/live-grants.d.ts.map +1 -0
- package/dist/test-utils/live-grants.js +6 -0
- package/dist/test-utils/live-grants.js.map +1 -0
- package/dist/test-utils/memory-storage.d.ts +18 -2
- package/dist/test-utils/memory-storage.d.ts.map +1 -1
- package/dist/test-utils/memory-storage.js +156 -42
- 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/dist-test/localdb/conformance.d.ts +13 -0
- package/dist-test/localdb/conformance.d.ts.map +1 -0
- package/dist-test/localdb/conformance.js +292 -0
- package/dist-test/localdb/conformance.js.map +1 -0
- package/dist-test/tsconfig.tsbuildinfo +1 -0
- package/package.json +131 -5
package/dist/mcp/tools.js
CHANGED
|
@@ -1,19 +1,33 @@
|
|
|
1
|
+
import { isMemoryScope, isSystemScope } from "../policy/reserved-scopes.js";
|
|
1
2
|
/**
|
|
2
3
|
* MCP tool surface. Phase 1 / §4 of 260604-PLAN-vana-mcp-personal-server.md.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
5
|
+
* Small, and only over scopes that the connection's grants cover. No
|
|
6
|
+
* grant-approval tools. No raw owner/admin status tools.
|
|
6
7
|
*
|
|
7
8
|
* Every tool that returns data first picks a covering grant from the
|
|
8
9
|
* connection's grant list, signs a Web3Signed request as the per-connection
|
|
9
10
|
* grantee, and uses the bounded sidecar read path — so reads are grant-gated,
|
|
10
11
|
* access-logged, and safe for large scopes.
|
|
12
|
+
*
|
|
13
|
+
* The one write tool, `remember`, saves only into a scope a `write:` grant
|
|
14
|
+
* entry covers, and goes through the delegated-write path a builder uses
|
|
15
|
+
* (see write-client.ts). A read grant never confers write access, and a
|
|
16
|
+
* `write:` entry never confers read access.
|
|
11
17
|
*/
|
|
12
18
|
import { z } from "zod";
|
|
19
|
+
import { MCP_SCOPE_ACCESS_REQUEST_LIMIT, } from "./types.js";
|
|
13
20
|
import { McpDataReadError } from "./read-client.js";
|
|
21
|
+
import { McpDataWriteError } from "./write-client.js";
|
|
22
|
+
import { isWriteScopeEntry, writeScopePatterns, WRITE_SCOPE_PREFIX, } from "../policy/data-write.js";
|
|
23
|
+
import { toMcpScopeAccessRequestView, } from "./connection-api.js";
|
|
24
|
+
import { buildMcpScopeRequestOpenerUrl, isOpenerEligibleApprovalUrl, resolveMcpScopeRequestApprovalUrl, } from "./approval-url.js";
|
|
14
25
|
import { MiniSearchIndex } from "./search/index.js";
|
|
15
26
|
import { MAX_SELECTED_BLOCK_IDS } from "../storage/blocks/index.js";
|
|
16
27
|
import { rawScopeFileInputSchema, rawScopeMetadata, rawScopeResourceUri, } from "./resources.js";
|
|
28
|
+
/** Tool names the read path stamps onto access records. */
|
|
29
|
+
const READ_SCOPE_TOOL = "read_scope";
|
|
30
|
+
const SEARCH_PERSONAL_CONTEXT_TOOL = "search_personal_context";
|
|
17
31
|
const STRUCTURED_CONTENT_TEXT_LIMIT_BYTES = 64 * 1024;
|
|
18
32
|
const resultTextEncoder = new TextEncoder();
|
|
19
33
|
/**
|
|
@@ -41,23 +55,92 @@ function textResult(value, isError = false) {
|
|
|
41
55
|
...(isError ? { isError: true } : {}),
|
|
42
56
|
};
|
|
43
57
|
}
|
|
58
|
+
/** A grant entry that names readable data: not a system scope, not `write:`. */
|
|
59
|
+
function isReadableScopeEntry(scope) {
|
|
60
|
+
return !isSystemScope(scope) && !isWriteScopeEntry(scope);
|
|
61
|
+
}
|
|
44
62
|
function uniqueScopes(connection) {
|
|
45
63
|
const set = new Set();
|
|
46
64
|
for (const grant of connection.grants) {
|
|
47
|
-
for (const scope of grant.scopes)
|
|
65
|
+
for (const scope of grant.scopes) {
|
|
66
|
+
if (isReadableScopeEntry(scope))
|
|
67
|
+
set.add(scope);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return Array.from(set).sort();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A scope `remember` may save into under these grant entries: an exact
|
|
74
|
+
* `write:<scope>` entry. MCP writes never honor a `write:` wildcard, even one
|
|
75
|
+
* an older grant still carries, although builder writes do: a memory grant
|
|
76
|
+
* names the one scope the agent saves into.
|
|
77
|
+
*/
|
|
78
|
+
function exactWriteScopes(grantScopes) {
|
|
79
|
+
return writeScopePatterns(grantScopes).filter((scope) => !scope.includes("*") && !isSystemScope(scope));
|
|
80
|
+
}
|
|
81
|
+
/** Scopes the connection may save into, `write:` prefix stripped. */
|
|
82
|
+
function uniqueWritableScopes(connection) {
|
|
83
|
+
const set = new Set();
|
|
84
|
+
for (const grant of connection.grants) {
|
|
85
|
+
for (const scope of exactWriteScopes(grant.scopes))
|
|
48
86
|
set.add(scope);
|
|
49
87
|
}
|
|
50
88
|
return Array.from(set).sort();
|
|
51
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Every data scope (or pattern) the connection may read or write, `write:`
|
|
92
|
+
* prefix stripped. A host that copies data in before serving a connection
|
|
93
|
+
* (the enclave) must copy write targets too: `remember` rewrites the whole
|
|
94
|
+
* memory list from the local copy, so a missing copy would drop memories.
|
|
95
|
+
*/
|
|
96
|
+
export function connectionDataScopes(connection) {
|
|
97
|
+
const set = new Set();
|
|
98
|
+
for (const grant of connection.grants) {
|
|
99
|
+
for (const scope of grant.scopes) {
|
|
100
|
+
const target = isWriteScopeEntry(scope)
|
|
101
|
+
? scope.slice(WRITE_SCOPE_PREFIX.length)
|
|
102
|
+
: scope;
|
|
103
|
+
if (target)
|
|
104
|
+
set.add(target);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return Array.from(set).sort();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Resolve a scope to a grant with an exact `write:` entry for it (see
|
|
111
|
+
* exactWriteScopes). The server-side write policy still runs on every save;
|
|
112
|
+
* this only narrows what the tool will attempt.
|
|
113
|
+
*/
|
|
114
|
+
export function resolveWriteGrantForScope(connection, scope) {
|
|
115
|
+
for (const grant of connection.grants) {
|
|
116
|
+
if (exactWriteScopes(grant.scopes).includes(scope)) {
|
|
117
|
+
return { grantId: grant.grantId, scopes: grant.scopes };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Whether the connection already holds `scope` as a scope request names it:
|
|
124
|
+
* a `write:` entry is covered only by write grants, anything else by reads.
|
|
125
|
+
*/
|
|
126
|
+
function connectionCoversRequestedScope(connection, scope) {
|
|
127
|
+
return isWriteScopeEntry(scope)
|
|
128
|
+
? Boolean(resolveWriteGrantForScope(connection, scope.slice(WRITE_SCOPE_PREFIX.length)))
|
|
129
|
+
: Boolean(resolveGrantForScope(connection, scope));
|
|
130
|
+
}
|
|
52
131
|
function uniqueSources(connection) {
|
|
53
132
|
const set = new Set();
|
|
54
133
|
for (const grant of connection.grants) {
|
|
134
|
+
if (!grant.scopes.some(isReadableScopeEntry))
|
|
135
|
+
continue;
|
|
55
136
|
const sourceId = typeof grant.sourceId === "string" ? grant.sourceId.trim() : "";
|
|
56
137
|
if (sourceId) {
|
|
57
138
|
set.add(sourceId);
|
|
58
139
|
continue;
|
|
59
140
|
}
|
|
60
141
|
for (const scope of grant.scopes) {
|
|
142
|
+
if (!isReadableScopeEntry(scope))
|
|
143
|
+
continue;
|
|
61
144
|
const [scopeSourceId] = scope.split(".");
|
|
62
145
|
if (scopeSourceId && scopeSourceId !== "*") {
|
|
63
146
|
set.add(scopeSourceId);
|
|
@@ -153,6 +236,28 @@ const SEARCH_REQUESTED_SCOPES_LIMIT = MAX_SEARCH_SCOPES * 2;
|
|
|
153
236
|
const SEARCH_SKIPPED_SCOPES_LIMIT = 50;
|
|
154
237
|
const SEARCH_PREVIEW_CHARS = 600;
|
|
155
238
|
const LIST_SCOPES_LIMIT = 200;
|
|
239
|
+
const scopeAccessRequestInputShape = {
|
|
240
|
+
scopes: z
|
|
241
|
+
.array(z.string().min(1).max(SEARCH_SCOPE_MAX_CHARS))
|
|
242
|
+
.min(1)
|
|
243
|
+
.max(MCP_SCOPE_ACCESS_REQUEST_LIMIT)
|
|
244
|
+
.describe("Exact scope ids to read, or write:<scope> to save into."),
|
|
245
|
+
reason: z
|
|
246
|
+
.string()
|
|
247
|
+
.max(500)
|
|
248
|
+
.optional()
|
|
249
|
+
.describe("Brief reason to show the user."),
|
|
250
|
+
};
|
|
251
|
+
export function parseScopeAccessRequestArguments(value) {
|
|
252
|
+
const parsed = z.object(scopeAccessRequestInputShape).safeParse(value);
|
|
253
|
+
if (!parsed.success)
|
|
254
|
+
return null;
|
|
255
|
+
const scopes = normalizeScopeListInput(parsed.data.scopes);
|
|
256
|
+
if (scopes.length === 0)
|
|
257
|
+
return null;
|
|
258
|
+
const reason = parsed.data.reason?.trim();
|
|
259
|
+
return { scopes, ...(reason ? { reason } : {}) };
|
|
260
|
+
}
|
|
156
261
|
// Size thresholds for sizeClass classification (raw envelope bytes)
|
|
157
262
|
const SIZE_CLASS_TINY_BYTES = 10_000;
|
|
158
263
|
const SIZE_CLASS_SMALL_BYTES = 100_000;
|
|
@@ -178,7 +283,9 @@ class OperationTimeoutError extends Error {
|
|
|
178
283
|
* tool surface never offers Claude a scope its grant won't actually pass
|
|
179
284
|
* server-side.
|
|
180
285
|
*/
|
|
181
|
-
function resolveGrantForScope(connection, scope) {
|
|
286
|
+
export function resolveGrantForScope(connection, scope) {
|
|
287
|
+
if (isSystemScope(scope))
|
|
288
|
+
return null;
|
|
182
289
|
for (const grant of connection.grants) {
|
|
183
290
|
for (const granted of grant.scopes) {
|
|
184
291
|
if (granted === scope) {
|
|
@@ -293,7 +400,7 @@ function miniSearchMatchIndex(text, terms) {
|
|
|
293
400
|
}
|
|
294
401
|
return 0;
|
|
295
402
|
}
|
|
296
|
-
async function withTimeout(promise, timeoutMs, operation) {
|
|
403
|
+
export async function withTimeout(promise, timeoutMs, operation) {
|
|
297
404
|
let timeout;
|
|
298
405
|
try {
|
|
299
406
|
return await Promise.race([
|
|
@@ -428,6 +535,7 @@ async function resolveSearchScopes({ connection, maxScopes, discoveryTimeoutMs,
|
|
|
428
535
|
const listed = await withTimeout(readClient.listScopes({
|
|
429
536
|
scopePrefix: prefix,
|
|
430
537
|
limit: LIST_SCOPES_LIMIT,
|
|
538
|
+
grantId: grant.grantId,
|
|
431
539
|
}), discoveryTimeoutMs, `list scopes for ${requested}`);
|
|
432
540
|
for (const summary of listed.scopes) {
|
|
433
541
|
if (resolveGrantForScope(connection, summary.scope)) {
|
|
@@ -462,6 +570,90 @@ async function resolveSearchScopes({ connection, maxScopes, discoveryTimeoutMs,
|
|
|
462
570
|
errors,
|
|
463
571
|
};
|
|
464
572
|
}
|
|
573
|
+
/**
|
|
574
|
+
* Under `scopeRequestGuidance`: appended to the server instructions and the
|
|
575
|
+
* `request_scope_access` description. Identical for every owner.
|
|
576
|
+
*/
|
|
577
|
+
export const SCOPE_REQUEST_GUIDANCE_TEXT = " If the user's question needs data you were not granted, call request_scope_access with the scope ids you need. " +
|
|
578
|
+
"The user chooses in Vana; the response does not tell you whether that data exists.";
|
|
579
|
+
/**
|
|
580
|
+
* Under `scopeRequestGuidance`: added to every `search_personal_context`
|
|
581
|
+
* result, empty ones too. Static: it never depends on hits, counts or which
|
|
582
|
+
* scopes the connection holds.
|
|
583
|
+
*/
|
|
584
|
+
export const SEARCH_COVERAGE_NOTE = "Results cover only scopes granted to you; to search other data, call request_scope_access.";
|
|
585
|
+
/** Appended to the `request_scope_access` description with a host scope list. */
|
|
586
|
+
export function requestableScopesDescription(scopes) {
|
|
587
|
+
const ids = [...new Set(scopes)].sort();
|
|
588
|
+
return ids.length === 0
|
|
589
|
+
? ""
|
|
590
|
+
: ` Scope ids Vana supports (not a list of what this user has): ${ids.join(", ")}`;
|
|
591
|
+
}
|
|
592
|
+
/** Appended to the `list_granted_scopes` description when `notShared` is on. */
|
|
593
|
+
export const UNSHARED_SCOPES_TOOL_DESCRIPTION = " Also lists notShared: data the user has but has not shared with this client.";
|
|
594
|
+
/** Appended to the server instructions when `notShared` is on. */
|
|
595
|
+
export const UNSHARED_SCOPES_INSTRUCTIONS = " list_granted_scopes also returns notShared: data the user has but has not shared with you. " +
|
|
596
|
+
"When the user asks about data in notShared, offer request_scope_access for it.";
|
|
597
|
+
const DEFAULT_OWNER_SCOPE_TIMEOUT_MS = 5_000;
|
|
598
|
+
// The liveness check is optional enrichment: a slow gateway must not cost the
|
|
599
|
+
// caller the whole listing, so it is bounded well below the tool timeout.
|
|
600
|
+
export const GRANT_LIVENESS_TIMEOUT_MS = 3_000;
|
|
601
|
+
/** The live grants. Fail closed: no check, a failed or slow check gives none. */
|
|
602
|
+
export async function liveGrants(verify) {
|
|
603
|
+
if (!verify)
|
|
604
|
+
return [];
|
|
605
|
+
try {
|
|
606
|
+
return await withTimeout(verify(), GRANT_LIVENESS_TIMEOUT_MS, "grant liveness check");
|
|
607
|
+
}
|
|
608
|
+
catch {
|
|
609
|
+
return [];
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
/** True when the connection has grants and every one of them is live. */
|
|
613
|
+
async function grantsStillLive(connection, verify) {
|
|
614
|
+
const live = new Set((await liveGrants(verify)).map((grant) => grant.grantId));
|
|
615
|
+
return (connection.grants.length > 0 &&
|
|
616
|
+
connection.grants.every((grant) => live.has(grant.grantId)));
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Owner scopes with local data that no grant on the connection covers.
|
|
620
|
+
* Reserved, system, memory and write scopes never appear. `[]` when the read
|
|
621
|
+
* client cannot list owner-wide; `null` when the listing failed (unknown
|
|
622
|
+
* account mode, no stream listing, timeout), which is not the same as empty.
|
|
623
|
+
* `notShared` is a hint and must not fail the tool.
|
|
624
|
+
*/
|
|
625
|
+
async function listNotSharedScopes(connection, readClient) {
|
|
626
|
+
if (typeof readClient.listOwnerScopes !== "function")
|
|
627
|
+
return [];
|
|
628
|
+
let owned;
|
|
629
|
+
try {
|
|
630
|
+
owned = await withTimeout(readClient.listOwnerScopes(), DEFAULT_OWNER_SCOPE_TIMEOUT_MS, "owner scope listing");
|
|
631
|
+
}
|
|
632
|
+
catch {
|
|
633
|
+
return null;
|
|
634
|
+
}
|
|
635
|
+
return owned
|
|
636
|
+
.filter((summary) => isReadableScopeEntry(summary.scope) &&
|
|
637
|
+
!isMemoryScope(summary.scope) &&
|
|
638
|
+
!resolveGrantForScope(connection, summary.scope) &&
|
|
639
|
+
// Only what bounded read can serve after approval. "ready" is the
|
|
640
|
+
// listing's own readiness: legacy `storage.hasScopeBlocks`, or, for a
|
|
641
|
+
// switched account, a scope the stream listing selected (the
|
|
642
|
+
// resolver's rule). An "indexing" scope has no block sidecars and
|
|
643
|
+
// `read_scope` answers 503 for it.
|
|
644
|
+
summary.dataStatus === "ready")
|
|
645
|
+
.sort((a, b) => (a.scope < b.scope ? -1 : a.scope > b.scope ? 1 : 0))
|
|
646
|
+
.map((summary) => ({
|
|
647
|
+
scope: summary.scope,
|
|
648
|
+
source: summary.scope.split(".")[0],
|
|
649
|
+
collectedAt: summary.latestCollectedAt,
|
|
650
|
+
dataStatus: "ready",
|
|
651
|
+
}));
|
|
652
|
+
}
|
|
653
|
+
/** The `nextAction` a read-side `scope_not_granted` carries under guidance. */
|
|
654
|
+
function requestAccessNextAction(scopes) {
|
|
655
|
+
return `Call request_scope_access with scopes ${JSON.stringify(scopes)}, then ask the user to approve it in Vana. This does not indicate whether the data exists.`;
|
|
656
|
+
}
|
|
465
657
|
const listGrantedSources = {
|
|
466
658
|
name: "list_granted_sources",
|
|
467
659
|
title: "List granted sources",
|
|
@@ -474,15 +666,15 @@ const listGrantedSources = {
|
|
|
474
666
|
const listGrantedScopes = {
|
|
475
667
|
name: "list_granted_scopes",
|
|
476
668
|
title: "List granted scopes",
|
|
477
|
-
description: "List granted scopes, readiness, size, and recommendedAccess. Call first.",
|
|
669
|
+
description: "List granted scopes, readiness, size, and recommendedAccess. Call first. Omitted scopes have unknown data availability.",
|
|
478
670
|
inputSchema: {},
|
|
479
|
-
async handler(_args, { connection, readClient }) {
|
|
671
|
+
async handler(_args, { connection, readClient, exposeUnsharedScopes, verifyGrantsLive }) {
|
|
480
672
|
const grantedScopes = uniqueScopes(connection);
|
|
481
673
|
const scopeEntries = await Promise.all(grantedScopes.map(async (scope) => {
|
|
482
674
|
let meta = null;
|
|
483
675
|
if (typeof readClient.getScopeMetadata === "function") {
|
|
484
676
|
try {
|
|
485
|
-
meta = await withTimeout(readClient.getScopeMetadata(scope), DEFAULT_SCOPE_METADATA_TIMEOUT_MS, `scope metadata for ${scope}`);
|
|
677
|
+
meta = await withTimeout(readClient.getScopeMetadata(scope, resolveGrantForScope(connection, scope)?.grantId), DEFAULT_SCOPE_METADATA_TIMEOUT_MS, `scope metadata for ${scope}`);
|
|
486
678
|
}
|
|
487
679
|
catch {
|
|
488
680
|
return {
|
|
@@ -519,33 +711,93 @@ const listGrantedScopes = {
|
|
|
519
711
|
reason,
|
|
520
712
|
};
|
|
521
713
|
}));
|
|
522
|
-
|
|
714
|
+
// Lets an agent that asked for more scopes see whether the owner has
|
|
715
|
+
// answered yet without re-recording the request.
|
|
716
|
+
const writableScopes = uniqueWritableScopes(connection);
|
|
717
|
+
const notShared = exposeUnsharedScopes &&
|
|
718
|
+
(await grantsStillLive(connection, verifyGrantsLive))
|
|
719
|
+
? await listNotSharedScopes(connection, readClient)
|
|
720
|
+
: undefined;
|
|
721
|
+
return textResult({
|
|
722
|
+
scopes: scopeEntries,
|
|
723
|
+
...(notShared ? { notShared } : {}),
|
|
724
|
+
...(notShared === null ? { notSharedUnavailable: true } : {}),
|
|
725
|
+
...(writableScopes.length > 0 ? { writableScopes } : {}),
|
|
726
|
+
...(connection.scopeAccessRequest
|
|
727
|
+
? {
|
|
728
|
+
pendingScopeRequest: toMcpScopeAccessRequestView(connection.scopeAccessRequest),
|
|
729
|
+
}
|
|
730
|
+
: {}),
|
|
731
|
+
...(liveDecision(connection)
|
|
732
|
+
? { lastScopeDecision: liveDecision(connection) }
|
|
733
|
+
: {}),
|
|
734
|
+
});
|
|
523
735
|
},
|
|
524
736
|
};
|
|
737
|
+
/**
|
|
738
|
+
* The owner's last answer, as the client may see it. An approval names only
|
|
739
|
+
* scopes this connection still holds live; one whose grants are gone reads as
|
|
740
|
+
* no decision at all, the same as a connection never granted.
|
|
741
|
+
*/
|
|
742
|
+
function liveDecision(connection) {
|
|
743
|
+
const decision = connection.scopeAccessDecision;
|
|
744
|
+
if (decision?.decision !== "approved")
|
|
745
|
+
return decision;
|
|
746
|
+
const approvedScopes = decision.approvedScopes.filter((scope) => resolveGrantForScope(connection, scope));
|
|
747
|
+
return approvedScopes.length > 0
|
|
748
|
+
? { ...decision, approvedScopes }
|
|
749
|
+
: undefined;
|
|
750
|
+
}
|
|
525
751
|
const requestScopeAccess = {
|
|
526
752
|
name: "request_scope_access",
|
|
527
753
|
title: "Request scope access",
|
|
528
|
-
description: "
|
|
529
|
-
inputSchema:
|
|
530
|
-
|
|
531
|
-
.array(z.string().min(1).max(SEARCH_SCOPE_MAX_CHARS))
|
|
532
|
-
.min(1)
|
|
533
|
-
.max(SEARCH_REQUESTED_SCOPES_LIMIT)
|
|
534
|
-
.describe("Exact scope ids the MCP client wants to read."),
|
|
535
|
-
reason: z
|
|
536
|
-
.string()
|
|
537
|
-
.max(500)
|
|
538
|
-
.optional()
|
|
539
|
-
.describe("Brief reason to show the user."),
|
|
540
|
-
},
|
|
541
|
-
async handler(args, { connection }) {
|
|
754
|
+
description: "Record scopes not yet granted on this MCP connection for explicit owner approval in Vana.",
|
|
755
|
+
inputSchema: scopeAccessRequestInputShape,
|
|
756
|
+
async handler(args, { connection, requestScopeAccess, scopeRequestApprovalUrl, scopeRequestReviewHint, serverOrigin, loopbackOrigin, }) {
|
|
542
757
|
const requestedScopes = normalizeScopeListInput(args.scopes);
|
|
543
|
-
|
|
544
|
-
|
|
758
|
+
// Read before recording: a new request must not hide the owner's last
|
|
759
|
+
// answer from the agent that is checking back.
|
|
760
|
+
const previousDecision = liveDecision(connection);
|
|
761
|
+
let effectiveConnection = connection;
|
|
762
|
+
let grantedRequestedScopes = requestedScopes.filter((scope) => connectionCoversRequestedScope(effectiveConnection, scope));
|
|
763
|
+
let missingScopes = requestedScopes.filter((scope) => !connectionCoversRequestedScope(connection, scope));
|
|
545
764
|
const reason = typeof args.reason === "string" ? args.reason.trim() : "";
|
|
546
765
|
const approvalRequired = missingScopes.length > 0;
|
|
766
|
+
const alreadyRecorded = approvalRequired &&
|
|
767
|
+
missingScopes.every((scope) => connection.scopeAccessRequest?.scopes.includes(scope));
|
|
768
|
+
let requestRecorded = alreadyRecorded;
|
|
769
|
+
let readToken;
|
|
770
|
+
if (approvalRequired && requestScopeAccess) {
|
|
771
|
+
const outcome = await requestScopeAccess({
|
|
772
|
+
scopes: missingScopes,
|
|
773
|
+
...(reason ? { reason } : {}),
|
|
774
|
+
liveGrants: connection.grants,
|
|
775
|
+
});
|
|
776
|
+
effectiveConnection = outcome.connection;
|
|
777
|
+
requestRecorded = outcome.requestRecorded;
|
|
778
|
+
readToken = outcome.readToken;
|
|
779
|
+
grantedRequestedScopes = requestedScopes.filter((scope) => connectionCoversRequestedScope(effectiveConnection, scope));
|
|
780
|
+
missingScopes = requestedScopes.filter((scope) => !connectionCoversRequestedScope(effectiveConnection, scope));
|
|
781
|
+
}
|
|
782
|
+
const finalApprovalRequired = missingScopes.length > 0;
|
|
783
|
+
const recorded = finalApprovalRequired && requestRecorded;
|
|
784
|
+
const hostApprovalUrl = recorded
|
|
785
|
+
? resolveMcpScopeRequestApprovalUrl(scopeRequestApprovalUrl, connection.id, {
|
|
786
|
+
serverOrigin,
|
|
787
|
+
...(readToken ? { readToken } : {}),
|
|
788
|
+
})
|
|
789
|
+
: undefined;
|
|
790
|
+
const useOpener = hostApprovalUrl !== undefined &&
|
|
791
|
+
loopbackOrigin !== undefined &&
|
|
792
|
+
isOpenerEligibleApprovalUrl(hostApprovalUrl, resolveMcpScopeRequestApprovalUrl(scopeRequestApprovalUrl, connection.id, {
|
|
793
|
+
serverOrigin,
|
|
794
|
+
}));
|
|
795
|
+
const approvalUrl = useOpener && loopbackOrigin
|
|
796
|
+
? buildMcpScopeRequestOpenerUrl(loopbackOrigin, connection.id)
|
|
797
|
+
: hostApprovalUrl;
|
|
798
|
+
const declinedScopes = previousDecision?.deniedScopes.filter((scope) => missingScopes.includes(scope)) ?? [];
|
|
547
799
|
return textResult({
|
|
548
|
-
approvalRequired,
|
|
800
|
+
approvalRequired: finalApprovalRequired,
|
|
549
801
|
client: {
|
|
550
802
|
id: connection.id,
|
|
551
803
|
displayName: connection.displayName,
|
|
@@ -554,16 +806,45 @@ const requestScopeAccess = {
|
|
|
554
806
|
requestedScopes,
|
|
555
807
|
grantedRequestedScopes,
|
|
556
808
|
missingScopes,
|
|
557
|
-
grantedScopes: uniqueScopes(
|
|
809
|
+
grantedScopes: uniqueScopes(effectiveConnection),
|
|
558
810
|
reason: reason || undefined,
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
811
|
+
requestRecorded: recorded,
|
|
812
|
+
approvalUrl,
|
|
813
|
+
previousDecision,
|
|
814
|
+
nextAction: scopeRequestNextAction({
|
|
815
|
+
finalApprovalRequired,
|
|
816
|
+
recorded,
|
|
817
|
+
approvalUrl,
|
|
818
|
+
approvalUrlIsOpener: useOpener,
|
|
819
|
+
scopeRequestReviewHint,
|
|
820
|
+
declinedScopes,
|
|
821
|
+
}),
|
|
562
822
|
});
|
|
563
823
|
},
|
|
564
824
|
};
|
|
825
|
+
function scopeRequestNextAction(input) {
|
|
826
|
+
if (!input.finalApprovalRequired) {
|
|
827
|
+
return "No new grant is needed for the requested scopes.";
|
|
828
|
+
}
|
|
829
|
+
const declined = input.declinedScopes.length > 0
|
|
830
|
+
? `The owner previously declined ${input.declinedScopes.join(", ")}; only ask again if the user wants to. `
|
|
831
|
+
: "";
|
|
832
|
+
if (!input.recorded) {
|
|
833
|
+
return `${declined}Ask the user to open Vana's Personal Server page and add the missing scopes to this MCP client. This tool cannot grant access by itself.`;
|
|
834
|
+
}
|
|
835
|
+
const reviewHint = input.scopeRequestReviewHint
|
|
836
|
+
? ` ${input.scopeRequestReviewHint}`
|
|
837
|
+
: "";
|
|
838
|
+
if (input.approvalUrl && input.approvalUrlIsOpener) {
|
|
839
|
+
return `${declined}Show the user this link as a markdown link, [Review the request in Vana](${input.approvalUrl}), to review the request. Ask them to approve or decline it there and to tell you when they are done, then call list_granted_scopes to see what was granted. Access remains unchanged until the owner approves.${reviewHint}`;
|
|
840
|
+
}
|
|
841
|
+
if (input.approvalUrl) {
|
|
842
|
+
return `${declined}Show the user this link to review the request: ${input.approvalUrl} . Ask them to approve or decline it there and to tell you when they are done, then call list_granted_scopes to see what was granted. Access remains unchanged until the owner approves.${reviewHint}`;
|
|
843
|
+
}
|
|
844
|
+
return `${declined}Ask the user to review this request in Vana and approve or decline it. Access remains unchanged until the owner approves it.${reviewHint}`;
|
|
845
|
+
}
|
|
565
846
|
const readScope = {
|
|
566
|
-
name:
|
|
847
|
+
name: READ_SCOPE_TOOL,
|
|
567
848
|
title: "Read scope",
|
|
568
849
|
description: "Read approved scope blocks. Pass blockIds to fetch exact blocks; otherwise page with nextCursor.",
|
|
569
850
|
inputSchema: {
|
|
@@ -587,7 +868,7 @@ const readScope = {
|
|
|
587
868
|
.optional()
|
|
588
869
|
.describe("Base64 X-PAYMENT proof (x402). Provide it after a prior call returned payment_required."),
|
|
589
870
|
},
|
|
590
|
-
async handler(args, { connection, readClient }) {
|
|
871
|
+
async handler(args, { connection, readClient, scopeRequestGuidance }) {
|
|
591
872
|
const scope = typeof args.scope === "string" ? args.scope : null;
|
|
592
873
|
if (!scope) {
|
|
593
874
|
return textResult({ error: "scope is required and must be a string" }, true);
|
|
@@ -598,6 +879,9 @@ const readScope = {
|
|
|
598
879
|
error: "scope_not_granted",
|
|
599
880
|
message: `Scope '${scope}' is not covered by any grant on this MCP connection.`,
|
|
600
881
|
grantedScopes: uniqueScopes(connection),
|
|
882
|
+
...(scopeRequestGuidance
|
|
883
|
+
? { nextAction: requestAccessNextAction([scope]) }
|
|
884
|
+
: {}),
|
|
601
885
|
}, true);
|
|
602
886
|
}
|
|
603
887
|
const cursor = typeof args.cursor === "string" ? args.cursor : undefined;
|
|
@@ -613,7 +897,7 @@ const readScope = {
|
|
|
613
897
|
// must never delay the read or consume the read timeout budget.
|
|
614
898
|
let guidance;
|
|
615
899
|
if (typeof readClient.getScopeMetadata === "function") {
|
|
616
|
-
void withTimeout(readClient.getScopeMetadata(scope), DEFAULT_SCOPE_METADATA_TIMEOUT_MS, `scope metadata for ${scope}`)
|
|
900
|
+
void withTimeout(readClient.getScopeMetadata(scope, grant.grantId), DEFAULT_SCOPE_METADATA_TIMEOUT_MS, `scope metadata for ${scope}`)
|
|
617
901
|
.then((meta) => {
|
|
618
902
|
if (!meta)
|
|
619
903
|
return;
|
|
@@ -642,6 +926,7 @@ const readScope = {
|
|
|
642
926
|
cursor,
|
|
643
927
|
maxBytes,
|
|
644
928
|
payment,
|
|
929
|
+
tool: READ_SCOPE_TOOL,
|
|
645
930
|
...(blockIds.length > 0 ? { blockIds } : {}),
|
|
646
931
|
}), timeoutMs, `read blocks for ${scope}`);
|
|
647
932
|
const nextCursor = result.nextCursor ?? null;
|
|
@@ -723,7 +1008,7 @@ const listScopeBlocks = {
|
|
|
723
1008
|
offset: z.number().int().min(0).optional(),
|
|
724
1009
|
limit: z.number().int().min(1).max(MAX_LIST_BLOCKS_LIMIT).optional(),
|
|
725
1010
|
},
|
|
726
|
-
async handler(args, { connection, readClient }) {
|
|
1011
|
+
async handler(args, { connection, readClient, scopeRequestGuidance }) {
|
|
727
1012
|
const scope = typeof args.scope === "string" ? args.scope : null;
|
|
728
1013
|
if (!scope) {
|
|
729
1014
|
return textResult({ error: "scope is required and must be a string" }, true);
|
|
@@ -734,6 +1019,9 @@ const listScopeBlocks = {
|
|
|
734
1019
|
error: "scope_not_granted",
|
|
735
1020
|
message: `Scope '${scope}' is not covered by any grant on this MCP connection.`,
|
|
736
1021
|
grantedScopes: uniqueScopes(connection),
|
|
1022
|
+
...(scopeRequestGuidance
|
|
1023
|
+
? { nextAction: requestAccessNextAction([scope]) }
|
|
1024
|
+
: {}),
|
|
737
1025
|
}, true);
|
|
738
1026
|
}
|
|
739
1027
|
if (typeof readClient.readBlockManifest !== "function") {
|
|
@@ -845,9 +1133,9 @@ function decodeSearchCursor(raw) {
|
|
|
845
1133
|
}
|
|
846
1134
|
}
|
|
847
1135
|
const searchPersonalContext = {
|
|
848
|
-
name:
|
|
1136
|
+
name: SEARCH_PERSONAL_CONTEXT_TOOL,
|
|
849
1137
|
title: "Search personal context",
|
|
850
|
-
description: "Search approved scopes. Omit scopes for
|
|
1138
|
+
description: "Search approved scopes. Omit scopes for a sweep of granted scopes only; name scopes for targeted search. Continue with nextSearchCursor. Free discovery/preview — it does not settle payments; chargeable scopes are returned in paymentRequiredScopes, fetch those via read_scope with a `payment` proof.",
|
|
851
1139
|
inputSchema: {
|
|
852
1140
|
query: z.string().min(1).max(SEARCH_QUERY_MAX_CHARS),
|
|
853
1141
|
scopes: z
|
|
@@ -861,7 +1149,7 @@ const searchPersonalContext = {
|
|
|
861
1149
|
timeoutMs: z.number().int().min(1000).max(MAX_SEARCH_TIMEOUT_MS).optional(),
|
|
862
1150
|
maxBytes: z.number().int().min(1).max(MAX_SEARCH_MAX_BYTES).optional(),
|
|
863
1151
|
},
|
|
864
|
-
async handler(args, { connection, readClient }) {
|
|
1152
|
+
async handler(args, { connection, readClient, scopeRequestGuidance }) {
|
|
865
1153
|
const query = typeof args.query === "string" ? args.query.trim() : "";
|
|
866
1154
|
if (!query) {
|
|
867
1155
|
return textResult({ error: "query is required and must be a non-empty string" }, true);
|
|
@@ -901,6 +1189,9 @@ const searchPersonalContext = {
|
|
|
901
1189
|
// `payment` proof, instead of burying the 402 as an opaque scope error.
|
|
902
1190
|
const paymentRequiredScopes = [];
|
|
903
1191
|
const errors = [...resolved.errors];
|
|
1192
|
+
const deniedScopes = resolved.errors
|
|
1193
|
+
.filter((e) => e.error === "scope_not_granted")
|
|
1194
|
+
.map((e) => e.scope);
|
|
904
1195
|
// When resuming, start from the scope index encoded in the cursor
|
|
905
1196
|
const startScopeIndex = resumeCursor
|
|
906
1197
|
? Math.max(0, Math.min(resumeCursor.scopeIndex, resolved.scopes.length))
|
|
@@ -1010,6 +1301,7 @@ const searchPersonalContext = {
|
|
|
1010
1301
|
grantId: grant.grantId,
|
|
1011
1302
|
cursor,
|
|
1012
1303
|
maxBytes,
|
|
1304
|
+
tool: SEARCH_PERSONAL_CONTEXT_TOOL,
|
|
1013
1305
|
}), perScopeTimeoutMs, `read blocks for ${scope}`);
|
|
1014
1306
|
const pageText = blockPageSearchText(result.blocks);
|
|
1015
1307
|
const { documents, textById } = blockPageSearchDocuments(scope, result.blocks);
|
|
@@ -1121,6 +1413,10 @@ const searchPersonalContext = {
|
|
|
1121
1413
|
],
|
|
1122
1414
|
truncatedScopes,
|
|
1123
1415
|
errors,
|
|
1416
|
+
...(scopeRequestGuidance && deniedScopes.length > 0
|
|
1417
|
+
? { nextAction: requestAccessNextAction(deniedScopes) }
|
|
1418
|
+
: {}),
|
|
1419
|
+
...(scopeRequestGuidance ? { coverageNote: SEARCH_COVERAGE_NOTE } : {}),
|
|
1124
1420
|
...(paymentRequiredScopes.length > 0
|
|
1125
1421
|
? {
|
|
1126
1422
|
payment_required: true,
|
|
@@ -1161,7 +1457,7 @@ const getScopeFile = {
|
|
|
1161
1457
|
.max(MAX_READ_FILE_TIMEOUT_MS)
|
|
1162
1458
|
.optional(),
|
|
1163
1459
|
},
|
|
1164
|
-
async handler(args, { connection, readClient }) {
|
|
1460
|
+
async handler(args, { connection, readClient, scopeRequestGuidance }) {
|
|
1165
1461
|
const scope = typeof args.scope === "string" ? args.scope : null;
|
|
1166
1462
|
if (!scope) {
|
|
1167
1463
|
return textResult({ error: "scope is required and must be a string" }, true);
|
|
@@ -1172,6 +1468,9 @@ const getScopeFile = {
|
|
|
1172
1468
|
error: "scope_not_granted",
|
|
1173
1469
|
message: `Scope '${scope}' is not covered by any grant on this MCP connection.`,
|
|
1174
1470
|
grantedScopes: uniqueScopes(connection),
|
|
1471
|
+
...(scopeRequestGuidance
|
|
1472
|
+
? { nextAction: requestAccessNextAction([scope]) }
|
|
1473
|
+
: {}),
|
|
1175
1474
|
}, true);
|
|
1176
1475
|
}
|
|
1177
1476
|
const at = typeof args.at === "string" ? args.at : undefined;
|
|
@@ -1292,7 +1591,7 @@ const getScopeFile = {
|
|
|
1292
1591
|
// single-use payment can't fund a second resources/read).
|
|
1293
1592
|
let meta = null;
|
|
1294
1593
|
try {
|
|
1295
|
-
meta = await readClient.getScopeMetadata(scope);
|
|
1594
|
+
meta = await readClient.getScopeMetadata(scope, grant.grantId);
|
|
1296
1595
|
}
|
|
1297
1596
|
catch {
|
|
1298
1597
|
meta = null;
|
|
@@ -1334,6 +1633,326 @@ const getScopeFile = {
|
|
|
1334
1633
|
}
|
|
1335
1634
|
},
|
|
1336
1635
|
};
|
|
1636
|
+
const REMEMBER_TOOL = "remember";
|
|
1637
|
+
const FORGET_TOOL = "forget";
|
|
1638
|
+
const REMEMBER_TEXT_MAX_CHARS = 4_000;
|
|
1639
|
+
const REMEMBER_KEY_MAX_CHARS = 128;
|
|
1640
|
+
const MEMORY_ID_MAX_CHARS = 64;
|
|
1641
|
+
/**
|
|
1642
|
+
* Every save stores a new snapshot of the scope's record list, so the list is
|
|
1643
|
+
* bounded by size rather than count. Sync publishes only the newest snapshot of
|
|
1644
|
+
* a memory scope (see `isCoalescedScope` in sync/workers/upload.ts).
|
|
1645
|
+
*/
|
|
1646
|
+
export const MEMORY_SCOPE_MAX_BYTES = 20 * 1024 * 1024;
|
|
1647
|
+
class RememberRefusal extends Error {
|
|
1648
|
+
body;
|
|
1649
|
+
constructor(body) {
|
|
1650
|
+
super(String(body.message));
|
|
1651
|
+
this.body = body;
|
|
1652
|
+
this.name = "RememberRefusal";
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
/** A save that would only repeat a memory the scope already holds. */
|
|
1656
|
+
class DuplicateMemory extends Error {
|
|
1657
|
+
record;
|
|
1658
|
+
constructor(record) {
|
|
1659
|
+
super("duplicate memory");
|
|
1660
|
+
this.record = record;
|
|
1661
|
+
this.name = "DuplicateMemory";
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
function isPlainRecord(value) {
|
|
1665
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* The memory records of a stored body. A memory scope holds exactly
|
|
1669
|
+
* `{ records: [...] }` of memory rows, or the earlier `{ memories: [...] }`
|
|
1670
|
+
* list, which is converted here (ids kept). Anything else was written by
|
|
1671
|
+
* someone else and is never overwritten.
|
|
1672
|
+
*/
|
|
1673
|
+
function storedMemoryRecords(scope, data) {
|
|
1674
|
+
const keys = Object.keys(data);
|
|
1675
|
+
if (keys.length === 1 &&
|
|
1676
|
+
Array.isArray(data.records) &&
|
|
1677
|
+
data.records.every((row) => isPlainRecord(row) &&
|
|
1678
|
+
typeof row.id === "string" &&
|
|
1679
|
+
typeof row.content === "string")) {
|
|
1680
|
+
return data.records;
|
|
1681
|
+
}
|
|
1682
|
+
if (keys.length === 1 &&
|
|
1683
|
+
Array.isArray(data.memories) &&
|
|
1684
|
+
data.memories.every((item) => isPlainRecord(item) &&
|
|
1685
|
+
typeof item.id === "string" &&
|
|
1686
|
+
typeof item.text === "string")) {
|
|
1687
|
+
return data.memories.map((item) => {
|
|
1688
|
+
const at = typeof item.savedAt === "string" ? item.savedAt : "";
|
|
1689
|
+
return {
|
|
1690
|
+
id: item.id,
|
|
1691
|
+
content: item.text,
|
|
1692
|
+
created_at: at,
|
|
1693
|
+
updated_at: at,
|
|
1694
|
+
...(typeof item.key === "string" ? { key: item.key } : {}),
|
|
1695
|
+
written_by: null,
|
|
1696
|
+
};
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
throw new RememberRefusal({
|
|
1700
|
+
error: "scope_not_memory",
|
|
1701
|
+
scope,
|
|
1702
|
+
message: `Scope ${scope} holds data that is not a memory list; it will not be changed. Use another write scope.`,
|
|
1703
|
+
});
|
|
1704
|
+
}
|
|
1705
|
+
/**
|
|
1706
|
+
* The scope a memory tool acts on and the grant that covers it, or the error
|
|
1707
|
+
* result to return. A call may omit `scope` when the connection can write to
|
|
1708
|
+
* exactly one scope.
|
|
1709
|
+
*/
|
|
1710
|
+
function resolveMemoryTarget(args, connection) {
|
|
1711
|
+
const writableScopes = uniqueWritableScopes(connection);
|
|
1712
|
+
const namedScope = typeof args.scope === "string" ? args.scope.trim() : "";
|
|
1713
|
+
const onlyScope = writableScopes.length === 1 && !writableScopes[0].includes("*")
|
|
1714
|
+
? writableScopes[0]
|
|
1715
|
+
: "";
|
|
1716
|
+
const scope = namedScope || onlyScope;
|
|
1717
|
+
if (!scope) {
|
|
1718
|
+
return {
|
|
1719
|
+
error: textResult({
|
|
1720
|
+
error: "scope_required",
|
|
1721
|
+
writableScopes,
|
|
1722
|
+
message: writableScopes.length === 0
|
|
1723
|
+
? 'This connection cannot save memories. Call request_scope_access with scopes ["memory.<app>", "write:memory.<app>"] and ask the user to approve it.'
|
|
1724
|
+
: "Name the scope; this connection can write to more than one.",
|
|
1725
|
+
}, true),
|
|
1726
|
+
};
|
|
1727
|
+
}
|
|
1728
|
+
if (!isMemoryScope(scope)) {
|
|
1729
|
+
return {
|
|
1730
|
+
error: textResult({
|
|
1731
|
+
error: "scope_not_memory",
|
|
1732
|
+
scope,
|
|
1733
|
+
message: `Memories live in memory.<app> scopes; ${scope} is not one.`,
|
|
1734
|
+
}, true),
|
|
1735
|
+
};
|
|
1736
|
+
}
|
|
1737
|
+
// `remember` and `forget` read the scope's existing memories to decide and
|
|
1738
|
+
// report (duplicates, counts, ids). A write-only grant must not turn that
|
|
1739
|
+
// into a read, so a covering read grant is required too, and its absence
|
|
1740
|
+
// answers exactly as a scope never granted.
|
|
1741
|
+
const grant = resolveGrantForScope(connection, scope)
|
|
1742
|
+
? resolveWriteGrantForScope(connection, scope)
|
|
1743
|
+
: null;
|
|
1744
|
+
if (!grant) {
|
|
1745
|
+
const requestScope = `${WRITE_SCOPE_PREFIX}${scope}`;
|
|
1746
|
+
return {
|
|
1747
|
+
error: textResult({
|
|
1748
|
+
error: "scope_not_granted",
|
|
1749
|
+
scope,
|
|
1750
|
+
requestScope,
|
|
1751
|
+
requestScopes: [scope, requestScope],
|
|
1752
|
+
nextAction: requestAccessNextAction([scope, requestScope]),
|
|
1753
|
+
message: `This connection may not write to ${scope}. Call request_scope_access with scopes ${JSON.stringify([scope, requestScope])} and ask the user to approve it.`,
|
|
1754
|
+
}, true),
|
|
1755
|
+
};
|
|
1756
|
+
}
|
|
1757
|
+
return { scope, grantId: grant.grantId };
|
|
1758
|
+
}
|
|
1759
|
+
const WRITE_UNAVAILABLE = textResult({
|
|
1760
|
+
error: "write_unavailable",
|
|
1761
|
+
message: "This Personal Server does not accept MCP writes.",
|
|
1762
|
+
}, true);
|
|
1763
|
+
/** Map a refused or failed memory write to the tool's error result. */
|
|
1764
|
+
function memoryWriteError(err, scope) {
|
|
1765
|
+
if (err instanceof RememberRefusal)
|
|
1766
|
+
return textResult(err.body, true);
|
|
1767
|
+
if (err instanceof McpDataWriteError) {
|
|
1768
|
+
const body = err.body;
|
|
1769
|
+
const detail = typeof body?.error === "object" && body.error !== null
|
|
1770
|
+
? body.error
|
|
1771
|
+
: { errorCode: body?.error, message: body?.message };
|
|
1772
|
+
return textResult({
|
|
1773
|
+
error: err.status === 401 || err.status === 403
|
|
1774
|
+
? "unauthorized"
|
|
1775
|
+
: err.status === 409 &&
|
|
1776
|
+
detail.errorCode === "STREAM_SYNC_WRITE_UNAVAILABLE"
|
|
1777
|
+
? "write_unavailable"
|
|
1778
|
+
: err.status === 412
|
|
1779
|
+
? "write_conflict"
|
|
1780
|
+
: "write_failed",
|
|
1781
|
+
status: err.status,
|
|
1782
|
+
scope,
|
|
1783
|
+
...(detail.errorCode ? { errorCode: detail.errorCode } : {}),
|
|
1784
|
+
...(detail.message ? { message: detail.message } : {}),
|
|
1785
|
+
}, true);
|
|
1786
|
+
}
|
|
1787
|
+
throw err;
|
|
1788
|
+
}
|
|
1789
|
+
function memoryBody(records, scope) {
|
|
1790
|
+
const body = { records };
|
|
1791
|
+
if (new TextEncoder().encode(JSON.stringify(body)).byteLength >
|
|
1792
|
+
MEMORY_SCOPE_MAX_BYTES) {
|
|
1793
|
+
throw new RememberRefusal({
|
|
1794
|
+
error: "memory_full",
|
|
1795
|
+
scope,
|
|
1796
|
+
limitBytes: MEMORY_SCOPE_MAX_BYTES,
|
|
1797
|
+
message: `Scope ${scope} is full. Forget or replace memories to make room.`,
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1800
|
+
return body;
|
|
1801
|
+
}
|
|
1802
|
+
const remember = {
|
|
1803
|
+
name: REMEMBER_TOOL,
|
|
1804
|
+
title: "Remember",
|
|
1805
|
+
description: "Save a fact, preference, goal or decision the user shares, without being asked, so any allowed agent can recall it. Tell the user briefly. Never save secrets, passwords, IDs or account numbers. Needs a write:<scope> grant (writableScopes).",
|
|
1806
|
+
inputSchema: {
|
|
1807
|
+
text: z
|
|
1808
|
+
.string()
|
|
1809
|
+
.min(1)
|
|
1810
|
+
.max(REMEMBER_TEXT_MAX_CHARS)
|
|
1811
|
+
.describe("Self-contained; readable without this chat."),
|
|
1812
|
+
scope: z
|
|
1813
|
+
.string()
|
|
1814
|
+
.min(1)
|
|
1815
|
+
.max(SEARCH_SCOPE_MAX_CHARS)
|
|
1816
|
+
.optional()
|
|
1817
|
+
.describe("e.g. memory.claude; optional with one writable scope."),
|
|
1818
|
+
key: z
|
|
1819
|
+
.string()
|
|
1820
|
+
.min(1)
|
|
1821
|
+
.max(REMEMBER_KEY_MAX_CHARS)
|
|
1822
|
+
.optional()
|
|
1823
|
+
.describe("Saving again with the same key replaces the memory."),
|
|
1824
|
+
},
|
|
1825
|
+
async handler(args, { connection, writeClient }) {
|
|
1826
|
+
const content = typeof args.text === "string" ? args.text.trim() : "";
|
|
1827
|
+
if (!content) {
|
|
1828
|
+
return textResult({ error: "invalid_arguments", message: "text must not be empty." }, true);
|
|
1829
|
+
}
|
|
1830
|
+
const key = typeof args.key === "string" && args.key.trim()
|
|
1831
|
+
? args.key.trim()
|
|
1832
|
+
: undefined;
|
|
1833
|
+
const target = resolveMemoryTarget(args, connection);
|
|
1834
|
+
if ("error" in target)
|
|
1835
|
+
return target.error;
|
|
1836
|
+
const { scope, grantId } = target;
|
|
1837
|
+
if (!writeClient)
|
|
1838
|
+
return WRITE_UNAVAILABLE;
|
|
1839
|
+
const now = new Date().toISOString();
|
|
1840
|
+
let saved;
|
|
1841
|
+
let replaced = false;
|
|
1842
|
+
let memoryCount = 0;
|
|
1843
|
+
try {
|
|
1844
|
+
await writeClient.updateScope({
|
|
1845
|
+
scope,
|
|
1846
|
+
grantId,
|
|
1847
|
+
update(current) {
|
|
1848
|
+
const records = current.data === null
|
|
1849
|
+
? []
|
|
1850
|
+
: storedMemoryRecords(scope, current.data);
|
|
1851
|
+
const previous = key
|
|
1852
|
+
? records.find((record) => record.key === key)
|
|
1853
|
+
: undefined;
|
|
1854
|
+
if (!key) {
|
|
1855
|
+
const same = records.find((record) => record.content === content);
|
|
1856
|
+
if (same)
|
|
1857
|
+
throw new DuplicateMemory(same);
|
|
1858
|
+
}
|
|
1859
|
+
replaced = previous !== undefined;
|
|
1860
|
+
saved = {
|
|
1861
|
+
id: previous?.id ?? crypto.randomUUID(),
|
|
1862
|
+
content,
|
|
1863
|
+
created_at: previous?.created_at ?? now,
|
|
1864
|
+
updated_at: now,
|
|
1865
|
+
...(key ? { key } : {}),
|
|
1866
|
+
written_by: connection.granteeAddress,
|
|
1867
|
+
};
|
|
1868
|
+
// Newest last: a replaced memory moves to the end, so list order is
|
|
1869
|
+
// the order the memories were last saved in.
|
|
1870
|
+
const next = [
|
|
1871
|
+
...records.filter((record) => record !== previous),
|
|
1872
|
+
saved,
|
|
1873
|
+
];
|
|
1874
|
+
memoryCount = next.length;
|
|
1875
|
+
return memoryBody(next, scope);
|
|
1876
|
+
},
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
catch (err) {
|
|
1880
|
+
if (err instanceof DuplicateMemory) {
|
|
1881
|
+
return textResult({
|
|
1882
|
+
saved: false,
|
|
1883
|
+
duplicate: true,
|
|
1884
|
+
scope,
|
|
1885
|
+
id: err.record.id,
|
|
1886
|
+
message: "This memory is already saved.",
|
|
1887
|
+
});
|
|
1888
|
+
}
|
|
1889
|
+
return memoryWriteError(err, scope);
|
|
1890
|
+
}
|
|
1891
|
+
return textResult({
|
|
1892
|
+
saved: true,
|
|
1893
|
+
scope,
|
|
1894
|
+
id: saved.id,
|
|
1895
|
+
savedAt: saved.updated_at,
|
|
1896
|
+
...(key ? { key } : {}),
|
|
1897
|
+
replaced,
|
|
1898
|
+
memoryCount,
|
|
1899
|
+
});
|
|
1900
|
+
},
|
|
1901
|
+
};
|
|
1902
|
+
const forget = {
|
|
1903
|
+
name: FORGET_TOOL,
|
|
1904
|
+
title: "Forget",
|
|
1905
|
+
description: "Delete a saved memory by id or key. Needs a write:<scope> grant.",
|
|
1906
|
+
inputSchema: {
|
|
1907
|
+
id: z.string().min(1).max(MEMORY_ID_MAX_CHARS).optional(),
|
|
1908
|
+
key: z.string().min(1).max(REMEMBER_KEY_MAX_CHARS).optional(),
|
|
1909
|
+
scope: z.string().min(1).max(SEARCH_SCOPE_MAX_CHARS).optional(),
|
|
1910
|
+
},
|
|
1911
|
+
async handler(args, { connection, writeClient }) {
|
|
1912
|
+
const id = typeof args.id === "string" ? args.id.trim() : "";
|
|
1913
|
+
const key = typeof args.key === "string" ? args.key.trim() : "";
|
|
1914
|
+
if (!id && !key) {
|
|
1915
|
+
return textResult({ error: "invalid_arguments", message: "Pass id or key." }, true);
|
|
1916
|
+
}
|
|
1917
|
+
const target = resolveMemoryTarget(args, connection);
|
|
1918
|
+
if ("error" in target)
|
|
1919
|
+
return target.error;
|
|
1920
|
+
const { scope, grantId } = target;
|
|
1921
|
+
if (!writeClient)
|
|
1922
|
+
return WRITE_UNAVAILABLE;
|
|
1923
|
+
let forgotten = [];
|
|
1924
|
+
let memoryCount = 0;
|
|
1925
|
+
try {
|
|
1926
|
+
await writeClient.updateScope({
|
|
1927
|
+
scope,
|
|
1928
|
+
grantId,
|
|
1929
|
+
update(current) {
|
|
1930
|
+
const records = current.data === null
|
|
1931
|
+
? []
|
|
1932
|
+
: storedMemoryRecords(scope, current.data);
|
|
1933
|
+
// With both id and key, a record must match both.
|
|
1934
|
+
const matches = (record) => (!id || record.id === id) && (!key || record.key === key);
|
|
1935
|
+
const keep = records.filter((record) => !matches(record));
|
|
1936
|
+
if (keep.length === records.length) {
|
|
1937
|
+
throw new RememberRefusal({
|
|
1938
|
+
error: "not_found",
|
|
1939
|
+
scope,
|
|
1940
|
+
message: "No saved memory matches that id or key.",
|
|
1941
|
+
});
|
|
1942
|
+
}
|
|
1943
|
+
// Reset on every attempt: a 412 retry re-runs this callback.
|
|
1944
|
+
forgotten = records.filter(matches).map((record) => record.id);
|
|
1945
|
+
memoryCount = keep.length;
|
|
1946
|
+
return memoryBody(keep, scope);
|
|
1947
|
+
},
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
catch (err) {
|
|
1951
|
+
return memoryWriteError(err, scope);
|
|
1952
|
+
}
|
|
1953
|
+
return textResult({ forgotten: true, scope, ids: forgotten, memoryCount });
|
|
1954
|
+
},
|
|
1955
|
+
};
|
|
1337
1956
|
export const MCP_TOOLS = [
|
|
1338
1957
|
listGrantedSources,
|
|
1339
1958
|
listGrantedScopes,
|
|
@@ -1342,5 +1961,7 @@ export const MCP_TOOLS = [
|
|
|
1342
1961
|
listScopeBlocks,
|
|
1343
1962
|
getScopeFile,
|
|
1344
1963
|
searchPersonalContext,
|
|
1964
|
+
remember,
|
|
1965
|
+
forget,
|
|
1345
1966
|
];
|
|
1346
1967
|
//# sourceMappingURL=tools.js.map
|