@cello-protocol/daemon 0.0.227 → 0.0.229
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/agent-admin-handlers.d.ts +56 -0
- package/dist/agent-admin-handlers.d.ts.map +1 -0
- package/dist/agent-admin-handlers.js +73 -0
- package/dist/agent-admin-handlers.js.map +1 -0
- package/dist/agent-handlers.d.ts +72 -0
- package/dist/agent-handlers.d.ts.map +1 -0
- package/dist/agent-handlers.js +604 -0
- package/dist/agent-handlers.js.map +1 -0
- package/dist/agent-id-migration.d.ts +70 -0
- package/dist/agent-id-migration.d.ts.map +1 -0
- package/dist/agent-id-migration.js +468 -0
- package/dist/agent-id-migration.js.map +1 -0
- package/dist/agent-loader.d.ts +37 -0
- package/dist/agent-loader.d.ts.map +1 -0
- package/dist/agent-loader.js +37 -0
- package/dist/agent-loader.js.map +1 -0
- package/dist/agent-selection-root.d.ts +29 -0
- package/dist/agent-selection-root.d.ts.map +1 -0
- package/dist/agent-selection-root.js +126 -0
- package/dist/agent-selection-root.js.map +1 -0
- package/dist/agent-selection.d.ts +73 -0
- package/dist/agent-selection.d.ts.map +1 -0
- package/dist/agent-selection.js +80 -0
- package/dist/agent-selection.js.map +1 -0
- package/dist/agent-settings-keys.d.ts +52 -0
- package/dist/agent-settings-keys.d.ts.map +1 -0
- package/dist/agent-settings-keys.js +114 -0
- package/dist/agent-settings-keys.js.map +1 -0
- package/dist/agent-state.d.ts +67 -0
- package/dist/agent-state.d.ts.map +1 -0
- package/dist/agent-state.js +66 -0
- package/dist/agent-state.js.map +1 -0
- package/dist/assignment-verify.d.ts +90 -0
- package/dist/assignment-verify.d.ts.map +1 -0
- package/dist/assignment-verify.js +301 -0
- package/dist/assignment-verify.js.map +1 -0
- package/dist/attendance-wiring.d.ts +23 -0
- package/dist/attendance-wiring.d.ts.map +1 -0
- package/dist/attendance-wiring.js +248 -0
- package/dist/attendance-wiring.js.map +1 -0
- package/dist/attestation-body.d.ts +47 -0
- package/dist/attestation-body.d.ts.map +1 -0
- package/dist/attestation-body.js +71 -0
- package/dist/attestation-body.js.map +1 -0
- package/dist/authorship-verification.d.ts +91 -0
- package/dist/authorship-verification.d.ts.map +1 -0
- package/dist/authorship-verification.js +532 -0
- package/dist/authorship-verification.js.map +1 -0
- package/dist/away-detection.d.ts +139 -0
- package/dist/away-detection.d.ts.map +1 -0
- package/dist/away-detection.js +186 -0
- package/dist/away-detection.js.map +1 -0
- package/dist/away-inbox-oneshot.d.ts +40 -0
- package/dist/away-inbox-oneshot.d.ts.map +1 -0
- package/dist/away-inbox-oneshot.js +311 -0
- package/dist/away-inbox-oneshot.js.map +1 -0
- package/dist/backup-restore-handlers.d.ts +10 -0
- package/dist/backup-restore-handlers.d.ts.map +1 -0
- package/dist/backup-restore-handlers.js +82 -0
- package/dist/backup-restore-handlers.js.map +1 -0
- package/dist/backup-restore.d.ts +102 -0
- package/dist/backup-restore.d.ts.map +1 -0
- package/dist/backup-restore.js +341 -0
- package/dist/backup-restore.js.map +1 -0
- package/dist/bin/cello-daemon.d.ts +13 -0
- package/dist/bin/cello-daemon.d.ts.map +1 -0
- package/dist/bin/cello-daemon.js.map +1 -0
- package/dist/boot-agents.d.ts +64 -0
- package/dist/boot-agents.d.ts.map +1 -0
- package/dist/boot-agents.js +241 -0
- package/dist/boot-agents.js.map +1 -0
- package/dist/boot-connection-state.d.ts +38 -0
- package/dist/boot-connection-state.d.ts.map +1 -0
- package/dist/boot-connection-state.js +95 -0
- package/dist/boot-connection-state.js.map +1 -0
- package/dist/boot-core.d.ts +36 -0
- package/dist/boot-core.d.ts.map +1 -0
- package/dist/boot-core.js +293 -0
- package/dist/boot-core.js.map +1 -0
- package/dist/boot-parked-content.d.ts +34 -0
- package/dist/boot-parked-content.d.ts.map +1 -0
- package/dist/boot-parked-content.js +528 -0
- package/dist/boot-parked-content.js.map +1 -0
- package/dist/boot-sweeps.d.ts +22 -0
- package/dist/boot-sweeps.d.ts.map +1 -0
- package/dist/boot-sweeps.js +51 -0
- package/dist/boot-sweeps.js.map +1 -0
- package/dist/bundled-consortium-manifest.d.ts +47 -0
- package/dist/bundled-consortium-manifest.d.ts.map +1 -0
- package/dist/bundled-consortium-manifest.js +116 -0
- package/dist/bundled-consortium-manifest.js.map +1 -0
- package/dist/cbor-blob-migration.d.ts +8 -0
- package/dist/cbor-blob-migration.d.ts.map +1 -0
- package/dist/cbor-blob-migration.js +116 -0
- package/dist/cbor-blob-migration.js.map +1 -0
- package/dist/challenge-verifier.d.ts +12 -0
- package/dist/challenge-verifier.d.ts.map +1 -0
- package/dist/challenge-verifier.js +11 -0
- package/dist/challenge-verifier.js.map +1 -0
- package/dist/channel-log-store.d.ts +80 -0
- package/dist/channel-log-store.d.ts.map +1 -0
- package/dist/channel-log-store.js +290 -0
- package/dist/channel-log-store.js.map +1 -0
- package/dist/close-commitment.d.ts +67 -0
- package/dist/close-commitment.d.ts.map +1 -0
- package/dist/close-commitment.js +78 -0
- package/dist/close-commitment.js.map +1 -0
- package/dist/close-session-handler.d.ts +94 -0
- package/dist/close-session-handler.d.ts.map +1 -0
- package/dist/close-session-handler.js +1418 -0
- package/dist/close-session-handler.js.map +1 -0
- package/dist/co-attendance.d.ts +29 -0
- package/dist/co-attendance.d.ts.map +1 -0
- package/dist/co-attendance.js +32 -0
- package/dist/co-attendance.js.map +1 -0
- package/dist/column-birth.d.ts +40 -0
- package/dist/column-birth.d.ts.map +1 -0
- package/dist/column-birth.js +61 -0
- package/dist/column-birth.js.map +1 -0
- package/dist/connect-or-start.d.ts +25 -0
- package/dist/connect-or-start.d.ts.map +1 -0
- package/dist/connect-or-start.js +175 -0
- package/dist/connect-or-start.js.map +1 -0
- package/dist/connection-agents.d.ts +16 -0
- package/dist/connection-agents.d.ts.map +1 -0
- package/dist/connection-agents.js +68 -0
- package/dist/connection-agents.js.map +1 -0
- package/dist/consent-migration.d.ts +49 -0
- package/dist/consent-migration.d.ts.map +1 -0
- package/dist/consent-migration.js +128 -0
- package/dist/consent-migration.js.map +1 -0
- package/dist/consortium-bootstrap.d.ts +138 -0
- package/dist/consortium-bootstrap.d.ts.map +1 -0
- package/dist/consortium-bootstrap.js +339 -0
- package/dist/consortium-bootstrap.js.map +1 -0
- package/dist/consortium-fingerprint.d.ts +115 -0
- package/dist/consortium-fingerprint.d.ts.map +1 -0
- package/dist/consortium-fingerprint.js +175 -0
- package/dist/consortium-fingerprint.js.map +1 -0
- package/dist/contact-handlers.d.ts +59 -0
- package/dist/contact-handlers.d.ts.map +1 -0
- package/dist/contact-handlers.js +343 -0
- package/dist/contact-handlers.js.map +1 -0
- package/dist/contact-pubkey-case.d.ts +65 -0
- package/dist/contact-pubkey-case.d.ts.map +1 -0
- package/dist/contact-pubkey-case.js +136 -0
- package/dist/contact-pubkey-case.js.map +1 -0
- package/dist/contacts-tier-migration.d.ts +90 -0
- package/dist/contacts-tier-migration.d.ts.map +1 -0
- package/dist/contacts-tier-migration.js +150 -0
- package/dist/contacts-tier-migration.js.map +1 -0
- package/dist/content-encryption-status.d.ts +111 -0
- package/dist/content-encryption-status.d.ts.map +1 -0
- package/dist/content-encryption-status.js +158 -0
- package/dist/content-encryption-status.js.map +1 -0
- package/dist/content-park-client.d.ts +90 -0
- package/dist/content-park-client.d.ts.map +1 -0
- package/dist/content-park-client.js +362 -0
- package/dist/content-park-client.js.map +1 -0
- package/dist/content-park.d.ts +52 -0
- package/dist/content-park.d.ts.map +1 -0
- package/dist/content-park.js +1309 -0
- package/dist/content-park.js.map +1 -0
- package/dist/cross-node-negotiation.d.ts +44 -0
- package/dist/cross-node-negotiation.d.ts.map +1 -0
- package/dist/cross-node-negotiation.js +34 -0
- package/dist/cross-node-negotiation.js.map +1 -0
- package/dist/daemon-handle.d.ts +57 -0
- package/dist/daemon-handle.d.ts.map +1 -0
- package/dist/daemon-handle.js +2 -0
- package/dist/daemon-handle.js.map +1 -0
- package/dist/daemon-status-report.d.ts +50 -0
- package/dist/daemon-status-report.d.ts.map +1 -0
- package/dist/daemon-status-report.js +81 -0
- package/dist/daemon-status-report.js.map +1 -0
- package/dist/daemon.d.ts +45 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +1177 -0
- package/dist/daemon.js.map +1 -0
- package/dist/db-identity-store.d.ts +159 -0
- package/dist/db-identity-store.d.ts.map +1 -0
- package/dist/db-identity-store.js +502 -0
- package/dist/db-identity-store.js.map +1 -0
- package/dist/delivery-open-registry.d.ts +92 -0
- package/dist/delivery-open-registry.d.ts.map +1 -0
- package/dist/delivery-open-registry.js +121 -0
- package/dist/delivery-open-registry.js.map +1 -0
- package/dist/delivery-session-suspects.d.ts +56 -0
- package/dist/delivery-session-suspects.d.ts.map +1 -0
- package/dist/delivery-session-suspects.js +94 -0
- package/dist/delivery-session-suspects.js.map +1 -0
- package/dist/directory-auth-posture.d.ts +87 -0
- package/dist/directory-auth-posture.d.ts.map +1 -0
- package/dist/directory-auth-posture.js +134 -0
- package/dist/directory-auth-posture.js.map +1 -0
- package/dist/directory-bootstrap.d.ts +310 -0
- package/dist/directory-bootstrap.d.ts.map +1 -0
- package/dist/directory-bootstrap.js +557 -0
- package/dist/directory-bootstrap.js.map +1 -0
- package/dist/directory-connect.d.ts +27 -0
- package/dist/directory-connect.d.ts.map +1 -0
- package/dist/directory-connect.js +106 -0
- package/dist/directory-connect.js.map +1 -0
- package/dist/disconnect-cleanup.d.ts +51 -0
- package/dist/disconnect-cleanup.d.ts.map +1 -0
- package/dist/disconnect-cleanup.js +72 -0
- package/dist/disconnect-cleanup.js.map +1 -0
- package/dist/document-amendment-store.d.ts +120 -0
- package/dist/document-amendment-store.d.ts.map +1 -0
- package/dist/document-amendment-store.js +266 -0
- package/dist/document-amendment-store.js.map +1 -0
- package/dist/document-delivery-transport.d.ts +168 -0
- package/dist/document-delivery-transport.d.ts.map +1 -0
- package/dist/document-delivery-transport.js +206 -0
- package/dist/document-delivery-transport.js.map +1 -0
- package/dist/document-engine.d.ts +134 -0
- package/dist/document-engine.d.ts.map +1 -0
- package/dist/document-engine.js +282 -0
- package/dist/document-engine.js.map +1 -0
- package/dist/document-flag.d.ts +58 -0
- package/dist/document-flag.d.ts.map +1 -0
- package/dist/document-flag.js +70 -0
- package/dist/document-flag.js.map +1 -0
- package/dist/document-frame-router.d.ts +245 -0
- package/dist/document-frame-router.d.ts.map +1 -0
- package/dist/document-frame-router.js +397 -0
- package/dist/document-frame-router.js.map +1 -0
- package/dist/document-gate-wiring.d.ts +61 -0
- package/dist/document-gate-wiring.d.ts.map +1 -0
- package/dist/document-gate-wiring.js +125 -0
- package/dist/document-gate-wiring.js.map +1 -0
- package/dist/document-gate.d.ts +149 -0
- package/dist/document-gate.d.ts.map +1 -0
- package/dist/document-gate.js +509 -0
- package/dist/document-gate.js.map +1 -0
- package/dist/document-handlers.d.ts +47 -0
- package/dist/document-handlers.d.ts.map +1 -0
- package/dist/document-handlers.js +2203 -0
- package/dist/document-handlers.js.map +1 -0
- package/dist/document-handshake.d.ts +176 -0
- package/dist/document-handshake.d.ts.map +1 -0
- package/dist/document-handshake.js +452 -0
- package/dist/document-handshake.js.map +1 -0
- package/dist/document-inbound.d.ts +162 -0
- package/dist/document-inbound.d.ts.map +1 -0
- package/dist/document-inbound.js +530 -0
- package/dist/document-inbound.js.map +1 -0
- package/dist/document-json.d.ts +120 -0
- package/dist/document-json.d.ts.map +1 -0
- package/dist/document-json.js +191 -0
- package/dist/document-json.js.map +1 -0
- package/dist/document-layer.d.ts +215 -0
- package/dist/document-layer.d.ts.map +1 -0
- package/dist/document-layer.js +1025 -0
- package/dist/document-layer.js.map +1 -0
- package/dist/document-lifecycle.d.ts +52 -0
- package/dist/document-lifecycle.d.ts.map +1 -0
- package/dist/document-lifecycle.js +134 -0
- package/dist/document-lifecycle.js.map +1 -0
- package/dist/document-live-docs.d.ts +58 -0
- package/dist/document-live-docs.d.ts.map +1 -0
- package/dist/document-live-docs.js +126 -0
- package/dist/document-live-docs.js.map +1 -0
- package/dist/document-notify.d.ts +228 -0
- package/dist/document-notify.d.ts.map +1 -0
- package/dist/document-notify.js +580 -0
- package/dist/document-notify.js.map +1 -0
- package/dist/document-profile.d.ts +61 -0
- package/dist/document-profile.d.ts.map +1 -0
- package/dist/document-profile.js +112 -0
- package/dist/document-profile.js.map +1 -0
- package/dist/document-publish.d.ts +87 -0
- package/dist/document-publish.d.ts.map +1 -0
- package/dist/document-publish.js +173 -0
- package/dist/document-publish.js.map +1 -0
- package/dist/document-reachability.d.ts +42 -0
- package/dist/document-reachability.d.ts.map +1 -0
- package/dist/document-reachability.js +80 -0
- package/dist/document-reachability.js.map +1 -0
- package/dist/document-reconcile-engine.d.ts +66 -0
- package/dist/document-reconcile-engine.d.ts.map +1 -0
- package/dist/document-reconcile-engine.js +225 -0
- package/dist/document-reconcile-engine.js.map +1 -0
- package/dist/document-reconcile-scheduler.d.ts +163 -0
- package/dist/document-reconcile-scheduler.d.ts.map +1 -0
- package/dist/document-reconcile-scheduler.js +303 -0
- package/dist/document-reconcile-scheduler.js.map +1 -0
- package/dist/document-rejection.d.ts +251 -0
- package/dist/document-rejection.d.ts.map +1 -0
- package/dist/document-rejection.js +435 -0
- package/dist/document-rejection.js.map +1 -0
- package/dist/document-screen.d.ts +114 -0
- package/dist/document-screen.d.ts.map +1 -0
- package/dist/document-screen.js +223 -0
- package/dist/document-screen.js.map +1 -0
- package/dist/document-store.d.ts +372 -0
- package/dist/document-store.d.ts.map +1 -0
- package/dist/document-store.js +931 -0
- package/dist/document-store.js.map +1 -0
- package/dist/document-surface.d.ts +32 -0
- package/dist/document-surface.d.ts.map +1 -0
- package/dist/document-surface.js +151 -0
- package/dist/document-surface.js.map +1 -0
- package/dist/document-types.d.ts +94 -0
- package/dist/document-types.d.ts.map +1 -0
- package/dist/document-types.js +90 -0
- package/dist/document-types.js.map +1 -0
- package/dist/document-watch.d.ts +69 -0
- package/dist/document-watch.d.ts.map +1 -0
- package/dist/document-watch.js +108 -0
- package/dist/document-watch.js.map +1 -0
- package/dist/document-wiring.d.ts +53 -0
- package/dist/document-wiring.d.ts.map +1 -0
- package/dist/document-wiring.js +323 -0
- package/dist/document-wiring.js.map +1 -0
- package/dist/document-write-guard.d.ts +66 -0
- package/dist/document-write-guard.d.ts.map +1 -0
- package/dist/document-write-guard.js +98 -0
- package/dist/document-write-guard.js.map +1 -0
- package/dist/document-write-path.d.ts +94 -0
- package/dist/document-write-path.d.ts.map +1 -0
- package/dist/document-write-path.js +530 -0
- package/dist/document-write-path.js.map +1 -0
- package/dist/error-message.d.ts +7 -0
- package/dist/error-message.d.ts.map +1 -0
- package/dist/error-message.js +19 -0
- package/dist/error-message.js.map +1 -0
- package/dist/file-manifest-provider.d.ts +37 -0
- package/dist/file-manifest-provider.d.ts.map +1 -0
- package/dist/file-manifest-provider.js +105 -0
- package/dist/file-manifest-provider.js.map +1 -0
- package/dist/frame-values.d.ts +3 -0
- package/dist/frame-values.d.ts.map +1 -0
- package/dist/frame-values.js +84 -0
- package/dist/frame-values.js.map +1 -0
- package/dist/frontier-mismatch.d.ts +73 -0
- package/dist/frontier-mismatch.d.ts.map +1 -0
- package/dist/frontier-mismatch.js +89 -0
- package/dist/frontier-mismatch.js.map +1 -0
- package/dist/gateway-config-handlers.d.ts +26 -0
- package/dist/gateway-config-handlers.d.ts.map +1 -0
- package/dist/gateway-config-handlers.js +454 -0
- package/dist/gateway-config-handlers.js.map +1 -0
- package/dist/held-content.d.ts +145 -0
- package/dist/held-content.d.ts.map +1 -0
- package/dist/held-content.js +389 -0
- package/dist/held-content.js.map +1 -0
- package/dist/http-manifest-poll.d.ts +67 -0
- package/dist/http-manifest-poll.d.ts.map +1 -0
- package/dist/http-manifest-poll.js +150 -0
- package/dist/http-manifest-poll.js.map +1 -0
- package/dist/identity-migration.d.ts +40 -0
- package/dist/identity-migration.d.ts.map +1 -0
- package/dist/identity-migration.js +461 -0
- package/dist/identity-migration.js.map +1 -0
- package/dist/inbound-refusals.d.ts +283 -0
- package/dist/inbound-refusals.d.ts.map +1 -0
- package/dist/inbound-refusals.js +919 -0
- package/dist/inbound-refusals.js.map +1 -0
- package/dist/inbound-seal-request.d.ts +32 -0
- package/dist/inbound-seal-request.d.ts.map +1 -0
- package/dist/inbound-seal-request.js +228 -0
- package/dist/inbound-seal-request.js.map +1 -0
- package/dist/inbound-sessions.d.ts +291 -0
- package/dist/inbound-sessions.d.ts.map +1 -0
- package/dist/inbound-sessions.js +1609 -0
- package/dist/inbound-sessions.js.map +1 -0
- package/dist/inclusion-proof-handlers.d.ts +43 -0
- package/dist/inclusion-proof-handlers.d.ts.map +1 -0
- package/dist/inclusion-proof-handlers.js +565 -0
- package/dist/inclusion-proof-handlers.js.map +1 -0
- package/dist/inclusion-proof.d.ts +151 -0
- package/dist/inclusion-proof.d.ts.map +1 -0
- package/dist/inclusion-proof.js +228 -0
- package/dist/inclusion-proof.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/initiate-session-handler.d.ts +55 -0
- package/dist/initiate-session-handler.d.ts.map +1 -0
- package/dist/initiate-session-handler.js +310 -0
- package/dist/initiate-session-handler.js.map +1 -0
- package/dist/ipc-client.d.ts +31 -0
- package/dist/ipc-client.d.ts.map +1 -0
- package/dist/ipc-client.js +113 -0
- package/dist/ipc-client.js.map +1 -0
- package/dist/ipc-server.d.ts +63 -0
- package/dist/ipc-server.d.ts.map +1 -0
- package/dist/ipc-server.js +429 -0
- package/dist/ipc-server.js.map +1 -0
- package/dist/ipc-surface.d.ts +44 -0
- package/dist/ipc-surface.d.ts.map +1 -0
- package/dist/ipc-surface.js +107 -0
- package/dist/ipc-surface.js.map +1 -0
- package/dist/line-lcs.d.ts +51 -0
- package/dist/line-lcs.d.ts.map +1 -0
- package/dist/line-lcs.js +71 -0
- package/dist/line-lcs.js.map +1 -0
- package/dist/lock-file.d.ts +39 -0
- package/dist/lock-file.d.ts.map +1 -0
- package/dist/lock-file.js +120 -0
- package/dist/lock-file.js.map +1 -0
- package/dist/log-collapse.d.ts +66 -0
- package/dist/log-collapse.d.ts.map +1 -0
- package/dist/log-collapse.js +244 -0
- package/dist/log-collapse.js.map +1 -0
- package/dist/log-rotate.d.ts +67 -0
- package/dist/log-rotate.d.ts.map +1 -0
- package/dist/log-rotate.js +134 -0
- package/dist/log-rotate.js.map +1 -0
- package/dist/manifest-deps.d.ts +25 -0
- package/dist/manifest-deps.d.ts.map +1 -0
- package/dist/manifest-deps.js +151 -0
- package/dist/manifest-deps.js.map +1 -0
- package/dist/manifest-poll-scheduler.d.ts +31 -0
- package/dist/manifest-poll-scheduler.d.ts.map +1 -0
- package/dist/manifest-poll-scheduler.js +59 -0
- package/dist/manifest-poll-scheduler.js.map +1 -0
- package/dist/manifest-validity.d.ts +153 -0
- package/dist/manifest-validity.d.ts.map +1 -0
- package/dist/manifest-validity.js +268 -0
- package/dist/manifest-validity.js.map +1 -0
- package/dist/manifest-version-store-db.d.ts +24 -0
- package/dist/manifest-version-store-db.d.ts.map +1 -0
- package/dist/manifest-version-store-db.js +58 -0
- package/dist/manifest-version-store-db.js.map +1 -0
- package/dist/manifest-version-store.d.ts +16 -0
- package/dist/manifest-version-store.d.ts.map +1 -0
- package/dist/manifest-version-store.js +15 -0
- package/dist/manifest-version-store.js.map +1 -0
- package/dist/network-directory-node.d.ts +136 -0
- package/dist/network-directory-node.d.ts.map +1 -0
- package/dist/network-directory-node.js +810 -0
- package/dist/network-directory-node.js.map +1 -0
- package/dist/nonce-dedup.d.ts +68 -0
- package/dist/nonce-dedup.d.ts.map +1 -0
- package/dist/nonce-dedup.js +205 -0
- package/dist/nonce-dedup.js.map +1 -0
- package/dist/notification-dispatcher.d.ts +92 -0
- package/dist/notification-dispatcher.d.ts.map +1 -0
- package/dist/notification-dispatcher.js +210 -0
- package/dist/notification-dispatcher.js.map +1 -0
- package/dist/notification-handlers.d.ts +53 -0
- package/dist/notification-handlers.d.ts.map +1 -0
- package/dist/notification-handlers.js +461 -0
- package/dist/notification-handlers.js.map +1 -0
- package/dist/onboarding-guidance.d.ts +79 -0
- package/dist/onboarding-guidance.d.ts.map +1 -0
- package/dist/onboarding-guidance.js +95 -0
- package/dist/onboarding-guidance.js.map +1 -0
- package/dist/operator-guidance.d.ts +25 -0
- package/dist/operator-guidance.d.ts.map +1 -0
- package/dist/operator-guidance.js +50 -0
- package/dist/operator-guidance.js.map +1 -0
- package/dist/orphan-triage.d.ts +130 -0
- package/dist/orphan-triage.d.ts.map +1 -0
- package/dist/orphan-triage.js +207 -0
- package/dist/orphan-triage.js.map +1 -0
- package/dist/outbound-sessions.d.ts +126 -0
- package/dist/outbound-sessions.d.ts.map +1 -0
- package/dist/outbound-sessions.js +1052 -0
- package/dist/outbound-sessions.js.map +1 -0
- package/dist/park-envelope.d.ts +329 -0
- package/dist/park-envelope.d.ts.map +1 -0
- package/dist/park-envelope.js +509 -0
- package/dist/park-envelope.js.map +1 -0
- package/dist/park-recovery.d.ts +273 -0
- package/dist/park-recovery.d.ts.map +1 -0
- package/dist/park-recovery.js +717 -0
- package/dist/park-recovery.js.map +1 -0
- package/dist/park-refusals.d.ts +147 -0
- package/dist/park-refusals.d.ts.map +1 -0
- package/dist/park-refusals.js +331 -0
- package/dist/park-refusals.js.map +1 -0
- package/dist/quarantine-framing.d.ts +92 -0
- package/dist/quarantine-framing.d.ts.map +1 -0
- package/dist/quarantine-framing.js +111 -0
- package/dist/quarantine-framing.js.map +1 -0
- package/dist/reconnect-drain.d.ts +22 -0
- package/dist/reconnect-drain.d.ts.map +1 -0
- package/dist/reconnect-drain.js +65 -0
- package/dist/reconnect-drain.js.map +1 -0
- package/dist/recovered-position.d.ts +14 -0
- package/dist/recovered-position.d.ts.map +1 -0
- package/dist/recovered-position.js +59 -0
- package/dist/recovered-position.js.map +1 -0
- package/dist/refusal-notices.d.ts +196 -0
- package/dist/refusal-notices.d.ts.map +1 -0
- package/dist/refusal-notices.js +516 -0
- package/dist/refusal-notices.js.map +1 -0
- package/dist/refusal-reasons.d.ts +245 -0
- package/dist/refusal-reasons.d.ts.map +1 -0
- package/dist/refusal-reasons.js +363 -0
- package/dist/refusal-reasons.js.map +1 -0
- package/dist/register-handler.d.ts +36 -0
- package/dist/register-handler.d.ts.map +1 -0
- package/dist/register-handler.js +285 -0
- package/dist/register-handler.js.map +1 -0
- package/dist/registration-context.d.ts +72 -0
- package/dist/registration-context.d.ts.map +1 -0
- package/dist/registration-context.js +126 -0
- package/dist/registration-context.js.map +1 -0
- package/dist/registration-manager.d.ts +94 -0
- package/dist/registration-manager.d.ts.map +1 -0
- package/dist/registration-manager.js +585 -0
- package/dist/registration-manager.js.map +1 -0
- package/dist/registration-persistence.d.ts +183 -0
- package/dist/registration-persistence.d.ts.map +1 -0
- package/dist/registration-persistence.js +263 -0
- package/dist/registration-persistence.js.map +1 -0
- package/dist/registry-poll.d.ts +52 -0
- package/dist/registry-poll.d.ts.map +1 -0
- package/dist/registry-poll.js +140 -0
- package/dist/registry-poll.js.map +1 -0
- package/dist/registry-version-store-db.d.ts +22 -0
- package/dist/registry-version-store-db.d.ts.map +1 -0
- package/dist/registry-version-store-db.js +50 -0
- package/dist/registry-version-store-db.js.map +1 -0
- package/dist/relay-endpoints.d.ts +18 -0
- package/dist/relay-endpoints.d.ts.map +1 -0
- package/dist/relay-endpoints.js +9 -0
- package/dist/relay-endpoints.js.map +1 -0
- package/dist/relay-only.d.ts +140 -0
- package/dist/relay-only.d.ts.map +1 -0
- package/dist/relay-only.js +193 -0
- package/dist/relay-only.js.map +1 -0
- package/dist/relay-receipt-store.d.ts +155 -0
- package/dist/relay-receipt-store.d.ts.map +1 -0
- package/dist/relay-receipt-store.js +284 -0
- package/dist/relay-receipt-store.js.map +1 -0
- package/dist/relay-reconnect.d.ts +32 -0
- package/dist/relay-reconnect.d.ts.map +1 -0
- package/dist/relay-reconnect.js +29 -0
- package/dist/relay-reconnect.js.map +1 -0
- package/dist/reply-lag.d.ts +11 -0
- package/dist/reply-lag.d.ts.map +1 -0
- package/dist/reply-lag.js +46 -0
- package/dist/reply-lag.js.map +1 -0
- package/dist/resolve-named-agent.d.ts +49 -0
- package/dist/resolve-named-agent.d.ts.map +1 -0
- package/dist/resolve-named-agent.js +77 -0
- package/dist/resolve-named-agent.js.map +1 -0
- package/dist/restart-seal-resolver.d.ts +110 -0
- package/dist/restart-seal-resolver.d.ts.map +1 -0
- package/dist/restart-seal-resolver.js +353 -0
- package/dist/restart-seal-resolver.js.map +1 -0
- package/dist/resume-last-seen.d.ts +15 -0
- package/dist/resume-last-seen.d.ts.map +1 -0
- package/dist/resume-last-seen.js +44 -0
- package/dist/resume-last-seen.js.map +1 -0
- package/dist/retry-queue.d.ts +203 -0
- package/dist/retry-queue.d.ts.map +1 -0
- package/dist/retry-queue.js +701 -0
- package/dist/retry-queue.js.map +1 -0
- package/dist/roster-freshness.d.ts +160 -0
- package/dist/roster-freshness.d.ts.map +1 -0
- package/dist/roster-freshness.js +250 -0
- package/dist/roster-freshness.js.map +1 -0
- package/dist/screening-status.d.ts +15 -0
- package/dist/screening-status.d.ts.map +1 -0
- package/dist/screening-status.js +65 -0
- package/dist/screening-status.js.map +1 -0
- package/dist/seal-carried-close.d.ts +37 -0
- package/dist/seal-carried-close.d.ts.map +1 -0
- package/dist/seal-carried-close.js +179 -0
- package/dist/seal-carried-close.js.map +1 -0
- package/dist/seal-certificate-pull.d.ts +79 -0
- package/dist/seal-certificate-pull.d.ts.map +1 -0
- package/dist/seal-certificate-pull.js +186 -0
- package/dist/seal-certificate-pull.js.map +1 -0
- package/dist/seal-certified-root-check.d.ts +37 -0
- package/dist/seal-certified-root-check.d.ts.map +1 -0
- package/dist/seal-certified-root-check.js +127 -0
- package/dist/seal-certified-root-check.js.map +1 -0
- package/dist/seal-coordinator.d.ts +118 -0
- package/dist/seal-coordinator.d.ts.map +1 -0
- package/dist/seal-coordinator.js +927 -0
- package/dist/seal-coordinator.js.map +1 -0
- package/dist/seal-escalation.d.ts +80 -0
- package/dist/seal-escalation.d.ts.map +1 -0
- package/dist/seal-escalation.js +283 -0
- package/dist/seal-escalation.js.map +1 -0
- package/dist/seal-evidence-root-check.d.ts +70 -0
- package/dist/seal-evidence-root-check.d.ts.map +1 -0
- package/dist/seal-evidence-root-check.js +199 -0
- package/dist/seal-evidence-root-check.js.map +1 -0
- package/dist/seal-failure-store.d.ts +139 -0
- package/dist/seal-failure-store.d.ts.map +1 -0
- package/dist/seal-failure-store.js +207 -0
- package/dist/seal-failure-store.js.map +1 -0
- package/dist/seal-flows.d.ts +107 -0
- package/dist/seal-flows.d.ts.map +1 -0
- package/dist/seal-flows.js +638 -0
- package/dist/seal-flows.js.map +1 -0
- package/dist/seal-frontier-verify.d.ts +103 -0
- package/dist/seal-frontier-verify.d.ts.map +1 -0
- package/dist/seal-frontier-verify.js +143 -0
- package/dist/seal-frontier-verify.js.map +1 -0
- package/dist/seal-leaf.d.ts +58 -0
- package/dist/seal-leaf.d.ts.map +1 -0
- package/dist/seal-leaf.js +112 -0
- package/dist/seal-leaf.js.map +1 -0
- package/dist/seal-legibility-tbs.d.ts +25 -0
- package/dist/seal-legibility-tbs.d.ts.map +1 -0
- package/dist/seal-legibility-tbs.js +77 -0
- package/dist/seal-legibility-tbs.js.map +1 -0
- package/dist/seal-local-terminus.d.ts +41 -0
- package/dist/seal-local-terminus.d.ts.map +1 -0
- package/dist/seal-local-terminus.js +170 -0
- package/dist/seal-local-terminus.js.map +1 -0
- package/dist/seal-receipt-upgrade.d.ts +30 -0
- package/dist/seal-receipt-upgrade.d.ts.map +1 -0
- package/dist/seal-receipt-upgrade.js +49 -0
- package/dist/seal-receipt-upgrade.js.map +1 -0
- package/dist/seal-relay-silence.d.ts +51 -0
- package/dist/seal-relay-silence.d.ts.map +1 -0
- package/dist/seal-relay-silence.js +76 -0
- package/dist/seal-relay-silence.js.map +1 -0
- package/dist/seal-settle.d.ts +38 -0
- package/dist/seal-settle.d.ts.map +1 -0
- package/dist/seal-settle.js +33 -0
- package/dist/seal-settle.js.map +1 -0
- package/dist/seal-upgrade.d.ts +107 -0
- package/dist/seal-upgrade.d.ts.map +1 -0
- package/dist/seal-upgrade.js +200 -0
- package/dist/seal-upgrade.js.map +1 -0
- package/dist/sealed-conversation.d.ts +36 -0
- package/dist/sealed-conversation.d.ts.map +1 -0
- package/dist/sealed-conversation.js +171 -0
- package/dist/sealed-conversation.js.map +1 -0
- package/dist/sealed-leaf-set.d.ts +92 -0
- package/dist/sealed-leaf-set.d.ts.map +1 -0
- package/dist/sealed-leaf-set.js +122 -0
- package/dist/sealed-leaf-set.js.map +1 -0
- package/dist/send-claims.d.ts +56 -0
- package/dist/send-claims.d.ts.map +1 -0
- package/dist/send-claims.js +50 -0
- package/dist/send-claims.js.map +1 -0
- package/dist/session-assignment-parser.d.ts +104 -0
- package/dist/session-assignment-parser.d.ts.map +1 -0
- package/dist/session-assignment-parser.js +345 -0
- package/dist/session-assignment-parser.js.map +1 -0
- package/dist/session-category.d.ts +19 -0
- package/dist/session-category.d.ts.map +1 -0
- package/dist/session-category.js +14 -0
- package/dist/session-category.js.map +1 -0
- package/dist/session-ceremony.d.ts +297 -0
- package/dist/session-ceremony.d.ts.map +1 -0
- package/dist/session-ceremony.js +964 -0
- package/dist/session-ceremony.js.map +1 -0
- package/dist/session-closed.d.ts +79 -0
- package/dist/session-closed.d.ts.map +1 -0
- package/dist/session-closed.js +189 -0
- package/dist/session-closed.js.map +1 -0
- package/dist/session-connection-gater.d.ts +148 -0
- package/dist/session-connection-gater.d.ts.map +1 -0
- package/dist/session-connection-gater.js +332 -0
- package/dist/session-connection-gater.js.map +1 -0
- package/dist/session-content-context.d.ts +162 -0
- package/dist/session-content-context.d.ts.map +1 -0
- package/dist/session-content-context.js +2 -0
- package/dist/session-content-context.js.map +1 -0
- package/dist/session-content-handlers.d.ts +82 -0
- package/dist/session-content-handlers.d.ts.map +1 -0
- package/dist/session-content-handlers.js +1382 -0
- package/dist/session-content-handlers.js.map +1 -0
- package/dist/session-content-ingest.d.ts +206 -0
- package/dist/session-content-ingest.d.ts.map +1 -0
- package/dist/session-content-ingest.js +2167 -0
- package/dist/session-content-ingest.js.map +1 -0
- package/dist/session-content-send.d.ts +191 -0
- package/dist/session-content-send.d.ts.map +1 -0
- package/dist/session-content-send.js +1360 -0
- package/dist/session-content-send.js.map +1 -0
- package/dist/session-delivery-acks.d.ts +169 -0
- package/dist/session-delivery-acks.d.ts.map +1 -0
- package/dist/session-delivery-acks.js +569 -0
- package/dist/session-delivery-acks.js.map +1 -0
- package/dist/session-ephemerals.d.ts +279 -0
- package/dist/session-ephemerals.d.ts.map +1 -0
- package/dist/session-ephemerals.js +591 -0
- package/dist/session-ephemerals.js.map +1 -0
- package/dist/session-leaf-records.d.ts +159 -0
- package/dist/session-leaf-records.d.ts.map +1 -0
- package/dist/session-leaf-records.js +408 -0
- package/dist/session-leaf-records.js.map +1 -0
- package/dist/session-lifecycle.d.ts +303 -0
- package/dist/session-lifecycle.d.ts.map +1 -0
- package/dist/session-lifecycle.js +1679 -0
- package/dist/session-lifecycle.js.map +1 -0
- package/dist/session-liveness.d.ts +135 -0
- package/dist/session-liveness.d.ts.map +1 -0
- package/dist/session-liveness.js +347 -0
- package/dist/session-liveness.js.map +1 -0
- package/dist/session-name.d.ts +35 -0
- package/dist/session-name.d.ts.map +1 -0
- package/dist/session-name.js +60 -0
- package/dist/session-name.js.map +1 -0
- package/dist/session-node-factory.d.ts +18 -0
- package/dist/session-node-factory.d.ts.map +1 -0
- package/dist/session-node-factory.js +182 -0
- package/dist/session-node-factory.js.map +1 -0
- package/dist/session-node-manager.d.ts +877 -0
- package/dist/session-node-manager.d.ts.map +1 -0
- package/dist/session-node-manager.js +2998 -0
- package/dist/session-node-manager.js.map +1 -0
- package/dist/session-node-types.d.ts +1057 -0
- package/dist/session-node-types.d.ts.map +1 -0
- package/dist/session-node-types.js +657 -0
- package/dist/session-node-types.js.map +1 -0
- package/dist/session-notify.d.ts +46 -0
- package/dist/session-notify.d.ts.map +1 -0
- package/dist/session-notify.js +116 -0
- package/dist/session-notify.js.map +1 -0
- package/dist/session-own-chain-store.d.ts +65 -0
- package/dist/session-own-chain-store.d.ts.map +1 -0
- package/dist/session-own-chain-store.js +75 -0
- package/dist/session-own-chain-store.js.map +1 -0
- package/dist/session-queries.d.ts +476 -0
- package/dist/session-queries.d.ts.map +1 -0
- package/dist/session-queries.js +1007 -0
- package/dist/session-queries.js.map +1 -0
- package/dist/session-read-handlers.d.ts +87 -0
- package/dist/session-read-handlers.d.ts.map +1 -0
- package/dist/session-read-handlers.js +689 -0
- package/dist/session-read-handlers.js.map +1 -0
- package/dist/session-records.d.ts +341 -0
- package/dist/session-records.d.ts.map +1 -0
- package/dist/session-records.js +858 -0
- package/dist/session-records.js.map +1 -0
- package/dist/session-relay-client.d.ts +659 -0
- package/dist/session-relay-client.d.ts.map +1 -0
- package/dist/session-relay-client.js +2876 -0
- package/dist/session-relay-client.js.map +1 -0
- package/dist/session-relay.d.ts +397 -0
- package/dist/session-relay.d.ts.map +1 -0
- package/dist/session-relay.js +1636 -0
- package/dist/session-relay.js.map +1 -0
- package/dist/session-salt-agreement.d.ts +331 -0
- package/dist/session-salt-agreement.d.ts.map +1 -0
- package/dist/session-salt-agreement.js +472 -0
- package/dist/session-salt-agreement.js.map +1 -0
- package/dist/session-salts.d.ts +432 -0
- package/dist/session-salts.d.ts.map +1 -0
- package/dist/session-salts.js +1540 -0
- package/dist/session-salts.js.map +1 -0
- package/dist/session-schema.d.ts +30 -0
- package/dist/session-schema.d.ts.map +1 -0
- package/dist/session-schema.js +877 -0
- package/dist/session-schema.js.map +1 -0
- package/dist/session-seal-leaf-store.d.ts +70 -0
- package/dist/session-seal-leaf-store.d.ts.map +1 -0
- package/dist/session-seal-leaf-store.js +105 -0
- package/dist/session-seal-leaf-store.js.map +1 -0
- package/dist/session-seal.d.ts +334 -0
- package/dist/session-seal.d.ts.map +1 -0
- package/dist/session-seal.js +1017 -0
- package/dist/session-seal.js.map +1 -0
- package/dist/session-terminal-refusal.d.ts +65 -0
- package/dist/session-terminal-refusal.d.ts.map +1 -0
- package/dist/session-terminal-refusal.js +87 -0
- package/dist/session-terminal-refusal.js.map +1 -0
- package/dist/session-tree.d.ts +110 -0
- package/dist/session-tree.d.ts.map +1 -0
- package/dist/session-tree.js +144 -0
- package/dist/session-tree.js.map +1 -0
- package/dist/session-views.d.ts +47 -0
- package/dist/session-views.d.ts.map +1 -0
- package/dist/session-views.js +278 -0
- package/dist/session-views.js.map +1 -0
- package/dist/signal-handlers.d.ts +63 -0
- package/dist/signal-handlers.d.ts.map +1 -0
- package/dist/signal-handlers.js +980 -0
- package/dist/signal-handlers.js.map +1 -0
- package/dist/signal-requirement-policy.d.ts +51 -0
- package/dist/signal-requirement-policy.d.ts.map +1 -0
- package/dist/signal-requirement-policy.js +89 -0
- package/dist/signal-requirement-policy.js.map +1 -0
- package/dist/signal-revocability.d.ts +49 -0
- package/dist/signal-revocability.d.ts.map +1 -0
- package/dist/signal-revocability.js +93 -0
- package/dist/signal-revocability.js.map +1 -0
- package/dist/signal-submission.d.ts +181 -0
- package/dist/signal-submission.d.ts.map +1 -0
- package/dist/signal-submission.js +368 -0
- package/dist/signal-submission.js.map +1 -0
- package/dist/signaling-connect.d.ts +118 -0
- package/dist/signaling-connect.d.ts.map +1 -0
- package/dist/signaling-connect.js +538 -0
- package/dist/signaling-connect.js.map +1 -0
- package/dist/signaling-wiring.d.ts +105 -0
- package/dist/signaling-wiring.d.ts.map +1 -0
- package/dist/signaling-wiring.js +393 -0
- package/dist/signaling-wiring.js.map +1 -0
- package/dist/singleton-lock.d.ts +85 -0
- package/dist/singleton-lock.d.ts.map +1 -0
- package/dist/singleton-lock.js +219 -0
- package/dist/singleton-lock.js.map +1 -0
- package/dist/sqlcipher-db.d.ts +139 -0
- package/dist/sqlcipher-db.d.ts.map +1 -0
- package/dist/sqlcipher-db.js +357 -0
- package/dist/sqlcipher-db.js.map +1 -0
- package/dist/standing-receivers.d.ts +319 -0
- package/dist/standing-receivers.d.ts.map +1 -0
- package/dist/standing-receivers.js +1295 -0
- package/dist/standing-receivers.js.map +1 -0
- package/dist/start-agent.d.ts +64 -0
- package/dist/start-agent.d.ts.map +1 -0
- package/dist/start-agent.js +136 -0
- package/dist/start-agent.js.map +1 -0
- package/dist/status-handler.d.ts +54 -0
- package/dist/status-handler.d.ts.map +1 -0
- package/dist/status-handler.js +61 -0
- package/dist/status-handler.js.map +1 -0
- package/dist/submission-retry.d.ts +208 -0
- package/dist/submission-retry.d.ts.map +1 -0
- package/dist/submission-retry.js +506 -0
- package/dist/submission-retry.js.map +1 -0
- package/dist/telegram-bot-client.d.ts +34 -0
- package/dist/telegram-bot-client.d.ts.map +1 -0
- package/dist/telegram-bot-client.js +36 -0
- package/dist/telegram-bot-client.js.map +1 -0
- package/dist/telegram-doorbell.d.ts +38 -0
- package/dist/telegram-doorbell.d.ts.map +1 -0
- package/dist/telegram-doorbell.js +140 -0
- package/dist/telegram-doorbell.js.map +1 -0
- package/dist/test-handlers.d.ts +62 -0
- package/dist/test-handlers.d.ts.map +1 -0
- package/dist/test-handlers.js +240 -0
- package/dist/test-handlers.js.map +1 -0
- package/dist/testing.d.ts +10 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +10 -0
- package/dist/testing.js.map +1 -0
- package/dist/transport-composition.d.ts +31 -0
- package/dist/transport-composition.d.ts.map +1 -0
- package/dist/transport-composition.js +55 -0
- package/dist/transport-composition.js.map +1 -0
- package/dist/transport-selector.d.ts +202 -0
- package/dist/transport-selector.d.ts.map +1 -0
- package/dist/transport-selector.js +196 -0
- package/dist/transport-selector.js.map +1 -0
- package/dist/trust-signal-pickup-listener.d.ts +43 -0
- package/dist/trust-signal-pickup-listener.d.ts.map +1 -0
- package/dist/trust-signal-pickup-listener.js +48 -0
- package/dist/trust-signal-pickup-listener.js.map +1 -0
- package/dist/trust-signal-store.d.ts +406 -0
- package/dist/trust-signal-store.d.ts.map +1 -0
- package/dist/trust-signal-store.js +939 -0
- package/dist/trust-signal-store.js.map +1 -0
- package/dist/trust-signal-sweep-tick.d.ts +60 -0
- package/dist/trust-signal-sweep-tick.d.ts.map +1 -0
- package/dist/trust-signal-sweep-tick.js +101 -0
- package/dist/trust-signal-sweep-tick.js.map +1 -0
- package/dist/trust-signal-sweep.d.ts +94 -0
- package/dist/trust-signal-sweep.d.ts.map +1 -0
- package/dist/trust-signal-sweep.js +147 -0
- package/dist/trust-signal-sweep.js.map +1 -0
- package/dist/type-registry.d.ts +42 -0
- package/dist/type-registry.d.ts.map +1 -0
- package/dist/type-registry.js +37 -0
- package/dist/type-registry.js.map +1 -0
- package/dist/types.d.ts +746 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +20 -0
- package/dist/types.js.map +1 -0
- package/dist/unresolved-nodes-report.d.ts +14 -0
- package/dist/unresolved-nodes-report.d.ts.map +1 -0
- package/dist/unresolved-nodes-report.js +96 -0
- package/dist/unresolved-nodes-report.js.map +1 -0
- package/dist/vocabulary.d.ts +150 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +386 -0
- package/dist/vocabulary.js.map +1 -0
- package/dist/who-label.d.ts +28 -0
- package/dist/who-label.d.ts.map +1 -0
- package/dist/who-label.js +31 -0
- package/dist/who-label.js.map +1 -0
- package/dist/who-resolver.d.ts +15 -0
- package/dist/who-resolver.d.ts.map +1 -0
- package/dist/who-resolver.js +47 -0
- package/dist/who-resolver.js.map +1 -0
- package/dist/wire-content-hash.d.ts +93 -0
- package/dist/wire-content-hash.d.ts.map +1 -0
- package/dist/wire-content-hash.js +116 -0
- package/dist/wire-content-hash.js.map +1 -0
- package/dist/withheld-content.d.ts +13 -0
- package/dist/withheld-content.d.ts.map +1 -0
- package/dist/withheld-content.js +46 -0
- package/dist/withheld-content.js.map +1 -0
- package/dist/witness-alerts.d.ts +40 -0
- package/dist/witness-alerts.d.ts.map +1 -0
- package/dist/witness-alerts.js +102 -0
- package/dist/witness-alerts.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,931 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOD-DOC-STORE-1 — the daemon's three document tables (§16.7-12).
|
|
3
|
+
*
|
|
4
|
+
* TWO LAYERS, NOT ONE (§14). Storing only a merged Yjs binary would discard the signed envelope
|
|
5
|
+
* chain that makes a seal verifiable, so both are kept:
|
|
6
|
+
*
|
|
7
|
+
* `document_envelopes` — the IMMUTABLE log: signatures, provenance, the per-document chain.
|
|
8
|
+
* This is the truth.
|
|
9
|
+
* `document_snapshots` — a MATERIALIZATION for fast start. Disposable by construction:
|
|
10
|
+
* delete it and it rebuilds from the log, byte-identical.
|
|
11
|
+
*
|
|
12
|
+
* The distinction is load-bearing rather than stylistic. Live Yjs state deliberately does NOT
|
|
13
|
+
* survive a daemon restart — CELLO's invariant is daemon-up-is-CELLO-on — and that is only safe
|
|
14
|
+
* because the log makes rebuilding a lookup rather than an archaeology exercise.
|
|
15
|
+
*
|
|
16
|
+
* THIS MODULE PERSISTS; IT DOES NOT APPLY. Replay is INJECTED (`rebuildSnapshot`), so the store
|
|
17
|
+
* owns *what to replay and in what order* while the engine (DOD-DOC-ENGINE-1) owns *how to
|
|
18
|
+
* apply*. That keeps `yjs` out of this file's imports entirely and keeps the P0/P1 boundary
|
|
19
|
+
* honest — a store that quietly grew a Y.Doc would be the engine wearing a store's name.
|
|
20
|
+
*
|
|
21
|
+
* WHAT IS NEVER STORED HERE: a Yjs clientID. §14's one-line rule is "let Yjs mint its own per
|
|
22
|
+
* live Y.Doc; never derive it from agent identity, never persist and restore one." DOD-DOC-FUZZ-1
|
|
23
|
+
* measured the cost of getting this wrong — two live docs sharing a clientID means the colliding
|
|
24
|
+
* writer silently wins, the honest client's update is accepted-and-dropped, and the result is a
|
|
25
|
+
* splice of two authors with an EMPTY pending set and no error on any path. So the snapshot
|
|
26
|
+
* stores a binary and a state vector, and nothing that could be restored into a live document as
|
|
27
|
+
* an identity.
|
|
28
|
+
*
|
|
29
|
+
* KEYED ON STABLE IDS ONLY. `agent_id` and `document_id`, never `agent_name` — it is a mutable
|
|
30
|
+
* display label and reusable after retirement. The M7 session tables join on `agent_name`; that
|
|
31
|
+
* is a known defect (`DOD-AGENT-ID-JOINKEY-1`), not a precedent to copy.
|
|
32
|
+
*/
|
|
33
|
+
import { DOCUMENT_ENTRIES_CREATE_SQL, dropLegacyEpochColumn, dropLegacyColumns, } from "./document-amendment-store.js";
|
|
34
|
+
import { extractErrorMessage } from "./error-message.js";
|
|
35
|
+
/** Thrown when a read path refuses to materialize over a chain that does not verify. */
|
|
36
|
+
export class DocumentChainError extends Error {
|
|
37
|
+
reason;
|
|
38
|
+
detail;
|
|
39
|
+
constructor(reason, detail) {
|
|
40
|
+
super(`${reason}: ${detail}`);
|
|
41
|
+
this.name = "DocumentChainError";
|
|
42
|
+
this.reason = reason;
|
|
43
|
+
this.detail = detail;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const CREATE_DOCUMENTS_SQL = `
|
|
47
|
+
CREATE TABLE IF NOT EXISTS documents (
|
|
48
|
+
owner_agent_id TEXT NOT NULL,
|
|
49
|
+
document_id TEXT NOT NULL,
|
|
50
|
+
peer_agent_id TEXT NOT NULL,
|
|
51
|
+
document_type TEXT NOT NULL,
|
|
52
|
+
properties TEXT NOT NULL,
|
|
53
|
+
status TEXT NOT NULL CHECK (status IN ('active', 'closed', 'killed', 'stalled')),
|
|
54
|
+
created_at INTEGER NOT NULL,
|
|
55
|
+
PRIMARY KEY (owner_agent_id, document_id)
|
|
56
|
+
);
|
|
57
|
+
`;
|
|
58
|
+
const CREATE_ENVELOPES_SQL = `
|
|
59
|
+
CREATE TABLE IF NOT EXISTS document_envelopes (
|
|
60
|
+
owner_agent_id TEXT NOT NULL,
|
|
61
|
+
document_id TEXT NOT NULL,
|
|
62
|
+
envelope_hash TEXT NOT NULL,
|
|
63
|
+
sender_agent_id TEXT NOT NULL,
|
|
64
|
+
doc_prev_hash TEXT,
|
|
65
|
+
signature BLOB NOT NULL,
|
|
66
|
+
state_vector BLOB NOT NULL,
|
|
67
|
+
payload BLOB,
|
|
68
|
+
-- SYNC-G1: the author's governance frontier at authoring (JSON array of entry hashes) —
|
|
69
|
+
-- content's causal link to the governance that made it admissible. Inside the signed TBS.
|
|
70
|
+
governance_parents TEXT NOT NULL DEFAULT '[]',
|
|
71
|
+
kind TEXT NOT NULL CHECK (kind IN ('update', 'withdrawal', 'rejection')),
|
|
72
|
+
-- The Yjs clientID the sender SIGNED for (ENVELOPE-1 puts it inside the TBS). Recorded so the
|
|
73
|
+
-- gate's authorship rule has a binding derived from authenticated data rather than from a seam
|
|
74
|
+
-- somebody has to remember to implement. §14 forbids persisting a clientID for REUSE — this is
|
|
75
|
+
-- the opposite: a record of which ones a peer has actually signed for.
|
|
76
|
+
sender_client_id INTEGER,
|
|
77
|
+
references_hash TEXT,
|
|
78
|
+
created_at INTEGER NOT NULL,
|
|
79
|
+
log_index INTEGER NOT NULL,
|
|
80
|
+
PRIMARY KEY (owner_agent_id, document_id, envelope_hash),
|
|
81
|
+
-- A duplicate index would make ORDER BY log_index non-deterministic, and this log's entire
|
|
82
|
+
-- value is deterministic replay. Two daemons on one DB file (the orphan-process case this
|
|
83
|
+
-- repo has been bitten by) would otherwise each compute the same next index and both insert.
|
|
84
|
+
UNIQUE (owner_agent_id, document_id, log_index),
|
|
85
|
+
-- An audit record carries no content, and replay SKIPS payload-free non-update rows on that
|
|
86
|
+
-- basis. Enforce it here rather than relying on the convention: if a withdrawal ever carried
|
|
87
|
+
-- a payload and were later purged, replay would skip it and rebuild SHORT — the exact
|
|
88
|
+
-- divergence the purged-update refusal exists to prevent.
|
|
89
|
+
CHECK (kind = 'update' OR payload IS NULL),
|
|
90
|
+
-- Rows cannot exist for a document that was never created. The reference store makes the
|
|
91
|
+
-- same call in writing: an unscoped row must be impossible to write, not merely discouraged
|
|
92
|
+
-- by a query convention every future caller has to remember.
|
|
93
|
+
FOREIGN KEY (owner_agent_id, document_id) REFERENCES documents (owner_agent_id, document_id)
|
|
94
|
+
);
|
|
95
|
+
`;
|
|
96
|
+
/**
|
|
97
|
+
* Quarantined updates (DOD-DOC-REJECT-1). A separate table, deliberately:
|
|
98
|
+
*
|
|
99
|
+
* `document_envelopes` cannot hold them — its CHECK forbids a payload on a non-update row — and
|
|
100
|
+
* putting the refused bytes in as an `update` row would be worse, because `replay` applies every
|
|
101
|
+
* payload in order and does not honour references. The refused content would come back on every
|
|
102
|
+
* rebuild, which is the opposite of quarantine.
|
|
103
|
+
*
|
|
104
|
+
* So the log stays clean and replay is untouched, while the bytes a `0x05` leaf references
|
|
105
|
+
* actually survive a restart — which is the whole point of "held, never discarded" (§3.2).
|
|
106
|
+
*/
|
|
107
|
+
const CREATE_QUARANTINE_SQL = `
|
|
108
|
+
CREATE TABLE IF NOT EXISTS document_quarantine (
|
|
109
|
+
owner_agent_id TEXT NOT NULL,
|
|
110
|
+
document_id TEXT NOT NULL,
|
|
111
|
+
rejected_envelope_hash TEXT NOT NULL,
|
|
112
|
+
-- The 0x05 leaf THIS row belongs to. It is the PK because one refused envelope can be refused
|
|
113
|
+
-- MORE THAN ONCE, for different reasons, across retry rounds — the rejection protocol's normal
|
|
114
|
+
-- path. Keyed on the REFUSED envelope instead, the second round's bytes, reason, rule and limit
|
|
115
|
+
-- were dropped by ON CONFLICT DO NOTHING with no log line, and the stall message then told the
|
|
116
|
+
-- operator "the most recent reason was" and printed the OLDEST. One 0x05 leaf, one row.
|
|
117
|
+
rejection_envelope_hash TEXT NOT NULL,
|
|
118
|
+
-- The refused envelope's OWN chain link and author, so verifyChainLinkage can bridge across
|
|
119
|
+
-- it. The refused payload is deliberately never written to the log (see the header), which
|
|
120
|
+
-- would otherwise leave the peer's supersession chaining onto a hash that is nowhere.
|
|
121
|
+
rejected_sender_agent_id TEXT NOT NULL,
|
|
122
|
+
rejected_doc_prev_hash TEXT,
|
|
123
|
+
payload BLOB NOT NULL,
|
|
124
|
+
reason TEXT NOT NULL,
|
|
125
|
+
detail TEXT,
|
|
126
|
+
rule TEXT,
|
|
127
|
+
limit_name TEXT,
|
|
128
|
+
limit_value INTEGER,
|
|
129
|
+
limit_actual INTEGER,
|
|
130
|
+
-- SYNC-R35: the EXACT signed refusal frame, so the refusal can travel by the ordinary
|
|
131
|
+
-- exchange (re-encoding from columns cannot reproduce the signed bytes). Nullable: rows
|
|
132
|
+
-- born before R35 hold no wire, and the exchange simply has nothing to attach for them.
|
|
133
|
+
rejection_wire BLOB,
|
|
134
|
+
created_at INTEGER NOT NULL,
|
|
135
|
+
PRIMARY KEY (owner_agent_id, document_id, rejection_envelope_hash),
|
|
136
|
+
FOREIGN KEY (owner_agent_id, document_id) REFERENCES documents (owner_agent_id, document_id)
|
|
137
|
+
);
|
|
138
|
+
`;
|
|
139
|
+
/**
|
|
140
|
+
* Rejections we RECEIVED (§3.2 "both sides"). A separate table from `document_quarantine` because
|
|
141
|
+
* the two hold different facts: quarantine holds bytes WE refused, this holds the peer's refusal of
|
|
142
|
+
* bytes we authored — we hold no payload of theirs to quarantine.
|
|
143
|
+
*
|
|
144
|
+
* It is durable rather than a log line because everything an operator needs on the publishing side
|
|
145
|
+
* depends on it surviving a restart: why their work was refused, and how many rounds remain before
|
|
146
|
+
* the document stalls. Without a row, the sending side counted its OWN rejections — which on a pure
|
|
147
|
+
* publisher is zero forever — so the retry bound existed only on the side that never loops.
|
|
148
|
+
*/
|
|
149
|
+
const CREATE_REJECTIONS_RECEIVED_SQL = `
|
|
150
|
+
CREATE TABLE IF NOT EXISTS document_rejections_received (
|
|
151
|
+
owner_agent_id TEXT NOT NULL,
|
|
152
|
+
document_id TEXT NOT NULL,
|
|
153
|
+
rejection_envelope_hash TEXT NOT NULL,
|
|
154
|
+
rejected_envelope_hash TEXT NOT NULL,
|
|
155
|
+
from_agent_id TEXT NOT NULL,
|
|
156
|
+
reason TEXT NOT NULL,
|
|
157
|
+
detail TEXT,
|
|
158
|
+
created_at INTEGER NOT NULL,
|
|
159
|
+
PRIMARY KEY (owner_agent_id, document_id, rejection_envelope_hash),
|
|
160
|
+
FOREIGN KEY (owner_agent_id, document_id) REFERENCES documents (owner_agent_id, document_id)
|
|
161
|
+
);
|
|
162
|
+
`;
|
|
163
|
+
const CREATE_SNAPSHOTS_SQL = `
|
|
164
|
+
CREATE TABLE IF NOT EXISTS document_snapshots (
|
|
165
|
+
owner_agent_id TEXT NOT NULL,
|
|
166
|
+
document_id TEXT NOT NULL,
|
|
167
|
+
binary BLOB NOT NULL,
|
|
168
|
+
state_vector BLOB NOT NULL,
|
|
169
|
+
last_applied_index INTEGER NOT NULL,
|
|
170
|
+
PRIMARY KEY (owner_agent_id, document_id),
|
|
171
|
+
FOREIGN KEY (owner_agent_id, document_id) REFERENCES documents (owner_agent_id, document_id)
|
|
172
|
+
);
|
|
173
|
+
`;
|
|
174
|
+
export class DocumentStore {
|
|
175
|
+
#db;
|
|
176
|
+
#logger;
|
|
177
|
+
/**
|
|
178
|
+
* The underlying handle, for modules that own their OWN tables alongside this one
|
|
179
|
+
* (DocumentLifecycle). Deliberately not a licence to query this store's tables from outside —
|
|
180
|
+
* every one of them has a method here, and a second query path is a second set of rules about
|
|
181
|
+
* scoping that nobody remembers to keep in step.
|
|
182
|
+
*/
|
|
183
|
+
get rawDb() {
|
|
184
|
+
return this.#db;
|
|
185
|
+
}
|
|
186
|
+
constructor(db, logger) {
|
|
187
|
+
this.#db = db;
|
|
188
|
+
this.#logger = logger;
|
|
189
|
+
this.#db.exec(CREATE_DOCUMENTS_SQL);
|
|
190
|
+
// SYNC-G1 birth-gated column (the consent-migration precedent): a database created before
|
|
191
|
+
// the causal-anchor column exists gains it here, defaulted to the empty frontier — CREATE
|
|
192
|
+
// IF NOT EXISTS cannot add columns, and a client-side migration that fails is unrecoverable
|
|
193
|
+
// on an operator machine, so the ALTER is guarded by the actual table shape.
|
|
194
|
+
const envelopeColumns = this.#db
|
|
195
|
+
.prepare(`PRAGMA table_info(document_envelopes)`)
|
|
196
|
+
.all();
|
|
197
|
+
if (envelopeColumns.length > 0 &&
|
|
198
|
+
!envelopeColumns.some((c) => c.name === "governance_parents")) {
|
|
199
|
+
this.#db.exec(`ALTER TABLE document_envelopes ADD COLUMN governance_parents TEXT NOT NULL DEFAULT '[]'`);
|
|
200
|
+
}
|
|
201
|
+
// M14B / DOD-MP-AMEND-1 — the amendments table this store READS (currentDocumentEpoch);
|
|
202
|
+
// DocumentAmendmentStore owns writes. Shared definition, whichever constructs first wins.
|
|
203
|
+
this.#db.exec(`DROP TABLE IF EXISTS document_amendments`);
|
|
204
|
+
this.#db.exec(DOCUMENT_ENTRIES_CREATE_SQL);
|
|
205
|
+
dropLegacyEpochColumn(this.#db, "document_entries");
|
|
206
|
+
this.#db.exec(CREATE_ENVELOPES_SQL);
|
|
207
|
+
dropLegacyEpochColumn(this.#db, "document_envelopes");
|
|
208
|
+
// SYNC-AC3 residue. P4 deleted the delivery worker and its ledgers but left DELIVERY-1's
|
|
209
|
+
// bookkeeping columns standing on the envelope log — no writer, no reader, and exactly the
|
|
210
|
+
// per-recipient DEBT the pivot exists to abolish ("X still owes Y this envelope"). Dead
|
|
211
|
+
// columns are not harmless here: the next author to see `next_attempt_at` in the schema
|
|
212
|
+
// reasonably concludes retry state belongs on the row and rebuilds the machine. Dropped on
|
|
213
|
+
// open, birth-gated like the epoch column beside it.
|
|
214
|
+
dropLegacyColumns(this.#db, "document_envelopes", [
|
|
215
|
+
"delivered_at", "acked_at", "abandoned_at", "attempts", "next_attempt_at",
|
|
216
|
+
]);
|
|
217
|
+
this.#db.exec(CREATE_QUARANTINE_SQL);
|
|
218
|
+
// SYNC-R35, birth-gated like the epoch drops: a database born earlier lacks the column.
|
|
219
|
+
{
|
|
220
|
+
const cols = this.#db.prepare(`PRAGMA table_info(document_quarantine)`).all();
|
|
221
|
+
if (!cols.some((c) => c.name === "rejection_wire")) {
|
|
222
|
+
this.#db.exec(`ALTER TABLE document_quarantine ADD COLUMN rejection_wire BLOB`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
this.#db.exec(CREATE_REJECTIONS_RECEIVED_SQL);
|
|
226
|
+
// D9 residue sweep (review F5): withdrawals have no reader or writer left.
|
|
227
|
+
this.#db.exec(`DROP TABLE IF EXISTS document_withdrawals`);
|
|
228
|
+
// SYNC-P5 (spec §9): the per-party DISPLAY CACHE — last successful exchange and the
|
|
229
|
+
// position that party last claimed. Non-authoritative by construction: no correctness
|
|
230
|
+
// decision reads it (R44); it exists so `cello_doc_list` can say in_sync|behind|unseen
|
|
231
|
+
// without initiating an exchange per row.
|
|
232
|
+
this.#db.exec(`
|
|
233
|
+
CREATE TABLE IF NOT EXISTS document_party_view (
|
|
234
|
+
owner_agent_id TEXT NOT NULL,
|
|
235
|
+
document_id TEXT NOT NULL,
|
|
236
|
+
party_agent_id TEXT NOT NULL,
|
|
237
|
+
last_exchange_ms INTEGER NOT NULL,
|
|
238
|
+
gov_seqs TEXT NOT NULL,
|
|
239
|
+
content_counts TEXT NOT NULL,
|
|
240
|
+
refused TEXT NOT NULL,
|
|
241
|
+
PRIMARY KEY (owner_agent_id, document_id, party_agent_id)
|
|
242
|
+
);
|
|
243
|
+
`);
|
|
244
|
+
this.#db.exec(CREATE_SNAPSHOTS_SQL);
|
|
245
|
+
// Reading the log in arrival order is the only access pattern that matters.
|
|
246
|
+
this.#db.exec("CREATE INDEX IF NOT EXISTS idx_document_envelopes_order ON document_envelopes (owner_agent_id, document_id, log_index)");
|
|
247
|
+
}
|
|
248
|
+
// ─── documents ────────────────────────────────────────────────────────────
|
|
249
|
+
createDocument(row) {
|
|
250
|
+
this.#db
|
|
251
|
+
.prepare(
|
|
252
|
+
// Scoped to the identity conflict only — a bare OR IGNORE would also swallow the status
|
|
253
|
+
// CHECK, leaving the caller believing a document exists that was never stored, and the
|
|
254
|
+
// failure would surface later as a foreign-key error on the first append.
|
|
255
|
+
`INSERT INTO documents
|
|
256
|
+
(owner_agent_id, document_id, peer_agent_id, document_type, properties, status, created_at)
|
|
257
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
258
|
+
ON CONFLICT (owner_agent_id, document_id) DO NOTHING`)
|
|
259
|
+
.run(row.ownerAgentId, row.documentId, row.peerAgentId, row.documentType, JSON.stringify(row.properties), row.status, row.createdAtMs);
|
|
260
|
+
}
|
|
261
|
+
getDocument(ownerAgentId, documentId) {
|
|
262
|
+
const r = this.#db
|
|
263
|
+
.prepare("SELECT * FROM documents WHERE owner_agent_id = ? AND document_id = ?")
|
|
264
|
+
.get(ownerAgentId, documentId);
|
|
265
|
+
return r ? toDocumentRow(r) : null;
|
|
266
|
+
}
|
|
267
|
+
listDocuments(ownerAgentId) {
|
|
268
|
+
const rows = this.#db
|
|
269
|
+
.prepare("SELECT * FROM documents WHERE owner_agent_id = ? ORDER BY created_at ASC")
|
|
270
|
+
.all(ownerAgentId);
|
|
271
|
+
return rows.map(toDocumentRow);
|
|
272
|
+
}
|
|
273
|
+
setDocumentStatus(ownerAgentId, documentId, status) {
|
|
274
|
+
this.#db
|
|
275
|
+
.prepare("UPDATE documents SET status = ? WHERE owner_agent_id = ? AND document_id = ?")
|
|
276
|
+
.run(status, ownerAgentId, documentId);
|
|
277
|
+
}
|
|
278
|
+
// ─── the append-only envelope log ─────────────────────────────────────────
|
|
279
|
+
/**
|
|
280
|
+
* Append an envelope at the next log position.
|
|
281
|
+
*
|
|
282
|
+
* IMMUTABLE AT A HASH: the conflict clause is scoped to the envelope hash ALONE, so a
|
|
283
|
+
* re-delivery — or a peer replaying the same hash with different bytes — cannot overwrite what
|
|
284
|
+
* was recorded. Returns whether a new row was written, so the caller can tell a genuine append
|
|
285
|
+
* from a duplicate rather than inferring it.
|
|
286
|
+
*
|
|
287
|
+
* Scoped deliberately, not written as a bare `OR IGNORE`: that form suppresses CHECK, UNIQUE
|
|
288
|
+
* and NOT NULL as well, which on an append-only log means a malformed `kind` or a colliding
|
|
289
|
+
* `log_index` would be DROPPED and reported to the caller as an already-seen duplicate. Every
|
|
290
|
+
* constraint except the hash conflict must throw, or `false` means three different things the
|
|
291
|
+
* caller cannot tell apart.
|
|
292
|
+
*/
|
|
293
|
+
appendEnvelope(ownerAgentId, envelope) {
|
|
294
|
+
// The log index is computed INSIDE the insert, not read first and passed in. A read-then-write
|
|
295
|
+
// is safe within one process (this API is synchronous throughout), but two daemons on one DB
|
|
296
|
+
// file — the orphan-process case this repo has hit before — would each read the same MAX and
|
|
297
|
+
// each insert it. A duplicate index makes ORDER BY log_index non-deterministic, and
|
|
298
|
+
// deterministic replay is this log's entire purpose. The UNIQUE constraint is the backstop.
|
|
299
|
+
let info;
|
|
300
|
+
try {
|
|
301
|
+
info = this.#db
|
|
302
|
+
.prepare(`INSERT INTO document_envelopes
|
|
303
|
+
(owner_agent_id, document_id, envelope_hash, sender_agent_id, doc_prev_hash,
|
|
304
|
+
signature, state_vector, payload, governance_parents, kind, references_hash,
|
|
305
|
+
sender_client_id, created_at, log_index)
|
|
306
|
+
SELECT ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
|
307
|
+
COALESCE((SELECT MAX(log_index) + 1 FROM document_envelopes
|
|
308
|
+
WHERE owner_agent_id = ? AND document_id = ?), 0)
|
|
309
|
+
ON CONFLICT (owner_agent_id, document_id, envelope_hash) DO NOTHING`)
|
|
310
|
+
.run(ownerAgentId, envelope.documentId, envelope.envelopeHash, envelope.senderAgentId, envelope.docPrevHash, Buffer.from(envelope.signature), Buffer.from(envelope.stateVector), envelope.payload === null ? null : Buffer.from(envelope.payload), JSON.stringify(envelope.governanceParents ?? []), envelope.kind, envelope.referencesEnvelopeHash ?? null, envelope.senderClientId ?? null, envelope.createdAtMs, ownerAgentId, envelope.documentId);
|
|
311
|
+
}
|
|
312
|
+
catch (err) {
|
|
313
|
+
const message = extractErrorMessage(err);
|
|
314
|
+
// SQLite says "FOREIGN KEY constraint failed" and nothing else — not which document, not
|
|
315
|
+
// which owner, not that a `documents` row is missing. That is the message an operator meets
|
|
316
|
+
// when an envelope arrives before its document exists, so it has to name its own cause.
|
|
317
|
+
if (message.includes("FOREIGN KEY")) {
|
|
318
|
+
throw new Error(`document_envelope_unscoped: no document ${envelope.documentId.slice(0, 16)}… exists for ` +
|
|
319
|
+
`owner ${ownerAgentId.slice(0, 16)}… — create the document before appending to its log`);
|
|
320
|
+
}
|
|
321
|
+
throw err;
|
|
322
|
+
}
|
|
323
|
+
return Number(info.changes) > 0;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Envelopes at or after `fromIndex`, in log order. This is what makes `lastAppliedIndex` the
|
|
327
|
+
* lookup §14 asks for: resume an incremental rebuild at `lastAppliedIndex + 1` without reading
|
|
328
|
+
* the whole log.
|
|
329
|
+
*/
|
|
330
|
+
getEnvelopesSince(ownerAgentId, documentId, fromIndex) {
|
|
331
|
+
const rows = this.#db
|
|
332
|
+
.prepare(`SELECT * FROM document_envelopes
|
|
333
|
+
WHERE owner_agent_id = ? AND document_id = ? AND log_index >= ?
|
|
334
|
+
ORDER BY log_index ASC`)
|
|
335
|
+
.all(ownerAgentId, documentId, fromIndex);
|
|
336
|
+
return rows.map(toEnvelopeRow);
|
|
337
|
+
}
|
|
338
|
+
getEnvelopeLog(ownerAgentId, documentId) {
|
|
339
|
+
const rows = this.#db
|
|
340
|
+
.prepare(`SELECT * FROM document_envelopes
|
|
341
|
+
WHERE owner_agent_id = ? AND document_id = ? ORDER BY log_index ASC`)
|
|
342
|
+
.all(ownerAgentId, documentId);
|
|
343
|
+
return rows.map(toEnvelopeRow);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Verify each sender's `doc_prev_hash` chain independently.
|
|
347
|
+
*
|
|
348
|
+
* The log interleaves both parties' envelopes, so there is no single total order to check —
|
|
349
|
+
* §16.7-5 defines replay set-based per epoch for exactly this reason. What must hold is that
|
|
350
|
+
* every sender's own links form one unbroken chain from a single genesis.
|
|
351
|
+
*
|
|
352
|
+
* A break REFUSES and names the sender and the missing predecessor. Skipping the leaf and
|
|
353
|
+
* carrying on would leave a document that reads as complete while missing operations, which is
|
|
354
|
+
* the silent-divergence failure the chain exists to prevent.
|
|
355
|
+
*
|
|
356
|
+
* LINKAGE ONLY — the name says so deliberately. This verifies no signature and does not check
|
|
357
|
+
* that `envelope_hash` hashes the content; neither is possible here (no key, no encoder). A
|
|
358
|
+
* caller must not read `ok: true` as authenticity — that belongs to the engine.
|
|
359
|
+
*/
|
|
360
|
+
verifyChainLinkage(ownerAgentId, documentId) {
|
|
361
|
+
const log = this.getEnvelopeLog(ownerAgentId, documentId);
|
|
362
|
+
// BRIDGE THE REFUSED ENVELOPES. A refused update's payload is never written to the log — that
|
|
363
|
+
// is what makes the refusal real across a restart — but the peer does not know it was refused
|
|
364
|
+
// when it authors the next envelope, so its supersession chains onto a hash the log does not
|
|
365
|
+
// contain. Without the bridge that reads as `document_chain_broken`, the document refuses to
|
|
366
|
+
// rebuild, and the operator is sent to debug the chain layer for a rejection-protocol event.
|
|
367
|
+
//
|
|
368
|
+
// These stubs exist ONLY for verification. They carry no payload and are never returned by
|
|
369
|
+
// `getEnvelopeLog`, so replay cannot see them and the refused content cannot come back.
|
|
370
|
+
const stubs = this.listQuarantined(ownerAgentId, documentId).map((q) => ({
|
|
371
|
+
envelopeHash: q.rejectedEnvelopeHash,
|
|
372
|
+
documentId: q.documentId,
|
|
373
|
+
senderAgentId: q.rejectedSenderAgentId,
|
|
374
|
+
docPrevHash: q.rejectedDocPrevHash,
|
|
375
|
+
governanceParents: [],
|
|
376
|
+
// EXEMPT from current-epoch stamping (M14B Entry 5): a stub is a SYNTHETIC verification
|
|
377
|
+
// node — never on the wire, never replayed — and the chain walk checks hash linkage only.
|
|
378
|
+
signature: new Uint8Array(0),
|
|
379
|
+
stateVector: new Uint8Array(0),
|
|
380
|
+
payload: null,
|
|
381
|
+
kind: "rejection",
|
|
382
|
+
referencesEnvelopeHash: null,
|
|
383
|
+
createdAtMs: q.createdAtMs,
|
|
384
|
+
}));
|
|
385
|
+
// One refused envelope can carry several quarantine rows (one per retry round), and the chain
|
|
386
|
+
// has exactly one node for it.
|
|
387
|
+
const seenStub = new Set();
|
|
388
|
+
const bySender = new Map();
|
|
389
|
+
for (const stub of stubs) {
|
|
390
|
+
if (seenStub.has(stub.envelopeHash))
|
|
391
|
+
continue;
|
|
392
|
+
seenStub.add(stub.envelopeHash);
|
|
393
|
+
const list = bySender.get(stub.senderAgentId);
|
|
394
|
+
if (list)
|
|
395
|
+
list.push(stub);
|
|
396
|
+
else
|
|
397
|
+
bySender.set(stub.senderAgentId, [stub]);
|
|
398
|
+
}
|
|
399
|
+
for (const e of log) {
|
|
400
|
+
const list = bySender.get(e.senderAgentId);
|
|
401
|
+
if (list)
|
|
402
|
+
list.push(e);
|
|
403
|
+
else
|
|
404
|
+
bySender.set(e.senderAgentId, [e]);
|
|
405
|
+
}
|
|
406
|
+
for (const [sender, envelopes] of bySender) {
|
|
407
|
+
const present = new Set(envelopes.map((e) => e.envelopeHash));
|
|
408
|
+
const genesis = envelopes.filter((e) => e.docPrevHash === null);
|
|
409
|
+
if (genesis.length !== 1) {
|
|
410
|
+
return {
|
|
411
|
+
ok: false,
|
|
412
|
+
reason: "document_chain_forked",
|
|
413
|
+
detail: `sender ${sender.slice(0, 16)}… has ${genesis.length} genesis envelopes for document ` +
|
|
414
|
+
`${documentId.slice(0, 16)}… — a chain has exactly one`,
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
// Every link must resolve. Checked first so a missing predecessor reports as BROKEN rather
|
|
418
|
+
// than as the unreachability it would also cause.
|
|
419
|
+
for (const e of envelopes) {
|
|
420
|
+
if (e.docPrevHash !== null && !present.has(e.docPrevHash)) {
|
|
421
|
+
return {
|
|
422
|
+
ok: false,
|
|
423
|
+
reason: "document_chain_broken",
|
|
424
|
+
detail: `sender ${sender.slice(0, 16)}… envelope ${e.envelopeHash.slice(0, 16)}… links to ` +
|
|
425
|
+
`${e.docPrevHash.slice(0, 16)}…, which is absent from the log and is not among this ` +
|
|
426
|
+
`document's refused envelopes either — so this is a gap in the chain itself, not a ` +
|
|
427
|
+
`rejection`,
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
// REACHABILITY, not structural heuristics. Walk forward from the one genesis and require
|
|
432
|
+
// the walk to cover every envelope this sender authored. That single check subsumes the
|
|
433
|
+
// duplicate-genesis case, the duplicate-predecessor fork, AND every cycle shape — including
|
|
434
|
+
// a disjoint cycle sitting alongside a perfectly good genesis chain, which counting roots
|
|
435
|
+
// and predecessors cannot see. `doc_prev_hash` is peer-controlled, so this is a hostile
|
|
436
|
+
// input path and the verifier is the only thing between a crafted log and a persisted
|
|
437
|
+
// snapshot.
|
|
438
|
+
const childOf = new Map();
|
|
439
|
+
for (const e of envelopes) {
|
|
440
|
+
if (e.docPrevHash === null)
|
|
441
|
+
continue;
|
|
442
|
+
const siblings = childOf.get(e.docPrevHash);
|
|
443
|
+
if (siblings)
|
|
444
|
+
siblings.push(e);
|
|
445
|
+
else
|
|
446
|
+
childOf.set(e.docPrevHash, [e]);
|
|
447
|
+
}
|
|
448
|
+
const reached = new Set();
|
|
449
|
+
let cursor = genesis[0];
|
|
450
|
+
while (cursor) {
|
|
451
|
+
if (reached.has(cursor.envelopeHash))
|
|
452
|
+
break; // defensive; a cycle cannot include genesis
|
|
453
|
+
reached.add(cursor.envelopeHash);
|
|
454
|
+
const children = childOf.get(cursor.envelopeHash) ?? [];
|
|
455
|
+
if (children.length > 1) {
|
|
456
|
+
return {
|
|
457
|
+
ok: false,
|
|
458
|
+
reason: "document_chain_forked",
|
|
459
|
+
detail: `sender ${sender.slice(0, 16)}… has ${children.length} envelopes claiming predecessor ` +
|
|
460
|
+
`${cursor.envelopeHash.slice(0, 16)}… — a chain branches nowhere`,
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
cursor = children[0];
|
|
464
|
+
}
|
|
465
|
+
if (reached.size !== envelopes.length) {
|
|
466
|
+
return {
|
|
467
|
+
ok: false,
|
|
468
|
+
reason: "document_chain_forked",
|
|
469
|
+
detail: `sender ${sender.slice(0, 16)}… has ${envelopes.length - reached.size} envelopes ` +
|
|
470
|
+
`unreachable from its genesis for document ${documentId.slice(0, 16)}… — a detached ` +
|
|
471
|
+
`cycle or branch, not a chain`,
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
return { ok: true };
|
|
476
|
+
}
|
|
477
|
+
// ─── quarantine (held, never discarded) ───────────────────────────────────
|
|
478
|
+
/**
|
|
479
|
+
* Hold a refused update's bytes. Idempotent per REJECTION (per 0x05 leaf), not per refused
|
|
480
|
+
* envelope — one envelope may be refused across several retry rounds and each round's reason,
|
|
481
|
+
* rule and limit are distinct facts an operator needs.
|
|
482
|
+
*
|
|
483
|
+
* Returns whether a row was written, so a caller never has to infer it. The previous signature
|
|
484
|
+
* returned void and the conflict clause silently dropped every round after the first.
|
|
485
|
+
*/
|
|
486
|
+
holdQuarantined(ownerAgentId, row) {
|
|
487
|
+
const info = this.#db
|
|
488
|
+
.prepare(`INSERT INTO document_quarantine
|
|
489
|
+
(owner_agent_id, document_id, rejection_envelope_hash, rejected_envelope_hash,
|
|
490
|
+
rejected_sender_agent_id, rejected_doc_prev_hash, payload, reason, detail,
|
|
491
|
+
rule, limit_name, limit_value, limit_actual, rejection_wire, created_at)
|
|
492
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
493
|
+
ON CONFLICT (owner_agent_id, document_id, rejection_envelope_hash) DO NOTHING`)
|
|
494
|
+
.run(ownerAgentId, row.documentId, row.rejectionEnvelopeHash, row.rejectedEnvelopeHash, row.rejectedSenderAgentId, row.rejectedDocPrevHash, Buffer.from(row.payload), row.reason, row.detail ?? null, row.rule ?? null, row.limitName ?? null, row.limitValue ?? null, row.limitActual ?? null, row.rejectionWire ? Buffer.from(row.rejectionWire) : null, row.createdAtMs);
|
|
495
|
+
return Number(info.changes) > 0;
|
|
496
|
+
}
|
|
497
|
+
listQuarantined(ownerAgentId, documentId) {
|
|
498
|
+
const rows = this.#db
|
|
499
|
+
.prepare(
|
|
500
|
+
// rowid breaks the tie. Several rounds can land inside one millisecond, and `created_at`
|
|
501
|
+
// alone then leaves the order to SQLite — which is what an operator is shown as "the most
|
|
502
|
+
// recent reason". Insertion order is the real answer and rowid is it.
|
|
503
|
+
`SELECT * FROM document_quarantine
|
|
504
|
+
WHERE owner_agent_id = ? AND document_id = ?
|
|
505
|
+
ORDER BY created_at ASC, rowid ASC`)
|
|
506
|
+
.all(ownerAgentId, documentId);
|
|
507
|
+
return rows.map((r) => ({
|
|
508
|
+
documentId: r["document_id"],
|
|
509
|
+
rejectionEnvelopeHash: r["rejection_envelope_hash"],
|
|
510
|
+
rejectedEnvelopeHash: r["rejected_envelope_hash"],
|
|
511
|
+
rejectedSenderAgentId: r["rejected_sender_agent_id"],
|
|
512
|
+
rejectedDocPrevHash: r["rejected_doc_prev_hash"] ?? null,
|
|
513
|
+
payload: toU8(r["payload"]),
|
|
514
|
+
reason: r["reason"],
|
|
515
|
+
detail: r["detail"] ?? undefined,
|
|
516
|
+
rule: r["rule"] ?? undefined,
|
|
517
|
+
limitName: r["limit_name"] ?? undefined,
|
|
518
|
+
limitValue: r["limit_value"] ?? undefined,
|
|
519
|
+
limitActual: r["limit_actual"] ?? undefined,
|
|
520
|
+
rejectionWire: r["rejection_wire"] == null ? undefined : toU8(r["rejection_wire"]),
|
|
521
|
+
createdAtMs: r["created_at"],
|
|
522
|
+
}));
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Release every entry for a refused envelope once its superseding update has been admitted.
|
|
526
|
+
* Returns whether anything was released. Keyed by the REFUSED envelope rather than the rejection
|
|
527
|
+
* leaf, because admitting the supersession resolves all of that envelope's rounds at once.
|
|
528
|
+
*/
|
|
529
|
+
releaseQuarantined(ownerAgentId, documentId, rejectedEnvelopeHash) {
|
|
530
|
+
const info = this.#db
|
|
531
|
+
.prepare(`DELETE FROM document_quarantine
|
|
532
|
+
WHERE owner_agent_id = ? AND document_id = ? AND rejected_envelope_hash = ?`)
|
|
533
|
+
.run(ownerAgentId, documentId, rejectedEnvelopeHash);
|
|
534
|
+
return Number(info.changes) > 0;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Every envelope hash we hold from one sender. Hash-only on purpose: the caller needs a set for a
|
|
538
|
+
* membership test, and `getEnvelopeLog` selects `*` — including every payload BLOB — so building
|
|
539
|
+
* that set from it materialized the whole document's content on every inbound update.
|
|
540
|
+
*/
|
|
541
|
+
knownEnvelopeHashesBySender(ownerAgentId, documentId, senderAgentId) {
|
|
542
|
+
const rows = this.#db
|
|
543
|
+
.prepare(
|
|
544
|
+
// THE QUARANTINE COUNTS AS KNOWN, and it has to.
|
|
545
|
+
//
|
|
546
|
+
// A refused envelope is deliberately never written to `document_envelopes` — that is the
|
|
547
|
+
// point of refusing it. But the sender's chain does not rewind: their next envelope links
|
|
548
|
+
// to the one we refused. Without the second half of this union that link resolves to
|
|
549
|
+
// nothing and the supersession is rejected as `document_chain_broken` — so ONE gate refusal
|
|
550
|
+
// permanently broke the document, and the supersede-then-converge protocol §3.2 describes
|
|
551
|
+
// could never run at all. Measured live.
|
|
552
|
+
//
|
|
553
|
+
// The bridge was already designed for exactly this: the quarantine records the refused
|
|
554
|
+
// envelope's own author and prev-hash so a later link can span it. It had only ever been
|
|
555
|
+
// applied to `verifyChainLinkage`, the LOCAL replay check — never to inbound admission,
|
|
556
|
+
// which is the path a peer's supersession actually arrives on.
|
|
557
|
+
//
|
|
558
|
+
// Scoped by the refused envelope's own sender, so one peer's quarantine can never make
|
|
559
|
+
// another peer's broken chain resolve.
|
|
560
|
+
`SELECT envelope_hash FROM document_envelopes
|
|
561
|
+
WHERE owner_agent_id = ? AND document_id = ? AND sender_agent_id = ?
|
|
562
|
+
UNION ALL
|
|
563
|
+
SELECT rejected_envelope_hash AS envelope_hash FROM document_quarantine
|
|
564
|
+
WHERE owner_agent_id = ? AND document_id = ? AND rejected_sender_agent_id = ?`)
|
|
565
|
+
.all(ownerAgentId, documentId, senderAgentId, ownerAgentId, documentId, senderAgentId);
|
|
566
|
+
return new Set(rows.map((r) => r.envelope_hash));
|
|
567
|
+
}
|
|
568
|
+
/** The clientIDs one sender has signed for on this document. Also hash-free — see above. */
|
|
569
|
+
senderClientIdsFor(ownerAgentId, documentId, senderAgentId) {
|
|
570
|
+
const rows = this.#db
|
|
571
|
+
.prepare(`SELECT DISTINCT sender_client_id FROM document_envelopes
|
|
572
|
+
WHERE owner_agent_id = ? AND document_id = ? AND sender_agent_id = ?
|
|
573
|
+
AND sender_client_id IS NOT NULL`)
|
|
574
|
+
.all(ownerAgentId, documentId, senderAgentId);
|
|
575
|
+
return rows.map((r) => r.sender_client_id);
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* The state vector the PEER last told us they had — from their most recent envelope.
|
|
579
|
+
*
|
|
580
|
+
* This is what a publish diffs against (§3.2 step 3, §7): an update computed against what they
|
|
581
|
+
* have already seen carries exactly the operations they lack. Diffing against OUR OWN snapshot
|
|
582
|
+
* instead publishes what we have not yet snapshotted, which is a different question with an
|
|
583
|
+
* answer that happens to look plausible.
|
|
584
|
+
*/
|
|
585
|
+
peerStateVector(ownerAgentId, documentId, peerAgentId) {
|
|
586
|
+
const r = this.#db
|
|
587
|
+
.prepare(`SELECT state_vector FROM document_envelopes
|
|
588
|
+
WHERE owner_agent_id = ? AND document_id = ? AND sender_agent_id = ? AND kind = 'update'
|
|
589
|
+
ORDER BY log_index DESC LIMIT 1`)
|
|
590
|
+
.get(ownerAgentId, documentId, peerAgentId);
|
|
591
|
+
return r?.state_vector === undefined ? null : toU8(r.state_vector);
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* The state vector OUR last published envelope carried — what we had when we last spoke.
|
|
595
|
+
*
|
|
596
|
+
* Distinct from `peerStateVector`, and the distinction is the point: that one answers "what does
|
|
597
|
+
* the peer lack" (what to send), this one answers "has anything changed since I last published"
|
|
598
|
+
* (whether to send at all). Conflating them meant a republish with no edits still produced a
|
|
599
|
+
* non-empty update, because before the peer has ever published the diff is the whole document.
|
|
600
|
+
*/
|
|
601
|
+
lastPublishedStateVector(ownerAgentId, documentId, senderAgentId) {
|
|
602
|
+
const r = this.#db
|
|
603
|
+
.prepare(`SELECT state_vector FROM document_envelopes
|
|
604
|
+
WHERE owner_agent_id = ? AND document_id = ? AND sender_agent_id = ? AND kind = 'update'
|
|
605
|
+
ORDER BY log_index DESC LIMIT 1`)
|
|
606
|
+
.get(ownerAgentId, documentId, senderAgentId);
|
|
607
|
+
return r?.state_vector === undefined ? null : toU8(r.state_vector);
|
|
608
|
+
}
|
|
609
|
+
/** The rejecting agent's most recent envelope for this document, for chain linkage. */
|
|
610
|
+
/**
|
|
611
|
+
* The head of a sender's chain AS WE SEE IT — including envelopes we REFUSED.
|
|
612
|
+
*
|
|
613
|
+
* A refused envelope is never written to `document_envelopes`, but the sender's chain does not
|
|
614
|
+
* rewind: their supersession links to the envelope we just refused. Taking the head from the log
|
|
615
|
+
* alone meant that link never matched, so the supersession was refused as `document_chain_broken`
|
|
616
|
+
* — and so was everything after it, forever. Measured against two real daemons: the gate fired
|
|
617
|
+
* ONCE and the next three envelopes never reached it, so the retry round stuck at 1 and the
|
|
618
|
+
* document could never reach the stall the protocol defines.
|
|
619
|
+
*
|
|
620
|
+
* That is the bridge the quarantine was built for — it stores the refused envelope's own author
|
|
621
|
+
* and prev-hash saying exactly this — and it had only ever been applied to `verifyChainLinkage`,
|
|
622
|
+
* the local replay check. An earlier attempt added the quarantine to the KNOWN-hash set, which
|
|
623
|
+
* was not enough and is worth recording: `known` answers "have I seen this before" (duplicate
|
|
624
|
+
* detection), while the forward link is checked against the HEAD. Bridging the wrong one looks
|
|
625
|
+
* right and changes nothing.
|
|
626
|
+
*
|
|
627
|
+
* `log_index` and the quarantine's `created_at` are different clocks, so they are not merged into
|
|
628
|
+
* one ORDER BY. Whichever is newer by arrival is the head: a refusal always happens after the
|
|
629
|
+
* envelope it refuses, so a quarantine row newer than the last admitted envelope IS the head.
|
|
630
|
+
*/
|
|
631
|
+
lastEnvelopeHashBySender(ownerAgentId, documentId, senderAgentId) {
|
|
632
|
+
const admitted = this.#db
|
|
633
|
+
.prepare(`SELECT envelope_hash, created_at FROM document_envelopes
|
|
634
|
+
WHERE owner_agent_id = ? AND document_id = ? AND sender_agent_id = ?
|
|
635
|
+
ORDER BY log_index DESC LIMIT 1`)
|
|
636
|
+
.get(ownerAgentId, documentId, senderAgentId);
|
|
637
|
+
const refused = this.#db
|
|
638
|
+
.prepare(`SELECT rejected_envelope_hash AS envelope_hash, created_at FROM document_quarantine
|
|
639
|
+
WHERE owner_agent_id = ? AND document_id = ? AND rejected_sender_agent_id = ?
|
|
640
|
+
ORDER BY created_at DESC LIMIT 1`)
|
|
641
|
+
.get(ownerAgentId, documentId, senderAgentId);
|
|
642
|
+
if (!refused?.envelope_hash)
|
|
643
|
+
return admitted?.envelope_hash ?? null;
|
|
644
|
+
if (!admitted?.envelope_hash)
|
|
645
|
+
return refused.envelope_hash;
|
|
646
|
+
return (refused.created_at ?? 0) >= (admitted.created_at ?? 0)
|
|
647
|
+
? refused.envelope_hash
|
|
648
|
+
: admitted.envelope_hash;
|
|
649
|
+
}
|
|
650
|
+
// ─── delivery (DELIVERY-1) ────────────────────────────────────────────────
|
|
651
|
+
/**
|
|
652
|
+
* Envelopes this agent authored that the peer has not acknowledged, and whose next attempt is
|
|
653
|
+
* due. DERIVED — there is no queue. Survives a restart because the log does.
|
|
654
|
+
*
|
|
655
|
+
* Scoped to `senderAgentId = ownerAgentId`: an envelope we RECEIVED is not ours to deliver, and
|
|
656
|
+
* without the scope a receiver would helpfully re-send the sender's own updates back at it.
|
|
657
|
+
*/
|
|
658
|
+
/**
|
|
659
|
+
* The document's CURRENT epoch: the head of its recorded amendment chain, 0 at genesis.
|
|
660
|
+
* Trustworthy for stamping because every append site rules on admissibility before
|
|
661
|
+
* recording — a row in document_amendments is post-validation by invariant (M14B Entry 5).
|
|
662
|
+
*/
|
|
663
|
+
/** SYNC-P5 (review F6) — per-sender envelope counts without hauling payload blobs. */
|
|
664
|
+
envelopeCountsBySender(ownerAgentId, documentId) {
|
|
665
|
+
const rows = this.#db
|
|
666
|
+
.prepare(`SELECT sender_agent_id, COUNT(*) AS n FROM document_envelopes
|
|
667
|
+
WHERE owner_agent_id = ? AND document_id = ?
|
|
668
|
+
GROUP BY sender_agent_id`)
|
|
669
|
+
.all(ownerAgentId, documentId);
|
|
670
|
+
return new Map(rows.map((r) => [r.sender_agent_id, r.n]));
|
|
671
|
+
}
|
|
672
|
+
/** SYNC-P5 — record what a party's exchange just showed us (display cache; see the table). */
|
|
673
|
+
recordPartyView(ownerAgentId, documentId, partyAgentId, view, nowMs) {
|
|
674
|
+
this.#db
|
|
675
|
+
.prepare(`INSERT INTO document_party_view
|
|
676
|
+
(owner_agent_id, document_id, party_agent_id, last_exchange_ms, gov_seqs,
|
|
677
|
+
content_counts, refused)
|
|
678
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
679
|
+
ON CONFLICT (owner_agent_id, document_id, party_agent_id) DO UPDATE SET
|
|
680
|
+
last_exchange_ms = excluded.last_exchange_ms,
|
|
681
|
+
gov_seqs = excluded.gov_seqs,
|
|
682
|
+
content_counts = excluded.content_counts,
|
|
683
|
+
refused = excluded.refused`)
|
|
684
|
+
.run(ownerAgentId, documentId, partyAgentId, nowMs, JSON.stringify(view.govSeqs), JSON.stringify(view.contentCounts), JSON.stringify(view.refused));
|
|
685
|
+
}
|
|
686
|
+
partyView(ownerAgentId, documentId, partyAgentId) {
|
|
687
|
+
const r = this.#db
|
|
688
|
+
.prepare(`SELECT last_exchange_ms, gov_seqs, content_counts, refused FROM document_party_view
|
|
689
|
+
WHERE owner_agent_id = ? AND document_id = ? AND party_agent_id = ?`)
|
|
690
|
+
.get(ownerAgentId, documentId, partyAgentId);
|
|
691
|
+
if (!r)
|
|
692
|
+
return null;
|
|
693
|
+
return {
|
|
694
|
+
lastExchangeMs: r.last_exchange_ms,
|
|
695
|
+
govSeqs: JSON.parse(r.gov_seqs),
|
|
696
|
+
contentCounts: JSON.parse(r.content_counts),
|
|
697
|
+
refused: JSON.parse(r.refused),
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
/** Record a rejection the PEER sent us. Returns whether a row was written (idempotent by leaf). */
|
|
701
|
+
recordRejectionReceived(ownerAgentId, row) {
|
|
702
|
+
const info = this.#db
|
|
703
|
+
.prepare(`INSERT INTO document_rejections_received
|
|
704
|
+
(owner_agent_id, document_id, rejection_envelope_hash, rejected_envelope_hash,
|
|
705
|
+
from_agent_id, reason, detail, created_at)
|
|
706
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
707
|
+
ON CONFLICT (owner_agent_id, document_id, rejection_envelope_hash) DO NOTHING`)
|
|
708
|
+
.run(ownerAgentId, row.documentId, row.rejectionEnvelopeHash, row.rejectedEnvelopeHash, row.fromAgentId, row.reason, row.detail ?? null, row.createdAtMs);
|
|
709
|
+
return Number(info.changes) > 0;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* DOD-DOC-SCREEN-1 (§16.7-16) — SENDER ADOPTS THE RECEIVER'S RULE.
|
|
713
|
+
*
|
|
714
|
+
* The codepoints this peer has actually refused for this document, learned from their own signed
|
|
715
|
+
* refusals rather than assumed. Rules compose toward STRICT: once they have said no to a
|
|
716
|
+
* character, we stop emitting it, so the same refusal cannot be spent twice — and three refusals
|
|
717
|
+
* stall the document, which makes every avoidable one expensive.
|
|
718
|
+
*
|
|
719
|
+
* Scoped to (owner, document), never global. A rule adopted for one document must not silently
|
|
720
|
+
* narrow what an operator may write everywhere else — the peer refused it HERE, under the profile
|
|
721
|
+
* agreed HERE, and another peer may accept it happily.
|
|
722
|
+
*
|
|
723
|
+
* Stored as the refusal's own machine-readable codepoints, which is why the refusal was made
|
|
724
|
+
* machine-readable in the first place: prose cannot be adopted.
|
|
725
|
+
*/
|
|
726
|
+
adoptedRefusedCodepoints(ownerAgentId, documentId) {
|
|
727
|
+
const rows = this.#db
|
|
728
|
+
.prepare(`SELECT detail FROM document_rejections_received
|
|
729
|
+
WHERE owner_agent_id = ? AND document_id = ? AND detail IS NOT NULL`)
|
|
730
|
+
.all(ownerAgentId, documentId);
|
|
731
|
+
const out = new Set();
|
|
732
|
+
for (const r of rows) {
|
|
733
|
+
if (typeof r.detail !== "string")
|
|
734
|
+
continue;
|
|
735
|
+
try {
|
|
736
|
+
const parsed = JSON.parse(r.detail);
|
|
737
|
+
// ONLY the structured form. A refusal whose detail is prose carries no rule to adopt, and
|
|
738
|
+
// guessing one out of English is how a sender ends up refusing text nobody objected to.
|
|
739
|
+
if (Array.isArray(parsed.codepoints)) {
|
|
740
|
+
for (const c of parsed.codepoints)
|
|
741
|
+
if (typeof c === "string")
|
|
742
|
+
out.add(c);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
catch {
|
|
746
|
+
/* prose detail — nothing to adopt, and that is not an error */
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
return out;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* How many ROUNDS this document has been through — DISTINCT refused envelopes, not rows.
|
|
753
|
+
*
|
|
754
|
+
* ONE REFUSED ENVELOPE IS ONE ROUND, however many times the refusal is announced. A peer's refusal
|
|
755
|
+
* arrives TWICE by design: once as the signed `document_rejection` frame, and once as the ack that
|
|
756
|
+
* settles the delivery (`admitted: false`). Both are recorded — correctly, they are two real
|
|
757
|
+
* events — but the table is keyed on the ANNOUNCEMENT's hash, so the two land as separate rows.
|
|
758
|
+
*
|
|
759
|
+
* Counting rows therefore advanced the round by two per refusal, and `MAX_REJECTED_ROUNDS` is 3 —
|
|
760
|
+
* so a document stalled after TWO refusals instead of three, cutting the supersede-and-retry
|
|
761
|
+
* budget the protocol grants an operator by a third. Measured: the stall enforcer's sender was
|
|
762
|
+
* refused at attempt 2 with `document_stalled`.
|
|
763
|
+
*
|
|
764
|
+
* Counted rather than deduplicated on write, deliberately. Both announcements genuinely happened
|
|
765
|
+
* and the audit record should say so; what was wrong is the arithmetic built on top of it. And a
|
|
766
|
+
* UNIQUE index on the refused hash would fail to create on any database that already holds the
|
|
767
|
+
* duplicate rows this fix is about.
|
|
768
|
+
*
|
|
769
|
+
* Same principle as `ackRecordHash` one layer down — that one collapsed repeated ACKS of one
|
|
770
|
+
* envelope; this collapses the two KINDS of announcement of one refusal.
|
|
771
|
+
*/
|
|
772
|
+
countRejectionsReceived(ownerAgentId, documentId) {
|
|
773
|
+
const r = this.#db
|
|
774
|
+
.prepare(`SELECT COUNT(DISTINCT rejected_envelope_hash) AS n FROM document_rejections_received
|
|
775
|
+
WHERE owner_agent_id = ? AND document_id = ?`)
|
|
776
|
+
.get(ownerAgentId, documentId);
|
|
777
|
+
return r?.n ?? 0;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Was a rejection received for THIS envelope? Envelope-scoped on purpose: the document-scoped
|
|
781
|
+
* reader below answers a different question, and using it to decide whether one envelope was
|
|
782
|
+
* refused makes a rejection of any OTHER envelope in the document look like a rejection of this
|
|
783
|
+
* one.
|
|
784
|
+
*/
|
|
785
|
+
rejectionReceivedFor(ownerAgentId, documentId, envelopeHash) {
|
|
786
|
+
const r = this.#db
|
|
787
|
+
.prepare(`SELECT 1 AS present FROM document_rejections_received
|
|
788
|
+
WHERE owner_agent_id = ? AND document_id = ? AND rejected_envelope_hash = ? LIMIT 1`)
|
|
789
|
+
.get(ownerAgentId, documentId, envelopeHash);
|
|
790
|
+
return r?.present === 1;
|
|
791
|
+
}
|
|
792
|
+
/** The most recently received rejection, for the reason an operator is shown on a stall. */
|
|
793
|
+
latestRejectionReceived(ownerAgentId, documentId) {
|
|
794
|
+
const r = this.#db
|
|
795
|
+
.prepare(`SELECT reason, detail, from_agent_id FROM document_rejections_received
|
|
796
|
+
WHERE owner_agent_id = ? AND document_id = ? ORDER BY created_at DESC, rowid DESC LIMIT 1`)
|
|
797
|
+
.get(ownerAgentId, documentId);
|
|
798
|
+
if (!r)
|
|
799
|
+
return null;
|
|
800
|
+
return {
|
|
801
|
+
reason: r["reason"],
|
|
802
|
+
detail: r["detail"] ?? undefined,
|
|
803
|
+
fromAgentId: r["from_agent_id"],
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* How many rejection records this document carries, PER REJECTING AGENT — the retry round.
|
|
808
|
+
*
|
|
809
|
+
* Scoped by author, because a mutual exchange puts both directions' 0x05 leaves in one document
|
|
810
|
+
* log. Counting across senders conflated them, so two peers each rejecting once read as round 2
|
|
811
|
+
* and the document stalled at half the intended rounds.
|
|
812
|
+
*/
|
|
813
|
+
countRejections(ownerAgentId, documentId, rejectingAgentId) {
|
|
814
|
+
const r = this.#db
|
|
815
|
+
.prepare(`SELECT COUNT(*) AS n FROM document_envelopes
|
|
816
|
+
WHERE owner_agent_id = ? AND document_id = ? AND kind = 'rejection'
|
|
817
|
+
AND sender_agent_id = ?`)
|
|
818
|
+
.get(ownerAgentId, documentId, rejectingAgentId);
|
|
819
|
+
return r?.n ?? 0;
|
|
820
|
+
}
|
|
821
|
+
// ─── the snapshot (disposable) ────────────────────────────────────────────
|
|
822
|
+
getSnapshot(ownerAgentId, documentId) {
|
|
823
|
+
const r = this.#db
|
|
824
|
+
.prepare("SELECT * FROM document_snapshots WHERE owner_agent_id = ? AND document_id = ?")
|
|
825
|
+
.get(ownerAgentId, documentId);
|
|
826
|
+
if (!r)
|
|
827
|
+
return null;
|
|
828
|
+
return {
|
|
829
|
+
binary: toU8(r["binary"]),
|
|
830
|
+
stateVector: toU8(r["state_vector"]),
|
|
831
|
+
lastAppliedIndex: r["last_applied_index"],
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
/** REPLACES — a snapshot is a cache of the log, not a second log. */
|
|
835
|
+
putSnapshot(ownerAgentId, documentId, snapshot) {
|
|
836
|
+
this.#db
|
|
837
|
+
.prepare(`INSERT OR REPLACE INTO document_snapshots
|
|
838
|
+
(owner_agent_id, document_id, binary, state_vector, last_applied_index)
|
|
839
|
+
VALUES (?, ?, ?, ?, ?)`)
|
|
840
|
+
.run(ownerAgentId, documentId, Buffer.from(snapshot.binary), Buffer.from(snapshot.stateVector), snapshot.lastAppliedIndex);
|
|
841
|
+
}
|
|
842
|
+
deleteSnapshot(ownerAgentId, documentId) {
|
|
843
|
+
this.#db
|
|
844
|
+
.prepare("DELETE FROM document_snapshots WHERE owner_agent_id = ? AND document_id = ?")
|
|
845
|
+
.run(ownerAgentId, documentId);
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Rebuild a snapshot from the envelope log alone, using the caller's replay function.
|
|
849
|
+
*
|
|
850
|
+
* Payload-stripped envelopes (purged, or withdrawal/rejection records that carry none)
|
|
851
|
+
* contribute nothing to replay but STILL COUNT toward `lastAppliedIndex` — otherwise the next
|
|
852
|
+
* incremental rebuild would start behind them and replay them forever.
|
|
853
|
+
*/
|
|
854
|
+
rebuildSnapshot(ownerAgentId, documentId, replay) {
|
|
855
|
+
// VERIFY BEFORE REPLAY. Rebuilding over an unverified chain is the exact silent divergence
|
|
856
|
+
// the chain exists to prevent: a log with a missing predecessor folds into a state that is
|
|
857
|
+
// quietly short of operations, and putSnapshot would then persist it as authoritative.
|
|
858
|
+
// Refusing is loud; a short document is not.
|
|
859
|
+
const verdict = this.verifyChainLinkage(ownerAgentId, documentId);
|
|
860
|
+
if (!verdict.ok) {
|
|
861
|
+
this.#logger.warn("document.chain.broken", {
|
|
862
|
+
documentId,
|
|
863
|
+
reason: verdict.reason,
|
|
864
|
+
detail: verdict.detail,
|
|
865
|
+
});
|
|
866
|
+
throw new DocumentChainError(verdict.reason, verdict.detail);
|
|
867
|
+
}
|
|
868
|
+
const log = this.getEnvelopeLog(ownerAgentId, documentId);
|
|
869
|
+
// The WHOLE log, in order — including withdrawal and rejection records, which carry no
|
|
870
|
+
// payload. The engine needs those rows to tell an expected payload-free AUDIT record from a
|
|
871
|
+
// PURGED update whose bytes are gone; filtering here would hide that distinction and make the
|
|
872
|
+
// row-shaped signature pointless. The store decides ORDER; the engine decides WHAT COUNTS.
|
|
873
|
+
const { binary, stateVector } = replay(log);
|
|
874
|
+
this.#logger.info("document.snapshot.rebuilt", {
|
|
875
|
+
documentId,
|
|
876
|
+
envelopes: log.length,
|
|
877
|
+
withPayload: log.filter((e) => e.payload !== null).length,
|
|
878
|
+
});
|
|
879
|
+
// The LAST ROW'S log_index, not the array length. They coincide only while indices are dense,
|
|
880
|
+
// which is an accident of how they are assigned rather than a guarantee.
|
|
881
|
+
return { binary, stateVector, lastAppliedIndex: log.at(-1)?.logIndex ?? -1 };
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function toDocumentRow(r) {
|
|
885
|
+
return {
|
|
886
|
+
documentId: r["document_id"],
|
|
887
|
+
ownerAgentId: r["owner_agent_id"],
|
|
888
|
+
peerAgentId: r["peer_agent_id"],
|
|
889
|
+
documentType: r["document_type"],
|
|
890
|
+
properties: JSON.parse(r["properties"]),
|
|
891
|
+
status: r["status"],
|
|
892
|
+
createdAtMs: r["created_at"],
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
function toEnvelopeRow(r) {
|
|
896
|
+
const payload = r["payload"];
|
|
897
|
+
return {
|
|
898
|
+
envelopeHash: r["envelope_hash"],
|
|
899
|
+
documentId: r["document_id"],
|
|
900
|
+
senderAgentId: r["sender_agent_id"],
|
|
901
|
+
docPrevHash: r["doc_prev_hash"] ?? null,
|
|
902
|
+
signature: toU8(r["signature"]),
|
|
903
|
+
stateVector: toU8(r["state_vector"]),
|
|
904
|
+
payload: payload === null || payload === undefined ? null : toU8(payload),
|
|
905
|
+
governanceParents: JSON.parse(r["governance_parents"] ?? "[]"),
|
|
906
|
+
kind: r["kind"],
|
|
907
|
+
senderClientId: r["sender_client_id"] ?? null,
|
|
908
|
+
referencesEnvelopeHash: r["references_hash"] ?? null,
|
|
909
|
+
createdAtMs: r["created_at"],
|
|
910
|
+
logIndex: r["log_index"],
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Normalize a SQLite BLOB (Buffer / Uint8Array / ArrayBuffer) to a Uint8Array.
|
|
915
|
+
*
|
|
916
|
+
* REFUSES anything else rather than substituting an empty array. This is the read path for
|
|
917
|
+
* `signature`, `state_vector` and `payload`: returning `new Uint8Array()` for an unexpected type
|
|
918
|
+
* would hand back a ZERO-LENGTH SIGNATURE as if it were the stored one, and the failure would
|
|
919
|
+
* surface downstream as "signature invalid" — sending an operator to the crypto layer for what
|
|
920
|
+
* is a storage-read defect. Nothing legitimate reaches this branch; `null` is handled by callers.
|
|
921
|
+
*/
|
|
922
|
+
function toU8(v) {
|
|
923
|
+
if (v instanceof Uint8Array)
|
|
924
|
+
return v;
|
|
925
|
+
if (Buffer.isBuffer(v))
|
|
926
|
+
return new Uint8Array(v);
|
|
927
|
+
if (v instanceof ArrayBuffer)
|
|
928
|
+
return new Uint8Array(v);
|
|
929
|
+
throw new Error(`document_store_blob_decode_failed: expected a BLOB, got ${v === null ? "null" : typeof v}`);
|
|
930
|
+
}
|
|
931
|
+
//# sourceMappingURL=document-store.js.map
|