@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,232 @@
|
|
|
1
|
+
/** Detect and Apply cannot adopt the intermediate effects of another
|
|
2
|
+
* durable operation. This is a scoped read of Apply's existing receipts,
|
|
3
|
+
* never another journal or a source of physical identity. */
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import { lstatSync } from "node:fs";
|
|
6
|
+
import { resolve, sep } from "node:path";
|
|
7
|
+
import { assertApplyIntent } from "@amalgm/live";
|
|
8
|
+
import { applyControlRoot, readApplyRecovery } from "../apply-recovery.js";
|
|
9
|
+
import { physicalKey } from "../source-signature.js";
|
|
10
|
+
import { cachedStatement } from "../sqlite.js";
|
|
11
|
+
import { unreadReason } from "./unreadable.js";
|
|
12
|
+
/** An object an Apply may own, named within the root that holds it. An owner
|
|
13
|
+
* protects its objects so that one moved outside its cones keeps its identity
|
|
14
|
+
* question for the Apply. Identity continuity is root-local, so an object
|
|
15
|
+
* that leaves its root is a new identity wherever it lands, Apply or not, and
|
|
16
|
+
* an inode number the Apply freed and the filesystem gave a file in another
|
|
17
|
+
* root names nothing this Apply owns. */
|
|
18
|
+
export const ownedObject = (root, physicalKey) => JSON.stringify([resolve(root), physicalKey]);
|
|
19
|
+
/** What an Apply attempt waits on while other unfinished operations own its
|
|
20
|
+
* scope. An attempt that already holds bound effects cannot simply wait: the
|
|
21
|
+
* overlap needs explicit repair. */
|
|
22
|
+
export function ownershipWait(owners, bound) {
|
|
23
|
+
if (owners.length === 0)
|
|
24
|
+
return null;
|
|
25
|
+
return { kind: "dependency", reason: bound ? "Overlapping Apply recovery obligations require explicit repair."
|
|
26
|
+
: "Another unfinished Apply operation owns this ground.",
|
|
27
|
+
waitFor: { producer: bound ? "capability" : "apply", entityIds: [...new Set(owners.map(owner => owner.intent.entityId))] } };
|
|
28
|
+
}
|
|
29
|
+
export class ApplyAttributionDeferred extends Error {
|
|
30
|
+
owners;
|
|
31
|
+
moving;
|
|
32
|
+
unavailable;
|
|
33
|
+
/** `moving` and `unavailable` name roots the same attempt found still
|
|
34
|
+
* moving or could not read: separate causes that travel with the owners
|
|
35
|
+
* and are never erased by them. */
|
|
36
|
+
constructor(owners, moving = [], unavailable = []) {
|
|
37
|
+
const blocked = owners.flatMap(owner => owner.unsafe ? [owner.unsafe] : owner.inaccessible ? [owner.inaccessible.reason] : []);
|
|
38
|
+
super(blocked.length ? `Detect attribution is waiting for Apply recovery: ${blocked.join("; ")}`
|
|
39
|
+
: "Detect attribution is waiting for an unfinished Apply operation");
|
|
40
|
+
this.owners = owners;
|
|
41
|
+
this.moving = moving;
|
|
42
|
+
this.unavailable = unavailable;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const contains = (cone, path) => cone === path
|
|
46
|
+
|| path.startsWith(cone.endsWith(sep) ? cone : `${cone}${sep}`);
|
|
47
|
+
const NONE = new Set();
|
|
48
|
+
const normalize = (scope) => Object.freeze({
|
|
49
|
+
entries: Object.freeze(scope.entries?.map(path => resolve(path)) ?? []),
|
|
50
|
+
subtrees: Object.freeze(scope.subtrees?.map(path => resolve(path)) ?? []),
|
|
51
|
+
uuids: scope.uuids ?? NONE,
|
|
52
|
+
physical: scope.physical ?? NONE,
|
|
53
|
+
});
|
|
54
|
+
const intersects = (owner, scope) => owner.uuids.some(uuid => scope.uuids.has(uuid))
|
|
55
|
+
|| owner.physical.some(key => scope.physical.has(key))
|
|
56
|
+
|| owner.cones.some(cone => scope.entries.some(path => contains(cone, path))
|
|
57
|
+
|| scope.subtrees.some(path => contains(cone, path) || contains(path, cone)));
|
|
58
|
+
/** Codes that say only that the bound path cannot be resolved or read now. */
|
|
59
|
+
const INACCESSIBLE = new Set(["ENOENT", "ENOTDIR", "EACCES", "EPERM"]);
|
|
60
|
+
/** Cannot inspect is not proved wrong: a binding that cannot be resolved or
|
|
61
|
+
* read now is inaccessible, and any other failure to read it is unsafe. */
|
|
62
|
+
function inspect(path) {
|
|
63
|
+
try {
|
|
64
|
+
return lstatSync(path, { bigint: true });
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
return INACCESSIBLE.has(error?.code ?? "")
|
|
68
|
+
? { inaccessible: { directory: path, reason: unreadReason(path, error) } }
|
|
69
|
+
: { unsafe: `Apply attribution owner's binding could not be read: ${error instanceof Error ? error.message : String(error)}` };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** Only a binding that resolves to another object, or cannot be read for
|
|
73
|
+
* another reason, is unsafe. */
|
|
74
|
+
function bindingState(recovery) {
|
|
75
|
+
const actual = inspect(recovery.binding.path);
|
|
76
|
+
if (!("isDirectory" in actual))
|
|
77
|
+
return actual;
|
|
78
|
+
return actual.isDirectory() && !actual.isSymbolicLink() && physicalKey(actual) === recovery.binding.physical
|
|
79
|
+
? {} : { unsafe: "Apply attribution owner has a replaced binding" };
|
|
80
|
+
}
|
|
81
|
+
/** Shared by Detect admission and the host's post-terminal wake. Original
|
|
82
|
+
* receipt participants remain known even if a row already moved or vanished. */
|
|
83
|
+
export function applyRecoveryFootprint(recovery) {
|
|
84
|
+
const preimages = [recovery.source, ...recovery.moves.map(move => move.source),
|
|
85
|
+
...recovery.relocated.map(move => move.source)].filter(value => value !== null);
|
|
86
|
+
return {
|
|
87
|
+
cones: Object.freeze([...new Set([recovery.targetPath, ...preimages.map(source => source.path),
|
|
88
|
+
...recovery.moves.map(move => move.destination)].map(path => resolve(path)))].sort()),
|
|
89
|
+
uuids: Object.freeze([...new Set([recovery.intent.entityId,
|
|
90
|
+
...preimages.flatMap(source => source.rows.map(row => row.record.uuid))])].sort()),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** One host adapter reads bound, nonterminal receipts. Unbound preparation
|
|
94
|
+
* owns no effects; terminal cleanup owns no live filesystem attribution. */
|
|
95
|
+
export function sqliteApplyOwnership(database) {
|
|
96
|
+
const owners = cachedStatement(database, `SELECT intent_json AS intentJson, recovery_location AS control
|
|
97
|
+
FROM entity_apply_intents WHERE retirement_json IS NULL AND recovery_location IS NOT NULL
|
|
98
|
+
ORDER BY authority_id, entity_id`);
|
|
99
|
+
const physical = cachedStatement(database, "SELECT absolute_path AS path, physical_key AS physical FROM entities WHERE uuid = ?");
|
|
100
|
+
const incarnation = cachedStatement(database, "SELECT identity FROM ground_incarnation WHERE singleton = 1");
|
|
101
|
+
return {
|
|
102
|
+
incarnation: () => {
|
|
103
|
+
const row = incarnation.get();
|
|
104
|
+
if (!row)
|
|
105
|
+
throw new Error("Apply attribution read has no database incarnation");
|
|
106
|
+
return row.identity;
|
|
107
|
+
},
|
|
108
|
+
read: () => owners.all().map(row => {
|
|
109
|
+
const intent = JSON.parse(row.intentJson);
|
|
110
|
+
assertApplyIntent(intent);
|
|
111
|
+
// The receipt lives in its binding's control tree. While that binding
|
|
112
|
+
// cannot be reached, the durable intent still owns everything bound
|
|
113
|
+
// there and the receipt stays unread: neither its presence nor its
|
|
114
|
+
// usability is proved, and absent is not proved lost.
|
|
115
|
+
const root = applyControlRoot(row.control);
|
|
116
|
+
const reached = inspect(root);
|
|
117
|
+
if (!("isDirectory" in reached)) {
|
|
118
|
+
const current = physical.get(intent.entityId);
|
|
119
|
+
return Object.freeze({ intent: Object.freeze(intent), control: row.control, receipt: "",
|
|
120
|
+
cones: Object.freeze([...new Set([resolve(root), ...(current ? [current.path] : [])])].sort()),
|
|
121
|
+
uuids: Object.freeze([intent.entityId]),
|
|
122
|
+
physical: Object.freeze(current ? [ownedObject(root, current.physical)] : []), ...reached });
|
|
123
|
+
}
|
|
124
|
+
const recovery = readApplyRecovery(row.control, intent);
|
|
125
|
+
if (!recovery)
|
|
126
|
+
throw new Error("Apply attribution owner lost its referenced receipt");
|
|
127
|
+
// A readable immutable receipt still names its original obligation when
|
|
128
|
+
// its binding cannot serve it. Keep that state with its actual scopes;
|
|
129
|
+
// it cannot make an unrelated root fail ownership collection.
|
|
130
|
+
const binding = bindingState(recovery);
|
|
131
|
+
const footprint = applyRecoveryFootprint(recovery);
|
|
132
|
+
const attributed = footprint.uuids.flatMap(uuid => {
|
|
133
|
+
const candidate = physical.get(uuid);
|
|
134
|
+
return candidate ? [candidate] : [];
|
|
135
|
+
});
|
|
136
|
+
const identities = attributed.map(row => row.physical);
|
|
137
|
+
for (const preimage of [recovery.source, ...recovery.moves.map(move => move.source),
|
|
138
|
+
...recovery.relocated.map(move => move.source)]) {
|
|
139
|
+
for (const row of preimage?.rows ?? [])
|
|
140
|
+
if (row.physical) {
|
|
141
|
+
identities.push(row.physical);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return Object.freeze({ intent: Object.freeze(intent), control: row.control,
|
|
145
|
+
receipt: createHash("sha256").update(JSON.stringify(recovery)).digest("hex"),
|
|
146
|
+
physical: Object.freeze([...new Set(identities.map(key => ownedObject(recovery.binding.path, key)))].sort()),
|
|
147
|
+
...footprint,
|
|
148
|
+
// Original participant UUIDs also protect their currently attributed
|
|
149
|
+
// addresses. A subtree effect cannot bypass ownership by moving one
|
|
150
|
+
// of those participants outside the original receipt's path cone.
|
|
151
|
+
cones: Object.freeze([...new Set([...footprint.cones, ...attributed.map(row => row.path)])].sort()),
|
|
152
|
+
...binding });
|
|
153
|
+
}),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/** One ownership collection serves every scope in an observation. Admission
|
|
157
|
+
* rechecks complete intersecting answers, including the initially empty set.
|
|
158
|
+
* Unrelated owners do not invalidate this scope. Source/SQL/lease proof is
|
|
159
|
+
* still required: active-owner equality alone cannot prove an effect-free gap. */
|
|
160
|
+
export class ApplyOwnershipSnapshot {
|
|
161
|
+
#reader;
|
|
162
|
+
#excluding;
|
|
163
|
+
#incarnation;
|
|
164
|
+
#owners;
|
|
165
|
+
#answers = [];
|
|
166
|
+
#physical = new Set();
|
|
167
|
+
#closed = false;
|
|
168
|
+
#failed = false;
|
|
169
|
+
constructor(reader, excluding) {
|
|
170
|
+
this.#reader = reader;
|
|
171
|
+
this.#excluding = excluding;
|
|
172
|
+
this.#incarnation = reader.incarnation();
|
|
173
|
+
this.#owners = this.#read();
|
|
174
|
+
}
|
|
175
|
+
#read() {
|
|
176
|
+
return this.#reader.read().filter(owner => !this.#excluding
|
|
177
|
+
|| owner.intent.attemptId !== this.#excluding.attemptId
|
|
178
|
+
|| owner.intent.authorityId !== this.#excluding.authorityId
|
|
179
|
+
|| owner.intent.entityId !== this.#excluding.entityId);
|
|
180
|
+
}
|
|
181
|
+
use(input) {
|
|
182
|
+
if (this.#closed || this.#failed)
|
|
183
|
+
throw new Error("Apply ownership observation is closed or failed");
|
|
184
|
+
try {
|
|
185
|
+
const scope = normalize(input);
|
|
186
|
+
const owners = this.#owners.filter(owner => intersects(owner, scope));
|
|
187
|
+
this.#answers.push({ scope, answer: signature(owners) });
|
|
188
|
+
return Object.freeze(owners);
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
this.#failed = true;
|
|
192
|
+
throw error;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/** Owners of one object (ownedObject), collected once, including negative
|
|
196
|
+
* answers. A protected directory moved outside its old cone cannot become a
|
|
197
|
+
* new UUID in its root. */
|
|
198
|
+
physical(object) {
|
|
199
|
+
if (this.#closed || this.#failed)
|
|
200
|
+
throw new Error("Apply ownership observation is closed or failed");
|
|
201
|
+
this.#physical.add(object);
|
|
202
|
+
return this.#owners.filter(owner => owner.physical.includes(object));
|
|
203
|
+
}
|
|
204
|
+
seal() {
|
|
205
|
+
if (this.#closed || this.#failed)
|
|
206
|
+
throw new Error("Apply ownership observation is closed or failed");
|
|
207
|
+
this.#closed = true;
|
|
208
|
+
const answers = [...this.#answers];
|
|
209
|
+
if (this.#physical.size) {
|
|
210
|
+
const scope = normalize({ physical: this.#physical });
|
|
211
|
+
answers.push({ scope, answer: signature(this.#owners.filter(owner => intersects(owner, scope))) });
|
|
212
|
+
}
|
|
213
|
+
return Object.freeze({ assertCurrent: () => {
|
|
214
|
+
if (this.#reader.incarnation() !== this.#incarnation)
|
|
215
|
+
throw new Error("Apply ownership database changed");
|
|
216
|
+
const owners = this.#read();
|
|
217
|
+
for (const { scope, answer } of answers) {
|
|
218
|
+
if (signature(owners.filter(owner => intersects(owner, scope))) !== answer) {
|
|
219
|
+
throw new Error("Apply ownership changed before Detect admission");
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
} });
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function signature(owners) {
|
|
226
|
+
return JSON.stringify(owners.map(owner => [owner.intent.attemptId, owner.intent.authorityId, owner.intent.entityId,
|
|
227
|
+
owner.intent.fromSequence, owner.intent.throughSequence, owner.intent.targetMutationId,
|
|
228
|
+
owner.intent.targetState, owner.intent.targetType, owner.intent.createdAt,
|
|
229
|
+
owner.control, owner.receipt, owner.cones, owner.uuids, owner.physical,
|
|
230
|
+
owner.inaccessible?.reason ?? null, owner.unsafe ?? null]).sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b))));
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=apply-ownership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-ownership.js","sourceRoot":"","sources":["../../src/detection/apply-ownership.ts"],"names":[],"mappings":"AAAA;;6DAE6D;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAoB,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAA2C,MAAM,cAAc,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AM,CAAC,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,gBAAgB;QACtF,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS;QACzE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ;QACtE,KAAK,CAAC,YAAY,EAAE,MAAM,IAAI,IAAI,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACvE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The verified notebook, a Watch binding or a Git writer advanced while
|
|
2
|
+
* Detect was observing. The complete generation stays pending and re-reads
|
|
3
|
+
* fresh truth on its next ring. A basis that knows when it settles without
|
|
4
|
+
* one, as a Git writer's lock does, says so, and is re-read then. */
|
|
5
|
+
export declare class DetectionBasisAdvancedError extends Error {
|
|
6
|
+
readonly settlesInMs: number | null;
|
|
7
|
+
constructor(message?: string, settlesInMs?: number | null);
|
|
8
|
+
}
|
|
9
|
+
export declare function detectionBasisAdvanced(error: unknown): boolean;
|
|
10
|
+
/** When moved evidence settles if nothing rings, where its basis knows. */
|
|
11
|
+
export declare function basisSettlesInMs(error: unknown): number | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** The verified notebook, a Watch binding or a Git writer advanced while
|
|
2
|
+
* Detect was observing. The complete generation stays pending and re-reads
|
|
3
|
+
* fresh truth on its next ring. A basis that knows when it settles without
|
|
4
|
+
* one, as a Git writer's lock does, says so, and is re-read then. */
|
|
5
|
+
export class DetectionBasisAdvancedError extends Error {
|
|
6
|
+
settlesInMs;
|
|
7
|
+
constructor(message = "the verified notebook advanced while Detect was observing; retrying fresh truth", settlesInMs = null) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.settlesInMs = settlesInMs;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function advancedBasis(error) {
|
|
13
|
+
for (let link = error; link instanceof Error; link = link.cause) {
|
|
14
|
+
if (link instanceof DetectionBasisAdvancedError)
|
|
15
|
+
return link;
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
export function detectionBasisAdvanced(error) {
|
|
20
|
+
return advancedBasis(error) !== null;
|
|
21
|
+
}
|
|
22
|
+
/** When moved evidence settles if nothing rings, where its basis knows. */
|
|
23
|
+
export function basisSettlesInMs(error) {
|
|
24
|
+
return advancedBasis(error)?.settlesInMs ?? null;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=basis-advanced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basis-advanced.js","sourceRoot":"","sources":["../../src/detection/basis-advanced.ts"],"names":[],"mappings":"AAAA;;;qEAGqE;AACrE,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IAGzC;IAFX,YACE,OAAO,GAAG,iFAAiF,EAClF,cAA6B,IAAI;QAE1C,KAAK,CAAC,OAAO,CAAC,CAAC;QAFN,gBAAW,GAAX,WAAW,CAAsB;IAG5C,CAAC;CACF;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,KAAK,IAAI,IAAI,GAAG,KAAK,EAAE,IAAI,YAAY,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAChE,IAAI,IAAI,YAAY,2BAA2B;YAAE,OAAO,IAAI,CAAC;IAC/D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,OAAO,aAAa,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;AACvC,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,aAAa,CAAC,KAAK,CAAC,EAAE,WAAW,IAAI,IAAI,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LocalCaptureResult } from "@amalgm/live";
|
|
2
|
+
import type Database from "better-sqlite3";
|
|
3
|
+
import { type GroundRow } from "../ground-row.js";
|
|
4
|
+
/** Settled ground may still hold local remainder, which an effect that
|
|
5
|
+
* displaces its directory must not destroy. */
|
|
6
|
+
export interface SettledGround {
|
|
7
|
+
readonly kind: "settled";
|
|
8
|
+
readonly remainder: readonly GroundRow[];
|
|
9
|
+
}
|
|
10
|
+
export declare function settledCaptureOutcome(database: Database.Database, input: {
|
|
11
|
+
readonly authorityId: string;
|
|
12
|
+
readonly entityId: string;
|
|
13
|
+
readonly addresses: readonly string[];
|
|
14
|
+
}): Extract<LocalCaptureResult, {
|
|
15
|
+
readonly kind: "local-only" | "retry";
|
|
16
|
+
}> | SettledGround;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/** Apply asks this only after its exact Watch generation has settled. This
|
|
2
|
+
* comparison reports observed local divergence from the committed
|
|
3
|
+
* inventories; it neither proves disk state nor treats observation as a
|
|
4
|
+
* durable backup or permission to overwrite it.
|
|
5
|
+
*
|
|
6
|
+
* It reads committed facts only: O, B and repository seals. An observed
|
|
7
|
+
* identity sharing never held is local remainder: no incoming result names
|
|
8
|
+
* it and nothing else holds a copy, so Apply keeps it and never waits for
|
|
9
|
+
* it. Any other difference between O and B is divergence unless selection
|
|
10
|
+
* explains it: a container whose membership differs only by remainder, or a
|
|
11
|
+
* repository whose seal derives O's result and B's from one examination. */
|
|
12
|
+
import { sep, resolve } from "node:path";
|
|
13
|
+
import { effectivelyActive, GROUND_ROW_PROJECTION } from "../ground-row.js";
|
|
14
|
+
import { readSealedRepositoryEvidence, sealDerives } from "./seal-law.js";
|
|
15
|
+
const INVENTORIES = ["entities", "detection_notebook"];
|
|
16
|
+
export function settledCaptureOutcome(database, input) {
|
|
17
|
+
if (input.addresses.length === 0)
|
|
18
|
+
return { kind: "retry", reason: "Apply capture has no proven address scope." };
|
|
19
|
+
const remainder = [];
|
|
20
|
+
const divergent = database.transaction(() => {
|
|
21
|
+
const affected = new Set([input.entityId]);
|
|
22
|
+
const roots = [];
|
|
23
|
+
for (const path of [...new Set(input.addresses.map(path => resolve(path)))].sort()) {
|
|
24
|
+
const last = roots.at(-1);
|
|
25
|
+
if (!last || !path.startsWith(last.endsWith(sep) ? last : `${last}${sep}`))
|
|
26
|
+
roots.push(path);
|
|
27
|
+
}
|
|
28
|
+
for (const inventory of INVENTORIES) {
|
|
29
|
+
const query = database.prepare(`
|
|
30
|
+
SELECT uuid FROM ${inventory} WHERE absolute_path = ? AND resource_id = ?
|
|
31
|
+
UNION ALL
|
|
32
|
+
SELECT uuid FROM ${inventory} WHERE absolute_path >= ? AND absolute_path < ? AND resource_id = ?
|
|
33
|
+
`);
|
|
34
|
+
for (const path of roots) {
|
|
35
|
+
const prefix = path.endsWith(sep) ? path : `${path}${sep}`;
|
|
36
|
+
const upper = prefix.slice(0, -1) + String.fromCharCode(sep.charCodeAt(0) + 1);
|
|
37
|
+
for (const row of query.all(path, input.authorityId, prefix, upper, input.authorityId)) {
|
|
38
|
+
affected.add(row.uuid);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const readers = Object.fromEntries(INVENTORIES.map(inventory => {
|
|
43
|
+
const statement = database.prepare(`SELECT ${GROUND_ROW_PROJECTION} FROM ${inventory} WHERE uuid = ? AND resource_id = ?`);
|
|
44
|
+
const cache = new Map();
|
|
45
|
+
return [inventory, (uuid) => {
|
|
46
|
+
if (!cache.has(uuid))
|
|
47
|
+
cache.set(uuid, statement.get(uuid, input.authorityId));
|
|
48
|
+
return cache.get(uuid);
|
|
49
|
+
}];
|
|
50
|
+
}));
|
|
51
|
+
const members = Object.fromEntries(INVENTORIES.map(inventory => {
|
|
52
|
+
const statement = database.prepare(`SELECT uuid, name FROM ${inventory} WHERE parent_uuid = ? AND resource_id = ? AND status = 'active'`);
|
|
53
|
+
return [inventory, (uuid) => statement.all(uuid, input.authorityId)];
|
|
54
|
+
}));
|
|
55
|
+
const active = (row, inventory) => row !== undefined
|
|
56
|
+
&& effectivelyActive(row, readers[inventory]);
|
|
57
|
+
// Both rows are active; selection explains a difference of payload alone.
|
|
58
|
+
const explained = (observed, shared) => {
|
|
59
|
+
if (observed.type !== shared.type || observed.parentUUID !== shared.parentUUID || observed.name !== shared.name)
|
|
60
|
+
return false;
|
|
61
|
+
if (observed.type === "workspace" || observed.type === "folder") {
|
|
62
|
+
// Membership is the stored-active children by (uuid, name).
|
|
63
|
+
const key = (member) => `${member.uuid}\0${member.name}`;
|
|
64
|
+
const held = new Set(members.detection_notebook(observed.uuid).map(key));
|
|
65
|
+
const kept = members.entities(observed.uuid).filter(child => readers.detection_notebook(child.uuid) !== undefined);
|
|
66
|
+
return kept.length === held.size && kept.every(child => held.has(key(child)));
|
|
67
|
+
}
|
|
68
|
+
return observed.type === "repo.git" && sealDerives(readSealedRepositoryEvidence(database, observed.uuid), observed, shared);
|
|
69
|
+
};
|
|
70
|
+
const divergent = [];
|
|
71
|
+
for (const uuid of affected) {
|
|
72
|
+
const physical = readers.entities(uuid), shared = readers.detection_notebook(uuid);
|
|
73
|
+
const present = active(physical, "entities"), admitted = active(shared, "detection_notebook");
|
|
74
|
+
// A different pack for the same logical result is not local divergence.
|
|
75
|
+
// Filesystem metadata and machine addresses are not portable state either.
|
|
76
|
+
if (present === admitted && (!present || physical.version === shared.version))
|
|
77
|
+
continue;
|
|
78
|
+
if (present && shared === undefined) {
|
|
79
|
+
remainder.push(physical);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (!present || !admitted || !explained(physical, shared))
|
|
83
|
+
divergent.push(uuid);
|
|
84
|
+
}
|
|
85
|
+
return divergent;
|
|
86
|
+
})();
|
|
87
|
+
return divergent.length ? {
|
|
88
|
+
kind: "local-only", entityIds: divergent.sort(),
|
|
89
|
+
reason: "Observed local changes have not been selected for sharing. Waiting for those changes to be shared or explicitly resolved before replacing them.",
|
|
90
|
+
} : { kind: "settled", remainder };
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=capture-outcome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-outcome.js","sourceRoot":"","sources":["../../src/detection/capture-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;4EAU4E;AAC5E,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAkB,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,4BAA4B,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAS1E,MAAM,WAAW,GAAG,CAAC,UAAU,EAAE,oBAAoB,CAAU,CAAC;AAIhE,MAAM,UAAU,qBAAqB,CAAC,QAA2B,EAAE,KAIlE;IACC,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,4CAA4C,EAAE,CAAC;IACjH,MAAM,SAAS,GAAgB,EAAE,CAAC;IAClC,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAa,EAAE;QACpD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YACn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AAQ,IAAI,CAAC,CAAC,OAAO,IAAI,QAAS,CAAC,OAAO,KAAK,MAAO,CAAC,OAAO,CAAC;gBAAE,SAAS;YAC1F,IAAI,OAAO,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBAAC,SAAS,CAAC,IAAI,CAAC,QAAS,CAAC,CAAC;gBAAC,SAAS;YAAC,CAAC;YAC7E,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,IAAI,CAAC,SAAS,CAAC,QAAS,EAAE,MAAO,CAAC;gBAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,EAAE,CAAC;IACL,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QACxB,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC,IAAI,EAAE;QAC/C,MAAM,EAAE,iJAAiJ;KAC1J,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A container's version is its portable fields plus the membership hash of
|
|
3
|
+
* its active children. A child counts toward its parent by its UUID and name
|
|
4
|
+
* while active, so only a create, move, rename or lifecycle change affects a
|
|
5
|
+
* parent; a content change leaves every parent as it is. A named unit
|
|
6
|
+
* re-derives each affected parent from that parent's complete stored child
|
|
7
|
+
* set with the unit's own rows substituted. Observation (O) and sharing (S)
|
|
8
|
+
* are derived separately: O from every observed result, S from the selected
|
|
9
|
+
* result only. A membership-only container change is local; it never
|
|
10
|
+
* becomes a Record.
|
|
11
|
+
*/
|
|
12
|
+
import { type Sha256Hex } from "@amalgm/live";
|
|
13
|
+
import { type GroundRow } from "../ground-row.js";
|
|
14
|
+
type Member = Pick<GroundRow, "uuid" | "parentUUID" | "name" | "status">;
|
|
15
|
+
/** The parents whose membership changes between each identity's stored row
|
|
16
|
+
* and its row after a unit: the parent it leaves and the parent it joins. */
|
|
17
|
+
export declare function membershipParents(changes: Iterable<{
|
|
18
|
+
readonly before: Member | null | undefined;
|
|
19
|
+
readonly after: Member | null | undefined;
|
|
20
|
+
}>): Set<string>;
|
|
21
|
+
export declare function finalizeContainers(input: {
|
|
22
|
+
/** Each affected parent's own row in this inventory. */
|
|
23
|
+
readonly parents: readonly GroundRow[];
|
|
24
|
+
/** The complete stored children of a parent in this inventory. */
|
|
25
|
+
readonly children: (parentUUID: string) => readonly Member[];
|
|
26
|
+
/** Every identity the unit examined; their stored placement is replaced. */
|
|
27
|
+
readonly targets: ReadonlySet<string>;
|
|
28
|
+
/** The unit's rows in this inventory, wherever they now belong. */
|
|
29
|
+
readonly results: readonly Member[];
|
|
30
|
+
readonly sha256Hex: Sha256Hex;
|
|
31
|
+
}): GroundRow[];
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A container's version is its portable fields plus the membership hash of
|
|
3
|
+
* its active children. A child counts toward its parent by its UUID and name
|
|
4
|
+
* while active, so only a create, move, rename or lifecycle change affects a
|
|
5
|
+
* parent; a content change leaves every parent as it is. A named unit
|
|
6
|
+
* re-derives each affected parent from that parent's complete stored child
|
|
7
|
+
* set with the unit's own rows substituted. Observation (O) and sharing (S)
|
|
8
|
+
* are derived separately: O from every observed result, S from the selected
|
|
9
|
+
* result only. A membership-only container change is local; it never
|
|
10
|
+
* becomes a Record.
|
|
11
|
+
*/
|
|
12
|
+
import { canonicalVersion, membershipHash } from "@amalgm/live";
|
|
13
|
+
import { portableGroundRecord as portable } from "../ground-row.js";
|
|
14
|
+
/** The parents whose membership changes between each identity's stored row
|
|
15
|
+
* and its row after a unit: the parent it leaves and the parent it joins. */
|
|
16
|
+
export function membershipParents(changes) {
|
|
17
|
+
const parents = new Set();
|
|
18
|
+
for (const { before, after } of changes) {
|
|
19
|
+
const left = counted(before);
|
|
20
|
+
const joined = counted(after);
|
|
21
|
+
if (left?.parentUUID === joined?.parentUUID && left?.name === joined?.name)
|
|
22
|
+
continue;
|
|
23
|
+
if (left)
|
|
24
|
+
parents.add(left.parentUUID);
|
|
25
|
+
if (joined)
|
|
26
|
+
parents.add(joined.parentUUID);
|
|
27
|
+
}
|
|
28
|
+
return parents;
|
|
29
|
+
}
|
|
30
|
+
const counted = (row) => row?.status === "active" && row.parentUUID ? row : null;
|
|
31
|
+
export function finalizeContainers(input) {
|
|
32
|
+
const changed = [];
|
|
33
|
+
for (const parent of input.parents) {
|
|
34
|
+
// A repository's payload is its Card + Checkpoint, never a membership hash.
|
|
35
|
+
if (parent.type !== "workspace" && parent.type !== "folder") {
|
|
36
|
+
throw new Error(`named membership parent ${parent.uuid} is not a folder`);
|
|
37
|
+
}
|
|
38
|
+
const members = input.children(parent.uuid).filter(child => !input.targets.has(child.uuid))
|
|
39
|
+
.concat(input.results.filter(row => row.parentUUID === parent.uuid))
|
|
40
|
+
.filter(child => child.status === "active")
|
|
41
|
+
.map(({ uuid, name }) => ({ uuid, name }));
|
|
42
|
+
const version = canonicalVersion({ ...portable(parent),
|
|
43
|
+
payloadVersion: membershipHash(members, input.sha256Hex) }, input.sha256Hex);
|
|
44
|
+
if (version !== parent.version)
|
|
45
|
+
changed.push({ ...parent, version });
|
|
46
|
+
}
|
|
47
|
+
return changed;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=container-membership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-membership.js","sourceRoot":"","sources":["../../src/detection/container-membership.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAkB,MAAM,cAAc,CAAC;AAEhF,OAAO,EAAE,oBAAoB,IAAI,QAAQ,EAAkB,MAAM,kBAAkB,CAAC;AAIpF;6EAC6E;AAC7E,MAAM,UAAU,iBAAiB,CAAC,OAGhC;IACA,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU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CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;aACnE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC;aAC1C,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,gBAAgB,CAAC,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC;YACpD,cAAc,EAAE,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAC/E,IAAI,OAAO,KAAK,MAAM,CAAC,OAAO;YAAE,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Shutdown ended this examination. It is neither a source failure nor a
|
|
2
|
+
* completed observation; the next startup suspects the ground again. */
|
|
3
|
+
export declare class DetectCancelled extends Error {
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
6
|
+
export declare function isDetectCancelled(error: unknown): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Shutdown ended this examination. It is neither a source failure nor a
|
|
2
|
+
* completed observation; the next startup suspects the ground again. */
|
|
3
|
+
export class DetectCancelled extends Error {
|
|
4
|
+
constructor() { super("Detect examination cancelled by shutdown"); }
|
|
5
|
+
}
|
|
6
|
+
export function isDetectCancelled(error) {
|
|
7
|
+
return error instanceof DetectCancelled
|
|
8
|
+
|| (error instanceof Error && isDetectCancelled(error.cause));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=detect-cancelled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-cancelled.js","sourceRoot":"","sources":["../../src/detection/detect-cancelled.ts"],"names":[],"mappings":"AAAA;wEACwE;AACxE,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,gBAAgB,KAAK,CAAC,0CAA0C,CAAC,CAAC,CAAC,CAAC;CACrE;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,KAAK,YAAY,eAAe;WAClC,CAAC,KAAK,YAAY,KAAK,IAAI,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Physical directory associations used by one named observation. */
|
|
2
|
+
export interface DirectoryBasis {
|
|
3
|
+
readonly uuid: string;
|
|
4
|
+
readonly type: string;
|
|
5
|
+
readonly parentUUID: string | null;
|
|
6
|
+
readonly physicalKey: string;
|
|
7
|
+
}
|
|
8
|
+
export interface DirectoryPhysical {
|
|
9
|
+
readonly physicalKey: string;
|
|
10
|
+
readonly repository: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface DirectoryProofPorts<Row> {
|
|
13
|
+
/** The indexed row at a container address. Beneath a proved parent every
|
|
14
|
+
* ancestor is already proved active, so only the row's own lifecycle and
|
|
15
|
+
* its parent remain to decide; the root is decided along its whole chain. */
|
|
16
|
+
readonly lookup: (path: string, parent: Row | undefined) => Row | undefined;
|
|
17
|
+
readonly read: (path: string) => DirectoryPhysical | null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A named path can reuse an indexed identity only while its directory chain
|
|
21
|
+
* still names the same indexed physical containers. This proof owns no
|
|
22
|
+
* identity decisions: a mismatch or an unindexed container asks the complete
|
|
23
|
+
* Live reconciliation to decide. Directory timestamps are intentionally
|
|
24
|
+
* irrelevant; sibling writes do not change the parent association. Each
|
|
25
|
+
* container is read physically again at admission; the rows it was matched
|
|
26
|
+
* against are facts of the admission basis.
|
|
27
|
+
*/
|
|
28
|
+
export declare class NamedDirectoryProof<Row extends DirectoryBasis> {
|
|
29
|
+
#private;
|
|
30
|
+
/** Distinct containers this pass read; the commit's recheck is closure. */
|
|
31
|
+
metadataReads: number;
|
|
32
|
+
constructor(ports: DirectoryProofPorts<Row>);
|
|
33
|
+
private read;
|
|
34
|
+
/**
|
|
35
|
+
* Prove the directory chain containing a named path, even when Watch
|
|
36
|
+
* supplies only a child or Git notice. The name itself is read once, by
|
|
37
|
+
* the caller that classifies it; a Git notice's repository is one of its
|
|
38
|
+
* containers.
|
|
39
|
+
*/
|
|
40
|
+
named(path: string): boolean;
|
|
41
|
+
/** One indexed container, proved beneath its proved parent from the root
|
|
42
|
+
* down, so a chain costs one lookup per container however deep it runs.
|
|
43
|
+
* Each is read once per pass and retained for commit. */
|
|
44
|
+
directory(path: string): Row | undefined;
|
|
45
|
+
unchanged(): boolean;
|
|
46
|
+
}
|
|
47
|
+
export {};
|