@bastani/atomic 0.10.11-alpha.2 → 0.10.11-alpha.4
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 +150 -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 +42 -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 +6 -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 +1470 -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
|
@@ -6,7 +6,7 @@ try {
|
|
|
6
6
|
} catch (error) {
|
|
7
7
|
const root = new URL("../../", import.meta.url);
|
|
8
8
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
9
|
-
const key = `${root.href}#0.10.11-alpha.
|
|
9
|
+
const key = `${root.href}#0.10.11-alpha.4`;
|
|
10
10
|
let release = releases.get(key);
|
|
11
11
|
if (release === undefined) {
|
|
12
12
|
const current = (async () => {
|
|
@@ -27,8 +27,8 @@ try {
|
|
|
27
27
|
release = current;
|
|
28
28
|
}
|
|
29
29
|
const running = await release;
|
|
30
|
-
if (running === undefined || running.version === "0.10.11-alpha.
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.
|
|
30
|
+
if (running === undefined || running.version === "0.10.11-alpha.4") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.4 while this session was running; restart it to keep using session storage.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -6,7 +6,7 @@ try {
|
|
|
6
6
|
} catch (error) {
|
|
7
7
|
const root = new URL("../../", import.meta.url);
|
|
8
8
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
9
|
-
const key = `${root.href}#0.10.11-alpha.
|
|
9
|
+
const key = `${root.href}#0.10.11-alpha.4`;
|
|
10
10
|
let release = releases.get(key);
|
|
11
11
|
if (release === undefined) {
|
|
12
12
|
const current = (async () => {
|
|
@@ -27,8 +27,8 @@ try {
|
|
|
27
27
|
release = current;
|
|
28
28
|
}
|
|
29
29
|
const running = await release;
|
|
30
|
-
if (running === undefined || running.version === "0.10.11-alpha.
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.
|
|
30
|
+
if (running === undefined || running.version === "0.10.11-alpha.4") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.4 while this session was running; restart it to keep using session storage.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -29,7 +29,7 @@ export declare const POSTGRES_MAX_STORAGE_PREFIX_LENGTH: number;
|
|
|
29
29
|
*/
|
|
30
30
|
export declare const POSTGRES_POOL_SESSION_PREFIX = "wf_ps_";
|
|
31
31
|
/**
|
|
32
|
-
* Check a storage prefix, and with `dialect`, that the backend can name every identifier under it. SQLite
|
|
32
|
+
* Check a storage prefix, and with `dialect`, that the backend can name every identifier under it. SQLite
|
|
33
33
|
* have no identifier limit. On PostgreSQL the limit applies to the prefix a user chose: a worker pool's session prefix
|
|
34
34
|
* (`<prefix>wf_ps_`) is checked as the prefix before it.
|
|
35
35
|
*/
|
|
@@ -25,6 +25,7 @@ export const POSTGRES_STORAGE_IDENTIFIER_SUFFIXES = Object.freeze([
|
|
|
25
25
|
"intercom_known_sessions_alias_id",
|
|
26
26
|
"intercom_known_sessions_atomic_id",
|
|
27
27
|
"intercom_known_sessions_intercom_id",
|
|
28
|
+
"intercom_known_sessions_lost",
|
|
28
29
|
"intercom_known_sessions_name",
|
|
29
30
|
"intercom_known_sessions_recorded",
|
|
30
31
|
"intercom_leases",
|
|
@@ -35,11 +36,15 @@ export const POSTGRES_STORAGE_IDENTIFIER_SUFFIXES = Object.freeze([
|
|
|
35
36
|
"intercom_leases_presence_id_head",
|
|
36
37
|
"intercom_leases_presence_name",
|
|
37
38
|
"intercom_outbox",
|
|
39
|
+
"intercom_outbox_settled",
|
|
38
40
|
"intercom_outbox_target",
|
|
39
41
|
"intercom_outbox_target_bytes",
|
|
42
|
+
"intercom_outbox_undelivered",
|
|
40
43
|
"intercom_pending_asks",
|
|
44
|
+
"intercom_pending_asks_ended",
|
|
41
45
|
"intercom_pending_asks_target",
|
|
42
46
|
"intercom_released_asks",
|
|
47
|
+
"intercom_released_asks_expires",
|
|
43
48
|
"intercom_restoring_reservation_counters",
|
|
44
49
|
"intercom_restoring_reservations",
|
|
45
50
|
"intercom_restoring_reservations_active",
|
|
@@ -90,6 +95,8 @@ export const POSTGRES_STORAGE_IDENTIFIER_SUFFIXES = Object.freeze([
|
|
|
90
95
|
"snapshot_blobs_age",
|
|
91
96
|
"snapshot_blobs_chunks_delete_all",
|
|
92
97
|
"snapshot_blobs_chunks_delete_all_fn",
|
|
98
|
+
"snapshot_blobs_fork_keep",
|
|
99
|
+
"snapshot_blobs_fork_keep_fn",
|
|
93
100
|
"snapshot_blobs_inline_size",
|
|
94
101
|
"snapshot_carried_refs",
|
|
95
102
|
"snapshot_carried_refs_hash",
|
|
@@ -99,9 +106,9 @@ export const POSTGRES_STORAGE_IDENTIFIER_SUFFIXES = Object.freeze([
|
|
|
99
106
|
"snapshot_run_refs_hash",
|
|
100
107
|
"snapshot_run_state",
|
|
101
108
|
"snapshot_session_links",
|
|
109
|
+
"snapshot_session_links_anchored",
|
|
102
110
|
"snapshot_session_links_broken",
|
|
103
111
|
"snapshot_session_links_entry",
|
|
104
|
-
"snapshot_session_links_leaves",
|
|
105
112
|
"snapshot_session_records",
|
|
106
113
|
"snapshot_session_records_hash",
|
|
107
114
|
"snapshot_session_refs",
|
|
@@ -247,7 +254,7 @@ export const POSTGRES_MAX_STORAGE_PREFIX_LENGTH = 63 - Math.max(...POSTGRES_STOR
|
|
|
247
254
|
*/
|
|
248
255
|
export const POSTGRES_POOL_SESSION_PREFIX = "wf_ps_";
|
|
249
256
|
/**
|
|
250
|
-
* Check a storage prefix, and with `dialect`, that the backend can name every identifier under it. SQLite
|
|
257
|
+
* Check a storage prefix, and with `dialect`, that the backend can name every identifier under it. SQLite
|
|
251
258
|
* have no identifier limit. On PostgreSQL the limit applies to the prefix a user chose: a worker pool's session prefix
|
|
252
259
|
* (`<prefix>wf_ps_`) is checked as the prefix before it.
|
|
253
260
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefix.js","sourceRoot":"","sources":["../../../src/core/storage/prefix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA2B,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAsB,MAAM,CAAC,MAAM,CAAC;IACpF,mBAAmB;IACnB,6BAA6B;IAC7B,2BAA2B;IAC3B,4BAA4B;IAC5B,sCAAsC;IACtC,iCAAiC;IACjC,4BAA4B;IAC5B,iC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AAM,EAAE,CAAC,CAAC;QACpE,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1B,SAAS,GAAG,UAAU,CAAC;YACvB,MAAM;QACP,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC;IACD,kBAAkB,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1C,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,wBAAwB,CACvC,MAA8B,EAC9B,KAAQ,EACR,MAAM,GAAG,EAAE;IAEX,MAAM,SAAS,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC;IAC/D,OAAO,MAAM,CAAC,MAAM,CACnB,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,YAAY,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CACnE,CAAC;AAC3C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAM,GAAG,EAAE;IAChD,OAAO,GAAG,qBAAqB,CAAC,MAAM,CAAC,mBAAmB,CAAC;AAC5D,CAAC","sourcesContent":["import { postgresDialect, type StorageDialectName } from \"./dialect.js\";\nimport { StoragePrefixError } from \"./errors.js\";\n\n/**\n * What follows the prefix in every identifier Atomic names on PostgreSQL: the tables, indexes, triggers and trigger\n * functions of sessions, worktree snapshots and the Intercom broker state (#5067), the Intercom lease order sequence\n * and the lease table's address indexes (#6560), and those the workflow run journal and\n * worker pools (#4793) of earlier releases left under the same prefix, pooled-stage sessions under\n * `POSTGRES_POOL_SESSION_PREFIX` included. Prefixes stay checked against them all, so a database those releases share\n * keeps every name whole. The storage adapters name none of their own, and\n * Postgres chooses constraint names and the sequences of serial columns itself. Longer pool names are in\n * `POSTGRES_HASHED_STORAGE_IDENTIFIER_SUFFIXES`.\n */\nexport const POSTGRES_STORAGE_IDENTIFIER_SUFFIXES: readonly string[] = Object.freeze([\n\t\"atomic_migrations\",\n\t\"intercom_ended_child_bodies\",\n\t\"intercom_ended_child_meta\",\n\t\"intercom_ended_child_queue\",\n\t\"intercom_ended_child_queue_departure\",\n\t\"intercom_ended_child_queue_home\",\n\t\"intercom_ended_child_wakes\",\n\t\"intercom_ended_child_wakes_home\",\n\t\"intercom_held_sends\",\n\t\"intercom_held_sends_reservation\",\n\t\"intercom_known_sessions\",\n\t\"intercom_known_sessions_alias_id\",\n\t\"intercom_known_sessions_atomic_id\",\n\t\"intercom_known_sessions_intercom_id\",\n\t\"intercom_known_sessions_name\",\n\t\"intercom_known_sessions_recorded\",\n\t\"intercom_leases\",\n\t\"intercom_leases_order\",\n\t\"intercom_leases_presence_alias\",\n\t\"intercom_leases_presence_host\",\n\t\"intercom_leases_presence_id\",\n\t\"intercom_leases_presence_id_head\",\n\t\"intercom_leases_presence_name\",\n\t\"intercom_outbox\",\n\t\"intercom_outbox_target\",\n\t\"intercom_outbox_target_bytes\",\n\t\"intercom_pending_asks\",\n\t\"intercom_pending_asks_target\",\n\t\"intercom_released_asks\",\n\t\"intercom_restoring_reservation_counters\",\n\t\"intercom_restoring_reservations\",\n\t\"intercom_restoring_reservations_active\",\n\t\"intercom_restoring_reservations_child\",\n\t\"intercom_restoring_reservations_wake\",\n\t\"intercom_restoring_wake_claims\",\n\t\"intercom_sent_messages\",\n\t\"intercom_sent_messages_recorded\",\n\t\"intercom_session_bindings\",\n\t\"intercom_session_bindings_recorded\",\n\t\"intercom_settled_asks\",\n\t\"intercom_settled_asks_at\",\n\t\"intercom_wakeups\",\n\t\"intercom_wakeups_broker\",\n\t\"intercom_wakeups_created\",\n\t\"session_blob_chunks\",\n\t\"session_blobs\",\n\t\"session_chat_v1\",\n\t\"session_chat_v1_anchor\",\n\t\"session_entries\",\n\t\"session_entries_search_forget\",\n\t\"session_entries_search_forget_fn\",\n\t\"session_entries_snapshot_links\",\n\t\"session_entries_snapshot_links_fn\",\n\t\"session_entries_snapshot_pending\",\n\t\"session_entries_snapshot_pending_fn\",\n\t\"session_entries_snapshot_refs\",\n\t\"session_entries_snapshot_refs_delete\",\n\t\"session_entries_snapshot_refs_delete_fn\",\n\t\"session_entries_snapshot_refs_fn\",\n\t\"session_entry_chunks\",\n\t\"session_fork_detach\",\n\t\"session_fork_lineage\",\n\t\"session_fork_segments\",\n\t\"session_fork_segments_source\",\n\t\"session_fork_staging\",\n\t\"session_fork_staging_name\",\n\t\"session_fork_tombstones\",\n\t\"session_meta\",\n\t\"session_open\",\n\t\"session_search_entries\",\n\t\"session_search_state\",\n\t\"session_search_texts\",\n\t\"session_search_trgm\",\n\t\"session_sessions\",\n\t\"snapshot_blob_chunks\",\n\t\"snapshot_blobs\",\n\t\"snapshot_blobs_age\",\n\t\"snapshot_blobs_chunks_delete_all\",\n\t\"snapshot_blobs_chunks_delete_all_fn\",\n\t\"snapshot_blobs_inline_size\",\n\t\"snapshot_carried_refs\",\n\t\"snapshot_carried_refs_hash\",\n\t\"snapshot_collection\",\n\t\"snapshot_index_sources\",\n\t\"snapshot_run_refs\",\n\t\"snapshot_run_refs_hash\",\n\t\"snapshot_run_state\",\n\t\"snapshot_session_links\",\n\t\"snapshot_session_links_broken\",\n\t\"snapshot_session_links_entry\",\n\t\"snapshot_session_links_leaves\",\n\t\"snapshot_session_records\",\n\t\"snapshot_session_records_hash\",\n\t\"snapshot_session_refs\",\n\t\"wf_event_chunks\",\n\t\"wf_events\",\n\t\"wf_events_snapshot_refs\",\n\t\"wf_events_snapshot_refs_fn\",\n\t\"wf_events_snapshot_state\",\n\t\"wf_events_snapshot_state_fn\",\n\t\"wf_lease_builds\",\n\t\"wf_leases\",\n\t\"wf_meta\",\n\t\"wf_ps_atomic_migrations\",\n\t\"wf_ps_session_blob_chunks\",\n\t\"wf_ps_session_blobs\",\n\t\"wf_ps_session_entries\",\n\t\"wf_ps_session_entries_search_forget\",\n\t\"wf_ps_session_entries_search_forget_fn\",\n\t\"wf_ps_session_entries_snapshot_links\",\n\t\"wf_ps_session_entries_snapshot_links_fn\",\n\t\"wf_ps_session_entries_snapshot_pending\",\n\t\"wf_ps_session_entries_snapshot_refs\",\n\t\"wf_ps_session_entries_snapshot_refs_fn\",\n\t\"wf_ps_session_entry_chunks\",\n\t\"wf_ps_session_meta\",\n\t\"wf_ps_session_open\",\n\t\"wf_ps_session_owners\",\n\t\"wf_ps_session_search_entries\",\n\t\"wf_ps_session_search_state\",\n\t\"wf_ps_session_search_texts\",\n\t\"wf_ps_session_search_trgm\",\n\t\"wf_ps_session_sessions\",\n\t\"wf_ps_snapshot_blob_chunks\",\n\t\"wf_ps_snapshot_blobs\",\n\t\"wf_ps_snapshot_blobs_age\",\n\t\"wf_ps_snapshot_blobs_chunks_delete_all\",\n\t\"wf_ps_snapshot_blobs_inline_size\",\n\t\"wf_ps_snapshot_carried_refs\",\n\t\"wf_ps_snapshot_carried_refs_hash\",\n\t\"wf_ps_snapshot_collection\",\n\t\"wf_ps_snapshot_index_sources\",\n\t\"wf_ps_snapshot_run_refs\",\n\t\"wf_ps_snapshot_run_refs_hash\",\n\t\"wf_ps_snapshot_run_state\",\n\t\"wf_ps_snapshot_session_links\",\n\t\"wf_ps_snapshot_session_links_broken\",\n\t\"wf_ps_snapshot_session_links_entry\",\n\t\"wf_ps_snapshot_session_links_leaves\",\n\t\"wf_ps_snapshot_session_records\",\n\t\"wf_ps_snapshot_session_records_hash\",\n\t\"wf_ps_snapshot_session_refs\",\n\t\"wf_runs\",\n\t\"wf_runs_fleet_controller\",\n\t\"wf_runs_fleet_drains\",\n\t\"wf_runs_fleet_events\",\n\t\"wf_runs_pool\",\n\t\"wf_runs_pool_activity\",\n\t\"wf_runs_pool_activity_version\",\n\t\"wf_runs_pool_control\",\n\t\"wf_runs_pool_fence\",\n\t\"wf_runs_pool_fence_abort\",\n\t\"wf_runs_pool_fence_abort_fn\",\n\t\"wf_runs_pool_hosts\",\n\t\"wf_runs_pool_meta\",\n\t\"wf_runs_pool_operations\",\n\t\"wf_runs_pool_restore_backoffs\",\n\t\"wf_runs_pool_root_snapshot\",\n\t\"wf_runs_pool_shared\",\n\t\"wf_runs_pool_usage\",\n\t\"wf_runs_pool_usage_totals\",\n\t\"wf_runs_pool_usage_totals_delete\",\n\t\"wf_runs_pool_usage_totals_delete_fn\",\n\t\"wf_runs_pool_usage_totals_insert\",\n\t\"wf_runs_pool_usage_totals_insert_fn\",\n\t\"wf_runs_pool_usage_totals_update\",\n\t\"wf_runs_pool_usage_totals_update_fn\",\n\t\"wf_runs_pool_usage_totals_work_delete\",\n\t\"wf_runs_rate_buckets\",\n\t\"wf_runs_rate_waiting\",\n\t\"wf_runs_rate_waiting_age\",\n\t\"wf_runs_resource_limits\",\n\t\"wf_runs_resource_owners\",\n\t\"wf_runs_resource_permits\",\n\t\"wf_runs_resource_permits_active\",\n\t\"wf_runs_resource_permits_owner\",\n\t\"wf_runs_resource_permits_state\",\n\t\"wf_runs_ship_batches\",\n\t\"wf_runs_ship_batches_work\",\n\t\"wf_runs_ship_watermarks\",\n\t\"wf_runs_snapshot_refs_delete\",\n\t\"wf_runs_snapshot_refs_delete_fn\",\n\t\"wf_runs_snapshot_state_insert\",\n\t\"wf_runs_snapshot_state_insert_fn\",\n\t\"wf_runs_snapshot_state_status\",\n\t\"wf_runs_snapshot_state_status_fn\",\n\t\"wf_runs_stage_inputs\",\n\t\"wf_runs_stage_inputs_pending\",\n\t\"wf_runs_stage_leases\",\n\t\"wf_runs_stage_workspaces\",\n\t\"wf_runs_work\",\n\t\"wf_runs_work_child\",\n\t\"wf_runs_work_expiry\",\n\t\"wf_runs_work_input_chunks\",\n\t\"wf_runs_work_ready\",\n\t\"wf_runs_work_result_chunks\",\n\t\"wf_runs_work_results\",\n\t\"wf_runs_work_scope\",\n\t\"wf_runs_work_snapshot_carried_delete\",\n\t\"wf_runs_work_snapshot_carried_delete_fn\",\n\t\"wf_runs_work_snapshot_carried_insert\",\n\t\"wf_runs_work_snapshot_carried_insert_fn\",\n\t\"wf_runs_work_snapshot_carried_update\",\n\t\"wf_runs_work_snapshot_carried_update_fn\",\n]);\n\n/**\n * What follows the prefix in the triggers and trigger functions of a worker pool (#4793) whose names are longer than\n * `POSTGRES_STORAGE_IDENTIFIER_SUFFIXES` allows. Under a prefix that makes one longer than 63 bytes, Postgres knows it by\n * `postgresDialect.identifier` of the whole name (its head and a hash), in every statement and catalog probe alike; under\n * a shorter prefix, by the whole name. They do not limit the prefix.\n */\nexport const POSTGRES_HASHED_STORAGE_IDENTIFIER_SUFFIXES: readonly string[] = Object.freeze([\n\t\"wf_ps_session_entries_snapshot_pending_fn\",\n\t\"wf_ps_session_entries_snapshot_refs_delete\",\n\t\"wf_ps_session_entries_snapshot_refs_delete_fn\",\n\t\"wf_ps_snapshot_blobs_chunks_delete_all_fn\",\n\t\"wf_runs_pool_root_snapshot_snapshot_carried_delete\",\n\t\"wf_runs_pool_root_snapshot_snapshot_carried_delete_fn\",\n\t\"wf_runs_pool_root_snapshot_snapshot_carried_insert\",\n\t\"wf_runs_pool_root_snapshot_snapshot_carried_insert_fn\",\n\t\"wf_runs_pool_root_snapshot_snapshot_carried_update\",\n\t\"wf_runs_pool_root_snapshot_snapshot_carried_update_fn\",\n\t\"wf_runs_pool_usage_totals_work_delete_fn\",\n]);\n\n/**\n * The longest storage prefix PostgreSQL takes: Postgres truncates an identifier longer than 63 bytes, so a longer\n * prefix would cut the longest name Atomic gives it, or make two names one. Prefixes are ASCII, one byte a character.\n */\nexport const POSTGRES_MAX_STORAGE_PREFIX_LENGTH =\n\t63 - Math.max(...POSTGRES_STORAGE_IDENTIFIER_SUFFIXES.map((suffix) => suffix.length));\n\n/**\n * What a worker pool of an earlier release added to the journal's prefix for the stores it carried on PostgreSQL: its\n * pooled-stage sessions and their snapshot index live under `<prefix>wf_ps_` (#4793). The length limit applies to the\n * prefix before it.\n */\nexport const POSTGRES_POOL_SESSION_PREFIX = \"wf_ps_\";\n\n/**\n * Check a storage prefix, and with `dialect`, that the backend can name every identifier under it. SQLite and libSQL\n * have no identifier limit. On PostgreSQL the limit applies to the prefix a user chose: a worker pool's session prefix\n * (`<prefix>wf_ps_`) is checked as the prefix before it.\n */\nexport function validateStoragePrefix(prefix = \"\", dialect?: StorageDialectName): string {\n\tif (prefix !== \"\" && !/^[A-Za-z_][A-Za-z0-9_]*$/.test(prefix)) {\n\t\tthrow new StoragePrefixError(prefix, \"pattern\");\n\t}\n\tif (/^sqlite_/i.test(prefix)) throw new StoragePrefixError(prefix, \"reserved\");\n\tconst chosen = prefix.endsWith(POSTGRES_POOL_SESSION_PREFIX)\n\t\t? prefix.slice(0, -POSTGRES_POOL_SESSION_PREFIX.length)\n\t\t: prefix;\n\tif (dialect === \"postgres\" && /[A-Z]/.test(prefix)) throw new StoragePrefixError(prefix, \"uppercase\");\n\tif (dialect === \"postgres\" && chosen.length > POSTGRES_MAX_STORAGE_PREFIX_LENGTH)\n\t\tthrow new StoragePrefixError(prefix, \"too-long\", POSTGRES_MAX_STORAGE_PREFIX_LENGTH);\n\tif (dialect === \"postgres\") {\n\t\tconst collision = postgresIdentifierCollision(chosen);\n\t\tif (collision !== undefined) throw new StoragePrefixError(prefix, \"identifier-collision\", undefined, collision);\n\t}\n\treturn prefix;\n}\n\nconst postgresCollisions = new Map<string, string | undefined>();\n\n/**\n * The identifier PostgreSQL would know two of the names under `prefix` by, if any (#5219): a name too long to keep whole\n * is its head and a hash of the whole name, so two names that share their head differ only in that hash.\n */\nfunction postgresIdentifierCollision(prefix: string): string | undefined {\n\tif (postgresCollisions.has(prefix)) return postgresCollisions.get(prefix);\n\tconst seen = new Set<string>();\n\tlet collision: string | undefined;\n\tfor (const suffix of [...POSTGRES_STORAGE_IDENTIFIER_SUFFIXES, ...POSTGRES_HASHED_STORAGE_IDENTIFIER_SUFFIXES]) {\n\t\tconst identifier = postgresDialect.identifier(`${prefix}${suffix}`);\n\t\tif (seen.has(identifier)) {\n\t\t\tcollision = identifier;\n\t\t\tbreak;\n\t\t}\n\t\tseen.add(identifier);\n\t}\n\tpostgresCollisions.set(prefix, collision);\n\treturn collision;\n}\n\nexport function renderStorageIdentifiers<T extends Readonly<Record<string, string>>>(\n\tdomain: \"journal\" | \"sessions\",\n\tnames: T,\n\tprefix = \"\",\n): Readonly<{ [K in keyof T]: string }> {\n\tconst validated = validateStoragePrefix(prefix);\n\tconst domainPrefix = domain === \"journal\" ? \"wf_\" : \"session_\";\n\treturn Object.freeze(\n\t\tObject.fromEntries(Object.entries(names).map(([key, name]) => [key, `${validated}${domainPrefix}${name}`])),\n\t) as Readonly<{ [K in keyof T]: string }>;\n}\n\n/**\n * The ledger `applyStorageMigrations` records each domain's applied versions in, one per prefix: the Postgres schema\n * of every domain under `prefix` (#4793). SQLite keeps no ledger, so its schema is unchanged.\n */\nexport function storageMigrationTable(prefix = \"\"): string {\n\treturn `${validateStoragePrefix(prefix)}atomic_migrations`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"prefix.js","sourceRoot":"","sources":["../../../src/core/storage/prefix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA2B,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAsB,MAAM,CAAC,MAAM,CAAC;IACpF,mBAAmB;IACnB,6BAA6B;IAC7B,2BAA2B;IAC3B,4BAA4B;IAC5B,sCAAsC;IACtC,iCAAiC;IACjC,4BAA4B;IAC5B,iCAAiC;IACjC,qBAAqB;IACrB,iCAAiC;IACjC,yBAAyB;IACzB,kCAAkC;IAClC,mCAAmC;IACnC,qCAAqC;IACrC,8BAA8B;IAC9B,8BAA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AC,CAAC;QACpE,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1B,SAAS,GAAG,UAAU,CAAC;YACvB,MAAM;QACP,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC;IACD,kBAAkB,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1C,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,wBAAwB,CACvC,MAA8B,EAC9B,KAAQ,EACR,MAAM,GAAG,EAAE;IAEX,MAAM,SAAS,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC;IAC/D,OAAO,MAAM,CAAC,MAAM,CACnB,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,YAAY,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CACnE,CAAC;AAC3C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAM,GAAG,EAAE;IAChD,OAAO,GAAG,qBAAqB,CAAC,MAAM,CAAC,mBAAmB,CAAC;AAC5D,CAAC","sourcesContent":["import { postgresDialect, type StorageDialectName } from \"./dialect.js\";\nimport { StoragePrefixError } from \"./errors.js\";\n\n/**\n * What follows the prefix in every identifier Atomic names on PostgreSQL: the tables, indexes, triggers and trigger\n * functions of sessions, worktree snapshots and the Intercom broker state (#5067), the Intercom lease order sequence\n * and the lease table's address indexes (#6560), and those the workflow run journal and\n * worker pools (#4793) of earlier releases left under the same prefix, pooled-stage sessions under\n * `POSTGRES_POOL_SESSION_PREFIX` included. Prefixes stay checked against them all, so a database those releases share\n * keeps every name whole. The storage adapters name none of their own, and\n * Postgres chooses constraint names and the sequences of serial columns itself. Longer pool names are in\n * `POSTGRES_HASHED_STORAGE_IDENTIFIER_SUFFIXES`.\n */\nexport const POSTGRES_STORAGE_IDENTIFIER_SUFFIXES: readonly string[] = Object.freeze([\n\t\"atomic_migrations\",\n\t\"intercom_ended_child_bodies\",\n\t\"intercom_ended_child_meta\",\n\t\"intercom_ended_child_queue\",\n\t\"intercom_ended_child_queue_departure\",\n\t\"intercom_ended_child_queue_home\",\n\t\"intercom_ended_child_wakes\",\n\t\"intercom_ended_child_wakes_home\",\n\t\"intercom_held_sends\",\n\t\"intercom_held_sends_reservation\",\n\t\"intercom_known_sessions\",\n\t\"intercom_known_sessions_alias_id\",\n\t\"intercom_known_sessions_atomic_id\",\n\t\"intercom_known_sessions_intercom_id\",\n\t\"intercom_known_sessions_lost\",\n\t\"intercom_known_sessions_name\",\n\t\"intercom_known_sessions_recorded\",\n\t\"intercom_leases\",\n\t\"intercom_leases_order\",\n\t\"intercom_leases_presence_alias\",\n\t\"intercom_leases_presence_host\",\n\t\"intercom_leases_presence_id\",\n\t\"intercom_leases_presence_id_head\",\n\t\"intercom_leases_presence_name\",\n\t\"intercom_outbox\",\n\t\"intercom_outbox_settled\",\n\t\"intercom_outbox_target\",\n\t\"intercom_outbox_target_bytes\",\n\t\"intercom_outbox_undelivered\",\n\t\"intercom_pending_asks\",\n\t\"intercom_pending_asks_ended\",\n\t\"intercom_pending_asks_target\",\n\t\"intercom_released_asks\",\n\t\"intercom_released_asks_expires\",\n\t\"intercom_restoring_reservation_counters\",\n\t\"intercom_restoring_reservations\",\n\t\"intercom_restoring_reservations_active\",\n\t\"intercom_restoring_reservations_child\",\n\t\"intercom_restoring_reservations_wake\",\n\t\"intercom_restoring_wake_claims\",\n\t\"intercom_sent_messages\",\n\t\"intercom_sent_messages_recorded\",\n\t\"intercom_session_bindings\",\n\t\"intercom_session_bindings_recorded\",\n\t\"intercom_settled_asks\",\n\t\"intercom_settled_asks_at\",\n\t\"intercom_wakeups\",\n\t\"intercom_wakeups_broker\",\n\t\"intercom_wakeups_created\",\n\t\"session_blob_chunks\",\n\t\"session_blobs\",\n\t\"session_chat_v1\",\n\t\"session_chat_v1_anchor\",\n\t\"session_entries\",\n\t\"session_entries_search_forget\",\n\t\"session_entries_search_forget_fn\",\n\t\"session_entries_snapshot_links\",\n\t\"session_entries_snapshot_links_fn\",\n\t\"session_entries_snapshot_pending\",\n\t\"session_entries_snapshot_pending_fn\",\n\t\"session_entries_snapshot_refs\",\n\t\"session_entries_snapshot_refs_delete\",\n\t\"session_entries_snapshot_refs_delete_fn\",\n\t\"session_entries_snapshot_refs_fn\",\n\t\"session_entry_chunks\",\n\t\"session_fork_detach\",\n\t\"session_fork_lineage\",\n\t\"session_fork_segments\",\n\t\"session_fork_segments_source\",\n\t\"session_fork_staging\",\n\t\"session_fork_staging_name\",\n\t\"session_fork_tombstones\",\n\t\"session_meta\",\n\t\"session_open\",\n\t\"session_search_entries\",\n\t\"session_search_state\",\n\t\"session_search_texts\",\n\t\"session_search_trgm\",\n\t\"session_sessions\",\n\t\"snapshot_blob_chunks\",\n\t\"snapshot_blobs\",\n\t\"snapshot_blobs_age\",\n\t\"snapshot_blobs_chunks_delete_all\",\n\t\"snapshot_blobs_chunks_delete_all_fn\",\n\t\"snapshot_blobs_fork_keep\",\n\t\"snapshot_blobs_fork_keep_fn\",\n\t\"snapshot_blobs_inline_size\",\n\t\"snapshot_carried_refs\",\n\t\"snapshot_carried_refs_hash\",\n\t\"snapshot_collection\",\n\t\"snapshot_index_sources\",\n\t\"snapshot_run_refs\",\n\t\"snapshot_run_refs_hash\",\n\t\"snapshot_run_state\",\n\t\"snapshot_session_links\",\n\t\"snapshot_session_links_anchored\",\n\t\"snapshot_session_links_broken\",\n\t\"snapshot_session_links_entry\",\n\t\"snapshot_session_records\",\n\t\"snapshot_session_records_hash\",\n\t\"snapshot_session_refs\",\n\t\"wf_event_chunks\",\n\t\"wf_events\",\n\t\"wf_events_snapshot_refs\",\n\t\"wf_events_snapshot_refs_fn\",\n\t\"wf_events_snapshot_state\",\n\t\"wf_events_snapshot_state_fn\",\n\t\"wf_lease_builds\",\n\t\"wf_leases\",\n\t\"wf_meta\",\n\t\"wf_ps_atomic_migrations\",\n\t\"wf_ps_session_blob_chunks\",\n\t\"wf_ps_session_blobs\",\n\t\"wf_ps_session_entries\",\n\t\"wf_ps_session_entries_search_forget\",\n\t\"wf_ps_session_entries_search_forget_fn\",\n\t\"wf_ps_session_entries_snapshot_links\",\n\t\"wf_ps_session_entries_snapshot_links_fn\",\n\t\"wf_ps_session_entries_snapshot_pending\",\n\t\"wf_ps_session_entries_snapshot_refs\",\n\t\"wf_ps_session_entries_snapshot_refs_fn\",\n\t\"wf_ps_session_entry_chunks\",\n\t\"wf_ps_session_meta\",\n\t\"wf_ps_session_open\",\n\t\"wf_ps_session_owners\",\n\t\"wf_ps_session_search_entries\",\n\t\"wf_ps_session_search_state\",\n\t\"wf_ps_session_search_texts\",\n\t\"wf_ps_session_search_trgm\",\n\t\"wf_ps_session_sessions\",\n\t\"wf_ps_snapshot_blob_chunks\",\n\t\"wf_ps_snapshot_blobs\",\n\t\"wf_ps_snapshot_blobs_age\",\n\t\"wf_ps_snapshot_blobs_chunks_delete_all\",\n\t\"wf_ps_snapshot_blobs_inline_size\",\n\t\"wf_ps_snapshot_carried_refs\",\n\t\"wf_ps_snapshot_carried_refs_hash\",\n\t\"wf_ps_snapshot_collection\",\n\t\"wf_ps_snapshot_index_sources\",\n\t\"wf_ps_snapshot_run_refs\",\n\t\"wf_ps_snapshot_run_refs_hash\",\n\t\"wf_ps_snapshot_run_state\",\n\t\"wf_ps_snapshot_session_links\",\n\t\"wf_ps_snapshot_session_links_broken\",\n\t\"wf_ps_snapshot_session_links_entry\",\n\t\"wf_ps_snapshot_session_links_leaves\",\n\t\"wf_ps_snapshot_session_records\",\n\t\"wf_ps_snapshot_session_records_hash\",\n\t\"wf_ps_snapshot_session_refs\",\n\t\"wf_runs\",\n\t\"wf_runs_fleet_controller\",\n\t\"wf_runs_fleet_drains\",\n\t\"wf_runs_fleet_events\",\n\t\"wf_runs_pool\",\n\t\"wf_runs_pool_activity\",\n\t\"wf_runs_pool_activity_version\",\n\t\"wf_runs_pool_control\",\n\t\"wf_runs_pool_fence\",\n\t\"wf_runs_pool_fence_abort\",\n\t\"wf_runs_pool_fence_abort_fn\",\n\t\"wf_runs_pool_hosts\",\n\t\"wf_runs_pool_meta\",\n\t\"wf_runs_pool_operations\",\n\t\"wf_runs_pool_restore_backoffs\",\n\t\"wf_runs_pool_root_snapshot\",\n\t\"wf_runs_pool_shared\",\n\t\"wf_runs_pool_usage\",\n\t\"wf_runs_pool_usage_totals\",\n\t\"wf_runs_pool_usage_totals_delete\",\n\t\"wf_runs_pool_usage_totals_delete_fn\",\n\t\"wf_runs_pool_usage_totals_insert\",\n\t\"wf_runs_pool_usage_totals_insert_fn\",\n\t\"wf_runs_pool_usage_totals_update\",\n\t\"wf_runs_pool_usage_totals_update_fn\",\n\t\"wf_runs_pool_usage_totals_work_delete\",\n\t\"wf_runs_rate_buckets\",\n\t\"wf_runs_rate_waiting\",\n\t\"wf_runs_rate_waiting_age\",\n\t\"wf_runs_resource_limits\",\n\t\"wf_runs_resource_owners\",\n\t\"wf_runs_resource_permits\",\n\t\"wf_runs_resource_permits_active\",\n\t\"wf_runs_resource_permits_owner\",\n\t\"wf_runs_resource_permits_state\",\n\t\"wf_runs_ship_batches\",\n\t\"wf_runs_ship_batches_work\",\n\t\"wf_runs_ship_watermarks\",\n\t\"wf_runs_snapshot_refs_delete\",\n\t\"wf_runs_snapshot_refs_delete_fn\",\n\t\"wf_runs_snapshot_state_insert\",\n\t\"wf_runs_snapshot_state_insert_fn\",\n\t\"wf_runs_snapshot_state_status\",\n\t\"wf_runs_snapshot_state_status_fn\",\n\t\"wf_runs_stage_inputs\",\n\t\"wf_runs_stage_inputs_pending\",\n\t\"wf_runs_stage_leases\",\n\t\"wf_runs_stage_workspaces\",\n\t\"wf_runs_work\",\n\t\"wf_runs_work_child\",\n\t\"wf_runs_work_expiry\",\n\t\"wf_runs_work_input_chunks\",\n\t\"wf_runs_work_ready\",\n\t\"wf_runs_work_result_chunks\",\n\t\"wf_runs_work_results\",\n\t\"wf_runs_work_scope\",\n\t\"wf_runs_work_snapshot_carried_delete\",\n\t\"wf_runs_work_snapshot_carried_delete_fn\",\n\t\"wf_runs_work_snapshot_carried_insert\",\n\t\"wf_runs_work_snapshot_carried_insert_fn\",\n\t\"wf_runs_work_snapshot_carried_update\",\n\t\"wf_runs_work_snapshot_carried_update_fn\",\n]);\n\n/**\n * What follows the prefix in the triggers and trigger functions of a worker pool (#4793) whose names are longer than\n * `POSTGRES_STORAGE_IDENTIFIER_SUFFIXES` allows. Under a prefix that makes one longer than 63 bytes, Postgres knows it by\n * `postgresDialect.identifier` of the whole name (its head and a hash), in every statement and catalog probe alike; under\n * a shorter prefix, by the whole name. They do not limit the prefix.\n */\nexport const POSTGRES_HASHED_STORAGE_IDENTIFIER_SUFFIXES: readonly string[] = Object.freeze([\n\t\"wf_ps_session_entries_snapshot_pending_fn\",\n\t\"wf_ps_session_entries_snapshot_refs_delete\",\n\t\"wf_ps_session_entries_snapshot_refs_delete_fn\",\n\t\"wf_ps_snapshot_blobs_chunks_delete_all_fn\",\n\t\"wf_runs_pool_root_snapshot_snapshot_carried_delete\",\n\t\"wf_runs_pool_root_snapshot_snapshot_carried_delete_fn\",\n\t\"wf_runs_pool_root_snapshot_snapshot_carried_insert\",\n\t\"wf_runs_pool_root_snapshot_snapshot_carried_insert_fn\",\n\t\"wf_runs_pool_root_snapshot_snapshot_carried_update\",\n\t\"wf_runs_pool_root_snapshot_snapshot_carried_update_fn\",\n\t\"wf_runs_pool_usage_totals_work_delete_fn\",\n]);\n\n/**\n * The longest storage prefix PostgreSQL takes: Postgres truncates an identifier longer than 63 bytes, so a longer\n * prefix would cut the longest name Atomic gives it, or make two names one. Prefixes are ASCII, one byte a character.\n */\nexport const POSTGRES_MAX_STORAGE_PREFIX_LENGTH =\n\t63 - Math.max(...POSTGRES_STORAGE_IDENTIFIER_SUFFIXES.map((suffix) => suffix.length));\n\n/**\n * What a worker pool of an earlier release added to the journal's prefix for the stores it carried on PostgreSQL: its\n * pooled-stage sessions and their snapshot index live under `<prefix>wf_ps_` (#4793). The length limit applies to the\n * prefix before it.\n */\nexport const POSTGRES_POOL_SESSION_PREFIX = \"wf_ps_\";\n\n/**\n * Check a storage prefix, and with `dialect`, that the backend can name every identifier under it. SQLite\n * have no identifier limit. On PostgreSQL the limit applies to the prefix a user chose: a worker pool's session prefix\n * (`<prefix>wf_ps_`) is checked as the prefix before it.\n */\nexport function validateStoragePrefix(prefix = \"\", dialect?: StorageDialectName): string {\n\tif (prefix !== \"\" && !/^[A-Za-z_][A-Za-z0-9_]*$/.test(prefix)) {\n\t\tthrow new StoragePrefixError(prefix, \"pattern\");\n\t}\n\tif (/^sqlite_/i.test(prefix)) throw new StoragePrefixError(prefix, \"reserved\");\n\tconst chosen = prefix.endsWith(POSTGRES_POOL_SESSION_PREFIX)\n\t\t? prefix.slice(0, -POSTGRES_POOL_SESSION_PREFIX.length)\n\t\t: prefix;\n\tif (dialect === \"postgres\" && /[A-Z]/.test(prefix)) throw new StoragePrefixError(prefix, \"uppercase\");\n\tif (dialect === \"postgres\" && chosen.length > POSTGRES_MAX_STORAGE_PREFIX_LENGTH)\n\t\tthrow new StoragePrefixError(prefix, \"too-long\", POSTGRES_MAX_STORAGE_PREFIX_LENGTH);\n\tif (dialect === \"postgres\") {\n\t\tconst collision = postgresIdentifierCollision(chosen);\n\t\tif (collision !== undefined) throw new StoragePrefixError(prefix, \"identifier-collision\", undefined, collision);\n\t}\n\treturn prefix;\n}\n\nconst postgresCollisions = new Map<string, string | undefined>();\n\n/**\n * The identifier PostgreSQL would know two of the names under `prefix` by, if any (#5219): a name too long to keep whole\n * is its head and a hash of the whole name, so two names that share their head differ only in that hash.\n */\nfunction postgresIdentifierCollision(prefix: string): string | undefined {\n\tif (postgresCollisions.has(prefix)) return postgresCollisions.get(prefix);\n\tconst seen = new Set<string>();\n\tlet collision: string | undefined;\n\tfor (const suffix of [...POSTGRES_STORAGE_IDENTIFIER_SUFFIXES, ...POSTGRES_HASHED_STORAGE_IDENTIFIER_SUFFIXES]) {\n\t\tconst identifier = postgresDialect.identifier(`${prefix}${suffix}`);\n\t\tif (seen.has(identifier)) {\n\t\t\tcollision = identifier;\n\t\t\tbreak;\n\t\t}\n\t\tseen.add(identifier);\n\t}\n\tpostgresCollisions.set(prefix, collision);\n\treturn collision;\n}\n\nexport function renderStorageIdentifiers<T extends Readonly<Record<string, string>>>(\n\tdomain: \"journal\" | \"sessions\",\n\tnames: T,\n\tprefix = \"\",\n): Readonly<{ [K in keyof T]: string }> {\n\tconst validated = validateStoragePrefix(prefix);\n\tconst domainPrefix = domain === \"journal\" ? \"wf_\" : \"session_\";\n\treturn Object.freeze(\n\t\tObject.fromEntries(Object.entries(names).map(([key, name]) => [key, `${validated}${domainPrefix}${name}`])),\n\t) as Readonly<{ [K in keyof T]: string }>;\n}\n\n/**\n * The ledger `applyStorageMigrations` records each domain's applied versions in, one per prefix: the Postgres schema\n * of every domain under `prefix` (#4793). SQLite keeps no ledger, so its schema is unchanged.\n */\nexport function storageMigrationTable(prefix = \"\"): string {\n\treturn `${validateStoragePrefix(prefix)}atomic_migrations`;\n}\n"]}
|
|
@@ -4,7 +4,7 @@ export declare const STORAGE_ENV = "ATOMIC_STORAGE";
|
|
|
4
4
|
export declare const SESSIONS_STORAGE_ENV = "ATOMIC_SESSIONS_STORAGE";
|
|
5
5
|
/**
|
|
6
6
|
* `sessions`: the session store, which has variables of its own. `shared`: the shared selection alone (`--storage`,
|
|
7
|
-
* `ATOMIC_STORAGE
|
|
7
|
+
* `ATOMIC_STORAGE`), as `atomic storage migrate` and the team layout read it.
|
|
8
8
|
*/
|
|
9
9
|
export type StorageDomain = "sessions" | "shared";
|
|
10
10
|
export type StorageFlag = "--storage" | "--storage-file";
|
|
@@ -45,7 +45,7 @@ export declare function validateProcessStorage(agentDir: string): void;
|
|
|
45
45
|
export declare function validateProcessStorageAsync(agentDir: string): Promise<void>;
|
|
46
46
|
/**
|
|
47
47
|
* The process-level storage selection for one domain: `--storage`/`--storage-file`, then, for sessions, the domain
|
|
48
|
-
* variable or its legacy path variable, then `ATOMIC_STORAGE
|
|
48
|
+
* variable or its legacy path variable, then `ATOMIC_STORAGE`.
|
|
49
49
|
* `undefined` leaves the choice to settings.
|
|
50
50
|
* Every set storage variable is validated, whichever one applies.
|
|
51
51
|
*/
|
|
@@ -56,9 +56,9 @@ export declare function selectProcessStorageSteps(domain: StorageDomain, agentDi
|
|
|
56
56
|
export declare function hasProcessStorageSelection(domain: StorageDomain): boolean;
|
|
57
57
|
/**
|
|
58
58
|
* The shared `storage` selection this process was launched with, as the `ATOMIC_STORAGE` value a child process it
|
|
59
|
-
* spawns should receive: `--storage`/`--storage-file`, then `ATOMIC_STORAGE
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
* spawns should receive: `--storage`/`--storage-file`, then `ATOMIC_STORAGE`. `undefined` leaves the choice to
|
|
60
|
+
* settings. A variable of the removed `ATOMIC_PROFILE=ci` team profile is refused, so a broker or Intercom session
|
|
61
|
+
* never starts without the database it named.
|
|
62
62
|
*/
|
|
63
63
|
export declare function processSharedStorageSelection(): string | undefined;
|
|
64
64
|
export declare function processSharedStorageSelectionAsync(): Promise<string | undefined>;
|
|
@@ -443,7 +443,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
443
443
|
return (async () => {
|
|
444
444
|
const root = new URL("../../", import.meta.url);
|
|
445
445
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
446
|
-
const key = `${root.href}#0.10.11-alpha.
|
|
446
|
+
const key = `${root.href}#0.10.11-alpha.4`;
|
|
447
447
|
let release = releases.get(key);
|
|
448
448
|
if (release === undefined) {
|
|
449
449
|
const current = (async () => {
|
|
@@ -471,7 +471,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
471
471
|
} catch {
|
|
472
472
|
// No installation to read, as in a bundle of the package: the release the process runs decides.
|
|
473
473
|
}
|
|
474
|
-
const updatedTo = typeof installed === "string" && installed !== "0.10.11-alpha.
|
|
474
|
+
const updatedTo = typeof installed === "string" && installed !== "0.10.11-alpha.4" ? installed : running !== undefined && running.version !== "0.10.11-alpha.4" ? "0.10.11-alpha.4" : undefined;
|
|
475
475
|
if (updatedTo === undefined) throw error;
|
|
476
476
|
const application = typeof running?.name === "string" ? running.name : "atomic";
|
|
477
477
|
const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SqliteDatabase, SqliteExecutor } from "./database.js";
|
|
2
|
+
import type { SequencedStatement } from "./statement-sequence.js";
|
|
2
3
|
/**
|
|
3
4
|
* What a schema held when one open read it: its relations, triggers and columns, and on PostgreSQL the versions its
|
|
4
5
|
* ledger records. Only a positive answer is final: the schema only moves forward, so what existed then still exists,
|
|
@@ -16,18 +17,17 @@ export interface StorageSchemaCatalog {
|
|
|
16
17
|
/** Whether `table` had a column named `column`. */
|
|
17
18
|
hasColumn(table: string, column: string): boolean;
|
|
18
19
|
/**
|
|
19
|
-
* Whether a function named `name` existed in the schema and this role may run it: PostgreSQL only, absent on SQLite
|
|
20
|
-
* and libSQL.
|
|
20
|
+
* Whether a function named `name` existed in the schema and this role may run it: PostgreSQL only, absent on SQLite.
|
|
21
21
|
*/
|
|
22
22
|
readonly hasFunction?: (name: string) => boolean;
|
|
23
23
|
/**
|
|
24
|
-
* What kind of object `name` was on SQLite
|
|
24
|
+
* What kind of object `name` was on SQLite (`table`, `index`, `view` or `trigger`), from one read of
|
|
25
25
|
* `sqlite_schema`; undefined when there was none, and always on PostgreSQL.
|
|
26
26
|
*/
|
|
27
27
|
readonly sqliteObjectType?: (name: string) => string | undefined;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* @internal The table under `ledger`'s prefix where SQLite
|
|
30
|
+
* @internal The table under `ledger`'s prefix where SQLite record which revision of each store's schema
|
|
31
31
|
* setup ran, and the database's schema version (`PRAGMA schema_version`) once it had: `domain`, `revision`,
|
|
32
32
|
* `schema_version`. SQLite counts every change to the schema in that version, whoever makes it, an older Atomic that
|
|
33
33
|
* records nothing included; a revision is believed only while the version still matches, so any later change is checked
|
|
@@ -44,8 +44,8 @@ export interface SqliteSchemaStamp {
|
|
|
44
44
|
* @internal Stamps each of `stamps`, in the transaction `tx` that ran their setups, with the schema version as that
|
|
45
45
|
* transaction leaves it: a later open believes their revisions until the schema changes again (#6560). Creates the
|
|
46
46
|
* stamps table first, unless `options.tableExists`, so its own creation is part of the version recorded. With
|
|
47
|
-
* `options.last`, the stamps are the transaction's last
|
|
48
|
-
* its commit. SQLite
|
|
47
|
+
* `options.last`, the stamps are the transaction's last statements: where its connection is pipelined, they go out with
|
|
48
|
+
* its commit. SQLite only; every stamp must share a ledger.
|
|
49
49
|
*/
|
|
50
50
|
export declare function recordSqliteSchemaStamps(tx: SqliteExecutor, stamps: readonly SqliteSchemaStamp[], options?: {
|
|
51
51
|
readonly tableExists?: boolean;
|
|
@@ -54,10 +54,60 @@ export declare function recordSqliteSchemaStamps(tx: SqliteExecutor, stamps: rea
|
|
|
54
54
|
/**
|
|
55
55
|
* Reads `database`'s schema and the versions `ledger` records, in one read-only transaction that takes no lock. On
|
|
56
56
|
* PostgreSQL, an adapter that read them when it opened gives them once (`takeOpenedCatalog`), and the first open reads
|
|
57
|
-
* nothing (#6560). On SQLite
|
|
57
|
+
* nothing (#6560). On SQLite, which record no versions, reads the schema alone in one statement. Undefined
|
|
58
58
|
* when a read fails: the stores then check each object themselves.
|
|
59
59
|
*/
|
|
60
60
|
export declare function readStorageSchemaCatalog(database: SqliteDatabase, ledger: string): Promise<StorageSchemaCatalog | undefined>;
|
|
61
|
+
/** @internal Context passed to a queued SQLite schema setup inside an open's single write transaction (#6709). */
|
|
62
|
+
export interface SqliteSchemaBatchContext {
|
|
63
|
+
/** The write transaction executor. */
|
|
64
|
+
readonly tx: SqliteExecutor;
|
|
65
|
+
/** The live schema catalog read at the start of the write transaction, authoritative under the write lock. */
|
|
66
|
+
readonly catalog: StorageSchemaCatalog | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Queues a SQLite write statement or multi-statement SQL script to run in order inside the transaction. Consecutive
|
|
69
|
+
* queued writes go out together to the connection thread, and the final run goes out with `COMMIT`. When
|
|
70
|
+
* `options.ignoreError` returns true for a statement's failure, that error is ignored.
|
|
71
|
+
*/
|
|
72
|
+
enqueue(statement: string | SequencedStatement, options?: {
|
|
73
|
+
readonly ignoreError?: (error: unknown) => boolean;
|
|
74
|
+
}): void;
|
|
75
|
+
/** Executes any writes queued so far; call before issuing a read on `tx` that depends on them. */
|
|
76
|
+
flushWrites(): Promise<void>;
|
|
77
|
+
/** Notes that this transaction added `column` to `table`, so a later queued setup does not add it again. */
|
|
78
|
+
noteColumnAdded(table: string, column: string): void;
|
|
79
|
+
/** Whether `table` already has `column` in `catalog` or added earlier in this transaction. */
|
|
80
|
+
hasColumn(table: string, column: string): boolean;
|
|
81
|
+
/** Notes that this transaction created `table`. */
|
|
82
|
+
noteTableCreated(table: string): void;
|
|
83
|
+
/** Whether `table` was created earlier in this transaction. */
|
|
84
|
+
createdTable(table: string): boolean;
|
|
85
|
+
/** Whether `table` already existed in `catalog` before this transaction began. */
|
|
86
|
+
tableExisted(table: string): boolean;
|
|
87
|
+
}
|
|
88
|
+
/** @internal A SQLite schema setup queued inside an open scope (`withStorageSchemaCatalog`) to run in one transaction. */
|
|
89
|
+
export interface SqliteSchemaBatchSetup {
|
|
90
|
+
/** Stamp recorded for this setup once the batched transaction commits, when the store uses SQLite schema stamps. */
|
|
91
|
+
readonly stamp?: SqliteSchemaStamp;
|
|
92
|
+
/** Whether the schema already holds everything this setup creates (for DDL-only setups without row seeds). */
|
|
93
|
+
readonly verify?: (catalog: StorageSchemaCatalog) => boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Checks outside any write lock whether another host completed this setup while we waited on `tryMaintenance`.
|
|
96
|
+
* Throwing (such as `StorageSchemaVersionError` for a newer build's database) immediately rejects the open.
|
|
97
|
+
*/
|
|
98
|
+
readonly done?: (catalog: StorageSchemaCatalog, stamps: ReadonlyMap<string, number> | undefined) => boolean | Promise<boolean>;
|
|
99
|
+
/** Reset any mutable per-attempt JS state before each transaction attempt or retry. */
|
|
100
|
+
readonly reset?: () => void;
|
|
101
|
+
/** Runs this setup inside the batched write transaction. */
|
|
102
|
+
readonly run: (context: SqliteSchemaBatchContext) => Promise<void> | void;
|
|
103
|
+
/**
|
|
104
|
+
* Optional setup (such as an FTS5 search index): if the transaction fails, the open retries with optional setups
|
|
105
|
+
* isolated in savepoints, calling `onFailure` instead of failing the open.
|
|
106
|
+
*/
|
|
107
|
+
readonly optional?: boolean;
|
|
108
|
+
/** Called when an optional setup fails and its savepoint rolls back. */
|
|
109
|
+
readonly onFailure?: () => void;
|
|
110
|
+
}
|
|
61
111
|
/** @internal How the end of an open stamps a store's setup: see {@link restampStorageSchemaAtOpenEnd}. */
|
|
62
112
|
export interface SchemaStampAtOpenEnd {
|
|
63
113
|
/**
|
|
@@ -80,8 +130,9 @@ export interface SchemaStampAtOpenEnd {
|
|
|
80
130
|
/**
|
|
81
131
|
* Runs `body`, an open of one or more stores on `database`, with one catalog read for all of them: the schema checks
|
|
82
132
|
* of the stores it opens ({@link schemaCatalogOf}) answer from it, so an open whose schema is current runs no schema
|
|
83
|
-
* transaction and takes no lock. Opens on `database` that overlap share the read.
|
|
84
|
-
*
|
|
133
|
+
* transaction and takes no lock. Opens on `database` that overlap share the read. On SQLite, setups queued inside the
|
|
134
|
+
* open ({@link queueSqliteSchemaSetup}) run in one write transaction before the root open returns (#6709). `views` are
|
|
135
|
+
* other handles on the same connection, such as a borrowed view, whose checks answer from the same read.
|
|
85
136
|
*/
|
|
86
137
|
export declare function withStorageSchemaCatalog<T>(database: SqliteDatabase, ledger: string, body: () => Promise<T>, views?: readonly SqliteDatabase[]): Promise<T>;
|
|
87
138
|
/**
|
|
@@ -100,21 +151,31 @@ export declare function noteStorageSchemaTables(database: SqliteDatabase, tables
|
|
|
100
151
|
*/
|
|
101
152
|
export declare function schemaCatalogOf(database: SqliteDatabase, ledger?: string): Promise<StorageSchemaCatalog | undefined>;
|
|
102
153
|
/**
|
|
103
|
-
* @internal The revisions the stamps under `ledger` record for the stores of `database` (SQLite
|
|
154
|
+
* @internal The revisions the stamps under `ledger` record for the stores of `database` (SQLite), by stamp
|
|
104
155
|
* key (`schema:<domain>`), as the open of `database` in progress read them; only those whose schema version was the
|
|
105
156
|
* database's then. Undefined outside such an open, and where none could be read, such as before any stamp. The first
|
|
106
157
|
* question reads them after the open's catalog, and only where it holds their table.
|
|
107
158
|
*/
|
|
108
159
|
export declare function sqliteSchemaStampsOf(database: SqliteDatabase, ledger: string): Promise<ReadonlyMap<string, number> | undefined>;
|
|
160
|
+
/**
|
|
161
|
+
* @internal Queues `setup` into the active SQLite open scope (`withStorageSchemaCatalog`) so that all needed setups of
|
|
162
|
+
* the open execute in one write transaction before the open returns (#6709). Returns `false` outside a SQLite open
|
|
163
|
+
* scope (or for a different `ledger`), in which case the caller runs `setup` immediately.
|
|
164
|
+
*/
|
|
165
|
+
export declare function queueSqliteSchemaSetup(database: SqliteDatabase, ledger: string | undefined, setup: SqliteSchemaBatchSetup): boolean;
|
|
166
|
+
/**
|
|
167
|
+
* @internal Executes and commits any SQLite schema setups queued so far in the active open scope, before the open
|
|
168
|
+
* needs their committed tables or evaluated outcomes (#6709). No-op when nothing is queued or outside a SQLite open.
|
|
169
|
+
*/
|
|
170
|
+
export declare function flushStorageSchemaSetups(database: SqliteDatabase, ledger?: string): Promise<void>;
|
|
109
171
|
/**
|
|
110
172
|
* @internal Tells the open of `database` in progress that it checked `setup`, the schema setup `stamp` names, without
|
|
111
|
-
* its stamp (SQLite
|
|
173
|
+
* its stamp (SQLite only): it ran it in a transaction that stamped it, found every object it creates in the
|
|
112
174
|
* catalog (with `verify`), or leaves it to the end (`deferred`). A schema change later in the same open, such as the
|
|
113
175
|
* next store's setup or a column it adds, leaves a stamp behind the schema version, and a store found in the catalog has
|
|
114
|
-
* none that is current, so the next open would check it again. The open's end
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* nothing is kept, outside such an open: the caller then runs `setup` as it would without stamps.
|
|
176
|
+
* none that is current, so the next open would check it again. The open's end checks or runs them in one transaction
|
|
177
|
+
* and stamps them all with the version it leaves: the next open of a current schema then takes no write lock and answers
|
|
178
|
+
* every such store from its stamp (#6560, #6709). False, and nothing is kept, outside such an open.
|
|
118
179
|
*/
|
|
119
180
|
export declare function restampStorageSchemaAtOpenEnd(database: SqliteDatabase, stamp: SqliteSchemaStamp, setup: (tx: SqliteExecutor) => Promise<unknown>, options?: SchemaStampAtOpenEnd): boolean;
|
|
120
181
|
//# sourceMappingURL=schema-catalog.d.ts.map
|