@amalgm/shell 0.1.164-preview.36072132286 → 0.1.164-preview.36809057014
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/PURPOSE.md +642 -128
- package/README.md +10 -8
- package/dist/accepted-tail.d.ts +26 -0
- package/dist/accepted-tail.js +37 -0
- package/dist/accepted-tail.js.map +1 -0
- package/dist/agent-execution.d.ts +16 -1
- package/dist/agent-execution.js +13 -5
- package/dist/agent-execution.js.map +1 -1
- package/dist/apply-cleanup.d.ts +28 -0
- package/dist/apply-cleanup.js +166 -0
- package/dist/apply-cleanup.js.map +1 -0
- package/dist/apply-recovery.d.ts +47 -0
- package/dist/apply-recovery.js +99 -0
- package/dist/apply-recovery.js.map +1 -0
- package/dist/apply-rows.d.ts +72 -0
- package/dist/apply-rows.js +150 -0
- package/dist/apply-rows.js.map +1 -0
- package/dist/apply-saves.d.ts +85 -0
- package/dist/apply-saves.js +238 -0
- package/dist/apply-saves.js.map +1 -0
- package/dist/boot.js +2 -1
- package/dist/boot.js.map +1 -1
- package/dist/capture-work.d.ts +8 -0
- package/dist/capture-work.js +67 -0
- package/dist/capture-work.js.map +1 -0
- package/dist/cargo-group.d.ts +45 -0
- package/dist/cargo-group.js +88 -0
- package/dist/cargo-group.js.map +1 -0
- package/dist/channel-session.d.ts +4 -2
- package/dist/channel-session.js +4 -3
- package/dist/channel-session.js.map +1 -1
- package/dist/chat-composition.d.ts +2 -0
- package/dist/chat-composition.js +1 -0
- package/dist/chat-composition.js.map +1 -1
- package/dist/cli.js +20 -1
- package/dist/cli.js.map +1 -1
- package/dist/construct-apply-host.d.ts +4 -2
- package/dist/construct-apply-host.js +8 -3
- package/dist/construct-apply-host.js.map +1 -1
- package/dist/construct-door.js +1 -1
- package/dist/construct-door.js.map +1 -1
- package/dist/construct-ledger.d.ts +6 -1
- package/dist/construct-ledger.js +21 -33
- package/dist/construct-ledger.js.map +1 -1
- package/dist/content-cache-collection.d.ts +18 -0
- package/dist/content-cache-collection.js +99 -0
- package/dist/content-cache-collection.js.map +1 -0
- package/dist/content-cache-host.d.ts +83 -17
- package/dist/content-cache-host.js +335 -95
- package/dist/content-cache-host.js.map +1 -1
- package/dist/content-cache-namespace.d.ts +59 -0
- package/dist/content-cache-namespace.js +210 -0
- package/dist/content-cache-namespace.js.map +1 -0
- package/dist/content-cache-ownership.d.ts +13 -0
- package/dist/content-cache-ownership.js +75 -0
- package/dist/content-cache-ownership.js.map +1 -0
- package/dist/content-cache-retention.d.ts +23 -0
- package/dist/content-cache-retention.js +195 -0
- package/dist/content-cache-retention.js.map +1 -0
- package/dist/content-capture-pool.d.ts +287 -0
- package/dist/content-capture-pool.js +461 -0
- package/dist/content-capture-pool.js.map +1 -0
- package/dist/content-capture-worker.d.ts +8 -0
- package/dist/content-capture-worker.js +109 -0
- package/dist/content-capture-worker.js.map +1 -0
- package/dist/content-clock.d.ts +42 -0
- package/dist/content-clock.js +166 -0
- package/dist/content-clock.js.map +1 -0
- package/dist/content-direct.d.ts +2 -0
- package/dist/content-direct.js +12 -0
- package/dist/content-direct.js.map +1 -1
- package/dist/content-failure.d.ts +18 -0
- package/dist/content-failure.js +38 -0
- package/dist/content-failure.js.map +1 -0
- package/dist/content-stream-thread.d.ts +60 -0
- package/dist/content-stream-thread.js +95 -0
- package/dist/content-stream-thread.js.map +1 -0
- package/dist/content-stream-worker.d.ts +7 -0
- package/dist/content-stream-worker.js +52 -0
- package/dist/content-stream-worker.js.map +1 -0
- package/dist/declaration-absorption.d.ts +37 -0
- package/dist/declaration-absorption.js +119 -0
- package/dist/declaration-absorption.js.map +1 -0
- package/dist/declaration-chain.d.ts +36 -0
- package/dist/declaration-chain.js +96 -0
- package/dist/declaration-chain.js.map +1 -0
- package/dist/declaration-commit.d.ts +31 -0
- package/dist/declaration-commit.js +49 -0
- package/dist/declaration-commit.js.map +1 -0
- package/dist/declaration-hold.d.ts +22 -0
- package/dist/declaration-hold.js +24 -0
- package/dist/declaration-hold.js.map +1 -0
- package/dist/declaration-journal.d.ts +62 -0
- package/dist/declaration-journal.js +99 -0
- package/dist/declaration-journal.js.map +1 -0
- package/dist/declaration-save.d.ts +31 -0
- package/dist/declaration-save.js +134 -0
- package/dist/declaration-save.js.map +1 -0
- package/dist/detection/accepted-result.d.ts +19 -1
- package/dist/detection/accepted-result.js +36 -5
- package/dist/detection/accepted-result.js.map +1 -1
- package/dist/detection/admission-save.d.ts +55 -0
- package/dist/detection/admission-save.js +48 -0
- package/dist/detection/admission-save.js.map +1 -0
- package/dist/detection/admission-units.d.ts +66 -0
- package/dist/detection/admission-units.js +322 -0
- package/dist/detection/admission-units.js.map +1 -0
- package/dist/detection/alias-discovery.d.ts +12 -0
- package/dist/detection/alias-discovery.js +80 -0
- package/dist/detection/alias-discovery.js.map +1 -0
- package/dist/detection/alias-examination.d.ts +30 -0
- package/dist/detection/alias-examination.js +49 -0
- package/dist/detection/alias-examination.js.map +1 -0
- package/dist/detection/apply-ownership.d.ts +81 -0
- package/dist/detection/apply-ownership.js +232 -0
- package/dist/detection/apply-ownership.js.map +1 -0
- package/dist/detection/basis-advanced.d.ts +11 -0
- package/dist/detection/basis-advanced.js +26 -0
- package/dist/detection/basis-advanced.js.map +1 -0
- package/dist/detection/capture-outcome.d.ts +16 -0
- package/dist/detection/capture-outcome.js +92 -0
- package/dist/detection/capture-outcome.js.map +1 -0
- package/dist/detection/container-membership.d.ts +32 -0
- package/dist/detection/container-membership.js +49 -0
- package/dist/detection/container-membership.js.map +1 -0
- package/dist/detection/detect-cancelled.d.ts +6 -0
- package/dist/detection/detect-cancelled.js +10 -0
- package/dist/detection/detect-cancelled.js.map +1 -0
- package/dist/detection/directory-proof.d.ts +47 -0
- package/dist/detection/directory-proof.js +77 -0
- package/dist/detection/directory-proof.js.map +1 -0
- package/dist/detection/disposition-rows.d.ts +18 -0
- package/dist/detection/disposition-rows.js +29 -0
- package/dist/detection/disposition-rows.js.map +1 -0
- package/dist/detection/dispositions.d.ts +130 -0
- package/dist/detection/dispositions.js +248 -0
- package/dist/detection/dispositions.js.map +1 -0
- package/dist/detection/git-notice.d.ts +88 -0
- package/dist/detection/git-notice.js +444 -0
- package/dist/detection/git-notice.js.map +1 -0
- package/dist/detection/ground-proof.d.ts +130 -0
- package/dist/detection/ground-proof.js +274 -0
- package/dist/detection/ground-proof.js.map +1 -0
- package/dist/detection/ground-reader.d.ts +29 -0
- package/dist/detection/ground-reader.js +102 -0
- package/dist/detection/ground-reader.js.map +1 -0
- package/dist/detection/held-territory.d.ts +51 -0
- package/dist/detection/held-territory.js +205 -0
- package/dist/detection/held-territory.js.map +1 -0
- package/dist/detection/identity-discovery.d.ts +45 -0
- package/dist/detection/identity-discovery.js +287 -0
- package/dist/detection/identity-discovery.js.map +1 -0
- package/dist/detection/maintenance-sweep.d.ts +108 -0
- package/dist/detection/maintenance-sweep.js +325 -0
- package/dist/detection/maintenance-sweep.js.map +1 -0
- package/dist/detection/name-reach.d.ts +12 -0
- package/dist/detection/name-reach.js +28 -0
- package/dist/detection/name-reach.js.map +1 -0
- package/dist/detection/notebook-basis.d.ts +5 -7
- package/dist/detection/notebook-basis.js +6 -7
- package/dist/detection/notebook-basis.js.map +1 -1
- package/dist/detection/owed-selection.d.ts +51 -0
- package/dist/detection/owed-selection.js +169 -0
- package/dist/detection/owed-selection.js.map +1 -0
- package/dist/detection/portable.d.ts +34 -34
- package/dist/detection/portable.js +67 -93
- package/dist/detection/portable.js.map +1 -1
- package/dist/detection/reconciliation-coverage.d.ts +7 -0
- package/dist/detection/reconciliation-coverage.js +16 -0
- package/dist/detection/reconciliation-coverage.js.map +1 -0
- package/dist/detection/repository-publication.d.ts +20 -0
- package/dist/detection/repository-publication.js +79 -0
- package/dist/detection/repository-publication.js.map +1 -0
- package/dist/detection/repository-routes.d.ts +43 -0
- package/dist/detection/repository-routes.js +97 -0
- package/dist/detection/repository-routes.js.map +1 -0
- package/dist/detection/root-examination.d.ts +94 -0
- package/dist/detection/root-examination.js +523 -0
- package/dist/detection/root-examination.js.map +1 -0
- package/dist/detection/runtime.d.ts +131 -64
- package/dist/detection/runtime.js +808 -1103
- package/dist/detection/runtime.js.map +1 -1
- package/dist/detection/scoped-identity-port.d.ts +34 -0
- package/dist/detection/scoped-identity-port.js +81 -0
- package/dist/detection/scoped-identity-port.js.map +1 -0
- package/dist/detection/seal-law.d.ts +66 -0
- package/dist/detection/seal-law.js +116 -0
- package/dist/detection/seal-law.js.map +1 -0
- package/dist/detection/sharing-policy.d.ts +11 -0
- package/dist/detection/sharing-policy.js +32 -0
- package/dist/detection/sharing-policy.js.map +1 -0
- package/dist/detection/thread-database.d.ts +4 -0
- package/dist/detection/thread-database.js +30 -0
- package/dist/detection/thread-database.js.map +1 -0
- package/dist/detection/unreadable.d.ts +11 -0
- package/dist/detection/unreadable.js +9 -0
- package/dist/detection/unreadable.js.map +1 -0
- package/dist/detection/verified-content.d.ts +6 -0
- package/dist/detection/verified-content.js +12 -0
- package/dist/detection/verified-content.js.map +1 -0
- package/dist/detection/walk-law.d.ts +34 -0
- package/dist/detection/walk-law.js +55 -0
- package/dist/detection/walk-law.js.map +1 -0
- package/dist/development/fly-guest.js +2 -1
- package/dist/development/fly-guest.js.map +1 -1
- package/dist/entity-apply-host.d.ts +29 -13
- package/dist/entity-apply-host.js +1426 -461
- package/dist/entity-apply-host.js.map +1 -1
- package/dist/entity-apply-store.d.ts +77 -30
- package/dist/entity-apply-store.js +221 -516
- package/dist/entity-apply-store.js.map +1 -1
- package/dist/entity-record-observability.js +2 -0
- package/dist/entity-record-observability.js.map +1 -1
- package/dist/entity-record-saves.d.ts +20 -0
- package/dist/entity-record-saves.js +91 -0
- package/dist/entity-record-saves.js.map +1 -0
- package/dist/entity-record-store.d.ts +15 -7
- package/dist/entity-record-store.js +57 -117
- package/dist/entity-record-store.js.map +1 -1
- package/dist/files-register-host.d.ts +22 -3
- package/dist/files-register-host.js +70 -31
- package/dist/files-register-host.js.map +1 -1
- package/dist/filesystem.js +3 -2
- package/dist/filesystem.js.map +1 -1
- package/dist/git-binding.d.ts +65 -0
- package/dist/git-binding.js +220 -0
- package/dist/git-binding.js.map +1 -0
- package/dist/git-capture.d.ts +39 -0
- package/dist/git-capture.js +86 -0
- package/dist/git-capture.js.map +1 -0
- package/dist/git-card.d.ts +12 -0
- package/dist/git-card.js +123 -0
- package/dist/git-card.js.map +1 -0
- package/dist/git-checkpoint-construction.d.ts +41 -0
- package/dist/git-checkpoint-construction.js +96 -0
- package/dist/git-checkpoint-construction.js.map +1 -0
- package/dist/git-checkpoint-preparation.d.ts +37 -0
- package/dist/git-checkpoint-preparation.js +145 -0
- package/dist/git-checkpoint-preparation.js.map +1 -0
- package/dist/git-command.d.ts +61 -8
- package/dist/git-command.js +217 -63
- package/dist/git-command.js.map +1 -1
- package/dist/git-configuration.d.ts +40 -0
- package/dist/git-configuration.js +217 -0
- package/dist/git-configuration.js.map +1 -0
- package/dist/git-evidence.d.ts +61 -0
- package/dist/git-evidence.js +181 -0
- package/dist/git-evidence.js.map +1 -0
- package/dist/git-index-entries.d.ts +15 -0
- package/dist/git-index-entries.js +44 -0
- package/dist/git-index-entries.js.map +1 -0
- package/dist/git-index-format.d.ts +35 -0
- package/dist/git-index-format.js +293 -0
- package/dist/git-index-format.js.map +1 -0
- package/dist/git-index-witness.d.ts +33 -0
- package/dist/git-index-witness.js +69 -0
- package/dist/git-index-witness.js.map +1 -0
- package/dist/git-literal-host.d.ts +82 -0
- package/dist/git-literal-host.js +172 -0
- package/dist/git-literal-host.js.map +1 -0
- package/dist/git-literal-read.d.ts +88 -0
- package/dist/git-literal-read.js +170 -0
- package/dist/git-literal-read.js.map +1 -0
- package/dist/git-literal-replay.d.ts +33 -0
- package/dist/git-literal-replay.js +268 -0
- package/dist/git-literal-replay.js.map +1 -0
- package/dist/git-native-file.d.ts +42 -0
- package/dist/git-native-file.js +145 -0
- package/dist/git-native-file.js.map +1 -0
- package/dist/git-native-index.d.ts +21 -0
- package/dist/git-native-index.js +44 -0
- package/dist/git-native-index.js.map +1 -0
- package/dist/git-operation-host.d.ts +48 -0
- package/dist/git-operation-host.js +127 -0
- package/dist/git-operation-host.js.map +1 -0
- package/dist/git-private-index.d.ts +11 -0
- package/dist/git-private-index.js +42 -0
- package/dist/git-private-index.js.map +1 -0
- package/dist/git-private-repository.d.ts +4 -0
- package/dist/git-private-repository.js +69 -0
- package/dist/git-private-repository.js.map +1 -0
- package/dist/git-private-view.d.ts +39 -0
- package/dist/git-private-view.js +162 -0
- package/dist/git-private-view.js.map +1 -0
- package/dist/git-ref-store.d.ts +12 -0
- package/dist/git-ref-store.js +68 -0
- package/dist/git-ref-store.js.map +1 -0
- package/dist/git-registration-host.d.ts +20 -30
- package/dist/git-registration-host.js +86 -249
- package/dist/git-registration-host.js.map +1 -1
- package/dist/git-repository-host.d.ts +148 -22
- package/dist/git-repository-host.js +633 -650
- package/dist/git-repository-host.js.map +1 -1
- package/dist/git-worktree-host.d.ts +2 -0
- package/dist/git-worktree-host.js +16 -0
- package/dist/git-worktree-host.js.map +1 -0
- package/dist/graph-publication.d.ts +75 -0
- package/dist/graph-publication.js +203 -0
- package/dist/graph-publication.js.map +1 -0
- package/dist/ground-basis.d.ts +242 -0
- package/dist/ground-basis.js +1023 -0
- package/dist/ground-basis.js.map +1 -0
- package/dist/ground-checkpoint-worker.d.ts +1 -0
- package/dist/ground-checkpoint-worker.js +84 -0
- package/dist/ground-checkpoint-worker.js.map +1 -0
- package/dist/ground-checkpoints.d.ts +16 -0
- package/dist/ground-checkpoints.js +45 -0
- package/dist/ground-checkpoints.js.map +1 -0
- package/dist/ground-coordination.d.ts +107 -3
- package/dist/ground-coordination.js +249 -24
- package/dist/ground-coordination.js.map +1 -1
- package/dist/ground-database.d.ts +42 -0
- package/dist/ground-database.js +290 -0
- package/dist/ground-database.js.map +1 -0
- package/dist/ground-differences.d.ts +23 -0
- package/dist/ground-differences.js +47 -0
- package/dist/ground-differences.js.map +1 -0
- package/dist/ground-holders.d.ts +4 -0
- package/dist/ground-holders.js +15 -0
- package/dist/ground-holders.js.map +1 -0
- package/dist/ground-initialization-worker.d.ts +1 -0
- package/dist/ground-initialization-worker.js +20 -0
- package/dist/ground-initialization-worker.js.map +1 -0
- package/dist/ground-initialization.d.ts +35 -0
- package/dist/ground-initialization.js +102 -0
- package/dist/ground-initialization.js.map +1 -0
- package/dist/ground-install-saves.d.ts +63 -0
- package/dist/ground-install-saves.js +139 -0
- package/dist/ground-install-saves.js.map +1 -0
- package/dist/ground-inventory-schema.d.ts +18 -0
- package/dist/ground-inventory-schema.js +168 -0
- package/dist/ground-inventory-schema.js.map +1 -0
- package/dist/ground-profile.d.ts +7 -0
- package/dist/ground-profile.js +52 -0
- package/dist/ground-profile.js.map +1 -0
- package/dist/ground-root-index.d.ts +2 -1
- package/dist/ground-root-index.js +16 -14
- package/dist/ground-root-index.js.map +1 -1
- package/dist/ground-row.d.ts +62 -0
- package/dist/ground-row.js +70 -0
- package/dist/ground-row.js.map +1 -0
- package/dist/ground-save-ops.d.ts +44 -0
- package/dist/ground-save-ops.js +41 -0
- package/dist/ground-save-ops.js.map +1 -0
- package/dist/ground-saver-worker.d.ts +1 -0
- package/dist/ground-saver-worker.js +156 -0
- package/dist/ground-saver-worker.js.map +1 -0
- package/dist/ground-saver.d.ts +75 -0
- package/dist/ground-saver.js +216 -0
- package/dist/ground-saver.js.map +1 -0
- package/dist/ground-store.d.ts +84 -0
- package/dist/ground-store.js +473 -0
- package/dist/ground-store.js.map +1 -0
- package/dist/ground-territory.d.ts +130 -0
- package/dist/ground-territory.js +511 -0
- package/dist/ground-territory.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/installation/ownership.d.ts +0 -2
- package/dist/installation/ownership.js +3 -15
- package/dist/installation/ownership.js.map +1 -1
- package/dist/machine-host.d.ts +3 -2
- package/dist/machine-host.js +28 -16
- package/dist/machine-host.js.map +1 -1
- package/dist/materialized-graph.d.ts +7 -7
- package/dist/materialized-graph.js +11 -23
- package/dist/materialized-graph.js.map +1 -1
- package/dist/module-thread.d.ts +9 -0
- package/dist/module-thread.js +10 -0
- package/dist/module-thread.js.map +1 -0
- package/dist/native/fsevents-stream.node +0 -0
- package/dist/physical-path-witness.d.ts +64 -0
- package/dist/physical-path-witness.js +168 -0
- package/dist/physical-path-witness.js.map +1 -0
- package/dist/register-upload-fusion.d.ts +5 -4
- package/dist/register-upload-fusion.js +9 -6
- package/dist/register-upload-fusion.js.map +1 -1
- package/dist/registry-graph.d.ts +3 -2
- package/dist/registry-graph.js +9 -6
- package/dist/registry-graph.js.map +1 -1
- package/dist/registry-page-cache.d.ts +5 -2
- package/dist/registry-page-cache.js.map +1 -1
- package/dist/repository-identity-steps.d.ts +5 -0
- package/dist/repository-identity-steps.js +33 -0
- package/dist/repository-identity-steps.js.map +1 -0
- package/dist/runtime-node-flags.d.ts +10 -0
- package/dist/runtime-node-flags.js +11 -0
- package/dist/runtime-node-flags.js.map +1 -0
- package/dist/service/adapter.d.ts +1 -1
- package/dist/service/adapter.js +1 -1
- package/dist/service/adapter.js.map +1 -1
- package/dist/service/cli.js +16 -20
- package/dist/service/cli.js.map +1 -1
- package/dist/service/control.d.ts +2 -2
- package/dist/service/keepalive.d.ts +4 -11
- package/dist/service/keepalive.js +65 -118
- package/dist/service/keepalive.js.map +1 -1
- package/dist/service/policy.d.ts +36 -0
- package/dist/service/policy.js +25 -0
- package/dist/service/policy.js.map +1 -0
- package/dist/service/portable.d.ts +1 -1
- package/dist/service/portable.js +1 -1
- package/dist/service/portable.js.map +1 -1
- package/dist/service/recovery.d.ts +10 -9
- package/dist/service/recovery.js +29 -19
- package/dist/service/recovery.js.map +1 -1
- package/dist/service/windows-action.d.ts +5 -3
- package/dist/service/windows-action.js +6 -9
- package/dist/service/windows-action.js.map +1 -1
- package/dist/service/windows-task.js +5 -5
- package/dist/service/windows-task.js.map +1 -1
- package/dist/sharing-admission.d.ts +17 -0
- package/dist/sharing-admission.js +128 -0
- package/dist/sharing-admission.js.map +1 -0
- package/dist/snapshot-delivery-baseline.d.ts +12 -3
- package/dist/snapshot-delivery-baseline.js +41 -42
- package/dist/snapshot-delivery-baseline.js.map +1 -1
- package/dist/source-proof.d.ts +36 -0
- package/dist/source-proof.js +70 -0
- package/dist/source-proof.js.map +1 -0
- package/dist/source-signature.d.ts +56 -0
- package/dist/source-signature.js +56 -0
- package/dist/source-signature.js.map +1 -0
- package/dist/source-witness.d.ts +15 -0
- package/dist/source-witness.js +29 -0
- package/dist/source-witness.js.map +1 -0
- package/dist/sqlite-durability.d.ts +31 -0
- package/dist/sqlite-durability.js +28 -0
- package/dist/sqlite-durability.js.map +1 -0
- package/dist/sqlite.d.ts +8 -2
- package/dist/sqlite.js +27 -4
- package/dist/sqlite.js.map +1 -1
- package/dist/sync-address.d.ts +19 -0
- package/dist/sync-address.js +52 -0
- package/dist/sync-address.js.map +1 -0
- package/dist/sync-setting.d.ts +15 -0
- package/dist/sync-setting.js +13 -0
- package/dist/sync-setting.js.map +1 -1
- package/dist/turns.d.ts +42 -0
- package/dist/turns.js +112 -0
- package/dist/turns.js.map +1 -0
- package/dist/updates/bootstrap.d.ts +53 -7
- package/dist/updates/bootstrap.js +224 -137
- package/dist/updates/bootstrap.js.map +1 -1
- package/dist/updates/controller.d.ts +8 -0
- package/dist/updates/controller.js +27 -3
- package/dist/updates/controller.js.map +1 -1
- package/dist/updates/store.d.ts +3 -0
- package/dist/updates/store.js +12 -0
- package/dist/updates/store.js.map +1 -1
- package/dist/user-ground-host.d.ts +364 -69
- package/dist/user-ground-host.js +5231 -3366
- package/dist/user-ground-host.js.map +1 -1
- package/dist/watching/fsevents.d.ts +52 -1
- package/dist/watching/fsevents.js +60 -25
- package/dist/watching/fsevents.js.map +1 -1
- package/dist/watching/host.d.ts +129 -5
- package/dist/watching/host.js +433 -80
- package/dist/watching/host.js.map +1 -1
- package/dist/watching/index.d.ts +1 -1
- package/dist/wire-binary.d.ts +3 -2
- package/dist/wire-binary.js +10 -8
- package/dist/wire-binary.js.map +1 -1
- package/dist/wire-client.d.ts +3 -4
- package/dist/wire-client.js +18 -44
- package/dist/wire-client.js.map +1 -1
- package/dist/wire-outbox.d.ts +34 -0
- package/dist/wire-outbox.js +127 -0
- package/dist/wire-outbox.js.map +1 -0
- package/dist/workspace-host.d.ts +4 -0
- package/dist/workspace-host.js +12 -1
- package/dist/workspace-host.js.map +1 -1
- package/examinations/fixtures/private-wire-authority.js +133 -10
- package/npm-shrinkwrap.json +43 -56
- package/package.json +26 -13
|
@@ -1,115 +1,61 @@
|
|
|
1
|
-
/** Persistent SQLite effects for Live's Inbox -> Apply -> Verify rail.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
].join(", ");
|
|
12
|
-
const rowValues = (row) => [
|
|
13
|
-
row.record.uuid,
|
|
14
|
-
row.resourceId,
|
|
15
|
-
row.rootUUID,
|
|
16
|
-
row.record.type,
|
|
17
|
-
row.record.parentUUID,
|
|
18
|
-
row.record.name,
|
|
19
|
-
row.record.status,
|
|
20
|
-
row.record.version,
|
|
21
|
-
row.record.payloadVersion,
|
|
22
|
-
row.record.transportVersion,
|
|
23
|
-
row.relativePath,
|
|
24
|
-
row.absolutePath,
|
|
25
|
-
row.deviceNumber,
|
|
26
|
-
row.inode,
|
|
27
|
-
row.byteSize,
|
|
28
|
-
row.modifiedTimeMs,
|
|
29
|
-
row.changedTimeMs,
|
|
30
|
-
row.filesystemMode,
|
|
31
|
-
row.contentVerifiedAtMs,
|
|
32
|
-
];
|
|
33
|
-
const sameIntent = (left, right) => left.authorityId === right.authorityId
|
|
34
|
-
&& left.entityId === right.entityId
|
|
35
|
-
&& left.fromSequence === right.fromSequence
|
|
36
|
-
&& left.throughSequence === right.throughSequence
|
|
37
|
-
&& left.targetMutationId === right.targetMutationId
|
|
38
|
-
&& left.targetState === right.targetState
|
|
39
|
-
&& left.targetType === right.targetType;
|
|
1
|
+
/** Persistent SQLite effects for Live's Inbox -> Apply -> Verify rail. Reads
|
|
2
|
+
* run on this connection; every write is a save on the ground file's saver
|
|
3
|
+
* thread (apply-saves.ts). */
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import { assertRecord, decodeAcceptedEntityRecord, isConstructType, } from "@amalgm/live";
|
|
6
|
+
import { applyResolution, hasLocalWorkAfter, ownedCleanup, ownPublication, readIntent, readRetirement, recoveryLocation, requireIntent, sameIntent, snapshotHistory, } from "./apply-rows.js";
|
|
7
|
+
import { save } from "./ground-saver.js";
|
|
8
|
+
import { closePhysically, sourceProofs, witnessProof } from "./source-proof.js";
|
|
9
|
+
import { cachedStatement } from "./sqlite.js";
|
|
10
|
+
import { turnBoundary } from "./turns.js";
|
|
40
11
|
/**
|
|
41
12
|
* Apply has one persistent database owner. Verify hands this owner the exact
|
|
42
|
-
* rows it just proved; completion writes those rows, cursors, Inbox resolution
|
|
43
|
-
* and
|
|
13
|
+
* rows it just proved; completion writes those rows, cursors, Inbox resolution
|
|
14
|
+
* and the terminal disposition in one save.
|
|
44
15
|
*/
|
|
45
16
|
export class EntityApplySqliteStore {
|
|
46
17
|
#database;
|
|
18
|
+
#file;
|
|
47
19
|
#now;
|
|
48
20
|
#onIntentFinished;
|
|
21
|
+
#onAttemptFailed;
|
|
22
|
+
#onOwnPublicationResolved;
|
|
49
23
|
#isLocallyEligible;
|
|
24
|
+
#holdsOwnPlacement;
|
|
50
25
|
#verified = new Map();
|
|
51
|
-
#
|
|
52
|
-
#state;
|
|
53
|
-
#inboxAfter;
|
|
54
|
-
#intent;
|
|
55
|
-
#intentByEntity;
|
|
56
|
-
#authorityForEntity;
|
|
57
|
-
#targetRecord;
|
|
58
|
-
#localRelevance;
|
|
59
|
-
#localWork;
|
|
60
|
-
#insertIntent;
|
|
61
|
-
#updateIntent;
|
|
62
|
-
#deleteIntent;
|
|
63
|
-
#resolveInbox;
|
|
64
|
-
#upsertState;
|
|
65
|
-
#upsertEntity;
|
|
66
|
-
#upsertNotebook;
|
|
67
|
-
#deleteEntity;
|
|
68
|
-
#deleteNotebook;
|
|
69
|
-
#entitySlot;
|
|
70
|
-
#notebookAtUuid;
|
|
71
|
-
#notebookChildren;
|
|
72
|
-
#updateEntityVersion;
|
|
73
|
-
#updateNotebookVersion;
|
|
74
|
-
#materializedMatches;
|
|
75
|
-
#resolveMaterializedHistory;
|
|
76
|
-
#baselineRows;
|
|
77
|
-
#baselineIntents;
|
|
78
|
-
#snapshotBaseline;
|
|
26
|
+
#cleanupProof = new Map();
|
|
79
27
|
constructor(database, options = {}) {
|
|
80
28
|
this.#database = database;
|
|
29
|
+
this.#file = database.name;
|
|
81
30
|
this.#now = options.now ?? Date.now;
|
|
82
31
|
this.#onIntentFinished = options.onIntentFinished ?? (() => undefined);
|
|
32
|
+
this.#onAttemptFailed = options.onAttemptFailed ?? (() => undefined);
|
|
33
|
+
this.#onOwnPublicationResolved = options.onOwnPublicationResolved ?? (() => undefined);
|
|
83
34
|
this.#isLocallyEligible = options.isLocallyEligible ?? (() => true);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
CREATE INDEX IF NOT EXISTS record_inbox_apply
|
|
104
|
-
ON record_inbox(authority_id, entity_id, global_sequence);
|
|
105
|
-
CREATE INDEX IF NOT EXISTS record_inbox_entity_apply
|
|
106
|
-
ON record_inbox(entity_id, global_sequence DESC);
|
|
107
|
-
`);
|
|
108
|
-
const inboxColumns = new Set(database.prepare("PRAGMA table_info(record_inbox)").all().map(({ name }) => name));
|
|
109
|
-
if (!inboxColumns.has("resolved_at")) {
|
|
110
|
-
database.exec("ALTER TABLE record_inbox ADD COLUMN resolved_at INTEGER");
|
|
35
|
+
this.#holdsOwnPlacement = options.holdsOwnPlacement ?? (() => false);
|
|
36
|
+
}
|
|
37
|
+
/** Only an explicitly installed snapshot watermark resolves startup history.
|
|
38
|
+
* Sharing-baseline equality is never evidence of current disk contents.
|
|
39
|
+
* Any existing physical recovery obligation must survive this adoption. */
|
|
40
|
+
async adoptSnapshotHistory(mayRetire = () => false) {
|
|
41
|
+
const history = snapshotHistory(this.#database);
|
|
42
|
+
const candidates = new Map();
|
|
43
|
+
for (const intent of [...history.intents,
|
|
44
|
+
...history.rows.flatMap(row => readIntent(this.#database, row.entityId) ?? [])]) {
|
|
45
|
+
if (!readRetirement(this.#database, intent))
|
|
46
|
+
candidates.set(intent.entityId, intent);
|
|
47
|
+
}
|
|
48
|
+
const retirable = [...candidates.values()].filter(intent => mayRetire(intent));
|
|
49
|
+
const { value } = await save(this.#file, "apply.adoptSnapshotHistory", { retirable });
|
|
50
|
+
for (const intent of value.supersededIntents) {
|
|
51
|
+
const staged = this.#verified.get(intent.entityId);
|
|
52
|
+
if (staged && sameIntent(staged.intent, intent))
|
|
53
|
+
this.#verified.delete(intent.entityId);
|
|
111
54
|
}
|
|
112
|
-
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
readApplyWork(limit, afterCursor) {
|
|
58
|
+
const all = cachedStatement(this.#database, `
|
|
113
59
|
SELECT entity_id AS entityId FROM entity_apply_intents
|
|
114
60
|
UNION
|
|
115
61
|
SELECT inbox.entity_id AS entityId
|
|
@@ -117,255 +63,7 @@ export class EntityApplySqliteStore {
|
|
|
117
63
|
LEFT JOIN entity_apply_state state ON state.entity_id = inbox.entity_id
|
|
118
64
|
WHERE inbox.global_sequence > COALESCE(state.resolved_through, 0)
|
|
119
65
|
ORDER BY entityId
|
|
120
|
-
`)
|
|
121
|
-
this.#state = database.prepare(`
|
|
122
|
-
SELECT resolved_through AS resolvedThrough,
|
|
123
|
-
materialized_sequence AS materializedSequence,
|
|
124
|
-
materialized_record_json AS materializedRecordJson
|
|
125
|
-
FROM entity_apply_state WHERE authority_id = ? AND entity_id = ?
|
|
126
|
-
`);
|
|
127
|
-
this.#inboxAfter = database.prepare(`
|
|
128
|
-
SELECT record_json AS recordJson, delivery_sequence AS deliverySequence
|
|
129
|
-
FROM record_inbox
|
|
130
|
-
WHERE authority_id = ? AND entity_id = ? AND global_sequence > ?
|
|
131
|
-
ORDER BY global_sequence
|
|
132
|
-
`);
|
|
133
|
-
this.#snapshotBaseline = database.prepare(`
|
|
134
|
-
SELECT delivery_sequence AS deliverySequence
|
|
135
|
-
FROM authority_snapshot_baselines WHERE authority_id = ?
|
|
136
|
-
`);
|
|
137
|
-
this.#intent = database.prepare(`
|
|
138
|
-
SELECT intent_json AS intentJson FROM entity_apply_intents
|
|
139
|
-
WHERE authority_id = ? AND entity_id = ?
|
|
140
|
-
`);
|
|
141
|
-
this.#intentByEntity = database.prepare(`
|
|
142
|
-
SELECT intent_json AS intentJson FROM entity_apply_intents WHERE entity_id = ?
|
|
143
|
-
`);
|
|
144
|
-
this.#authorityForEntity = database.prepare(`
|
|
145
|
-
SELECT authority_id AS authorityId FROM record_inbox
|
|
146
|
-
WHERE entity_id = ? ORDER BY global_sequence DESC LIMIT 1
|
|
147
|
-
`);
|
|
148
|
-
this.#targetRecord = database.prepare(`
|
|
149
|
-
SELECT record_json AS recordJson FROM record_inbox
|
|
150
|
-
WHERE authority_id = ? AND entity_id = ? AND global_sequence = ?
|
|
151
|
-
`);
|
|
152
|
-
this.#localRelevance = database.prepare(`
|
|
153
|
-
SELECT 1 AS present FROM entities WHERE uuid = ?
|
|
154
|
-
UNION ALL
|
|
155
|
-
SELECT 1 AS present FROM detection_notebook WHERE uuid = ?
|
|
156
|
-
LIMIT 1
|
|
157
|
-
`);
|
|
158
|
-
this.#localWork = database.prepare(`
|
|
159
|
-
SELECT 1 AS present FROM record_outbox
|
|
160
|
-
WHERE authority_id = ? AND entity_id = ?
|
|
161
|
-
AND (status = 'pending' OR global_sequence > ?)
|
|
162
|
-
LIMIT 1
|
|
163
|
-
`);
|
|
164
|
-
this.#insertIntent = database.prepare(`
|
|
165
|
-
INSERT INTO entity_apply_intents(entity_id, authority_id, intent_json)
|
|
166
|
-
VALUES (?, ?, ?)
|
|
167
|
-
`);
|
|
168
|
-
this.#updateIntent = database.prepare(`
|
|
169
|
-
UPDATE entity_apply_intents SET intent_json = ?
|
|
170
|
-
WHERE authority_id = ? AND entity_id = ?
|
|
171
|
-
`);
|
|
172
|
-
this.#deleteIntent = database.prepare(`
|
|
173
|
-
DELETE FROM entity_apply_intents WHERE authority_id = ? AND entity_id = ?
|
|
174
|
-
`);
|
|
175
|
-
this.#resolveInbox = database.prepare(`
|
|
176
|
-
UPDATE record_inbox SET resolved_at = ?
|
|
177
|
-
WHERE authority_id = ? AND entity_id = ?
|
|
178
|
-
AND global_sequence > ? AND global_sequence <= ?
|
|
179
|
-
`);
|
|
180
|
-
this.#upsertState = database.prepare(`
|
|
181
|
-
INSERT INTO entity_apply_state(
|
|
182
|
-
entity_id, authority_id, resolved_through,
|
|
183
|
-
materialized_sequence, materialized_record_json
|
|
184
|
-
) VALUES (?, ?, ?, ?, ?)
|
|
185
|
-
ON CONFLICT(entity_id) DO UPDATE SET
|
|
186
|
-
authority_id = excluded.authority_id,
|
|
187
|
-
resolved_through = excluded.resolved_through,
|
|
188
|
-
materialized_sequence = excluded.materialized_sequence,
|
|
189
|
-
materialized_record_json = excluded.materialized_record_json
|
|
190
|
-
`);
|
|
191
|
-
const upsert = (table) => database.prepare(`
|
|
192
|
-
INSERT INTO ${table}(${GROUND_COLUMNS})
|
|
193
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
194
|
-
ON CONFLICT(uuid) DO UPDATE SET
|
|
195
|
-
resource_id = excluded.resource_id,
|
|
196
|
-
root_uuid = excluded.root_uuid,
|
|
197
|
-
type = excluded.type,
|
|
198
|
-
parent_uuid = excluded.parent_uuid,
|
|
199
|
-
name = excluded.name,
|
|
200
|
-
status = excluded.status,
|
|
201
|
-
version = excluded.version,
|
|
202
|
-
payload_version = excluded.payload_version,
|
|
203
|
-
transport_version = excluded.transport_version,
|
|
204
|
-
relative_path = excluded.relative_path,
|
|
205
|
-
absolute_path = excluded.absolute_path,
|
|
206
|
-
device_number = excluded.device_number,
|
|
207
|
-
inode = excluded.inode,
|
|
208
|
-
byte_size = excluded.byte_size,
|
|
209
|
-
modified_time_ms = excluded.modified_time_ms,
|
|
210
|
-
changed_time_ms = excluded.changed_time_ms,
|
|
211
|
-
filesystem_mode = excluded.filesystem_mode,
|
|
212
|
-
content_verified_at_ms = excluded.content_verified_at_ms
|
|
213
|
-
`);
|
|
214
|
-
this.#upsertEntity = upsert("entities");
|
|
215
|
-
this.#upsertNotebook = upsert("detection_notebook");
|
|
216
|
-
this.#deleteEntity = database.prepare("DELETE FROM entities WHERE uuid = ?");
|
|
217
|
-
this.#deleteNotebook = database.prepare("DELETE FROM detection_notebook WHERE uuid = ?");
|
|
218
|
-
this.#entitySlot = database.prepare(`
|
|
219
|
-
SELECT uuid, type, payload_version AS payloadVersion,
|
|
220
|
-
absolute_path AS absolutePath FROM entities
|
|
221
|
-
WHERE resource_id = ? AND root_uuid = ? AND relative_path = ?
|
|
222
|
-
`);
|
|
223
|
-
this.#notebookAtUuid = database.prepare(`
|
|
224
|
-
SELECT uuid, type, parent_uuid AS parentUUID, name, status
|
|
225
|
-
FROM detection_notebook WHERE uuid = ?
|
|
226
|
-
`);
|
|
227
|
-
this.#notebookChildren = database.prepare(`
|
|
228
|
-
SELECT uuid, name FROM detection_notebook
|
|
229
|
-
WHERE parent_uuid = ? AND status = 'active' ORDER BY name, uuid
|
|
230
|
-
`);
|
|
231
|
-
this.#updateEntityVersion = database.prepare("UPDATE entities SET version = ? WHERE uuid = ?");
|
|
232
|
-
this.#updateNotebookVersion = database.prepare("UPDATE detection_notebook SET version = ? WHERE uuid = ?");
|
|
233
|
-
this.#materializedMatches = database.prepare(`
|
|
234
|
-
SELECT inbox.authority_id AS authorityId,
|
|
235
|
-
inbox.entity_id AS entityId,
|
|
236
|
-
inbox.global_sequence AS globalSequence,
|
|
237
|
-
inbox.record_json AS recordJson,
|
|
238
|
-
intent.intent_json AS intentJson,
|
|
239
|
-
notebook.type,
|
|
240
|
-
notebook.parent_uuid AS parentUUID,
|
|
241
|
-
notebook.name,
|
|
242
|
-
notebook.status,
|
|
243
|
-
notebook.version,
|
|
244
|
-
notebook.payload_version AS payloadVersion,
|
|
245
|
-
notebook.filesystem_mode AS filesystemMode,
|
|
246
|
-
notebook.transport_version AS transportVersion
|
|
247
|
-
FROM detection_notebook AS notebook
|
|
248
|
-
JOIN record_inbox AS inbox
|
|
249
|
-
ON inbox.authority_id = notebook.resource_id
|
|
250
|
-
AND inbox.entity_id = notebook.uuid
|
|
251
|
-
AND inbox.global_sequence = (
|
|
252
|
-
SELECT MAX(candidate.global_sequence)
|
|
253
|
-
FROM record_inbox AS candidate
|
|
254
|
-
WHERE candidate.authority_id = notebook.resource_id
|
|
255
|
-
AND candidate.entity_id = notebook.uuid
|
|
256
|
-
AND json_extract(candidate.record_json, '$.resultState') = notebook.version
|
|
257
|
-
)
|
|
258
|
-
LEFT JOIN entity_apply_intents AS intent
|
|
259
|
-
ON intent.entity_id = inbox.entity_id
|
|
260
|
-
AND intent.authority_id = inbox.authority_id
|
|
261
|
-
LEFT JOIN entity_apply_state AS state
|
|
262
|
-
ON state.entity_id = inbox.entity_id
|
|
263
|
-
AND state.authority_id = inbox.authority_id
|
|
264
|
-
WHERE (? IS NULL OR notebook.root_uuid = ?)
|
|
265
|
-
AND (inbox.resolved_at IS NULL
|
|
266
|
-
OR intent.intent_json IS NOT NULL
|
|
267
|
-
OR state.entity_id IS NULL
|
|
268
|
-
OR state.materialized_sequence IS NULL
|
|
269
|
-
OR state.materialized_sequence < inbox.global_sequence)
|
|
270
|
-
ORDER BY inbox.entity_id
|
|
271
|
-
`);
|
|
272
|
-
this.#resolveMaterializedHistory = database.prepare(`
|
|
273
|
-
UPDATE record_inbox SET resolved_at = ?
|
|
274
|
-
WHERE authority_id = ? AND entity_id = ? AND global_sequence <= ?
|
|
275
|
-
AND resolved_at IS NULL
|
|
276
|
-
`);
|
|
277
|
-
this.#baselineRows = database.prepare(`
|
|
278
|
-
SELECT inbox.authority_id AS authorityId,
|
|
279
|
-
inbox.entity_id AS entityId,
|
|
280
|
-
MAX(inbox.global_sequence) AS resolvedThrough
|
|
281
|
-
FROM record_inbox AS inbox
|
|
282
|
-
JOIN authority_snapshot_baselines AS baseline
|
|
283
|
-
ON baseline.authority_id = inbox.authority_id
|
|
284
|
-
LEFT JOIN entity_apply_state AS state
|
|
285
|
-
ON state.authority_id = inbox.authority_id
|
|
286
|
-
AND state.entity_id = inbox.entity_id
|
|
287
|
-
WHERE inbox.delivery_sequence <= baseline.delivery_sequence
|
|
288
|
-
AND inbox.global_sequence > COALESCE(state.resolved_through, 0)
|
|
289
|
-
GROUP BY inbox.authority_id, inbox.entity_id
|
|
290
|
-
`);
|
|
291
|
-
this.#baselineIntents = database.prepare(`
|
|
292
|
-
SELECT intent.intent_json AS intentJson
|
|
293
|
-
FROM entity_apply_intents AS intent
|
|
294
|
-
JOIN record_inbox AS target
|
|
295
|
-
ON target.authority_id = intent.authority_id
|
|
296
|
-
AND target.entity_id = intent.entity_id
|
|
297
|
-
AND target.global_sequence = json_extract(intent.intent_json, '$.throughSequence')
|
|
298
|
-
JOIN authority_snapshot_baselines AS baseline
|
|
299
|
-
ON baseline.authority_id = intent.authority_id
|
|
300
|
-
WHERE target.delivery_sequence <= baseline.delivery_sequence
|
|
301
|
-
`);
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* A verified notebook row is the last exact materialization this machine
|
|
305
|
-
* proved. When retained Inbox history contains that same complete result,
|
|
306
|
-
* the disk does not need to replay it: adopt the newest equal sequence as
|
|
307
|
-
* Apply's baseline and leave every later different result as ordinary work.
|
|
308
|
-
*
|
|
309
|
-
* This runs before the installed root becomes eligible to Apply, or before
|
|
310
|
-
* the Apply rail starts. Returned superseded intents let the host remove any
|
|
311
|
-
* private preparation left by an interrupted older process.
|
|
312
|
-
*/
|
|
313
|
-
adoptVerifiedMaterialization(rootUUID = null) {
|
|
314
|
-
const supersededIntents = [];
|
|
315
|
-
let settledRecords = 0;
|
|
316
|
-
this.#database.transaction(() => {
|
|
317
|
-
for (const row of this.#baselineRows.all()) {
|
|
318
|
-
const prior = this.#state.get(row.authorityId, row.entityId);
|
|
319
|
-
this.#upsertState.run(row.entityId, row.authorityId, row.resolvedThrough, prior?.materializedSequence ?? null, prior?.materializedRecordJson ?? null);
|
|
320
|
-
}
|
|
321
|
-
for (const { intentJson } of this.#baselineIntents.all()) {
|
|
322
|
-
const intent = JSON.parse(intentJson);
|
|
323
|
-
assertApplyIntent(intent);
|
|
324
|
-
this.#deleteIntent.run(intent.authorityId, intent.entityId);
|
|
325
|
-
this.#verified.delete(intent.entityId);
|
|
326
|
-
supersededIntents.push(intent);
|
|
327
|
-
}
|
|
328
|
-
})();
|
|
329
|
-
const matches = this.#materializedMatches.all(rootUUID, rootUUID);
|
|
330
|
-
this.#database.transaction(() => {
|
|
331
|
-
for (const match of matches) {
|
|
332
|
-
const accepted = decodeAcceptedEntityRecord(match.recordJson);
|
|
333
|
-
const notebook = {
|
|
334
|
-
uuid: match.entityId,
|
|
335
|
-
type: match.type,
|
|
336
|
-
parentUUID: match.parentUUID,
|
|
337
|
-
name: match.name,
|
|
338
|
-
status: match.status,
|
|
339
|
-
version: match.version,
|
|
340
|
-
payloadVersion: match.payloadVersion,
|
|
341
|
-
fileMode: portableFileMode(match.type, match.filesystemMode),
|
|
342
|
-
transportVersion: match.transportVersion,
|
|
343
|
-
};
|
|
344
|
-
if (!sameRecords([notebook], [accepted.change.result]))
|
|
345
|
-
continue;
|
|
346
|
-
const prior = this.#state.get(match.authorityId, match.entityId);
|
|
347
|
-
if (!prior || prior.resolvedThrough <= match.globalSequence) {
|
|
348
|
-
this.#upsertState.run(match.entityId, match.authorityId, match.globalSequence, match.globalSequence, JSON.stringify(accepted.change.result));
|
|
349
|
-
}
|
|
350
|
-
settledRecords += this.#resolveMaterializedHistory.run(this.#now(), match.authorityId, match.entityId, match.globalSequence).changes;
|
|
351
|
-
if (match.intentJson) {
|
|
352
|
-
const intent = JSON.parse(match.intentJson);
|
|
353
|
-
assertApplyIntent(intent);
|
|
354
|
-
if (intent.throughSequence <= match.globalSequence) {
|
|
355
|
-
this.#deleteIntent.run(intent.authorityId, intent.entityId);
|
|
356
|
-
this.#verified.delete(intent.entityId);
|
|
357
|
-
supersededIntents.push(intent);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
})();
|
|
362
|
-
return Object.freeze({
|
|
363
|
-
settledRecords,
|
|
364
|
-
supersededIntents: Object.freeze(supersededIntents),
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
readApplyWork(limit, afterCursor) {
|
|
368
|
-
const all = this.#candidateEntities.all()
|
|
66
|
+
`).all()
|
|
369
67
|
.map(({ entityId }) => entityId)
|
|
370
68
|
.filter((entityId) => afterCursor === null || entityId > afterCursor);
|
|
371
69
|
const materializable = [];
|
|
@@ -389,197 +87,204 @@ export class EntityApplySqliteStore {
|
|
|
389
87
|
});
|
|
390
88
|
}
|
|
391
89
|
#readApplyWork(entityId) {
|
|
392
|
-
const intent = this.#
|
|
90
|
+
const intent = readIntent(this.#database, entityId);
|
|
393
91
|
const authorityId = intent?.authorityId ?? this.#authorityFor(entityId);
|
|
394
92
|
if (!authorityId)
|
|
395
93
|
return null;
|
|
396
|
-
const state = this.#
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
const
|
|
401
|
-
if (
|
|
402
|
-
|
|
403
|
-
const firstRecord = decodeAcceptedEntityRecord(first.recordJson);
|
|
404
|
-
resolvedThrough = firstRecord.globalSequence - 1;
|
|
405
|
-
}
|
|
94
|
+
const { state, resolvedThrough, rows } = applyResolution(this.#database, authorityId, entityId);
|
|
95
|
+
const materialized = state?.materializedSequence && state.materializedRecordJson
|
|
96
|
+
? { globalSequence: state.materializedSequence, record: assertRecord(JSON.parse(state.materializedRecordJson)) }
|
|
97
|
+
: null;
|
|
98
|
+
const retired = intent ? readRetirement(this.#database, intent) : null;
|
|
99
|
+
if (retired)
|
|
100
|
+
return { authorityId, entityId, resolvedThrough, materialized, records: [], intent, retirement: retired.retirement };
|
|
406
101
|
const records = rows.map(({ recordJson }) => decodeAcceptedEntityRecord(recordJson));
|
|
407
|
-
if (
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
intent,
|
|
427
|
-
};
|
|
102
|
+
if (!intent) {
|
|
103
|
+
const target = records.at(-1);
|
|
104
|
+
if (!target)
|
|
105
|
+
return null;
|
|
106
|
+
const parent = target.change.result.parentUUID;
|
|
107
|
+
if (!(this.#locallyPresent(entityId) || (parent !== null && this.#locallyPresent(parent)))
|
|
108
|
+
|| !this.#isLocallyEligible(target.change.result))
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
return { authorityId, entityId, resolvedThrough, materialized, records, intent };
|
|
112
|
+
}
|
|
113
|
+
#locallyPresent(uuid) {
|
|
114
|
+
return cachedStatement(this.#database, `SELECT 1 FROM entities WHERE uuid = ?
|
|
115
|
+
UNION ALL SELECT 1 FROM detection_notebook WHERE uuid = ? LIMIT 1`).get(uuid, uuid) !== undefined;
|
|
116
|
+
}
|
|
117
|
+
#authorityFor(entityId) {
|
|
118
|
+
const row = cachedStatement(this.#database, `SELECT authority_id AS authorityId FROM record_inbox
|
|
119
|
+
WHERE entity_id = ? ORDER BY global_sequence DESC LIMIT 1`).get(entityId);
|
|
120
|
+
return row?.authorityId ?? null;
|
|
428
121
|
}
|
|
429
122
|
hasLocalWorkAfter(authorityId, entityId, targetSequence) {
|
|
430
|
-
return this.#
|
|
123
|
+
return hasLocalWorkAfter(this.#database, authorityId, entityId, targetSequence);
|
|
431
124
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
this.#
|
|
125
|
+
/** The save re-answers every database condition; placement is disk, so
|
|
126
|
+
* it is proved here before the save is posted. Apply settles a page's
|
|
127
|
+
* bookkeeping together, so each proof and each answer is a turn boundary:
|
|
128
|
+
* one saver batch answers many resolutions, and no number of them runs in
|
|
129
|
+
* one activation. */
|
|
130
|
+
async resolveOwnPublication(work, target) {
|
|
131
|
+
await turnBoundary();
|
|
132
|
+
const publication = { authorityId: work.authorityId, entityId: work.entityId, resolvedThrough: work.resolvedThrough,
|
|
133
|
+
globalSequence: target.globalSequence, mutationId: target.mutationId };
|
|
134
|
+
const own = ownPublication(this.#database, publication);
|
|
135
|
+
// The history still starts where the work saw it and ends at the target,
|
|
136
|
+
// so the work's records through the target are exactly what it settles.
|
|
137
|
+
if (!own || !this.#holdsOwnPlacement(own.accepted.change.result, work.records.filter(record => record.globalSequence <= target.globalSequence)))
|
|
138
|
+
return false;
|
|
139
|
+
const { value: resolved } = await save(this.#file, "apply.resolveOwnPublication", { ...publication, resolvedAt: this.#now() });
|
|
140
|
+
await turnBoundary();
|
|
141
|
+
if (resolved)
|
|
142
|
+
this.#onOwnPublicationResolved(target);
|
|
143
|
+
return resolved;
|
|
144
|
+
}
|
|
145
|
+
async beginIntent(intent) {
|
|
146
|
+
await save(this.#file, "apply.beginIntent", intent);
|
|
442
147
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
148
|
+
recoveryLocation(intent) {
|
|
149
|
+
return recoveryLocation(this.#database, intent);
|
|
150
|
+
}
|
|
151
|
+
/** Publish where this attempt's recovery receipt lives, unless another
|
|
152
|
+
* unfinished operation owns part of its scope. The save decides against
|
|
153
|
+
* every binding posted before it. */
|
|
154
|
+
async bindRecoveryLocation(intent, directory, scope) {
|
|
155
|
+
return (await save(this.#file, "apply.bindRecovery", { intent, directory, scope })).value;
|
|
156
|
+
}
|
|
157
|
+
async setIntentPhase(intent) {
|
|
158
|
+
await save(this.#file, "apply.setIntentPhase", intent);
|
|
451
159
|
}
|
|
452
160
|
cancelIntent(intent) {
|
|
453
|
-
|
|
454
|
-
if (!sameIntent(existing, intent))
|
|
455
|
-
throw new Error("Apply cancel changed intent identity");
|
|
456
|
-
this.#verified.delete(intent.entityId);
|
|
457
|
-
this.#deleteIntent.run(intent.authorityId, intent.entityId);
|
|
458
|
-
this.#onIntentFinished(intent);
|
|
161
|
+
return this.#commitRetirement(intent, { kind: "cancelled" });
|
|
459
162
|
}
|
|
460
|
-
|
|
461
|
-
this.#
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}
|
|
163
|
+
stageRetirement(intent, purpose, description, evidence = {}) {
|
|
164
|
+
requireIntent(this.#database, intent);
|
|
165
|
+
const { repair, proof = witnessProof([]), attribution = null } = evidence;
|
|
166
|
+
if ((description.contract === "amalgm.apply-no-ground@1") !== isConstructType(intent.targetType)) {
|
|
167
|
+
throw new Error("Apply cleanup disposition does not belong to its entity type");
|
|
168
|
+
}
|
|
169
|
+
if (repair && (purpose.kind !== "cancelled" || isConstructType(intent.targetType))) {
|
|
170
|
+
throw new Error("Apply placement repair belongs only to cancelled filesystem effects");
|
|
171
|
+
}
|
|
172
|
+
this.#cleanupProof.set(intent.entityId, { intent: Object.freeze({ ...intent }),
|
|
173
|
+
purpose: Object.freeze({ ...purpose }), description: JSON.parse(JSON.stringify(description)), proof, attribution,
|
|
174
|
+
...(repair ? { repair: { ...repair, rows: Object.freeze(repair.rows.map(row => Object.freeze({ ...row }))) } } : {}) });
|
|
175
|
+
}
|
|
176
|
+
cleanupDescription(retirement) {
|
|
177
|
+
return ownedCleanup(this.#database, retirement);
|
|
178
|
+
}
|
|
179
|
+
async acknowledgeCleanup(retirement) {
|
|
180
|
+
await save(this.#file, "apply.acknowledgeCleanup", retirement);
|
|
181
|
+
}
|
|
182
|
+
/** Verify's rows as data: each repository observation's proof closes with
|
|
183
|
+
* the Verify proof, never on the saver thread. */
|
|
184
|
+
stageVerification(intent, ground, basis, proof) {
|
|
185
|
+
requireIntent(this.#database, intent);
|
|
186
|
+
if (isConstructType(intent.targetType))
|
|
187
|
+
throw new Error("construct verification cannot claim filesystem ground");
|
|
188
|
+
const detach = (rows) => Object.freeze(rows.map(({ repositoryObservation, ...row }) => Object.freeze({ ...row, record: Object.freeze({ ...row.record }),
|
|
189
|
+
...(repositoryObservation ? { repositoryObservation: dataOf(repositoryObservation) } : {}) })));
|
|
190
|
+
this.#verified.set(intent.entityId, { intent: Object.freeze({ ...intent }), basis, proof,
|
|
191
|
+
ground: Object.freeze({ observed: detach(ground.observed), shared: detach(ground.shared),
|
|
192
|
+
removedObserved: Object.freeze([...new Set(ground.removedObserved)]),
|
|
193
|
+
removedShared: Object.freeze([...new Set(ground.removedShared)]),
|
|
194
|
+
}) });
|
|
195
|
+
}
|
|
196
|
+
/** Product verification has no filesystem projection. The product remains
|
|
197
|
+
* the owner of its running state and ledger; this stages its exact receipt. */
|
|
198
|
+
stageConstructVerification(intent, target) {
|
|
199
|
+
requireIntent(this.#database, intent);
|
|
200
|
+
if (!isConstructType(intent.targetType) || target.uuid !== intent.entityId
|
|
201
|
+
|| target.type !== intent.targetType || target.version !== intent.targetState) {
|
|
202
|
+
throw new Error("construct Verify does not describe its exact Apply target");
|
|
203
|
+
}
|
|
204
|
+
this.#verified.set(intent.entityId, { intent: Object.freeze({ ...intent }), ground: null, basis: null,
|
|
205
|
+
proof: witnessProof([]) });
|
|
466
206
|
}
|
|
467
207
|
completeIntent(intent, completion) {
|
|
208
|
+
return this.#commitRetirement(intent, completion);
|
|
209
|
+
}
|
|
210
|
+
async #commitRetirement(intent, completion) {
|
|
211
|
+
const verified = this.#verified.get(intent.entityId), cleanup = this.#cleanupProof.get(intent.entityId);
|
|
468
212
|
try {
|
|
469
|
-
const
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
const prior = this.#state.get(intent.authorityId, intent.entityId);
|
|
474
|
-
const verified = this.#verified.get(intent.entityId);
|
|
475
|
-
if (completion.kind === "materialized" && !verified) {
|
|
476
|
-
throw new Error("Apply completion has no exact Verify evidence");
|
|
477
|
-
}
|
|
478
|
-
const targetRow = this.#targetRecord.get(intent.authorityId, intent.entityId, intent.throughSequence);
|
|
479
|
-
if (!targetRow)
|
|
480
|
-
throw new Error("Apply target disappeared from its retained Inbox");
|
|
481
|
-
const target = decodeAcceptedEntityRecord(targetRow.recordJson);
|
|
482
|
-
this.#database.transaction(() => {
|
|
483
|
-
if (completion.kind === "materialized") {
|
|
484
|
-
const membershipContainers = new Set();
|
|
485
|
-
for (const uuid of verified.removals) {
|
|
486
|
-
const old = this.#notebookAtUuid.get(uuid);
|
|
487
|
-
if (old?.parentUUID)
|
|
488
|
-
membershipContainers.add(old.parentUUID);
|
|
489
|
-
this.#deleteEntity.run(uuid);
|
|
490
|
-
this.#deleteNotebook.run(uuid);
|
|
491
|
-
}
|
|
492
|
-
for (const row of verified.rows) {
|
|
493
|
-
const old = this.#notebookAtUuid.get(row.record.uuid);
|
|
494
|
-
if (old?.parentUUID)
|
|
495
|
-
membershipContainers.add(old.parentUUID);
|
|
496
|
-
if (row.record.parentUUID)
|
|
497
|
-
membershipContainers.add(row.record.parentUUID);
|
|
498
|
-
if (row.record.type === "workspace" || row.record.type === "folder") {
|
|
499
|
-
membershipContainers.add(row.record.uuid);
|
|
500
|
-
}
|
|
501
|
-
this.#deleteEntity.run(row.record.uuid);
|
|
502
|
-
}
|
|
503
|
-
for (const row of verified.rows) {
|
|
504
|
-
if (row.record.status === "active") {
|
|
505
|
-
try {
|
|
506
|
-
this.#upsertEntity.run(...rowValues(row));
|
|
507
|
-
}
|
|
508
|
-
catch (error) {
|
|
509
|
-
const occupant = this.#entitySlot.get(row.resourceId, row.rootUUID, row.relativePath);
|
|
510
|
-
throw new Error(`Apply projection could not place ${row.record.uuid} at `
|
|
511
|
-
+ `${row.rootUUID}:${row.relativePath}; occupied by `
|
|
512
|
-
+ `${occupant?.uuid ?? "no retained row"} (${occupant?.absolutePath ?? "unknown"}); `
|
|
513
|
-
+ `incoming=${row.record.type}:${row.record.payloadVersion ?? "none"}; `
|
|
514
|
-
+ `occupant=${occupant?.type ?? "none"}:${occupant?.payloadVersion ?? "none"}`, { cause: error });
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
else {
|
|
518
|
-
this.#deleteEntity.run(row.record.uuid);
|
|
519
|
-
}
|
|
520
|
-
this.#upsertNotebook.run(...rowValues(row));
|
|
521
|
-
}
|
|
522
|
-
this.#refreshMembershipVersions(membershipContainers);
|
|
523
|
-
}
|
|
524
|
-
this.#resolveInbox.run(this.#now(), intent.authorityId, intent.entityId, intent.fromSequence, intent.throughSequence);
|
|
525
|
-
this.#upsertState.run(intent.entityId, intent.authorityId, intent.throughSequence, completion.kind === "materialized"
|
|
526
|
-
? intent.throughSequence
|
|
527
|
-
: prior?.materializedSequence ?? null, completion.kind === "materialized"
|
|
528
|
-
? JSON.stringify(target.change.result)
|
|
529
|
-
: prior?.materializedRecordJson ?? null);
|
|
530
|
-
const removed = this.#deleteIntent.run(intent.authorityId, intent.entityId);
|
|
531
|
-
if (removed.changes !== 1)
|
|
532
|
-
throw new Error("Apply intent disappeared before completion");
|
|
533
|
-
})();
|
|
534
|
-
this.#verified.delete(intent.entityId);
|
|
213
|
+
const retirement = await this.#commitTerminalOutcome(intent, completion, verified, cleanup);
|
|
214
|
+
this.#release(intent, verified, cleanup);
|
|
215
|
+
return retirement;
|
|
535
216
|
}
|
|
536
|
-
|
|
537
|
-
this
|
|
217
|
+
catch (error) {
|
|
218
|
+
// Only this attempt's own staged evidence retires with its failure.
|
|
219
|
+
this.#release(intent, verified, cleanup);
|
|
220
|
+
this.#onAttemptFailed(intent);
|
|
221
|
+
throw error;
|
|
538
222
|
}
|
|
539
223
|
}
|
|
540
|
-
|
|
541
|
-
this.#
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
* this machine. No container record is emitted for this derivation. */
|
|
547
|
-
#refreshMembershipVersions(uuids) {
|
|
548
|
-
for (const uuid of uuids) {
|
|
549
|
-
const row = this.#notebookAtUuid.get(uuid);
|
|
550
|
-
if (!row || (row.type !== "workspace" && row.type !== "folder"))
|
|
551
|
-
continue;
|
|
552
|
-
const children = this.#notebookChildren.all(uuid);
|
|
553
|
-
const version = canonicalVersion({
|
|
554
|
-
type: row.type,
|
|
555
|
-
parentUUID: row.parentUUID,
|
|
556
|
-
name: row.name,
|
|
557
|
-
status: row.status,
|
|
558
|
-
payloadVersion: membershipHash(children, sha256Hex),
|
|
559
|
-
}, sha256Hex);
|
|
560
|
-
this.#updateEntityVersion.run(version, uuid);
|
|
561
|
-
this.#updateNotebookVersion.run(version, uuid);
|
|
224
|
+
#release(intent, verified, cleanup) {
|
|
225
|
+
if (verified && this.#verified.get(intent.entityId) === verified && sameIntent(verified.intent, intent)) {
|
|
226
|
+
this.#verified.delete(intent.entityId);
|
|
227
|
+
}
|
|
228
|
+
if (cleanup && this.#cleanupProof.get(intent.entityId) === cleanup && sameIntent(cleanup.intent, intent)) {
|
|
229
|
+
this.#cleanupProof.delete(intent.entityId);
|
|
562
230
|
}
|
|
563
231
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
232
|
+
/** Every terminal prerequisite, read from local state now. Semantic closing
|
|
233
|
+
* awaits, so the commit asks again afterwards rather than trusting a read
|
|
234
|
+
* taken before the wait. */
|
|
235
|
+
#terminalPrerequisites(intent, completion, verified, cleanup) {
|
|
236
|
+
const repeated = readRetirement(this.#database, intent);
|
|
237
|
+
if (repeated) {
|
|
238
|
+
if (repeated.retirement.purpose.kind !== completion.kind)
|
|
239
|
+
throw new Error("Apply terminal purpose cannot change");
|
|
240
|
+
return { repeated: repeated.retirement };
|
|
241
|
+
}
|
|
242
|
+
const existing = requireIntent(this.#database, intent);
|
|
243
|
+
if (completion.kind !== "cancelled" && existing.phase !== "revealed") {
|
|
244
|
+
throw new Error("Apply completion does not match its revealed intent");
|
|
245
|
+
}
|
|
246
|
+
if (completion.kind === "materialized" && (!verified || !sameIntent(verified.intent, intent)
|
|
247
|
+
|| this.#verified.get(intent.entityId) !== verified)) {
|
|
248
|
+
throw new Error("Apply completion has no exact Verify evidence");
|
|
249
|
+
}
|
|
250
|
+
if (!cleanup || !sameIntent(cleanup.intent, intent) || cleanup.purpose.kind !== completion.kind
|
|
251
|
+
|| this.#cleanupProof.get(intent.entityId) !== cleanup)
|
|
252
|
+
throw new Error("Apply retirement has no proven cleanup description");
|
|
253
|
+
return { cleanup };
|
|
567
254
|
}
|
|
568
|
-
#
|
|
569
|
-
const
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
255
|
+
async #commitTerminalOutcome(intent, completion, verified, staged) {
|
|
256
|
+
const opening = this.#terminalPrerequisites(intent, completion, verified, staged);
|
|
257
|
+
if ("repeated" in opening)
|
|
258
|
+
return opening.repeated;
|
|
259
|
+
// Git and other slow owners re-answer first; native witnesses and
|
|
260
|
+
// ownership close as the save is posted, and the save re-reads every
|
|
261
|
+
// database fact the outcome depends on.
|
|
262
|
+
const proofs = [opening.cleanup.proof, ...(opening.cleanup.repair ? [opening.cleanup.repair.proof] : []),
|
|
263
|
+
...(completion.kind === "materialized" ? [verified.proof] : [])];
|
|
264
|
+
await sourceProofs(proofs).semantic();
|
|
265
|
+
const closing = this.#terminalPrerequisites(intent, completion, verified, staged);
|
|
266
|
+
if ("repeated" in closing)
|
|
267
|
+
return closing.repeated;
|
|
268
|
+
const { cleanup } = closing;
|
|
269
|
+
for (const proof of proofs)
|
|
270
|
+
closePhysically(proof);
|
|
271
|
+
const retirement = { token: randomUUID(), intent, purpose: completion };
|
|
272
|
+
const ground = completion.kind === "materialized" && verified?.ground && verified.basis
|
|
273
|
+
? { ground: verified.ground, basis: verified.basis.toData() } : null;
|
|
274
|
+
await save(this.#file, "apply.retire", {
|
|
275
|
+
retirement,
|
|
276
|
+
cleanup: cleanup.description,
|
|
277
|
+
attribution: cleanup.attribution?.toData() ?? null,
|
|
278
|
+
repair: cleanup.repair ? { rows: cleanup.repair.rows, basis: cleanup.repair.basis.toData() } : null,
|
|
279
|
+
verified: ground,
|
|
280
|
+
resolvedAt: this.#now(),
|
|
281
|
+
});
|
|
282
|
+
this.#onIntentFinished(intent);
|
|
283
|
+
return retirement;
|
|
577
284
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
if (!existing)
|
|
581
|
-
throw new Error(`entity ${intent.entityId} has no durable Apply intent`);
|
|
582
|
-
return existing;
|
|
285
|
+
close() {
|
|
286
|
+
this.#database.close();
|
|
583
287
|
}
|
|
584
288
|
}
|
|
289
|
+
const dataOf = ({ proof: _proof, ...pair }) => pair;
|
|
585
290
|
//# sourceMappingURL=entity-apply-store.js.map
|