@cleocode/core 2026.9.26 → 2026.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-provenance.json +2 -2
- package/dist/cloud/journal.d.ts +9 -5
- package/dist/cloud/journal.d.ts.map +1 -1
- package/dist/cloud/journal.js +29 -8
- package/dist/cloud/journal.js.map +1 -1
- package/dist/cloud/manifest-check.d.ts +140 -4
- package/dist/cloud/manifest-check.d.ts.map +1 -1
- package/dist/cloud/manifest-check.js +309 -10
- package/dist/cloud/manifest-check.js.map +1 -1
- package/dist/cloud/nexus-attach.d.ts +119 -0
- package/dist/cloud/nexus-attach.d.ts.map +1 -0
- package/dist/cloud/nexus-attach.js +267 -0
- package/dist/cloud/nexus-attach.js.map +1 -0
- package/dist/cloud/nexus-auth.d.ts +15 -3
- package/dist/cloud/nexus-auth.d.ts.map +1 -1
- package/dist/cloud/nexus-auth.js +90 -6
- package/dist/cloud/nexus-auth.js.map +1 -1
- package/dist/cloud/nexus-cloud-activity.d.ts +37 -0
- package/dist/cloud/nexus-cloud-activity.d.ts.map +1 -0
- package/dist/cloud/nexus-cloud-activity.js +79 -0
- package/dist/cloud/nexus-cloud-activity.js.map +1 -0
- package/dist/cloud/nexus-cloud-status.d.ts +132 -0
- package/dist/cloud/nexus-cloud-status.d.ts.map +1 -0
- package/dist/cloud/nexus-cloud-status.js +476 -0
- package/dist/cloud/nexus-cloud-status.js.map +1 -0
- package/dist/cloud/nexus-cloud.d.ts +179 -0
- package/dist/cloud/nexus-cloud.d.ts.map +1 -0
- package/dist/cloud/nexus-cloud.js +296 -0
- package/dist/cloud/nexus-cloud.js.map +1 -0
- package/dist/cloud/nexus-device.d.ts +32 -7
- package/dist/cloud/nexus-device.d.ts.map +1 -1
- package/dist/cloud/nexus-device.js +54 -7
- package/dist/cloud/nexus-device.js.map +1 -1
- package/dist/cloud/nexus-enrol.d.ts +35 -4
- package/dist/cloud/nexus-enrol.d.ts.map +1 -1
- package/dist/cloud/nexus-enrol.js +192 -47
- package/dist/cloud/nexus-enrol.js.map +1 -1
- package/dist/cloud/nexus-home.d.ts +74 -0
- package/dist/cloud/nexus-home.d.ts.map +1 -0
- package/dist/cloud/nexus-home.js +97 -0
- package/dist/cloud/nexus-home.js.map +1 -0
- package/dist/cloud/nexus-link.d.ts +8 -1
- package/dist/cloud/nexus-link.d.ts.map +1 -1
- package/dist/cloud/nexus-link.js +138 -11
- package/dist/cloud/nexus-link.js.map +1 -1
- package/dist/cloud/nexus-logout.d.ts +114 -0
- package/dist/cloud/nexus-logout.d.ts.map +1 -0
- package/dist/cloud/nexus-logout.js +429 -0
- package/dist/cloud/nexus-logout.js.map +1 -0
- package/dist/cloud/nexus-vault-keys.d.ts +129 -0
- package/dist/cloud/nexus-vault-keys.d.ts.map +1 -0
- package/dist/cloud/nexus-vault-keys.js +277 -0
- package/dist/cloud/nexus-vault-keys.js.map +1 -0
- package/dist/cloud/nexus-vault-state.d.ts +121 -0
- package/dist/cloud/nexus-vault-state.d.ts.map +1 -0
- package/dist/cloud/nexus-vault-state.js +274 -0
- package/dist/cloud/nexus-vault-state.js.map +1 -0
- package/dist/cloud/nexus-vault.d.ts +160 -0
- package/dist/cloud/nexus-vault.d.ts.map +1 -0
- package/dist/cloud/nexus-vault.js +1733 -0
- package/dist/cloud/nexus-vault.js.map +1 -0
- package/dist/cloud/signing.d.ts +24 -8
- package/dist/cloud/signing.d.ts.map +1 -1
- package/dist/cloud/signing.js +61 -15
- package/dist/cloud/signing.js.map +1 -1
- package/dist/docs/export-document.js +8341 -3317
- package/dist/docs/export-document.js.map +3 -3
- package/dist/doctor/migrations.d.ts +75 -0
- package/dist/doctor/migrations.d.ts.map +1 -0
- package/dist/doctor/migrations.js +136 -0
- package/dist/doctor/migrations.js.map +1 -0
- package/dist/doctor/sync-sealer.d.ts +48 -0
- package/dist/doctor/sync-sealer.d.ts.map +1 -0
- package/dist/doctor/sync-sealer.js +109 -0
- package/dist/doctor/sync-sealer.js.map +1 -0
- package/dist/doctor/sync-triggers.d.ts +53 -0
- package/dist/doctor/sync-triggers.d.ts.map +1 -0
- package/dist/doctor/sync-triggers.js +157 -0
- package/dist/doctor/sync-triggers.js.map +1 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +5 -1
- package/dist/init.js.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/llm/plugin-facade.js +8668 -3644
- package/dist/llm/plugin-facade.js.map +3 -3
- package/dist/nexus/projects-clean.d.ts +3 -0
- package/dist/nexus/projects-clean.d.ts.map +1 -1
- package/dist/nexus/projects-clean.js +9 -3
- package/dist/nexus/projects-clean.js.map +1 -1
- package/dist/nexus/registry-roots.d.ts +3 -1
- package/dist/nexus/registry-roots.d.ts.map +1 -1
- package/dist/nexus/registry-roots.js +5 -2
- package/dist/nexus/registry-roots.js.map +1 -1
- package/dist/nexus/registry.d.ts +8 -1
- package/dist/nexus/registry.d.ts.map +1 -1
- package/dist/nexus/registry.js +24 -10
- package/dist/nexus/registry.js.map +1 -1
- package/dist/nexus/workspace.d.ts +4 -1
- package/dist/nexus/workspace.d.ts.map +1 -1
- package/dist/nexus/workspace.js +10 -4
- package/dist/nexus/workspace.js.map +1 -1
- package/dist/orchestrate/spawn-ops.d.ts.map +1 -1
- package/dist/orchestrate/spawn-ops.js +7 -2
- package/dist/orchestrate/spawn-ops.js.map +1 -1
- package/dist/orchestrate/worker-verify.d.ts +121 -12
- package/dist/orchestrate/worker-verify.d.ts.map +1 -1
- package/dist/orchestrate/worker-verify.js +172 -21
- package/dist/orchestrate/worker-verify.js.map +1 -1
- package/dist/orchestration/spawn-prompt.d.ts.map +1 -1
- package/dist/orchestration/spawn-prompt.js +15 -9
- package/dist/orchestration/spawn-prompt.js.map +1 -1
- package/dist/release/ci-evidence.d.ts +9 -0
- package/dist/release/ci-evidence.d.ts.map +1 -1
- package/dist/release/ci-evidence.js +9 -2
- package/dist/release/ci-evidence.js.map +1 -1
- package/dist/resources/backend.d.ts +15 -3
- package/dist/resources/backend.d.ts.map +1 -1
- package/dist/resources/backend.js +7 -3
- package/dist/resources/backend.js.map +1 -1
- package/dist/resources/darwin-backend.d.ts +142 -0
- package/dist/resources/darwin-backend.d.ts.map +1 -0
- package/dist/resources/darwin-backend.js +288 -0
- package/dist/resources/darwin-backend.js.map +1 -0
- package/dist/resources/governor.d.ts +44 -1
- package/dist/resources/governor.d.ts.map +1 -1
- package/dist/resources/governor.js +100 -36
- package/dist/resources/governor.js.map +1 -1
- package/dist/resources/heavy-command.d.ts +132 -0
- package/dist/resources/heavy-command.d.ts.map +1 -0
- package/dist/resources/heavy-command.js +768 -0
- package/dist/resources/heavy-command.js.map +1 -0
- package/dist/resources/monitor.d.ts +50 -1
- package/dist/resources/monitor.d.ts.map +1 -1
- package/dist/resources/monitor.js +83 -1
- package/dist/resources/monitor.js.map +1 -1
- package/dist/resources/run-admission.d.ts +303 -0
- package/dist/resources/run-admission.d.ts.map +1 -0
- package/dist/resources/run-admission.js +648 -0
- package/dist/resources/run-admission.js.map +1 -0
- package/dist/resources/run-class.d.ts +111 -0
- package/dist/resources/run-class.d.ts.map +1 -0
- package/dist/resources/run-class.js +658 -0
- package/dist/resources/run-class.js.map +1 -0
- package/dist/resources/run-governed.d.ts +158 -0
- package/dist/resources/run-governed.d.ts.map +1 -0
- package/dist/resources/run-governed.js +406 -0
- package/dist/resources/run-governed.js.map +1 -0
- package/dist/resources/slot-holder.d.ts +267 -0
- package/dist/resources/slot-holder.d.ts.map +1 -0
- package/dist/resources/slot-holder.js +505 -0
- package/dist/resources/slot-holder.js.map +1 -0
- package/dist/resources/tool-groups.d.ts +74 -0
- package/dist/resources/tool-groups.d.ts.map +1 -0
- package/dist/resources/tool-groups.js +118 -0
- package/dist/resources/tool-groups.js.map +1 -0
- package/dist/routing/build-command-groups.d.ts.map +1 -1
- package/dist/routing/build-command-groups.js +1 -0
- package/dist/routing/build-command-groups.js.map +1 -1
- package/dist/selfimprove/fix-gen.js +8676 -3652
- package/dist/selfimprove/fix-gen.js.map +3 -3
- package/dist/sentient/cross-project-hygiene.d.ts +3 -2
- package/dist/sentient/cross-project-hygiene.d.ts.map +1 -1
- package/dist/sentient/cross-project-hygiene.js +5 -2
- package/dist/sentient/cross-project-hygiene.js.map +1 -1
- package/dist/sentient/state.d.ts +7 -0
- package/dist/sentient/state.d.ts.map +1 -1
- package/dist/sentient/state.js.map +1 -1
- package/dist/sentient/tick.d.ts +14 -2
- package/dist/sentient/tick.d.ts.map +1 -1
- package/dist/sentient/tick.js +63 -4
- package/dist/sentient/tick.js.map +1 -1
- package/dist/setup/sections/nexus-account.d.ts +8 -6
- package/dist/setup/sections/nexus-account.d.ts.map +1 -1
- package/dist/setup/sections/nexus-account.js +53 -9
- package/dist/setup/sections/nexus-account.js.map +1 -1
- package/dist/store/backup-recover.d.ts.map +1 -1
- package/dist/store/backup-recover.js +5 -0
- package/dist/store/backup-recover.js.map +1 -1
- package/dist/store/data-accessor.d.ts +1 -0
- package/dist/store/data-accessor.d.ts.map +1 -1
- package/dist/store/data-accessor.js +7 -0
- package/dist/store/data-accessor.js.map +1 -1
- package/dist/store/dual-scope-db.d.ts +23 -1
- package/dist/store/dual-scope-db.d.ts.map +1 -1
- package/dist/store/dual-scope-db.js +126 -36
- package/dist/store/dual-scope-db.js.map +1 -1
- package/dist/store/exodus/recovery.d.ts.map +1 -1
- package/dist/store/exodus/recovery.js +15 -0
- package/dist/store/exodus/recovery.js.map +1 -1
- package/dist/store/legacy-tasks-lineage.d.ts.map +1 -1
- package/dist/store/legacy-tasks-lineage.js +5 -0
- package/dist/store/legacy-tasks-lineage.js.map +1 -1
- package/dist/store/lock.d.ts +8 -1
- package/dist/store/lock.d.ts.map +1 -1
- package/dist/store/lock.js +10 -2
- package/dist/store/lock.js.map +1 -1
- package/dist/store/migration-manager.d.ts +5 -0
- package/dist/store/migration-manager.d.ts.map +1 -1
- package/dist/store/migration-manager.js +11 -0
- package/dist/store/migration-manager.js.map +1 -1
- package/dist/store/migration-runner.d.ts +158 -0
- package/dist/store/migration-runner.d.ts.map +1 -0
- package/dist/store/migration-runner.js +493 -0
- package/dist/store/migration-runner.js.map +1 -0
- package/dist/store/portable-bundle-import.d.ts +15 -1
- package/dist/store/portable-bundle-import.d.ts.map +1 -1
- package/dist/store/portable-bundle-import.js +24 -4
- package/dist/store/portable-bundle-import.js.map +1 -1
- package/dist/store/portable-bundle-relocate.d.ts +43 -0
- package/dist/store/portable-bundle-relocate.d.ts.map +1 -1
- package/dist/store/portable-bundle-relocate.js +79 -5
- package/dist/store/portable-bundle-relocate.js.map +1 -1
- package/dist/store/portable-bundle-scan.d.ts +20 -0
- package/dist/store/portable-bundle-scan.d.ts.map +1 -1
- package/dist/store/portable-bundle-scan.js +38 -3
- package/dist/store/portable-bundle-scan.js.map +1 -1
- package/dist/store/portable-bundle.d.ts +33 -0
- package/dist/store/portable-bundle.d.ts.map +1 -1
- package/dist/store/portable-bundle.js +34 -7
- package/dist/store/portable-bundle.js.map +1 -1
- package/dist/store/row-identity-registry.d.ts +137 -7
- package/dist/store/row-identity-registry.d.ts.map +1 -1
- package/dist/store/row-identity-registry.js +364 -9
- package/dist/store/row-identity-registry.js.map +1 -1
- package/dist/store/row-identity.d.ts.map +1 -1
- package/dist/store/row-identity.js +9 -10
- package/dist/store/row-identity.js.map +1 -1
- package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
- package/dist/store/sqlite-data-accessor.js +10 -0
- package/dist/store/sqlite-data-accessor.js.map +1 -1
- package/dist/store/sqlite.d.ts +31 -0
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/sqlite.js +5 -1
- package/dist/store/sqlite.js.map +1 -1
- package/dist/store/sync/capture.d.ts +203 -0
- package/dist/store/sync/capture.d.ts.map +1 -0
- package/dist/store/sync/capture.js +562 -0
- package/dist/store/sync/capture.js.map +1 -0
- package/dist/store/sync/clock-store.d.ts.map +1 -1
- package/dist/store/sync/clock-store.js +2 -0
- package/dist/store/sync/clock-store.js.map +1 -1
- package/dist/store/sync/fk-orphans.d.ts +133 -0
- package/dist/store/sync/fk-orphans.d.ts.map +1 -0
- package/dist/store/sync/fk-orphans.js +265 -0
- package/dist/store/sync/fk-orphans.js.map +1 -0
- package/dist/store/sync/flags.d.ts +7 -0
- package/dist/store/sync/flags.d.ts.map +1 -1
- package/dist/store/sync/flags.js +16 -0
- package/dist/store/sync/flags.js.map +1 -1
- package/dist/store/sync/hlc.d.ts.map +1 -1
- package/dist/store/sync/hlc.js +4 -0
- package/dist/store/sync/hlc.js.map +1 -1
- package/dist/store/sync/identity-fill.d.ts +45 -0
- package/dist/store/sync/identity-fill.d.ts.map +1 -0
- package/dist/store/sync/identity-fill.js +85 -0
- package/dist/store/sync/identity-fill.js.map +1 -0
- package/dist/store/sync/machinery.d.ts +27 -0
- package/dist/store/sync/machinery.d.ts.map +1 -0
- package/dist/store/sync/machinery.js +44 -0
- package/dist/store/sync/machinery.js.map +1 -0
- package/dist/store/sync/netting.d.ts +120 -0
- package/dist/store/sync/netting.d.ts.map +1 -0
- package/dist/store/sync/netting.js +336 -0
- package/dist/store/sync/netting.js.map +1 -0
- package/dist/store/sync/replica.d.ts +59 -3
- package/dist/store/sync/replica.d.ts.map +1 -1
- package/dist/store/sync/replica.js +84 -3
- package/dist/store/sync/replica.js.map +1 -1
- package/dist/store/sync/schema.d.ts +18 -3
- package/dist/store/sync/schema.d.ts.map +1 -1
- package/dist/store/sync/schema.js +27 -3
- package/dist/store/sync/schema.js.map +1 -1
- package/dist/store/sync/seal-backlog.d.ts +21 -0
- package/dist/store/sync/seal-backlog.d.ts.map +1 -0
- package/dist/store/sync/seal-backlog.js +24 -0
- package/dist/store/sync/seal-backlog.js.map +1 -0
- package/dist/store/sync/sealer-values.d.ts +34 -0
- package/dist/store/sync/sealer-values.d.ts.map +1 -0
- package/dist/store/sync/sealer-values.js +53 -0
- package/dist/store/sync/sealer-values.js.map +1 -0
- package/dist/store/sync/sealer.d.ts +145 -0
- package/dist/store/sync/sealer.d.ts.map +1 -0
- package/dist/store/sync/sealer.js +906 -0
- package/dist/store/sync/sealer.js.map +1 -0
- package/dist/store/sync/structural.d.ts +63 -0
- package/dist/store/sync/structural.d.ts.map +1 -0
- package/dist/store/sync/structural.js +180 -0
- package/dist/store/sync/structural.js.map +1 -0
- package/dist/store/sync/timestamps.d.ts +92 -0
- package/dist/store/sync/timestamps.d.ts.map +1 -0
- package/dist/store/sync/timestamps.js +228 -0
- package/dist/store/sync/timestamps.js.map +1 -0
- package/dist/store/sync/tombstones.d.ts +75 -0
- package/dist/store/sync/tombstones.d.ts.map +1 -0
- package/dist/store/sync/tombstones.js +103 -0
- package/dist/store/sync/tombstones.js.map +1 -0
- package/dist/store/sync/trigger-classes.d.ts +221 -0
- package/dist/store/sync/trigger-classes.d.ts.map +1 -0
- package/dist/store/sync/trigger-classes.js +441 -0
- package/dist/store/sync/trigger-classes.js.map +1 -0
- package/dist/store/sync/trigger-suspend-at-path.d.ts +23 -0
- package/dist/store/sync/trigger-suspend-at-path.d.ts.map +1 -0
- package/dist/store/sync/trigger-suspend-at-path.js +44 -0
- package/dist/store/sync/trigger-suspend-at-path.js.map +1 -0
- package/dist/store/sync/writer-version.d.ts +43 -0
- package/dist/store/sync/writer-version.d.ts.map +1 -0
- package/dist/store/sync/writer-version.js +90 -0
- package/dist/store/sync/writer-version.js.map +1 -0
- package/dist/store/table-classification.d.ts.map +1 -1
- package/dist/store/table-classification.js +102 -0
- package/dist/store/table-classification.js.map +1 -1
- package/dist/store/trigger-suspend-schema.d.ts +44 -0
- package/dist/store/trigger-suspend-schema.d.ts.map +1 -0
- package/dist/store/trigger-suspend-schema.js +25 -0
- package/dist/store/trigger-suspend-schema.js.map +1 -0
- package/dist/store/vault-manifest.d.ts +365 -0
- package/dist/store/vault-manifest.d.ts.map +1 -0
- package/dist/store/vault-manifest.js +812 -0
- package/dist/store/vault-manifest.js.map +1 -0
- package/dist/store/writer-lease.d.ts +31 -0
- package/dist/store/writer-lease.d.ts.map +1 -1
- package/dist/store/writer-lease.js +65 -2
- package/dist/store/writer-lease.js.map +1 -1
- package/dist/system/health.d.ts.map +1 -1
- package/dist/system/health.js +21 -0
- package/dist/system/health.js.map +1 -1
- package/dist/system/project-health.d.ts.map +1 -1
- package/dist/system/project-health.js +3 -1
- package/dist/system/project-health.js.map +1 -1
- package/dist/tasks/affected-packages.d.ts +58 -0
- package/dist/tasks/affected-packages.d.ts.map +1 -1
- package/dist/tasks/affected-packages.js +75 -6
- package/dist/tasks/affected-packages.js.map +1 -1
- package/dist/tasks/affected-scope.d.ts +150 -23
- package/dist/tasks/affected-scope.d.ts.map +1 -1
- package/dist/tasks/affected-scope.js +320 -32
- package/dist/tasks/affected-scope.js.map +1 -1
- package/dist/tasks/change-set.d.ts +96 -0
- package/dist/tasks/change-set.d.ts.map +1 -1
- package/dist/tasks/change-set.js +169 -4
- package/dist/tasks/change-set.js.map +1 -1
- package/dist/tasks/complete-ci.d.ts +115 -0
- package/dist/tasks/complete-ci.d.ts.map +1 -0
- package/dist/tasks/complete-ci.js +171 -0
- package/dist/tasks/complete-ci.js.map +1 -0
- package/dist/tasks/complete.d.ts.map +1 -1
- package/dist/tasks/complete.js +50 -17
- package/dist/tasks/complete.js.map +1 -1
- package/dist/tasks/compute-task-view.d.ts.map +1 -1
- package/dist/tasks/compute-task-view.js +7 -0
- package/dist/tasks/compute-task-view.js.map +1 -1
- package/dist/tasks/done-plan.d.ts.map +1 -1
- package/dist/tasks/done-plan.js +51 -30
- package/dist/tasks/done-plan.js.map +1 -1
- package/dist/tasks/done-record.d.ts +6 -0
- package/dist/tasks/done-record.d.ts.map +1 -1
- package/dist/tasks/done-record.js +9 -3
- package/dist/tasks/done-record.js.map +1 -1
- package/dist/tasks/evidence.d.ts +3 -2
- package/dist/tasks/evidence.d.ts.map +1 -1
- package/dist/tasks/evidence.js +143 -12
- package/dist/tasks/evidence.js.map +1 -1
- package/dist/tasks/gate-notes.d.ts +22 -0
- package/dist/tasks/gate-notes.d.ts.map +1 -0
- package/dist/tasks/gate-notes.js +33 -0
- package/dist/tasks/gate-notes.js.map +1 -0
- package/dist/tasks/index.d.ts +2 -1
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/index.js +2 -1
- package/dist/tasks/index.js.map +1 -1
- package/dist/tasks/test-run-binding.d.ts +117 -0
- package/dist/tasks/test-run-binding.d.ts.map +1 -0
- package/dist/tasks/test-run-binding.js +365 -0
- package/dist/tasks/test-run-binding.js.map +1 -0
- package/dist/tasks/tool-cache-env.d.ts +123 -0
- package/dist/tasks/tool-cache-env.d.ts.map +1 -0
- package/dist/tasks/tool-cache-env.js +287 -0
- package/dist/tasks/tool-cache-env.js.map +1 -0
- package/dist/tasks/tool-cache-failed-first.d.ts +155 -0
- package/dist/tasks/tool-cache-failed-first.d.ts.map +1 -0
- package/dist/tasks/tool-cache-failed-first.js +285 -0
- package/dist/tasks/tool-cache-failed-first.js.map +1 -0
- package/dist/tasks/tool-cache.d.ts +375 -55
- package/dist/tasks/tool-cache.d.ts.map +1 -1
- package/dist/tasks/tool-cache.js +912 -303
- package/dist/tasks/tool-cache.js.map +1 -1
- package/dist/tasks/tool-resolver.d.ts +4 -3
- package/dist/tasks/tool-resolver.d.ts.map +1 -1
- package/dist/tasks/tool-resolver.js +15 -4
- package/dist/tasks/tool-resolver.js.map +1 -1
- package/dist/tasks/tool-semaphore.d.ts +67 -7
- package/dist/tasks/tool-semaphore.d.ts.map +1 -1
- package/dist/tasks/tool-semaphore.js +134 -56
- package/dist/tasks/tool-semaphore.js.map +1 -1
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +4 -0
- package/dist/upgrade.js.map +1 -1
- package/dist/validation/engine-ops.d.ts +6 -0
- package/dist/validation/engine-ops.d.ts.map +1 -1
- package/dist/validation/engine-ops.js +8 -0
- package/dist/validation/engine-ops.js.map +1 -1
- package/migrations/drizzle-cleo-project/20260930170000_t12819-trigger-suspend-clause/migration.sql +367 -0
- package/migrations/sync-journal/20260930120000_t12343-capture/migration.sql +47 -0
- package/migrations/sync-journal/20261001170000_t12984-sealer/migration.sql +101 -0
- package/package.json +13 -13
- package/templates/CLEO-INJECTION.md +5 -5
- package/templates/CLEO-REFERENCE.md +8 -4
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The open-time row-identity fill under capture (journal spec §2.3a rule 1;
|
|
3
|
+
* the S2 capture interactions of T12806 and T12801).
|
|
4
|
+
*
|
|
5
|
+
* The fill, the refill of pre-release fingerprints and the graveyard re-link
|
|
6
|
+
* are DERIVED rewrites: every value they write is a deterministic function of
|
|
7
|
+
* the store (spec §12.1), and a refill runs only before any uid has synced.
|
|
8
|
+
* Capturing them would journal one K and one F per filled row under shadow
|
|
9
|
+
* capture. So on a store with the sync schema they run inside
|
|
10
|
+
* {@link withSyncTriggersSuspended}, and the tables they wrote are marked
|
|
11
|
+
* suspect, for the sealer's repair diff (S3).
|
|
12
|
+
*
|
|
13
|
+
* One exception is journaled: a row whose identity a CAPTURED write cleared
|
|
14
|
+
* (a snapshot-overwrite import, K old → NULL) gets the K that records its
|
|
15
|
+
* new uid ({@link captureRemints}), in a `remint` frame, so the pair nets to
|
|
16
|
+
* old → new instead of leaving the new identity unjournaled.
|
|
17
|
+
*
|
|
18
|
+
* @task T12343
|
|
19
|
+
* @module store/sync/identity-fill
|
|
20
|
+
*/
|
|
21
|
+
import { getLogger } from '../../logger.js';
|
|
22
|
+
import { prepareRowIdentity, ROW_IDENTITY } from '../row-identity.js';
|
|
23
|
+
import { captureRemints, clearCaptureFrame, finishCaptureFrame, openCaptureFrame, } from './capture.js';
|
|
24
|
+
import { readSyncFlags } from './flags.js';
|
|
25
|
+
import { hasTable } from './schema.js';
|
|
26
|
+
import { markSuspect, touchSet, withSyncTriggersSuspended } from './structural.js';
|
|
27
|
+
/** The tables a fill report says were written. */
|
|
28
|
+
export function filledTables(scope, report) {
|
|
29
|
+
const written = new Set();
|
|
30
|
+
const add = (counts) => {
|
|
31
|
+
for (const [key, n] of Object.entries(counts)) {
|
|
32
|
+
if (n > 0)
|
|
33
|
+
written.add(key.split('.')[0]);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
add(report.filled);
|
|
37
|
+
add(report.fingerprinted);
|
|
38
|
+
add(report.refsFilled);
|
|
39
|
+
if (report.relinked > 0)
|
|
40
|
+
written.add('tasks_task_acceptance_criteria');
|
|
41
|
+
if (report.refill === 'cleared') {
|
|
42
|
+
for (const spec of ROW_IDENTITY[scope])
|
|
43
|
+
written.add(spec.table);
|
|
44
|
+
}
|
|
45
|
+
return [...written];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Run the open-time identity fill ({@link prepareRowIdentity}). With
|
|
49
|
+
* `sync.capture` on: with the capture triggers dropped, the written tables
|
|
50
|
+
* marked suspect, and re-mint K captures for identities a captured write
|
|
51
|
+
* cleared. With it off: exactly {@link prepareRowIdentity}, even when the
|
|
52
|
+
* sync tables exist (`cleo project link` creates them, T13025).
|
|
53
|
+
*
|
|
54
|
+
* Never throws, like {@link prepareRowIdentity}: a failed bracket (busy,
|
|
55
|
+
* a broken sync schema) is logged and reported as no fill.
|
|
56
|
+
*/
|
|
57
|
+
export function prepareRowIdentityUnderCapture(db, scope, options = {}) {
|
|
58
|
+
const capture = readSyncFlags(db)['sync.capture'] && hasTable(db, '_sync_capture');
|
|
59
|
+
if (!capture) {
|
|
60
|
+
return { report: prepareRowIdentity(db, scope, options), suspect: [], remints: {} };
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
return bracketedFill(db, scope, options);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
getLogger('row-identity').warn({ scope, err: err instanceof Error ? err.message : String(err) }, 'identity fill under capture failed; the store opens without it (T13025)');
|
|
67
|
+
return { report: null, suspect: [], remints: {} };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function bracketedFill(db, scope, options) {
|
|
71
|
+
return withSyncTriggersSuspended(db, scope, () => {
|
|
72
|
+
const report = prepareRowIdentity(db, scope, options);
|
|
73
|
+
const suspect = report ? markSuspect(db, scope, touchSet(db, filledTables(scope, report))) : [];
|
|
74
|
+
const frame = openCaptureFrame(db, 'remint');
|
|
75
|
+
try {
|
|
76
|
+
const remints = captureRemints(db, scope);
|
|
77
|
+
finishCaptureFrame(db, frame);
|
|
78
|
+
return { report, suspect, remints };
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
clearCaptureFrame(db, frame);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=identity-fill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-fill.js","sourceRoot":"","sources":["../../../src/store/sync/identity-fill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAyB,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAWnF,kDAAkD;AAClD,MAAM,UAAU,YAAY,CAAC,KAAiB,EAAE,MAAwB;IACtE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,GAAG,GAAG,CAAC,MAAwC,EAAE,EAAE;QACvD,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC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AG,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAChE,yEAAyE,CAC1E,CAAC;QACF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACpD,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CACpB,EAAgB,EAChB,KAAiB,EACjB,OAAiD;IAEjD,OAAO,yBAAyB,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;QAC/C,MAAM,MAAM,GAAG,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACtD,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChG,MAAM,KAAK,GAAG,gBAAgB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC7C,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;YAC1C,kBAAkB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;YAC9B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;QACtC,CAAC;gBAAS,CAAC;YACT,iBAAiB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removing the change journal from a store (journal spec §2.3a rules 4 and 10).
|
|
3
|
+
*
|
|
4
|
+
* {@link dropSyncMachinery} is the ONLY code allowed to drop `_sync_*`
|
|
5
|
+
* tables; gate 36 forbids `DROP TABLE _sync_…` anywhere else. It drops every
|
|
6
|
+
* capture trigger first, then the tables, in one transaction, so no state
|
|
7
|
+
* with a trigger but without `_sync_capture` is ever committed.
|
|
8
|
+
*
|
|
9
|
+
* It never drops `cleo_trigger_suspend`: that table is schema-owned, and the
|
|
10
|
+
* owned guard and side-effect triggers read it (C2). Nor does anything else;
|
|
11
|
+
* gate 36 forbids dropping it.
|
|
12
|
+
*
|
|
13
|
+
* @task T12819
|
|
14
|
+
* @module store/sync/machinery
|
|
15
|
+
*/
|
|
16
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
17
|
+
/** What {@link dropSyncMachinery} removed. */
|
|
18
|
+
export interface DroppedSyncMachinery {
|
|
19
|
+
readonly triggers: string[];
|
|
20
|
+
readonly tables: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Drop every capture trigger, then every `_sync_*` table, in one
|
|
24
|
+
* transaction (a savepoint when the caller holds one).
|
|
25
|
+
*/
|
|
26
|
+
export declare function dropSyncMachinery(db: DatabaseSync): DroppedSyncMachinery;
|
|
27
|
+
//# sourceMappingURL=machinery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machinery.d.ts","sourceRoot":"","sources":["../../../src/store/sync/machinery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,8CAA8C;AAC9C,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,GAAG,oBAAoB,CAuBxE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removing the change journal from a store (journal spec §2.3a rules 4 and 10).
|
|
3
|
+
*
|
|
4
|
+
* {@link dropSyncMachinery} is the ONLY code allowed to drop `_sync_*`
|
|
5
|
+
* tables; gate 36 forbids `DROP TABLE _sync_…` anywhere else. It drops every
|
|
6
|
+
* capture trigger first, then the tables, in one transaction, so no state
|
|
7
|
+
* with a trigger but without `_sync_capture` is ever committed.
|
|
8
|
+
*
|
|
9
|
+
* It never drops `cleo_trigger_suspend`: that table is schema-owned, and the
|
|
10
|
+
* owned guard and side-effect triggers read it (C2). Nor does anything else;
|
|
11
|
+
* gate 36 forbids dropping it.
|
|
12
|
+
*
|
|
13
|
+
* @task T12819
|
|
14
|
+
* @module store/sync/machinery
|
|
15
|
+
*/
|
|
16
|
+
import { removeCaptureStamp } from './capture.js';
|
|
17
|
+
import { CAPTURE_TRIGGER_PREFIX, TRIGGER_SUSPEND_TABLE } from './trigger-classes.js';
|
|
18
|
+
/**
|
|
19
|
+
* Drop every capture trigger, then every `_sync_*` table, in one
|
|
20
|
+
* transaction (a savepoint when the caller holds one).
|
|
21
|
+
*/
|
|
22
|
+
export function dropSyncMachinery(db) {
|
|
23
|
+
const names = (type, prefix) => db
|
|
24
|
+
.prepare('SELECT name FROM main.sqlite_master WHERE type = ? AND substr(name, 1, length(?)) = ? ORDER BY name')
|
|
25
|
+
.all(type, prefix, prefix).map((r) => r.name);
|
|
26
|
+
const triggers = names('trigger', CAPTURE_TRIGGER_PREFIX);
|
|
27
|
+
const tables = names('table', '_sync_').filter((t) => t !== TRIGGER_SUSPEND_TABLE);
|
|
28
|
+
const nested = db.isTransaction;
|
|
29
|
+
removeCaptureStamp(db);
|
|
30
|
+
db.exec(nested ? 'SAVEPOINT drop_sync_machinery' : 'BEGIN IMMEDIATE');
|
|
31
|
+
try {
|
|
32
|
+
for (const t of triggers)
|
|
33
|
+
db.exec(`DROP TRIGGER IF EXISTS "${t}"`);
|
|
34
|
+
for (const t of tables)
|
|
35
|
+
db.exec(`DROP TABLE IF EXISTS "${t}"`);
|
|
36
|
+
db.exec(nested ? 'RELEASE drop_sync_machinery' : 'COMMIT');
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
db.exec(nested ? 'ROLLBACK TO drop_sync_machinery; RELEASE drop_sync_machinery' : 'ROLLBACK');
|
|
40
|
+
throw err;
|
|
41
|
+
}
|
|
42
|
+
return { triggers, tables };
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=machinery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machinery.js","sourceRoot":"","sources":["../../../src/store/sync/machinery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAQrF;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAgB;IAChD,MAAM,KAAK,GAAG,CAAC,IAAyB,EAAE,MAAc,EAAE,EAAE,CAExD,EAAE;SACC,OAAO,CACN,qGAAqG,CACtG;SACA,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAC5B,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACvB,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,qBAAqB,CAAC,CAAC;IACnF,MAAM,MAAM,GAAG,EAAE,CAAC,aAAa,CAAC;IAChC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IACvB,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACtE,IAAI,CAAC;QACH,KAAK,MAAM,CAAC,IAAI,QAAQ;YAAE,EAAE,CAAC,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;QACnE,KAAK,MAAM,CAAC,IAAI,MAAM;YAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC;QAC/D,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,8DAA8D,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QAC9F,MAAM,GAAG,CAAC;IACZ,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Netting inside one transaction (journal spec §2.4, R8, N8; S3b, T12985).
|
|
3
|
+
*
|
|
4
|
+
* The sealer builds one draft op per capture; {@link netTransaction} reduces a
|
|
5
|
+
* transaction's drafts to the ops a receiver needs. Netting is per (table,
|
|
6
|
+
* uid) (§2.4): drafts are first chained per (table, local key `rk`), because a
|
|
7
|
+
* re-key changes the uid but never the local key, and then chains with no K
|
|
8
|
+
* that carry the same uid merge, so a delete of one local row and an insert
|
|
9
|
+
* of another under the same uid (an AC relink) net to one U (T13035).
|
|
10
|
+
*
|
|
11
|
+
* Per chain:
|
|
12
|
+
*
|
|
13
|
+
* 1. **Re-keys.** Adjacent K ops collapse: K(x → NULL) followed by the fill's
|
|
14
|
+
* K(NULL → y) is one K(x → y) (N8). A K whose old uid no sealed op ever
|
|
15
|
+
* carried (no row meta) is **dropped**: every op of the chain then uses the
|
|
16
|
+
* final uid, and the caller moves the row meta ({@link NetResult.renames}).
|
|
17
|
+
* A K on a uid row meta knows is **kept** (T13035): ops sealed earlier on
|
|
18
|
+
* the old uid are never rewritten, so the K is what links them to the new
|
|
19
|
+
* uid. Ops before a kept K use the old uid, ops after it the new one.
|
|
20
|
+
* 2. **Net each stretch between kept K ops** (§2.4 table):
|
|
21
|
+
*
|
|
22
|
+
* | sequence | result |
|
|
23
|
+
* |---|---|
|
|
24
|
+
* | I, then any U | I with the final image |
|
|
25
|
+
* | U, U, … | one U: first before, last after per column; unchanged columns dropped; no op when nothing changed |
|
|
26
|
+
* | I … D | nothing |
|
|
27
|
+
* | D, then I | U of the non-key columns that differ, or nothing |
|
|
28
|
+
* | D, I, D | D, before-image from the first D |
|
|
29
|
+
* | U … D | D, before-image from the first U's before |
|
|
30
|
+
* | I on a uid row meta knows live, not deleted earlier in the transaction (foreign REPLACE) | U against it |
|
|
31
|
+
*
|
|
32
|
+
* 3. **Counters (§2.6).** On a U, a column declared in
|
|
33
|
+
* {@link SYNC_COUNTER_COLUMNS} carries `{$inc: after − before}` instead of
|
|
34
|
+
* the absolute value; the before-image keeps the old value.
|
|
35
|
+
*
|
|
36
|
+
* Each op keeps its first capture's `seq` (output order) and records its last
|
|
37
|
+
* capture's in `last`: the sealer takes the op's HLC time and local key from
|
|
38
|
+
* the last capture (T13037).
|
|
39
|
+
*
|
|
40
|
+
* Apply-intent subtraction (§3.3) needs `_sync_apply_intent`, which arrives
|
|
41
|
+
* with pull/apply (S5); {@link subtractIntents} is the seam and is a no-op
|
|
42
|
+
* until then, so the sealer refuses apply and rebase frames. Across
|
|
43
|
+
* transactions, the sealer drops the dead incarnation of a row that never got
|
|
44
|
+
* a uid (I … D, T13036); the rest of cross-transaction compaction is S4,
|
|
45
|
+
* where segment state exists.
|
|
46
|
+
*
|
|
47
|
+
* Pure: no database access; the caller supplies row-meta facts.
|
|
48
|
+
*
|
|
49
|
+
* @module store/sync/netting
|
|
50
|
+
* @task T12985
|
|
51
|
+
* @epic T12323
|
|
52
|
+
*/
|
|
53
|
+
import { type WireValue } from './sealer-values.js';
|
|
54
|
+
/**
|
|
55
|
+
* In-place counter columns per table (§2.6, `SYNC_COUNTER_COLUMNS`): sealed
|
|
56
|
+
* as `{$inc: delta}` on update. Empty while no counter-bearing table is in
|
|
57
|
+
* the sync set (brain_patterns joins with T12894).
|
|
58
|
+
*/
|
|
59
|
+
export declare const SYNC_COUNTER_COLUMNS: Readonly<Record<string, readonly string[]>>;
|
|
60
|
+
/** A counter delta on the wire (§2.6). */
|
|
61
|
+
export interface IncValue {
|
|
62
|
+
readonly $inc: number;
|
|
63
|
+
}
|
|
64
|
+
/** A draft op: one capture, before netting. `u`/`nu` may be NULL mid-re-key. */
|
|
65
|
+
export interface DraftOp {
|
|
66
|
+
readonly t: string;
|
|
67
|
+
/** Local key of the row (the capture's `rk`): stable across re-keys. */
|
|
68
|
+
readonly rk: string;
|
|
69
|
+
/** Capture seq, for ordering. */
|
|
70
|
+
readonly seq: number;
|
|
71
|
+
readonly o: 'I' | 'U' | 'D' | 'K';
|
|
72
|
+
/** Row uid; for K the OLD uid. NULL when not yet known. */
|
|
73
|
+
readonly u: string | null;
|
|
74
|
+
/** K only: the new uid (NULL for a clear). */
|
|
75
|
+
readonly nu?: string | null;
|
|
76
|
+
readonly bfp?: string;
|
|
77
|
+
readonly obfp?: string;
|
|
78
|
+
readonly k?: Record<string, WireValue>;
|
|
79
|
+
readonly a?: Record<string, WireValue | IncValue>;
|
|
80
|
+
readonly b?: Record<string, WireValue>;
|
|
81
|
+
}
|
|
82
|
+
/** A netted op, ready for an HLC. `last` is its last capture's seq. */
|
|
83
|
+
export type NettedOp = Omit<DraftOp, 'rk'> & {
|
|
84
|
+
readonly u: string | null;
|
|
85
|
+
readonly last: number;
|
|
86
|
+
};
|
|
87
|
+
/** Row-meta facts the netting needs. */
|
|
88
|
+
export interface MetaFacts {
|
|
89
|
+
/** Whether a persisted segment ever carried this uid (`sent = 1`). */
|
|
90
|
+
sent(table: string, uid: string): boolean;
|
|
91
|
+
/** Whether row meta knows this uid as a LIVE row (not a tombstone). */
|
|
92
|
+
live(table: string, uid: string): boolean;
|
|
93
|
+
/** Whether row meta knows this uid at all: some sealed op carried it. */
|
|
94
|
+
known(table: string, uid: string): boolean;
|
|
95
|
+
}
|
|
96
|
+
/** Netting options beyond row meta. */
|
|
97
|
+
export interface NetOptions {
|
|
98
|
+
/** In-place counter columns per table (§2.6). */
|
|
99
|
+
readonly counters?: Readonly<Record<string, readonly string[]>>;
|
|
100
|
+
/** A table's key columns: a D-then-I U never carries them (§2.4). */
|
|
101
|
+
readonly keyColumns?: (table: string) => readonly string[];
|
|
102
|
+
}
|
|
103
|
+
/** What netting produced. */
|
|
104
|
+
export interface NetResult {
|
|
105
|
+
readonly ops: NettedOp[];
|
|
106
|
+
/** Dropped re-keys: move row meta `from` → `to` without an op. */
|
|
107
|
+
readonly renames: ReadonlyArray<{
|
|
108
|
+
readonly t: string;
|
|
109
|
+
readonly from: string;
|
|
110
|
+
readonly to: string;
|
|
111
|
+
}>;
|
|
112
|
+
}
|
|
113
|
+
/** Intent subtraction (§3.3): the S5 seam. No apply intents exist before pull. */
|
|
114
|
+
export declare function subtractIntents(ops: readonly DraftOp[]): DraftOp[];
|
|
115
|
+
/**
|
|
116
|
+
* Net one transaction's drafts (§2.4). Output is ordered by each op's first
|
|
117
|
+
* capture seq; kept K ops sit between their chain's stretches.
|
|
118
|
+
*/
|
|
119
|
+
export declare function netTransaction(drafts: readonly DraftOp[], facts: MetaFacts, options?: NetOptions): NetResult;
|
|
120
|
+
//# sourceMappingURL=netting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"netting.d.ts","sourceRoot":"","sources":["../../../src/store/sync/netting.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,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ACvE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1C,yEAAyE;IACzE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5C;AAED,uCAAuC;AACvC,MAAM,WAAW,UAAU;IACzB,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IAChE,qEAAqE;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,CAAC;CAC5D;AAED,6BAA6B;AAC7B,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC;IACzB,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;QAC9B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;CACJ;AAoJD,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,CAElE;AA+CD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,OAAO,EAAE,EAC1B,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE,UAAe,GACvB,SAAS,CAwFX"}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Netting inside one transaction (journal spec §2.4, R8, N8; S3b, T12985).
|
|
3
|
+
*
|
|
4
|
+
* The sealer builds one draft op per capture; {@link netTransaction} reduces a
|
|
5
|
+
* transaction's drafts to the ops a receiver needs. Netting is per (table,
|
|
6
|
+
* uid) (§2.4): drafts are first chained per (table, local key `rk`), because a
|
|
7
|
+
* re-key changes the uid but never the local key, and then chains with no K
|
|
8
|
+
* that carry the same uid merge, so a delete of one local row and an insert
|
|
9
|
+
* of another under the same uid (an AC relink) net to one U (T13035).
|
|
10
|
+
*
|
|
11
|
+
* Per chain:
|
|
12
|
+
*
|
|
13
|
+
* 1. **Re-keys.** Adjacent K ops collapse: K(x → NULL) followed by the fill's
|
|
14
|
+
* K(NULL → y) is one K(x → y) (N8). A K whose old uid no sealed op ever
|
|
15
|
+
* carried (no row meta) is **dropped**: every op of the chain then uses the
|
|
16
|
+
* final uid, and the caller moves the row meta ({@link NetResult.renames}).
|
|
17
|
+
* A K on a uid row meta knows is **kept** (T13035): ops sealed earlier on
|
|
18
|
+
* the old uid are never rewritten, so the K is what links them to the new
|
|
19
|
+
* uid. Ops before a kept K use the old uid, ops after it the new one.
|
|
20
|
+
* 2. **Net each stretch between kept K ops** (§2.4 table):
|
|
21
|
+
*
|
|
22
|
+
* | sequence | result |
|
|
23
|
+
* |---|---|
|
|
24
|
+
* | I, then any U | I with the final image |
|
|
25
|
+
* | U, U, … | one U: first before, last after per column; unchanged columns dropped; no op when nothing changed |
|
|
26
|
+
* | I … D | nothing |
|
|
27
|
+
* | D, then I | U of the non-key columns that differ, or nothing |
|
|
28
|
+
* | D, I, D | D, before-image from the first D |
|
|
29
|
+
* | U … D | D, before-image from the first U's before |
|
|
30
|
+
* | I on a uid row meta knows live, not deleted earlier in the transaction (foreign REPLACE) | U against it |
|
|
31
|
+
*
|
|
32
|
+
* 3. **Counters (§2.6).** On a U, a column declared in
|
|
33
|
+
* {@link SYNC_COUNTER_COLUMNS} carries `{$inc: after − before}` instead of
|
|
34
|
+
* the absolute value; the before-image keeps the old value.
|
|
35
|
+
*
|
|
36
|
+
* Each op keeps its first capture's `seq` (output order) and records its last
|
|
37
|
+
* capture's in `last`: the sealer takes the op's HLC time and local key from
|
|
38
|
+
* the last capture (T13037).
|
|
39
|
+
*
|
|
40
|
+
* Apply-intent subtraction (§3.3) needs `_sync_apply_intent`, which arrives
|
|
41
|
+
* with pull/apply (S5); {@link subtractIntents} is the seam and is a no-op
|
|
42
|
+
* until then, so the sealer refuses apply and rebase frames. Across
|
|
43
|
+
* transactions, the sealer drops the dead incarnation of a row that never got
|
|
44
|
+
* a uid (I … D, T13036); the rest of cross-transaction compaction is S4,
|
|
45
|
+
* where segment state exists.
|
|
46
|
+
*
|
|
47
|
+
* Pure: no database access; the caller supplies row-meta facts.
|
|
48
|
+
*
|
|
49
|
+
* @module store/sync/netting
|
|
50
|
+
* @task T12985
|
|
51
|
+
* @epic T12323
|
|
52
|
+
*/
|
|
53
|
+
import { canonicalJson } from './sealer-values.js';
|
|
54
|
+
/**
|
|
55
|
+
* In-place counter columns per table (§2.6, `SYNC_COUNTER_COLUMNS`): sealed
|
|
56
|
+
* as `{$inc: delta}` on update. Empty while no counter-bearing table is in
|
|
57
|
+
* the sync set (brain_patterns joins with T12894).
|
|
58
|
+
*/
|
|
59
|
+
export const SYNC_COUNTER_COLUMNS = Object.freeze({});
|
|
60
|
+
const same = (x, y) => canonicalJson(x) === canonicalJson(y);
|
|
61
|
+
/** Collapse adjacent K ops of a chain: x→a then a→b is x→b (N8). */
|
|
62
|
+
function collapseRekeys(chain) {
|
|
63
|
+
const out = [];
|
|
64
|
+
for (const op of chain) {
|
|
65
|
+
const prev = out[out.length - 1];
|
|
66
|
+
if (op.o === 'K' && prev?.o === 'K' && (prev.nu ?? null) === (op.u ?? null)) {
|
|
67
|
+
out[out.length - 1] = {
|
|
68
|
+
...prev,
|
|
69
|
+
nu: op.nu ?? null,
|
|
70
|
+
...(op.bfp !== undefined ? { bfp: op.bfp } : {}),
|
|
71
|
+
};
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
out.push(op);
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
function step(acc, op) {
|
|
79
|
+
const a = op.a ?? {};
|
|
80
|
+
const b = op.b ?? {};
|
|
81
|
+
switch (acc.s) {
|
|
82
|
+
case 'none':
|
|
83
|
+
if (op.o === 'I')
|
|
84
|
+
return { s: 'I', a: { ...a }, first: op };
|
|
85
|
+
if (op.o === 'U')
|
|
86
|
+
return { s: 'U', a: { ...a }, b: { ...b }, first: op };
|
|
87
|
+
return { s: 'D', b: { ...b }, first: op };
|
|
88
|
+
case 'gone':
|
|
89
|
+
// I … D, then more: start again from here.
|
|
90
|
+
return step({ s: 'none' }, op);
|
|
91
|
+
case 'I':
|
|
92
|
+
if (op.o === 'U')
|
|
93
|
+
return { ...acc, a: { ...acc.a, ...a } };
|
|
94
|
+
if (op.o === 'D')
|
|
95
|
+
return { s: 'gone', first: acc.first };
|
|
96
|
+
return { s: 'I', a: { ...a }, first: acc.first }; // I, I: the later image
|
|
97
|
+
case 'U':
|
|
98
|
+
if (op.o === 'U')
|
|
99
|
+
return { ...acc, a: { ...acc.a, ...a }, b: { ...b, ...acc.b } };
|
|
100
|
+
if (op.o === 'D')
|
|
101
|
+
return { s: 'D', b: { ...b, ...acc.b }, first: acc.first };
|
|
102
|
+
return { s: 'I', a: { ...a }, first: acc.first };
|
|
103
|
+
case 'D':
|
|
104
|
+
if (op.o === 'I')
|
|
105
|
+
return { s: 'DI', b: acc.b, a: { ...a }, first: acc.first, ins: op };
|
|
106
|
+
return acc; // D, D (or U after D): the first before-image stands
|
|
107
|
+
case 'DI':
|
|
108
|
+
if (op.o === 'U')
|
|
109
|
+
return { ...acc, a: { ...acc.a, ...a } };
|
|
110
|
+
if (op.o === 'D')
|
|
111
|
+
return { s: 'D', b: acc.b, first: acc.first };
|
|
112
|
+
return { ...acc, a: { ...a } };
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function counterize(table, a, b, registry) {
|
|
116
|
+
const counters = registry[table];
|
|
117
|
+
if (!counters || counters.length === 0)
|
|
118
|
+
return a;
|
|
119
|
+
const out = { ...a };
|
|
120
|
+
for (const col of counters) {
|
|
121
|
+
const after = a[col];
|
|
122
|
+
const before = b[col];
|
|
123
|
+
if (typeof after === 'number' && typeof before === 'number')
|
|
124
|
+
out[col] = { $inc: after - before };
|
|
125
|
+
}
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
128
|
+
/** Turn one stretch's accumulator into at most one op. */
|
|
129
|
+
function settle(acc, lastOp, uid, bfp, live, counters, keys) {
|
|
130
|
+
const base = (first) => ({
|
|
131
|
+
t: first.t,
|
|
132
|
+
seq: first.seq,
|
|
133
|
+
last: lastOp.seq,
|
|
134
|
+
u: uid,
|
|
135
|
+
...(bfp !== undefined ? { bfp } : {}),
|
|
136
|
+
...(first.k !== undefined ? { k: first.k } : {}),
|
|
137
|
+
});
|
|
138
|
+
switch (acc.s) {
|
|
139
|
+
case 'none':
|
|
140
|
+
case 'gone':
|
|
141
|
+
return null;
|
|
142
|
+
case 'I': {
|
|
143
|
+
// A foreign REPLACE: an insert of a uid row meta already knows as live.
|
|
144
|
+
if (uid !== null && acc.first.o === 'I' && live(acc.first.t, uid, acc.first.seq)) {
|
|
145
|
+
return { ...base(acc.first), o: 'U', a: acc.a };
|
|
146
|
+
}
|
|
147
|
+
return { ...base(acc.first), o: 'I', a: acc.a };
|
|
148
|
+
}
|
|
149
|
+
case 'U': {
|
|
150
|
+
const a = {};
|
|
151
|
+
const b = {};
|
|
152
|
+
for (const col of new Set([...Object.keys(acc.a), ...Object.keys(acc.b)])) {
|
|
153
|
+
if (same(acc.a[col] ?? null, acc.b[col] ?? null))
|
|
154
|
+
continue;
|
|
155
|
+
if (col in acc.a)
|
|
156
|
+
a[col] = acc.a[col];
|
|
157
|
+
if (col in acc.b)
|
|
158
|
+
b[col] = acc.b[col];
|
|
159
|
+
}
|
|
160
|
+
if (Object.keys(a).length === 0)
|
|
161
|
+
return null;
|
|
162
|
+
return { ...base(acc.first), o: 'U', a: counterize(acc.first.t, a, b, counters), b };
|
|
163
|
+
}
|
|
164
|
+
case 'D':
|
|
165
|
+
return { ...base(acc.first), o: 'D', b: acc.b };
|
|
166
|
+
case 'DI': {
|
|
167
|
+
// D then I: never a tombstone plus an insert; the columns that differ.
|
|
168
|
+
const a = {};
|
|
169
|
+
const b = {};
|
|
170
|
+
for (const col of new Set([...Object.keys(acc.a), ...Object.keys(acc.b)])) {
|
|
171
|
+
if (keys.includes(col))
|
|
172
|
+
continue;
|
|
173
|
+
const now = acc.a[col] ?? null;
|
|
174
|
+
const was = acc.b[col] ?? null;
|
|
175
|
+
if (same(now, was))
|
|
176
|
+
continue;
|
|
177
|
+
a[col] = now;
|
|
178
|
+
b[col] = was;
|
|
179
|
+
}
|
|
180
|
+
if (Object.keys(a).length === 0)
|
|
181
|
+
return null;
|
|
182
|
+
return { ...base(acc.first), o: 'U', a: counterize(acc.first.t, a, b, counters), b };
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/** Intent subtraction (§3.3): the S5 seam. No apply intents exist before pull. */
|
|
187
|
+
export function subtractIntents(ops) {
|
|
188
|
+
return [...ops];
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Chain drafts per (table, rk), then merge the chains that carry the same
|
|
192
|
+
* single uid (§2.4 nets per uid; T13035). A chain's uid is its one non-NULL
|
|
193
|
+
* uid, counting a fill's K(NULL → y) as y. A chain with a real re-key (a K
|
|
194
|
+
* from a non-NULL uid) stays on its own: its uid changes along the chain, so
|
|
195
|
+
* merging it by uid could put a collision loser's ops on the winner's row.
|
|
196
|
+
*/
|
|
197
|
+
function chainsOf(drafts) {
|
|
198
|
+
const byRk = new Map();
|
|
199
|
+
for (const d of drafts) {
|
|
200
|
+
const key = `${d.t}\u0000${d.rk}`;
|
|
201
|
+
let c = byRk.get(key);
|
|
202
|
+
if (!c) {
|
|
203
|
+
c = [];
|
|
204
|
+
byRk.set(key, c);
|
|
205
|
+
}
|
|
206
|
+
c.push(d);
|
|
207
|
+
}
|
|
208
|
+
const out = [];
|
|
209
|
+
const byUid = new Map();
|
|
210
|
+
for (const chain of byRk.values()) {
|
|
211
|
+
const rekeys = chain.some((d) => d.o === 'K' && d.u !== null);
|
|
212
|
+
const uids = new Set();
|
|
213
|
+
for (const d of chain) {
|
|
214
|
+
const u = d.o === 'K' ? (d.nu ?? null) : d.u;
|
|
215
|
+
if (u !== null)
|
|
216
|
+
uids.add(u);
|
|
217
|
+
}
|
|
218
|
+
const only = uids.size === 1 ? [...uids][0] : undefined;
|
|
219
|
+
if (rekeys || only === undefined) {
|
|
220
|
+
out.push(chain);
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
const key = `${chain[0]?.t}\u0000${only}`;
|
|
224
|
+
const into = byUid.get(key);
|
|
225
|
+
if (into) {
|
|
226
|
+
into.push(...chain);
|
|
227
|
+
into.sort((x, y) => x.seq - y.seq);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
byUid.set(key, chain);
|
|
231
|
+
out.push(chain);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return out;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Net one transaction's drafts (§2.4). Output is ordered by each op's first
|
|
238
|
+
* capture seq; kept K ops sit between their chain's stretches.
|
|
239
|
+
*/
|
|
240
|
+
export function netTransaction(drafts, facts, options = {}) {
|
|
241
|
+
const counters = options.counters ?? SYNC_COUNTER_COLUMNS;
|
|
242
|
+
const keyColumns = options.keyColumns ?? (() => []);
|
|
243
|
+
const input = subtractIntents(drafts);
|
|
244
|
+
// A uid deleted earlier in this transaction is not live for a later I,
|
|
245
|
+
// whatever row meta says (T13035): that I stays an I.
|
|
246
|
+
const deletedAt = new Map();
|
|
247
|
+
for (const d of input) {
|
|
248
|
+
if (d.o !== 'D' || d.u === null)
|
|
249
|
+
continue;
|
|
250
|
+
const key = `${d.t}\u0000${d.u}`;
|
|
251
|
+
if (!deletedAt.has(key))
|
|
252
|
+
deletedAt.set(key, d.seq);
|
|
253
|
+
}
|
|
254
|
+
const live = (t, u, seq) => {
|
|
255
|
+
const at = deletedAt.get(`${t}\u0000${u}`);
|
|
256
|
+
return (at === undefined || at > seq) && facts.live(t, u);
|
|
257
|
+
};
|
|
258
|
+
const out = [];
|
|
259
|
+
const renames = [];
|
|
260
|
+
for (const raw of chainsOf(input)) {
|
|
261
|
+
const chain = collapseRekeys(raw);
|
|
262
|
+
const keys = chain[0] ? keyColumns(chain[0].t) : [];
|
|
263
|
+
// The uid each stretch uses: a dropped K renames the whole chain to its
|
|
264
|
+
// final uid; a kept K splits it.
|
|
265
|
+
const kept = new Set();
|
|
266
|
+
let finalUid = null;
|
|
267
|
+
for (const op of chain) {
|
|
268
|
+
if (op.o !== 'K') {
|
|
269
|
+
finalUid = finalUid ?? op.u;
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const from = op.u ?? null;
|
|
273
|
+
const to = op.nu ?? null;
|
|
274
|
+
if (from !== null && (facts.sent(op.t, from) || facts.known(op.t, from)))
|
|
275
|
+
kept.add(op);
|
|
276
|
+
// A K that keeps its uid (only birth_fp changed) renames nothing.
|
|
277
|
+
else if (from !== null && to !== null && from !== to)
|
|
278
|
+
renames.push({ t: op.t, from, to });
|
|
279
|
+
finalUid = to;
|
|
280
|
+
}
|
|
281
|
+
let acc = { s: 'none' };
|
|
282
|
+
let last = null;
|
|
283
|
+
// The birth_fp the stretch ends with: a dropped K's new value wins.
|
|
284
|
+
let bfp;
|
|
285
|
+
// Stretch uid: before a kept K its old uid; otherwise the uid after the
|
|
286
|
+
// last K in the stretch (a dropped K rewrites earlier ops).
|
|
287
|
+
const stretchUid = (start, end) => {
|
|
288
|
+
for (let i = end - 1; i >= start; i--) {
|
|
289
|
+
const op = chain[i];
|
|
290
|
+
if (op.o === 'K')
|
|
291
|
+
return op.nu ?? null;
|
|
292
|
+
}
|
|
293
|
+
for (let i = start; i < end; i++) {
|
|
294
|
+
const op = chain[i];
|
|
295
|
+
if (op.u !== null)
|
|
296
|
+
return op.u;
|
|
297
|
+
}
|
|
298
|
+
return null;
|
|
299
|
+
};
|
|
300
|
+
let start = 0;
|
|
301
|
+
const flush = (end) => {
|
|
302
|
+
if (last !== null) {
|
|
303
|
+
const keptAfter = chain[end] && kept.has(chain[end]) ? chain[end] : null;
|
|
304
|
+
const uid = keptAfter ? (keptAfter.u ?? null) : (stretchUid(start, end) ?? finalUid);
|
|
305
|
+
const settled = settle(acc, last, uid, bfp, live, counters, keys);
|
|
306
|
+
if (settled)
|
|
307
|
+
out.push(settled);
|
|
308
|
+
}
|
|
309
|
+
acc = { s: 'none' };
|
|
310
|
+
last = null;
|
|
311
|
+
bfp = undefined;
|
|
312
|
+
};
|
|
313
|
+
chain.forEach((op, i) => {
|
|
314
|
+
if (op.o === 'K') {
|
|
315
|
+
if (kept.has(op)) {
|
|
316
|
+
flush(i);
|
|
317
|
+
const { rk: _rk, ...k } = op;
|
|
318
|
+
out.push({ ...k, last: op.seq });
|
|
319
|
+
start = i + 1;
|
|
320
|
+
}
|
|
321
|
+
else if (op.bfp !== undefined) {
|
|
322
|
+
bfp = op.bfp;
|
|
323
|
+
}
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
acc = step(acc, op);
|
|
327
|
+
last = op;
|
|
328
|
+
if (op.bfp !== undefined)
|
|
329
|
+
bfp = op.bfp;
|
|
330
|
+
});
|
|
331
|
+
flush(chain.length);
|
|
332
|
+
}
|
|
333
|
+
out.sort((x, y) => (x.seq ?? 0) - (y.seq ?? 0));
|
|
334
|
+
return { ops: out, renames };
|
|
335
|
+
}
|
|
336
|
+
//# sourceMappingURL=netting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"netting.js","sourceRoot":"","sources":["../../../src/store/sync/netting.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,EAAE,aAAa,EAAkB,MAAM,oBAAoB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgD,MAAM,CAA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