@cleocode/core 2026.10.4 → 2026.10.5
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/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +7 -37
- package/dist/bootstrap.js.map +1 -1
- package/dist/build-provenance.json +2 -2
- package/dist/caamp/adapter.d.ts.map +1 -1
- package/dist/caamp/adapter.js +5 -2
- package/dist/caamp/adapter.js.map +1 -1
- package/dist/changesets/parse-frontmatter.d.ts +1 -1
- package/dist/changesets/parse-frontmatter.d.ts.map +1 -1
- package/dist/changesets/parse-frontmatter.js +2 -1
- package/dist/changesets/parse-frontmatter.js.map +1 -1
- package/dist/changesets/parser.d.ts +1 -1
- package/dist/changesets/parser.d.ts.map +1 -1
- package/dist/changesets/parser.js +2 -1
- package/dist/changesets/parser.js.map +1 -1
- package/dist/changesets/writer.d.ts +8 -1
- package/dist/changesets/writer.d.ts.map +1 -1
- package/dist/changesets/writer.js +56 -5
- package/dist/changesets/writer.js.map +1 -1
- package/dist/cloud/keys.d.ts +9 -0
- package/dist/cloud/keys.d.ts.map +1 -1
- package/dist/cloud/keys.js +11 -0
- package/dist/cloud/keys.js.map +1 -1
- package/dist/cloud/nexus-attach.d.ts +17 -0
- package/dist/cloud/nexus-attach.d.ts.map +1 -1
- package/dist/cloud/nexus-attach.js +30 -9
- package/dist/cloud/nexus-attach.js.map +1 -1
- package/dist/cloud/nexus-auth.d.ts +7 -1
- package/dist/cloud/nexus-auth.d.ts.map +1 -1
- package/dist/cloud/nexus-auth.js +7 -1
- package/dist/cloud/nexus-auth.js.map +1 -1
- package/dist/cloud/nexus-cloud-activity.d.ts.map +1 -1
- package/dist/cloud/nexus-cloud-activity.js +2 -1
- package/dist/cloud/nexus-cloud-activity.js.map +1 -1
- package/dist/cloud/nexus-cloud-conflicts.d.ts +48 -0
- package/dist/cloud/nexus-cloud-conflicts.d.ts.map +1 -0
- package/dist/cloud/nexus-cloud-conflicts.js +68 -0
- package/dist/cloud/nexus-cloud-conflicts.js.map +1 -0
- package/dist/cloud/nexus-cloud-status.d.ts +42 -6
- package/dist/cloud/nexus-cloud-status.d.ts.map +1 -1
- package/dist/cloud/nexus-cloud-status.js +233 -19
- package/dist/cloud/nexus-cloud-status.js.map +1 -1
- package/dist/cloud/nexus-cloud.d.ts +18 -1
- package/dist/cloud/nexus-cloud.d.ts.map +1 -1
- package/dist/cloud/nexus-cloud.js +56 -2
- package/dist/cloud/nexus-cloud.js.map +1 -1
- package/dist/cloud/nexus-credentials.d.ts +1 -1
- package/dist/cloud/nexus-credentials.d.ts.map +1 -1
- package/dist/cloud/nexus-credentials.js +1 -1
- package/dist/cloud/nexus-credentials.js.map +1 -1
- package/dist/cloud/nexus-enrol.d.ts +1 -1
- package/dist/cloud/nexus-enrol.d.ts.map +1 -1
- package/dist/cloud/nexus-enrol.js +2 -1
- package/dist/cloud/nexus-enrol.js.map +1 -1
- package/dist/cloud/nexus-first-run.d.ts +6 -2
- package/dist/cloud/nexus-first-run.d.ts.map +1 -1
- package/dist/cloud/nexus-first-run.js +8 -2
- package/dist/cloud/nexus-first-run.js.map +1 -1
- package/dist/cloud/nexus-link.d.ts +35 -4
- package/dist/cloud/nexus-link.d.ts.map +1 -1
- package/dist/cloud/nexus-link.js +172 -7
- package/dist/cloud/nexus-link.js.map +1 -1
- package/dist/cloud/nexus-presence-refresh.d.ts +65 -0
- package/dist/cloud/nexus-presence-refresh.d.ts.map +1 -0
- package/dist/cloud/nexus-presence-refresh.js +122 -0
- package/dist/cloud/nexus-presence-refresh.js.map +1 -0
- package/dist/cloud/nexus-project-history.d.ts +54 -0
- package/dist/cloud/nexus-project-history.d.ts.map +1 -0
- package/dist/cloud/nexus-project-history.js +108 -0
- package/dist/cloud/nexus-project-history.js.map +1 -0
- package/dist/cloud/nexus-vault-keys.d.ts.map +1 -1
- package/dist/cloud/nexus-vault-keys.js +12 -6
- package/dist/cloud/nexus-vault-keys.js.map +1 -1
- package/dist/cloud/nexus-vault.d.ts +7 -3
- package/dist/cloud/nexus-vault.d.ts.map +1 -1
- package/dist/cloud/nexus-vault.js +176 -29
- package/dist/cloud/nexus-vault.js.map +1 -1
- package/dist/cloud/presence.d.ts +1 -1
- package/dist/cloud/presence.d.ts.map +1 -1
- package/dist/cloud/presence.js +1 -1
- package/dist/cloud/presence.js.map +1 -1
- package/dist/cloud/projects.d.ts +7 -4
- package/dist/cloud/projects.d.ts.map +1 -1
- package/dist/cloud/projects.js +10 -1
- package/dist/cloud/projects.js.map +1 -1
- package/dist/cloud/signing.d.ts +14 -0
- package/dist/cloud/signing.d.ts.map +1 -1
- package/dist/cloud/signing.js +9 -0
- package/dist/cloud/signing.js.map +1 -1
- package/dist/conduit/cloud-endpoint.d.ts +96 -0
- package/dist/conduit/cloud-endpoint.d.ts.map +1 -0
- package/dist/conduit/cloud-endpoint.js +191 -0
- package/dist/conduit/cloud-endpoint.js.map +1 -0
- package/dist/conduit/conduit-client.d.ts.map +1 -1
- package/dist/conduit/conduit-client.js +2 -1
- package/dist/conduit/conduit-client.js.map +1 -1
- package/dist/conduit/factory.d.ts +4 -0
- package/dist/conduit/factory.d.ts.map +1 -1
- package/dist/conduit/factory.js +7 -1
- package/dist/conduit/factory.js.map +1 -1
- package/dist/conduit/http-transport.d.ts +12 -7
- package/dist/conduit/http-transport.d.ts.map +1 -1
- package/dist/conduit/http-transport.js +18 -11
- package/dist/conduit/http-transport.js.map +1 -1
- package/dist/conduit/index.d.ts +3 -1
- package/dist/conduit/index.d.ts.map +1 -1
- package/dist/conduit/index.js +3 -1
- package/dist/conduit/index.js.map +1 -1
- package/dist/conduit/sse-transport.d.ts +5 -1
- package/dist/conduit/sse-transport.d.ts.map +1 -1
- package/dist/conduit/sse-transport.js +10 -2
- package/dist/conduit/sse-transport.js.map +1 -1
- package/dist/config/registry.js +1 -1
- package/dist/config/registry.js.map +1 -1
- package/dist/core-paths.d.ts +13 -0
- package/dist/core-paths.d.ts.map +1 -0
- package/dist/core-paths.js +13 -0
- package/dist/core-paths.js.map +1 -0
- package/dist/decide/bench/source.js +1 -1
- package/dist/decide/bench/source.js.map +1 -1
- package/dist/decide/client.d.ts +1 -1
- package/dist/decide/client.d.ts.map +1 -1
- package/dist/decide/client.js +1 -1
- package/dist/decide/client.js.map +1 -1
- package/dist/decide/credentials.d.ts +1 -1
- package/dist/decide/credentials.d.ts.map +1 -1
- package/dist/decide/credentials.js +1 -1
- package/dist/decide/credentials.js.map +1 -1
- package/dist/decide/jev-wire.d.ts +1 -1
- package/dist/decide/jev-wire.d.ts.map +1 -1
- package/dist/decide/jev-wire.js +1 -1
- package/dist/decide/jev-wire.js.map +1 -1
- package/dist/decide/operations.d.ts +1 -1
- package/dist/decide/operations.d.ts.map +1 -1
- package/dist/decide/operations.js +1 -1
- package/dist/decide/operations.js.map +1 -1
- package/dist/decide/providers.d.ts +1 -1
- package/dist/decide/providers.d.ts.map +1 -1
- package/dist/decide/providers.js +1 -1
- package/dist/decide/providers.js.map +1 -1
- package/dist/decide/wizard.d.ts.map +1 -1
- package/dist/decide/wizard.js +1 -1
- package/dist/decide/wizard.js.map +1 -1
- package/dist/dispatch/config-domain-handler.d.ts +1 -1
- package/dist/dispatch/config-domain-handler.d.ts.map +1 -1
- package/dist/dispatch/config-domain-handler.js +1 -1
- package/dist/dispatch/config-domain-handler.js.map +1 -1
- package/dist/dispatch/contracts/ensures-schema.d.ts +1 -1
- package/dist/dispatch/contracts/ensures-schema.d.ts.map +1 -1
- package/dist/dispatch/contracts/ensures-schema.js +1 -1
- package/dist/dispatch/contracts/ensures-schema.js.map +1 -1
- package/dist/dispatch/contracts/input-contracts.d.ts +1 -1
- package/dist/dispatch/contracts/input-contracts.d.ts.map +1 -1
- package/dist/dispatch/contracts/input-contracts.js +3 -1
- package/dist/dispatch/contracts/input-contracts.js.map +1 -1
- package/dist/dispatch/describe-operation.d.ts +1 -1
- package/dist/dispatch/describe-operation.d.ts.map +1 -1
- package/dist/dispatch/describe-operation.js +1 -1
- package/dist/dispatch/describe-operation.js.map +1 -1
- package/dist/docs/display-alias.js +1 -1
- package/dist/docs/display-alias.js.map +1 -1
- package/dist/docs/docs-update.d.ts +1 -1
- package/dist/docs/docs-update.d.ts.map +1 -1
- package/dist/docs/docs-update.js +2 -1
- package/dist/docs/docs-update.js.map +1 -1
- package/dist/docs/export-document.js +14 -58300
- package/dist/docs/export-document.js.map +3 -3
- package/dist/docs/publish-pr.js +1 -1
- package/dist/docs/publish-pr.js.map +1 -1
- package/dist/docs/supersede.js +1 -1
- package/dist/docs/supersede.js.map +1 -1
- package/dist/docs/validate-body.d.ts +1 -1
- package/dist/docs/validate-body.d.ts.map +1 -1
- package/dist/docs/validate-body.js +1 -1
- package/dist/docs/validate-body.js.map +1 -1
- package/dist/docs/writer-registry.js +1 -1
- package/dist/docs/writer-registry.js.map +1 -1
- package/dist/doctor/acceptance-drift.js +1 -1
- package/dist/doctor/acceptance-drift.js.map +1 -1
- package/dist/doctor/db-substrate.d.ts +1 -1
- package/dist/doctor/db-substrate.d.ts.map +1 -1
- package/dist/doctor/db-substrate.js +1 -1
- package/dist/doctor/db-substrate.js.map +1 -1
- package/dist/doctor/invariant-audit.js +1 -1
- package/dist/doctor/invariant-audit.js.map +1 -1
- package/dist/doctor/malformed-task-ids.js +1 -1
- package/dist/doctor/malformed-task-ids.js.map +1 -1
- package/dist/doctor/row-identity-refill.d.ts +43 -0
- package/dist/doctor/row-identity-refill.d.ts.map +1 -0
- package/dist/doctor/row-identity-refill.js +186 -0
- package/dist/doctor/row-identity-refill.js.map +1 -0
- package/dist/doctor/superseded-store.d.ts.map +1 -1
- package/dist/doctor/superseded-store.js +51 -2
- package/dist/doctor/superseded-store.js.map +1 -1
- package/dist/doctor/sync-repair.d.ts +39 -0
- package/dist/doctor/sync-repair.d.ts.map +1 -0
- package/dist/doctor/sync-repair.js +71 -0
- package/dist/doctor/sync-repair.js.map +1 -0
- package/dist/doctor/sync-triggers.d.ts +63 -4
- package/dist/doctor/sync-triggers.d.ts.map +1 -1
- package/dist/doctor/sync-triggers.js +352 -9
- package/dist/doctor/sync-triggers.js.map +1 -1
- package/dist/doctor/twin-collapse.js +1 -1
- package/dist/doctor/twin-collapse.js.map +1 -1
- package/dist/engine/engine-ops.d.ts.map +1 -1
- package/dist/engine/engine-ops.js +7 -1
- package/dist/engine/engine-ops.js.map +1 -1
- package/dist/engine-result.d.ts +1 -1
- package/dist/engine-result.d.ts.map +1 -1
- package/dist/engine-result.js +1 -1
- package/dist/engine-result.js.map +1 -1
- package/dist/error-registry.d.ts +1 -1
- package/dist/error-registry.d.ts.map +1 -1
- package/dist/error-registry.js +1 -1
- package/dist/error-registry.js.map +1 -1
- package/dist/errors-to-engine.d.ts +20 -0
- package/dist/errors-to-engine.d.ts.map +1 -1
- package/dist/errors-to-engine.js +37 -0
- package/dist/errors-to-engine.js.map +1 -1
- package/dist/gc/janitor.d.ts +23 -4
- package/dist/gc/janitor.d.ts.map +1 -1
- package/dist/gc/janitor.js +71 -11
- package/dist/gc/janitor.js.map +1 -1
- package/dist/goal/continuation.d.ts +1 -1
- package/dist/goal/continuation.d.ts.map +1 -1
- package/dist/goal/continuation.js +1 -1
- package/dist/goal/continuation.js.map +1 -1
- package/dist/goal/judge.d.ts.map +1 -1
- package/dist/goal/judge.js +2 -1
- package/dist/goal/judge.js.map +1 -1
- package/dist/hooks/handlers/session-hooks.d.ts.map +1 -1
- package/dist/hooks/handlers/session-hooks.js +1 -1
- package/dist/hooks/handlers/session-hooks.js.map +1 -1
- package/dist/init/engine-ops.js +1 -1
- package/dist/init/engine-ops.js.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +10 -41
- package/dist/init.js.map +1 -1
- package/dist/inject/index.js +1 -1
- package/dist/inject/index.js.map +1 -1
- package/dist/injection.d.ts.map +1 -1
- package/dist/injection.js +13 -0
- package/dist/injection.js.map +1 -1
- package/dist/internal.d.ts +4 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +7 -4
- package/dist/internal.js.map +1 -1
- package/dist/issue/create.js +1 -1
- package/dist/issue/create.js.map +1 -1
- package/dist/json-schema-validator.js +1 -1
- package/dist/json-schema-validator.js.map +1 -1
- package/dist/lifecycle/index.d.ts +2 -23
- package/dist/lifecycle/index.d.ts.map +1 -1
- package/dist/lifecycle/index.js +5 -112
- package/dist/lifecycle/index.js.map +1 -1
- package/dist/lifecycle/kind-requirements.d.ts +1 -1
- package/dist/lifecycle/kind-requirements.d.ts.map +1 -1
- package/dist/lifecycle/kind-requirements.js +1 -1
- package/dist/lifecycle/kind-requirements.js.map +1 -1
- package/dist/lifecycle/pipeline.js +1 -1
- package/dist/lifecycle/pipeline.js.map +1 -1
- package/dist/lifecycle/resume.js +2 -2
- package/dist/lifecycle/resume.js.map +1 -1
- package/dist/lifecycle/state-machine.js +1 -1
- package/dist/lifecycle/state-machine.js.map +1 -1
- package/dist/lifecycle/status.d.ts +46 -0
- package/dist/lifecycle/status.d.ts.map +1 -0
- package/dist/lifecycle/status.js +147 -0
- package/dist/lifecycle/status.js.map +1 -0
- package/dist/lifecycle/verification/satisfies-validator.js +1 -1
- package/dist/lifecycle/verification/satisfies-validator.js.map +1 -1
- package/dist/llm/catalog-seeder.d.ts +1 -1
- package/dist/llm/catalog-seeder.d.ts.map +1 -1
- package/dist/llm/catalog-seeder.js +1 -1
- package/dist/llm/catalog-seeder.js.map +1 -1
- package/dist/llm/cli-ops.d.ts +1 -2
- package/dist/llm/cli-ops.d.ts.map +1 -1
- package/dist/llm/cli-ops.js +2 -1
- package/dist/llm/cli-ops.js.map +1 -1
- package/dist/llm/credential-seeders/claude-code-seeder.js +1 -1
- package/dist/llm/credential-seeders/claude-code-seeder.js.map +1 -1
- package/dist/llm/credential-seeders/cleo-pkce-seeder.js +1 -1
- package/dist/llm/credential-seeders/cleo-pkce-seeder.js.map +1 -1
- package/dist/llm/credential-writeback.js +1 -1
- package/dist/llm/credential-writeback.js.map +1 -1
- package/dist/llm/entity-ops.d.ts +1 -1
- package/dist/llm/entity-ops.d.ts.map +1 -1
- package/dist/llm/entity-ops.js +2 -1
- package/dist/llm/entity-ops.js.map +1 -1
- package/dist/llm/llm-queue-admit.d.ts +1 -1
- package/dist/llm/llm-queue-admit.d.ts.map +1 -1
- package/dist/llm/llm-queue-admit.js +2 -1
- package/dist/llm/llm-queue-admit.js.map +1 -1
- package/dist/llm/onboarding/login-engine.js +1 -1
- package/dist/llm/onboarding/login-engine.js.map +1 -1
- package/dist/llm/pi/pi-errors.d.ts +1 -1
- package/dist/llm/pi/pi-errors.d.ts.map +1 -1
- package/dist/llm/pi/pi-errors.js +1 -1
- package/dist/llm/pi/pi-errors.js.map +1 -1
- package/dist/llm/plugin-facade.d.ts.map +1 -1
- package/dist/llm/plugin-facade.js +14 -93552
- package/dist/llm/plugin-facade.js.map +3 -3
- package/dist/llm/system-key.d.ts +1 -1
- package/dist/llm/system-key.d.ts.map +1 -1
- package/dist/llm/system-key.js +1 -1
- package/dist/llm/system-key.js.map +1 -1
- package/dist/llm/system-of-use-registry.d.ts +1 -1
- package/dist/llm/system-of-use-registry.d.ts.map +1 -1
- package/dist/llm/system-of-use-registry.js +1 -1
- package/dist/llm/system-of-use-registry.js.map +1 -1
- package/dist/llm/system-resolver.js +1 -1
- package/dist/llm/system-resolver.js.map +1 -1
- package/dist/memory/brain-host.d.ts +71 -0
- package/dist/memory/brain-host.d.ts.map +1 -0
- package/dist/memory/brain-host.js +84 -0
- package/dist/memory/brain-host.js.map +1 -0
- package/dist/memory/brain-writer-handlers.d.ts.map +1 -1
- package/dist/memory/brain-writer-handlers.js +24 -7
- package/dist/memory/brain-writer-handlers.js.map +1 -1
- package/dist/memory/brain-writer-thread.d.ts +66 -6
- package/dist/memory/brain-writer-thread.d.ts.map +1 -1
- package/dist/memory/brain-writer-thread.js +67 -10
- package/dist/memory/brain-writer-thread.js.map +1 -1
- package/dist/memory/brain-writer-worker.js +7 -0
- package/dist/memory/brain-writer-worker.js.map +1 -1
- package/dist/memory/decisions.js +2 -1
- package/dist/memory/decisions.js.map +1 -1
- package/dist/memory/embedding-backfill.d.ts +70 -0
- package/dist/memory/embedding-backfill.d.ts.map +1 -0
- package/dist/memory/embedding-backfill.js +110 -0
- package/dist/memory/embedding-backfill.js.map +1 -0
- package/dist/memory/index.js +1 -1
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/manifest-identity.js +1 -1
- package/dist/memory/manifest-identity.js.map +1 -1
- package/dist/memory/retrieval/observe.d.ts +23 -0
- package/dist/memory/retrieval/observe.d.ts.map +1 -1
- package/dist/memory/retrieval/observe.js +82 -36
- package/dist/memory/retrieval/observe.js.map +1 -1
- package/dist/metrics/model-provider-registry.d.ts.map +1 -1
- package/dist/metrics/model-provider-registry.js +6 -0
- package/dist/metrics/model-provider-registry.js.map +1 -1
- package/dist/metrics/token-service.d.ts +17 -0
- package/dist/metrics/token-service.d.ts.map +1 -1
- package/dist/metrics/token-service.js +17 -0
- package/dist/metrics/token-service.js.map +1 -1
- package/dist/migration/index.js +1 -1
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/manual/T10165-backfill-adr-index.js +1 -1
- package/dist/migration/manual/T10165-backfill-adr-index.js.map +1 -1
- package/dist/nexus/assessment-projection.d.ts +1 -1
- package/dist/nexus/assessment-projection.d.ts.map +1 -1
- package/dist/nexus/assessment-projection.js +1 -1
- package/dist/nexus/assessment-projection.js.map +1 -1
- package/dist/nexus/deps.d.ts +1 -1
- package/dist/nexus/deps.d.ts.map +1 -1
- package/dist/nexus/deps.js +1 -1
- package/dist/nexus/deps.js.map +1 -1
- package/dist/nexus/fleet-status.d.ts +1 -1
- package/dist/nexus/fleet-status.d.ts.map +1 -1
- package/dist/nexus/fleet-status.js +1 -1
- package/dist/nexus/fleet-status.js.map +1 -1
- package/dist/nexus/identity.js +1 -1
- package/dist/nexus/identity.js.map +1 -1
- package/dist/nexus/permissions.d.ts +1 -1
- package/dist/nexus/permissions.d.ts.map +1 -1
- package/dist/nexus/permissions.js +1 -1
- package/dist/nexus/permissions.js.map +1 -1
- package/dist/nexus/query-dsl.js +1 -1
- package/dist/nexus/query-dsl.js.map +1 -1
- package/dist/nexus/query.d.ts +1 -2
- package/dist/nexus/query.d.ts.map +1 -1
- package/dist/nexus/query.js +1 -1
- package/dist/nexus/query.js.map +1 -1
- package/dist/nexus/registry-errors.js +1 -1
- package/dist/nexus/registry-errors.js.map +1 -1
- package/dist/nexus/registry.d.ts +1 -1
- package/dist/nexus/registry.d.ts.map +1 -1
- package/dist/nexus/registry.js +1 -1
- package/dist/nexus/registry.js.map +1 -1
- package/dist/nexus/workspace.js +1 -1
- package/dist/nexus/workspace.js.map +1 -1
- package/dist/orchestrate/pivot.d.ts.map +1 -1
- package/dist/orchestrate/pivot.js +2 -1
- package/dist/orchestrate/pivot.js.map +1 -1
- package/dist/orchestrate/query-ops.js +1 -1
- package/dist/orchestrate/query-ops.js.map +1 -1
- package/dist/orchestrate/spawn-ops.js +1 -1
- package/dist/orchestrate/spawn-ops.js.map +1 -1
- package/dist/orchestration/atomicity.d.ts +1 -1
- package/dist/orchestration/atomicity.d.ts.map +1 -1
- package/dist/orchestration/atomicity.js +1 -1
- package/dist/orchestration/atomicity.js.map +1 -1
- package/dist/orchestration/classify.js +1 -1
- package/dist/orchestration/classify.js.map +1 -1
- package/dist/orchestration/index.js +1 -1
- package/dist/orchestration/index.js.map +1 -1
- package/dist/orchestration/parallel.js +1 -1
- package/dist/orchestration/parallel.js.map +1 -1
- package/dist/orchestration/protocol-validators.d.ts +1 -1
- package/dist/orchestration/protocol-validators.d.ts.map +1 -1
- package/dist/orchestration/protocol-validators.js +1 -1
- package/dist/orchestration/protocol-validators.js.map +1 -1
- package/dist/orchestration/skill-ops.js +1 -1
- package/dist/orchestration/skill-ops.js.map +1 -1
- package/dist/orchestration/spawn-prompt.d.ts +9 -0
- package/dist/orchestration/spawn-prompt.d.ts.map +1 -1
- package/dist/orchestration/spawn-prompt.js +13 -2
- package/dist/orchestration/spawn-prompt.js.map +1 -1
- package/dist/orchestration/spawn.js +1 -1
- package/dist/orchestration/spawn.js.map +1 -1
- package/dist/paths.d.ts +3 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +3 -1
- package/dist/paths.js.map +1 -1
- package/dist/phases/deps.js +1 -1
- package/dist/phases/deps.js.map +1 -1
- package/dist/phases/index.js +1 -1
- package/dist/phases/index.js.map +1 -1
- package/dist/project-lifecycle.js +3 -3
- package/dist/project-lifecycle.js.map +1 -1
- package/dist/registrations.d.ts +30 -0
- package/dist/registrations.d.ts.map +1 -0
- package/dist/registrations.js +30 -0
- package/dist/registrations.js.map +1 -0
- package/dist/release/changesets-aggregator.js +1 -1
- package/dist/release/changesets-aggregator.js.map +1 -1
- package/dist/release/ci-evidence.d.ts +68 -2
- package/dist/release/ci-evidence.d.ts.map +1 -1
- package/dist/release/ci-evidence.js +203 -39
- package/dist/release/ci-evidence.js.map +1 -1
- package/dist/release/invariants/archive-reason-invariant.d.ts +1 -1
- package/dist/release/invariants/archive-reason-invariant.d.ts.map +1 -1
- package/dist/release/invariants/archive-reason-invariant.js +1 -1
- package/dist/release/invariants/archive-reason-invariant.js.map +1 -1
- package/dist/release/invariants/registry.d.ts +1 -1
- package/dist/release/invariants/registry.d.ts.map +1 -1
- package/dist/release/invariants/registry.js +1 -1
- package/dist/release/invariants/registry.js.map +1 -1
- package/dist/release/open.d.ts +1 -1
- package/dist/release/open.d.ts.map +1 -1
- package/dist/release/open.js +3 -1
- package/dist/release/open.js.map +1 -1
- package/dist/release/plan.d.ts +1 -2
- package/dist/release/plan.d.ts.map +1 -1
- package/dist/release/plan.js +4 -1
- package/dist/release/plan.js.map +1 -1
- package/dist/release/pr-evidence.d.ts +1 -1
- package/dist/release/pr-evidence.d.ts.map +1 -1
- package/dist/release/pr-evidence.js +2 -2
- package/dist/release/pr-evidence.js.map +1 -1
- package/dist/release/preflight-skip.d.ts +5 -0
- package/dist/release/preflight-skip.d.ts.map +1 -1
- package/dist/release/preflight-skip.js +60 -1
- package/dist/release/preflight-skip.js.map +1 -1
- package/dist/release/reconcile.d.ts +1 -1
- package/dist/release/reconcile.d.ts.map +1 -1
- package/dist/release/reconcile.js +19 -3
- package/dist/release/reconcile.js.map +1 -1
- package/dist/release/version-bump.d.ts +1 -1
- package/dist/release/version-bump.d.ts.map +1 -1
- package/dist/release/version-bump.js +1 -1
- package/dist/release/version-bump.js.map +1 -1
- package/dist/resources/admission-ledger.d.ts +587 -0
- package/dist/resources/admission-ledger.d.ts.map +1 -0
- package/dist/resources/admission-ledger.js +1401 -0
- package/dist/resources/admission-ledger.js.map +1 -0
- package/dist/resources/backend.d.ts +37 -1
- package/dist/resources/backend.d.ts.map +1 -1
- package/dist/resources/backend.js +1 -1
- package/dist/resources/darwin-backend.d.ts +152 -26
- package/dist/resources/darwin-backend.d.ts.map +1 -1
- package/dist/resources/darwin-backend.js +217 -34
- package/dist/resources/darwin-backend.js.map +1 -1
- package/dist/resources/governor.d.ts +36 -39
- package/dist/resources/governor.d.ts.map +1 -1
- package/dist/resources/governor.js +140 -49
- package/dist/resources/governor.js.map +1 -1
- package/dist/resources/pressure-gate.d.ts +148 -0
- package/dist/resources/pressure-gate.d.ts.map +1 -0
- package/dist/resources/pressure-gate.js +273 -0
- package/dist/resources/pressure-gate.js.map +1 -0
- package/dist/resources/run-admission.d.ts +33 -45
- package/dist/resources/run-admission.d.ts.map +1 -1
- package/dist/resources/run-admission.js +50 -118
- package/dist/resources/run-admission.js.map +1 -1
- package/dist/resources/run-class.d.ts +60 -4
- package/dist/resources/run-class.d.ts.map +1 -1
- package/dist/resources/run-class.js +473 -6
- package/dist/resources/run-class.js.map +1 -1
- package/dist/resources/run-governed.d.ts +43 -11
- package/dist/resources/run-governed.d.ts.map +1 -1
- package/dist/resources/run-governed.js +139 -99
- package/dist/resources/run-governed.js.map +1 -1
- package/dist/resources/slot-holder.d.ts +12 -4
- package/dist/resources/slot-holder.d.ts.map +1 -1
- package/dist/resources/slot-holder.js +19 -14
- package/dist/resources/slot-holder.js.map +1 -1
- package/dist/resources/spawn-wrapper.js +1 -1
- package/dist/resources/spawn-wrapper.js.map +1 -1
- package/dist/resources/supervisor-admit.d.ts +1 -1
- package/dist/resources/supervisor-admit.d.ts.map +1 -1
- package/dist/resources/supervisor-admit.js +2 -1
- package/dist/resources/supervisor-admit.js.map +1 -1
- package/dist/runtime/openapi/generate-openapi.d.ts +1 -1
- package/dist/runtime/openapi/generate-openapi.d.ts.map +1 -1
- package/dist/runtime/openapi/generate-openapi.js +1 -1
- package/dist/runtime/openapi/generate-openapi.js.map +1 -1
- package/dist/sagas/index.d.ts +3 -1
- package/dist/sagas/index.d.ts.map +1 -1
- package/dist/sagas/index.js +2 -5
- package/dist/sagas/index.js.map +1 -1
- package/dist/scaffold/project-identity.js +1 -1
- package/dist/scaffold/project-identity.js.map +1 -1
- package/dist/sdk/validator-attest.d.ts +1 -1
- package/dist/sdk/validator-attest.d.ts.map +1 -1
- package/dist/sdk/validator-attest.js +1 -1
- package/dist/sdk/validator-attest.js.map +1 -1
- package/dist/sdk/validator-reject.d.ts +1 -1
- package/dist/sdk/validator-reject.d.ts.map +1 -1
- package/dist/sdk/validator-reject.js +1 -1
- package/dist/sdk/validator-reject.js.map +1 -1
- package/dist/security/input-sanitization.js +2 -1
- package/dist/security/input-sanitization.js.map +1 -1
- package/dist/security/override-cap.js +1 -1
- package/dist/security/override-cap.js.map +1 -1
- package/dist/security/owner-override-auth.js +1 -1
- package/dist/security/owner-override-auth.js.map +1 -1
- package/dist/security/shared-evidence-tracker.js +1 -1
- package/dist/security/shared-evidence-tracker.js.map +1 -1
- package/dist/selfimprove/fix-gen.js +35 -93037
- package/dist/selfimprove/fix-gen.js.map +3 -3
- package/dist/sentient/daemon.d.ts.map +1 -1
- package/dist/sentient/daemon.js +3 -0
- package/dist/sentient/daemon.js.map +1 -1
- package/dist/sentient/tick.d.ts +7 -0
- package/dist/sentient/tick.d.ts.map +1 -1
- package/dist/sentient/tick.js +11 -0
- package/dist/sentient/tick.js.map +1 -1
- package/dist/sequence/index.js +1 -1
- package/dist/sequence/index.js.map +1 -1
- package/dist/session/engine-ops.d.ts +3 -45
- package/dist/session/engine-ops.d.ts.map +1 -1
- package/dist/session/engine-ops.js +63 -112
- package/dist/session/engine-ops.js.map +1 -1
- package/dist/session/status-op.d.ts +40 -0
- package/dist/session/status-op.d.ts.map +1 -0
- package/dist/session/status-op.js +71 -0
- package/dist/session/status-op.js.map +1 -0
- package/dist/session/task-current.d.ts +31 -0
- package/dist/session/task-current.d.ts.map +1 -0
- package/dist/session/task-current.js +59 -0
- package/dist/session/task-current.js.map +1 -0
- package/dist/sessions/assumptions.d.ts +1 -1
- package/dist/sessions/assumptions.d.ts.map +1 -1
- package/dist/sessions/assumptions.js +1 -1
- package/dist/sessions/assumptions.js.map +1 -1
- package/dist/sessions/context-inject.js +1 -1
- package/dist/sessions/context-inject.js.map +1 -1
- package/dist/sessions/decisions.d.ts +1 -1
- package/dist/sessions/decisions.d.ts.map +1 -1
- package/dist/sessions/decisions.js +1 -1
- package/dist/sessions/decisions.js.map +1 -1
- package/dist/sessions/focus-state-store.d.ts.map +1 -1
- package/dist/sessions/focus-state-store.js +2 -1
- package/dist/sessions/focus-state-store.js.map +1 -1
- package/dist/sessions/handoff.js +1 -1
- package/dist/sessions/handoff.js.map +1 -1
- package/dist/sessions/index.d.ts +1 -2
- package/dist/sessions/index.d.ts.map +1 -1
- package/dist/sessions/index.js +3 -2
- package/dist/sessions/index.js.map +1 -1
- package/dist/sessions/session-drift.js +1 -1
- package/dist/sessions/session-drift.js.map +1 -1
- package/dist/sessions/session-end-snapshot-entry.d.ts +4 -0
- package/dist/sessions/session-end-snapshot-entry.d.ts.map +1 -1
- package/dist/sessions/session-end-snapshot-entry.js +11 -0
- package/dist/sessions/session-end-snapshot-entry.js.map +1 -1
- package/dist/sessions/session-end-snapshot.d.ts.map +1 -1
- package/dist/sessions/session-end-snapshot.js +4 -0
- package/dist/sessions/session-end-snapshot.js.map +1 -1
- package/dist/sessions/session-enforcement.js +1 -1
- package/dist/sessions/session-enforcement.js.map +1 -1
- package/dist/sessions/session-show.d.ts +1 -2
- package/dist/sessions/session-show.d.ts.map +1 -1
- package/dist/sessions/session-show.js +1 -1
- package/dist/sessions/session-show.js.map +1 -1
- package/dist/sessions/session-stats.js +1 -1
- package/dist/sessions/session-stats.js.map +1 -1
- package/dist/sessions/session-suspend.d.ts +1 -2
- package/dist/sessions/session-suspend.d.ts.map +1 -1
- package/dist/sessions/session-suspend.js +1 -1
- package/dist/sessions/session-suspend.js.map +1 -1
- package/dist/sessions/session-switch.js +1 -1
- package/dist/sessions/session-switch.js.map +1 -1
- package/dist/sessions/snapshot.js +1 -1
- package/dist/sessions/snapshot.js.map +1 -1
- package/dist/sessions/terminal-identity.d.ts +1 -1
- package/dist/sessions/terminal-identity.d.ts.map +1 -1
- package/dist/sessions/terminal-identity.js +1 -1
- package/dist/sessions/terminal-identity.js.map +1 -1
- package/dist/setup/sections/integrations.d.ts.map +1 -1
- package/dist/setup/sections/integrations.js +9 -0
- package/dist/setup/sections/integrations.js.map +1 -1
- package/dist/setup/sections/models-roles.js +1 -1
- package/dist/setup/sections/models-roles.js.map +1 -1
- package/dist/setup/sections/verification.d.ts.map +1 -1
- package/dist/setup/sections/verification.js +8 -2
- package/dist/setup/sections/verification.js.map +1 -1
- package/dist/shutdown.d.ts +24 -0
- package/dist/shutdown.d.ts.map +1 -1
- package/dist/shutdown.js +30 -1
- package/dist/shutdown.js.map +1 -1
- package/dist/skills/agents/install.d.ts +46 -6
- package/dist/skills/agents/install.d.ts.map +1 -1
- package/dist/skills/agents/install.js +86 -17
- package/dist/skills/agents/install.js.map +1 -1
- package/dist/skills/injection/subagent.js +1 -1
- package/dist/skills/injection/subagent.js.map +1 -1
- package/dist/skills/manifests/research.d.ts.map +1 -1
- package/dist/skills/manifests/research.js +2 -1
- package/dist/skills/manifests/research.js.map +1 -1
- package/dist/skills/orchestrator/spawn.js +1 -1
- package/dist/skills/orchestrator/spawn.js.map +1 -1
- package/dist/skills/orchestrator/validator.js +1 -1
- package/dist/skills/orchestrator/validator.js.map +1 -1
- package/dist/snapshot/index.d.ts.map +1 -1
- package/dist/snapshot/index.js +13 -0
- package/dist/snapshot/index.js.map +1 -1
- package/dist/spawn/agent-identity.js +1 -1
- package/dist/spawn/agent-identity.js.map +1 -1
- package/dist/stats/index.d.ts.map +1 -1
- package/dist/stats/index.js +2 -1
- package/dist/stats/index.js.map +1 -1
- package/dist/store/agent-install.d.ts.map +1 -1
- package/dist/store/agent-install.js +2 -1
- package/dist/store/agent-install.js.map +1 -1
- package/dist/store/agent-registry-accessor.d.ts +1 -0
- package/dist/store/agent-registry-accessor.d.ts.map +1 -1
- package/dist/store/agent-registry-accessor.js +3 -1
- package/dist/store/agent-registry-accessor.js.map +1 -1
- package/dist/store/atomic.js +1 -1
- package/dist/store/atomic.js.map +1 -1
- package/dist/store/attachment-store.js +1 -1
- package/dist/store/attachment-store.js.map +1 -1
- package/dist/store/audit-log-schema.d.ts +645 -0
- package/dist/store/audit-log-schema.d.ts.map +1 -0
- package/dist/store/audit-log-schema.js +30 -0
- package/dist/store/audit-log-schema.js.map +1 -0
- package/dist/store/background-ops.d.ts +26 -0
- package/dist/store/background-ops.d.ts.map +1 -1
- package/dist/store/background-ops.js +46 -0
- package/dist/store/background-ops.js.map +1 -1
- package/dist/store/backup-recover.d.ts +36 -1
- package/dist/store/backup-recover.d.ts.map +1 -1
- package/dist/store/backup-recover.js +99 -1
- package/dist/store/backup-recover.js.map +1 -1
- package/dist/store/backup-verify.d.ts +1 -1
- package/dist/store/backup-verify.d.ts.map +1 -1
- package/dist/store/backup-verify.js +6 -1
- package/dist/store/backup-verify.js.map +1 -1
- package/dist/store/backup.js +1 -1
- package/dist/store/backup.js.map +1 -1
- package/dist/store/conduit-sqlite.d.ts.map +1 -1
- package/dist/store/conduit-sqlite.js +2 -26
- package/dist/store/conduit-sqlite.js.map +1 -1
- package/dist/store/converters.js +1 -1
- package/dist/store/converters.js.map +1 -1
- package/dist/store/db-helpers.js +1 -1
- package/dist/store/db-helpers.js.map +1 -1
- package/dist/store/dependency-cycles.js +1 -1
- package/dist/store/dependency-cycles.js.map +1 -1
- package/dist/store/display-id-alias.d.ts +2 -2
- package/dist/store/display-id-alias.d.ts.map +1 -1
- package/dist/store/display-id-alias.js +5 -28
- package/dist/store/display-id-alias.js.map +1 -1
- package/dist/store/drizzle-node-sqlite.d.ts +56 -0
- package/dist/store/drizzle-node-sqlite.d.ts.map +1 -0
- package/dist/store/drizzle-node-sqlite.js +87 -0
- package/dist/store/drizzle-node-sqlite.js.map +1 -0
- package/dist/store/dual-scope-db.d.ts +26 -33
- package/dist/store/dual-scope-db.d.ts.map +1 -1
- package/dist/store/dual-scope-db.js +416 -127
- package/dist/store/dual-scope-db.js.map +1 -1
- package/dist/store/exodus/abort-events.d.ts +134 -0
- package/dist/store/exodus/abort-events.d.ts.map +1 -1
- package/dist/store/exodus/abort-events.js +201 -0
- package/dist/store/exodus/abort-events.js.map +1 -1
- package/dist/store/exodus/migrate.d.ts +7 -0
- package/dist/store/exodus/migrate.d.ts.map +1 -1
- package/dist/store/exodus/migrate.js +156 -118
- package/dist/store/exodus/migrate.js.map +1 -1
- package/dist/store/exodus/on-open.d.ts +36 -0
- package/dist/store/exodus/on-open.d.ts.map +1 -1
- package/dist/store/exodus/on-open.js +102 -27
- package/dist/store/exodus/on-open.js.map +1 -1
- package/dist/store/exodus/prior-recoveries.d.ts +75 -0
- package/dist/store/exodus/prior-recoveries.d.ts.map +1 -0
- package/dist/store/exodus/prior-recoveries.js +122 -0
- package/dist/store/exodus/prior-recoveries.js.map +1 -0
- package/dist/store/exodus/reconcile.d.ts.map +1 -1
- package/dist/store/exodus/reconcile.js +188 -24
- package/dist/store/exodus/reconcile.js.map +1 -1
- package/dist/store/exodus/runtime-targets.d.ts +3 -3
- package/dist/store/exodus/runtime-targets.js +3 -3
- package/dist/store/exodus/task-id-collision-sql.d.ts +52 -0
- package/dist/store/exodus/task-id-collision-sql.d.ts.map +1 -0
- package/dist/store/exodus/task-id-collision-sql.js +97 -0
- package/dist/store/exodus/task-id-collision-sql.js.map +1 -0
- package/dist/store/exodus/task-id-remap.d.ts +113 -0
- package/dist/store/exodus/task-id-remap.d.ts.map +1 -0
- package/dist/store/exodus/task-id-remap.js +301 -0
- package/dist/store/exodus/task-id-remap.js.map +1 -0
- package/dist/store/exodus/verify-migration.js +1 -1
- package/dist/store/exodus/verify-migration.js.map +1 -1
- package/dist/store/exodus/write-guard.d.ts +136 -0
- package/dist/store/exodus/write-guard.d.ts.map +1 -0
- package/dist/store/exodus/write-guard.js +289 -0
- package/dist/store/exodus/write-guard.js.map +1 -0
- package/dist/store/identity-share.d.ts +31 -0
- package/dist/store/identity-share.d.ts.map +1 -0
- package/dist/store/identity-share.js +54 -0
- package/dist/store/identity-share.js.map +1 -0
- package/dist/store/import-remap.js +1 -1
- package/dist/store/import-remap.js.map +1 -1
- package/dist/store/import-sort.js +1 -1
- package/dist/store/import-sort.js.map +1 -1
- package/dist/store/json.js +1 -1
- package/dist/store/json.js.map +1 -1
- package/dist/store/legacy-tasks-lineage.js +3 -3
- package/dist/store/legacy-tasks-lineage.js.map +1 -1
- package/dist/store/lock.d.ts +17 -0
- package/dist/store/lock.d.ts.map +1 -1
- package/dist/store/lock.js +18 -1
- package/dist/store/lock.js.map +1 -1
- package/dist/store/memory-sqlite.d.ts.map +1 -1
- package/dist/store/memory-sqlite.js +2 -25
- package/dist/store/memory-sqlite.js.map +1 -1
- package/dist/store/migration-files.d.ts +30 -0
- package/dist/store/migration-files.d.ts.map +1 -0
- package/dist/store/migration-files.js +59 -0
- package/dist/store/migration-files.js.map +1 -0
- package/dist/store/migration-manager.d.ts.map +1 -1
- package/dist/store/migration-manager.js +14 -14
- package/dist/store/migration-manager.js.map +1 -1
- package/dist/store/migration-runner.d.ts.map +1 -1
- package/dist/store/migration-runner.js +2 -2
- package/dist/store/migration-runner.js.map +1 -1
- package/dist/store/migration-sqlite.d.ts +1 -1
- package/dist/store/migration-sqlite.d.ts.map +1 -1
- package/dist/store/migration-sqlite.js +290 -355
- package/dist/store/migration-sqlite.js.map +1 -1
- package/dist/store/open-cleo-db.d.ts.map +1 -1
- package/dist/store/open-cleo-db.js +4 -2
- package/dist/store/open-cleo-db.js.map +1 -1
- package/dist/store/pid-alive.d.ts +15 -0
- package/dist/store/pid-alive.d.ts.map +1 -0
- package/dist/store/pid-alive.js +24 -0
- package/dist/store/pid-alive.js.map +1 -0
- package/dist/store/portable-bundle-scan.d.ts +1 -1
- package/dist/store/portable-bundle-scan.d.ts.map +1 -1
- package/dist/store/portable-bundle-scan.js +1 -1
- package/dist/store/portable-bundle-scan.js.map +1 -1
- package/dist/store/portable-bundle.d.ts +10 -1
- package/dist/store/portable-bundle.d.ts.map +1 -1
- package/dist/store/portable-bundle.js +10 -1
- package/dist/store/portable-bundle.js.map +1 -1
- package/dist/store/recover-malformed-db.d.ts +1 -1
- package/dist/store/recover-malformed-db.d.ts.map +1 -1
- package/dist/store/recover-malformed-db.js +1 -1
- package/dist/store/recover-malformed-db.js.map +1 -1
- package/dist/store/repair-malformed-dbs.d.ts +1 -1
- package/dist/store/repair-malformed-dbs.d.ts.map +1 -1
- package/dist/store/repair-malformed-dbs.js +1 -1
- package/dist/store/repair-malformed-dbs.js.map +1 -1
- package/dist/store/restore-marker.d.ts +89 -0
- package/dist/store/restore-marker.d.ts.map +1 -0
- package/dist/store/restore-marker.js +197 -0
- package/dist/store/restore-marker.js.map +1 -0
- package/dist/store/restore-store.d.ts +85 -0
- package/dist/store/restore-store.d.ts.map +1 -0
- package/dist/store/restore-store.js +391 -0
- package/dist/store/restore-store.js.map +1 -0
- package/dist/store/row-identity.d.ts +123 -1
- package/dist/store/row-identity.d.ts.map +1 -1
- package/dist/store/row-identity.js +454 -80
- package/dist/store/row-identity.js.map +1 -1
- package/dist/store/schema/agent-registry-schema.d.ts +1 -1
- package/dist/store/schema/agent-registry-schema.d.ts.map +1 -1
- package/dist/store/schema/agent-registry-schema.js +5 -1
- package/dist/store/schema/agent-registry-schema.js.map +1 -1
- package/dist/store/schema/cleo-global/agent-registry.d.ts +1 -1
- package/dist/store/schema/cleo-global/agent-registry.d.ts.map +1 -1
- package/dist/store/schema/cleo-global/agent-registry.js +9 -5
- package/dist/store/schema/cleo-global/agent-registry.js.map +1 -1
- package/dist/store/schema/cleo-global/models-catalog.js +1 -1
- package/dist/store/schema/cleo-global/models-catalog.js.map +1 -1
- package/dist/store/schema/cleo-global/nexus.js +1 -1
- package/dist/store/schema/cleo-global/nexus.js.map +1 -1
- package/dist/store/schema/cleo-project/provenance-commits.d.ts +1 -1
- package/dist/store/schema/cleo-project/provenance-orphans.d.ts +1 -1
- package/dist/store/schema/cleo-project/provenance-orphans.d.ts.map +1 -1
- package/dist/store/schema/cleo-project/provenance-orphans.js +9 -2
- package/dist/store/schema/cleo-project/provenance-orphans.js.map +1 -1
- package/dist/store/schema/cleo-project/provenance-rest.d.ts +1 -1
- package/dist/store/schema/cleo-project/provenance-rest.js +1 -1
- package/dist/store/schema/cleo-project/provenance-rest.js.map +1 -1
- package/dist/store/schema/cleo-shared/brain.js +1 -1
- package/dist/store/schema/cleo-shared/brain.js.map +1 -1
- package/dist/store/schema/memory-schema.d.ts +1 -1
- package/dist/store/schema/memory-schema.d.ts.map +1 -1
- package/dist/store/schema/memory-schema.js +1 -1
- package/dist/store/schema/memory-schema.js.map +1 -1
- package/dist/store/schema/nexus-schema.js +1 -1
- package/dist/store/schema/nexus-schema.js.map +1 -1
- package/dist/store/service-host-matcher.d.ts +1 -1
- package/dist/store/service-host-matcher.d.ts.map +1 -1
- package/dist/store/service-host-matcher.js +1 -1
- package/dist/store/service-host-matcher.js.map +1 -1
- package/dist/store/service-oauth.js +1 -1
- package/dist/store/service-oauth.js.map +1 -1
- package/dist/store/session-store.d.ts.map +1 -1
- package/dist/store/session-store.js +7 -1
- package/dist/store/session-store.js.map +1 -1
- package/dist/store/sqlite-backup.d.ts +1 -1
- package/dist/store/sqlite-backup.d.ts.map +1 -1
- package/dist/store/sqlite-backup.js +1 -1
- package/dist/store/sqlite-backup.js.map +1 -1
- package/dist/store/sqlite-data-accessor.d.ts +52 -1
- package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
- package/dist/store/sqlite-data-accessor.js +95 -22
- package/dist/store/sqlite-data-accessor.js.map +1 -1
- package/dist/store/sqlite-native.d.ts.map +1 -1
- package/dist/store/sqlite-native.js +9 -9
- package/dist/store/sqlite-native.js.map +1 -1
- package/dist/store/sqlite-pragmas.d.ts +12 -5
- package/dist/store/sqlite-pragmas.d.ts.map +1 -1
- package/dist/store/sqlite-pragmas.js +13 -2
- package/dist/store/sqlite-pragmas.js.map +1 -1
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/sqlite.js +7 -32
- package/dist/store/sqlite.js.map +1 -1
- package/dist/store/status-registry.d.ts +1 -1
- package/dist/store/status-registry.d.ts.map +1 -1
- package/dist/store/status-registry.js +1 -1
- package/dist/store/status-registry.js.map +1 -1
- package/dist/store/sync/apply/applier.d.ts +119 -0
- package/dist/store/sync/apply/applier.d.ts.map +1 -0
- package/dist/store/sync/apply/applier.js +1239 -0
- package/dist/store/sync/apply/applier.js.map +1 -0
- package/dist/store/sync/apply/fk.d.ts +47 -0
- package/dist/store/sync/apply/fk.d.ts.map +1 -0
- package/dist/store/sync/apply/fk.js +89 -0
- package/dist/store/sync/apply/fk.js.map +1 -0
- package/dist/store/sync/apply/footprints.d.ts +60 -0
- package/dist/store/sync/apply/footprints.d.ts.map +1 -0
- package/dist/store/sync/apply/footprints.js +235 -0
- package/dist/store/sync/apply/footprints.js.map +1 -0
- package/dist/store/sync/apply/frame.d.ts +80 -0
- package/dist/store/sync/apply/frame.d.ts.map +1 -0
- package/dist/store/sync/apply/frame.js +127 -0
- package/dist/store/sync/apply/frame.js.map +1 -0
- package/dist/store/sync/apply/index.d.ts +11 -0
- package/dist/store/sync/apply/index.d.ts.map +1 -0
- package/dist/store/sync/apply/index.js +11 -0
- package/dist/store/sync/apply/index.js.map +1 -0
- package/dist/store/sync/apply/parent-delete.d.ts +38 -0
- package/dist/store/sync/apply/parent-delete.d.ts.map +1 -0
- package/dist/store/sync/apply/parent-delete.js +41 -0
- package/dist/store/sync/apply/parent-delete.js.map +1 -0
- package/dist/store/sync/apply/post-apply.d.ts +67 -0
- package/dist/store/sync/apply/post-apply.d.ts.map +1 -0
- package/dist/store/sync/apply/post-apply.js +118 -0
- package/dist/store/sync/apply/post-apply.js.map +1 -0
- package/dist/store/sync/apply/refs.d.ts +60 -0
- package/dist/store/sync/apply/refs.d.ts.map +1 -0
- package/dist/store/sync/apply/refs.js +90 -0
- package/dist/store/sync/apply/refs.js.map +1 -0
- package/dist/store/sync/apply/write-api.d.ts +195 -0
- package/dist/store/sync/apply/write-api.d.ts.map +1 -0
- package/dist/store/sync/apply/write-api.js +416 -0
- package/dist/store/sync/apply/write-api.js.map +1 -0
- package/dist/store/sync/apply-intent.d.ts +117 -0
- package/dist/store/sync/apply-intent.d.ts.map +1 -0
- package/dist/store/sync/apply-intent.js +225 -0
- package/dist/store/sync/apply-intent.js.map +1 -0
- package/dist/store/sync/capture.d.ts +32 -2
- package/dist/store/sync/capture.d.ts.map +1 -1
- package/dist/store/sync/capture.js +47 -13
- package/dist/store/sync/capture.js.map +1 -1
- package/dist/store/sync/conflicts.d.ts +81 -0
- package/dist/store/sync/conflicts.d.ts.map +1 -0
- package/dist/store/sync/conflicts.js +98 -0
- package/dist/store/sync/conflicts.js.map +1 -0
- package/dist/store/sync/field-leave.d.ts +146 -0
- package/dist/store/sync/field-leave.d.ts.map +1 -0
- package/dist/store/sync/field-leave.js +241 -0
- package/dist/store/sync/field-leave.js.map +1 -0
- package/dist/store/sync/flags.d.ts +119 -0
- package/dist/store/sync/flags.d.ts.map +1 -1
- package/dist/store/sync/flags.js +360 -0
- package/dist/store/sync/flags.js.map +1 -1
- package/dist/store/sync/held.d.ts +197 -0
- package/dist/store/sync/held.d.ts.map +1 -0
- package/dist/store/sync/held.js +314 -0
- package/dist/store/sync/held.js.map +1 -0
- package/dist/store/sync/identity-fill.d.ts.map +1 -1
- package/dist/store/sync/identity-fill.js +10 -2
- package/dist/store/sync/identity-fill.js.map +1 -1
- package/dist/store/sync/inbox.d.ts +114 -0
- package/dist/store/sync/inbox.d.ts.map +1 -0
- package/dist/store/sync/inbox.js +222 -0
- package/dist/store/sync/inbox.js.map +1 -0
- package/dist/store/sync/inherit.d.ts +36 -0
- package/dist/store/sync/inherit.d.ts.map +1 -0
- package/dist/store/sync/inherit.js +38 -0
- package/dist/store/sync/inherit.js.map +1 -0
- package/dist/store/sync/merge/engine.d.ts +114 -0
- package/dist/store/sync/merge/engine.d.ts.map +1 -0
- package/dist/store/sync/merge/engine.js +698 -0
- package/dist/store/sync/merge/engine.js.map +1 -0
- package/dist/store/sync/merge/index.d.ts +11 -0
- package/dist/store/sync/merge/index.d.ts.map +1 -0
- package/dist/store/sync/merge/index.js +11 -0
- package/dist/store/sync/merge/index.js.map +1 -0
- package/dist/store/sync/merge/rules.d.ts +91 -0
- package/dist/store/sync/merge/rules.d.ts.map +1 -0
- package/dist/store/sync/merge/rules.js +151 -0
- package/dist/store/sync/merge/rules.js.map +1 -0
- package/dist/store/sync/merge/types.d.ts +206 -0
- package/dist/store/sync/merge/types.d.ts.map +1 -0
- package/dist/store/sync/merge/types.js +15 -0
- package/dist/store/sync/merge/types.js.map +1 -0
- package/dist/store/sync/migration-hooks.d.ts +47 -0
- package/dist/store/sync/migration-hooks.d.ts.map +1 -0
- package/dist/store/sync/migration-hooks.js +74 -0
- package/dist/store/sync/migration-hooks.js.map +1 -0
- package/dist/store/sync/netting.d.ts +5 -0
- package/dist/store/sync/netting.d.ts.map +1 -1
- package/dist/store/sync/netting.js +29 -2
- package/dist/store/sync/netting.js.map +1 -1
- package/dist/store/sync/remap.d.ts +72 -0
- package/dist/store/sync/remap.d.ts.map +1 -0
- package/dist/store/sync/remap.js +209 -0
- package/dist/store/sync/remap.js.map +1 -0
- package/dist/store/sync/repair.d.ts +180 -0
- package/dist/store/sync/repair.d.ts.map +1 -0
- package/dist/store/sync/repair.js +499 -0
- package/dist/store/sync/repair.js.map +1 -0
- package/dist/store/sync/replica-registry.d.ts +54 -0
- package/dist/store/sync/replica-registry.d.ts.map +1 -1
- package/dist/store/sync/replica-registry.js +72 -2
- package/dist/store/sync/replica-registry.js.map +1 -1
- package/dist/store/sync/replica.d.ts +71 -9
- package/dist/store/sync/replica.d.ts.map +1 -1
- package/dist/store/sync/replica.js +95 -11
- package/dist/store/sync/replica.js.map +1 -1
- package/dist/store/sync/row-meta.d.ts +148 -0
- package/dist/store/sync/row-meta.d.ts.map +1 -0
- package/dist/store/sync/row-meta.js +200 -0
- package/dist/store/sync/row-meta.js.map +1 -0
- package/dist/store/sync/schema.d.ts +13 -5
- package/dist/store/sync/schema.d.ts.map +1 -1
- package/dist/store/sync/schema.js +34 -7
- package/dist/store/sync/schema.js.map +1 -1
- package/dist/store/sync/sealer-values.d.ts.map +1 -1
- package/dist/store/sync/sealer-values.js +1 -0
- package/dist/store/sync/sealer-values.js.map +1 -1
- package/dist/store/sync/sealer.d.ts +96 -0
- package/dist/store/sync/sealer.d.ts.map +1 -1
- package/dist/store/sync/sealer.js +532 -58
- package/dist/store/sync/sealer.js.map +1 -1
- package/dist/store/sync/sequencing.d.ts +175 -0
- package/dist/store/sync/sequencing.d.ts.map +1 -0
- package/dist/store/sync/sequencing.js +295 -0
- package/dist/store/sync/sequencing.js.map +1 -0
- package/dist/store/sync/structural.d.ts +30 -2
- package/dist/store/sync/structural.d.ts.map +1 -1
- package/dist/store/sync/structural.js +64 -2
- package/dist/store/sync/structural.js.map +1 -1
- package/dist/store/sync/timestamp-canon.d.ts +44 -0
- package/dist/store/sync/timestamp-canon.d.ts.map +1 -0
- package/dist/store/sync/timestamp-canon.js +102 -0
- package/dist/store/sync/timestamp-canon.js.map +1 -0
- package/dist/store/sync/timestamps.d.ts +1 -30
- package/dist/store/sync/timestamps.d.ts.map +1 -1
- package/dist/store/sync/timestamps.js +2 -89
- package/dist/store/sync/timestamps.js.map +1 -1
- package/dist/store/sync/trigger-classes.d.ts +8 -0
- package/dist/store/sync/trigger-classes.d.ts.map +1 -1
- package/dist/store/sync/trigger-classes.js +13 -0
- package/dist/store/sync/trigger-classes.js.map +1 -1
- package/dist/store/sync/write-actor.d.ts +58 -0
- package/dist/store/sync/write-actor.d.ts.map +1 -0
- package/dist/store/sync/write-actor.js +67 -0
- package/dist/store/sync/write-actor.js.map +1 -0
- package/dist/store/table-classification.d.ts.map +1 -1
- package/dist/store/table-classification.js +84 -0
- package/dist/store/table-classification.js.map +1 -1
- package/dist/store/task-claim.d.ts +1 -1
- package/dist/store/task-claim.d.ts.map +1 -1
- package/dist/store/task-claim.js +1 -1
- package/dist/store/task-claim.js.map +1 -1
- package/dist/store/task-reference-columns.d.ts +27 -0
- package/dist/store/task-reference-columns.d.ts.map +1 -0
- package/dist/store/task-reference-columns.js +65 -0
- package/dist/store/task-reference-columns.js.map +1 -0
- package/dist/store/task-version.d.ts +1 -1
- package/dist/store/task-version.d.ts.map +1 -1
- package/dist/store/task-version.js +1 -1
- package/dist/store/task-version.js.map +1 -1
- package/dist/store/tasks-schema.d.ts +2 -1
- package/dist/store/tasks-schema.d.ts.map +1 -1
- package/dist/store/tasks-schema.js +5 -4
- package/dist/store/tasks-schema.js.map +1 -1
- package/dist/store/tasks-sqlite.d.ts +1 -1
- package/dist/store/tasks-sqlite.d.ts.map +1 -1
- package/dist/store/tasks-sqlite.js +3 -1
- package/dist/store/tasks-sqlite.js.map +1 -1
- package/dist/store/twin-collapse.d.ts +43 -14
- package/dist/store/twin-collapse.d.ts.map +1 -1
- package/dist/store/twin-collapse.js +373 -32
- package/dist/store/twin-collapse.js.map +1 -1
- package/dist/store/validation-schemas.d.ts +44 -674
- package/dist/store/validation-schemas.d.ts.map +1 -1
- package/dist/store/validation-schemas.js +2 -22
- package/dist/store/validation-schemas.js.map +1 -1
- package/dist/store/vault-manifest.d.ts +1 -1
- package/dist/store/vault-manifest.d.ts.map +1 -1
- package/dist/store/vault-manifest.js +1 -1
- package/dist/store/vault-manifest.js.map +1 -1
- package/dist/store/worktree-build-guard.js +1 -1
- package/dist/store/worktree-build-guard.js.map +1 -1
- package/dist/store/worktree-isolation-guard.js +1 -1
- package/dist/store/worktree-isolation-guard.js.map +1 -1
- package/dist/store/writer-lease.d.ts.map +1 -1
- package/dist/store/writer-lease.js +1 -11
- package/dist/store/writer-lease.js.map +1 -1
- package/dist/store/zod-schema-factory.d.ts +16 -0
- package/dist/store/zod-schema-factory.d.ts.map +1 -0
- package/dist/store/zod-schema-factory.js +23 -0
- package/dist/store/zod-schema-factory.js.map +1 -0
- package/dist/system/backup.d.ts +106 -0
- package/dist/system/backup.d.ts.map +1 -1
- package/dist/system/backup.js +295 -19
- package/dist/system/backup.js.map +1 -1
- package/dist/system/cleanup.js +1 -1
- package/dist/system/cleanup.js.map +1 -1
- package/dist/system/labels.js +1 -1
- package/dist/system/labels.js.map +1 -1
- package/dist/system/migrate.js +1 -1
- package/dist/system/migrate.js.map +1 -1
- package/dist/system/safestop.d.ts.map +1 -1
- package/dist/system/safestop.js +1 -1
- package/dist/system/safestop.js.map +1 -1
- package/dist/task-work/current.d.ts +34 -0
- package/dist/task-work/current.d.ts.map +1 -0
- package/dist/task-work/current.js +34 -0
- package/dist/task-work/current.js.map +1 -0
- package/dist/task-work/index.d.ts +2 -19
- package/dist/task-work/index.d.ts.map +1 -1
- package/dist/task-work/index.js +6 -20
- package/dist/task-work/index.js.map +1 -1
- package/dist/tasks/ac-identity.d.ts +28 -0
- package/dist/tasks/ac-identity.d.ts.map +1 -0
- package/dist/tasks/ac-identity.js +43 -0
- package/dist/tasks/ac-identity.js.map +1 -0
- package/dist/tasks/ac-immutability.d.ts +1 -1
- package/dist/tasks/ac-immutability.d.ts.map +1 -1
- package/dist/tasks/ac-immutability.js +1 -1
- package/dist/tasks/ac-immutability.js.map +1 -1
- package/dist/tasks/ac-table.d.ts +2 -14
- package/dist/tasks/ac-table.d.ts.map +1 -1
- package/dist/tasks/ac-table.js +6 -29
- package/dist/tasks/ac-table.js.map +1 -1
- package/dist/tasks/acceptance-input.js +1 -1
- package/dist/tasks/acceptance-input.js.map +1 -1
- package/dist/tasks/add.d.ts.map +1 -1
- package/dist/tasks/add.js +3 -1
- package/dist/tasks/add.js.map +1 -1
- package/dist/tasks/affected-packages.d.ts +80 -12
- package/dist/tasks/affected-packages.d.ts.map +1 -1
- package/dist/tasks/affected-packages.js +130 -19
- package/dist/tasks/affected-packages.js.map +1 -1
- package/dist/tasks/archive.d.ts.map +1 -1
- package/dist/tasks/archive.js +1 -1
- package/dist/tasks/archive.js.map +1 -1
- package/dist/tasks/axis-filters.d.ts.map +1 -1
- package/dist/tasks/axis-filters.js +2 -1
- package/dist/tasks/axis-filters.js.map +1 -1
- package/dist/tasks/child-disposition.js +1 -1
- package/dist/tasks/child-disposition.js.map +1 -1
- package/dist/tasks/collection.js +1 -1
- package/dist/tasks/collection.js.map +1 -1
- package/dist/tasks/complete.d.ts.map +1 -1
- package/dist/tasks/complete.js +2 -1
- package/dist/tasks/complete.js.map +1 -1
- package/dist/tasks/decompose.js +1 -1
- package/dist/tasks/decompose.js.map +1 -1
- package/dist/tasks/delete.js +1 -1
- package/dist/tasks/delete.js.map +1 -1
- package/dist/tasks/done-plan.d.ts +2 -1
- package/dist/tasks/done-plan.d.ts.map +1 -1
- package/dist/tasks/done-plan.js +10 -20
- package/dist/tasks/done-plan.js.map +1 -1
- package/dist/tasks/done-record.d.ts +1 -1
- package/dist/tasks/done-record.d.ts.map +1 -1
- package/dist/tasks/done-record.js +1 -1
- package/dist/tasks/done-record.js.map +1 -1
- package/dist/tasks/enforcement.d.ts +2 -1
- package/dist/tasks/enforcement.d.ts.map +1 -1
- package/dist/tasks/enforcement.js +1 -1
- package/dist/tasks/enforcement.js.map +1 -1
- package/dist/tasks/engine-wrap-ops.js +1 -1
- package/dist/tasks/engine-wrap-ops.js.map +1 -1
- package/dist/tasks/engine-wrap.d.ts.map +1 -1
- package/dist/tasks/engine-wrap.js +7 -3
- package/dist/tasks/engine-wrap.js.map +1 -1
- package/dist/tasks/epic-enforcement.js +1 -1
- package/dist/tasks/epic-enforcement.js.map +1 -1
- package/dist/tasks/evidence.d.ts.map +1 -1
- package/dist/tasks/evidence.js +41 -19
- package/dist/tasks/evidence.js.map +1 -1
- package/dist/tasks/find.js +1 -1
- package/dist/tasks/find.js.map +1 -1
- package/dist/tasks/gate-result-cache.js +1 -1
- package/dist/tasks/gate-result-cache.js.map +1 -1
- package/dist/tasks/gate-runner.d.ts.map +1 -1
- package/dist/tasks/gate-runner.js +1 -1
- package/dist/tasks/gate-runner.js.map +1 -1
- package/dist/tasks/heavy-tool-env.d.ts +79 -11
- package/dist/tasks/heavy-tool-env.d.ts.map +1 -1
- package/dist/tasks/heavy-tool-env.js +111 -14
- package/dist/tasks/heavy-tool-env.js.map +1 -1
- package/dist/tasks/index.d.ts +1 -1
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/index.js +2 -2
- package/dist/tasks/index.js.map +1 -1
- package/dist/tasks/labels.js +1 -1
- package/dist/tasks/labels.js.map +1 -1
- package/dist/tasks/nexus-impact-gate.js +1 -1
- package/dist/tasks/nexus-impact-gate.js.map +1 -1
- package/dist/tasks/pipeline-stage.js +1 -1
- package/dist/tasks/pipeline-stage.js.map +1 -1
- package/dist/tasks/population.js +1 -1
- package/dist/tasks/population.js.map +1 -1
- package/dist/tasks/ranking-audit.js +1 -1
- package/dist/tasks/ranking-audit.js.map +1 -1
- package/dist/tasks/reconcile-scope.js +1 -1
- package/dist/tasks/reconcile-scope.js.map +1 -1
- package/dist/tasks/relates.js +1 -1
- package/dist/tasks/relates.js.map +1 -1
- package/dist/tasks/req.d.ts.map +1 -1
- package/dist/tasks/req.js +2 -1
- package/dist/tasks/req.js.map +1 -1
- package/dist/tasks/severity-attestation.d.ts +1 -1
- package/dist/tasks/severity-attestation.d.ts.map +1 -1
- package/dist/tasks/severity-attestation.js +1 -1
- package/dist/tasks/severity-attestation.js.map +1 -1
- package/dist/tasks/show.d.ts.map +1 -1
- package/dist/tasks/show.js +47 -3
- package/dist/tasks/show.js.map +1 -1
- package/dist/tasks/task-import.js +1 -1
- package/dist/tasks/task-import.js.map +1 -1
- package/dist/tasks/task-reparent.d.ts.map +1 -1
- package/dist/tasks/task-reparent.js +2 -1
- package/dist/tasks/task-reparent.js.map +1 -1
- package/dist/tasks/test-run-binding.d.ts.map +1 -1
- package/dist/tasks/test-run-binding.js +9 -2
- package/dist/tasks/test-run-binding.js.map +1 -1
- package/dist/tasks/tool-cache.d.ts +23 -8
- package/dist/tasks/tool-cache.d.ts.map +1 -1
- package/dist/tasks/tool-cache.js +57 -16
- package/dist/tasks/tool-cache.js.map +1 -1
- package/dist/tasks/tool-resolver.d.ts +8 -0
- package/dist/tasks/tool-resolver.d.ts.map +1 -1
- package/dist/tasks/tool-resolver.js +15 -1
- package/dist/tasks/tool-resolver.js.map +1 -1
- package/dist/tasks/tool-runner-guard.d.ts +131 -0
- package/dist/tasks/tool-runner-guard.d.ts.map +1 -0
- package/dist/tasks/tool-runner-guard.js +141 -0
- package/dist/tasks/tool-runner-guard.js.map +1 -0
- package/dist/tasks/tool-semaphore.d.ts +103 -342
- package/dist/tasks/tool-semaphore.d.ts.map +1 -1
- package/dist/tasks/tool-semaphore.js +131 -619
- package/dist/tasks/tool-semaphore.js.map +1 -1
- package/dist/tasks/update.d.ts.map +1 -1
- package/dist/tasks/update.js +2 -1
- package/dist/tasks/update.js.map +1 -1
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +5 -34
- package/dist/upgrade.js.map +1 -1
- package/dist/validation/doctor/checks.d.ts +24 -0
- package/dist/validation/doctor/checks.d.ts.map +1 -1
- package/dist/validation/doctor/checks.js +168 -0
- package/dist/validation/doctor/checks.js.map +1 -1
- package/dist/validation/doctor/index.d.ts +1 -1
- package/dist/validation/doctor/index.d.ts.map +1 -1
- package/dist/validation/doctor/index.js +1 -1
- package/dist/validation/doctor/index.js.map +1 -1
- package/dist/validation/engine-ops.js +1 -1
- package/dist/validation/engine-ops.js.map +1 -1
- package/dist/validation/engine.d.ts +1 -1
- package/dist/validation/engine.d.ts.map +1 -1
- package/dist/validation/engine.js +2 -1
- package/dist/validation/engine.js.map +1 -1
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +1 -1
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/operation-gate-validators.js +1 -1
- package/dist/validation/operation-gate-validators.js.map +1 -1
- package/dist/validation/protocol-common.js +1 -1
- package/dist/validation/protocol-common.js.map +1 -1
- package/dist/validation/protocols/_shared.js +1 -1
- package/dist/validation/protocols/_shared.js.map +1 -1
- package/dist/validation/validate-ops.js +1 -1
- package/dist/validation/validate-ops.js.map +1 -1
- package/dist/validation/verification.js +1 -1
- package/dist/validation/verification.js.map +1 -1
- package/dist/workgraph/index.d.ts +1 -1
- package/dist/workgraph/index.d.ts.map +1 -1
- package/dist/workgraph/index.js +1 -1
- package/dist/workgraph/index.js.map +1 -1
- package/dist/workgraph/reparent-preflight.d.ts +1 -2
- package/dist/workgraph/reparent-preflight.d.ts.map +1 -1
- package/dist/workgraph/reparent-preflight.js +1 -1
- package/dist/workgraph/reparent-preflight.js.map +1 -1
- package/dist/workgraph/scaffold-validate.js +1 -1
- package/dist/workgraph/scaffold-validate.js.map +1 -1
- package/dist/worktree/force-unlock.d.ts +1 -1
- package/dist/worktree/force-unlock.d.ts.map +1 -1
- package/dist/worktree/force-unlock.js +1 -1
- package/dist/worktree/force-unlock.js.map +1 -1
- package/dist/worktree/isolation.d.ts +1 -1
- package/dist/worktree/isolation.d.ts.map +1 -1
- package/dist/worktree/isolation.js +1 -1
- package/dist/worktree/isolation.js.map +1 -1
- package/dist/worktree/list.d.ts +1 -1
- package/dist/worktree/list.d.ts.map +1 -1
- package/dist/worktree/list.js +1 -1
- package/dist/worktree/list.js.map +1 -1
- package/dist/worktree/prune.d.ts +1 -1
- package/dist/worktree/prune.d.ts.map +1 -1
- package/dist/worktree/prune.js +1 -1
- package/dist/worktree/prune.js.map +1 -1
- package/dist/worktree/worktree-adopt.d.ts +1 -2
- package/dist/worktree/worktree-adopt.d.ts.map +1 -1
- package/dist/worktree/worktree-adopt.js +1 -1
- package/dist/worktree/worktree-adopt.js.map +1 -1
- package/migrations/sync-journal/20261004120000_t12757-apply-intent/migration.sql +21 -0
- package/migrations/sync-journal/20261005120000_t12344-inbox/migration.sql +67 -0
- package/migrations/sync-journal/20261006120000_t13193-rebase-undo/migration.sql +51 -0
- package/migrations/sync-journal/20261006130000_t13193-rebase-state/migration.sql +17 -0
- package/migrations/sync-journal/20261006140000_t13193-held-rows/migration.sql +24 -0
- package/package.json +13 -13
- package/schemas/project-context.schema.json +14 -0
- package/templates/CLEO-INJECTION.md +11 -11
- package/templates/CLEO-REFERENCE.md +2 -2
- package/templates/workflows/release-prepare.yml.tmpl +10 -10
|
@@ -48,13 +48,19 @@
|
|
|
48
48
|
import { createHash } from 'node:crypto';
|
|
49
49
|
import { naturalRowUid } from '../row-identity.js';
|
|
50
50
|
import { BIRTH_FP_COLUMN, rowIdentitySpec, UID_COLUMN } from '../row-identity-registry.js';
|
|
51
|
-
import {
|
|
51
|
+
import { loadFrameIntents, subtractApplyIntents } from './apply-intent.js';
|
|
52
|
+
import { captureTableDef, chunkedObject, enc, SECRET_MARKER, syncSetTables, } from './capture.js';
|
|
52
53
|
import { tickClock, withImmediateTransaction } from './clock-store.js';
|
|
53
|
-
import {
|
|
54
|
+
import { actorOpOf, clearFieldLeaves, localFrontierUpdates, localLeaves, recordFieldLeaves, setFieldFrontiers, } from './field-leave.js';
|
|
55
|
+
import { isSyncFlagOn, legacyStrandRemedy, legacyStrandsCached, UNRELEASED_FLAGS, } from './flags.js';
|
|
56
|
+
import { mergeGroupsOf } from './merge/rules.js';
|
|
54
57
|
import { netTransaction } from './netting.js';
|
|
58
|
+
import { encText, remapCapture, remapPending } from './remap.js';
|
|
55
59
|
import { activeReplica } from './replica.js';
|
|
60
|
+
import { nextFhlc, upsertRowMeta } from './row-meta.js';
|
|
56
61
|
import { hasTable } from './schema.js';
|
|
57
62
|
import { canonicalJson, decodeEnc } from './sealer-values.js';
|
|
63
|
+
import { snapshotRowUndo, undoEnabled } from './sequencing.js';
|
|
58
64
|
import { markSuspect } from './structural.js';
|
|
59
65
|
import { canonicalStoreTimestamp, timestampColumns } from './timestamps.js';
|
|
60
66
|
export { sealBacklog } from './seal-backlog.js';
|
|
@@ -120,6 +126,17 @@ class TableContext {
|
|
|
120
126
|
const row = this.stmt('SELECT bfp AS f FROM _sync_row_meta WHERE tbl = ? AND uid = ?').get(table, uid);
|
|
121
127
|
return row?.f ?? undefined;
|
|
122
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* A natural row's key as row meta recorded it (refs as uids), for a repair
|
|
131
|
+
* D whose row is gone (T12987).
|
|
132
|
+
*/
|
|
133
|
+
metaKey(table, uid) {
|
|
134
|
+
const row = this.stmt('SELECT key_json AS k FROM _sync_row_meta WHERE tbl = ? AND uid = ?').get(table, uid);
|
|
135
|
+
if (!row?.k)
|
|
136
|
+
// @sync-invariant none:input-shape a repair D of a natural row without a recorded key is quarantined, never sealed
|
|
137
|
+
throw new SealInputError(`${table} ${uid}: orphaned natural row has no recorded key`);
|
|
138
|
+
return JSON.parse(row.k);
|
|
139
|
+
}
|
|
123
140
|
/** The live row's uid by its local key (the capture's `rk`). */
|
|
124
141
|
uidByKey(table, rk) {
|
|
125
142
|
const def = this.def(table);
|
|
@@ -155,6 +172,7 @@ class TableContext {
|
|
|
155
172
|
}
|
|
156
173
|
// §2.10: every op's table is in the sync set. A capture of any other table
|
|
157
174
|
// holds its group (reported), never aborts the batch (T13029).
|
|
175
|
+
// @sync-invariant none:input-shape a capture of a table outside the sync set is quarantined, never sealed
|
|
158
176
|
if (d === null)
|
|
159
177
|
throw new SealInputError(`capture for ${table}, which is not in the sync set`);
|
|
160
178
|
return d;
|
|
@@ -176,7 +194,29 @@ class TableContext {
|
|
|
176
194
|
if (key === null || typeof key === 'object')
|
|
177
195
|
return null;
|
|
178
196
|
const row = this.stmt(`SELECT ${q(UID_COLUMN)} AS u FROM ${q(table)} WHERE ${q(keyColumn)} = ?`).get(key);
|
|
179
|
-
|
|
197
|
+
if (row !== undefined)
|
|
198
|
+
return row.u ?? null;
|
|
199
|
+
return this.deletedUid(table, keyColumn, key);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The uid of a row deleted but not yet sealed, from its live D capture
|
|
203
|
+
* (T13226). An FK action fires while its parent is already gone: a child's
|
|
204
|
+
* SET NULL or cascaded D refers to the parent by local key, and only the
|
|
205
|
+
* parent's own D capture (same transaction, so same frame and batch) still
|
|
206
|
+
* knows its uid. Single-column local keys only; the latest such D wins.
|
|
207
|
+
*/
|
|
208
|
+
deletedUid(table, keyColumn, key) {
|
|
209
|
+
if (this.keyColumns(table).length !== 1 || this.keyColumns(table)[0] !== keyColumn)
|
|
210
|
+
return null;
|
|
211
|
+
const rk = JSON.stringify([typeof key === 'string' ? encText(key) : String(key)]);
|
|
212
|
+
const d = this.stmt(`SELECT uid, json_extract(img, '$.${UID_COLUMN}') AS iu FROM _sync_capture
|
|
213
|
+
WHERE state = 'live' AND tbl = ? AND op = 'D' AND rk = ? ORDER BY seq DESC LIMIT 1`).get(table, rk);
|
|
214
|
+
if (!d)
|
|
215
|
+
return null;
|
|
216
|
+
if (d.uid !== null)
|
|
217
|
+
return d.uid;
|
|
218
|
+
const v = d.iu === null ? null : decodeEnc(d.iu);
|
|
219
|
+
return typeof v === 'string' ? v : null;
|
|
180
220
|
}
|
|
181
221
|
/**
|
|
182
222
|
* The first live delete of (table, rk) after `seq`, if any (T13041). The
|
|
@@ -216,6 +256,7 @@ function columnValue(ctx, def, col, raw) {
|
|
|
216
256
|
return ref ? ctx.uidOf(ref.table, ref.key, local) : local;
|
|
217
257
|
}
|
|
218
258
|
if (typeof raw !== 'string')
|
|
259
|
+
// @sync-invariant none:input-shape a malformed capture image is quarantined, never sealed
|
|
219
260
|
throw new SealInputError(`${def.table}.${col}: unexpected image value`);
|
|
220
261
|
if (raw === SECRET_MARKER)
|
|
221
262
|
return undefined;
|
|
@@ -224,6 +265,7 @@ function columnValue(ctx, def, col, raw) {
|
|
|
224
265
|
v = decodeEnc(raw);
|
|
225
266
|
}
|
|
226
267
|
catch (err) {
|
|
268
|
+
// @sync-invariant none:input-shape an undecodable capture value is quarantined, never sealed
|
|
227
269
|
throw new SealInputError(`${def.table}.${col}: ${err.message}`);
|
|
228
270
|
}
|
|
229
271
|
return wireTimestamp(ctx.timestamps(def.table), col, v);
|
|
@@ -316,11 +358,47 @@ function resolveBirthFp(ctx, births, table, uid) {
|
|
|
316
358
|
* may stay NULL here; the netted op is checked afterwards, so a clear-and-
|
|
317
359
|
* refill pair (K x → NULL, K NULL → y) can net to one K first (N8).
|
|
318
360
|
*/
|
|
319
|
-
|
|
361
|
+
/**
|
|
362
|
+
* The uid of an I, U or D capture's row (§2.5 step 3): the capture's own,
|
|
363
|
+
* else the image's `uid`, else the live row's by local key (unless a later
|
|
364
|
+
* capture deletes that local row: the live row is then a later
|
|
365
|
+
* incarnation, T13041), else a natural row's uid from its key.
|
|
366
|
+
*/
|
|
367
|
+
function resolveCaptureUid(ctx, c, img, naturalK) {
|
|
368
|
+
const def = ctx.def(c.tbl);
|
|
369
|
+
let uid = c.uid;
|
|
370
|
+
if (uid === null && def.identity.includes(UID_COLUMN)) {
|
|
371
|
+
const raw = img[UID_COLUMN];
|
|
372
|
+
if (typeof raw === 'string')
|
|
373
|
+
uid = str(decodeEnc(raw)) ?? null;
|
|
374
|
+
}
|
|
375
|
+
if (uid === null && !ctx.laterDelete(c.tbl, c.rk, c.seq))
|
|
376
|
+
uid = ctx.uidByKey(c.tbl, c.rk);
|
|
377
|
+
// A natural row's uid is a function of its key with references as uids
|
|
378
|
+
// (T12341 §5.3), so a capture taken before the fill still seals. Symmetric
|
|
379
|
+
// edges need the fill's twin rule and wait for it (the step-0 fill, S3d).
|
|
380
|
+
if (uid === null && naturalK)
|
|
381
|
+
uid = ctx.naturalUid(c.tbl, naturalK);
|
|
382
|
+
return uid;
|
|
383
|
+
}
|
|
384
|
+
/** The uid a capture is matched to apply intents by (a K: the uid before the re-key). */
|
|
385
|
+
function intentUid(ctx, c) {
|
|
386
|
+
if (c.op === 'K')
|
|
387
|
+
return c.uid;
|
|
388
|
+
const img = JSON.parse(c.img);
|
|
389
|
+
const natural = ctx.minted(c.tbl) ? undefined : naturalKey(ctx, ctx.def(c.tbl), c.rk);
|
|
390
|
+
return resolveCaptureUid(ctx, c, img, natural);
|
|
391
|
+
}
|
|
392
|
+
function buildDraft(ctx, c, births, repair = false) {
|
|
320
393
|
const def = ctx.def(c.tbl);
|
|
321
394
|
const img = JSON.parse(c.img);
|
|
322
395
|
const minted = ctx.minted(c.tbl);
|
|
323
|
-
|
|
396
|
+
// A repair D of an orphaned meta row (§4.4, T12987) has no live row and no
|
|
397
|
+
// local key: its image is empty, and a natural row's key comes from meta.
|
|
398
|
+
const orphan = repair && c.op === 'D' && c.uid !== null && Object.keys(img).length === 0;
|
|
399
|
+
const natural = minted
|
|
400
|
+
? {}
|
|
401
|
+
: { k: orphan && c.uid !== null ? ctx.metaKey(c.tbl, c.uid) : naturalKey(ctx, def, c.rk) };
|
|
324
402
|
const base = { t: c.tbl, rk: c.rk, seq: c.seq };
|
|
325
403
|
if (c.op === 'K') {
|
|
326
404
|
const pair = (col) => {
|
|
@@ -339,23 +417,7 @@ function buildDraft(ctx, c, births) {
|
|
|
339
417
|
...natural,
|
|
340
418
|
};
|
|
341
419
|
}
|
|
342
|
-
|
|
343
|
-
if (uid === null && def.identity.includes(UID_COLUMN)) {
|
|
344
|
-
const raw = img[UID_COLUMN];
|
|
345
|
-
if (typeof raw === 'string')
|
|
346
|
-
uid = str(decodeEnc(raw)) ?? null;
|
|
347
|
-
}
|
|
348
|
-
// Resolve a missing uid from the live row by its local key (§2.5 step 3),
|
|
349
|
-
// unless a later capture deletes that local row: the live row is then a
|
|
350
|
-
// later incarnation, and this one is resolved by the netting or dropped as
|
|
351
|
-
// dead (T13041).
|
|
352
|
-
if (uid === null && !ctx.laterDelete(c.tbl, c.rk, c.seq))
|
|
353
|
-
uid = ctx.uidByKey(c.tbl, c.rk);
|
|
354
|
-
// A natural row's uid is a function of its key with references as uids
|
|
355
|
-
// (T12341 §5.3), so a capture taken before the fill still seals. Symmetric
|
|
356
|
-
// edges need the fill's twin rule and wait for it (the step-0 fill, S3d).
|
|
357
|
-
if (uid === null && !minted && natural.k)
|
|
358
|
-
uid = ctx.naturalUid(c.tbl, natural.k);
|
|
420
|
+
const uid = resolveCaptureUid(ctx, c, img, natural.k);
|
|
359
421
|
switch (c.op) {
|
|
360
422
|
case 'I': {
|
|
361
423
|
// The uid may have come from the live row (the capture predates the
|
|
@@ -374,19 +436,35 @@ function buildDraft(ctx, c, births) {
|
|
|
374
436
|
case 'U': {
|
|
375
437
|
const a = {};
|
|
376
438
|
const b = {};
|
|
439
|
+
let unknownBefore = false;
|
|
377
440
|
for (const [col, pair] of Object.entries(img)) {
|
|
378
441
|
if (ctx.refSources(def.table).has(col))
|
|
379
442
|
continue;
|
|
380
443
|
const [before, after] = pair;
|
|
381
444
|
const nv = columnValue(ctx, def, col, after);
|
|
382
|
-
const ov = columnValue(ctx, def, col, before);
|
|
383
445
|
if (nv !== undefined)
|
|
384
446
|
a[col] = nv;
|
|
447
|
+
// A JSON null before is a repair U's (§4.4, T12987): only the content
|
|
448
|
+
// hash was kept, so the before-image is unknown. No trigger writes
|
|
449
|
+
// one: a NULL value is the text 'NULL'.
|
|
450
|
+
if (before === null && repair) {
|
|
451
|
+
unknownBefore = true;
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
const ov = columnValue(ctx, def, col, before);
|
|
385
455
|
if (ov !== undefined)
|
|
386
456
|
b[col] = ov;
|
|
387
457
|
}
|
|
388
458
|
const bfp = minted ? resolveBirthFp(ctx, births, c.tbl, uid) : undefined;
|
|
389
|
-
return {
|
|
459
|
+
return {
|
|
460
|
+
...base,
|
|
461
|
+
o: 'U',
|
|
462
|
+
u: uid,
|
|
463
|
+
...(bfp ? { bfp } : {}),
|
|
464
|
+
...natural,
|
|
465
|
+
a,
|
|
466
|
+
...(unknownBefore ? { unknownBefore: true } : { b }),
|
|
467
|
+
};
|
|
390
468
|
}
|
|
391
469
|
case 'D': {
|
|
392
470
|
const bfp = str(columnValue(ctx, def, BIRTH_FP_COLUMN, img[BIRTH_FP_COLUMN] ?? 'NULL')) ??
|
|
@@ -416,6 +494,9 @@ function unsealable(ctx, op) {
|
|
|
416
494
|
}
|
|
417
495
|
return null;
|
|
418
496
|
}
|
|
497
|
+
// ---------------------------------------------------------------------------
|
|
498
|
+
// Row meta, chash, ledger
|
|
499
|
+
// ---------------------------------------------------------------------------
|
|
419
500
|
/**
|
|
420
501
|
* sha256 of a row's canonical WIRE image (§2.7, M6; T13031): the values an I
|
|
421
502
|
* op of the row would carry, so every replica hashes identical bytes. Secret
|
|
@@ -428,6 +509,21 @@ function unsealable(ctx, op) {
|
|
|
428
509
|
export function rowChash(db, scope, def, uid) {
|
|
429
510
|
return chashOf(new TableContext(db, scope), def, uid);
|
|
430
511
|
}
|
|
512
|
+
/**
|
|
513
|
+
* A {@link SealerRowView} over `db`, valid while its schema does not change.
|
|
514
|
+
*
|
|
515
|
+
* @param db - The store.
|
|
516
|
+
* @param scope - Its scope.
|
|
517
|
+
*/
|
|
518
|
+
export function sealerRowView(db, scope) {
|
|
519
|
+
const ctx = new TableContext(db, scope);
|
|
520
|
+
return {
|
|
521
|
+
chash: (def, uid) => chashOf(ctx, def, uid),
|
|
522
|
+
naturalKeyJson: (def, rk) => canonicalJson(naturalKey(ctx, def, rk)),
|
|
523
|
+
liveBirthFp: (table, uid) => ctx.liveBirthFp(table, uid),
|
|
524
|
+
naturalUid: (def, rk) => ctx.minted(def.table) ? null : ctx.naturalUid(def.table, naturalKey(ctx, def, rk)),
|
|
525
|
+
};
|
|
526
|
+
}
|
|
431
527
|
function chashOf(ctx, def, uid) {
|
|
432
528
|
const spec = rowIdentitySpec(ctx.scope, def.table);
|
|
433
529
|
const localKey = new Set(spec?.kind === 'minted' ? spec.key : []);
|
|
@@ -453,20 +549,6 @@ function chashOf(ctx, def, uid) {
|
|
|
453
549
|
}
|
|
454
550
|
return createHash('sha256').update(canonicalJson(wire)).digest('hex');
|
|
455
551
|
}
|
|
456
|
-
function nextFhlc(prev, def, changed, h) {
|
|
457
|
-
if (!prev)
|
|
458
|
-
return null;
|
|
459
|
-
const old = prev.fhlc ? JSON.parse(prev.fhlc) : {};
|
|
460
|
-
const out = {};
|
|
461
|
-
for (const col of def.columns) {
|
|
462
|
-
if (def.identity.includes(col) || changed.includes(col))
|
|
463
|
-
continue;
|
|
464
|
-
const at = old[col] ?? prev.hlc;
|
|
465
|
-
if (at < h)
|
|
466
|
-
out[col] = at;
|
|
467
|
-
}
|
|
468
|
-
return Object.keys(out).length > 0 ? canonicalJson(out) : null;
|
|
469
|
-
}
|
|
470
552
|
// ---------------------------------------------------------------------------
|
|
471
553
|
// sealPending
|
|
472
554
|
// ---------------------------------------------------------------------------
|
|
@@ -484,6 +566,13 @@ export function sealPreconditions(db, env, allowUnreleased = false) {
|
|
|
484
566
|
if (UNRELEASED_FLAGS.has('sync.seal') && !allowUnreleased) {
|
|
485
567
|
return 'sync.seal is unreleased until S3b–S3d land (T13032)';
|
|
486
568
|
}
|
|
569
|
+
// T13224, T13225: a flag persisted before the store's rows were stranded in
|
|
570
|
+
// the bare family still never seals a view missing them.
|
|
571
|
+
// Decided once per data_version, not on every batch (T13319).
|
|
572
|
+
const strands = legacyStrandsCached(db);
|
|
573
|
+
if (strands.length > 0) {
|
|
574
|
+
return `legacy-only store: ${legacyStrandRemedy(db, strands)}`;
|
|
575
|
+
}
|
|
487
576
|
return null;
|
|
488
577
|
}
|
|
489
578
|
/** Where the sealer's transaction counter is persisted (T13033). */
|
|
@@ -627,6 +716,151 @@ function waitingEffect(db, tbl, facts) {
|
|
|
627
716
|
}
|
|
628
717
|
return n;
|
|
629
718
|
}
|
|
719
|
+
/** Write one `_sync_meta` value (the sealer's own bookkeeping keys). */
|
|
720
|
+
function setSealMeta(db, key, value, atIso) {
|
|
721
|
+
db.prepare('INSERT INTO _sync_meta (key, value, updated_at) VALUES (?, ?, ?) ' +
|
|
722
|
+
'ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at').run(key, value, atIso);
|
|
723
|
+
}
|
|
724
|
+
/** Set once the sealed-but-unsent ops have been made group-whole (T13233). */
|
|
725
|
+
export const LEGACY_GROUPS_KEY = 'sealer.group_whole_v1';
|
|
726
|
+
/** The merge-group members a U image or op carries part of, and lacks. */
|
|
727
|
+
function missingGroupMembers(def, carried) {
|
|
728
|
+
return mergeGroupsOf(def.table, def.columns).flatMap((g) => g.some((m) => m in carried) ? g.filter((m) => !(m in carried)) : []);
|
|
729
|
+
}
|
|
730
|
+
/** `enc()` of SQL NULL. */
|
|
731
|
+
const ENC_NULL = 'NULL';
|
|
732
|
+
/**
|
|
733
|
+
* A column's `enc()` value at the time of capture `c`:
|
|
734
|
+
* - the before-image of the row's next live U capture that recorded it;
|
|
735
|
+
* - else, at the row's next I or D capture, its image (which omits NULL
|
|
736
|
+
* columns, so a member it does not name was NULL, T13235);
|
|
737
|
+
* - else the live row; a row that no longer exists held NULL.
|
|
738
|
+
*/
|
|
739
|
+
function encAtCapture(ctx, c, col) {
|
|
740
|
+
const later = ctx
|
|
741
|
+
.stmt("SELECT op, img FROM _sync_capture WHERE state = 'live' AND tbl = ? AND rk = ? AND seq > ? ORDER BY seq")
|
|
742
|
+
.all(c.tbl, c.rk, c.seq);
|
|
743
|
+
for (const l of later) {
|
|
744
|
+
if (l.op !== 'U' && l.op !== 'I' && l.op !== 'D')
|
|
745
|
+
continue;
|
|
746
|
+
const img = JSON.parse(l.img);
|
|
747
|
+
if (!(col in img)) {
|
|
748
|
+
if (l.op === 'U')
|
|
749
|
+
continue;
|
|
750
|
+
return ENC_NULL;
|
|
751
|
+
}
|
|
752
|
+
const raw = img[col];
|
|
753
|
+
const v = l.op === 'U' && Array.isArray(raw) ? raw[0] : raw;
|
|
754
|
+
return typeof v === 'string' ? v : ENC_NULL;
|
|
755
|
+
}
|
|
756
|
+
if (c.uid === null)
|
|
757
|
+
return ENC_NULL;
|
|
758
|
+
const row = ctx
|
|
759
|
+
.stmt(`SELECT ${enc(q(col))} AS v FROM main.${q(c.tbl)} WHERE ${q(UID_COLUMN)} = ?`)
|
|
760
|
+
.get(c.uid);
|
|
761
|
+
return typeof row?.v === 'string' ? row.v : ENC_NULL;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Complete the merge groups of U captures the pre-T13222 trigger recorded
|
|
765
|
+
* (changed columns only, T13233): each missing member is added unchanged
|
|
766
|
+
* (before = after) with its value at the capture, so the sealed op carries
|
|
767
|
+
* the whole group instead of being refused by every receiver. A capture
|
|
768
|
+
* from the current trigger always records whole groups and is untouched.
|
|
769
|
+
*/
|
|
770
|
+
function completeLegacyCaptureGroups(ctx, batch) {
|
|
771
|
+
return batch.map((c) => {
|
|
772
|
+
if (c.op !== 'U')
|
|
773
|
+
return c;
|
|
774
|
+
const img = JSON.parse(c.img);
|
|
775
|
+
if (mergeGroupsOf(c.tbl, Object.keys(img)).length === 0)
|
|
776
|
+
return c;
|
|
777
|
+
const def = ctx.def(c.tbl);
|
|
778
|
+
const missing = missingGroupMembers(def, img);
|
|
779
|
+
if (missing.length === 0)
|
|
780
|
+
return c;
|
|
781
|
+
for (const m of missing) {
|
|
782
|
+
const v = encAtCapture(ctx, c, m);
|
|
783
|
+
img[m] = [v, v];
|
|
784
|
+
}
|
|
785
|
+
return { ...c, img: JSON.stringify(img) };
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Make sealed-but-unsent U ops group-whole once (T13233): ops sealed from
|
|
790
|
+
* pre-T13222 captures carry part of a merge group. Only `state = 'sealed'`
|
|
791
|
+
* transactions are rewritten (in place, `_sync_op.body`): segmented ops have
|
|
792
|
+
* left the device and inherited ones belong to another replica. A missing
|
|
793
|
+
* member's value at the op is the before-image of the row's next sealed U
|
|
794
|
+
* that carries it, or of its next D (which omits NULL columns, so an absent
|
|
795
|
+
* member was NULL), else the live row's; a row that no longer exists held
|
|
796
|
+
* NULL. Runs once per store ({@link LEGACY_GROUPS_KEY}), set only when every
|
|
797
|
+
* op came out whole.
|
|
798
|
+
*
|
|
799
|
+
* Per-field HLCs: the completed members travel at the op's HLC, while the
|
|
800
|
+
* origin's row meta keeps their older field HLC. Group LWW decides on the
|
|
801
|
+
* group's newest HLC, so merges agree; only a per-field HLC comparison (the
|
|
802
|
+
* repair diff) can see the difference.
|
|
803
|
+
*
|
|
804
|
+
* @returns How many ops were completed.
|
|
805
|
+
*/
|
|
806
|
+
function completeLegacySealedGroups(ctx, atIso) {
|
|
807
|
+
const db = ctx.db;
|
|
808
|
+
if (db.prepare('SELECT 1 FROM _sync_meta WHERE key = ?').get(LEGACY_GROUPS_KEY))
|
|
809
|
+
return 0;
|
|
810
|
+
const rows = db
|
|
811
|
+
.prepare("SELECT o.txn, o.idx, o.body FROM _sync_op o JOIN _sync_txn t ON t.txn = o.txn WHERE t.state = 'sealed' ORDER BY t.local_seq, o.idx")
|
|
812
|
+
.all();
|
|
813
|
+
const ops = rows.map((r) => ({ ...r, op: JSON.parse(r.body) }));
|
|
814
|
+
let fixed = 0;
|
|
815
|
+
let incomplete = 0;
|
|
816
|
+
ops.forEach((r, i) => {
|
|
817
|
+
if (r.op.o !== 'U' || !r.op.a)
|
|
818
|
+
return;
|
|
819
|
+
if (mergeGroupsOf(r.op.t, Object.keys(r.op.a)).length === 0)
|
|
820
|
+
return;
|
|
821
|
+
const def = ctx.def(r.op.t);
|
|
822
|
+
const missing = missingGroupMembers(def, r.op.a);
|
|
823
|
+
if (missing.length === 0)
|
|
824
|
+
return;
|
|
825
|
+
const a = { ...r.op.a };
|
|
826
|
+
const b = { ...(r.op.b ?? {}) };
|
|
827
|
+
for (const m of missing) {
|
|
828
|
+
// The row's next sealed op that tells: a U carrying the member in `b`,
|
|
829
|
+
// or a D, whose before-image omits NULL columns (T13235).
|
|
830
|
+
const next = ops
|
|
831
|
+
.slice(i + 1)
|
|
832
|
+
.find((x) => x.op.t === r.op.t &&
|
|
833
|
+
x.op.u === r.op.u &&
|
|
834
|
+
(x.op.o === 'D' || (x.op.o === 'U' && x.op.b !== undefined && m in x.op.b)));
|
|
835
|
+
let v;
|
|
836
|
+
if (next) {
|
|
837
|
+
v = next.op.b?.[m] ?? null;
|
|
838
|
+
}
|
|
839
|
+
else {
|
|
840
|
+
const row = ctx
|
|
841
|
+
.stmt(`SELECT ${enc(q(m))} AS v FROM main.${q(r.op.t)} WHERE ${q(UID_COLUMN)} = ?`)
|
|
842
|
+
.get(r.op.u);
|
|
843
|
+
// A row that no longer exists held NULL.
|
|
844
|
+
v = typeof row?.v === 'string' ? columnValue(ctx, def, m, row.v) : null;
|
|
845
|
+
}
|
|
846
|
+
if (v === undefined) {
|
|
847
|
+
incomplete += 1; // a secret member: never sealed whole by this pass
|
|
848
|
+
continue;
|
|
849
|
+
}
|
|
850
|
+
a[m] = v;
|
|
851
|
+
b[m] = v;
|
|
852
|
+
}
|
|
853
|
+
const body = canonicalJson({ ...r.op, a, b });
|
|
854
|
+
db.prepare('UPDATE _sync_op SET body = ? WHERE txn = ? AND idx = ?').run(body, r.txn, r.idx);
|
|
855
|
+
r.op = { ...r.op, a, b };
|
|
856
|
+
fixed += 1;
|
|
857
|
+
});
|
|
858
|
+
// Marked done only when every op is whole: an op left partial is retried
|
|
859
|
+
// on the next seal, never pushed as if the pass had covered it.
|
|
860
|
+
if (incomplete === 0)
|
|
861
|
+
setSealMeta(db, LEGACY_GROUPS_KEY, String(fixed), atIso);
|
|
862
|
+
return fixed;
|
|
863
|
+
}
|
|
630
864
|
function sealInTransaction(db, opts, budget, now) {
|
|
631
865
|
const ctx = new TableContext(db, opts.scope);
|
|
632
866
|
const started = performance.now();
|
|
@@ -638,6 +872,8 @@ function sealInTransaction(db, opts, budget, now) {
|
|
|
638
872
|
let batch = db
|
|
639
873
|
.prepare(`SELECT ${CAPTURE_COLS} FROM _sync_capture WHERE state = 'live' ORDER BY seq LIMIT ?`)
|
|
640
874
|
.all(budget);
|
|
875
|
+
// T13233: ops sealed from pre-T13222 captures become group-whole, once.
|
|
876
|
+
completeLegacySealedGroups(ctx, new Date(now()).toISOString());
|
|
641
877
|
if (batch.length === 0)
|
|
642
878
|
return emptyReport(null);
|
|
643
879
|
const lastFrame = batch[batch.length - 1]?.frame ?? null;
|
|
@@ -652,6 +888,7 @@ function sealInTransaction(db, opts, budget, now) {
|
|
|
652
888
|
batch = batch.filter((c) => c.frame !== lastFrame);
|
|
653
889
|
}
|
|
654
890
|
}
|
|
891
|
+
batch = completeLegacyCaptureGroups(ctx, batch);
|
|
655
892
|
const births = batchBirths(batch);
|
|
656
893
|
// 2. Group: a validated frame is one transaction; anything else a singleton.
|
|
657
894
|
const frames = new Map();
|
|
@@ -678,12 +915,6 @@ function sealInTransaction(db, opts, budget, now) {
|
|
|
678
915
|
// 3–5. Seal each group, in order.
|
|
679
916
|
const meta = {
|
|
680
917
|
get: db.prepare('SELECT hlc, fhlc, version, deleted, key_json, chash, bfp FROM _sync_row_meta WHERE tbl = ? AND uid = ?'),
|
|
681
|
-
upsert: db.prepare(`INSERT INTO _sync_row_meta (tbl, uid, hlc, fhlc, origin, actor, version, deleted, key_json, chash, bfp)
|
|
682
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
683
|
-
ON CONFLICT (tbl, uid) DO UPDATE SET hlc = excluded.hlc, fhlc = excluded.fhlc,
|
|
684
|
-
origin = excluded.origin, actor = excluded.actor, version = excluded.version,
|
|
685
|
-
deleted = excluded.deleted, key_json = coalesce(excluded.key_json, key_json),
|
|
686
|
-
chash = excluded.chash, bfp = coalesce(excluded.bfp, bfp)`),
|
|
687
918
|
remove: db.prepare('DELETE FROM _sync_row_meta WHERE tbl = ? AND uid = ?'),
|
|
688
919
|
// A re-key moves the row's meta and keeps hlc, fhlc, version and chash
|
|
689
920
|
// (§2.5 step 5, T13031); only the key and birth_fp follow the new uid.
|
|
@@ -707,6 +938,10 @@ function sealInTransaction(db, opts, budget, now) {
|
|
|
707
938
|
const pending = [];
|
|
708
939
|
const touched = new Map();
|
|
709
940
|
const ledgerDelta = new Map();
|
|
941
|
+
const leaveTable = hasTable(db, '_sync_field_leave');
|
|
942
|
+
// §3.5 Rule 2 (T13193): while undo is on, each sealed op snapshots its
|
|
943
|
+
// row's prior merge state, so a rebase rewind restores HLCs with values.
|
|
944
|
+
const rowUndo = hasTable(db, '_sync_row_undo') && undoEnabled(db);
|
|
710
945
|
const metaFacts = {
|
|
711
946
|
sent: (t, u) => meta.flags.get(t, u)?.sent === 1,
|
|
712
947
|
live: (t, u) => meta.flags.get(t, u)?.deleted === 0,
|
|
@@ -720,7 +955,7 @@ function sealInTransaction(db, opts, budget, now) {
|
|
|
720
955
|
const pointedAt = new Map();
|
|
721
956
|
let dropped = 0;
|
|
722
957
|
const quarantined = [];
|
|
723
|
-
for (const g of groups) {
|
|
958
|
+
for (const [gi, g] of groups.entries()) {
|
|
724
959
|
// Bound the time this transaction holds the write lock (T13032).
|
|
725
960
|
if (txns > 0 && performance.now() - started > maxMs)
|
|
726
961
|
break;
|
|
@@ -737,24 +972,44 @@ function sealInTransaction(db, opts, budget, now) {
|
|
|
737
972
|
dead.add(c.seq);
|
|
738
973
|
consumed.add(c.seq);
|
|
739
974
|
}
|
|
740
|
-
|
|
975
|
+
let captures = g.captures
|
|
741
976
|
.filter((c) => !dead.has(c.seq))
|
|
742
977
|
.map((c) => (pointedAt.has(c.seq) ? { ...c, uid: pointedAt.get(c.seq) ?? null } : c));
|
|
743
978
|
if (captures.length === 0)
|
|
744
979
|
continue;
|
|
745
980
|
const head = captures[0]?.seq ?? 0;
|
|
746
|
-
if (g.frame !== null &&
|
|
747
|
-
//
|
|
748
|
-
//
|
|
749
|
-
pending.push({ firstSeq: head, reason:
|
|
981
|
+
if (g.frame !== null && g.kind === 'rebase') {
|
|
982
|
+
// A rebase frame replays rewound local ops (§3.5); it seals with S5's
|
|
983
|
+
// scoped rebase (T13037).
|
|
984
|
+
pending.push({ firstSeq: head, reason: 'rebase frames wait for the S5 scoped rebase' });
|
|
750
985
|
break;
|
|
751
986
|
}
|
|
987
|
+
if (g.frame !== null && g.kind === 'apply') {
|
|
988
|
+
// §3.3 (T12757): subtract what the apply wrote; only residual fields
|
|
989
|
+
// seal, as local writes. A removed capture is consumed: the applied row
|
|
990
|
+
// exists, so the ledger counts it and its chash is refreshed.
|
|
991
|
+
const sub = subtractApplyIntents(captures, loadFrameIntents(db, g.frame), (c) => intentUid(ctx, c));
|
|
992
|
+
for (const c of sub.removed) {
|
|
993
|
+
consumed.add(c.seq);
|
|
994
|
+
const uid = intentUid(ctx, c);
|
|
995
|
+
if (c.op === 'I')
|
|
996
|
+
ledgerDelta.set(c.tbl, (ledgerDelta.get(c.tbl) ?? 0) + 1);
|
|
997
|
+
if (c.op === 'D')
|
|
998
|
+
ledgerDelta.set(c.tbl, (ledgerDelta.get(c.tbl) ?? 0) - 1);
|
|
999
|
+
if (uid !== null && (c.op === 'I' || c.op === 'U')) {
|
|
1000
|
+
touched.set(rowKey(c.tbl, uid), { tbl: c.tbl, uid, rk: c.rk });
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
captures = sub.residual;
|
|
1004
|
+
if (captures.length === 0)
|
|
1005
|
+
continue;
|
|
1006
|
+
}
|
|
752
1007
|
const capOf = new Map(captures.map((c) => [c.seq, c]));
|
|
753
1008
|
let drafts = [];
|
|
754
1009
|
let partial = false;
|
|
755
1010
|
for (const c of captures) {
|
|
756
1011
|
try {
|
|
757
|
-
drafts.push(buildDraft(ctx, c, births));
|
|
1012
|
+
drafts.push(buildDraft(ctx, c, births, g.kind === 'repair'));
|
|
758
1013
|
}
|
|
759
1014
|
catch (err) {
|
|
760
1015
|
if (!(err instanceof SealInputError))
|
|
@@ -797,15 +1052,46 @@ function sealInTransaction(db, opts, budget, now) {
|
|
|
797
1052
|
meta.remove.run(r.t, r.to);
|
|
798
1053
|
meta.move.run(r.to, null, null, r.t, r.from);
|
|
799
1054
|
}
|
|
1055
|
+
// §3.3 G (T12779): the stream never learns a dropped re-key's old uid, so
|
|
1056
|
+
// every reference to it that is still pending moves to the new uid: the
|
|
1057
|
+
// other ops of this transaction, the captures still waiting (in this
|
|
1058
|
+
// batch and in the store), and sealed ops not yet in a segment.
|
|
1059
|
+
let txnOps = netted.ops;
|
|
1060
|
+
if (netted.renames.length > 0) {
|
|
1061
|
+
const renamed = new Map(netted.renames.map((r) => [r.from, r.to]));
|
|
1062
|
+
const swap = (vals) => {
|
|
1063
|
+
const out = {};
|
|
1064
|
+
for (const [col, v] of Object.entries(vals)) {
|
|
1065
|
+
const to = typeof v === 'string' ? renamed.get(v) : undefined;
|
|
1066
|
+
out[col] = to !== undefined ? to : v;
|
|
1067
|
+
}
|
|
1068
|
+
return out;
|
|
1069
|
+
};
|
|
1070
|
+
txnOps = txnOps.map((op) => ({
|
|
1071
|
+
...op,
|
|
1072
|
+
...(op.a !== undefined ? { a: swap(op.a) } : {}),
|
|
1073
|
+
...(op.b !== undefined ? { b: swap(op.b) } : {}),
|
|
1074
|
+
...(op.k !== undefined ? { k: swap(op.k) } : {}),
|
|
1075
|
+
}));
|
|
1076
|
+
for (const r of netted.renames) {
|
|
1077
|
+
const remap = { table: r.t, oldUid: r.from, newUid: r.to, newBfp: null };
|
|
1078
|
+
remapPending(db, remap);
|
|
1079
|
+
for (const later of groups.slice(gi + 1)) {
|
|
1080
|
+
later.captures.forEach((c, i) => {
|
|
1081
|
+
later.captures[i] = remapCapture(c, remap);
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
800
1086
|
for (const c of captures)
|
|
801
1087
|
consumed.add(c.seq);
|
|
802
|
-
if (
|
|
1088
|
+
if (txnOps.length === 0)
|
|
803
1089
|
continue; // everything netted away
|
|
804
1090
|
localSeq += 1;
|
|
805
1091
|
const txn = `${replica}:${localSeq}`;
|
|
806
1092
|
// An op's time and local key are its LAST capture's (T13037).
|
|
807
1093
|
const at = (op) => capOf.get(op.last) ?? capOf.get(op.seq);
|
|
808
|
-
const sealedOps =
|
|
1094
|
+
const sealedOps = txnOps.map((op) => {
|
|
809
1095
|
const { seq, last, ...rest } = op;
|
|
810
1096
|
return {
|
|
811
1097
|
...rest,
|
|
@@ -816,12 +1102,14 @@ function sealInTransaction(db, opts, budget, now) {
|
|
|
816
1102
|
});
|
|
817
1103
|
const txnHlc = sealedOps.reduce((m, o) => (o.h > m ? o.h : m), sealedOps[0]?.h ?? '');
|
|
818
1104
|
const kind = g.frame !== null && TXN_KINDS.has(g.kind) ? g.kind : 'write';
|
|
819
|
-
insTxn.run(txn, localSeq, replica, txnHlc, opts.scope, g.frame === null ? 'foreign' : 'accessor', kind, g.actor, g.frame, g.frame === null ? 1 : 0, partial ? 1 : 0, sealedOps.length, now());
|
|
1105
|
+
insTxn.run(txn, localSeq, replica, txnHlc, opts.scope, g.frame === null ? 'foreign' : g.kind === 'repair' ? 'repair' : 'accessor', kind, g.actor, g.frame, g.frame === null ? 1 : 0, partial ? 1 : 0, sealedOps.length, now());
|
|
820
1106
|
sealedOps.forEach(({ seq, last, ...op }, i) => {
|
|
821
1107
|
const rk = at({ seq, last })?.rk ?? '';
|
|
822
1108
|
insOp.run(txn, i, op.t, op.u, op.o, op.h, canonicalJson(op));
|
|
823
1109
|
const def = ctx.def(op.t);
|
|
824
1110
|
const prev = meta.get.get(op.t, op.u);
|
|
1111
|
+
if (rowUndo)
|
|
1112
|
+
snapshotRowUndo(db, txn, i, op.t, op.u);
|
|
825
1113
|
const keyJson = op.k ? canonicalJson(op.k) : null;
|
|
826
1114
|
if (op.o === 'K' && op.nu !== undefined) {
|
|
827
1115
|
// A K that keeps its uid changes only birth_fp: its meta stays put.
|
|
@@ -831,7 +1119,19 @@ function sealInTransaction(db, opts, budget, now) {
|
|
|
831
1119
|
meta.move.run(op.nu, keyJson, op.bfp ?? null, op.t, op.u);
|
|
832
1120
|
}
|
|
833
1121
|
else {
|
|
834
|
-
|
|
1122
|
+
upsertRowMeta(db, {
|
|
1123
|
+
tbl: op.t,
|
|
1124
|
+
uid: op.nu,
|
|
1125
|
+
hlc: op.h,
|
|
1126
|
+
fhlc: null,
|
|
1127
|
+
origin: replica,
|
|
1128
|
+
actor: g.actor,
|
|
1129
|
+
version: 1,
|
|
1130
|
+
deleted: false,
|
|
1131
|
+
keyJson,
|
|
1132
|
+
chash: null,
|
|
1133
|
+
bfp: op.bfp ?? null,
|
|
1134
|
+
});
|
|
835
1135
|
}
|
|
836
1136
|
touched.delete(rowKey(op.t, op.u));
|
|
837
1137
|
touched.set(rowKey(op.t, op.nu), { tbl: op.t, uid: op.nu, rk });
|
|
@@ -847,7 +1147,28 @@ function sealInTransaction(db, opts, budget, now) {
|
|
|
847
1147
|
}
|
|
848
1148
|
const changed = op.o === 'U' ? Object.keys(op.a ?? {}) : [];
|
|
849
1149
|
const fhlc = op.o === 'U' ? nextFhlc(prev, def, changed, op.h) : null;
|
|
850
|
-
|
|
1150
|
+
upsertRowMeta(db, {
|
|
1151
|
+
tbl: op.t,
|
|
1152
|
+
uid: op.u,
|
|
1153
|
+
hlc: op.h,
|
|
1154
|
+
fhlc,
|
|
1155
|
+
origin: replica,
|
|
1156
|
+
actor: g.actor,
|
|
1157
|
+
version: (prev?.version ?? 0) + 1,
|
|
1158
|
+
deleted: op.o === 'D',
|
|
1159
|
+
keyJson,
|
|
1160
|
+
chash: op.o === 'D' ? (prev?.chash ?? null) : null,
|
|
1161
|
+
bfp: op.bfp ?? null,
|
|
1162
|
+
});
|
|
1163
|
+
// Explicit leaves of absorbing states, which the merge reads (T12344).
|
|
1164
|
+
if (leaveTable && op.o === 'U') {
|
|
1165
|
+
const leaves = localLeaves(op.t, op, actorOpOf(g.actor));
|
|
1166
|
+
recordFieldLeaves(db, op.t, op.u, leaves);
|
|
1167
|
+
// A local rank-max write joins the stored frontier (T13232).
|
|
1168
|
+
setFieldFrontiers(db, op.t, op.u, localFrontierUpdates(db, op.t, op.u, op, leaves));
|
|
1169
|
+
}
|
|
1170
|
+
if (leaveTable && op.o === 'D')
|
|
1171
|
+
clearFieldLeaves(db, op.t, op.u);
|
|
851
1172
|
if (op.o === 'I')
|
|
852
1173
|
ledgerDelta.set(op.t, (ledgerDelta.get(op.t) ?? 0) + 1);
|
|
853
1174
|
if (op.o === 'D')
|
|
@@ -863,14 +1184,17 @@ function sealInTransaction(db, opts, budget, now) {
|
|
|
863
1184
|
unframed += 1;
|
|
864
1185
|
}
|
|
865
1186
|
if (localSeq !== firstSeq) {
|
|
866
|
-
db
|
|
867
|
-
'ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at').run(SEAL_COUNTER_KEY, String(localSeq), new Date(now()).toISOString());
|
|
1187
|
+
setSealMeta(db, SEAL_COUNTER_KEY, String(localSeq), new Date(now()).toISOString());
|
|
868
1188
|
}
|
|
869
1189
|
// Consume the sealed captures (and frames nothing references any more).
|
|
870
1190
|
const del = db.prepare('DELETE FROM _sync_capture WHERE seq = ?');
|
|
871
1191
|
for (const seq of consumed)
|
|
872
1192
|
del.run(seq);
|
|
873
1193
|
db.exec("DELETE FROM _sync_frame WHERE NOT EXISTS (SELECT 1 FROM _sync_capture c WHERE c.frame = _sync_frame.frame AND c.state = 'live')");
|
|
1194
|
+
// A frame's apply intents go with it (§3.3, T12757).
|
|
1195
|
+
if (hasTable(db, '_sync_apply_intent')) {
|
|
1196
|
+
db.exec('DELETE FROM _sync_apply_intent WHERE NOT EXISTS (SELECT 1 FROM _sync_frame f WHERE f.frame = _sync_apply_intent.frame)');
|
|
1197
|
+
}
|
|
874
1198
|
// chash from the live row, once no live capture of that row remains.
|
|
875
1199
|
const stillLive = db.prepare("SELECT 1 FROM _sync_capture WHERE tbl = ? AND rk = ? AND state = 'live' LIMIT 1");
|
|
876
1200
|
const setChash = db.prepare('UPDATE _sync_row_meta SET chash = ? WHERE tbl = ? AND uid = ?');
|
|
@@ -903,4 +1227,154 @@ function sealInTransaction(db, opts, budget, now) {
|
|
|
903
1227
|
refused: null,
|
|
904
1228
|
};
|
|
905
1229
|
}
|
|
1230
|
+
/** `_sync_meta` key of the sync-set version the row-meta `chash` baseline matches (§2.3a rule 3). */
|
|
1231
|
+
export const CHASH_BASELINE_KEY = 'sync.set_version';
|
|
1232
|
+
/**
|
|
1233
|
+
* The sync set's version: a hash of every sync-set table's captured columns,
|
|
1234
|
+
* secret columns and references as this store's schema has them (§2.3a,
|
|
1235
|
+
* §2.9). A migration that changes what is captured changes it.
|
|
1236
|
+
*
|
|
1237
|
+
* @param db - The store.
|
|
1238
|
+
* @param scope - Its scope.
|
|
1239
|
+
*/
|
|
1240
|
+
export function syncSetVersion(db, scope) {
|
|
1241
|
+
const shape = syncSetTables(scope)
|
|
1242
|
+
.sort()
|
|
1243
|
+
.map((table) => {
|
|
1244
|
+
const def = hasTable(db, table) ? captureTableDef(db, scope, table) : undefined;
|
|
1245
|
+
if (!def)
|
|
1246
|
+
return [table, null];
|
|
1247
|
+
return [
|
|
1248
|
+
table,
|
|
1249
|
+
{
|
|
1250
|
+
columns: [...def.columns],
|
|
1251
|
+
secret: [...def.secret].sort(),
|
|
1252
|
+
refs: [...def.refs].map(([col, r]) => [col, r.table, r.key]).sort(),
|
|
1253
|
+
},
|
|
1254
|
+
];
|
|
1255
|
+
});
|
|
1256
|
+
return createHash('sha256').update(canonicalJson(shape)).digest('hex').slice(0, 32);
|
|
1257
|
+
}
|
|
1258
|
+
const metaKey = (tbl, uid) => `${tbl}\u0000${uid}`;
|
|
1259
|
+
function totalChanges(db) {
|
|
1260
|
+
return db.prepare('SELECT total_changes() AS n').get().n;
|
|
1261
|
+
}
|
|
1262
|
+
function suspectTables(db) {
|
|
1263
|
+
return new Set(db.prepare("SELECT key FROM _sync_meta WHERE key LIKE 'suspect:%'").all().map((r) => r.key.slice('suspect:'.length)));
|
|
1264
|
+
}
|
|
1265
|
+
/**
|
|
1266
|
+
* Before a migration pass: which live rows are in baseline (`chash` equals the
|
|
1267
|
+
* live hash under the current schema), and which tables already diverge. Only
|
|
1268
|
+
* in-baseline rows may be re-baselined afterwards; a divergence is an
|
|
1269
|
+
* uncaptured edit the repair diff (S3d) must still see (§2.3a rule 3,
|
|
1270
|
+
* NEW-8).
|
|
1271
|
+
*
|
|
1272
|
+
* @param db - The store, before its first pending migration.
|
|
1273
|
+
* @param scope - Its scope.
|
|
1274
|
+
*/
|
|
1275
|
+
export function chashBaselineSnapshot(db, scope) {
|
|
1276
|
+
const version = syncSetVersion(db, scope);
|
|
1277
|
+
if (!hasTable(db, '_sync_row_meta') || !hasTable(db, '_sync_meta')) {
|
|
1278
|
+
return {
|
|
1279
|
+
inBaseline: new Set(),
|
|
1280
|
+
divergent: new Set(),
|
|
1281
|
+
suspect: new Set(),
|
|
1282
|
+
changes: totalChanges(db),
|
|
1283
|
+
version,
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
const ctx = new TableContext(db, scope);
|
|
1287
|
+
const syncSet = new Set(syncSetTables(scope).filter((t) => hasTable(db, t)));
|
|
1288
|
+
const inBaseline = new Set();
|
|
1289
|
+
const divergent = new Set();
|
|
1290
|
+
// A row with a live capture differs because of a captured edit the sealer
|
|
1291
|
+
// will hash: neither in baseline nor an uncaptured divergence.
|
|
1292
|
+
const liveCapture = hasTable(db, '_sync_capture')
|
|
1293
|
+
? db.prepare("SELECT 1 FROM _sync_capture WHERE state = 'live' AND tbl = ? AND uid = ? LIMIT 1")
|
|
1294
|
+
: null;
|
|
1295
|
+
for (const m of db
|
|
1296
|
+
.prepare('SELECT tbl, uid, chash FROM _sync_row_meta WHERE deleted = 0')
|
|
1297
|
+
.all()) {
|
|
1298
|
+
if (!syncSet.has(m.tbl))
|
|
1299
|
+
continue;
|
|
1300
|
+
if (liveCapture?.get(m.tbl, m.uid))
|
|
1301
|
+
continue;
|
|
1302
|
+
const def = captureTableDef(db, scope, m.tbl);
|
|
1303
|
+
if (!def)
|
|
1304
|
+
continue;
|
|
1305
|
+
if (chashOf(ctx, def, m.uid) === m.chash)
|
|
1306
|
+
inBaseline.add(metaKey(m.tbl, m.uid));
|
|
1307
|
+
else
|
|
1308
|
+
divergent.add(m.tbl);
|
|
1309
|
+
}
|
|
1310
|
+
return { inBaseline, divergent, suspect: suspectTables(db), changes: totalChanges(db), version };
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Re-baseline `_sync_row_meta.chash` after a migration, emitting nothing
|
|
1314
|
+
* (§2.3a rule 3; B, T12775). A migration's backfill is deterministic and
|
|
1315
|
+
* every replica runs it itself, so its changes must not travel; but the row
|
|
1316
|
+
* meta's content hash would otherwise make the repair diff read every migrated
|
|
1317
|
+
* row as an uncaptured edit.
|
|
1318
|
+
*
|
|
1319
|
+
* Only rows that were in baseline before the pass ({@link ChashSnapshot}) move
|
|
1320
|
+
* to the live hash. A row that already diverged keeps its `chash`, and its
|
|
1321
|
+
* table is marked `suspect:` so the repair diff still emits the edit. A table
|
|
1322
|
+
* already suspect, and a row with a live capture (the sealer will hash it),
|
|
1323
|
+
* are left alone. Live rows only: a tombstone keeps the hash it was deleted
|
|
1324
|
+
* with. When the migration changed no row and the sync-set version did not
|
|
1325
|
+
* move, nothing is re-hashed. Records {@link CHASH_BASELINE_KEY}.
|
|
1326
|
+
*
|
|
1327
|
+
* Runs in the caller's transaction when there is one: the migration bracket
|
|
1328
|
+
* calls it before its COMMIT, so a migration and its re-baseline commit or
|
|
1329
|
+
* roll back together. Otherwise it opens its own `BEGIN IMMEDIATE`.
|
|
1330
|
+
*
|
|
1331
|
+
* @param db - The store.
|
|
1332
|
+
* @param scope - Its scope.
|
|
1333
|
+
* @param snapshot - From {@link chashBaselineSnapshot} before the pass, or the
|
|
1334
|
+
* previous re-baseline's `snapshot`.
|
|
1335
|
+
*/
|
|
1336
|
+
export function rebaselineChash(db, scope, snapshot) {
|
|
1337
|
+
const version = syncSetVersion(db, scope);
|
|
1338
|
+
const changes = totalChanges(db);
|
|
1339
|
+
const unchanged = changes === snapshot.changes && version === snapshot.version;
|
|
1340
|
+
if (unchanged || !hasTable(db, '_sync_row_meta') || !hasTable(db, '_sync_meta')) {
|
|
1341
|
+
return { rows: 0, version, snapshot: { ...snapshot, changes, version } };
|
|
1342
|
+
}
|
|
1343
|
+
// Inside the migration's own transaction (the bracket calls it before
|
|
1344
|
+
// COMMIT), so a migration and its re-baseline commit or roll back together.
|
|
1345
|
+
const inTxn = db.isTransaction;
|
|
1346
|
+
const run = (fn) => (inTxn ? fn() : withImmediateTransaction(db, fn));
|
|
1347
|
+
return run(() => {
|
|
1348
|
+
const ctx = new TableContext(db, scope);
|
|
1349
|
+
const skip = new Set([...snapshot.suspect, ...suspectTables(db)]);
|
|
1350
|
+
markSuspect(db, scope, [...snapshot.divergent].filter((t) => !skip.has(t)));
|
|
1351
|
+
const liveCapture = hasTable(db, '_sync_capture')
|
|
1352
|
+
? db.prepare("SELECT 1 FROM _sync_capture WHERE state = 'live' AND tbl = ? AND uid = ? LIMIT 1")
|
|
1353
|
+
: null;
|
|
1354
|
+
const setChash = db.prepare('UPDATE _sync_row_meta SET chash = ? WHERE tbl = ? AND uid = ?');
|
|
1355
|
+
let rows = 0;
|
|
1356
|
+
for (const m of db
|
|
1357
|
+
.prepare('SELECT tbl, uid, chash FROM _sync_row_meta WHERE deleted = 0')
|
|
1358
|
+
.all()) {
|
|
1359
|
+
if (!snapshot.inBaseline.has(metaKey(m.tbl, m.uid)) || skip.has(m.tbl))
|
|
1360
|
+
continue;
|
|
1361
|
+
if (liveCapture?.get(m.tbl, m.uid))
|
|
1362
|
+
continue;
|
|
1363
|
+
const def = captureTableDef(db, scope, m.tbl);
|
|
1364
|
+
if (!def)
|
|
1365
|
+
continue;
|
|
1366
|
+
const next = chashOf(ctx, def, m.uid);
|
|
1367
|
+
if (next === m.chash)
|
|
1368
|
+
continue;
|
|
1369
|
+
setChash.run(next, m.tbl, m.uid);
|
|
1370
|
+
rows += 1;
|
|
1371
|
+
}
|
|
1372
|
+
setSealMeta(db, CHASH_BASELINE_KEY, version, new Date().toISOString());
|
|
1373
|
+
return {
|
|
1374
|
+
rows,
|
|
1375
|
+
version,
|
|
1376
|
+
snapshot: { ...snapshot, suspect: suspectTables(db), changes: totalChanges(db), version },
|
|
1377
|
+
};
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
906
1380
|
//# sourceMappingURL=sealer.js.map
|