@amalgm/shell 0.1.164-preview.36072132286 → 0.1.164-preview.36809057014
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PURPOSE.md +642 -128
- package/README.md +10 -8
- package/dist/accepted-tail.d.ts +26 -0
- package/dist/accepted-tail.js +37 -0
- package/dist/accepted-tail.js.map +1 -0
- package/dist/agent-execution.d.ts +16 -1
- package/dist/agent-execution.js +13 -5
- package/dist/agent-execution.js.map +1 -1
- package/dist/apply-cleanup.d.ts +28 -0
- package/dist/apply-cleanup.js +166 -0
- package/dist/apply-cleanup.js.map +1 -0
- package/dist/apply-recovery.d.ts +47 -0
- package/dist/apply-recovery.js +99 -0
- package/dist/apply-recovery.js.map +1 -0
- package/dist/apply-rows.d.ts +72 -0
- package/dist/apply-rows.js +150 -0
- package/dist/apply-rows.js.map +1 -0
- package/dist/apply-saves.d.ts +85 -0
- package/dist/apply-saves.js +238 -0
- package/dist/apply-saves.js.map +1 -0
- package/dist/boot.js +2 -1
- package/dist/boot.js.map +1 -1
- package/dist/capture-work.d.ts +8 -0
- package/dist/capture-work.js +67 -0
- package/dist/capture-work.js.map +1 -0
- package/dist/cargo-group.d.ts +45 -0
- package/dist/cargo-group.js +88 -0
- package/dist/cargo-group.js.map +1 -0
- package/dist/channel-session.d.ts +4 -2
- package/dist/channel-session.js +4 -3
- package/dist/channel-session.js.map +1 -1
- package/dist/chat-composition.d.ts +2 -0
- package/dist/chat-composition.js +1 -0
- package/dist/chat-composition.js.map +1 -1
- package/dist/cli.js +20 -1
- package/dist/cli.js.map +1 -1
- package/dist/construct-apply-host.d.ts +4 -2
- package/dist/construct-apply-host.js +8 -3
- package/dist/construct-apply-host.js.map +1 -1
- package/dist/construct-door.js +1 -1
- package/dist/construct-door.js.map +1 -1
- package/dist/construct-ledger.d.ts +6 -1
- package/dist/construct-ledger.js +21 -33
- package/dist/construct-ledger.js.map +1 -1
- package/dist/content-cache-collection.d.ts +18 -0
- package/dist/content-cache-collection.js +99 -0
- package/dist/content-cache-collection.js.map +1 -0
- package/dist/content-cache-host.d.ts +83 -17
- package/dist/content-cache-host.js +335 -95
- package/dist/content-cache-host.js.map +1 -1
- package/dist/content-cache-namespace.d.ts +59 -0
- package/dist/content-cache-namespace.js +210 -0
- package/dist/content-cache-namespace.js.map +1 -0
- package/dist/content-cache-ownership.d.ts +13 -0
- package/dist/content-cache-ownership.js +75 -0
- package/dist/content-cache-ownership.js.map +1 -0
- package/dist/content-cache-retention.d.ts +23 -0
- package/dist/content-cache-retention.js +195 -0
- package/dist/content-cache-retention.js.map +1 -0
- package/dist/content-capture-pool.d.ts +287 -0
- package/dist/content-capture-pool.js +461 -0
- package/dist/content-capture-pool.js.map +1 -0
- package/dist/content-capture-worker.d.ts +8 -0
- package/dist/content-capture-worker.js +109 -0
- package/dist/content-capture-worker.js.map +1 -0
- package/dist/content-clock.d.ts +42 -0
- package/dist/content-clock.js +166 -0
- package/dist/content-clock.js.map +1 -0
- package/dist/content-direct.d.ts +2 -0
- package/dist/content-direct.js +12 -0
- package/dist/content-direct.js.map +1 -1
- package/dist/content-failure.d.ts +18 -0
- package/dist/content-failure.js +38 -0
- package/dist/content-failure.js.map +1 -0
- package/dist/content-stream-thread.d.ts +60 -0
- package/dist/content-stream-thread.js +95 -0
- package/dist/content-stream-thread.js.map +1 -0
- package/dist/content-stream-worker.d.ts +7 -0
- package/dist/content-stream-worker.js +52 -0
- package/dist/content-stream-worker.js.map +1 -0
- package/dist/declaration-absorption.d.ts +37 -0
- package/dist/declaration-absorption.js +119 -0
- package/dist/declaration-absorption.js.map +1 -0
- package/dist/declaration-chain.d.ts +36 -0
- package/dist/declaration-chain.js +96 -0
- package/dist/declaration-chain.js.map +1 -0
- package/dist/declaration-commit.d.ts +31 -0
- package/dist/declaration-commit.js +49 -0
- package/dist/declaration-commit.js.map +1 -0
- package/dist/declaration-hold.d.ts +22 -0
- package/dist/declaration-hold.js +24 -0
- package/dist/declaration-hold.js.map +1 -0
- package/dist/declaration-journal.d.ts +62 -0
- package/dist/declaration-journal.js +99 -0
- package/dist/declaration-journal.js.map +1 -0
- package/dist/declaration-save.d.ts +31 -0
- package/dist/declaration-save.js +134 -0
- package/dist/declaration-save.js.map +1 -0
- package/dist/detection/accepted-result.d.ts +19 -1
- package/dist/detection/accepted-result.js +36 -5
- package/dist/detection/accepted-result.js.map +1 -1
- package/dist/detection/admission-save.d.ts +55 -0
- package/dist/detection/admission-save.js +48 -0
- package/dist/detection/admission-save.js.map +1 -0
- package/dist/detection/admission-units.d.ts +66 -0
- package/dist/detection/admission-units.js +322 -0
- package/dist/detection/admission-units.js.map +1 -0
- package/dist/detection/alias-discovery.d.ts +12 -0
- package/dist/detection/alias-discovery.js +80 -0
- package/dist/detection/alias-discovery.js.map +1 -0
- package/dist/detection/alias-examination.d.ts +30 -0
- package/dist/detection/alias-examination.js +49 -0
- package/dist/detection/alias-examination.js.map +1 -0
- package/dist/detection/apply-ownership.d.ts +81 -0
- package/dist/detection/apply-ownership.js +232 -0
- package/dist/detection/apply-ownership.js.map +1 -0
- package/dist/detection/basis-advanced.d.ts +11 -0
- package/dist/detection/basis-advanced.js +26 -0
- package/dist/detection/basis-advanced.js.map +1 -0
- package/dist/detection/capture-outcome.d.ts +16 -0
- package/dist/detection/capture-outcome.js +92 -0
- package/dist/detection/capture-outcome.js.map +1 -0
- package/dist/detection/container-membership.d.ts +32 -0
- package/dist/detection/container-membership.js +49 -0
- package/dist/detection/container-membership.js.map +1 -0
- package/dist/detection/detect-cancelled.d.ts +6 -0
- package/dist/detection/detect-cancelled.js +10 -0
- package/dist/detection/detect-cancelled.js.map +1 -0
- package/dist/detection/directory-proof.d.ts +47 -0
- package/dist/detection/directory-proof.js +77 -0
- package/dist/detection/directory-proof.js.map +1 -0
- package/dist/detection/disposition-rows.d.ts +18 -0
- package/dist/detection/disposition-rows.js +29 -0
- package/dist/detection/disposition-rows.js.map +1 -0
- package/dist/detection/dispositions.d.ts +130 -0
- package/dist/detection/dispositions.js +248 -0
- package/dist/detection/dispositions.js.map +1 -0
- package/dist/detection/git-notice.d.ts +88 -0
- package/dist/detection/git-notice.js +444 -0
- package/dist/detection/git-notice.js.map +1 -0
- package/dist/detection/ground-proof.d.ts +130 -0
- package/dist/detection/ground-proof.js +274 -0
- package/dist/detection/ground-proof.js.map +1 -0
- package/dist/detection/ground-reader.d.ts +29 -0
- package/dist/detection/ground-reader.js +102 -0
- package/dist/detection/ground-reader.js.map +1 -0
- package/dist/detection/held-territory.d.ts +51 -0
- package/dist/detection/held-territory.js +205 -0
- package/dist/detection/held-territory.js.map +1 -0
- package/dist/detection/identity-discovery.d.ts +45 -0
- package/dist/detection/identity-discovery.js +287 -0
- package/dist/detection/identity-discovery.js.map +1 -0
- package/dist/detection/maintenance-sweep.d.ts +108 -0
- package/dist/detection/maintenance-sweep.js +325 -0
- package/dist/detection/maintenance-sweep.js.map +1 -0
- package/dist/detection/name-reach.d.ts +12 -0
- package/dist/detection/name-reach.js +28 -0
- package/dist/detection/name-reach.js.map +1 -0
- package/dist/detection/notebook-basis.d.ts +5 -7
- package/dist/detection/notebook-basis.js +6 -7
- package/dist/detection/notebook-basis.js.map +1 -1
- package/dist/detection/owed-selection.d.ts +51 -0
- package/dist/detection/owed-selection.js +169 -0
- package/dist/detection/owed-selection.js.map +1 -0
- package/dist/detection/portable.d.ts +34 -34
- package/dist/detection/portable.js +67 -93
- package/dist/detection/portable.js.map +1 -1
- package/dist/detection/reconciliation-coverage.d.ts +7 -0
- package/dist/detection/reconciliation-coverage.js +16 -0
- package/dist/detection/reconciliation-coverage.js.map +1 -0
- package/dist/detection/repository-publication.d.ts +20 -0
- package/dist/detection/repository-publication.js +79 -0
- package/dist/detection/repository-publication.js.map +1 -0
- package/dist/detection/repository-routes.d.ts +43 -0
- package/dist/detection/repository-routes.js +97 -0
- package/dist/detection/repository-routes.js.map +1 -0
- package/dist/detection/root-examination.d.ts +94 -0
- package/dist/detection/root-examination.js +523 -0
- package/dist/detection/root-examination.js.map +1 -0
- package/dist/detection/runtime.d.ts +131 -64
- package/dist/detection/runtime.js +808 -1103
- package/dist/detection/runtime.js.map +1 -1
- package/dist/detection/scoped-identity-port.d.ts +34 -0
- package/dist/detection/scoped-identity-port.js +81 -0
- package/dist/detection/scoped-identity-port.js.map +1 -0
- package/dist/detection/seal-law.d.ts +66 -0
- package/dist/detection/seal-law.js +116 -0
- package/dist/detection/seal-law.js.map +1 -0
- package/dist/detection/sharing-policy.d.ts +11 -0
- package/dist/detection/sharing-policy.js +32 -0
- package/dist/detection/sharing-policy.js.map +1 -0
- package/dist/detection/thread-database.d.ts +4 -0
- package/dist/detection/thread-database.js +30 -0
- package/dist/detection/thread-database.js.map +1 -0
- package/dist/detection/unreadable.d.ts +11 -0
- package/dist/detection/unreadable.js +9 -0
- package/dist/detection/unreadable.js.map +1 -0
- package/dist/detection/verified-content.d.ts +6 -0
- package/dist/detection/verified-content.js +12 -0
- package/dist/detection/verified-content.js.map +1 -0
- package/dist/detection/walk-law.d.ts +34 -0
- package/dist/detection/walk-law.js +55 -0
- package/dist/detection/walk-law.js.map +1 -0
- package/dist/development/fly-guest.js +2 -1
- package/dist/development/fly-guest.js.map +1 -1
- package/dist/entity-apply-host.d.ts +29 -13
- package/dist/entity-apply-host.js +1426 -461
- package/dist/entity-apply-host.js.map +1 -1
- package/dist/entity-apply-store.d.ts +77 -30
- package/dist/entity-apply-store.js +221 -516
- package/dist/entity-apply-store.js.map +1 -1
- package/dist/entity-record-observability.js +2 -0
- package/dist/entity-record-observability.js.map +1 -1
- package/dist/entity-record-saves.d.ts +20 -0
- package/dist/entity-record-saves.js +91 -0
- package/dist/entity-record-saves.js.map +1 -0
- package/dist/entity-record-store.d.ts +15 -7
- package/dist/entity-record-store.js +57 -117
- package/dist/entity-record-store.js.map +1 -1
- package/dist/files-register-host.d.ts +22 -3
- package/dist/files-register-host.js +70 -31
- package/dist/files-register-host.js.map +1 -1
- package/dist/filesystem.js +3 -2
- package/dist/filesystem.js.map +1 -1
- package/dist/git-binding.d.ts +65 -0
- package/dist/git-binding.js +220 -0
- package/dist/git-binding.js.map +1 -0
- package/dist/git-capture.d.ts +39 -0
- package/dist/git-capture.js +86 -0
- package/dist/git-capture.js.map +1 -0
- package/dist/git-card.d.ts +12 -0
- package/dist/git-card.js +123 -0
- package/dist/git-card.js.map +1 -0
- package/dist/git-checkpoint-construction.d.ts +41 -0
- package/dist/git-checkpoint-construction.js +96 -0
- package/dist/git-checkpoint-construction.js.map +1 -0
- package/dist/git-checkpoint-preparation.d.ts +37 -0
- package/dist/git-checkpoint-preparation.js +145 -0
- package/dist/git-checkpoint-preparation.js.map +1 -0
- package/dist/git-command.d.ts +61 -8
- package/dist/git-command.js +217 -63
- package/dist/git-command.js.map +1 -1
- package/dist/git-configuration.d.ts +40 -0
- package/dist/git-configuration.js +217 -0
- package/dist/git-configuration.js.map +1 -0
- package/dist/git-evidence.d.ts +61 -0
- package/dist/git-evidence.js +181 -0
- package/dist/git-evidence.js.map +1 -0
- package/dist/git-index-entries.d.ts +15 -0
- package/dist/git-index-entries.js +44 -0
- package/dist/git-index-entries.js.map +1 -0
- package/dist/git-index-format.d.ts +35 -0
- package/dist/git-index-format.js +293 -0
- package/dist/git-index-format.js.map +1 -0
- package/dist/git-index-witness.d.ts +33 -0
- package/dist/git-index-witness.js +69 -0
- package/dist/git-index-witness.js.map +1 -0
- package/dist/git-literal-host.d.ts +82 -0
- package/dist/git-literal-host.js +172 -0
- package/dist/git-literal-host.js.map +1 -0
- package/dist/git-literal-read.d.ts +88 -0
- package/dist/git-literal-read.js +170 -0
- package/dist/git-literal-read.js.map +1 -0
- package/dist/git-literal-replay.d.ts +33 -0
- package/dist/git-literal-replay.js +268 -0
- package/dist/git-literal-replay.js.map +1 -0
- package/dist/git-native-file.d.ts +42 -0
- package/dist/git-native-file.js +145 -0
- package/dist/git-native-file.js.map +1 -0
- package/dist/git-native-index.d.ts +21 -0
- package/dist/git-native-index.js +44 -0
- package/dist/git-native-index.js.map +1 -0
- package/dist/git-operation-host.d.ts +48 -0
- package/dist/git-operation-host.js +127 -0
- package/dist/git-operation-host.js.map +1 -0
- package/dist/git-private-index.d.ts +11 -0
- package/dist/git-private-index.js +42 -0
- package/dist/git-private-index.js.map +1 -0
- package/dist/git-private-repository.d.ts +4 -0
- package/dist/git-private-repository.js +69 -0
- package/dist/git-private-repository.js.map +1 -0
- package/dist/git-private-view.d.ts +39 -0
- package/dist/git-private-view.js +162 -0
- package/dist/git-private-view.js.map +1 -0
- package/dist/git-ref-store.d.ts +12 -0
- package/dist/git-ref-store.js +68 -0
- package/dist/git-ref-store.js.map +1 -0
- package/dist/git-registration-host.d.ts +20 -30
- package/dist/git-registration-host.js +86 -249
- package/dist/git-registration-host.js.map +1 -1
- package/dist/git-repository-host.d.ts +148 -22
- package/dist/git-repository-host.js +633 -650
- package/dist/git-repository-host.js.map +1 -1
- package/dist/git-worktree-host.d.ts +2 -0
- package/dist/git-worktree-host.js +16 -0
- package/dist/git-worktree-host.js.map +1 -0
- package/dist/graph-publication.d.ts +75 -0
- package/dist/graph-publication.js +203 -0
- package/dist/graph-publication.js.map +1 -0
- package/dist/ground-basis.d.ts +242 -0
- package/dist/ground-basis.js +1023 -0
- package/dist/ground-basis.js.map +1 -0
- package/dist/ground-checkpoint-worker.d.ts +1 -0
- package/dist/ground-checkpoint-worker.js +84 -0
- package/dist/ground-checkpoint-worker.js.map +1 -0
- package/dist/ground-checkpoints.d.ts +16 -0
- package/dist/ground-checkpoints.js +45 -0
- package/dist/ground-checkpoints.js.map +1 -0
- package/dist/ground-coordination.d.ts +107 -3
- package/dist/ground-coordination.js +249 -24
- package/dist/ground-coordination.js.map +1 -1
- package/dist/ground-database.d.ts +42 -0
- package/dist/ground-database.js +290 -0
- package/dist/ground-database.js.map +1 -0
- package/dist/ground-differences.d.ts +23 -0
- package/dist/ground-differences.js +47 -0
- package/dist/ground-differences.js.map +1 -0
- package/dist/ground-holders.d.ts +4 -0
- package/dist/ground-holders.js +15 -0
- package/dist/ground-holders.js.map +1 -0
- package/dist/ground-initialization-worker.d.ts +1 -0
- package/dist/ground-initialization-worker.js +20 -0
- package/dist/ground-initialization-worker.js.map +1 -0
- package/dist/ground-initialization.d.ts +35 -0
- package/dist/ground-initialization.js +102 -0
- package/dist/ground-initialization.js.map +1 -0
- package/dist/ground-install-saves.d.ts +63 -0
- package/dist/ground-install-saves.js +139 -0
- package/dist/ground-install-saves.js.map +1 -0
- package/dist/ground-inventory-schema.d.ts +18 -0
- package/dist/ground-inventory-schema.js +168 -0
- package/dist/ground-inventory-schema.js.map +1 -0
- package/dist/ground-profile.d.ts +7 -0
- package/dist/ground-profile.js +52 -0
- package/dist/ground-profile.js.map +1 -0
- package/dist/ground-root-index.d.ts +2 -1
- package/dist/ground-root-index.js +16 -14
- package/dist/ground-root-index.js.map +1 -1
- package/dist/ground-row.d.ts +62 -0
- package/dist/ground-row.js +70 -0
- package/dist/ground-row.js.map +1 -0
- package/dist/ground-save-ops.d.ts +44 -0
- package/dist/ground-save-ops.js +41 -0
- package/dist/ground-save-ops.js.map +1 -0
- package/dist/ground-saver-worker.d.ts +1 -0
- package/dist/ground-saver-worker.js +156 -0
- package/dist/ground-saver-worker.js.map +1 -0
- package/dist/ground-saver.d.ts +75 -0
- package/dist/ground-saver.js +216 -0
- package/dist/ground-saver.js.map +1 -0
- package/dist/ground-store.d.ts +84 -0
- package/dist/ground-store.js +473 -0
- package/dist/ground-store.js.map +1 -0
- package/dist/ground-territory.d.ts +130 -0
- package/dist/ground-territory.js +511 -0
- package/dist/ground-territory.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/installation/ownership.d.ts +0 -2
- package/dist/installation/ownership.js +3 -15
- package/dist/installation/ownership.js.map +1 -1
- package/dist/machine-host.d.ts +3 -2
- package/dist/machine-host.js +28 -16
- package/dist/machine-host.js.map +1 -1
- package/dist/materialized-graph.d.ts +7 -7
- package/dist/materialized-graph.js +11 -23
- package/dist/materialized-graph.js.map +1 -1
- package/dist/module-thread.d.ts +9 -0
- package/dist/module-thread.js +10 -0
- package/dist/module-thread.js.map +1 -0
- package/dist/native/fsevents-stream.node +0 -0
- package/dist/physical-path-witness.d.ts +64 -0
- package/dist/physical-path-witness.js +168 -0
- package/dist/physical-path-witness.js.map +1 -0
- package/dist/register-upload-fusion.d.ts +5 -4
- package/dist/register-upload-fusion.js +9 -6
- package/dist/register-upload-fusion.js.map +1 -1
- package/dist/registry-graph.d.ts +3 -2
- package/dist/registry-graph.js +9 -6
- package/dist/registry-graph.js.map +1 -1
- package/dist/registry-page-cache.d.ts +5 -2
- package/dist/registry-page-cache.js.map +1 -1
- package/dist/repository-identity-steps.d.ts +5 -0
- package/dist/repository-identity-steps.js +33 -0
- package/dist/repository-identity-steps.js.map +1 -0
- package/dist/runtime-node-flags.d.ts +10 -0
- package/dist/runtime-node-flags.js +11 -0
- package/dist/runtime-node-flags.js.map +1 -0
- package/dist/service/adapter.d.ts +1 -1
- package/dist/service/adapter.js +1 -1
- package/dist/service/adapter.js.map +1 -1
- package/dist/service/cli.js +16 -20
- package/dist/service/cli.js.map +1 -1
- package/dist/service/control.d.ts +2 -2
- package/dist/service/keepalive.d.ts +4 -11
- package/dist/service/keepalive.js +65 -118
- package/dist/service/keepalive.js.map +1 -1
- package/dist/service/policy.d.ts +36 -0
- package/dist/service/policy.js +25 -0
- package/dist/service/policy.js.map +1 -0
- package/dist/service/portable.d.ts +1 -1
- package/dist/service/portable.js +1 -1
- package/dist/service/portable.js.map +1 -1
- package/dist/service/recovery.d.ts +10 -9
- package/dist/service/recovery.js +29 -19
- package/dist/service/recovery.js.map +1 -1
- package/dist/service/windows-action.d.ts +5 -3
- package/dist/service/windows-action.js +6 -9
- package/dist/service/windows-action.js.map +1 -1
- package/dist/service/windows-task.js +5 -5
- package/dist/service/windows-task.js.map +1 -1
- package/dist/sharing-admission.d.ts +17 -0
- package/dist/sharing-admission.js +128 -0
- package/dist/sharing-admission.js.map +1 -0
- package/dist/snapshot-delivery-baseline.d.ts +12 -3
- package/dist/snapshot-delivery-baseline.js +41 -42
- package/dist/snapshot-delivery-baseline.js.map +1 -1
- package/dist/source-proof.d.ts +36 -0
- package/dist/source-proof.js +70 -0
- package/dist/source-proof.js.map +1 -0
- package/dist/source-signature.d.ts +56 -0
- package/dist/source-signature.js +56 -0
- package/dist/source-signature.js.map +1 -0
- package/dist/source-witness.d.ts +15 -0
- package/dist/source-witness.js +29 -0
- package/dist/source-witness.js.map +1 -0
- package/dist/sqlite-durability.d.ts +31 -0
- package/dist/sqlite-durability.js +28 -0
- package/dist/sqlite-durability.js.map +1 -0
- package/dist/sqlite.d.ts +8 -2
- package/dist/sqlite.js +27 -4
- package/dist/sqlite.js.map +1 -1
- package/dist/sync-address.d.ts +19 -0
- package/dist/sync-address.js +52 -0
- package/dist/sync-address.js.map +1 -0
- package/dist/sync-setting.d.ts +15 -0
- package/dist/sync-setting.js +13 -0
- package/dist/sync-setting.js.map +1 -1
- package/dist/turns.d.ts +42 -0
- package/dist/turns.js +112 -0
- package/dist/turns.js.map +1 -0
- package/dist/updates/bootstrap.d.ts +53 -7
- package/dist/updates/bootstrap.js +224 -137
- package/dist/updates/bootstrap.js.map +1 -1
- package/dist/updates/controller.d.ts +8 -0
- package/dist/updates/controller.js +27 -3
- package/dist/updates/controller.js.map +1 -1
- package/dist/updates/store.d.ts +3 -0
- package/dist/updates/store.js +12 -0
- package/dist/updates/store.js.map +1 -1
- package/dist/user-ground-host.d.ts +364 -69
- package/dist/user-ground-host.js +5231 -3366
- package/dist/user-ground-host.js.map +1 -1
- package/dist/watching/fsevents.d.ts +52 -1
- package/dist/watching/fsevents.js +60 -25
- package/dist/watching/fsevents.js.map +1 -1
- package/dist/watching/host.d.ts +129 -5
- package/dist/watching/host.js +433 -80
- package/dist/watching/host.js.map +1 -1
- package/dist/watching/index.d.ts +1 -1
- package/dist/wire-binary.d.ts +3 -2
- package/dist/wire-binary.js +10 -8
- package/dist/wire-binary.js.map +1 -1
- package/dist/wire-client.d.ts +3 -4
- package/dist/wire-client.js +18 -44
- package/dist/wire-client.js.map +1 -1
- package/dist/wire-outbox.d.ts +34 -0
- package/dist/wire-outbox.js +127 -0
- package/dist/wire-outbox.js.map +1 -0
- package/dist/workspace-host.d.ts +4 -0
- package/dist/workspace-host.js +12 -1
- package/dist/workspace-host.js.map +1 -1
- package/examinations/fixtures/private-wire-authority.js +133 -10
- package/npm-shrinkwrap.json +43 -56
- package/package.json +26 -13
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type RestartPolicy } from './policy.js';
|
|
2
2
|
import type { ServiceIdentity } from './registration.js';
|
|
3
3
|
export interface RecoveryState {
|
|
4
4
|
readonly attempts: number;
|
|
5
|
-
readonly maxAttempts: number;
|
|
6
5
|
readonly generation: string | null;
|
|
7
6
|
readonly lastFailure: string | null;
|
|
7
|
+
readonly lastFailureAt: string | null;
|
|
8
8
|
readonly lastHealthyGeneration: string | null;
|
|
9
9
|
readonly lastHealthyAt: string | null;
|
|
10
|
-
readonly parked: boolean;
|
|
11
10
|
}
|
|
12
11
|
/** Only the controller holding the installation lease opens this journal.
|
|
13
|
-
* Charge
|
|
14
|
-
*
|
|
12
|
+
* Charge each start before the host effect so controller replacement cannot
|
|
13
|
+
* reset the backoff; a sustained healthy run is the only thing that does. */
|
|
15
14
|
export declare class RuntimeRecovery {
|
|
16
|
-
readonly policy:
|
|
15
|
+
readonly policy: RestartPolicy;
|
|
17
16
|
private readonly database;
|
|
18
|
-
|
|
19
|
-
constructor(identity: ServiceIdentity, policy?: ChildRestartPolicy);
|
|
17
|
+
constructor(identity: ServiceIdentity, policy?: RestartPolicy);
|
|
20
18
|
get state(): RecoveryState;
|
|
19
|
+
/** The backoff counts from the last failure, so time already spent down —
|
|
20
|
+
* a reboot, a controller replacement — is never waited again. */
|
|
21
21
|
get delayMs(): number;
|
|
22
22
|
begin(generation: string): void;
|
|
23
23
|
healthy(generation: string): void;
|
|
24
24
|
exited(generation: string, failure: string | null): void;
|
|
25
|
-
retry
|
|
25
|
+
/** Operator retry and an authorized update both start without waiting. */
|
|
26
|
+
reset(): void;
|
|
26
27
|
close(): void;
|
|
27
28
|
}
|
package/dist/service/recovery.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { CHILD_RESTART_POLICY } from '@amalgm/core/supervision';
|
|
2
1
|
import { join } from 'node:path';
|
|
3
2
|
import { openFileDatabase } from '../sqlite.js';
|
|
3
|
+
import { backoffMs } from '../updates/bootstrap.js';
|
|
4
|
+
import { ALWAYS_ON_POLICY } from './policy.js';
|
|
4
5
|
/** Only the controller holding the installation lease opens this journal.
|
|
5
|
-
* Charge
|
|
6
|
-
*
|
|
6
|
+
* Charge each start before the host effect so controller replacement cannot
|
|
7
|
+
* reset the backoff; a sustained healthy run is the only thing that does. */
|
|
7
8
|
export class RuntimeRecovery {
|
|
8
9
|
policy;
|
|
9
10
|
database;
|
|
10
|
-
|
|
11
|
-
constructor(identity, policy = CHILD_RESTART_POLICY) {
|
|
11
|
+
constructor(identity, policy = ALWAYS_ON_POLICY.restart) {
|
|
12
12
|
this.policy = policy;
|
|
13
|
-
this.maxAttempts = policy.maxRestarts + 1;
|
|
14
13
|
this.database = openFileDatabase(join(identity.serviceDir, 'recovery.sqlite'));
|
|
15
14
|
try {
|
|
16
15
|
this.database.pragma('synchronous = FULL');
|
|
@@ -19,8 +18,13 @@ export class RuntimeRecovery {
|
|
|
19
18
|
attempts INTEGER NOT NULL CHECK (attempts >= 0),
|
|
20
19
|
generation TEXT, lastFailure TEXT, lastHealthyGeneration TEXT, lastHealthyAt TEXT
|
|
21
20
|
);
|
|
22
|
-
INSERT OR IGNORE INTO recovery (id, attempts) VALUES (1, 0);
|
|
23
|
-
|
|
21
|
+
INSERT OR IGNORE INTO recovery (id, attempts) VALUES (1, 0);`);
|
|
22
|
+
const columns = this.database.pragma('table_info(recovery)');
|
|
23
|
+
if (!columns.some(column => column.name === 'lastFailureAt'))
|
|
24
|
+
this.database.exec('ALTER TABLE recovery ADD COLUMN lastFailureAt TEXT');
|
|
25
|
+
// The failure time stays the runtime's own: a controller that died
|
|
26
|
+
// around a healthy runtime is no reason to delay its next start.
|
|
27
|
+
this.database.exec(`UPDATE recovery SET generation = NULL,
|
|
24
28
|
lastFailure = 'Controller exited before its runtime drained'
|
|
25
29
|
WHERE generation IS NOT NULL;`);
|
|
26
30
|
}
|
|
@@ -30,28 +34,34 @@ export class RuntimeRecovery {
|
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
36
|
get state() {
|
|
33
|
-
|
|
34
|
-
return { ...row, maxAttempts: this.maxAttempts, parked: row.generation === null && row.attempts >= this.maxAttempts };
|
|
37
|
+
return this.database.prepare('SELECT attempts, generation, lastFailure, lastFailureAt, lastHealthyGeneration, lastHealthyAt FROM recovery WHERE id = 1').get();
|
|
35
38
|
}
|
|
39
|
+
/** The backoff counts from the last failure, so time already spent down —
|
|
40
|
+
* a reboot, a controller replacement — is never waited again. */
|
|
36
41
|
get delayMs() {
|
|
37
|
-
const { attempts } = this.state;
|
|
38
|
-
|
|
42
|
+
const { attempts, lastFailureAt } = this.state;
|
|
43
|
+
const delay = backoffMs(this.policy, attempts);
|
|
44
|
+
if (!delay || !lastFailureAt)
|
|
45
|
+
return 0;
|
|
46
|
+
return Math.min(delay, Math.max(0, delay - (Date.now() - Date.parse(lastFailureAt))));
|
|
39
47
|
}
|
|
40
48
|
begin(generation) {
|
|
41
|
-
const result = this.database.prepare('UPDATE recovery SET attempts = attempts + 1, generation = ? WHERE id = 1 AND generation IS NULL
|
|
49
|
+
const result = this.database.prepare('UPDATE recovery SET attempts = attempts + 1, generation = ? WHERE id = 1 AND generation IS NULL').run(generation);
|
|
42
50
|
if (result.changes !== 1)
|
|
43
|
-
throw new Error('
|
|
51
|
+
throw new Error('A runtime generation is still owned.');
|
|
44
52
|
}
|
|
45
53
|
healthy(generation) {
|
|
46
|
-
this.database.prepare('UPDATE recovery SET attempts = 0, lastFailure = NULL, lastHealthyGeneration = ?, lastHealthyAt = ? WHERE id = 1 AND generation = ?')
|
|
54
|
+
this.database.prepare('UPDATE recovery SET attempts = 0, lastFailure = NULL, lastFailureAt = NULL, lastHealthyGeneration = ?, lastHealthyAt = ? WHERE id = 1 AND generation = ?')
|
|
47
55
|
.run(generation, new Date().toISOString(), generation);
|
|
48
56
|
}
|
|
49
57
|
exited(generation, failure) {
|
|
50
|
-
this.database.prepare(
|
|
51
|
-
|
|
58
|
+
this.database.prepare(`UPDATE recovery SET generation = NULL, lastFailure = COALESCE(@failure, lastFailure),
|
|
59
|
+
lastFailureAt = CASE WHEN @failure IS NULL THEN lastFailureAt ELSE @at END WHERE id = 1 AND generation = @generation`)
|
|
60
|
+
.run({ failure: failure?.slice(0, 1_024) ?? null, at: new Date().toISOString(), generation });
|
|
52
61
|
}
|
|
53
|
-
retry
|
|
54
|
-
|
|
62
|
+
/** Operator retry and an authorized update both start without waiting. */
|
|
63
|
+
reset() {
|
|
64
|
+
this.database.prepare('UPDATE recovery SET attempts = 0 WHERE id = 1').run();
|
|
55
65
|
}
|
|
56
66
|
close() { this.database.close(); }
|
|
57
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recovery.js","sourceRoot":"","sources":["../../src/service/recovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"recovery.js","sourceRoot":"","sources":["../../src/service/recovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAsB,MAAM,aAAa,CAAC;AAYnE;;6EAE6E;AAC7E,MAAM,OAAO,eAAe;IAGsB;IAF/B,QAAQ,CAAC;IAE1B,YAAY,QAAyB,EAAW,SAAwB,gB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AC,CAAC,EAAE,KAAK,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IACxF,CAAC;IAED,KAAK,CAAC,UAAkB;QACtB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,iGAAiG,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACxJ,IAAI,MAAM,CAAC,OAAO,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,CAAC,UAAkB;QACxB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,0JAA0J,CAAC;aAC9K,GAAG,CAAC,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,CAAC,UAAkB,EAAE,OAAsB;QAC/C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;2HACiG,CAAC;aACrH,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAClG,CAAC;IAED,0EAA0E;IAC1E,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,+CAA+C,CAAC,CAAC,GAAG,EAAE,CAAC;IAC/E,CAAC;IAED,KAAK,KAAW,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CACzC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type RestartPolicy } from './policy.js';
|
|
2
2
|
export declare const encodePowerShell: (source: string) => string;
|
|
3
3
|
export declare function jsonExpression(value: unknown): string;
|
|
4
4
|
export declare function powershellExecutable(env?: NodeJS.ProcessEnv): string;
|
|
@@ -9,8 +9,10 @@ export declare function quoteWindowsArgument(value: string): string;
|
|
|
9
9
|
* https://learn.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw */
|
|
10
10
|
export declare function powershellArguments(encoded: string, hidden?: boolean): string[];
|
|
11
11
|
/** Scheduler owns this action's logged-in lifetime. Its launch-retry setting
|
|
12
|
-
* cannot observe controller exits, so this
|
|
12
|
+
* cannot observe controller exits, so this action restarts the controller
|
|
13
|
+
* itself: every exit except an operator stop (0) is retried after a doubling
|
|
14
|
+
* delay capped at the policy's maximum, for as long as the user is logged in.
|
|
13
15
|
* Self-assignment before launch avoids a spawn/assign race. The action alone
|
|
14
16
|
* owns the non-inheritable job handle, which the OS closes on action death.
|
|
15
17
|
* https://learn.microsoft.com/windows/win32/procthread/job-objects */
|
|
16
|
-
export declare function windowsControllerAction(command: readonly string[], workingDirectory: string, restartPolicy?:
|
|
18
|
+
export declare function windowsControllerAction(command: readonly string[], workingDirectory: string, restartPolicy?: RestartPolicy): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { win32 } from 'node:path';
|
|
2
|
-
import {
|
|
2
|
+
import { ALWAYS_ON_POLICY } from './policy.js';
|
|
3
3
|
export const encodePowerShell = (source) => Buffer.from(source, 'utf16le').toString('base64');
|
|
4
4
|
export function jsonExpression(value) {
|
|
5
5
|
return `ConvertFrom-Json ([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('${Buffer.from(JSON.stringify(value), 'utf8').toString('base64')}')))`;
|
|
@@ -24,11 +24,13 @@ export function powershellArguments(encoded, hidden = false) {
|
|
|
24
24
|
return args;
|
|
25
25
|
}
|
|
26
26
|
/** Scheduler owns this action's logged-in lifetime. Its launch-retry setting
|
|
27
|
-
* cannot observe controller exits, so this
|
|
27
|
+
* cannot observe controller exits, so this action restarts the controller
|
|
28
|
+
* itself: every exit except an operator stop (0) is retried after a doubling
|
|
29
|
+
* delay capped at the policy's maximum, for as long as the user is logged in.
|
|
28
30
|
* Self-assignment before launch avoids a spawn/assign race. The action alone
|
|
29
31
|
* owns the non-inheritable job handle, which the OS closes on action death.
|
|
30
32
|
* https://learn.microsoft.com/windows/win32/procthread/job-objects */
|
|
31
|
-
export function windowsControllerAction(command, workingDirectory, restartPolicy =
|
|
33
|
+
export function windowsControllerAction(command, workingDirectory, restartPolicy = ALWAYS_ON_POLICY.restart) {
|
|
32
34
|
if (!command.length || !command[0])
|
|
33
35
|
throw new Error('The controller needs an executable.');
|
|
34
36
|
const action = encodePowerShell(`
|
|
@@ -106,7 +108,6 @@ $start.WorkingDirectory = $launch.workingDirectory
|
|
|
106
108
|
$start.UseShellExecute = $false
|
|
107
109
|
$start.CreateNoWindow = $true
|
|
108
110
|
$clock = [Diagnostics.Stopwatch]::StartNew()
|
|
109
|
-
$history = @()
|
|
110
111
|
$delay = $policy.initialDelayMs
|
|
111
112
|
while ($true) {
|
|
112
113
|
$started = $clock.ElapsedMilliseconds
|
|
@@ -119,11 +120,7 @@ while ($true) {
|
|
|
119
120
|
} catch { [Console]::Error.WriteLine($_.Exception.Message) }
|
|
120
121
|
finally { if ($runtimeProcess) { $runtimeProcess.Dispose() } }
|
|
121
122
|
if ($result -eq 0) { exit 0 }
|
|
122
|
-
$
|
|
123
|
-
if ($now - $started -ge $policy.stableAfterMs) { $delay = $policy.initialDelayMs; $history = @() }
|
|
124
|
-
$history = @($history | Where-Object { $now - $_ -le $policy.windowMs })
|
|
125
|
-
if ($history.Count -ge $policy.maxRestarts) { exit $result }
|
|
126
|
-
$history += $now
|
|
123
|
+
if ($clock.ElapsedMilliseconds - $started -ge $policy.stableAfterMs) { $delay = $policy.initialDelayMs }
|
|
127
124
|
Start-Sleep -Milliseconds $delay
|
|
128
125
|
$delay = [Math]::Min($delay * 2, $policy.maxDelayMs)
|
|
129
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windows-action.js","sourceRoot":"","sources":["../../src/service/windows-action.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Arguments, powershellExecutable, quoteWindowsArgument } from './windows-action.js';
|
|
3
2
|
export { encodePowerShell, powershellExecutable, quoteWindowsArgument, windowsControllerAction } from './windows-action.js';
|
|
4
3
|
/** All input is structured JSON transported as ASCII stdin and decoded as UTF-8.
|
|
@@ -9,12 +8,13 @@ export function windowsTaskOperation(input) {
|
|
|
9
8
|
const executable = powershellExecutable();
|
|
10
9
|
const request = { operation: input.operation, name: input.name, executable,
|
|
11
10
|
...(input.action ? { arguments: powershellArguments(input.action, true).map(quoteWindowsArgument).join(' ') } : {}),
|
|
12
|
-
|
|
13
|
-
//
|
|
11
|
+
// MS-TSCH 2.5.4.2: these retries cover failure to start an action, not its
|
|
12
|
+
// exit, which the action itself retries. Both values are the schema's
|
|
13
|
+
// bounds: the most retries, one minute apart.
|
|
14
14
|
// https://learn.microsoft.com/openspecs/windows_protocols/ms-tsch/2ff4aa5a-7bc4-449f-bbb1-27475645867f
|
|
15
|
-
// Task Scheduler's supported minimum is one minute.
|
|
16
15
|
// https://learn.microsoft.com/windows/win32/taskschd/taskschedulerschema-restarttype-complextype
|
|
17
|
-
|
|
16
|
+
restartCount: 999,
|
|
17
|
+
restartIntervalMs: 60_000 };
|
|
18
18
|
const command = encodePowerShell(`
|
|
19
19
|
$ErrorActionPreference = 'Stop'
|
|
20
20
|
$request = ConvertFrom-Json ([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String([Console]::In.ReadToEnd())))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windows-task.js","sourceRoot":"","sources":["../../src/service/windows-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"windows-task.js","sourceRoot":"","sources":["../../src/service/windows-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACxH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAI5H;;;+EAG+E;AAC/E,MAAM,UAAU,oBAAoB,CAAC,KAIpC;IACC,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;IAC1C,MAAM,OAAO,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,UAAU;QACxE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,mBAAmB,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnH,2EAA2E;QAC3E,sEAAsE;QACtE,8CAA8C;QAC9C,uGAAuG;QACvG,iGAAiG;QACjG,YAAY,EAAE,GAAG;QACjB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BlC,CAAC,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,mBAAmB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;AACpI,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Transaction-local provenance for the sharing baseline. The only durable
|
|
2
|
+
* value is its originating mutation ID on the existing notebook row. */
|
|
3
|
+
import { type LocalEntityRecord } from "@amalgm/live";
|
|
4
|
+
import type Database from "better-sqlite3";
|
|
5
|
+
import { type GroundRow } from "./ground-row.js";
|
|
6
|
+
import type { GroundTransition } from "./ground-basis.js";
|
|
7
|
+
export type SharingWrite = "replace" | "retain-equivalent";
|
|
8
|
+
export declare function sameSharingResult(before: GroundRow, after: GroundRow): boolean;
|
|
9
|
+
export declare class SharingAdmission {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(database: Database.Database);
|
|
12
|
+
batch(get: (uuid: string) => GroundRow | undefined): {
|
|
13
|
+
changed(before: GroundRow | undefined, after: GroundRow | undefined, mode: SharingWrite): void;
|
|
14
|
+
admit(record: LocalEntityRecord): string;
|
|
15
|
+
finish(transitions: Iterable<GroundTransition>): ReadonlyMap<string, string | null>;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/** Transaction-local provenance for the sharing baseline. The only durable
|
|
2
|
+
* value is its originating mutation ID on the existing notebook row. */
|
|
3
|
+
import { assertRecord, checkLocalEntityRecord, encodeEntityRecord } from "@amalgm/live";
|
|
4
|
+
import { portableGroundRecord } from "./ground-row.js";
|
|
5
|
+
export function sameSharingResult(before, after) {
|
|
6
|
+
return before.resourceId === after.resourceId
|
|
7
|
+
&& JSON.stringify(portableGroundRecord(before)) === JSON.stringify(portableGroundRecord(after));
|
|
8
|
+
}
|
|
9
|
+
/** A nested repository contributes its placement, never its independent head. */
|
|
10
|
+
function sameRepositoryPlacement(before, after) {
|
|
11
|
+
return before?.type === "repo.git" && after?.type === "repo.git"
|
|
12
|
+
&& before.resourceId === after.resourceId && before.rootUUID === after.rootUUID
|
|
13
|
+
&& before.parentUUID === after.parentUUID && before.name === after.name
|
|
14
|
+
&& before.status === after.status;
|
|
15
|
+
}
|
|
16
|
+
export class SharingAdmission {
|
|
17
|
+
#database;
|
|
18
|
+
#append;
|
|
19
|
+
constructor(database) {
|
|
20
|
+
this.#database = database;
|
|
21
|
+
this.#append = database.prepare(`INSERT INTO record_outbox(
|
|
22
|
+
mutation_id, authority_id, entity_id, record_json, status, global_sequence, created_at, accepted_at
|
|
23
|
+
) VALUES (?, ?, ?, ?, 'pending', NULL, ?, NULL)`);
|
|
24
|
+
}
|
|
25
|
+
batch(get) {
|
|
26
|
+
const touched = new Map();
|
|
27
|
+
const placements = new Map();
|
|
28
|
+
const admitted = new Map();
|
|
29
|
+
let sealed = false;
|
|
30
|
+
return {
|
|
31
|
+
changed(before, after, mode) {
|
|
32
|
+
if (sealed)
|
|
33
|
+
throw new Error("sharing projection cannot change after Record admission");
|
|
34
|
+
if (mode === "retain-equivalent" && before && after && sameSharingResult(before, after)) {
|
|
35
|
+
if (before.relativePath !== after.relativePath || before.rootUUID !== after.rootUUID) {
|
|
36
|
+
placements.set(before.uuid, { before: placements.get(before.uuid)?.before ?? before, after });
|
|
37
|
+
}
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const uuid = (after ?? before)?.uuid;
|
|
41
|
+
if (!uuid)
|
|
42
|
+
return;
|
|
43
|
+
const previous = touched.get(uuid);
|
|
44
|
+
touched.set(uuid, { before: previous ? previous.before : before, after });
|
|
45
|
+
},
|
|
46
|
+
// A repository's package is its territory, which the admitting unit's
|
|
47
|
+
// basis holds unchanged since the rows it was built from.
|
|
48
|
+
admit: (record) => {
|
|
49
|
+
sealed = true;
|
|
50
|
+
if (admitted.has(record.entityId))
|
|
51
|
+
throw new Error("one sharing batch cannot admit two records for one entity");
|
|
52
|
+
const row = get(record.entityId);
|
|
53
|
+
const valid = checkLocalEntityRecord(record);
|
|
54
|
+
if (!valid.ok)
|
|
55
|
+
throw new Error(valid.error);
|
|
56
|
+
if (!row || row.resourceId !== record.authorityId || record.change.origin !== "detected"
|
|
57
|
+
|| JSON.stringify(portableGroundRecord(row)) !== JSON.stringify(assertRecord(record.change.result))) {
|
|
58
|
+
throw new Error("sharing admission requires its exact selected result");
|
|
59
|
+
}
|
|
60
|
+
const json = encodeEntityRecord(record);
|
|
61
|
+
this.#append.run(record.mutationId, record.authorityId, record.entityId, json, record.createdAt);
|
|
62
|
+
admitted.set(record.entityId, record);
|
|
63
|
+
return json;
|
|
64
|
+
},
|
|
65
|
+
finish: transitions => {
|
|
66
|
+
if (!this.#database.inTransaction)
|
|
67
|
+
throw new Error("sharing admission belongs to a ground transaction");
|
|
68
|
+
const originals = new Map([...transitions].filter(change => change.inventory === "detection_notebook")
|
|
69
|
+
.map(change => [(change.after ?? change.before).uuid, change.before]));
|
|
70
|
+
const original = (uuid) => originals.has(uuid) ? originals.get(uuid) : get(uuid);
|
|
71
|
+
const invalid = new Set(touched.keys());
|
|
72
|
+
const owner = (row, read) => {
|
|
73
|
+
if (!row || row.uuid === row.rootUUID)
|
|
74
|
+
return null;
|
|
75
|
+
const seen = new Set();
|
|
76
|
+
let uuid = row?.parentUUID;
|
|
77
|
+
while (uuid) {
|
|
78
|
+
if (seen.has(uuid))
|
|
79
|
+
throw new Error("sharing ancestry contains a cycle");
|
|
80
|
+
seen.add(uuid);
|
|
81
|
+
const parent = read(uuid);
|
|
82
|
+
if (!parent && uuid === row.rootUUID)
|
|
83
|
+
return null; // An unmaterialized boundary has no local certificate.
|
|
84
|
+
if (!parent)
|
|
85
|
+
throw new Error("sharing owner has incomplete original ancestry");
|
|
86
|
+
if (parent.type === "repo.git")
|
|
87
|
+
return parent;
|
|
88
|
+
if (parent.uuid === row.rootUUID)
|
|
89
|
+
return null;
|
|
90
|
+
uuid = parent.parentUUID;
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
};
|
|
94
|
+
for (const { before, after } of touched.values()) {
|
|
95
|
+
if (sameRepositoryPlacement(before, after))
|
|
96
|
+
continue;
|
|
97
|
+
for (const root of [owner(before, original), owner(after, get)])
|
|
98
|
+
if (root)
|
|
99
|
+
invalid.add(root.uuid);
|
|
100
|
+
}
|
|
101
|
+
for (const { before, after } of placements.values()) {
|
|
102
|
+
const priorOwner = owner(before, original), nextOwner = owner(after, get);
|
|
103
|
+
const address = (member, root) => root
|
|
104
|
+
? member.relativePath.slice(root.relativePath ? root.relativePath.length + 1 : 0) : null;
|
|
105
|
+
if (priorOwner?.uuid === nextOwner?.uuid && address(before, priorOwner) === address(after, nextOwner))
|
|
106
|
+
continue;
|
|
107
|
+
for (const root of [priorOwner, nextOwner])
|
|
108
|
+
if (root)
|
|
109
|
+
invalid.add(root.uuid);
|
|
110
|
+
}
|
|
111
|
+
const changes = new Map();
|
|
112
|
+
for (const uuid of new Set([...invalid, ...admitted.keys()])) {
|
|
113
|
+
const row = get(uuid);
|
|
114
|
+
if (!row)
|
|
115
|
+
continue;
|
|
116
|
+
const next = admitted.get(uuid)?.mutationId ?? null;
|
|
117
|
+
// A newly inserted row starts without provenance. Cold declaration
|
|
118
|
+
// needs no extra write to erase a certificate that never existed.
|
|
119
|
+
if (next === null && !original(uuid))
|
|
120
|
+
continue;
|
|
121
|
+
changes.set(uuid, next);
|
|
122
|
+
}
|
|
123
|
+
return changes;
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=sharing-admission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharing-admission.js","sourceRoot":"","sources":["../src/sharing-admission.ts"],"names":[],"mappings":"AAAA;wEACwE;AACxE,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,kBAAkB,EAA0B,MAAM,cAAc,CAAC;AAEhH,OAAO,EAAE,oBAAoB,EAAkB,MAAM,iBAAiB,CAAC;AAKvE,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,KAAgB;IACnE,OAAO,MAAM,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU;WACxC,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC;AACpG,CAAC;AAED,iFAAiF;AACjF,SAAS,uBAAuB,CAAC,MAA6B,EAAE,KAA4B;IAC1F,OAAO,MAAM,EAAE,IAAI,KAAK,UAAU,IAAI,KAAK,EAAE,IAAI,KAAK,UAAU;WAC3D,MAAM,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,IAAI,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|
|
|
6
6
|
* or below N are history rather than Apply work. Per-entity cursors remain
|
|
7
7
|
* lazy: the first later delivery proves its predecessor from this complete
|
|
8
8
|
* authority prefix.
|
|
9
|
+
*
|
|
10
|
+
* A cursor that jumps to N never received the records it skipped, so N
|
|
11
|
+
* becomes the history floor: the Inbox holds every authority record in
|
|
12
|
+
* (floor, cursor], and nothing below the floor may be read as a tail.
|
|
9
13
|
*/
|
|
10
|
-
import Database from "better-sqlite3";
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
import type Database from "better-sqlite3";
|
|
15
|
+
/** `record.adoptSnapshotBaseline`, run only by the ground file's saver thread
|
|
16
|
+
* (ground-saver.ts): how many retained Inbox rows N resolves. */
|
|
17
|
+
export declare function adoptSnapshotDeliveryBaseline(database: Database.Database, input: {
|
|
18
|
+
readonly authorityId: string;
|
|
19
|
+
readonly deliverySequence: number;
|
|
20
|
+
readonly now: number;
|
|
21
|
+
}): number;
|
|
@@ -6,53 +6,52 @@
|
|
|
6
6
|
* or below N are history rather than Apply work. Per-entity cursors remain
|
|
7
7
|
* lazy: the first later delivery proves its predecessor from this complete
|
|
8
8
|
* authority prefix.
|
|
9
|
+
*
|
|
10
|
+
* A cursor that jumps to N never received the records it skipped, so N
|
|
11
|
+
* becomes the history floor: the Inbox holds every authority record in
|
|
12
|
+
* (floor, cursor], and nothing below the floor may be read as a tail.
|
|
9
13
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
)
|
|
16
|
-
`);
|
|
17
|
-
}
|
|
18
|
-
export function adoptSnapshotDeliveryBaseline(database, authorityId, deliverySequence, now = Date.now()) {
|
|
14
|
+
import { cachedStatement } from "./sqlite.js";
|
|
15
|
+
/** `record.adoptSnapshotBaseline`, run only by the ground file's saver thread
|
|
16
|
+
* (ground-saver.ts): how many retained Inbox rows N resolves. */
|
|
17
|
+
export function adoptSnapshotDeliveryBaseline(database, input) {
|
|
18
|
+
const { authorityId, deliverySequence, now } = input;
|
|
19
19
|
if (!authorityId)
|
|
20
20
|
throw new Error("snapshot delivery authority is required");
|
|
21
21
|
if (!Number.isSafeInteger(deliverySequence) || deliverySequence < 0) {
|
|
22
22
|
throw new Error("snapshot delivery watermark must be a non-negative integer");
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})();
|
|
24
|
+
cachedStatement(database, `
|
|
25
|
+
INSERT INTO authority_snapshot_baselines(authority_id, delivery_sequence)
|
|
26
|
+
VALUES (?, ?)
|
|
27
|
+
ON CONFLICT(authority_id) DO UPDATE SET
|
|
28
|
+
delivery_sequence = MAX(delivery_sequence, excluded.delivery_sequence)
|
|
29
|
+
`).run(authorityId, deliverySequence);
|
|
30
|
+
cachedStatement(database, `
|
|
31
|
+
INSERT INTO authority_delivery_cursors(authority_id, received_through, history_floor)
|
|
32
|
+
VALUES (?, ?, ?)
|
|
33
|
+
ON CONFLICT(authority_id) DO UPDATE SET
|
|
34
|
+
history_floor = CASE WHEN received_through < excluded.received_through
|
|
35
|
+
THEN MAX(history_floor, excluded.received_through) ELSE history_floor END,
|
|
36
|
+
received_through = MAX(received_through, excluded.received_through)
|
|
37
|
+
`).run(authorityId, deliverySequence, deliverySequence);
|
|
38
|
+
// The snapshot replaces per-entity receive history through N. Retain a
|
|
39
|
+
// cursor only when this machine already holds a genuinely later delivery;
|
|
40
|
+
// otherwise the first post-snapshot record establishes its immediate
|
|
41
|
+
// predecessor from the complete authority prefix.
|
|
42
|
+
cachedStatement(database, `
|
|
43
|
+
DELETE FROM entity_receive_cursors AS cursor
|
|
44
|
+
WHERE cursor.authority_id = ?
|
|
45
|
+
AND NOT EXISTS (
|
|
46
|
+
SELECT 1 FROM record_inbox AS inbox
|
|
47
|
+
WHERE inbox.authority_id = cursor.authority_id
|
|
48
|
+
AND inbox.entity_id = cursor.entity_id
|
|
49
|
+
AND inbox.delivery_sequence > ?
|
|
50
|
+
)
|
|
51
|
+
`).run(authorityId, deliverySequence);
|
|
52
|
+
return cachedStatement(database, `
|
|
53
|
+
UPDATE record_inbox SET resolved_at = ?
|
|
54
|
+
WHERE authority_id = ? AND delivery_sequence <= ? AND resolved_at IS NULL
|
|
55
|
+
`).run(now, authorityId, deliverySequence).changes;
|
|
57
56
|
}
|
|
58
57
|
//# sourceMappingURL=snapshot-delivery-baseline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot-delivery-baseline.js","sourceRoot":"","sources":["../src/snapshot-delivery-baseline.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"snapshot-delivery-baseline.js","sourceRoot":"","sources":["../src/snapshot-delivery-baseline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;iEACiE;AACjE,MAAM,UAAU,6BAA6B,CAAC,QAA2B,EAAE,KAI1E;IACC,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IACrD,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7E,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,GAAG,CAAC,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IACD,eAAe,CAAC,QAAQ,EAAE;;;;;GAKzB,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IACtC,eAAe,CAAC,QAAQ,EAAE;;;;;;;GAOzB,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;IACxD,uEAAuE;IACvE,0EAA0E;IAC1E,qEAAqE;IACrE,kDAAkD;IAClD,eAAe,CAAC,QAAQ,EAAE;;;;;;;;;GASzB,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IACtC,OAAO,eAAe,CAAC,QAAQ,EAAE;;;GAGhC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAAC,OAAO,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** A retained observation closes in two phases. The semantic phase re-asks a
|
|
2
|
+
* slower owner such as Git and may await. The physical phase compares the
|
|
3
|
+
* original native witnesses and never awaits. Neither renews its baseline;
|
|
4
|
+
* together they belong to one observation, and neither alone admits it.
|
|
5
|
+
* Admission awaits every semantic phase first, then closes every physical
|
|
6
|
+
* phase with its commit, so final closure checks the original observation
|
|
7
|
+
* against its retained dependencies after all intervening semantic work. A
|
|
8
|
+
* change no witness holds belongs to a later Watch generation.
|
|
9
|
+
*
|
|
10
|
+
* The physical phase is data where it can be: witnesses any thread samples
|
|
11
|
+
* and judges. What only the admitting thread can answer — host authority
|
|
12
|
+
* such as the content clock, or a check over live objects — is an admission
|
|
13
|
+
* that runs there, synchronously, after the witnesses are judged. */
|
|
14
|
+
import { type SourceWitness } from "./source-witness.js";
|
|
15
|
+
export interface SourceProof {
|
|
16
|
+
semantic(): Promise<void>;
|
|
17
|
+
readonly witnesses: readonly SourceWitness[];
|
|
18
|
+
readonly admission?: () => void;
|
|
19
|
+
}
|
|
20
|
+
export declare const witnessProof: (witnesses: readonly SourceWitness[]) => SourceProof;
|
|
21
|
+
export declare const admissionProof: (admission: () => void) => SourceProof;
|
|
22
|
+
export declare const semanticProof: (semantic: () => Promise<void>) => SourceProof;
|
|
23
|
+
/** The admission half alone, for a caller whose witnesses were judged elsewhere.
|
|
24
|
+
* A void-typed boundary accepts a value-returning function; a Promise that
|
|
25
|
+
* slipped through must fail here rather than pass as a completed check. */
|
|
26
|
+
export declare function admitPhysically(proof: SourceProof): void;
|
|
27
|
+
export declare function closePhysically(proof: SourceProof): void;
|
|
28
|
+
export declare const proofLeaves: (proof: SourceProof) => readonly SourceProof[];
|
|
29
|
+
/** Each original proof closes once, at its last requested position, so no
|
|
30
|
+
* duplicate can close before a later dependency's work. Identity is
|
|
31
|
+
* ownership: equal paths or answers never merge proofs. Semantic phases run
|
|
32
|
+
* one at a time, so several repositories never multiply concurrent Git
|
|
33
|
+
* processes. */
|
|
34
|
+
export declare function sourceProofs(proofs: readonly SourceProof[]): SourceProof;
|
|
35
|
+
/** A standalone close: the semantic answer, then the original witnesses. */
|
|
36
|
+
export declare function closeSource(proof: SourceProof): Promise<void>;
|