@bastani/atomic 0.10.11-alpha.2 → 0.10.11
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/CHANGELOG.md +307 -0
- package/README.md +5 -8
- package/dist/_shared/dist-KOELCESV.js +2 -2
- package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
- package/dist/_shared/lib-4PES5P4V.js +2 -2
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +6 -6
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +5 -5
- package/dist/_shared/mode-shared-2QJSCUM6.js +6 -6
- package/dist/_shared/p0-cli-BB45ZQY6.js +46 -67
- package/dist/_shared/p0-cli-BB45ZQY6.js.map +1 -1
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +7 -8
- package/dist/_shared/p1a-prewarm-XIU57JHF.js.map +1 -1
- package/dist/_shared/{p1b-elig-ENCUPKKJ.js → p1b-elig-TVB5CBLL.js} +36 -8
- package/dist/_shared/p1b-elig-TVB5CBLL.js.map +1 -0
- package/dist/_shared/p2-shell-main-B2WIALFD.js +6 -3
- package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
- package/dist/_shared/runtime-O4KCSG4C.js +3 -3
- package/dist/_shared/{sdk-IQMULKFU.js → sdk-B5LEWGGI.js} +1218 -657
- package/dist/_shared/sdk-B5LEWGGI.js.map +1 -0
- package/dist/_shared/session-data-AHTU7IS6.js +2 -2
- package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
- package/dist/_shared/{startup-0-0-3IXNMFM2.js → startup-0-0-XJJDOIEC.js} +50 -48
- package/dist/_shared/startup-0-0-XJJDOIEC.js.map +1 -0
- package/dist/_shared/{startup-0-1-7T2IAE7J.js → startup-0-1-M6OWAYHH.js} +540 -136
- package/dist/_shared/startup-0-1-M6OWAYHH.js.map +1 -0
- package/dist/_shared/startup-0-2-5QHPCEON.js +47 -48
- package/dist/_shared/startup-0-2-5QHPCEON.js.map +1 -1
- package/dist/_shared/startup-0-3-4ZYBYQNM.js +5 -5
- package/dist/_shared/startup-0-4-ZMJV547D.js +12 -7
- package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -1
- package/dist/_shared/startup-0-5-YDW47QX6.js +7 -7
- package/dist/_shared/startup-0-5-YDW47QX6.js.map +1 -1
- package/dist/_shared/startup-10-0-TDQNBDDL.js +6 -6
- package/dist/_shared/startup-12-0-55AAXBJZ.js +2 -2
- package/dist/_shared/startup-14-0-MLX36RBG.js +4 -5
- package/dist/_shared/startup-14-0-MLX36RBG.js.map +1 -1
- package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
- package/dist/_shared/startup-15-1-4S7FLMNG.js +19 -27
- package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +2144 -249
- package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
- package/dist/_shared/{startup-8-1-X32CYSXB.js → startup-8-1-LZFXSD3Z.js} +98 -1184
- package/dist/_shared/startup-8-1-LZFXSD3Z.js.map +1 -0
- package/dist/_shared/storage-command-7MGXLJGZ.js +188 -37
- package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
- package/dist/_shared/storage-status-K7PX2RXA.js +557 -0
- package/dist/_shared/storage-status-K7PX2RXA.js.map +1 -0
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/team-DOQKICG2.js +376 -0
- package/dist/_shared/team-DOQKICG2.js.map +1 -0
- package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +88 -0
- package/dist/builtin/intercom/README.md +2 -2
- package/dist/builtin/intercom/broker/broker.bundle.mjs +1917 -381
- package/dist/builtin/intercom/broker/client.ts +8 -0
- package/dist/builtin/intercom/broker/database-wake-up-bus.ts +324 -68
- package/dist/builtin/intercom/broker/multinode-router.ts +256 -39
- package/dist/builtin/intercom/broker/multinode-state-store.ts +71 -5
- package/dist/builtin/intercom/broker/open-broker-state.ts +14 -0
- package/dist/builtin/intercom/broker/send-order-gate.ts +5 -2
- package/dist/builtin/intercom/broker/sql-add-column.ts +50 -5
- package/dist/builtin/intercom/broker/sql-ended-child-queue-store.ts +3 -2
- package/dist/builtin/intercom/broker/sql-held-send-store.ts +2 -2
- package/dist/builtin/intercom/broker/sql-known-session-store.ts +43 -19
- package/dist/builtin/intercom/broker/sql-lease-store.ts +473 -121
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +821 -79
- package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +8 -5
- package/dist/builtin/intercom/broker/sql-released-ask-store.ts +12 -5
- package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +256 -8
- package/dist/builtin/intercom/broker/sql-retention.ts +150 -0
- package/dist/builtin/intercom/broker/sql-schema.ts +175 -24
- package/dist/builtin/intercom/broker/sql-sent-message-authority.ts +74 -19
- package/dist/builtin/intercom/broker/wake-up-bus.ts +6 -0
- package/dist/builtin/intercom/index.bundle.mjs +14 -4
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +20 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/skill-creator/eval-viewer/generate_review.py +8 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/index.bundle.mjs +2 -10
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/bun/bundled-sqlite.js +41 -0
- package/dist/bun/bundled-sqlite.js.map +1 -0
- package/dist/cli/args.js +2 -2
- package/dist/cli/auth-cli.code.js +4 -4
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.code.js +3 -3
- package/dist/cli/blueprint-command.impl.js +3 -3
- package/dist/cli/blueprint-command.js +3 -3
- package/dist/cli/intercom-command.code.js +3 -3
- package/dist/cli/intercom-command.code.js.map +1 -1
- package/dist/cli/intercom-command.impl.js +3 -3
- package/dist/cli/intercom-command.js +3 -3
- package/dist/cli/list-models.code.js +2 -2
- package/dist/cli/list-models.impl.js +3 -3
- package/dist/cli/list-models.js +3 -3
- package/dist/cli/session-picker.code.js +1 -1
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/startup-ui.code.js +1 -1
- package/dist/cli/startup-ui.impl.js +3 -3
- package/dist/cli/startup-ui.js +3 -3
- package/dist/cli/storage-command.impl.js +3 -3
- package/dist/cli/storage-command.js +3 -3
- package/dist/cli/storage-search-session.code.js +3 -3
- package/dist/cli/storage-search-session.impl.js +3 -3
- package/dist/cli/storage-search-session.js +3 -3
- package/dist/cli/team-command.code.js +19 -113
- package/dist/cli/team-command.code.js.map +1 -1
- package/dist/cli/team-command.impl.js +3 -3
- package/dist/cli/team-command.js +3 -3
- package/dist/cli.js +5 -18
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-rehydrate-errors.d.ts +4 -9
- package/dist/core/compaction/compactor.d.ts +3 -3
- package/dist/core/debug.code.js +1 -1
- package/dist/core/debug.impl.js +3 -3
- package/dist/core/debug.js +3 -3
- package/dist/core/export-html/card-projection.impl.js +3 -3
- package/dist/core/export-html/card-projection.js +3 -3
- package/dist/core/export-html/index.code.js +4 -4
- package/dist/core/export-html/index.code.js.map +1 -1
- package/dist/core/export-html/index.impl.js +3 -3
- package/dist/core/export-html/index.js +3 -3
- package/dist/core/export-html/json-spans.impl.js +3 -3
- package/dist/core/export-html/json-spans.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.js +3 -3
- package/dist/core/export-html/tool-renderer.impl.js +3 -3
- package/dist/core/export-html/tool-renderer.js +3 -3
- package/dist/core/extensions/jiti-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-loader.js +3 -3
- package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-static-loader.js +3 -3
- package/dist/core/extensions/loader-host-modules.code.js +1 -1
- package/dist/core/extensions/loader-host-modules.impl.js +3 -3
- package/dist/core/extensions/loader-host-modules.js +3 -3
- package/dist/core/extensions/loader-virtual-modules.js +1 -1
- package/dist/core/extensions/runner-context.js +2 -2
- package/dist/core/intercom-broker-control-host.code.js +2 -2
- package/dist/core/intercom-broker-control-host.impl.js +3 -3
- package/dist/core/intercom-broker-control-host.js +3 -3
- package/dist/core/intercom-broker-control.code.js +3 -3
- package/dist/core/intercom-broker-control.impl.js +3 -3
- package/dist/core/intercom-broker-control.js +3 -3
- package/dist/core/package-manager-storage-adapters.code.js +1 -1
- package/dist/core/package-manager-storage-adapters.impl.js +3 -3
- package/dist/core/package-manager-storage-adapters.js +3 -3
- package/dist/core/process-start-token.d.ts +12 -3
- package/dist/core/process-tree-containment.d.ts +16 -0
- package/dist/core/sdk-types.d.ts +1 -2
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.code.js +3 -3
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.js +5 -5
- package/dist/core/session-manager-list.impl.js +3 -3
- package/dist/core/session-manager-list.js +3 -3
- package/dist/core/session-manager.code.js +1 -1
- package/dist/core/session-manager.impl.js +3 -3
- package/dist/core/session-manager.js +3 -3
- package/dist/core/session-storage.code.js +1 -1
- package/dist/core/session-storage.impl.js +3 -3
- package/dist/core/session-storage.js +3 -3
- package/dist/core/settings-schema.d.ts +0 -3
- package/dist/core/storage/added-exports-0-10-11.js +19 -0
- package/dist/core/storage/added-exports-0-10-11.js.map +1 -0
- package/dist/core/storage/creation-time.js +105 -0
- package/dist/core/storage/creation-time.js.map +1 -0
- package/dist/core/storage/database.d.ts +25 -5
- package/dist/core/storage/database.js.map +1 -1
- package/dist/core/storage/dialect.d.ts +1 -1
- package/dist/core/storage/dialect.js +1 -1
- package/dist/core/storage/dialect.js.map +1 -1
- package/dist/core/storage/errors.d.ts +13 -13
- package/dist/core/storage/errors.js +10 -16
- package/dist/core/storage/errors.js.map +1 -1
- package/dist/core/storage/fenced-paths.d.ts +18 -6
- package/dist/core/storage/fenced-paths.js +18 -6
- package/dist/core/storage/fenced-paths.js.map +1 -1
- package/dist/core/storage/file-identity.d.ts +2 -0
- package/dist/core/storage/file-identity.js +24 -8
- package/dist/core/storage/file-identity.js.map +1 -1
- package/dist/core/storage/index.d.ts +3 -2
- package/dist/core/storage/index.js +5 -3
- package/dist/core/storage/index.js.map +1 -1
- package/dist/core/storage/libsql-removed.d.ts +71 -0
- package/dist/core/storage/libsql-removed.js +123 -0
- package/dist/core/storage/libsql-removed.js.map +1 -0
- package/dist/core/storage/migrations.d.ts +78 -14
- package/dist/core/storage/migrations.js +375 -49
- package/dist/core/storage/migrations.js.map +1 -1
- package/dist/core/storage/node-sqlite-file-gate.js +0 -15
- package/dist/core/storage/node-sqlite-file-gate.js.map +1 -1
- package/dist/core/storage/node-sqlite-thread.js +215 -30
- package/dist/core/storage/node-sqlite-thread.js.map +1 -1
- package/dist/core/storage/node-sqlite.js +484 -72
- package/dist/core/storage/node-sqlite.js.map +1 -1
- package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
- package/dist/core/storage/offline-snapshot-file.js +3 -3
- package/dist/core/storage/prefix.d.ts +1 -1
- package/dist/core/storage/prefix.js +9 -2
- package/dist/core/storage/prefix.js.map +1 -1
- package/dist/core/storage/process-selection.d.ts +5 -5
- package/dist/core/storage/provider.js +2 -2
- package/dist/core/storage/schema-catalog.d.ts +76 -15
- package/dist/core/storage/schema-catalog.js +359 -68
- package/dist/core/storage/schema-catalog.js.map +1 -1
- package/dist/core/storage/selection.d.ts +7 -82
- package/dist/core/storage/selection.js +20 -235
- package/dist/core/storage/selection.js.map +1 -1
- package/dist/core/storage/session/branch-fork-source.code.js +2 -2
- package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
- package/dist/core/storage/session/branch-fork-source.js +3 -3
- package/dist/core/storage/session/card-view.impl.js +3 -3
- package/dist/core/storage/session/card-view.js +3 -3
- package/dist/core/storage/session/child-reader.code.js +3 -3
- package/dist/core/storage/session/child-reader.impl.js +3 -3
- package/dist/core/storage/session/child-reader.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.js +3 -3
- package/dist/core/storage/session/expanded-child-details.code.js +2 -2
- package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
- package/dist/core/storage/session/expanded-child-details.js +3 -3
- package/dist/core/storage/session/fork-detach.d.ts +11 -1
- package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.js +3 -3
- package/dist/core/storage/session/fork-row-index.impl.js +3 -3
- package/dist/core/storage/session/fork-row-index.js +3 -3
- package/dist/core/storage/session/fork-staging.code.js +4 -7
- package/dist/core/storage/session/fork-staging.code.js.map +1 -1
- package/dist/core/storage/session/fork-staging.impl.js +3 -3
- package/dist/core/storage/session/fork-staging.js +3 -3
- package/dist/core/storage/session/fork-sweep.js +31 -7
- package/dist/core/storage/session/fork-sweep.js.map +1 -1
- package/dist/core/storage/session/fork-window.code.js +3 -3
- package/dist/core/storage/session/fork-window.impl.js +3 -3
- package/dist/core/storage/session/fork-window.js +3 -3
- package/dist/core/storage/session/history-pages.impl.js +3 -3
- package/dist/core/storage/session/history-pages.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
- package/dist/core/storage/session/jsonl-session-lock.d.ts +100 -0
- package/dist/core/storage/session/jsonl-session-store.d.ts +46 -24
- package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.js +3 -3
- package/dist/core/storage/session/memory-session-store.impl.js +3 -3
- package/dist/core/storage/session/memory-session-store.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.js +3 -3
- package/dist/core/storage/session/released-history-files.code.js +9 -9
- package/dist/core/storage/session/released-history-files.code.js.map +1 -1
- package/dist/core/storage/session/released-history-files.impl.js +3 -3
- package/dist/core/storage/session/released-history-files.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.js +3 -3
- package/dist/core/storage/session/session-resume.impl.js +3 -3
- package/dist/core/storage/session/session-resume.js +3 -3
- package/dist/core/storage/session/session-search-index.d.ts +52 -5
- package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
- package/dist/core/storage/session/snapshot-cut.js +3 -3
- package/dist/core/storage/session/snapshot-history.code.js +3 -3
- package/dist/core/storage/session/snapshot-history.impl.js +3 -3
- package/dist/core/storage/session/snapshot-history.js +3 -3
- package/dist/core/storage/session/sql-session-store.code.js +1 -1
- package/dist/core/storage/session/sql-session-store.d.ts +99 -18
- package/dist/core/storage/session/sql-session-store.impl.js +3 -3
- package/dist/core/storage/session/sql-session-store.js +3 -3
- package/dist/core/storage/session/tree-outline.impl.js +3 -3
- package/dist/core/storage/session/tree-outline.js +3 -3
- package/dist/core/storage/session/tree-presentation.impl.js +3 -3
- package/dist/core/storage/session/tree-presentation.js +3 -3
- package/dist/core/storage/sqlite-facade.d.ts +12 -1
- package/dist/core/storage/sqlite-facade.js +310 -33
- package/dist/core/storage/sqlite-facade.js.map +1 -1
- package/dist/core/storage/sqlite-open-batch.js +10 -0
- package/dist/core/storage/sqlite-open-batch.js.map +1 -0
- package/dist/core/storage/storage-status.code.js +1 -1
- package/dist/core/storage/storage-status.impl.js +3 -3
- package/dist/core/storage/storage-status.js +3 -3
- package/dist/core/storage/team.code.js +1 -1
- package/dist/core/storage/team.d.ts +26 -115
- package/dist/core/storage/team.impl.js +3 -3
- package/dist/core/storage/team.js +3 -3
- package/dist/core/structured-output/index.code.js +1 -1
- package/dist/core/structured-output/index.impl.js +3 -3
- package/dist/core/structured-output/index.js +3 -3
- package/dist/core/tasks/task-completion-entry.impl.js +3 -3
- package/dist/core/tasks/task-completion-entry.js +3 -3
- package/dist/core/tasks/task-file-history.code.js +3 -3
- package/dist/core/tasks/task-file-history.impl.js +3 -3
- package/dist/core/tasks/task-file-history.js +3 -3
- package/dist/core/tasks/task-reference-archive.code.js +4 -4
- package/dist/core/tasks/task-reference-archive.js +3 -3
- package/dist/core/tasks/task-reference-identity.js +3 -3
- package/dist/core/tasks/task-reference-stream.impl.js +3 -3
- package/dist/core/tasks/task-reference-stream.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.js +3 -3
- package/dist/core/tasks/task-view-source.code.js +1 -1
- package/dist/core/tasks/task-view-source.impl.js +3 -3
- package/dist/core/tasks/task-view-source.js +3 -3
- package/dist/core/tools/history-tasks.d.ts +3 -2
- package/dist/core/tools/read-url.code.js +4 -4
- package/dist/core/tools/read-url.impl.js +3 -3
- package/dist/core/tools/read-url.js +3 -3
- package/dist/core/worktree-snapshot/blob-store.d.ts +44 -5
- package/dist/core/worktree-snapshot/blob-store.js +553 -30
- package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
- package/dist/core/worktree-snapshot/errors.code.js +2 -2
- package/dist/core/worktree-snapshot/errors.impl.js +3 -3
- package/dist/core/worktree-snapshot/errors.js +3 -3
- package/dist/core/worktree-snapshot/fork-blob-guard.js +81 -0
- package/dist/core/worktree-snapshot/fork-blob-guard.js.map +1 -0
- package/dist/core/worktree-snapshot/fork-snapshot-index.js +208 -50
- package/dist/core/worktree-snapshot/fork-snapshot-index.js.map +1 -1
- package/dist/core/worktree-snapshot/session-index-reset.code.js +4 -0
- package/dist/core/worktree-snapshot/session-index-reset.code.js.map +1 -1
- package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
- package/dist/extensions/codemode/execute.code.js +1 -1
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.code.js +2 -2
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- package/dist/extensions/mcp/cli.code.js +3 -3
- package/dist/extensions/mcp/cli.impl.js +3 -3
- package/dist/extensions/mcp/cli.js +3 -3
- package/dist/extensions/mcp/cli.lazy.code.js +2 -2
- package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
- package/dist/extensions/mcp/cli.lazy.js +3 -3
- package/dist/extensions/mcp/runtime.code.js +1 -1
- package/dist/extensions/mcp/runtime.impl.js +3 -3
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -5
- package/dist/main-first-time-setup.code.js +1 -1
- package/dist/main-first-time-setup.impl.js +3 -3
- package/dist/main-first-time-setup.js +3 -3
- package/dist/main.js +1 -1
- package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
- package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
- package/dist/modes/interactive/startup-shell-eligibility.js +1 -1
- package/dist/modes/interactive-engine/engine-prewarm.d.ts +1 -1
- package/dist/modes/print-mode.js +1 -1
- package/dist/package-manager-cli.code.js +6 -6
- package/dist/package-manager-cli.impl.js +3 -3
- package/dist/package-manager-cli.js +3 -3
- package/dist/rpc-entry.js +1 -1
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/10.js +1 -1
- package/dist/startup-stages/11.js +1 -1
- package/dist/startup-stages/12.js +1 -1
- package/dist/startup-stages/2.js +2 -4
- package/dist/startup-stages/3.js +1 -3
- package/dist/startup-stages/4.js +1 -2
- package/dist/startup-stages/5.js +1 -1
- package/dist/startup-stages/6.js +5 -7
- package/dist/startup-stages/7.js +3 -10
- package/dist/startup-stages/8.js +7 -2
- package/dist/startup-stages/9.js +1 -7
- package/dist/startup-stages/stages.json +1 -1
- package/dist/utils/compile-cache-deferral.js +8 -13
- package/dist/utils/compile-cache-deferral.js.map +1 -1
- package/dist/utils/compile-cache-warmup-host.js +3 -4
- package/dist/utils/compile-cache-warmup-host.js.map +1 -1
- package/dist/utils/compile-cache.js +12 -100
- package/dist/utils/compile-cache.js.map +1 -1
- package/dist/utils/startup-database-spare.code.js +2 -2
- package/dist/utils/startup-database-spare.impl.js +3 -3
- package/dist/utils/startup-database-spare.js +3 -3
- package/dist/utils/tools-manager.code.js +1 -1
- package/dist/utils/tools-manager.impl.js +3 -3
- package/dist/utils/tools-manager.js +3 -3
- package/dist/utils/worker-threads.js +2 -15
- package/dist/utils/worker-threads.js.map +1 -1
- package/docs/build.md +3 -3
- package/docs/changelog.mdx +1498 -69
- package/docs/compaction/reference.md +5 -5
- package/docs/compaction.md +7 -9
- package/docs/containerization.md +2 -2
- package/docs/custom-provider/api-reference.md +1 -1
- package/docs/docs.json +37 -10
- package/docs/environment-variables.md +0 -2
- package/docs/extensions/api-reference.md +4 -4
- package/docs/getting-started/installation.md +3 -0
- package/docs/guides/configuration.md +1 -1
- package/docs/guides/non-interactive.md +1 -1
- package/docs/guides/resume-on-any-machine.md +14 -22
- package/docs/guides/team-setup.md +56 -83
- package/docs/guides.md +2 -4
- package/docs/herdr.md +1 -1
- package/docs/index.md +1 -1
- package/docs/intercom/operations.md +26 -21
- package/docs/intercom/reference.md +2 -2
- package/docs/intercom.md +1 -1
- package/docs/libraries/storage-postgres.md +9 -9
- package/docs/libraries.md +2 -3
- package/docs/models-configuration.md +2 -2
- package/docs/models.md +2 -3
- package/docs/packages/authoring.md +7 -7
- package/docs/packages.md +1 -1
- package/docs/programmatic.md +2 -2
- package/docs/quickstart.md +1 -1
- package/docs/reference/cli.md +6 -11
- package/docs/reference.md +2 -2
- package/docs/rpc/extension-ui.md +2 -2
- package/docs/sdk/reference.md +5 -4
- package/docs/sdk/storage.md +8 -92
- package/docs/sdk/structured-decisions.md +1 -1
- package/docs/sdk/web-server.md +3 -3
- package/docs/sdk.md +14 -4
- package/docs/security.md +1 -1
- package/docs/session-format.md +5 -5
- package/docs/sessions.md +29 -49
- package/docs/settings.md +7 -8
- package/docs/storage/custom-adapters.md +255 -0
- package/docs/storage/jsonl.md +117 -0
- package/docs/{guides/postgres-pgbouncer.md → storage/postgres/pgbouncer.md} +66 -68
- package/docs/storage/postgres/tuning.md +337 -0
- package/docs/storage/postgres.md +556 -0
- package/docs/storage/sqlite.md +99 -0
- package/docs/storage.md +326 -990
- package/docs/subagents/authoring.md +1 -1
- package/docs/subagents.md +2 -2
- package/docs/tools.md +1 -1
- package/docs/worktree-snapshots.md +2 -2
- package/package.json +9 -9
- package/schemas/models.schema.json +2 -2
- package/schemas/settings.schema.json +0 -14
- package/dist/_shared/p1b-elig-ENCUPKKJ.js.map +0 -1
- package/dist/_shared/sdk-IQMULKFU.js.map +0 -1
- package/dist/_shared/startup-0-0-3IXNMFM2.js.map +0 -1
- package/dist/_shared/startup-0-1-7T2IAE7J.js.map +0 -1
- package/dist/_shared/startup-8-1-X32CYSXB.js.map +0 -1
- package/dist/core/intercom-broker-control.d.ts +0 -129
- package/dist/startup-stages/13.js +0 -1
- package/docs/guides/postgres-tuning.md +0 -311
- package/docs/libraries/storage-libsql.md +0 -97
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { transactionFinisher } from "../storage/added-exports.js";
|
|
1
|
+
import { storageSchemaCurrent, transactionFinisher } from "../storage/added-exports.js";
|
|
2
|
+
import { MAX_SEQUENCE_REQUEST_STATEMENTS, noteStorageSchemaTables } from "../storage/added-exports-0-10-11.js";
|
|
2
3
|
import { dialectOf } from "../storage/dialect.js";
|
|
3
4
|
import { StorageWriteLockTimeoutError } from "../storage/errors.js";
|
|
4
|
-
import { applyStorageMigrations, withShortSchemaLockWaits } from "../storage/migrations.js";
|
|
5
|
+
import { applyStorageMigrations, ensureStorageSchema, withShortSchemaLockWaits } from "../storage/migrations.js";
|
|
5
6
|
import { renderStorageIdentifiers, storageMigrationTable, validateStoragePrefix } from "../storage/prefix.js";
|
|
6
|
-
import { schemaCatalogOf } from "../storage/schema-catalog.js";
|
|
7
|
+
import { schemaCatalogOf, withStorageSchemaCatalog } from "../storage/schema-catalog.js";
|
|
8
|
+
import { queueSqliteSchemaSetup } from "../storage/sqlite-open-batch.js";
|
|
7
9
|
import { statementBatch } from "../storage/statement-batches.js";
|
|
8
|
-
import {
|
|
10
|
+
import { forkInheritedBlobGuard, forkInheritedBlobGuardName } from "./fork-blob-guard.js";
|
|
11
|
+
import { entriesIndexComplete, forkLinksCheck, forkSegmentsTable, forkSessionLink, legacyForkLinksTriggerName, materializedForkLinks, ownDuplicate, ownParentSeq, parentColumns, snapshotEntryCondition, } from "./fork-snapshot-index.js";
|
|
9
12
|
/**
|
|
10
13
|
* The key under which a failed rename's error carries the trigger or view that stopped it, once confirmed in the
|
|
11
14
|
* database (#5622); `WorkspaceCollectionError` names it in its hint. A `Symbol.for` key, shared without an import.
|
|
@@ -209,7 +212,7 @@ export const SNAPSHOT_COLLECTION_DELETE_BATCH = 8;
|
|
|
209
212
|
export const SNAPSHOT_COLLECTION_SESSION_REFS = 2_048;
|
|
210
213
|
/**
|
|
211
214
|
* The most bytes of legacy blobs one write transaction of a collection stamps or moves. A blob stored before blob ages
|
|
212
|
-
* has an unknown age, which collection stamps; changing one column rewrites the whole row on SQLite
|
|
215
|
+
* has an unknown age, which collection stamps; changing one column rewrites the whole row on SQLite, its
|
|
213
216
|
* blob included, and holds the writer for as long as that takes, so a stamping transaction stops at this many bytes of
|
|
214
217
|
* blobs. An in-row blob larger than {@link SNAPSHOT_BLOB_CHUNK_BYTES} is moved to chunks regardless of age,
|
|
215
218
|
* at most this many bytes per transaction. Publishing frees its old value while holding the writer, with time
|
|
@@ -223,7 +226,7 @@ export const SNAPSHOT_LEGACY_STAMP_BYTES = 16 * SNAPSHOT_BLOB_CHUNK_BYTES;
|
|
|
223
226
|
*/
|
|
224
227
|
export const SNAPSHOT_CHUNK_MOVE_ROWS = 4;
|
|
225
228
|
/**
|
|
226
|
-
* The free space a chunk table's move to the row layout leaves on the file system of a SQLite
|
|
229
|
+
* The free space a chunk table's move to the row layout leaves on the file system of a SQLite database file
|
|
227
230
|
* beyond its copy, at least (#5694): the move starts only when the disk has room for the copy, its write-ahead log and
|
|
228
231
|
* this much more, so other writes keep room on the disk.
|
|
229
232
|
*/
|
|
@@ -520,14 +523,19 @@ function indexSources(prefix, t, d, forkSegments) {
|
|
|
520
523
|
const parentType = "r.parent_type";
|
|
521
524
|
const parentId = "r.parent_id";
|
|
522
525
|
const isSnapshot = snapshotEntryCondition(d, entryRow);
|
|
523
|
-
|
|
526
|
+
// The parent is the first link before the entry with the parent's id, as `forkSessionLink` finds it (#6560).
|
|
527
|
+
const parentOf = (rows) => `${rows} AS r LEFT JOIN ${t.sessionLinks} AS parent ON parent.session_id = r.session_id AND parent.seq = ${ownParentSeq(t.sessionLinks)}`;
|
|
524
528
|
/**
|
|
525
|
-
* Indexes one session entry's link in the session tree. `rows` yields that one entry as `r
|
|
526
|
-
*
|
|
529
|
+
* Indexes one session entry's link in the session tree. `rows` yields that one entry as `r`. Only the links before
|
|
530
|
+
* it count: its parent, an earlier entry of the same id, and the entries whose child it is, whose children it adds
|
|
531
|
+
* to, once. A row linked again gets the same anchor and broken mark, so a session's rows linked in seq order end
|
|
532
|
+
* the same whether a save or the index's rebuild linked them, and whatever links after them were there (#6560).
|
|
527
533
|
*/
|
|
528
534
|
const sessionLink = (rows) => [
|
|
529
|
-
`UPDATE ${t.sessionLinks} SET children = children + 1 FROM ${rows} AS r WHERE ${t.sessionLinks}.session_id = r.session_id AND ${t.sessionLinks}.entry_id = ${parentId} AND ${parentType} = 'text' AND NOT EXISTS (SELECT 1 FROM ${t.sessionLinks} AS own WHERE own.session_id = r.session_id AND own.seq = r.seq)`,
|
|
530
|
-
|
|
535
|
+
`UPDATE ${t.sessionLinks} SET children = children + 1 FROM ${rows} AS r WHERE ${t.sessionLinks}.session_id = r.session_id AND ${t.sessionLinks}.entry_id = ${parentId} AND ${parentType} = 'text' AND +${t.sessionLinks}.seq < r.seq AND NOT EXISTS (SELECT 1 FROM ${t.sessionLinks} AS own WHERE own.session_id = r.session_id AND own.seq = r.seq)`,
|
|
536
|
+
`INSERT INTO ${t.sessionLinks} (session_id, seq, entry_id, parent_id, anchor_seq, children, broken)
|
|
537
|
+
SELECT r.session_id, r.seq, r.entry_id, CASE WHEN ${parentType} = 'text' THEN ${parentId} END, CASE WHEN ${isSnapshot} THEN r.seq ELSE parent.anchor_seq END, 0, CASE WHEN ${ownDuplicate(t.sessionLinks)} THEN 1 WHEN ${parentType} IS NULL OR ${parentType} = 'null' THEN 0 WHEN parent.entry_id IS NOT NULL THEN parent.broken ELSE 1 END FROM ${parentOf(rows)} WHERE true
|
|
538
|
+
ON CONFLICT (session_id, seq) DO UPDATE SET anchor_seq = excluded.anchor_seq, broken = excluded.broken`,
|
|
531
539
|
];
|
|
532
540
|
/** Indexes a snapshot entry's reference and the blobs of its record; any other entry adds nothing. */
|
|
533
541
|
const sessionRecord = (rows) => {
|
|
@@ -586,6 +594,10 @@ function indexSources(prefix, t, d, forkSegments) {
|
|
|
586
594
|
/** One entry as `r`, with its parent named once, so that each statement parses the entry's JSON for it only once. */
|
|
587
595
|
const triggerEntry = `(SELECT ${entryColumns.map((name) => `NEW.${name} AS ${name}`).join(", ")}, ${parentColumns(d, "NEW.entry_json")})`;
|
|
588
596
|
const storedEntry = `(SELECT ${entryColumns.join(", ")}, ${parentColumns(d, "entry_json")} FROM ${entries} WHERE ${d.rowOrder()} = ?)`;
|
|
597
|
+
/** The rows session `?` stores from seq `?` on, as `storedEntry` yields one. */
|
|
598
|
+
const entriesFrom = `(SELECT ${entryColumns.join(", ")}, ${parentColumns(d, "entry_json")} FROM ${entries} WHERE session_id = ? AND seq >= ?)`;
|
|
599
|
+
/** Sets the previous snapshot of the references of `rows` to their parent's anchor: when a pin began stays. */
|
|
600
|
+
const refsAgain = (rows) => `UPDATE ${t.sessionRefs} SET prev_seq = linked.anchor_seq FROM (SELECT r.session_id, r.seq, parent.anchor_seq FROM ${parentOf(rows)} WHERE ${isSnapshot}) AS linked WHERE ${t.sessionRefs}.session_id = linked.session_id AND ${t.sessionRefs}.seq = linked.seq`;
|
|
589
601
|
const indexComplete = entriesIndexComplete(t.sources);
|
|
590
602
|
const newRowOrder = d.rowOrder("NEW");
|
|
591
603
|
const forkLink = (rows) => forkSegments === undefined ? [] : [forkSessionLink(t.sessionLinks, forkSegments, rows, isSnapshot)];
|
|
@@ -615,6 +627,15 @@ function indexSources(prefix, t, d, forkSegments) {
|
|
|
615
627
|
].map((trigger) => withMarker(trigger, ENTRIES_OWN_PROGRESS)),
|
|
616
628
|
backfill: [],
|
|
617
629
|
rowwise: [...sessionLink(storedEntry), ...forkLink(storedEntry), ...sessionRecord(storedEntry)],
|
|
630
|
+
...(forkSegments === undefined ? {} : { segments: forkSegments }),
|
|
631
|
+
entriesFrom,
|
|
632
|
+
relink: {
|
|
633
|
+
link: sessionLink(storedEntry)[1],
|
|
634
|
+
...(forkSegments === undefined ? {} : { fork: forkLink(storedEntry)[0] }),
|
|
635
|
+
// The reference's previous snapshot only: when a pin began stays as its first indexing recorded it.
|
|
636
|
+
refs: refsAgain(storedEntry),
|
|
637
|
+
refsFrom: refsAgain(entriesFrom),
|
|
638
|
+
},
|
|
618
639
|
// The triggers that index degraded pins (#4922). Older builds install theirs under the same names (#5065).
|
|
619
640
|
version: "session-entries@degraded-pins",
|
|
620
641
|
own: ENTRIES_OWN_PROGRESS,
|
|
@@ -643,6 +664,181 @@ function indexSources(prefix, t, d, forkSegments) {
|
|
|
643
664
|
});
|
|
644
665
|
return [eventsSource, runsSource, entriesSource, workSource, rootSource];
|
|
645
666
|
}
|
|
667
|
+
/** The session entries' {@link EntryLinking} of `source`, with the dialect and links table it runs on. */
|
|
668
|
+
function entryLinking(source, dialect, links) {
|
|
669
|
+
return {
|
|
670
|
+
dialect,
|
|
671
|
+
links,
|
|
672
|
+
entries: source.table,
|
|
673
|
+
segments: source.segments,
|
|
674
|
+
statements: source.rowwise,
|
|
675
|
+
relink: source.relink,
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Runs `statements` in order, each sent without waiting for the answer to the one before: a database runs a
|
|
680
|
+
* connection's calls in the order they are made, and a pipelined connection sends them together.
|
|
681
|
+
*/
|
|
682
|
+
async function runInOrder(executor, statements) {
|
|
683
|
+
await Promise.all(statements.map(({ sql, params }) => executor.run(sql, ...params)));
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Links the rows session `sessionId` stores from seq `fromSeq` on again, in seq order, each behind the rows before it
|
|
687
|
+
* (#6560), then counts their children again: an entry's children are the rows after it in the session whose parent
|
|
688
|
+
* has its id. A materialization runs it once it copied rows in below the rows a fork appended, and the index's rebuild
|
|
689
|
+
* when it meets a row stored before rows below it: both link every row as a save in seq order did.
|
|
690
|
+
*/
|
|
691
|
+
async function relinkSessionEntries(executor, linking, sessionId, fromSeq) {
|
|
692
|
+
const { dialect, links, entries, segments, statements, relink } = linking;
|
|
693
|
+
const rows = await executor.all(`SELECT ${dialect.rowOrder("e")} AS id,
|
|
694
|
+
CASE WHEN EXISTS (SELECT 1 FROM ${links} AS l WHERE l.session_id = e.session_id AND l.seq = e.seq) THEN 1 ELSE 0 END AS linked,
|
|
695
|
+
CASE WHEN ${dialect.contains("e.entry_json", `'"worktree_snapshot"'`)} THEN 1 ELSE 0 END AS snapshot
|
|
696
|
+
FROM ${entries} AS e WHERE e.session_id = ? AND e.seq >= ? ORDER BY e.seq`, sessionId, fromSeq);
|
|
697
|
+
const forked = segments !== undefined &&
|
|
698
|
+
relink.fork !== undefined &&
|
|
699
|
+
(await executor.get(`SELECT 1 AS found FROM ${segments} WHERE session_id = ? LIMIT 1`, sessionId)) !== undefined;
|
|
700
|
+
// A row not linked yet gets every statement; one linked already only those that write its link and reference again.
|
|
701
|
+
const again = (snapshot) => [
|
|
702
|
+
relink.link,
|
|
703
|
+
...(forked ? [relink.fork] : []),
|
|
704
|
+
...(snapshot ? [relink.refs] : []),
|
|
705
|
+
];
|
|
706
|
+
await runInOrder(executor, rows.flatMap(({ id, linked, snapshot }) => (Number(linked) === 1 ? again(Number(snapshot) === 1) : statements).map((sql) => ({ sql, params: [id] }))));
|
|
707
|
+
const linked = await executor.all(`SELECT seq, entry_id, parent_id, children FROM ${links} WHERE session_id = ? AND seq >= ? ORDER BY seq DESC`, sessionId, fromSeq);
|
|
708
|
+
const later = new Map();
|
|
709
|
+
const counts = [];
|
|
710
|
+
for (const link of linked) {
|
|
711
|
+
const children = later.get(link.entry_id) ?? 0;
|
|
712
|
+
if (Number(link.children) !== children)
|
|
713
|
+
counts.push({
|
|
714
|
+
sql: `UPDATE ${links} SET children = ? WHERE session_id = ? AND seq = ?`,
|
|
715
|
+
params: [children, sessionId, Number(link.seq)],
|
|
716
|
+
});
|
|
717
|
+
if (link.parent_id !== null)
|
|
718
|
+
later.set(link.parent_id, (later.get(link.parent_id) ?? 0) + 1);
|
|
719
|
+
}
|
|
720
|
+
await runInOrder(executor, counts);
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Links, in seq order, every row session `sessionId` stores up to seq `seq` that is not linked yet, behind the rows of
|
|
724
|
+
* its sources that its segments before `seq` name, which are linked first, the same way. Where the session has a row
|
|
725
|
+
* linked already after the first row this links, the rows after it are linked again with it (see
|
|
726
|
+
* {@link relinkSessionEntries}). A session linked this way has every row before a linked row linked, so the link of a
|
|
727
|
+
* segment's last row tells that its source is linked through it.
|
|
728
|
+
*/
|
|
729
|
+
async function linkThrough(executor, linking, sessionId, seq) {
|
|
730
|
+
const { dialect, links, entries, segments, statements } = linking;
|
|
731
|
+
const sources = async (through) => {
|
|
732
|
+
if (segments === undefined)
|
|
733
|
+
return;
|
|
734
|
+
const pending = await executor.all(`SELECT seg.source_id, seg.to_seq FROM ${segments} AS seg WHERE seg.session_id = ? AND seg.base_seq < ? AND NOT EXISTS (SELECT 1 FROM ${links} AS l WHERE l.session_id = seg.source_id AND l.seq = seg.to_seq) ORDER BY seg.base_seq`, sessionId, through);
|
|
735
|
+
for (const segment of pending)
|
|
736
|
+
await linkThrough(executor, linking, segment.source_id, Number(segment.to_seq));
|
|
737
|
+
};
|
|
738
|
+
await sources(seq);
|
|
739
|
+
const first = await executor.get(`SELECT f.seq, CASE WHEN EXISTS (SELECT 1 FROM ${links} AS l WHERE l.session_id = ? AND l.seq > f.seq) THEN 1 ELSE 0 END AS later
|
|
740
|
+
FROM (SELECT min(e.seq) AS seq FROM ${entries} AS e WHERE e.session_id = ? AND e.seq <= ? AND NOT EXISTS (SELECT 1 FROM ${links} AS l WHERE l.session_id = e.session_id AND l.seq = e.seq)) AS f`, sessionId, sessionId, seq);
|
|
741
|
+
if (first?.seq === null || first?.seq === undefined)
|
|
742
|
+
return;
|
|
743
|
+
if (Number(first.later) === 1) {
|
|
744
|
+
// The rows after it were linked before it: they are linked again, behind it.
|
|
745
|
+
await relinkFrom(executor, linking, sessionId, Number(first.seq));
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
const rows = await executor.all(`SELECT ${dialect.rowOrder()} AS id FROM ${entries} WHERE session_id = ? AND seq >= ? AND seq <= ? ORDER BY seq`, sessionId, Number(first.seq), seq);
|
|
749
|
+
await runInOrder(executor, rows.flatMap(({ id }) => statements.map((sql) => ({ sql, params: [id] }))));
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Links the rows session `sessionId` stores from seq `fromSeq` on again, behind the rows of the sources its segments
|
|
753
|
+
* name, and then the rows of every session that reads them through a segment and has a row linked after them: such a
|
|
754
|
+
* row took its parent's link, or its anchor, from the rows linked again (#6560).
|
|
755
|
+
*/
|
|
756
|
+
async function relinkFrom(executor, linking, sessionId, fromSeq) {
|
|
757
|
+
const { links, segments } = linking;
|
|
758
|
+
if (segments !== undefined) {
|
|
759
|
+
const pending = await executor.all(`SELECT seg.source_id, seg.to_seq FROM ${segments} AS seg WHERE seg.session_id = ? AND NOT EXISTS (SELECT 1 FROM ${links} AS l WHERE l.session_id = seg.source_id AND l.seq = seg.to_seq) ORDER BY seg.base_seq`, sessionId);
|
|
760
|
+
for (const segment of pending)
|
|
761
|
+
await linkThrough(executor, linking, segment.source_id, Number(segment.to_seq));
|
|
762
|
+
}
|
|
763
|
+
await relinkSessionEntries(executor, linking, sessionId, fromSeq);
|
|
764
|
+
if (segments === undefined)
|
|
765
|
+
return;
|
|
766
|
+
const readers = await executor.all(`SELECT seg.session_id, min(seg.base_seq + 1 + CASE WHEN seg.from_seq < ? THEN ? - seg.from_seq ELSE 0 END) AS first
|
|
767
|
+
FROM ${segments} AS seg WHERE seg.source_id = ? AND seg.to_seq >= ? GROUP BY seg.session_id ORDER BY seg.session_id`, fromSeq, fromSeq, sessionId, fromSeq);
|
|
768
|
+
for (const reader of readers) {
|
|
769
|
+
const linked = await executor.get(`SELECT 1 AS found FROM ${links} WHERE session_id = ? AND seq >= ? LIMIT 1`, reader.session_id, Number(reader.first));
|
|
770
|
+
if (linked !== undefined)
|
|
771
|
+
await relinkFrom(executor, linking, reader.session_id, Number(reader.first));
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Indexes the stored entry at row order `id`, as the index's backfill meets it. The backfill goes in row order, but a
|
|
776
|
+
* fork that copied in the rows it read stores them after the entries it appended, and a fork moved onto another
|
|
777
|
+
* session's copy reads rows stored after its own (#6560): a row with a row before it, of its session or of a source
|
|
778
|
+
* its segments name, not linked yet, or with a row after it linked already, is linked by {@link linkThrough}, so every
|
|
779
|
+
* row is linked behind the rows before it in its view, as a save links it.
|
|
780
|
+
*/
|
|
781
|
+
async function linkStoredEntry(executor, linking, id) {
|
|
782
|
+
const { dialect, links, entries, segments, statements } = linking;
|
|
783
|
+
const pendingSource = segments === undefined
|
|
784
|
+
? "0"
|
|
785
|
+
: `CASE WHEN EXISTS (SELECT 1 FROM ${segments} AS seg WHERE seg.session_id = e.session_id AND seg.base_seq < e.seq AND NOT EXISTS (SELECT 1 FROM ${links} AS l WHERE l.session_id = seg.source_id AND l.seq = seg.to_seq)) THEN 1 ELSE 0 END`;
|
|
786
|
+
const row = await executor.get(`SELECT e.session_id, e.seq,
|
|
787
|
+
CASE WHEN EXISTS (SELECT 1 FROM ${links} AS l WHERE l.session_id = e.session_id AND l.seq = e.seq) THEN 1 ELSE 0 END AS linked,
|
|
788
|
+
CASE WHEN EXISTS (SELECT 1 FROM ${links} AS l WHERE l.session_id = e.session_id AND l.seq > e.seq) THEN 1 ELSE 0 END AS later,
|
|
789
|
+
(SELECT max(p.seq) FROM ${entries} AS p WHERE p.session_id = e.session_id AND p.seq < e.seq) AS previous,
|
|
790
|
+
(SELECT max(l.seq) FROM ${links} AS l WHERE l.session_id = e.session_id AND l.seq < e.seq) AS linked_before,
|
|
791
|
+
${pendingSource} AS pending_source
|
|
792
|
+
FROM ${entries} AS e WHERE ${dialect.rowOrder("e")} = ?`, id);
|
|
793
|
+
const inOrder = row === undefined ||
|
|
794
|
+
Number(row.linked) === 1 ||
|
|
795
|
+
(Number(row.later) === 0 &&
|
|
796
|
+
Number(row.pending_source) === 0 &&
|
|
797
|
+
(row.previous === null || (row.linked_before !== null && Number(row.linked_before) === Number(row.previous))));
|
|
798
|
+
if (inOrder)
|
|
799
|
+
for (const sql of statements)
|
|
800
|
+
await executor.run(sql, id);
|
|
801
|
+
else
|
|
802
|
+
await linkThrough(executor, linking, row.session_id, Number(row.seq));
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* The {@link SessionEntryLinks} of a session store under `prefix` whose fork segments table is `forkSegments` (#6560).
|
|
806
|
+
* Until the index's backfill of the session entries is done, which links the rows in seq order itself, `settle` only
|
|
807
|
+
* writes the segments.
|
|
808
|
+
*/
|
|
809
|
+
export function sessionEntryLinks(prefix, dialect, forkSegments) {
|
|
810
|
+
const t = snapshotIndexTables(prefix);
|
|
811
|
+
const source = indexSources(prefix, t, dialect, forkSegments).find((source) => source.name === "session-entries");
|
|
812
|
+
const linking = entryLinking(source, dialect, t.sessionLinks);
|
|
813
|
+
const complete = entriesIndexComplete(t.sources);
|
|
814
|
+
const tables = { links: t.sessionLinks, segments: forkSegments, refs: t.sessionRefs };
|
|
815
|
+
const materializePlain = dialect.name === "postgres";
|
|
816
|
+
const checkWithSegments = forkLinksCheck(tables, complete, { hasSegments: true });
|
|
817
|
+
const checkWithoutSegments = forkLinksCheck(tables, complete, {
|
|
818
|
+
hasSegments: false,
|
|
819
|
+
materialize: materializePlain,
|
|
820
|
+
});
|
|
821
|
+
return {
|
|
822
|
+
materialized: materializedForkLinks(t.sessionLinks, forkSegments, complete, dialect.types.int, dialect.name),
|
|
823
|
+
async settle(executor, sessionId, fromSeq, before, hasSegments = true) {
|
|
824
|
+
const [, verdict] = await Promise.all([
|
|
825
|
+
runInOrder(executor, before),
|
|
826
|
+
hasSegments
|
|
827
|
+
? executor.get(checkWithSegments, sessionId, sessionId, fromSeq, sessionId, fromSeq)
|
|
828
|
+
: materializePlain
|
|
829
|
+
? executor.get(checkWithoutSegments, sessionId, fromSeq, sessionId, fromSeq)
|
|
830
|
+
: executor.get(checkWithoutSegments, sessionId, fromSeq, sessionId, fromSeq, sessionId, fromSeq),
|
|
831
|
+
]);
|
|
832
|
+
if (verdict === undefined)
|
|
833
|
+
return;
|
|
834
|
+
const children = Number(verdict.children) === 1;
|
|
835
|
+
if (verdict.seq !== null || children)
|
|
836
|
+
await relinkFrom(executor, linking, sessionId, children ? fromSeq : Number(verdict.seq));
|
|
837
|
+
if (verdict.seq !== null || children || Number(verdict.refs) === 1)
|
|
838
|
+
await executor.run(linking.relink.refsFrom, sessionId, fromSeq);
|
|
839
|
+
},
|
|
840
|
+
};
|
|
841
|
+
}
|
|
646
842
|
/**
|
|
647
843
|
* Creates a chunk table named `table` unless it exists. An ordinary table, whose primary key is an index of its own:
|
|
648
844
|
* a lookup reads that small index, then only the row it finds. A `WITHOUT ROWID` table, as earlier releases created,
|
|
@@ -695,7 +891,9 @@ async function addBlobChunks(transaction, t, dialect) {
|
|
|
695
891
|
* Creates the blob table and the tables of its reference index that are missing, reading what each step needs
|
|
696
892
|
* together, so on a SQLite file connection the setup waits for the connection's thread three times.
|
|
697
893
|
*/
|
|
698
|
-
async function createSnapshotIndexTables(transaction, t, prefix, dialect
|
|
894
|
+
async function createSnapshotIndexTables(transaction, t, prefix, dialect,
|
|
895
|
+
/** Statements that run with the tables' own, in the same request: such as a ledger record of what they create. */
|
|
896
|
+
after = []) {
|
|
699
897
|
const { int, text, blob } = dialect.types;
|
|
700
898
|
const strict = dialect.tableOptions;
|
|
701
899
|
const keyed = dialect.withoutRowidTableOptions;
|
|
@@ -713,7 +911,7 @@ async function createSnapshotIndexTables(transaction, t, prefix, dialect) {
|
|
|
713
911
|
CREATE TABLE IF NOT EXISTS ${t.sessionRefs} (session_id ${text} NOT NULL, seq ${int} NOT NULL, root ${text} NOT NULL, snapshot_id ${text} NOT NULL, prev_seq ${int}, restore_from ${text}, restore_to ${text}, degraded_from ${text}, degraded_since ${int}, PRIMARY KEY (session_id, seq))${keyed};
|
|
714
912
|
CREATE TABLE IF NOT EXISTS ${t.sessionLinks} (session_id ${text} NOT NULL, seq ${int} NOT NULL, entry_id ${text} NOT NULL, parent_id ${text}, anchor_seq ${int}, children ${int} NOT NULL, broken ${int} NOT NULL, PRIMARY KEY (session_id, seq))${strict};
|
|
715
913
|
CREATE INDEX IF NOT EXISTS ${t.sessionLinks}_entry ON ${t.sessionLinks} (session_id, entry_id);
|
|
716
|
-
|
|
914
|
+
${sessionLinksLeafIndex(t, dialect)};
|
|
717
915
|
CREATE INDEX IF NOT EXISTS ${t.sessionLinks}_broken ON ${t.sessionLinks} (session_id) WHERE broken = 1;
|
|
718
916
|
CREATE TABLE IF NOT EXISTS ${t.sessionRecords} (session_id ${text} NOT NULL, seq ${int} NOT NULL, snapshot_id ${text} NOT NULL, hash ${text} NOT NULL, PRIMARY KEY (session_id, seq, hash))${keyed};
|
|
719
917
|
CREATE INDEX IF NOT EXISTS ${t.sessionRecords}_hash ON ${t.sessionRecords} (hash);
|
|
@@ -722,6 +920,7 @@ async function createSnapshotIndexTables(transaction, t, prefix, dialect) {
|
|
|
722
920
|
CREATE TABLE IF NOT EXISTS ${t.collection} (id ${int} PRIMARY KEY CHECK (id = 1), claimed_at ${int}, holder ${text}, finished_at ${int}, deleted ${int}, error_code ${text})${strict};
|
|
723
921
|
INSERT INTO ${t.collection} (id) VALUES (1) ON CONFLICT DO NOTHING;
|
|
724
922
|
CREATE TABLE IF NOT EXISTS ${t.sources} (source ${text} PRIMARY KEY, watermark ${int} NOT NULL, backfilled_through ${int} NOT NULL)${keyed};
|
|
923
|
+
${after.map((statement) => `${statement};`).join("\n")}
|
|
725
924
|
`,
|
|
726
925
|
chunkTableDefinition(t.blobChunks, dialect),
|
|
727
926
|
], [...blobChunkProbes(transaction, t, dialect), ...sessionRefColumnProbes(transaction, t, dialect)]);
|
|
@@ -741,6 +940,124 @@ function blobMaintenanceIndexes(t) {
|
|
|
741
940
|
async function addBlobMaintenanceIndexes(transaction, t) {
|
|
742
941
|
await statementBatch(transaction, blobMaintenanceIndexes(t), []);
|
|
743
942
|
}
|
|
943
|
+
/**
|
|
944
|
+
* The ledger step, `schema:snapshot-links-hot`, after which the session links table has no index that names
|
|
945
|
+
* `children` on PostgreSQL ({@link hotSessionLinks}).
|
|
946
|
+
*/
|
|
947
|
+
const SESSION_LINKS_HOT_DOMAIN = "snapshot-links-hot";
|
|
948
|
+
function sessionLinksHotSchema(prefix) {
|
|
949
|
+
return { ledger: storageMigrationTable(prefix), domain: SESSION_LINKS_HOT_DOMAIN, revision: 1 };
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* The index the queries for the session tree's leaves read: on PostgreSQL every link with an anchor, whose leaves they
|
|
953
|
+
* pick by `children = 0` ({@link hotSessionLinks}); elsewhere only the leaves with an anchor.
|
|
954
|
+
*/
|
|
955
|
+
function sessionLinksLeafIndex(t, dialect) {
|
|
956
|
+
return dialect.name === "postgres"
|
|
957
|
+
? `CREATE INDEX IF NOT EXISTS ${t.sessionLinks}_anchored ON ${t.sessionLinks} (session_id, anchor_seq) WHERE anchor_seq IS NOT NULL`
|
|
958
|
+
: `CREATE INDEX IF NOT EXISTS ${t.sessionLinks}_leaves ON ${t.sessionLinks} (session_id, anchor_seq) WHERE children = 0 AND anchor_seq IS NOT NULL`;
|
|
959
|
+
}
|
|
960
|
+
/** The ledger record of {@link hotSessionLinks}, for a database whose links table this transaction created with it. */
|
|
961
|
+
function hotSessionLinksRecord(prefix, dialect) {
|
|
962
|
+
const { ledger, domain, revision } = sessionLinksHotSchema(prefix);
|
|
963
|
+
return `INSERT INTO ${ledger} (domain, version, applied_at) VALUES ('schema:${domain}', ${revision}, ${dialect.nowMs}) ON CONFLICT DO NOTHING`;
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Makes the update each append writes to its parent's session link a HOT update on PostgreSQL: one that stays on its
|
|
967
|
+
* page and writes no index entry. Each append raises its parent link's `children`, and PostgreSQL updates a row in
|
|
968
|
+
* place only when no index names a changed column, its condition included, which `_leaves` (`WHERE children = 0`)
|
|
969
|
+
* did. So every append wrote the parent link's new version into each of the table's indexes. `_anchored` indexes the
|
|
970
|
+
* same rows without that condition, and the queries for leaves, which only collection runs, check `children = 0` on
|
|
971
|
+
* the rows it finds. Older builds read and write the table as before, and none of them creates `_leaves` again: on
|
|
972
|
+
* PostgreSQL the step that creates it runs once per database. Recorded in the ledger, so it runs once. SQLite keeps
|
|
973
|
+
* `_leaves`, as it updates rows in place whatever their indexes.
|
|
974
|
+
*/
|
|
975
|
+
async function hotSessionLinks(transaction, t, prefix, dialect) {
|
|
976
|
+
await ensureStorageSchema(transaction, dialect, sessionLinksHotSchema(prefix), async () => {
|
|
977
|
+
await transaction.exec(sessionLinksLeafIndex(t, dialect));
|
|
978
|
+
await transaction.exec(`DROP INDEX IF EXISTS ${t.sessionLinks}_leaves`);
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
/** This process's check of {@link hotSessionLinks} for each database, ledger and links table, while it holds. */
|
|
982
|
+
const hotSessionLinksChecks = new Map();
|
|
983
|
+
/**
|
|
984
|
+
* Runs {@link hotSessionLinks} on a PostgreSQL database whose ledger lacks it, in a transaction of its own. Nothing runs
|
|
985
|
+
* where the catalog the open read records it, or where this role does not own the links table: a runtime role without
|
|
986
|
+
* DDL opens as before, and `atomic storage migrate`, run as the owner, makes the change. A role that does not own the
|
|
987
|
+
* table finds that out once per process, as for the fillfactor steps.
|
|
988
|
+
*/
|
|
989
|
+
async function ensureHotSessionLinks(database, t, prefix) {
|
|
990
|
+
const dialect = dialectOf(database);
|
|
991
|
+
if (dialect.name !== "postgres" || database.readOnly === true)
|
|
992
|
+
return;
|
|
993
|
+
const schema = sessionLinksHotSchema(prefix);
|
|
994
|
+
if (await storageSchemaCurrent(database, schema))
|
|
995
|
+
return;
|
|
996
|
+
const identity = database.databaseIdentity?.();
|
|
997
|
+
if (identity === undefined) {
|
|
998
|
+
await checkHotSessionLinks(database, t, prefix);
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
1001
|
+
const key = JSON.stringify([identity, schema.ledger, t.sessionLinks]);
|
|
1002
|
+
let check = hotSessionLinksChecks.get(key);
|
|
1003
|
+
if (check === undefined) {
|
|
1004
|
+
const made = checkHotSessionLinks(database, t, prefix);
|
|
1005
|
+
check = made;
|
|
1006
|
+
hotSessionLinksChecks.set(key, made);
|
|
1007
|
+
const forget = () => {
|
|
1008
|
+
if (hotSessionLinksChecks.get(key) === made)
|
|
1009
|
+
hotSessionLinksChecks.delete(key);
|
|
1010
|
+
};
|
|
1011
|
+
made.then((settled) => {
|
|
1012
|
+
if (!settled)
|
|
1013
|
+
forget();
|
|
1014
|
+
}, forget);
|
|
1015
|
+
}
|
|
1016
|
+
await check;
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* The largest links table, in bytes, an open builds {@link hotSessionLinks}'s index for in its own transaction, which
|
|
1020
|
+
* holds the table's writes for the build: about 150,000 links, a fraction of a second. A larger one is left to `atomic
|
|
1021
|
+
* storage migrate`, which builds the index without holding them ({@link SqlSnapshotBlobStore.buildHotSessionLinksIndex}).
|
|
1022
|
+
*/
|
|
1023
|
+
const HOT_SESSION_LINKS_OPEN_BUILD_BYTES = 16 * 1024 * 1024;
|
|
1024
|
+
/** How often {@link SqlSnapshotBlobStore.buildHotSessionLinksIndex} looks again at an index build another process runs. */
|
|
1025
|
+
const HOT_SESSION_LINKS_BUILD_POLL_MS = 500;
|
|
1026
|
+
/** The links table's owner, size and `_anchored` index, in one read; `undefined` when the table does not exist. */
|
|
1027
|
+
async function sessionLinksState(database, t, dialect) {
|
|
1028
|
+
const row = await database.get(`SELECT pg_catalog.pg_has_role(current_user, c.relowner, 'USAGE') AS owned, pg_catalog.pg_relation_size(c.oid) AS bytes,
|
|
1029
|
+
(SELECT x.indisvalid FROM pg_catalog.pg_index x JOIN pg_catalog.pg_class i ON i.oid = x.indexrelid
|
|
1030
|
+
WHERE x.indrelid = c.oid AND i.relname = ?) AS anchored,
|
|
1031
|
+
EXISTS (SELECT 1 FROM pg_catalog.pg_stat_progress_create_index p WHERE p.relid = c.oid) AS building
|
|
1032
|
+
FROM pg_catalog.pg_class c WHERE c.relnamespace = current_schema()::regnamespace AND c.relname = ?`, dialect.identifier(`${t.sessionLinks}_anchored`), dialect.identifier(t.sessionLinks));
|
|
1033
|
+
if (row === undefined)
|
|
1034
|
+
return undefined;
|
|
1035
|
+
const yes = (value) => value === true || Number(value) === 1;
|
|
1036
|
+
return {
|
|
1037
|
+
owned: yes(row.owned),
|
|
1038
|
+
bytes: Number(row.bytes),
|
|
1039
|
+
anchored: row.anchored === null ? undefined : yes(row.anchored),
|
|
1040
|
+
building: yes(row.building),
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Runs {@link hotSessionLinks} where this role owns a small links table; true when this process need not check again.
|
|
1045
|
+
* A large table, or one whose `_anchored` index a build of `atomic storage migrate` left unfinished or is making now,
|
|
1046
|
+
* is left to `atomic storage migrate`.
|
|
1047
|
+
*/
|
|
1048
|
+
async function checkHotSessionLinks(database, t, prefix) {
|
|
1049
|
+
const dialect = dialectOf(database);
|
|
1050
|
+
const found = await sessionLinksState(database, t, dialect);
|
|
1051
|
+
if (found === undefined)
|
|
1052
|
+
return false;
|
|
1053
|
+
if (!found.owned || found.bytes > HOT_SESSION_LINKS_OPEN_BUILD_BYTES || found.anchored === false || found.building)
|
|
1054
|
+
return true;
|
|
1055
|
+
await database.transaction((transaction) => hotSessionLinks(transaction, t, prefix, dialect), {
|
|
1056
|
+
retryTransientFailures: true,
|
|
1057
|
+
concurrency: { kind: "serial", domain: sessionLinksHotSchema(prefix).ledger },
|
|
1058
|
+
});
|
|
1059
|
+
return false;
|
|
1060
|
+
}
|
|
744
1061
|
/** The columns of {@link SnapshotIndexTables.sessionRefs} that later builds added, with their types. */
|
|
745
1062
|
const SESSION_REF_COLUMNS = ["prev_seq", "restore_from", "restore_to", "degraded_from", "degraded_since"];
|
|
746
1063
|
/** Whether the session references have each of {@link SESSION_REF_COLUMNS}, in its order. */
|
|
@@ -830,7 +1147,7 @@ async function installSource(transaction, dialect, t, source, reset) {
|
|
|
830
1147
|
}
|
|
831
1148
|
/**
|
|
832
1149
|
* Whether this build writes `source`'s {@link IndexSource.version} row only once its own backfill of the source is done:
|
|
833
|
-
* on SQLite
|
|
1150
|
+
* on SQLite, which builds before 0.9.88 also open (#5558).
|
|
834
1151
|
*/
|
|
835
1152
|
function withholdsVersion(dialect, source) {
|
|
836
1153
|
return dialect.name === "sqlite" && source.version !== undefined && source.own !== undefined;
|
|
@@ -868,7 +1185,7 @@ function sourceProgressRead(t) {
|
|
|
868
1185
|
async function readSourceStates(executor, dialect, t, sources, listRetired = false, present, also) {
|
|
869
1186
|
// `also` asks, in the same statement, which of other objects exist, as `also.found` tells.
|
|
870
1187
|
const names = [...sourceObjectNames(sources), ...(also?.names ?? [])];
|
|
871
|
-
// Builds before 0.9.88 open SQLite
|
|
1188
|
+
// Builds before 0.9.88 open SQLite databases only, so only there can a trigger of this build's name be
|
|
872
1189
|
// one that indexes less.
|
|
873
1190
|
const sqlite = dialect.name === "sqlite";
|
|
874
1191
|
const signatures = sqlite ? sources.flatMap((source) => source.signature ?? []) : [];
|
|
@@ -996,11 +1313,16 @@ export class SqlSnapshotBlobStore {
|
|
|
996
1313
|
/**
|
|
997
1314
|
* Opens the blob table and its reference index, creating the tables that are missing in their own transaction, such
|
|
998
1315
|
* as those an index written by an earlier build lacks, and indexes referencing tables created since. A store whose
|
|
999
|
-
* tables and index exist opens without the write lock.
|
|
1316
|
+
* tables and index exist opens without the write lock. On SQLite inside an open scope (`withStorageSchemaCatalog`),
|
|
1317
|
+
* table creation and index installation queue into the open's single write transaction (#6709).
|
|
1000
1318
|
*/
|
|
1001
|
-
static
|
|
1319
|
+
static open(database, prefix = "") {
|
|
1320
|
+
return withStorageSchemaCatalog(database, storageMigrationTable(prefix), () => SqlSnapshotBlobStore.openWithCatalog(database, prefix));
|
|
1321
|
+
}
|
|
1322
|
+
static async openWithCatalog(database, prefix) {
|
|
1002
1323
|
const t = snapshotIndexTables(prefix);
|
|
1003
1324
|
const dialect = dialectOf(database);
|
|
1325
|
+
const ledger = storageMigrationTable(prefix);
|
|
1004
1326
|
const columns = [
|
|
1005
1327
|
[t.blobs, "created_at"],
|
|
1006
1328
|
[t.blobs, "chunks"],
|
|
@@ -1012,6 +1334,9 @@ export class SqlSnapshotBlobStore {
|
|
|
1012
1334
|
...columns.map(([table, column]) => dialect.columnExists(table, column)),
|
|
1013
1335
|
dialect.schemaObjects(triggers),
|
|
1014
1336
|
];
|
|
1337
|
+
const tablesPresent = (found) => Object.values(t).every((table) => found.hasTable(table)) &&
|
|
1338
|
+
columns.every(([table, column]) => found.hasColumn(table, column)) &&
|
|
1339
|
+
triggers.some((trigger) => found.hasObject(trigger));
|
|
1015
1340
|
// One catalog read answers the schema questions where an open read it (#6560): always on Postgres, at the first
|
|
1016
1341
|
// question on SQLite.
|
|
1017
1342
|
const catalog = await schemaCatalogOf(database);
|
|
@@ -1027,15 +1352,145 @@ export class SqlSnapshotBlobStore {
|
|
|
1027
1352
|
const current = dialect.versionedMigrations
|
|
1028
1353
|
? false
|
|
1029
1354
|
: catalog !== undefined
|
|
1030
|
-
?
|
|
1031
|
-
columns.every(([table, column]) => catalog.hasColumn(table, column)) &&
|
|
1032
|
-
triggers.some((trigger) => catalog.hasObject(trigger))
|
|
1355
|
+
? tablesPresent(catalog)
|
|
1033
1356
|
: (await Promise.all(probes.map((probe) => database.get(probe.sql, ...probe.params)))).every((row) => row !== undefined);
|
|
1357
|
+
// On SQLite inside an open scope, when the snapshot tables are missing or incomplete, queue both table creation
|
|
1358
|
+
// and source index trigger installation into the open's single write transaction without reading uncommitted tables
|
|
1359
|
+
// beforehand (#6709).
|
|
1360
|
+
if (!current && !dialect.versionedMigrations && catalog !== undefined) {
|
|
1361
|
+
const needsReset = catalog.hasTable(t.sessionLinks) || catalog.hasTable(t.sessionRefs) || catalog.hasTable(t.sessionRecords);
|
|
1362
|
+
const reset = needsReset ? await SqlSnapshotBlobStore.prepareSessionIndexReset(database) : undefined;
|
|
1363
|
+
const store = new SqlSnapshotBlobStore(database, dialect, t, indexSources(prefix, t, dialect, (await shared) ? segments : undefined), segments);
|
|
1364
|
+
const enqueueFreshTables = (ctx, sharedNow) => {
|
|
1365
|
+
const { int, text, blob } = dialect.types;
|
|
1366
|
+
const strict = dialect.tableOptions;
|
|
1367
|
+
const keyed = dialect.withoutRowidTableOptions;
|
|
1368
|
+
const guard = sharedNow ? [forkInheritedBlobGuard(dialect, t, segments).replace(/;\s*$/, "")] : [];
|
|
1369
|
+
ctx.enqueue(`CREATE TABLE IF NOT EXISTS ${t.blobs} (hash ${text} PRIMARY KEY, bytes ${int} NOT NULL, data ${blob} NOT NULL, created_at ${int} NOT NULL DEFAULT (${dialect.nowSeconds}))${strict}`);
|
|
1370
|
+
ctx.enqueue(`
|
|
1371
|
+
CREATE TABLE IF NOT EXISTS ${t.runRefs} (run_id ${text} NOT NULL, hash ${text} NOT NULL, PRIMARY KEY (run_id, hash))${keyed};
|
|
1372
|
+
CREATE INDEX IF NOT EXISTS ${t.runRefs}_hash ON ${t.runRefs} (hash);
|
|
1373
|
+
CREATE TABLE IF NOT EXISTS ${t.runState} (run_id ${text} PRIMARY KEY, retained ${int} NOT NULL, seq ${int} NOT NULL)${keyed};
|
|
1374
|
+
CREATE TABLE IF NOT EXISTS ${t.sessionRefs} (session_id ${text} NOT NULL, seq ${int} NOT NULL, root ${text} NOT NULL, snapshot_id ${text} NOT NULL, prev_seq ${int}, restore_from ${text}, restore_to ${text}, degraded_from ${text}, degraded_since ${int}, PRIMARY KEY (session_id, seq))${keyed};
|
|
1375
|
+
CREATE TABLE IF NOT EXISTS ${t.sessionLinks} (session_id ${text} NOT NULL, seq ${int} NOT NULL, entry_id ${text} NOT NULL, parent_id ${text}, anchor_seq ${int}, children ${int} NOT NULL, broken ${int} NOT NULL, PRIMARY KEY (session_id, seq))${strict};
|
|
1376
|
+
CREATE INDEX IF NOT EXISTS ${t.sessionLinks}_entry ON ${t.sessionLinks} (session_id, entry_id);
|
|
1377
|
+
${sessionLinksLeafIndex(t, dialect)};
|
|
1378
|
+
CREATE INDEX IF NOT EXISTS ${t.sessionLinks}_broken ON ${t.sessionLinks} (session_id) WHERE broken = 1;
|
|
1379
|
+
CREATE TABLE IF NOT EXISTS ${t.sessionRecords} (session_id ${text} NOT NULL, seq ${int} NOT NULL, snapshot_id ${text} NOT NULL, hash ${text} NOT NULL, PRIMARY KEY (session_id, seq, hash))${keyed};
|
|
1380
|
+
CREATE INDEX IF NOT EXISTS ${t.sessionRecords}_hash ON ${t.sessionRecords} (hash);
|
|
1381
|
+
CREATE TABLE IF NOT EXISTS ${t.carriedRefs} (owner ${text} NOT NULL, hash ${text} NOT NULL, PRIMARY KEY (owner, hash))${keyed};
|
|
1382
|
+
CREATE INDEX IF NOT EXISTS ${t.carriedRefs}_hash ON ${t.carriedRefs} (hash);
|
|
1383
|
+
CREATE TABLE IF NOT EXISTS ${t.collection} (id ${int} PRIMARY KEY CHECK (id = 1), claimed_at ${int}, holder ${text}, finished_at ${int}, deleted ${int}, error_code ${text})${strict};
|
|
1384
|
+
INSERT INTO ${t.collection} (id) VALUES (1) ON CONFLICT DO NOTHING;
|
|
1385
|
+
CREATE TABLE IF NOT EXISTS ${t.sources} (source ${text} PRIMARY KEY, watermark ${int} NOT NULL, backfilled_through ${int} NOT NULL)${keyed};
|
|
1386
|
+
${guard.map((statement) => `${statement};`).join("\n")}
|
|
1387
|
+
`);
|
|
1388
|
+
ctx.enqueue(chunkTableDefinition(t.blobChunks, dialect));
|
|
1389
|
+
for (const write of [...blobChunkWrites(t, dialect, [false, false]), ...blobMaintenanceIndexes(t)]) {
|
|
1390
|
+
if (write !== false && write !== undefined)
|
|
1391
|
+
ctx.enqueue(write);
|
|
1392
|
+
}
|
|
1393
|
+
for (const table of Object.values(t))
|
|
1394
|
+
ctx.noteTableCreated(table);
|
|
1395
|
+
};
|
|
1396
|
+
const queued = queueSqliteSchemaSetup(database, ledger, {
|
|
1397
|
+
done: async (freshCatalog) => {
|
|
1398
|
+
if (!tablesPresent(freshCatalog))
|
|
1399
|
+
return false;
|
|
1400
|
+
const sharedNow = freshCatalog.hasTable(segments);
|
|
1401
|
+
if (sharedNow && !freshCatalog.hasObject(forkInheritedBlobGuardName(t.blobs)))
|
|
1402
|
+
return false;
|
|
1403
|
+
const sourcesNow = indexSources(prefix, t, dialect, sharedNow ? segments : undefined);
|
|
1404
|
+
const legacy = store.legacyForkLinks();
|
|
1405
|
+
const foundLegacy = new Set();
|
|
1406
|
+
const states = await readSourceStates(database, dialect, t, sourcesNow, false, undefined, legacy && { names: [legacy.name], found: foundLegacy });
|
|
1407
|
+
if (legacy !== undefined && foundLegacy.has(legacy.name))
|
|
1408
|
+
return false;
|
|
1409
|
+
if (states.some((state) => !state.installed && !state.deferred))
|
|
1410
|
+
return false;
|
|
1411
|
+
store.sources = sourcesNow;
|
|
1412
|
+
return true;
|
|
1413
|
+
},
|
|
1414
|
+
run: async (ctx) => {
|
|
1415
|
+
const sharedNow = ctx.tableExisted(segments) || ctx.createdTable(segments);
|
|
1416
|
+
store.sources = indexSources(prefix, t, dialect, sharedNow ? segments : undefined);
|
|
1417
|
+
const anyTableExisted = Object.values(t).some((table) => ctx.tableExisted(table));
|
|
1418
|
+
const tablesAlreadyCurrent = ctx.catalog !== undefined && tablesPresent(ctx.catalog);
|
|
1419
|
+
const guardName = forkInheritedBlobGuardName(t.blobs);
|
|
1420
|
+
if (!tablesAlreadyCurrent) {
|
|
1421
|
+
if (ctx.catalog !== undefined && !anyTableExisted) {
|
|
1422
|
+
enqueueFreshTables(ctx, sharedNow);
|
|
1423
|
+
}
|
|
1424
|
+
else {
|
|
1425
|
+
await ctx.flushWrites();
|
|
1426
|
+
await createSnapshotIndexTables(ctx.tx, t, prefix, dialect, sharedNow ? [forkInheritedBlobGuard(dialect, t, segments).replace(/;\s*$/, "")] : []);
|
|
1427
|
+
for (const table of Object.values(t))
|
|
1428
|
+
ctx.noteTableCreated(table);
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
else if (sharedNow && ctx.catalog?.hasObject(guardName) !== true) {
|
|
1432
|
+
ctx.enqueue(forkInheritedBlobGuard(dialect, t, segments));
|
|
1433
|
+
}
|
|
1434
|
+
// Install snapshot index triggers in the same transaction. When no referencing table or progress table
|
|
1435
|
+
// existed before this transaction, only newly created tables (empty, watermark 0) need triggers.
|
|
1436
|
+
const existingSources = store.sources.filter((source) => ctx.tableExisted(source.table));
|
|
1437
|
+
if (!ctx.tableExisted(t.sources) && existingSources.length === 0) {
|
|
1438
|
+
for (const source of store.sources) {
|
|
1439
|
+
if (!ctx.createdTable(source.table))
|
|
1440
|
+
continue;
|
|
1441
|
+
ctx.enqueue(source.triggers.map((trigger) => dialect.renderTrigger(trigger)).join("\n"));
|
|
1442
|
+
ctx.enqueue({
|
|
1443
|
+
sql: `INSERT INTO ${t.sources} (source, watermark, backfilled_through) VALUES (?, 0, 0) ${REPLACE_PROGRESS}`,
|
|
1444
|
+
params: [source.name],
|
|
1445
|
+
});
|
|
1446
|
+
if (source.own !== undefined)
|
|
1447
|
+
ctx.enqueue({
|
|
1448
|
+
sql: `INSERT INTO ${t.sources} (source, watermark, backfilled_through) VALUES (?, 0, 0) ${REPLACE_PROGRESS}`,
|
|
1449
|
+
params: [source.own],
|
|
1450
|
+
});
|
|
1451
|
+
if (source.version !== undefined)
|
|
1452
|
+
ctx.enqueue(publishVersion(t, source));
|
|
1453
|
+
}
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
await ctx.flushWrites();
|
|
1457
|
+
const legacy = store.legacyForkLinks();
|
|
1458
|
+
const foundLegacy = new Set();
|
|
1459
|
+
const states = await readSourceStates(ctx.tx, dialect, t, store.sources, false, undefined, legacy && { names: [legacy.name], found: foundLegacy });
|
|
1460
|
+
if (legacy !== undefined && foundLegacy.has(legacy.name))
|
|
1461
|
+
await ctx.tx.exec(dialect.dropTrigger(legacy.name, legacy.table, true));
|
|
1462
|
+
for (const { source, installed, deferred } of states) {
|
|
1463
|
+
if (!installed && !deferred)
|
|
1464
|
+
await installSource(ctx.tx, dialect, t, source, reset);
|
|
1465
|
+
}
|
|
1466
|
+
},
|
|
1467
|
+
});
|
|
1468
|
+
if (queued)
|
|
1469
|
+
return store;
|
|
1470
|
+
}
|
|
1034
1471
|
// A versioned database always checks its ledger: a newer schema with the same tables is refused, and a step it
|
|
1035
1472
|
// lacks, such as the index triggers, runs even when every table exists.
|
|
1473
|
+
// Whether this open created the tables on PostgreSQL, and with them the links indexes of {@link hotSessionLinks}.
|
|
1474
|
+
let linksHot = false;
|
|
1036
1475
|
if (!current) {
|
|
1037
|
-
await applyStorageMigrations(database, SNAPSHOT_BLOB_DOMAIN, [
|
|
1038
|
-
{
|
|
1476
|
+
const migrated = await applyStorageMigrations(database, SNAPSHOT_BLOB_DOMAIN, [
|
|
1477
|
+
{
|
|
1478
|
+
version: 1,
|
|
1479
|
+
up: async (transaction, dialect) => {
|
|
1480
|
+
// On PostgreSQL the tables come with the links index of {@link hotSessionLinks}, without one an
|
|
1481
|
+
// earlier build made, recorded in the ledger in the same request: a new database takes no extra
|
|
1482
|
+
// round trip for it. Where forks share history, as a new database's do from its first open, the
|
|
1483
|
+
// guard that keeps what they inherit comes with them in that request too (fork-blob-guard.ts).
|
|
1484
|
+
const hot = dialect.name === "postgres";
|
|
1485
|
+
await createSnapshotIndexTables(transaction, t, prefix, dialect, [
|
|
1486
|
+
...(hot
|
|
1487
|
+
? [`DROP INDEX IF EXISTS ${t.sessionLinks}_leaves`, hotSessionLinksRecord(prefix, dialect)]
|
|
1488
|
+
: []),
|
|
1489
|
+
...((await shared) ? [forkInheritedBlobGuard(dialect, t, segments).replace(/;\s*$/, "")] : []),
|
|
1490
|
+
]);
|
|
1491
|
+
linksHot = hot;
|
|
1492
|
+
},
|
|
1493
|
+
},
|
|
1039
1494
|
// Where a ledger records the steps, it records the index triggers too, installed under the migration lock.
|
|
1040
1495
|
// Without one, installIndex below installs each source in a transaction of its own, as it always has.
|
|
1041
1496
|
...(dialect.versionedMigrations
|
|
@@ -1063,12 +1518,65 @@ export class SqlSnapshotBlobStore {
|
|
|
1063
1518
|
},
|
|
1064
1519
|
]
|
|
1065
1520
|
: []),
|
|
1066
|
-
], { table:
|
|
1521
|
+
], { table: ledger });
|
|
1522
|
+
// The session store's open, which asks the catalog for the guard next, finds it without reading the schema again.
|
|
1523
|
+
if (migrated.applied.includes(1) && (await shared))
|
|
1524
|
+
noteStorageSchemaTables(database, [forkInheritedBlobGuardName(t.blobs)]);
|
|
1067
1525
|
}
|
|
1526
|
+
if (!linksHot)
|
|
1527
|
+
await ensureHotSessionLinks(database, t, prefix);
|
|
1068
1528
|
const store = new SqlSnapshotBlobStore(database, dialect, t, indexSources(prefix, t, dialect, (await shared) ? segments : undefined), segments);
|
|
1069
1529
|
await store.installIndex(undefined, false, await schemaCatalogOf(database));
|
|
1070
1530
|
return store;
|
|
1071
1531
|
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Gives a PostgreSQL database's session links the index of {@link hotSessionLinks} without holding the table's writes,
|
|
1534
|
+
* as `atomic storage migrate` does where an open would not ({@link HOT_SESSION_LINKS_OPEN_BUILD_BYTES}). Each step
|
|
1535
|
+
* runs on its own, outside a transaction: `CREATE INDEX CONCURRENTLY` builds `_anchored`, `DROP INDEX CONCURRENTLY`
|
|
1536
|
+
* removes `_leaves`, and only then does the ledger record the step. A build that stopped part way, which leaves an
|
|
1537
|
+
* invalid `_anchored`, is dropped and made again; one another process is making is waited for. Nothing runs where the
|
|
1538
|
+
* ledger records the step, where the table does not exist yet (its first open creates it with the index), or where
|
|
1539
|
+
* this role does not own it. `database` should allow a statement as long as the build takes.
|
|
1540
|
+
*/
|
|
1541
|
+
static async buildHotSessionLinksIndex(database, prefix = "") {
|
|
1542
|
+
const dialect = dialectOf(database);
|
|
1543
|
+
if (dialect.name !== "postgres")
|
|
1544
|
+
return "current";
|
|
1545
|
+
const t = snapshotIndexTables(prefix);
|
|
1546
|
+
const schema = sessionLinksHotSchema(prefix);
|
|
1547
|
+
const recorded = async () => {
|
|
1548
|
+
const ledger = dialect.tableExists(schema.ledger);
|
|
1549
|
+
if ((await database.get(ledger.sql, ...ledger.params)) === undefined)
|
|
1550
|
+
return false;
|
|
1551
|
+
return ((await database.get(`SELECT 1 AS found FROM ${schema.ledger} WHERE domain = ? AND version >= ?`, `schema:${schema.domain}`, schema.revision)) !== undefined);
|
|
1552
|
+
};
|
|
1553
|
+
if (await recorded())
|
|
1554
|
+
return "current";
|
|
1555
|
+
for (;;) {
|
|
1556
|
+
const found = await sessionLinksState(database, t, dialect);
|
|
1557
|
+
if (found === undefined)
|
|
1558
|
+
return "absent";
|
|
1559
|
+
if (!found.owned)
|
|
1560
|
+
return "not-owner";
|
|
1561
|
+
if (found.building) {
|
|
1562
|
+
// Another process builds an index of the table, perhaps this one: its outcome decides what is left to do.
|
|
1563
|
+
await new Promise((resolve) => setTimeout(resolve, HOT_SESSION_LINKS_BUILD_POLL_MS));
|
|
1564
|
+
continue;
|
|
1565
|
+
}
|
|
1566
|
+
if (found.anchored === false)
|
|
1567
|
+
await database.exec(`DROP INDEX CONCURRENTLY IF EXISTS ${t.sessionLinks}_anchored`);
|
|
1568
|
+
if (found.anchored !== true)
|
|
1569
|
+
await database.exec(sessionLinksLeafIndex(t, dialect).replace("CREATE INDEX", "CREATE INDEX CONCURRENTLY"));
|
|
1570
|
+
break;
|
|
1571
|
+
}
|
|
1572
|
+
await database.exec(`DROP INDEX CONCURRENTLY IF EXISTS ${t.sessionLinks}_leaves`);
|
|
1573
|
+
// The index is in place, so the record runs no DDL, which would wait for the table's writes.
|
|
1574
|
+
await database.transaction((transaction) => ensureStorageSchema(transaction, dialect, schema, async () => { }), {
|
|
1575
|
+
retryTransientFailures: true,
|
|
1576
|
+
concurrency: { kind: "serial", domain: schema.ledger },
|
|
1577
|
+
});
|
|
1578
|
+
return "built";
|
|
1579
|
+
}
|
|
1072
1580
|
/** Runs only layout maintenance on the offline command's dedicated, exclusively locked SQLite file connection. */
|
|
1073
1581
|
static async moveChunksOffline(file, prefix = "") {
|
|
1074
1582
|
const tables = snapshotIndexTables(prefix);
|
|
@@ -1154,8 +1662,10 @@ export class SqlSnapshotBlobStore {
|
|
|
1154
1662
|
const chunk = `INSERT INTO ${this.tables.blobChunks} (hash, idx, data) SELECT ?, ?, ? WHERE NOT EXISTS (SELECT 1 FROM ${this.table} WHERE hash = ?) ON CONFLICT DO NOTHING`;
|
|
1155
1663
|
const statements = [];
|
|
1156
1664
|
let chunked = false;
|
|
1665
|
+
let totalBytes = 0;
|
|
1157
1666
|
for (const blob of blobs) {
|
|
1158
1667
|
const { hash, data } = blob;
|
|
1668
|
+
totalBytes += data.byteLength;
|
|
1159
1669
|
if (data.byteLength <= SNAPSHOT_BLOB_CHUNK_BYTES) {
|
|
1160
1670
|
statements.push({ sql: header, params: [hash, data.byteLength, data, 0] });
|
|
1161
1671
|
continue;
|
|
@@ -1172,13 +1682,14 @@ export class SqlSnapshotBlobStore {
|
|
|
1172
1682
|
await this.database.batch(statements);
|
|
1173
1683
|
return;
|
|
1174
1684
|
}
|
|
1685
|
+
const lead = statements.length < MAX_SEQUENCE_REQUEST_STATEMENTS && totalBytes <= SNAPSHOT_BLOB_CHUNK_BYTES;
|
|
1175
1686
|
await this.database.transaction(async (transaction) => {
|
|
1176
1687
|
// On a pipelined connection the statements go out with the commit: one round trip after the locks.
|
|
1177
1688
|
if (transactionFinisher(transaction)?.(statements) === true)
|
|
1178
1689
|
return;
|
|
1179
1690
|
for (const statement of statements)
|
|
1180
1691
|
await transaction.run(statement.sql, ...statement.params);
|
|
1181
|
-
}, this.blobWrite());
|
|
1692
|
+
}, this.blobWrite(lead ? statements : undefined, lead));
|
|
1182
1693
|
}
|
|
1183
1694
|
/**
|
|
1184
1695
|
* How a put or a refresh of this table's blobs runs: a serial transaction of the blob table's own domain (#6560). On
|
|
@@ -1188,11 +1699,12 @@ export class SqlSnapshotBlobStore {
|
|
|
1188
1699
|
* in hash order, as an append's check of the blobs it records locks them (`missingBlob`), so neither waits on the
|
|
1189
1700
|
* other in a cycle. Its callback only uses the transaction, so a transient failure runs it again.
|
|
1190
1701
|
*/
|
|
1191
|
-
blobWrite(leading) {
|
|
1702
|
+
blobWrite(leading, leadingOnly = false) {
|
|
1192
1703
|
return {
|
|
1193
1704
|
retryTransientFailures: true,
|
|
1194
1705
|
concurrency: { kind: "serial", domain: this.table },
|
|
1195
1706
|
...(leading === undefined ? {} : { leading }),
|
|
1707
|
+
...(leading !== undefined && leadingOnly ? { leadingOnly: true } : {}),
|
|
1196
1708
|
};
|
|
1197
1709
|
}
|
|
1198
1710
|
/**
|
|
@@ -1474,11 +1986,16 @@ export class SqlSnapshotBlobStore {
|
|
|
1474
1986
|
await transaction.run(sql, from, upper);
|
|
1475
1987
|
if (source.rowwise !== undefined) {
|
|
1476
1988
|
const rows = await transaction.all(`SELECT ${row} AS id FROM ${source.table} WHERE ${row} > ? AND ${row} <= ? ORDER BY ${row}`, from, upper);
|
|
1989
|
+
// The session entries are linked in each session's seq order, whatever order their rows are stored in (#6560).
|
|
1990
|
+
const linking = source.name === "session-entries" ? entryLinking(source, this.dialect, t.sessionLinks) : undefined;
|
|
1477
1991
|
for (const { id } of rows) {
|
|
1478
1992
|
// Stopping between rows rolls the whole batch back, progress included, so the pass stays resumable.
|
|
1479
1993
|
signal?.throwIfAborted();
|
|
1480
|
-
|
|
1481
|
-
await transaction
|
|
1994
|
+
if (linking !== undefined)
|
|
1995
|
+
await linkStoredEntry(transaction, linking, id);
|
|
1996
|
+
else
|
|
1997
|
+
for (const sql of source.rowwise)
|
|
1998
|
+
await transaction.run(sql, id);
|
|
1482
1999
|
}
|
|
1483
2000
|
}
|
|
1484
2001
|
// Indexing rows again behind the source's progress, for this build's own, never moves the progress back.
|
|
@@ -1628,6 +2145,12 @@ export class SqlSnapshotBlobStore {
|
|
|
1628
2145
|
* and the sessions that record its blobs now. A blob a session the sweep did not walk records, such as one created
|
|
1629
2146
|
* since, is kept; the next collection walks that session. Nothing in the transaction waits for a turn of the event
|
|
1630
2147
|
* loop (#5530).
|
|
2148
|
+
*
|
|
2149
|
+
* It runs as a whole-database transaction on purpose, so no other write runs beside it. With only the blob table's
|
|
2150
|
+
* lock it would not be safe: it decides which blobs sessions still use in one statement and deletes in the next. A
|
|
2151
|
+
* session write that records a blob meanwhile holds the blob's row only until it commits its reference; the delete
|
|
2152
|
+
* waits for it, then goes ahead without looking at the references again, and removes a blob a session has just
|
|
2153
|
+
* recorded. The same goes for the references retaining runs and carried work write.
|
|
1631
2154
|
*/
|
|
1632
2155
|
deleteUnretained(batch, minimumAge, options) {
|
|
1633
2156
|
const t = this.tables;
|
|
@@ -1957,7 +2480,7 @@ export class SqlSnapshotBlobStore {
|
|
|
1957
2480
|
Reflect.defineProperty(error, RENAME_BLOCKER, { value: { type: only.type, name: only.name } });
|
|
1958
2481
|
}
|
|
1959
2482
|
/**
|
|
1960
|
-
* Whether the file system of a SQLite
|
|
2483
|
+
* Whether the file system of a SQLite database file has room to copy what is left of the chunk table to the
|
|
1961
2484
|
* row layout (#5694): the copy grows the file by the bytes its free pages do not hold, and the write-ahead log can
|
|
1962
2485
|
* hold every page the copy writes until a checkpoint moves them into the file, with
|
|
1963
2486
|
* {@link SNAPSHOT_CHUNK_MOVE_HEADROOM_BYTES} left over; the database's own `freeBytes` says how much the file system
|
|
@@ -2161,7 +2684,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
2161
2684
|
return (async () => {
|
|
2162
2685
|
const root = new URL("../../", import.meta.url);
|
|
2163
2686
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
2164
|
-
const key = `${root.href}#0.10.11
|
|
2687
|
+
const key = `${root.href}#0.10.11`;
|
|
2165
2688
|
let release = releases.get(key);
|
|
2166
2689
|
if (release === undefined) {
|
|
2167
2690
|
const current = (async () => {
|
|
@@ -2189,7 +2712,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
2189
2712
|
} catch {
|
|
2190
2713
|
// No installation to read, as in a bundle of the package: the release the process runs decides.
|
|
2191
2714
|
}
|
|
2192
|
-
const updatedTo = typeof installed === "string" && installed !== "0.10.11
|
|
2715
|
+
const updatedTo = typeof installed === "string" && installed !== "0.10.11" ? installed : running !== undefined && running.version !== "0.10.11" ? "0.10.11" : undefined;
|
|
2193
2716
|
if (updatedTo === undefined) throw error;
|
|
2194
2717
|
const application = typeof running?.name === "string" ? running.name : "atomic";
|
|
2195
2718
|
const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {
|