@cleocode/core 2026.6.12 → 2026.6.13
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/conduit/local-transport.d.ts +12 -0
- package/dist/conduit/local-transport.d.ts.map +1 -1
- package/dist/conduit/local-transport.js +53 -23
- package/dist/conduit/local-transport.js.map +1 -1
- package/dist/crypto/credentials.d.ts +37 -0
- package/dist/crypto/credentials.d.ts.map +1 -1
- package/dist/crypto/credentials.js +110 -0
- package/dist/crypto/credentials.js.map +1 -1
- package/dist/dispatch/contracts/derive-output-contract.d.ts +86 -0
- package/dist/dispatch/contracts/derive-output-contract.d.ts.map +1 -0
- package/dist/dispatch/contracts/derive-output-contract.js +347 -0
- package/dist/dispatch/contracts/derive-output-contract.js.map +1 -0
- package/dist/dispatch/contracts/ensures-schema.d.ts +77 -0
- package/dist/dispatch/contracts/ensures-schema.d.ts.map +1 -0
- package/dist/dispatch/contracts/ensures-schema.js +91 -0
- package/dist/dispatch/contracts/ensures-schema.js.map +1 -0
- package/dist/dispatch/contracts/output-contracts.d.ts +27 -5
- package/dist/dispatch/contracts/output-contracts.d.ts.map +1 -1
- package/dist/dispatch/contracts/output-contracts.js +29 -6
- package/dist/dispatch/contracts/output-contracts.js.map +1 -1
- package/dist/docs/export-document.js +2294 -1250
- package/dist/docs/export-document.js.map +3 -3
- package/dist/go/driver.d.ts +132 -7
- package/dist/go/driver.d.ts.map +1 -1
- package/dist/go/driver.js +135 -10
- package/dist/go/driver.js.map +1 -1
- package/dist/go/index.d.ts +1 -1
- package/dist/go/index.d.ts.map +1 -1
- package/dist/go/index.js +1 -1
- package/dist/go/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +13 -10
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +11 -11
- package/dist/internal.js.map +1 -1
- package/dist/lifecycle/engine-ops.d.ts.map +1 -1
- package/dist/lifecycle/engine-ops.js +7 -4
- package/dist/lifecycle/engine-ops.js.map +1 -1
- package/dist/lifecycle/ivtr-loop.d.ts +108 -183
- package/dist/lifecycle/ivtr-loop.d.ts.map +1 -1
- package/dist/lifecycle/ivtr-loop.js +207 -522
- package/dist/lifecycle/ivtr-loop.js.map +1 -1
- package/dist/llm/auxiliary-fallback.js +1 -1
- package/dist/llm/auxiliary-fallback.js.map +1 -1
- package/dist/llm/cli-ops.d.ts +14 -1
- package/dist/llm/cli-ops.d.ts.map +1 -1
- package/dist/llm/cli-ops.js +41 -12
- package/dist/llm/cli-ops.js.map +1 -1
- package/dist/llm/concrete-session.d.ts.map +1 -1
- package/dist/llm/concrete-session.js +4 -0
- package/dist/llm/concrete-session.js.map +1 -1
- package/dist/llm/credentials.d.ts +35 -0
- package/dist/llm/credentials.d.ts.map +1 -1
- package/dist/llm/credentials.js +49 -0
- package/dist/llm/credentials.js.map +1 -1
- package/dist/llm/index.d.ts +4 -0
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +4 -0
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/pi/gondolin-loader.d.ts +241 -0
- package/dist/llm/pi/gondolin-loader.d.ts.map +1 -0
- package/dist/llm/pi/gondolin-loader.js +195 -0
- package/dist/llm/pi/gondolin-loader.js.map +1 -0
- package/dist/llm/pi/index.d.ts +28 -0
- package/dist/llm/pi/index.d.ts.map +1 -0
- package/dist/llm/pi/index.js +27 -0
- package/dist/llm/pi/index.js.map +1 -0
- package/dist/llm/pi/pi-agent-adapter.d.ts +135 -0
- package/dist/llm/pi/pi-agent-adapter.d.ts.map +1 -0
- package/dist/llm/pi/pi-agent-adapter.js +329 -0
- package/dist/llm/pi/pi-agent-adapter.js.map +1 -0
- package/dist/llm/pi/pi-errors.d.ts +161 -0
- package/dist/llm/pi/pi-errors.d.ts.map +1 -0
- package/dist/llm/pi/pi-errors.js +296 -0
- package/dist/llm/pi/pi-errors.js.map +1 -0
- package/dist/llm/pi/pi-execution-env.d.ts +286 -0
- package/dist/llm/pi/pi-execution-env.d.ts.map +1 -0
- package/dist/llm/pi/pi-execution-env.js +406 -0
- package/dist/llm/pi/pi-execution-env.js.map +1 -0
- package/dist/llm/pi/pi-gondolin-env.d.ts +227 -0
- package/dist/llm/pi/pi-gondolin-env.d.ts.map +1 -0
- package/dist/llm/pi/pi-gondolin-env.js +541 -0
- package/dist/llm/pi/pi-gondolin-env.js.map +1 -0
- package/dist/llm/pi/pi-session-storage.d.ts +154 -0
- package/dist/llm/pi/pi-session-storage.d.ts.map +1 -0
- package/dist/llm/pi/pi-session-storage.js +314 -0
- package/dist/llm/pi/pi-session-storage.js.map +1 -0
- package/dist/llm/pi/pi-stream-fn.d.ts +124 -0
- package/dist/llm/pi/pi-stream-fn.d.ts.map +1 -0
- package/dist/llm/pi/pi-stream-fn.js +504 -0
- package/dist/llm/pi/pi-stream-fn.js.map +1 -0
- package/dist/llm/pi/pi-tool-bridge.d.ts +99 -0
- package/dist/llm/pi/pi-tool-bridge.d.ts.map +1 -0
- package/dist/llm/pi/pi-tool-bridge.js +117 -0
- package/dist/llm/pi/pi-tool-bridge.js.map +1 -0
- package/dist/llm/pi/pi-types.d.ts +56 -0
- package/dist/llm/pi/pi-types.d.ts.map +1 -0
- package/dist/llm/pi/pi-types.js +16 -0
- package/dist/llm/pi/pi-types.js.map +1 -0
- package/dist/llm/pi/resolve-execution-env.d.ts +194 -0
- package/dist/llm/pi/resolve-execution-env.d.ts.map +1 -0
- package/dist/llm/pi/resolve-execution-env.js +132 -0
- package/dist/llm/pi/resolve-execution-env.js.map +1 -0
- package/dist/llm/plugin-facade.js +2253 -1151
- package/dist/llm/plugin-facade.js.map +3 -3
- package/dist/llm/role-executor.d.ts.map +1 -1
- package/dist/llm/role-executor.js +8 -5
- package/dist/llm/role-executor.js.map +1 -1
- package/dist/llm/role-resolver.d.ts +46 -14
- package/dist/llm/role-resolver.d.ts.map +1 -1
- package/dist/llm/role-resolver.js +178 -20
- package/dist/llm/role-resolver.js.map +1 -1
- package/dist/llm/sealed-credential.d.ts +125 -0
- package/dist/llm/sealed-credential.d.ts.map +1 -0
- package/dist/llm/sealed-credential.js +133 -0
- package/dist/llm/sealed-credential.js.map +1 -0
- package/dist/llm/session-factory.d.ts.map +1 -1
- package/dist/llm/session-factory.js +6 -2
- package/dist/llm/session-factory.js.map +1 -1
- package/dist/llm/system-key.d.ts +67 -0
- package/dist/llm/system-key.d.ts.map +1 -0
- package/dist/llm/system-key.js +87 -0
- package/dist/llm/system-key.js.map +1 -0
- package/dist/llm/system-of-use-registry.d.ts +119 -0
- package/dist/llm/system-of-use-registry.d.ts.map +1 -0
- package/dist/llm/system-of-use-registry.js +200 -0
- package/dist/llm/system-of-use-registry.js.map +1 -0
- package/dist/llm/system-resolver.d.ts +32 -10
- package/dist/llm/system-resolver.d.ts.map +1 -1
- package/dist/llm/system-resolver.js +70 -18
- package/dist/llm/system-resolver.js.map +1 -1
- package/dist/memory/brain-writer-thread.d.ts.map +1 -1
- package/dist/memory/brain-writer-thread.js +116 -11
- package/dist/memory/brain-writer-thread.js.map +1 -1
- package/dist/memory/claude-mem-migration.d.ts.map +1 -1
- package/dist/memory/claude-mem-migration.js +21 -0
- package/dist/memory/claude-mem-migration.js.map +1 -1
- package/dist/memory/graph-memory-bridge.d.ts.map +1 -1
- package/dist/memory/graph-memory-bridge.js +32 -25
- package/dist/memory/graph-memory-bridge.js.map +1 -1
- package/dist/memory/llm-backend-resolver.js +23 -5
- package/dist/memory/llm-backend-resolver.js.map +1 -1
- package/dist/nexus/migrations/M-split-graph.d.ts.map +1 -1
- package/dist/nexus/migrations/M-split-graph.js +60 -53
- package/dist/nexus/migrations/M-split-graph.js.map +1 -1
- package/dist/orchestrate/pivot.d.ts.map +1 -1
- package/dist/orchestrate/pivot.js +20 -2
- package/dist/orchestrate/pivot.js.map +1 -1
- package/dist/release/engine-ops.js +2 -2
- package/dist/release/engine-ops.js.map +1 -1
- package/dist/routing/capability-matrix.d.ts.map +1 -1
- package/dist/routing/capability-matrix.js +0 -57
- package/dist/routing/capability-matrix.js.map +1 -1
- package/dist/selfimprove/budget.d.ts +206 -0
- package/dist/selfimprove/budget.d.ts.map +1 -0
- package/dist/selfimprove/budget.js +203 -0
- package/dist/selfimprove/budget.js.map +1 -0
- package/dist/selfimprove/dhq-adapter.d.ts +105 -0
- package/dist/selfimprove/dhq-adapter.d.ts.map +1 -0
- package/dist/selfimprove/dhq-adapter.js +95 -0
- package/dist/selfimprove/dhq-adapter.js.map +1 -0
- package/dist/selfimprove/draft-pr.d.ts +129 -0
- package/dist/selfimprove/draft-pr.d.ts.map +1 -0
- package/dist/selfimprove/draft-pr.js +158 -0
- package/dist/selfimprove/draft-pr.js.map +1 -0
- package/dist/selfimprove/envelope-diff.d.ts +162 -0
- package/dist/selfimprove/envelope-diff.d.ts.map +1 -0
- package/dist/selfimprove/envelope-diff.js +321 -0
- package/dist/selfimprove/envelope-diff.js.map +1 -0
- package/dist/selfimprove/replay.d.ts +121 -0
- package/dist/selfimprove/replay.d.ts.map +1 -0
- package/dist/selfimprove/replay.js +109 -0
- package/dist/selfimprove/replay.js.map +1 -0
- package/dist/selfimprove/run-loop.d.ts +148 -0
- package/dist/selfimprove/run-loop.d.ts.map +1 -0
- package/dist/selfimprove/run-loop.js +240 -0
- package/dist/selfimprove/run-loop.js.map +1 -0
- package/dist/selfimprove/scenario.d.ts +145 -0
- package/dist/selfimprove/scenario.d.ts.map +1 -0
- package/dist/selfimprove/scenario.js +243 -0
- package/dist/selfimprove/scenario.js.map +1 -0
- package/dist/sentient/daemon-entry.js +5 -0
- package/dist/sentient/daemon-entry.js.map +1 -1
- package/dist/sentient/daemon.d.ts.map +1 -1
- package/dist/sentient/daemon.js +19 -0
- package/dist/sentient/daemon.js.map +1 -1
- package/dist/sentient/hygiene-scan.d.ts.map +1 -1
- package/dist/sentient/hygiene-scan.js +14 -6
- package/dist/sentient/hygiene-scan.js.map +1 -1
- package/dist/sessions/briefing.d.ts.map +1 -1
- package/dist/sessions/briefing.js +13 -9
- package/dist/sessions/briefing.js.map +1 -1
- package/dist/sessions/connection-session-handle.d.ts +161 -0
- package/dist/sessions/connection-session-handle.d.ts.map +1 -0
- package/dist/sessions/connection-session-handle.js +168 -0
- package/dist/sessions/connection-session-handle.js.map +1 -0
- package/dist/sessions/handoff.d.ts.map +1 -1
- package/dist/sessions/handoff.js +9 -0
- package/dist/sessions/handoff.js.map +1 -1
- package/dist/sessions/index.d.ts +4 -1
- package/dist/sessions/index.d.ts.map +1 -1
- package/dist/sessions/index.js +31 -1
- package/dist/sessions/index.js.map +1 -1
- package/dist/sessions/session-id.d.ts +34 -0
- package/dist/sessions/session-id.d.ts.map +1 -1
- package/dist/sessions/session-id.js +37 -0
- package/dist/sessions/session-id.js.map +1 -1
- package/dist/sessions/session-manifest-mirror.d.ts +115 -0
- package/dist/sessions/session-manifest-mirror.d.ts.map +1 -0
- package/dist/sessions/session-manifest-mirror.js +250 -0
- package/dist/sessions/session-manifest-mirror.js.map +1 -0
- package/dist/sessions/session-switch.d.ts.map +1 -1
- package/dist/sessions/session-switch.js +5 -2
- package/dist/sessions/session-switch.js.map +1 -1
- package/dist/store/converters.d.ts.map +1 -1
- package/dist/store/converters.js +2 -0
- package/dist/store/converters.js.map +1 -1
- package/dist/store/db-helpers.d.ts.map +1 -1
- package/dist/store/db-helpers.js +2 -0
- package/dist/store/db-helpers.js.map +1 -1
- package/dist/store/dual-scope-db.d.ts.map +1 -1
- package/dist/store/dual-scope-db.js +87 -47
- package/dist/store/dual-scope-db.js.map +1 -1
- package/dist/store/pi-session-store.d.ts +151 -0
- package/dist/store/pi-session-store.d.ts.map +1 -0
- package/dist/store/pi-session-store.js +166 -0
- package/dist/store/pi-session-store.js.map +1 -0
- package/dist/store/safety-data-accessor.d.ts +1 -0
- package/dist/store/safety-data-accessor.d.ts.map +1 -1
- package/dist/store/safety-data-accessor.js +5 -0
- package/dist/store/safety-data-accessor.js.map +1 -1
- package/dist/store/schema/cleo-global/accounts.d.ts +357 -0
- package/dist/store/schema/cleo-global/accounts.d.ts.map +1 -0
- package/dist/store/schema/cleo-global/accounts.js +136 -0
- package/dist/store/schema/cleo-global/accounts.js.map +1 -0
- package/dist/store/schema/cleo-global/index.d.ts +2 -0
- package/dist/store/schema/cleo-global/index.d.ts.map +1 -1
- package/dist/store/schema/cleo-global/index.js +2 -0
- package/dist/store/schema/cleo-global/index.js.map +1 -1
- package/dist/store/schema/cleo-global/session-manifest.d.ts +217 -0
- package/dist/store/schema/cleo-global/session-manifest.d.ts.map +1 -0
- package/dist/store/schema/cleo-global/session-manifest.js +99 -0
- package/dist/store/schema/cleo-global/session-manifest.js.map +1 -0
- package/dist/store/schema/cleo-project/tasks-core.d.ts +16 -0
- package/dist/store/schema/cleo-project/tasks-core.d.ts.map +1 -1
- package/dist/store/schema/cleo-project/tasks-core.js +14 -0
- package/dist/store/schema/cleo-project/tasks-core.js.map +1 -1
- package/dist/store/schema/tasks.d.ts +16 -0
- package/dist/store/schema/tasks.d.ts.map +1 -1
- package/dist/store/schema/tasks.js +10 -0
- package/dist/store/schema/tasks.js.map +1 -1
- package/dist/store/selfimprove-dhq-schema.d.ts +284 -0
- package/dist/store/selfimprove-dhq-schema.d.ts.map +1 -0
- package/dist/store/selfimprove-dhq-schema.js +128 -0
- package/dist/store/selfimprove-dhq-schema.js.map +1 -0
- package/dist/store/selfimprove-dhq-store.d.ts +175 -0
- package/dist/store/selfimprove-dhq-store.d.ts.map +1 -0
- package/dist/store/selfimprove-dhq-store.js +182 -0
- package/dist/store/selfimprove-dhq-store.js.map +1 -0
- package/dist/store/session-store.d.ts +52 -13
- package/dist/store/session-store.d.ts.map +1 -1
- package/dist/store/session-store.js +71 -13
- package/dist/store/session-store.js.map +1 -1
- package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
- package/dist/store/sqlite-data-accessor.js +7 -0
- package/dist/store/sqlite-data-accessor.js.map +1 -1
- package/dist/store/umbrella-data-accessor.d.ts +1 -0
- package/dist/store/umbrella-data-accessor.d.ts.map +1 -1
- package/dist/store/umbrella-data-accessor.js +5 -0
- package/dist/store/umbrella-data-accessor.js.map +1 -1
- package/dist/store/validation-schemas.d.ts +32 -0
- package/dist/store/validation-schemas.d.ts.map +1 -1
- package/dist/store/writer-lease-schema.d.ts +392 -0
- package/dist/store/writer-lease-schema.d.ts.map +1 -0
- package/dist/store/writer-lease-schema.js +142 -0
- package/dist/store/writer-lease-schema.js.map +1 -0
- package/dist/store/writer-lease.d.ts +368 -0
- package/dist/store/writer-lease.d.ts.map +1 -0
- package/dist/store/writer-lease.js +1002 -0
- package/dist/store/writer-lease.js.map +1 -0
- package/dist/tasks/backfill-child-projections.d.ts.map +1 -1
- package/dist/tasks/backfill-child-projections.js +14 -9
- package/dist/tasks/backfill-child-projections.js.map +1 -1
- package/dist/tasks/complete.d.ts.map +1 -1
- package/dist/tasks/complete.js +7 -10
- package/dist/tasks/complete.js.map +1 -1
- package/dist/tasks/duplicate-detector.d.ts.map +1 -1
- package/dist/tasks/duplicate-detector.js +14 -7
- package/dist/tasks/duplicate-detector.js.map +1 -1
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +10 -4
- package/dist/telemetry/index.js.map +1 -1
- package/dist/tools/agent-registry.d.ts +250 -0
- package/dist/tools/agent-registry.d.ts.map +1 -0
- package/dist/tools/agent-registry.js +292 -0
- package/dist/tools/agent-registry.js.map +1 -0
- package/dist/tools/agent-tool-families.d.ts +107 -0
- package/dist/tools/agent-tool-families.d.ts.map +1 -0
- package/dist/tools/agent-tool-families.js +527 -0
- package/dist/tools/agent-tool-families.js.map +1 -0
- package/dist/tools/browser-driver.d.ts +183 -0
- package/dist/tools/browser-driver.d.ts.map +1 -0
- package/dist/tools/browser-driver.js +242 -0
- package/dist/tools/browser-driver.js.map +1 -0
- package/dist/tools/builtin-agent-tools.d.ts +36 -0
- package/dist/tools/builtin-agent-tools.d.ts.map +1 -0
- package/dist/tools/builtin-agent-tools.js +150 -0
- package/dist/tools/builtin-agent-tools.js.map +1 -0
- package/dist/tools/dispatch.d.ts +370 -0
- package/dist/tools/dispatch.d.ts.map +1 -0
- package/dist/tools/dispatch.js +505 -0
- package/dist/tools/dispatch.js.map +1 -0
- package/dist/tools/env-scrub.d.ts +93 -0
- package/dist/tools/env-scrub.d.ts.map +1 -0
- package/dist/tools/env-scrub.js +176 -0
- package/dist/tools/env-scrub.js.map +1 -0
- package/dist/tools/fs.d.ts +30 -0
- package/dist/tools/fs.d.ts.map +1 -1
- package/dist/tools/fs.js +55 -2
- package/dist/tools/fs.js.map +1 -1
- package/dist/tools/guard.d.ts +15 -0
- package/dist/tools/guard.d.ts.map +1 -1
- package/dist/tools/guard.js +49 -12
- package/dist/tools/guard.js.map +1 -1
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +37 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/pty.d.ts +45 -0
- package/dist/tools/pty.d.ts.map +1 -0
- package/dist/tools/pty.js +166 -0
- package/dist/tools/pty.js.map +1 -0
- package/dist/tools/schema-gen.d.ts +57 -0
- package/dist/tools/schema-gen.d.ts.map +1 -0
- package/dist/tools/schema-gen.js +52 -0
- package/dist/tools/schema-gen.js.map +1 -0
- package/dist/tools/shell.d.ts +12 -0
- package/dist/tools/shell.d.ts.map +1 -1
- package/dist/tools/shell.js +14 -1
- package/dist/tools/shell.js.map +1 -1
- package/dist/tools/web-agent-tools.d.ts +72 -0
- package/dist/tools/web-agent-tools.d.ts.map +1 -0
- package/dist/tools/web-agent-tools.js +393 -0
- package/dist/tools/web-agent-tools.js.map +1 -0
- package/dist/tools/web-search-backends.d.ts +156 -0
- package/dist/tools/web-search-backends.d.ts.map +1 -0
- package/dist/tools/web-search-backends.js +290 -0
- package/dist/tools/web-search-backends.js.map +1 -0
- package/dist/validation/ops.d.ts +1 -15
- package/dist/validation/ops.d.ts.map +1 -1
- package/dist/validation/ops.js +0 -20
- package/dist/validation/ops.js.map +1 -1
- package/migrations/drizzle-cleo-global/20260607000000_t11891-writer-leases/migration.sql +55 -0
- package/migrations/drizzle-cleo-global/20260607010000_t11639-session-manifest/migration.sql +43 -0
- package/migrations/drizzle-cleo-global/20260608000000_t11899-pi-session-tree/migration.sql +52 -0
- package/migrations/drizzle-cleo-global/20260608010000_t11709-accounts-credential-pool/migration.sql +72 -0
- package/migrations/drizzle-cleo-global/20260608020000_t11889-selfimprove-dhq/migration.sql +64 -0
- package/migrations/drizzle-cleo-project/20260607000000_t11891-writer-leases/migration.sql +55 -0
- package/migrations/drizzle-cleo-project/20260607010000_t11639-session-parent/migration.sql +22 -0
- package/migrations/drizzle-cleo-project/20260608000000_t11899-pi-session-tree/migration.sql +52 -0
- package/migrations/drizzle-cleo-project/20260608020000_t11889-selfimprove-dhq/migration.sql +64 -0
- package/package.json +15 -13
- package/dist/lifecycle/chain-composition.d.ts +0 -30
- package/dist/lifecycle/chain-composition.d.ts.map +0 -1
- package/dist/lifecycle/chain-composition.js +0 -152
- package/dist/lifecycle/chain-composition.js.map +0 -1
- package/dist/lifecycle/chain-store.d.ts +0 -70
- package/dist/lifecycle/chain-store.d.ts.map +0 -1
- package/dist/lifecycle/chain-store.js +0 -246
- package/dist/lifecycle/chain-store.js.map +0 -1
- package/dist/lifecycle/default-chain.d.ts +0 -39
- package/dist/lifecycle/default-chain.d.ts.map +0 -1
- package/dist/lifecycle/default-chain.js +0 -176
- package/dist/lifecycle/default-chain.js.map +0 -1
- package/dist/lifecycle/tessera-engine.d.ts +0 -48
- package/dist/lifecycle/tessera-engine.d.ts.map +0 -1
- package/dist/lifecycle/tessera-engine.js +0 -249
- package/dist/lifecycle/tessera-engine.js.map +0 -1
- package/dist/validation/chain-validation.d.ts +0 -43
- package/dist/validation/chain-validation.d.ts.map +0 -1
- package/dist/validation/chain-validation.js +0 -146
- package/dist/validation/chain-validation.js.map +0 -1
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **DbWriterLease** — single in-process writer-lease arbitration over a persisted
|
|
3
|
+
* SQLite row (T11627 ST-2 · local-mode engine).
|
|
4
|
+
*
|
|
5
|
+
* Heals the T5158 multi-writer corruption (`E_NOT_INITIALIZED` / `E_INTERNAL` on
|
|
6
|
+
* the consolidated `cleo.db`) **while the supervisor daemon stays DISABLED in
|
|
7
|
+
* production** by serializing writers through a `BEGIN IMMEDIATE` claim transaction
|
|
8
|
+
* against a persisted `_writer_leases` row, fenced by an epoch-CAS. The supervisor
|
|
9
|
+
* (ST-5, daemon-on) and Node (this module, daemon-off) share the SAME arbitration
|
|
10
|
+
* primitive and row format — IPC is a coordination optimization over the persisted
|
|
11
|
+
* source-of-truth, never a second source.
|
|
12
|
+
*
|
|
13
|
+
* ## Modes ({@link resolveLeaseMode})
|
|
14
|
+
*
|
|
15
|
+
* `CLEO_WRITER_LEASE_MODE` ∈ `{ supervisor | local | off | require }`, default
|
|
16
|
+
* `local`:
|
|
17
|
+
*
|
|
18
|
+
* - `local` — Node arbitrates the row directly. No IPC. **Heals T5158 with the
|
|
19
|
+
* daemon off** (the shipping config). DEFAULT.
|
|
20
|
+
* - `supervisor` — would prefer IPC to the supervisor; in ST-2 (no IPC client
|
|
21
|
+
* wired) it transparently behaves as `local`, logging the demotion once.
|
|
22
|
+
* - `off` — pure pass-through: {@link withWriterLease} just runs `fn` under the
|
|
23
|
+
* existing `busy_timeout=30000`. Byte-identical to pre-lease behaviour. Rollback
|
|
24
|
+
* escape hatch.
|
|
25
|
+
* - `require` — strict: an acquire that cannot take the row throws
|
|
26
|
+
* `E_LEASE_UNAVAILABLE`. No fallback.
|
|
27
|
+
*
|
|
28
|
+
* `busy_timeout=30000` (SSoT in `specs/sqlite-pragmas.json`) backstops every
|
|
29
|
+
* `BEGIN IMMEDIATE`, so a contended claim degrades to today's bounded wait rather
|
|
30
|
+
* than a hang in any mode.
|
|
31
|
+
*
|
|
32
|
+
* ## Re-entrancy
|
|
33
|
+
*
|
|
34
|
+
* A process-local grant memo (`Map<\`${scope}::${lane}\`, { handle, refcount }>`)
|
|
35
|
+
* memoizes the active grant so a nested same-lane write in the SAME process shares
|
|
36
|
+
* one lease (`refcount++` + the row's `reentrancy_depth++`) instead of re-running
|
|
37
|
+
* the claim txn — no second `BEGIN IMMEDIATE`, no IPC. `release()` decrements; the
|
|
38
|
+
* row is freed (`active = 0`) at depth 0.
|
|
39
|
+
*
|
|
40
|
+
* ## DB Open Guard (Gate 3)
|
|
41
|
+
*
|
|
42
|
+
* This module lives under `packages/core/src/store/**`, which is inside the Gate-3
|
|
43
|
+
* raw-open allowlist (the DB chokepoint). It obtains the native handle via
|
|
44
|
+
* {@link openDualScopeDb} (no new raw `new DatabaseSync(`) and runs raw
|
|
45
|
+
* `BEGIN IMMEDIATE` claim/reclaim/release transactions on it.
|
|
46
|
+
*
|
|
47
|
+
* ## Cold-open seam (T11627 ST-3 · Seam 0 — the T5158 heal)
|
|
48
|
+
*
|
|
49
|
+
* {@link withColdOpenLease} leases the `dual-scope-db.ts` cold-open critical
|
|
50
|
+
* section (`reconcileJournal` + `migrateWithRetry` + the exodus-on-open hook)
|
|
51
|
+
* against the SAME native handle the open just created — it does NOT route through
|
|
52
|
+
* the default resolver (which would re-enter `openDualScopeDb` and recurse). It
|
|
53
|
+
* idempotently bootstraps the lease tables on that handle FIRST (the full
|
|
54
|
+
* migration that creates them runs INSIDE the leased section), so exactly one
|
|
55
|
+
* process per scope runs the migrate/reconcile write-txn while peers
|
|
56
|
+
* `BEGIN IMMEDIATE`-queue and then observe a ready DB. This is the heal that ships
|
|
57
|
+
* with the supervisor daemon disabled.
|
|
58
|
+
*
|
|
59
|
+
* @module
|
|
60
|
+
* @task T11627
|
|
61
|
+
* @epic T11625
|
|
62
|
+
* @see ./writer-lease-schema.ts — the drizzle table decls + bootstrap index assertion
|
|
63
|
+
* @see ./dual-scope-db.ts — the open chokepoint this engine routes through (Seams 0 & 1)
|
|
64
|
+
*/
|
|
65
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
66
|
+
import type { LeaseLane, LeaseScope } from '@cleocode/contracts';
|
|
67
|
+
export type { LeaseLane, LeaseScope } from '@cleocode/contracts';
|
|
68
|
+
/**
|
|
69
|
+
* The writer-lease arbitration mode. Resolved once at process start from
|
|
70
|
+
* `CLEO_WRITER_LEASE_MODE`; default `'local'`.
|
|
71
|
+
*/
|
|
72
|
+
export type LeaseMode = 'supervisor' | 'local' | 'off' | 'require';
|
|
73
|
+
/**
|
|
74
|
+
* A held writer-lease grant. Returned by {@link acquireWriterLease}; passed to the
|
|
75
|
+
* callback of {@link withWriterLease}.
|
|
76
|
+
*/
|
|
77
|
+
export interface LeaseHandle {
|
|
78
|
+
/** The cleo.db scope this lease arbitrates within. */
|
|
79
|
+
readonly scope: LeaseScope;
|
|
80
|
+
/** The write lane this lease arbitrates within the scope. */
|
|
81
|
+
readonly lane: LeaseLane;
|
|
82
|
+
/**
|
|
83
|
+
* The epoch fence assigned to this grant. A write whose epoch no longer matches
|
|
84
|
+
* the row (the lease was reclaimed) must fail rather than corrupt
|
|
85
|
+
* (`E_WRITER_LEASE_STALE`).
|
|
86
|
+
*/
|
|
87
|
+
readonly epoch: number;
|
|
88
|
+
/**
|
|
89
|
+
* Release the lease. Decrements the process-local refcount and the row's
|
|
90
|
+
* `reentrancy_depth`; frees the row (`active = 0`) and stops the heartbeat at
|
|
91
|
+
* depth 0. Idempotent — a second call is a no-op.
|
|
92
|
+
*/
|
|
93
|
+
release(): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Advance the lease heartbeat (`heartbeat_at = now`) under the epoch guard. A
|
|
96
|
+
* reclaimed holder's heartbeat no-ops. Called automatically by the internal
|
|
97
|
+
* timer; exposed for callers that want to assert liveness mid-batch.
|
|
98
|
+
*/
|
|
99
|
+
heartbeat(): void;
|
|
100
|
+
}
|
|
101
|
+
/** Options accepted by {@link withWriterLease} / {@link acquireWriterLease}. */
|
|
102
|
+
export interface LeaseAcquireOptions {
|
|
103
|
+
/** Advisory priority — lower acquires sooner. `0` = highest. Default `100`. */
|
|
104
|
+
priority?: number;
|
|
105
|
+
/** Lease time-to-live in milliseconds. Default {@link DEFAULT_TTL_MS}. */
|
|
106
|
+
ttlMs?: number;
|
|
107
|
+
/**
|
|
108
|
+
* When true (default), a nested same-(scope,dbPath,lane) acquire in this process
|
|
109
|
+
* re-enters the existing grant (refcount++) instead of contending. When false,
|
|
110
|
+
* a nested acquire is forced to take a fresh row (used only by tests exercising
|
|
111
|
+
* cross-holder contention within one process).
|
|
112
|
+
*/
|
|
113
|
+
reentrant?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Pin the lease to a SPECIFIC cleo.db file (its resolved on-disk path) instead
|
|
116
|
+
* of the cwd-default canonical path the scope→path resolver returns. The
|
|
117
|
+
* chokepoint write primitives pass the dbPath recorded at cold-open
|
|
118
|
+
* ({@link activeScopeDbPath}) so the lease row lands in the SAME file the write
|
|
119
|
+
* targets — correct when more than one project's cleo.db is open in one process
|
|
120
|
+
* (Finding 1). When omitted, the canonical scope→path resolution is used.
|
|
121
|
+
*/
|
|
122
|
+
dbPath?: string;
|
|
123
|
+
}
|
|
124
|
+
/** Default lease TTL — aligned to `busy_timeout=30000` (specs/sqlite-pragmas.json). */
|
|
125
|
+
export declare const DEFAULT_TTL_MS = 30000;
|
|
126
|
+
/** The cold-open schema-bootstrap priority (highest). */
|
|
127
|
+
export declare const SCHEMA_BOOTSTRAP_PRIORITY = 0;
|
|
128
|
+
/**
|
|
129
|
+
* Resolve the writer-lease mode from `CLEO_WRITER_LEASE_MODE`, once per process.
|
|
130
|
+
*
|
|
131
|
+
* Unknown / unset values resolve to `'local'` — the production-safe default while
|
|
132
|
+
* the supervisor daemon is disabled.
|
|
133
|
+
*
|
|
134
|
+
* @returns The resolved {@link LeaseMode}.
|
|
135
|
+
*
|
|
136
|
+
* @task T11627
|
|
137
|
+
*/
|
|
138
|
+
export declare function resolveLeaseMode(): LeaseMode;
|
|
139
|
+
/**
|
|
140
|
+
* Reset cached process-global state (mode + demotion flag + grant memo). Tests
|
|
141
|
+
* only — production resolves these once and never resets.
|
|
142
|
+
*
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
145
|
+
export declare function _resetWriterLeaseStateForTest(): void;
|
|
146
|
+
/**
|
|
147
|
+
* A resolved lease target: the native `cleo.db` handle for a scope PLUS the
|
|
148
|
+
* absolute on-disk path that physically distinguishes it.
|
|
149
|
+
*
|
|
150
|
+
* The lease scope key is the EXISTING `cacheKey(scope, dbPath)` composite
|
|
151
|
+
* (`${scope}::${dbPath}`), so two DIFFERENT project files opened in one process
|
|
152
|
+
* are DISTINCT lease scopes (spec §6 Seam 0). Keying the grant memo + the
|
|
153
|
+
* resolver on the abstract scope LABEL alone would mis-share an in-process grant
|
|
154
|
+
* across two projects and route the second project's lease writes to the
|
|
155
|
+
* cwd-default file. `dbPath` closes that latent cross-project gap.
|
|
156
|
+
*/
|
|
157
|
+
export interface LeaseTarget {
|
|
158
|
+
/** The native `DatabaseSync` handle for the scope's `cleo.db`. */
|
|
159
|
+
readonly native: DatabaseSync;
|
|
160
|
+
/** The absolute on-disk path of that `cleo.db` (the lease-scope discriminator). */
|
|
161
|
+
readonly dbPath: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Resolver that yields the native handle + path for a scope's `cleo.db`. When
|
|
165
|
+
* `dbPath` is supplied the resolver MUST open THAT file (an explicit-path lease,
|
|
166
|
+
* e.g. a second project's cleo.db); otherwise it resolves the cwd-default
|
|
167
|
+
* canonical path for the scope.
|
|
168
|
+
*/
|
|
169
|
+
export type NativeDbResolver = (scope: LeaseScope, dbPath?: string) => Promise<LeaseTarget>;
|
|
170
|
+
/**
|
|
171
|
+
* Override how the engine obtains a scope's native `cleo.db` handle + path. Tests
|
|
172
|
+
* inject a temp-dir handle here so arbitration runs against an isolated fixture
|
|
173
|
+
* with no supervisor and no canonical-path side effects.
|
|
174
|
+
*
|
|
175
|
+
* For backward-compatibility a resolver that returns a bare `DatabaseSync` is
|
|
176
|
+
* accepted and adapted to a {@link LeaseTarget} whose `dbPath` is a stable
|
|
177
|
+
* synthetic per-scope token (`test://<scope>`) — sufficient for single-file test
|
|
178
|
+
* fixtures, which key one file per scope.
|
|
179
|
+
*
|
|
180
|
+
* @param resolver - The resolver to use, or `undefined` to restore the default.
|
|
181
|
+
* @internal
|
|
182
|
+
*/
|
|
183
|
+
export declare function _setNativeDbResolverForTest(resolver: ((scope: LeaseScope, dbPath?: string) => Promise<DatabaseSync | LeaseTarget>) | undefined): void;
|
|
184
|
+
/**
|
|
185
|
+
* Record the scope (and optionally the resolved dbPath) of the cold-open
|
|
186
|
+
* currently in progress / most recently opened. Called by `dual-scope-db.ts` at
|
|
187
|
+
* the head of its cold-open critical section (Seam 0). Idempotent — last writer
|
|
188
|
+
* wins; a project open after a global open makes `'project'` the active scope,
|
|
189
|
+
* which is correct because the chokepoint write primitives only ever write the
|
|
190
|
+
* project-tier `tasks_*` tables.
|
|
191
|
+
*
|
|
192
|
+
* @param scope - The scope of the in-progress cold-open.
|
|
193
|
+
* @param dbPath - The resolved on-disk path of that scope's cleo.db. When
|
|
194
|
+
* omitted, the active dbPath is cleared so {@link activeScopeDbPath} falls back
|
|
195
|
+
* to the canonical scope→path resolver.
|
|
196
|
+
* @internal
|
|
197
|
+
* @task T11627
|
|
198
|
+
*/
|
|
199
|
+
export declare function setActiveScope(scope: LeaseScope, dbPath?: string): void;
|
|
200
|
+
/**
|
|
201
|
+
* The scope the chokepoint write primitives should lease against. Defaults to
|
|
202
|
+
* `'project'` (the tasks chokepoint is project-tier) when no cold-open has
|
|
203
|
+
* recorded a scope yet — a write before any open is degenerate, but `'project'`
|
|
204
|
+
* is the only correct lease scope for `tasks_*` mutations.
|
|
205
|
+
*
|
|
206
|
+
* @returns The active {@link LeaseScope}.
|
|
207
|
+
* @internal
|
|
208
|
+
* @task T11627
|
|
209
|
+
*/
|
|
210
|
+
export declare function activeScope(): LeaseScope;
|
|
211
|
+
/**
|
|
212
|
+
* The dbPath the chokepoint write primitives should lease their row in. Returns
|
|
213
|
+
* the path recorded by the most-recent cold-open, or — defensively — the
|
|
214
|
+
* canonical scope→path resolution for {@link activeScope} when none was recorded.
|
|
215
|
+
*
|
|
216
|
+
* @returns The active cleo.db on-disk path.
|
|
217
|
+
* @internal
|
|
218
|
+
* @task T11627
|
|
219
|
+
*/
|
|
220
|
+
export declare function activeScopeDbPath(): string;
|
|
221
|
+
/**
|
|
222
|
+
* Clear the recorded active scope + dbPath. Tests only — production records once
|
|
223
|
+
* per cold-open and never clears (the scope of the last canonical open remains
|
|
224
|
+
* the lease target for subsequent writes).
|
|
225
|
+
*
|
|
226
|
+
* @internal
|
|
227
|
+
*/
|
|
228
|
+
export declare function _clearActiveScopeForTest(): void;
|
|
229
|
+
/**
|
|
230
|
+
* Thrown when `require` mode cannot acquire the lease, or (future) when a
|
|
231
|
+
* supervisor explicitly denies. Carries a stable `codeName` for envelope mapping.
|
|
232
|
+
*
|
|
233
|
+
* @public
|
|
234
|
+
*/
|
|
235
|
+
export declare class LeaseUnavailableError extends Error {
|
|
236
|
+
/** Stable string error code for envelope `codeName` / log correlation. */
|
|
237
|
+
readonly codeName: "E_LEASE_UNAVAILABLE";
|
|
238
|
+
constructor(scope: LeaseScope, lane: LeaseLane, reason: string);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Thrown when a write primitive opens the WRITE handle without a held lease
|
|
242
|
+
* (T11627 ST-4 · Seam 2 · AC4). The brain worker (and any other dedicated-handle
|
|
243
|
+
* writer outside the chokepoint) MUST hold its lane's grant before it writes — a
|
|
244
|
+
* lease-less write is exactly the multi-writer race the lease exists to kill.
|
|
245
|
+
*
|
|
246
|
+
* Enforced (not merely advised): the brain writer bootstrap calls
|
|
247
|
+
* {@link assertWriterLeaseHeld} before draining, and a lease-less drain throws
|
|
248
|
+
* this. `off` mode (the rollback escape hatch) is exempt — there is no lease to
|
|
249
|
+
* hold and the underlying `busy_timeout` serializes writes as before.
|
|
250
|
+
*
|
|
251
|
+
* @public
|
|
252
|
+
* @task T11627
|
|
253
|
+
*/
|
|
254
|
+
export declare class WriterLeaseRequiredError extends Error {
|
|
255
|
+
/** Stable string error code for envelope `codeName` / log correlation. */
|
|
256
|
+
readonly codeName: "E_WRITER_LEASE_REQUIRED";
|
|
257
|
+
constructor(scope: LeaseScope, lane: LeaseLane);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Whether THIS process currently holds an active grant for `(scope, lane)` in the
|
|
261
|
+
* process-local grant memo. Used by dedicated-handle writers (the brain worker) to
|
|
262
|
+
* assert AC4 without re-running the claim txn.
|
|
263
|
+
*
|
|
264
|
+
* @param scope - The cleo.db scope.
|
|
265
|
+
* @param lane - The write lane.
|
|
266
|
+
* @returns `true` iff a memoized grant with `refcount > 0` exists for the key.
|
|
267
|
+
*
|
|
268
|
+
* @task T11627
|
|
269
|
+
*/
|
|
270
|
+
export declare function hasActiveGrant(scope: LeaseScope, lane: LeaseLane): boolean;
|
|
271
|
+
/**
|
|
272
|
+
* AC4 guard. Assert this process holds the `(scope, lane)` writer lease before it
|
|
273
|
+
* opens a dedicated WRITE handle. In `off` mode the assertion is a no-op (there is
|
|
274
|
+
* no lease; `busy_timeout` serializes). In every other mode a missing grant throws
|
|
275
|
+
* {@link WriterLeaseRequiredError}.
|
|
276
|
+
*
|
|
277
|
+
* @param scope - The cleo.db scope the handle writes to.
|
|
278
|
+
* @param lane - The write lane that must be held.
|
|
279
|
+
* @throws {WriterLeaseRequiredError} when no grant is held and mode is not `off`.
|
|
280
|
+
*
|
|
281
|
+
* @task T11627
|
|
282
|
+
*/
|
|
283
|
+
export declare function assertWriterLeaseHeld(scope: LeaseScope, lane: LeaseLane): void;
|
|
284
|
+
/**
|
|
285
|
+
* Acquire (or re-enter) the writer lease for `(scope, lane)`. Caller MUST call
|
|
286
|
+
* `release()` on the returned handle (use {@link withWriterLease} to do so
|
|
287
|
+
* automatically).
|
|
288
|
+
*
|
|
289
|
+
* - `off` mode → returns a no-op handle (pass-through; no row written).
|
|
290
|
+
* - `local`/`supervisor` mode → arbitrates over the persisted row via
|
|
291
|
+
* `BEGIN IMMEDIATE` (+ epoch-CAS). A nested same-(scope,lane) acquire in this
|
|
292
|
+
* process re-enters the memoized grant (refcount++).
|
|
293
|
+
* - `require` mode → throws {@link LeaseUnavailableError} if the row cannot be
|
|
294
|
+
* taken within the acquire window (`min(ACQUIRE_DEADLINE_MS, ttlMs)`).
|
|
295
|
+
*
|
|
296
|
+
* @param scope - The cleo.db scope.
|
|
297
|
+
* @param lane - The write lane within the scope.
|
|
298
|
+
* @param opts - Priority / TTL / re-entrancy options.
|
|
299
|
+
* @returns A held {@link LeaseHandle}.
|
|
300
|
+
*
|
|
301
|
+
* @task T11627
|
|
302
|
+
*/
|
|
303
|
+
export declare function acquireWriterLease(scope: LeaseScope, lane: LeaseLane, opts?: LeaseAcquireOptions): Promise<LeaseHandle>;
|
|
304
|
+
/**
|
|
305
|
+
* Primary surface: acquire → run `fn` → release (always, even on throw).
|
|
306
|
+
*
|
|
307
|
+
* Refcounted + re-entrant by `(scope, lane)`: a nested same-lane write in the same
|
|
308
|
+
* process re-enters the memoized grant rather than re-running the claim txn.
|
|
309
|
+
*
|
|
310
|
+
* - `off` mode → pass-through (runs `fn` under today's busy_timeout, no row).
|
|
311
|
+
* - `require` mode → an unacquirable lease throws {@link LeaseUnavailableError}
|
|
312
|
+
* before `fn` runs.
|
|
313
|
+
*
|
|
314
|
+
* @param scope - The cleo.db scope.
|
|
315
|
+
* @param lane - The write lane.
|
|
316
|
+
* @param fn - The work to run while holding the lease; receives the handle.
|
|
317
|
+
* @param opts - Priority / TTL / re-entrancy options.
|
|
318
|
+
* @returns The resolved value of `fn`.
|
|
319
|
+
*
|
|
320
|
+
* @task T11627
|
|
321
|
+
*/
|
|
322
|
+
export declare function withWriterLease<T>(scope: LeaseScope, lane: LeaseLane, fn: (h: LeaseHandle) => Promise<T>, opts?: LeaseAcquireOptions): Promise<T>;
|
|
323
|
+
/**
|
|
324
|
+
* Lease the dual-scope-db COLD-OPEN critical section (Seam 0 — the T5158 heal).
|
|
325
|
+
*
|
|
326
|
+
* This is the high-value gate: it serializes the cold-open `reconcileJournal` +
|
|
327
|
+
* `migrateWithRetry` write-txn — the precise span that races in T5158 — so EXACTLY
|
|
328
|
+
* ONE process per scope runs it while peers `BEGIN IMMEDIATE`-queue and then observe
|
|
329
|
+
* a ready DB. It heals the T5158 `E_NOT_INITIALIZED` / `E_INTERNAL` corruption
|
|
330
|
+
* **with the supervisor daemon disabled** (`local` mode default). The caller
|
|
331
|
+
* (`dual-scope-db.ts`) runs the exodus-on-open hook AFTER this lease releases — the
|
|
332
|
+
* exodus engine owns its own single-flight lock + dedicated connections and
|
|
333
|
+
* closes/re-opens handles, so it must not run under this row lease.
|
|
334
|
+
*
|
|
335
|
+
* Unlike {@link withWriterLease} it operates DIRECTLY on the already-opened native
|
|
336
|
+
* handle — it never routes through the default resolver (which would re-enter
|
|
337
|
+
* `openDualScopeDb` and recurse) and it bootstraps the lease tables first (the full
|
|
338
|
+
* migration that creates them runs inside `fn`). It also records the scope in the
|
|
339
|
+
* Seam-1 active-scope registry ({@link setActiveScope}) so chokepoint write
|
|
340
|
+
* primitives lease against the right scope.
|
|
341
|
+
*
|
|
342
|
+
* Mode semantics mirror {@link withWriterLease}:
|
|
343
|
+
* - `off` → pass-through: runs `fn` under today's `busy_timeout=30000`, byte-
|
|
344
|
+
* identical to pre-lease cold-open behaviour.
|
|
345
|
+
* - `local` / `supervisor` (demoted) → claim the row via `BEGIN IMMEDIATE`; on a
|
|
346
|
+
* contended live holder, spin under the busy-timeout-backstopped deadline, then
|
|
347
|
+
* degrade to running `fn` (busy_timeout still serializes the migrate write-txn).
|
|
348
|
+
* - `require` → throw {@link LeaseUnavailableError} if the row cannot be taken.
|
|
349
|
+
*
|
|
350
|
+
* @param scope - The cleo.db scope being cold-opened.
|
|
351
|
+
* @param nativeDb - The native handle the cold-open just created (pragmas applied).
|
|
352
|
+
* @param fn - The cold-open body to run while holding the lease.
|
|
353
|
+
* @param opts - Priority / TTL options + the resolved `dbPath` of this cold-open.
|
|
354
|
+
* `dbPath` is recorded in the Seam-1 active-scope registry so the chokepoint
|
|
355
|
+
* write primitives lease their row in the SAME file this open targeted (correct
|
|
356
|
+
* when more than one project is open in one process — Finding 1). Cold-open
|
|
357
|
+
* defaults to highest priority ({@link SCHEMA_BOOTSTRAP_PRIORITY}) and a 60s TTL
|
|
358
|
+
* (schema bootstrap can be slow).
|
|
359
|
+
* @returns The resolved value of `fn`.
|
|
360
|
+
*
|
|
361
|
+
* @task T11627
|
|
362
|
+
*/
|
|
363
|
+
export declare function withColdOpenLease<T>(scope: LeaseScope, nativeDb: DatabaseSync, fn: () => Promise<T>, opts?: {
|
|
364
|
+
priority?: number;
|
|
365
|
+
ttlMs?: number;
|
|
366
|
+
dbPath?: string;
|
|
367
|
+
}): Promise<T>;
|
|
368
|
+
//# sourceMappingURL=writer-lease.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writer-lease.d.ts","sourceRoot":"","sources":["../../src/store/writer-lease.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAYjE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC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