@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
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register's enclosing law. W's ground may enclose workspaces this machine
|
|
3
|
+
* already materializes. Each one the authority holds as its own root is
|
|
4
|
+
* absorbed: its accepted subtree joins W's head with every identity kept,
|
|
5
|
+
* and its root leaves the head in the same commit. Only its root record
|
|
6
|
+
* changes: it is re-placed where W's walk found it, under its parentUUID
|
|
7
|
+
* and name there, and a `workspace`, which only a root can be, becomes a
|
|
8
|
+
* `folder`.
|
|
9
|
+
*
|
|
10
|
+
* Absorbed ground rides as each inventory already holds it. The head
|
|
11
|
+
* carries its accepted records, and sharing (B) keeps its own rows
|
|
12
|
+
* (declaration-save.ts), so local work there, including an identity the walk
|
|
13
|
+
* found moved out of it, stays owed to ordinary Detect. Only identities an
|
|
14
|
+
* inventory lacks enter from the walk.
|
|
15
|
+
*/
|
|
16
|
+
import { canonicalVersion, eachStep, refusal, } from "@amalgm/live";
|
|
17
|
+
import { pathWithin } from "./files-register-host.js";
|
|
18
|
+
import { acceptedResultRootResolver, acceptedRoot, deriveContainerVersionsSteps, } from "./graph-publication.js";
|
|
19
|
+
import { eachInTurns, finishStepsInTurns } from "./turns.js";
|
|
20
|
+
/** The bound workspaces W's ground encloses. */
|
|
21
|
+
export function enclosedWorkspaces(bindings, workspaceId, directory) {
|
|
22
|
+
return bindings.filter((binding) => binding.workspaceId !== workspaceId && pathWithin(directory, binding.directory));
|
|
23
|
+
}
|
|
24
|
+
/** The root AV holds this identity in, or null when AV never accepted it. */
|
|
25
|
+
export async function acceptedHolder(view, uuid) {
|
|
26
|
+
const tailed = view.tail.results.find((result) => result.uuid === uuid);
|
|
27
|
+
if (tailed)
|
|
28
|
+
return acceptedResultRootResolver(view.tail.results, view.located)(tailed);
|
|
29
|
+
return view.head.graph.locate(uuid);
|
|
30
|
+
}
|
|
31
|
+
/** The enclosed workspaces W absorbs on this view. One held inside another
|
|
32
|
+
* enclosed workspace rides with it. Anything else refuses: ground whose own
|
|
33
|
+
* declaration the authority has not accepted, or that it holds inside a root
|
|
34
|
+
* this machine does not enclose, would move identities W never observed. */
|
|
35
|
+
export async function absorbedRoots(view, workspaceId, enclosed, held) {
|
|
36
|
+
const enclosedIds = new Set(enclosed.map((entry) => entry.workspaceId));
|
|
37
|
+
const absorbed = [];
|
|
38
|
+
for (const { workspaceId: inner, directory } of enclosed) {
|
|
39
|
+
const refused = (why) => refusal(`files register refuses workspace ${workspaceId}: `
|
|
40
|
+
+ `the workspace ${inner} it encloses at ${directory} ${why}`);
|
|
41
|
+
if (held.has(inner))
|
|
42
|
+
throw refused("still awaits its own registration; register it again first");
|
|
43
|
+
const holder = await acceptedHolder(view, inner);
|
|
44
|
+
if (holder === null)
|
|
45
|
+
throw refused("was never accepted");
|
|
46
|
+
if (holder !== inner) {
|
|
47
|
+
if (enclosedIds.has(holder))
|
|
48
|
+
continue;
|
|
49
|
+
throw refused(`is accepted inside root ${holder}, which this workspace does not enclose`);
|
|
50
|
+
}
|
|
51
|
+
const tailed = view.tail.results.find((result) => result.uuid === inner);
|
|
52
|
+
const status = (tailed ?? await view.head.graph.rootRecord(inner)).status;
|
|
53
|
+
if (status !== "active")
|
|
54
|
+
throw refused(`is ${status} in the accepted graph`);
|
|
55
|
+
absorbed.push(inner);
|
|
56
|
+
}
|
|
57
|
+
return absorbed;
|
|
58
|
+
}
|
|
59
|
+
/** An absorbed root's own record, re-placed where W's walk found it. */
|
|
60
|
+
export function placeAbsorbedRoot(record, placement, sha256Hex) {
|
|
61
|
+
const type = record.type === "workspace" ? "folder" : record.type;
|
|
62
|
+
const placed = { ...record, type, parentUUID: placement.parentUUID, name: placement.name };
|
|
63
|
+
return { ...placed, version: canonicalVersion(placed, sha256Hex) };
|
|
64
|
+
}
|
|
65
|
+
/** D's records for W: the walk outside absorbed ground, minus identities AV
|
|
66
|
+
* already holds there, plus each absorbed root exactly as AV holds it with
|
|
67
|
+
* its root re-placed. Container versions derive from D's own membership. */
|
|
68
|
+
export async function absorbingDeclaration(view, workspaceId, walked, absorbed, sha256Hex) {
|
|
69
|
+
if (absorbed.length === 0)
|
|
70
|
+
return walked;
|
|
71
|
+
const walkedById = new Map();
|
|
72
|
+
await eachInTurns(walked, (record) => { walkedById.set(record.uuid, record); });
|
|
73
|
+
const accepted = new Map();
|
|
74
|
+
for (const root of absorbed) {
|
|
75
|
+
const placement = walkedById.get(root);
|
|
76
|
+
if (!placement) {
|
|
77
|
+
throw refusal(`files register refuses workspace ${workspaceId}: its enrollment policy leaves out `
|
|
78
|
+
+ `the workspace ${root} it encloses, so that workspace has no place in its graph`);
|
|
79
|
+
}
|
|
80
|
+
await eachInTurns((await acceptedRoot(view, root, sha256Hex)).values(), (record) => {
|
|
81
|
+
accepted.set(record.uuid, record.uuid === root ? placeAbsorbedRoot(record, placement, sha256Hex) : record);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const inside = await finishStepsInTurns(absorbedGroundSteps(walked, absorbed));
|
|
85
|
+
const records = [];
|
|
86
|
+
await eachInTurns(walked, (record) => {
|
|
87
|
+
if (!inside.has(record.uuid) && !accepted.has(record.uuid))
|
|
88
|
+
records.push(record);
|
|
89
|
+
});
|
|
90
|
+
await eachInTurns(accepted.values(), (record) => { records.push(record); });
|
|
91
|
+
return finishStepsInTurns(deriveContainerVersionsSteps(records, sha256Hex));
|
|
92
|
+
}
|
|
93
|
+
/** Every walked identity inside an absorbed root, the root included. */
|
|
94
|
+
function* absorbedGroundSteps(walked, absorbed) {
|
|
95
|
+
const children = new Map();
|
|
96
|
+
yield* eachStep(walked, ({ uuid, parentUUID }) => {
|
|
97
|
+
if (parentUUID === null)
|
|
98
|
+
return;
|
|
99
|
+
const siblings = children.get(parentUUID);
|
|
100
|
+
if (siblings)
|
|
101
|
+
siblings.push(uuid);
|
|
102
|
+
else
|
|
103
|
+
children.set(parentUUID, [uuid]);
|
|
104
|
+
});
|
|
105
|
+
const inside = new Set();
|
|
106
|
+
const pending = [...absorbed];
|
|
107
|
+
function* reached() {
|
|
108
|
+
for (let uuid = pending.pop(); uuid !== undefined; uuid = pending.pop())
|
|
109
|
+
yield uuid;
|
|
110
|
+
}
|
|
111
|
+
yield* eachStep(reached(), (uuid) => {
|
|
112
|
+
if (inside.has(uuid))
|
|
113
|
+
return;
|
|
114
|
+
inside.add(uuid);
|
|
115
|
+
pending.push(...children.get(uuid) ?? []);
|
|
116
|
+
});
|
|
117
|
+
return inside;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=declaration-absorption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declaration-absorption.js","sourceRoot":"","sources":["../src/declaration-absorption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,OAAO,GAKR,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EACL,0BAA0B,EAC1B,YAAY,EACZ,4BAA4B,GAE7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAQ7D,gDAAgD;AAChD,MAAM,UAAU,kBAAkB,CAChC,QAAmC,EACnC,WAAmB,EACnB,SAAiB;IAEjB,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,WAAW,IAAI,UAAU,CAAC,SAAS,EAAE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,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QAC7B,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type Database from "better-sqlite3";
|
|
2
|
+
import { type CloudEntityRecord, type Sha256Hex } from "@amalgm/live";
|
|
3
|
+
import { type ContentBoundary } from "./content-clock.js";
|
|
4
|
+
import type { GroundRow } from "./ground-row.js";
|
|
5
|
+
export interface DeclarationChain {
|
|
6
|
+
/** The core records D declares: the reference, and its folder when the
|
|
7
|
+
* accepted view lacks it. */
|
|
8
|
+
readonly records: readonly CloudEntityRecord[];
|
|
9
|
+
/** Rows for the chain's two addresses, reference first, as observed when
|
|
10
|
+
* derived. */
|
|
11
|
+
readonly chained: readonly GroundRow[];
|
|
12
|
+
/** What local ground named at each chained address when derived. */
|
|
13
|
+
readonly named: readonly (string | null)[];
|
|
14
|
+
/** B rows for exactly the declared records. */
|
|
15
|
+
readonly shared: readonly GroundRow[];
|
|
16
|
+
/** The containers whose membership the chain decides: its folder, then
|
|
17
|
+
* the core root. */
|
|
18
|
+
readonly containers: readonly string[];
|
|
19
|
+
}
|
|
20
|
+
/** Derive W's chain in core ground. `accepted` is AV's core root. */
|
|
21
|
+
export declare function deriveDeclarationChain(input: {
|
|
22
|
+
readonly database: Database.Database;
|
|
23
|
+
readonly resourceId: string;
|
|
24
|
+
readonly userRoot: string;
|
|
25
|
+
readonly bindingDir: string;
|
|
26
|
+
readonly coreRootId: string;
|
|
27
|
+
readonly workspaceId: string;
|
|
28
|
+
readonly accepted: ReadonlyMap<string, CloudEntityRecord>;
|
|
29
|
+
/** The core root's content clock, stamped before this read. */
|
|
30
|
+
readonly clock: ContentBoundary | null;
|
|
31
|
+
/** The UUID minted for an address no row names; see `addressMinter`. */
|
|
32
|
+
readonly mint: (relativePath: string) => string;
|
|
33
|
+
readonly sha256Hex: Sha256Hex;
|
|
34
|
+
}): DeclarationChain;
|
|
35
|
+
/** One UUID per address, however often the chain is derived again. */
|
|
36
|
+
export declare function addressMinter(mint: () => string): (relativePath: string) => string;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The core records one Register declaration adds beside its root W: W's
|
|
3
|
+
* managed reference, and the `workspaces` folder that holds it while the
|
|
4
|
+
* accepted view lacks that folder.
|
|
5
|
+
*
|
|
6
|
+
* Identity follows local ground: sharing (B) first, then observation (O), so
|
|
7
|
+
* repeating a declaration names the same UUIDs. A folder no local row names
|
|
8
|
+
* adopts the accepted folder in its slot, and only then is a UUID minted, once
|
|
9
|
+
* per address for the whole Register.
|
|
10
|
+
* Both are read from the rendered reference itself: a reference that is gone
|
|
11
|
+
* ends the declaration, because D would name ground this machine no longer
|
|
12
|
+
* holds.
|
|
13
|
+
*
|
|
14
|
+
* Core Detect keeps observing the same ground while Register works. The chain
|
|
15
|
+
* is derived on the main thread; the only facts it read that can move before
|
|
16
|
+
* its commit are what local ground names at its two addresses. The commit
|
|
17
|
+
* reads those again on the saver thread and never writes a chain whose
|
|
18
|
+
* identities moved.
|
|
19
|
+
*/
|
|
20
|
+
import { lstatSync } from "node:fs";
|
|
21
|
+
import { basename, join } from "node:path";
|
|
22
|
+
import { canonicalVersion, membershipHash, refusal } from "@amalgm/live";
|
|
23
|
+
import { leafBoundary } from "./content-clock.js";
|
|
24
|
+
import { namedAt } from "./declaration-save.js";
|
|
25
|
+
import { findReference } from "./files-register-host.js";
|
|
26
|
+
import { sourceFingerprint } from "./source-signature.js";
|
|
27
|
+
const WORKSPACES = "workspaces";
|
|
28
|
+
/** Derive W's chain in core ground. `accepted` is AV's core root. */
|
|
29
|
+
export function deriveDeclarationChain(input) {
|
|
30
|
+
const { database, resourceId, userRoot, coreRootId, workspaceId, accepted, sha256Hex } = input;
|
|
31
|
+
const folderPath = join(userRoot, WORKSPACES);
|
|
32
|
+
const referencePath = findReference(folderPath, input.bindingDir, workspaceId);
|
|
33
|
+
if (referencePath === null) {
|
|
34
|
+
throw refusal(`workspace ${workspaceId} has no reference in ${folderPath}; run files register again`);
|
|
35
|
+
}
|
|
36
|
+
const name = basename(referencePath);
|
|
37
|
+
const referenceRelative = `${WORKSPACES}/${name}`;
|
|
38
|
+
const named = [referenceRelative, WORKSPACES].map(relativePath => namedAt(database, resourceId, coreRootId, relativePath));
|
|
39
|
+
const acceptedFolder = [...accepted.values()].find(record => record.parentUUID === coreRootId
|
|
40
|
+
&& record.name === WORKSPACES && record.type === "folder" && record.status === "active");
|
|
41
|
+
const folderId = named[1] ?? acceptedFolder?.uuid ?? input.mint(WORKSPACES);
|
|
42
|
+
const acceptedAsFolder = accepted.get(folderId);
|
|
43
|
+
if (acceptedAsFolder && (acceptedAsFolder.status !== "active" || acceptedAsFolder.type !== "folder")) {
|
|
44
|
+
throw refusal(`${folderPath} is ${acceptedAsFolder.status} ${acceptedAsFolder.type} ${folderId} in the accepted graph`);
|
|
45
|
+
}
|
|
46
|
+
const reference = canonical({
|
|
47
|
+
uuid: named[0] ?? input.mint(referenceRelative),
|
|
48
|
+
type: "reference", parentUUID: folderId, name, payloadVersion: workspaceId,
|
|
49
|
+
}, sha256Hex);
|
|
50
|
+
const folder = canonical({
|
|
51
|
+
uuid: folderId, type: "folder", parentUUID: coreRootId, name: WORKSPACES,
|
|
52
|
+
payloadVersion: membershipHash([{ uuid: reference.uuid, name }], sha256Hex),
|
|
53
|
+
}, sha256Hex);
|
|
54
|
+
const row = (record, relativePath, absolutePath) => {
|
|
55
|
+
const stats = lstatSync(absolutePath, { bigint: true });
|
|
56
|
+
return {
|
|
57
|
+
resourceId, rootUUID: coreRootId, uuid: record.uuid, type: record.type,
|
|
58
|
+
parentUUID: record.parentUUID, name: record.name, status: "active", version: record.version,
|
|
59
|
+
payloadVersion: record.payloadVersion, transportVersion: null, relativePath, absolutePath,
|
|
60
|
+
contentVerifiedNs: record.type === "reference" ? leafBoundary(input.clock, stats) : null,
|
|
61
|
+
...sourceFingerprint(stats),
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const chained = [row(reference, referenceRelative, referencePath), row(folder, WORKSPACES, folderPath)];
|
|
65
|
+
const declaresFolder = acceptedAsFolder === undefined;
|
|
66
|
+
return {
|
|
67
|
+
records: declaresFolder ? [reference, folder] : [reference],
|
|
68
|
+
chained,
|
|
69
|
+
named,
|
|
70
|
+
shared: declaresFolder ? chained : [chained[0]],
|
|
71
|
+
containers: [folderId, coreRootId],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** One UUID per address, however often the chain is derived again. */
|
|
75
|
+
export function addressMinter(mint) {
|
|
76
|
+
const minted = new Map();
|
|
77
|
+
return (relativePath) => {
|
|
78
|
+
let uuid = minted.get(relativePath);
|
|
79
|
+
if (uuid === undefined)
|
|
80
|
+
minted.set(relativePath, uuid = mint());
|
|
81
|
+
return uuid;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function canonical(fields, sha256Hex) {
|
|
85
|
+
const derived = fields.type === "folder";
|
|
86
|
+
return {
|
|
87
|
+
...fields,
|
|
88
|
+
status: "active",
|
|
89
|
+
// A folder's payload is its membership, which never travels.
|
|
90
|
+
payloadVersion: derived ? null : fields.payloadVersion,
|
|
91
|
+
fileMode: null,
|
|
92
|
+
transportVersion: null,
|
|
93
|
+
version: canonicalVersion({ ...fields, status: "active" }, sha256Hex),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=declaration-chain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declaration-chain.js","sourceRoot":"","sources":["../src/declaration-chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,C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AAG,EAAkB,CAAC;IACzC,OAAO,CAAC,YAAY,EAAE,EAAE;QACtB,IAAI,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACpC,IAAI,IAAI,KAAK,SAAS;YAAE,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,GAAG,IAAI,EAAE,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAChB,MAA2F,EAC3F,SAAoB;IAEpB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;IACzC,OAAO;QACL,GAAG,MAAM;QACT,MAAM,EAAE,QAAQ;QAChB,6DAA6D;QAC7D,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc;QACtD,QAAQ,EAAE,IAAI;QACd,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,gBAAgB,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC;KACtE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DeclarationChain } from "./declaration-chain.js";
|
|
2
|
+
import type { DeclarationJournalEntry } from "./declaration-journal.js";
|
|
3
|
+
import type { RepositorySealCandidate } from "./detection/seal-law.js";
|
|
4
|
+
import type { RepositoryObservationPair } from "./git-repository-host.js";
|
|
5
|
+
import type { GroundRow } from "./ground-row.js";
|
|
6
|
+
import type { SourceProof } from "./source-proof.js";
|
|
7
|
+
/** Core ground moved the chain after D was derived. */
|
|
8
|
+
export declare class DeclarationChainMoved extends Error {
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
/** W's walk: rows in its own root, admitted only while its witnesses close. */
|
|
12
|
+
export interface DeclarationWalk {
|
|
13
|
+
/** Its semantic phase has already answered. */
|
|
14
|
+
readonly source: SourceProof;
|
|
15
|
+
readonly repositoryObservations: readonly RepositoryObservationPair[];
|
|
16
|
+
readonly observed: readonly GroundRow[];
|
|
17
|
+
readonly selected: readonly GroundRow[];
|
|
18
|
+
/** Repository seals, installed only with the rows they describe. */
|
|
19
|
+
readonly seals: readonly RepositorySealCandidate[];
|
|
20
|
+
}
|
|
21
|
+
export declare function commitDeclaration(file: string, input: {
|
|
22
|
+
readonly resourceId: string;
|
|
23
|
+
readonly coreRootId: string;
|
|
24
|
+
readonly walk: DeclarationWalk | null;
|
|
25
|
+
/** The enclosed roots D absorbs. */
|
|
26
|
+
readonly absorbed: readonly string[];
|
|
27
|
+
/** Every bound root W's ground encloses. */
|
|
28
|
+
readonly enclosed: readonly string[];
|
|
29
|
+
readonly chain: DeclarationChain;
|
|
30
|
+
readonly journal: DeclarationJournalEntry;
|
|
31
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admit one Register declaration D beside its journal row, and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* Register admits D and the bookkeeping needed to install D: W's observation
|
|
5
|
+
* (O) and selection (B) exactly as its walk captured them, sharing's own rows
|
|
6
|
+
* of any ground W absorbs, W's chain in core, and the container versions
|
|
7
|
+
* those change in each inventory. Every other observation stays owed to
|
|
8
|
+
* ordinary Detect.
|
|
9
|
+
*
|
|
10
|
+
* The walk's witnesses are judged on a content thread and its admission runs
|
|
11
|
+
* here as the save posts, so W stands exactly as captured: Register holds W's
|
|
12
|
+
* ground, and saves commit in post order. The save (declaration-save.ts)
|
|
13
|
+
* reads the chain's addresses again on the saver thread, and a chain whose
|
|
14
|
+
* identities moved since D was derived commits nothing: the caller derives
|
|
15
|
+
* again. A re-fold after the authority moved commits no walk. W's rows
|
|
16
|
+
* already stand, and local work in W after its walk becomes ordinary Records
|
|
17
|
+
* once the declaration is accepted.
|
|
18
|
+
*/
|
|
19
|
+
import { closePhysicallyOffThread } from "./content-capture-pool.js";
|
|
20
|
+
import { save } from "./ground-saver.js";
|
|
21
|
+
/** Core ground moved the chain after D was derived. */
|
|
22
|
+
export class DeclarationChainMoved extends Error {
|
|
23
|
+
constructor() {
|
|
24
|
+
super("the declaration's core chain moved after its publication was derived");
|
|
25
|
+
this.name = "DeclarationChainMoved";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export async function commitDeclaration(file, input) {
|
|
29
|
+
const { walk } = input;
|
|
30
|
+
if (walk)
|
|
31
|
+
await closePhysicallyOffThread(walk.source, "complete");
|
|
32
|
+
const { value } = await save(file, "register.declare", {
|
|
33
|
+
resourceId: input.resourceId,
|
|
34
|
+
coreRootId: input.coreRootId,
|
|
35
|
+
walk: walk && {
|
|
36
|
+
repositoryObservations: walk.repositoryObservations.map(({ proof: _proof, ...pair }) => pair),
|
|
37
|
+
observed: walk.observed,
|
|
38
|
+
selected: walk.selected,
|
|
39
|
+
seals: walk.seals,
|
|
40
|
+
},
|
|
41
|
+
absorbed: input.absorbed,
|
|
42
|
+
enclosed: input.enclosed,
|
|
43
|
+
chain: input.chain,
|
|
44
|
+
journal: input.journal,
|
|
45
|
+
});
|
|
46
|
+
if (value === "moved")
|
|
47
|
+
throw new DeclarationChainMoved();
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=declaration-commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declaration-commit.js","sourceRoot":"","sources":["../src/declaration-commit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAMrE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,uDAAuD;AACvD,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C;QACE,KAAK,CAAC,sEAAsE,CAAC,CAAC;QAC9E,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAaD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAY,EAAE,KAUrD;IACC,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACvB,IAAI,IAAI;QAAE,MAAM,wBAAwB,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAClE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,kBAAkB,EAAE;QACrD,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,IAAI,EAAE,IAAI,IAAI;YACZ,sBAAsB,EAAE,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC;YAC7F,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB;QACD,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC,CAAC;IACH,IAAI,KAAK,KAAK,OAAO;QAAE,MAAM,IAAI,qBAAqB,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Register declaration holds its root back from ordinary Detect until the
|
|
3
|
+
* authority has accepted it. A bound root is held while a publication row
|
|
4
|
+
* owns its declaration, or while sharing (B) has never recorded the root:
|
|
5
|
+
* then the declaration exists only as a local binding that no Register has
|
|
6
|
+
* committed yet.
|
|
7
|
+
*
|
|
8
|
+
* Held ground is observed, never selected. Its reference in core stays out of
|
|
9
|
+
* Send, and its own root admits no Record, so ordinary Detect can never
|
|
10
|
+
* publish a declaration piecemeal before the graph head that introduces it.
|
|
11
|
+
* The publication outcome wakes the ground it held.
|
|
12
|
+
*/
|
|
13
|
+
import type Database from "better-sqlite3";
|
|
14
|
+
/** A Watch pass could not conclude because these roots are held: the
|
|
15
|
+
* publication outcome, never a timer, wakes them. */
|
|
16
|
+
export declare class DeclarationHeld extends Error {
|
|
17
|
+
readonly roots: readonly string[];
|
|
18
|
+
constructor(roots: readonly string[]);
|
|
19
|
+
}
|
|
20
|
+
/** The held subset of these bound roots, read on the caller's connection so
|
|
21
|
+
* it joins whatever read transaction the caller is in. */
|
|
22
|
+
export declare function heldDeclarations(database: Database.Database, bindings: Iterable<string>): Set<string>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cachedStatement } from "./sqlite.js";
|
|
2
|
+
/** A Watch pass could not conclude because these roots are held: the
|
|
3
|
+
* publication outcome, never a timer, wakes them. */
|
|
4
|
+
export class DeclarationHeld extends Error {
|
|
5
|
+
roots;
|
|
6
|
+
constructor(roots) {
|
|
7
|
+
super(`${roots.join(", ")} held by a Register declaration awaiting the authority`);
|
|
8
|
+
this.roots = roots;
|
|
9
|
+
this.name = "DeclarationHeld";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** The held subset of these bound roots, read on the caller's connection so
|
|
13
|
+
* it joins whatever read transaction the caller is in. */
|
|
14
|
+
export function heldDeclarations(database, bindings) {
|
|
15
|
+
const journaled = cachedStatement(database, "SELECT 1 FROM snapshot_publications WHERE declaration_root = ? LIMIT 1").pluck();
|
|
16
|
+
const shared = cachedStatement(database, "SELECT 1 FROM detection_notebook WHERE uuid = ?").pluck();
|
|
17
|
+
const held = new Set();
|
|
18
|
+
for (const root of bindings) {
|
|
19
|
+
if (journaled.get(root) !== undefined || shared.get(root) === undefined)
|
|
20
|
+
held.add(root);
|
|
21
|
+
}
|
|
22
|
+
return held;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=declaration-hold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declaration-hold.js","sourceRoot":"","sources":["../src/declaration-hold.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;qDACqD;AACrD,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACnB;IAArB,YAAqB,KAAwB;QAC3C,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC;QADhE,UAAK,GAAL,KAAK,CAAmB;QAE3C,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED;0DAC0D;AAC1D,MAAM,UAAU,gBAAgB,CAAC,QAA2B,EAAE,QAA0B;IACtF,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,EACxC,wEAAwE,CAAC,CAAC,KAAK,EAAE,CAAC;IACpF,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,EAAE,iDAAiD,CAAC,CAAC,KAAK,EAAE,CAAC;IACpG,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS;YAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Register declaration journal: one durable row per graph-head commit that
|
|
3
|
+
* introduces a workspace declaration D.
|
|
4
|
+
*
|
|
5
|
+
* Register is the only graph-head publisher, and every row it journals owns
|
|
6
|
+
* exactly one declaration, named by its root W. The row carries the small
|
|
7
|
+
* facts the authority must be told, the canonical operation bytes that submit
|
|
8
|
+
* as-is, and the pages the head newly names. D is never stored twice: its
|
|
9
|
+
* records are read back from those pages.
|
|
10
|
+
*
|
|
11
|
+
* pending: intended, retried under the same mutation id until the authority
|
|
12
|
+
* answers. Once submitted, its outcome may exist only at the authority, so
|
|
13
|
+
* nothing may supersede it.
|
|
14
|
+
* rejected: the authority conclusively refused this mutation. It is never
|
|
15
|
+
* replayed; the next Register re-folds its D onto the current accepted view
|
|
16
|
+
* under a new mutation id.
|
|
17
|
+
*
|
|
18
|
+
* While any row names W, W's ground is held from ordinary Detect. Every write
|
|
19
|
+
* here runs on the ground file's saver thread (ground-save-ops.ts).
|
|
20
|
+
*/
|
|
21
|
+
import type Database from "better-sqlite3";
|
|
22
|
+
/** One immutable graph page exactly as it must be sealed. */
|
|
23
|
+
export interface JournaledGraphPage {
|
|
24
|
+
readonly sha256: string;
|
|
25
|
+
readonly bytes: Buffer;
|
|
26
|
+
}
|
|
27
|
+
export interface DeclarationJournalEntry {
|
|
28
|
+
readonly mutationId: string;
|
|
29
|
+
readonly resourceId: string;
|
|
30
|
+
/** W: the root whose declaration this row owns. */
|
|
31
|
+
readonly declarationRoot: string;
|
|
32
|
+
/** The core records D adds beside W: its reference and any ancestor the
|
|
33
|
+
* accepted view lacked. */
|
|
34
|
+
readonly declaredIds: readonly string[];
|
|
35
|
+
readonly authorityEpoch: number;
|
|
36
|
+
readonly baseVersion: number;
|
|
37
|
+
readonly snapshotChecksum: string;
|
|
38
|
+
/** N: the complete accepted prefix this publication folded. */
|
|
39
|
+
readonly deliveryWatermark: number;
|
|
40
|
+
readonly operationKind: string;
|
|
41
|
+
readonly replacementRootIds: readonly string[];
|
|
42
|
+
/** Canonical operation bytes — stableJson of the head commit. */
|
|
43
|
+
readonly operationBlob: Buffer;
|
|
44
|
+
/** Pages the committed head did not already name. */
|
|
45
|
+
readonly pages: readonly JournaledGraphPage[];
|
|
46
|
+
readonly status: "pending" | "rejected";
|
|
47
|
+
/** True once a submit attempt was durably declared for this row. */
|
|
48
|
+
readonly submitted: boolean;
|
|
49
|
+
}
|
|
50
|
+
export declare function readDeclarationJournal(database: Database.Database): DeclarationJournalEntry[];
|
|
51
|
+
/** Journal one declaration publication, superseding that declaration's
|
|
52
|
+
* earlier rows. Runs inside the caller's transaction, so the row lands with
|
|
53
|
+
* whatever the caller commits beside it. A submitted pending row for the same
|
|
54
|
+
* declaration may already be accepted, so it refuses supersession. */
|
|
55
|
+
export declare function journalDeclaration(database: Database.Database, entry: DeclarationJournalEntry): void;
|
|
56
|
+
/** Durably declare a submit attempt before the first frame leaves. From this
|
|
57
|
+
* moment the outcome may exist only at the authority. */
|
|
58
|
+
export declare function markDeclarationSubmitted(database: Database.Database, mutationId: string): void;
|
|
59
|
+
/** The authority conclusively refused this exact mutation. */
|
|
60
|
+
export declare function markDeclarationRejected(database: Database.Database, mutationId: string): void;
|
|
61
|
+
/** The authority accepted it: the declaration no longer holds its ground. */
|
|
62
|
+
export declare function clearDeclaration(database: Database.Database, mutationId: string): void;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { GRAPH_HEAD_OPERATION_KIND, stableJson } from "@amalgm/live";
|
|
2
|
+
export function readDeclarationJournal(database) {
|
|
3
|
+
const pagesByMutation = new Map();
|
|
4
|
+
for (const page of database.prepare(`
|
|
5
|
+
SELECT mutation_id AS mutationId, sha256, bytes
|
|
6
|
+
FROM snapshot_publication_pages ORDER BY mutation_id, page_index
|
|
7
|
+
`).iterate()) {
|
|
8
|
+
const carried = pagesByMutation.get(page.mutationId) ?? [];
|
|
9
|
+
carried.push({ sha256: page.sha256, bytes: page.bytes });
|
|
10
|
+
pagesByMutation.set(page.mutationId, carried);
|
|
11
|
+
}
|
|
12
|
+
return database.prepare(`
|
|
13
|
+
SELECT mutation_id AS mutationId, resource_id AS resourceId,
|
|
14
|
+
declaration_root AS declarationRoot, meta_json AS metaJson,
|
|
15
|
+
operation_blob AS operationBlob, status, submitted_at AS submittedAt
|
|
16
|
+
FROM snapshot_publications ORDER BY sequence
|
|
17
|
+
`).all().map((row) => {
|
|
18
|
+
const meta = JSON.parse(row.metaJson);
|
|
19
|
+
// A row that names no exact replacement or declaration is damage, never a
|
|
20
|
+
// skippable row: dropping it could supersede a submitted mutation whose
|
|
21
|
+
// outcome exists only at the authority.
|
|
22
|
+
const deliveryWatermark = Number(meta.deliveryWatermark);
|
|
23
|
+
if (meta.operationKind !== GRAPH_HEAD_OPERATION_KIND
|
|
24
|
+
|| !Array.isArray(meta.replacementRootIds) || !meta.replacementRootIds.includes(row.declarationRoot)
|
|
25
|
+
|| !Array.isArray(meta.declaredIds)
|
|
26
|
+
|| !Number.isSafeInteger(deliveryWatermark) || deliveryWatermark < 0) {
|
|
27
|
+
throw new Error(`declaration publication ${row.mutationId} is not an exact graph-head declaration`);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
mutationId: row.mutationId,
|
|
31
|
+
resourceId: row.resourceId,
|
|
32
|
+
declarationRoot: row.declarationRoot,
|
|
33
|
+
declaredIds: meta.declaredIds.map(String),
|
|
34
|
+
authorityEpoch: Number(meta.authorityEpoch),
|
|
35
|
+
baseVersion: Number(meta.baseVersion),
|
|
36
|
+
snapshotChecksum: String(meta.snapshotChecksum),
|
|
37
|
+
deliveryWatermark,
|
|
38
|
+
operationKind: meta.operationKind,
|
|
39
|
+
replacementRootIds: meta.replacementRootIds.map(String),
|
|
40
|
+
operationBlob: row.operationBlob,
|
|
41
|
+
pages: pagesByMutation.get(row.mutationId) ?? [],
|
|
42
|
+
status: row.status === "rejected" ? "rejected" : "pending",
|
|
43
|
+
submitted: row.submittedAt !== null,
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** Journal one declaration publication, superseding that declaration's
|
|
48
|
+
* earlier rows. Runs inside the caller's transaction, so the row lands with
|
|
49
|
+
* whatever the caller commits beside it. A submitted pending row for the same
|
|
50
|
+
* declaration may already be accepted, so it refuses supersession. */
|
|
51
|
+
export function journalDeclaration(database, entry) {
|
|
52
|
+
if (!database.inTransaction)
|
|
53
|
+
throw new Error("a declaration journals inside its caller's transaction");
|
|
54
|
+
if (database.prepare(`
|
|
55
|
+
SELECT 1 FROM snapshot_publications
|
|
56
|
+
WHERE declaration_root = ? AND status = 'pending' AND submitted_at IS NOT NULL LIMIT 1
|
|
57
|
+
`).get(entry.declarationRoot) !== undefined) {
|
|
58
|
+
throw new Error(`declaration ${entry.declarationRoot} has a submitted publication whose outcome is unknown`);
|
|
59
|
+
}
|
|
60
|
+
database.prepare(`
|
|
61
|
+
DELETE FROM snapshot_publication_pages WHERE mutation_id IN (
|
|
62
|
+
SELECT mutation_id FROM snapshot_publications WHERE declaration_root = ?)
|
|
63
|
+
`).run(entry.declarationRoot);
|
|
64
|
+
database.prepare("DELETE FROM snapshot_publications WHERE declaration_root = ?").run(entry.declarationRoot);
|
|
65
|
+
database.prepare(`
|
|
66
|
+
INSERT INTO snapshot_publications(
|
|
67
|
+
mutation_id, resource_id, declaration_root, meta_json, operation_blob, created_at
|
|
68
|
+
) VALUES (?, ?, ?, ?, ?, ?)
|
|
69
|
+
`).run(entry.mutationId, entry.resourceId, entry.declarationRoot, stableJson({
|
|
70
|
+
declaredIds: entry.declaredIds,
|
|
71
|
+
authorityEpoch: entry.authorityEpoch,
|
|
72
|
+
baseVersion: entry.baseVersion,
|
|
73
|
+
snapshotChecksum: entry.snapshotChecksum,
|
|
74
|
+
deliveryWatermark: entry.deliveryWatermark,
|
|
75
|
+
operationKind: entry.operationKind,
|
|
76
|
+
replacementRootIds: entry.replacementRootIds,
|
|
77
|
+
}), entry.operationBlob, Date.now());
|
|
78
|
+
const insertPage = database.prepare(`
|
|
79
|
+
INSERT INTO snapshot_publication_pages(mutation_id, page_index, sha256, bytes) VALUES (?, ?, ?, ?)
|
|
80
|
+
`);
|
|
81
|
+
entry.pages.forEach((page, index) => insertPage.run(entry.mutationId, index, page.sha256, page.bytes));
|
|
82
|
+
}
|
|
83
|
+
/** Durably declare a submit attempt before the first frame leaves. From this
|
|
84
|
+
* moment the outcome may exist only at the authority. */
|
|
85
|
+
export function markDeclarationSubmitted(database, mutationId) {
|
|
86
|
+
database.prepare("UPDATE snapshot_publications SET submitted_at = ? WHERE mutation_id = ?")
|
|
87
|
+
.run(Date.now(), mutationId);
|
|
88
|
+
}
|
|
89
|
+
/** The authority conclusively refused this exact mutation. */
|
|
90
|
+
export function markDeclarationRejected(database, mutationId) {
|
|
91
|
+
database.prepare("UPDATE snapshot_publications SET status = 'rejected' WHERE mutation_id = ?")
|
|
92
|
+
.run(mutationId);
|
|
93
|
+
}
|
|
94
|
+
/** The authority accepted it: the declaration no longer holds its ground. */
|
|
95
|
+
export function clearDeclaration(database, mutationId) {
|
|
96
|
+
database.prepare("DELETE FROM snapshot_publication_pages WHERE mutation_id = ?").run(mutationId);
|
|
97
|
+
database.prepare("DELETE FROM snapshot_publications WHERE mutation_id = ?").run(mutationId);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=declaration-journal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declaration-journal.js","sourceRoot":"","sources":["../src/declaration-journal.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA0CrE,MAAM,UAAU,sBAAsB,CAAC,QAA2B;IAChE,MAAM,eAAe,GAAG,IAAI,GAAG,EAAgC,CAAC;IAChE,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,OAAO,CAAC;;;GAGnC,CAAC,CAAC,OAAO,EAAqE,EAAE,CAAC;QAChF,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QAC3D,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACzD,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IACD,OAAQ,QAAQ,CAAC,OAAO,CAAC;;;;;GAK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xB,KAAK,CAAC,aAAa,EACnB,IAAI,CAAC,GAAG,EAAE,CACX,CAAC;IACF,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC;;GAEnC,CAAC,CAAC;IACH,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACzG,CAAC;AAED;yDACyD;AACzD,MAAM,UAAU,wBAAwB,CAAC,QAA2B,EAAE,UAAkB;IACtF,QAAQ,CAAC,OAAO,CAAC,yEAAyE,CAAC;SACxF,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;AACjC,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,uBAAuB,CAAC,QAA2B,EAAE,UAAkB;IACrF,QAAQ,CAAC,OAAO,CAAC,4EAA4E,CAAC;SAC3F,GAAG,CAAC,UAAU,CAAC,CAAC;AACrB,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,gBAAgB,CAAC,QAA2B,EAAE,UAAkB;IAC9E,QAAQ,CAAC,OAAO,CAAC,8DAA8D,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACjG,QAAQ,CAAC,OAAO,CAAC,yDAAyD,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type Database from "better-sqlite3";
|
|
2
|
+
import type { DeclarationChain } from "./declaration-chain.js";
|
|
3
|
+
import { type DeclarationJournalEntry } from "./declaration-journal.js";
|
|
4
|
+
import { type RepositorySealCandidate } from "./detection/seal-law.js";
|
|
5
|
+
import type { RepositoryObservationPair } from "./git-repository-host.js";
|
|
6
|
+
import { type GroundRow } from "./ground-row.js";
|
|
7
|
+
/** One declaration as data. */
|
|
8
|
+
export interface DeclarationSave {
|
|
9
|
+
readonly resourceId: string;
|
|
10
|
+
readonly coreRootId: string;
|
|
11
|
+
/** W's walk, or null for a re-fold whose walk already stands. */
|
|
12
|
+
readonly walk: {
|
|
13
|
+
readonly repositoryObservations: readonly Omit<RepositoryObservationPair, "proof">[];
|
|
14
|
+
readonly observed: readonly GroundRow[];
|
|
15
|
+
readonly selected: readonly GroundRow[];
|
|
16
|
+
readonly seals: readonly RepositorySealCandidate[];
|
|
17
|
+
} | null;
|
|
18
|
+
/** The enclosed roots W absorbs. */
|
|
19
|
+
readonly absorbed: readonly string[];
|
|
20
|
+
/** Every bound root W's ground encloses; its rows join W's root. */
|
|
21
|
+
readonly enclosed: readonly string[];
|
|
22
|
+
readonly chain: DeclarationChain;
|
|
23
|
+
readonly journal: DeclarationJournalEntry;
|
|
24
|
+
}
|
|
25
|
+
/** The UUID local ground names at one core address: B first, then O. */
|
|
26
|
+
export declare function namedAt(database: Database.Database, resourceId: string, coreRootId: string, relativePath: string): string | null;
|
|
27
|
+
/** `register.declare`: nothing when an address moved. O rows already held
|
|
28
|
+
* under the chain's identities stand as observed, and rows at its addresses
|
|
29
|
+
* under other identities are displaced: sharing names the identity, and
|
|
30
|
+
* observation re-derives the rest on its next pass. */
|
|
31
|
+
export declare function saveDeclaration(database: Database.Database, input: DeclarationSave): "committed" | "moved";
|