@bastani/atomic 0.10.10-alpha.2 → 0.10.11-alpha.1
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 +142 -0
- package/README.md +1 -1
- 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 +8 -10
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +6 -6
- package/dist/_shared/mode-shared-2QJSCUM6.js +52 -15
- package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
- package/dist/_shared/runtime-O4KCSG4C.js +3 -3
- package/dist/_shared/{sdk-RRLVN7ER.js → sdk-AVFII7NK.js} +757 -233
- package/dist/_shared/sdk-AVFII7NK.js.map +1 -0
- package/dist/_shared/session-data-AHTU7IS6.js +3 -3
- package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
- package/dist/_shared/{startup-0-0-4VG2G44V.js → startup-0-0-57KF6LZH.js} +94 -42
- package/dist/_shared/startup-0-0-57KF6LZH.js.map +1 -0
- package/dist/_shared/{startup-0-1-XTIL65D4.js → startup-0-1-GIY75K46.js} +75 -13
- package/dist/_shared/startup-0-1-GIY75K46.js.map +1 -0
- package/dist/_shared/startup-0-2-27OWFHV6.js +72 -7
- package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -1
- package/dist/_shared/startup-0-3-T4DVFYWX.js +4 -4
- package/dist/_shared/startup-0-4-ZMJV547D.js +4 -4
- package/dist/_shared/{startup-0-5-FD2P735I.js → startup-0-5-YDW47QX6.js} +27 -69
- package/dist/_shared/startup-0-5-YDW47QX6.js.map +1 -0
- package/dist/_shared/startup-10-0-TDQNBDDL.js +6 -6
- package/dist/_shared/startup-12-0-55AAXBJZ.js +3 -3
- package/dist/_shared/startup-14-0-MLX36RBG.js +4 -4
- package/dist/_shared/startup-15-0-YUKGAC63.js +31 -7
- package/dist/_shared/startup-15-0-YUKGAC63.js.map +1 -1
- package/dist/_shared/startup-15-1-4S7FLMNG.js +7 -6
- package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +4 -4
- package/dist/_shared/{startup-8-1-4KANEHRA.js → startup-8-1-X32CYSXB.js} +1219 -714
- package/dist/_shared/startup-8-1-X32CYSXB.js.map +1 -0
- package/dist/_shared/storage-command-7MGXLJGZ.js +14 -8
- package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
- package/dist/_shared/task-reference-stream-JWMUZSJX.js +1 -1
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +24 -0
- package/dist/builtin/intercom/broker/broker.bundle.mjs +993 -362
- package/dist/builtin/intercom/broker/database-wake-up-bus.ts +103 -24
- package/dist/builtin/intercom/broker/multinode-router.ts +42 -21
- package/dist/builtin/intercom/broker/multinode-state-store.ts +22 -1
- package/dist/builtin/intercom/broker/open-broker-state.ts +82 -31
- package/dist/builtin/intercom/broker/paths.ts +8 -4
- package/dist/builtin/intercom/broker/released-asker-remote-replies.ts +18 -6
- package/dist/builtin/intercom/broker/sql-add-column.ts +4 -1
- package/dist/builtin/intercom/broker/sql-ended-child-queue-store.ts +65 -44
- package/dist/builtin/intercom/broker/sql-held-send-store.ts +11 -3
- package/dist/builtin/intercom/broker/sql-known-session-store.ts +24 -12
- package/dist/builtin/intercom/broker/sql-lease-store.ts +375 -65
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +270 -101
- package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +20 -9
- package/dist/builtin/intercom/broker/sql-released-ask-store.ts +14 -6
- package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +27 -11
- package/dist/builtin/intercom/broker/sql-schema.ts +139 -1
- package/dist/builtin/intercom/broker/sql-sent-message-authority.ts +97 -34
- package/dist/builtin/intercom/index.bundle.mjs +11 -8
- 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/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +62 -23
- package/dist/builtin/web-access/CHANGELOG.md +9 -0
- package/dist/builtin/web-access/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- 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 +2 -2
- 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 +2 -2
- package/dist/cli/team-command.impl.js +3 -3
- package/dist/cli/team-command.js +3 -3
- package/dist/cli.js +2 -2
- package/dist/core/agent-session-methods.d.ts +3 -0
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/compaction/compactor.d.ts +2 -0
- package/dist/core/debug.impl.js +3 -3
- package/dist/core/debug.js +3 -3
- package/dist/core/export-html/card-projection.code.js +1 -1
- 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 +2 -2
- 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.code.js +1 -1
- 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 +2 -2
- package/dist/core/extensions/runner-context.js +3 -3
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/intercom-broker-control-host.code.js +1 -1
- 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/model-registry.js +1 -1
- package/dist/core/model-resolver-defaults.d.ts +3 -2
- 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/sdk.code.js +3 -4
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.d.ts +5 -2
- package/dist/core/session-manager-core.js +17 -13
- package/dist/core/session-manager-core.js.map +1 -1
- 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/storage/added-exports.d.ts +6 -0
- package/dist/core/storage/added-exports.js +16 -0
- package/dist/core/storage/added-exports.js.map +1 -0
- package/dist/core/storage/database.d.ts +16 -0
- package/dist/core/storage/database.js.map +1 -1
- package/dist/core/storage/fenced-paths.d.ts +47 -0
- package/dist/core/storage/fenced-paths.js +53 -0
- package/dist/core/storage/fenced-paths.js.map +1 -1
- package/dist/core/storage/file-identity.js +31 -2
- package/dist/core/storage/file-identity.js.map +1 -1
- package/dist/core/storage/index.d.ts +3 -0
- package/dist/core/storage/index.js +5 -2
- package/dist/core/storage/index.js.map +1 -1
- package/dist/core/storage/migrations.d.ts +22 -0
- package/dist/core/storage/migrations.js +55 -0
- package/dist/core/storage/migrations.js.map +1 -1
- package/dist/core/storage/node-sqlite-thread.js +19 -6
- package/dist/core/storage/node-sqlite-thread.js.map +1 -1
- package/dist/core/storage/node-sqlite.js +53 -4
- 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 +3 -2
- package/dist/core/storage/prefix.js +18 -2
- package/dist/core/storage/prefix.js.map +1 -1
- package/dist/core/storage/provider.js +2 -2
- package/dist/core/storage/schema-catalog.d.ts +42 -0
- package/dist/core/storage/schema-catalog.js +141 -0
- package/dist/core/storage/schema-catalog.js.map +1 -0
- package/dist/core/storage/selection.js +2 -2
- package/dist/core/storage/session/branch-fork-source.code.js +41 -20
- package/dist/core/storage/session/branch-fork-source.code.js.map +1 -1
- 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.code.js +1 -1
- 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 +3 -3
- 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-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 +176 -36
- 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-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-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 +2 -2
- 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 +5 -0
- 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-chat-records.d.ts +15 -0
- package/dist/core/storage/session/sql-session-store.code.js +1 -1
- package/dist/core/storage/session/sql-session-store.d.ts +102 -5
- package/dist/core/storage/session/sql-session-store.impl.js +4 -4
- package/dist/core/storage/session/sql-session-store.js +4 -4
- 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.code.js +1 -1
- 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/session/types.d.ts +14 -0
- package/dist/core/storage/sqlite-facade.d.ts +37 -5
- package/dist/core/storage/sqlite-facade.js +351 -18
- package/dist/core/storage/sqlite-facade.js.map +1 -1
- package/dist/core/storage/statement-sequence.d.ts +83 -0
- package/dist/core/storage/statement-sequence.js +21 -0
- package/dist/core/storage/statement-sequence.js.map +1 -1
- 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.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.code.js +1 -1
- 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/bash.d.ts +8 -4
- package/dist/core/tools/history-session.d.ts +5 -0
- package/dist/core/tools/history-tasks.d.ts +123 -0
- package/dist/core/tools/kill.d.ts +5 -2
- package/dist/core/tools/powershell.d.ts +2 -2
- package/dist/core/tools/read-url.code.js +3 -3
- package/dist/core/tools/read-url.impl.js +3 -3
- package/dist/core/tools/read-url.js +3 -3
- package/dist/core/tools/read.d.ts +12 -2
- package/dist/core/tools/resource-selectors.d.ts +2 -0
- package/dist/core/tools/search.d.ts +12 -2
- package/dist/core/worktree-snapshot/blob-store.d.ts +14 -2
- package/dist/core/worktree-snapshot/blob-store.js +69 -16
- 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/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 +2 -2
- 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.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/agent-panel.d.ts +1 -0
- 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/task-inspector.d.ts +2 -0
- package/dist/modes/interactive/components/user-message-selector-archive.code.js +1 -1
- 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/interactive-mode-helpers.d.ts +2 -2
- package/dist/modes/print-mode.js +1 -1
- package/dist/modes/rpc/agent-panel-bridge.d.ts +5 -0
- 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/0.js +1 -1
- package/dist/startup-stages/1.js +1 -1
- package/dist/startup-stages/10.js +1 -1
- package/dist/startup-stages/12.js +1 -1
- package/dist/startup-stages/2.js +8 -1
- package/dist/startup-stages/3.js +1 -6
- package/dist/startup-stages/5.js +1 -1
- package/dist/startup-stages/7.js +1 -5
- 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/docs/background-tasks.md +123 -23
- package/docs/compaction.md +18 -0
- package/docs/docs.json +2 -0
- package/docs/environment-variables.md +1 -1
- package/docs/getting-started/installation.md +9 -2
- package/docs/guides/postgres-pgbouncer.md +339 -0
- package/docs/guides/postgres-tuning.md +311 -0
- package/docs/guides/resume-on-any-machine.md +2 -2
- package/docs/guides.md +2 -0
- package/docs/index.md +1 -1
- package/docs/libraries/agent-core.md +1 -1
- package/docs/libraries/ai.md +2 -2
- package/docs/libraries/codemode.md +1 -1
- package/docs/libraries/storage-libsql.md +6 -1
- package/docs/libraries/storage-postgres.md +11 -6
- package/docs/libraries/tui.md +1 -1
- package/docs/libraries.md +2 -2
- package/docs/programmatic.md +1 -1
- package/docs/quickstart.md +1 -1
- package/docs/sdk/storage.md +1 -1
- package/docs/sdk/web-server.md +1 -3
- package/docs/sdk.md +1 -7
- package/docs/sessions.md +58 -2
- package/docs/settings.md +20 -1
- package/docs/skills/authoring.md +1 -1
- package/docs/skills.md +79 -6
- package/docs/storage.md +262 -12
- package/docs/subagents/reference.md +2 -2
- package/docs/subagents.md +4 -3
- package/docs/tools.md +44 -10
- package/docs/windows.md +1 -1
- package/package.json +9 -9
- package/dist/_shared/sdk-RRLVN7ER.js.map +0 -1
- package/dist/_shared/startup-0-0-4VG2G44V.js.map +0 -1
- package/dist/_shared/startup-0-1-XTIL65D4.js.map +0 -1
- package/dist/_shared/startup-0-5-FD2P735I.js.map +0 -1
- package/dist/_shared/startup-8-1-4KANEHRA.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { type BashOperations, type BashSpawnContext, type BashSpawnHook, type Ba
|
|
|
2
2
|
import { type SupervisedCommandOwner } from "./bash-pty-native.js";
|
|
3
3
|
export declare const powershellToolSystemPromptContribution: Readonly<{
|
|
4
4
|
readonly snippet: "Execute PowerShell commands.";
|
|
5
|
-
readonly guidelines: readonly ["You can inspect ATOMIC_* or PI_* environment variables for current model and session details.", "Use { action: \"wait\", id: taskId } to observe an existing shell task with the owner policy. Avoid repeated short polls; await completion notifications when no dependent work is blocked. Never relaunch a yielded command. Waiting
|
|
5
|
+
readonly guidelines: readonly ["You can inspect ATOMIC_* or PI_* environment variables for current model and session details.", "Use { action: \"wait\", id: taskId } to observe an existing shell task with the owner policy. Avoid repeated short polls; await completion notifications when no dependent work is blocked. Never relaunch a yielded command. Waiting never stops a command or changes when it stops.", "For ordinary commands, omit wait to use the owner's observation policy (normally 10s). Do not routinely request one-second waits: premature yields add tool calls without making the command faster. Use a short budget only for a concrete responsiveness need, or explicit background observation when you have independent work to do. Explicit budgets, including zero for polling, remain available.", "Choose foreground or background shell observation as needed without asking the user each time. Background yields after admission; foreground waits for its optional budget then the same command continues in background. Omitted wait uses owner-configured automatic background yield (default 10s). Observation never stops the command. Background requires a supported task owner; unbound foreground waits until completion regardless of budget.", "A command has no time limit: it runs until it exits, kill({ id: taskId }) stops it, or this session ends. Set timeout (in seconds) only when it must stop by a deadline; timeout: 600 stops it after 10 minutes. Up to 64 commands run at once in a session; at that limit a new command is refused until one finishes or is stopped."];
|
|
6
6
|
}>;
|
|
7
7
|
export type PowerShellOperations = BashOperations;
|
|
8
8
|
export type PowerShellToolDetails = BashToolDetails;
|
|
@@ -183,7 +183,7 @@ export declare function createPowerShellToolDefinition(cwd: string, options?: Po
|
|
|
183
183
|
} & Partial<Record<"command" | "cwd" | "env" | "heartbeatMs" | "pty" | "timeout" | "wait", never>>), signal: AbortSignal | undefined, onUpdate: import("@bastani/atomic-agent-core").AgentToolUpdateCallback<BashToolDetails | undefined> | undefined, ctx: import("../extensions/context-types.ts").ExtensionToolContext): Promise<import("@bastani/atomic-agent-core").AgentToolResult<BashToolDetails | undefined>>;
|
|
184
184
|
description: string;
|
|
185
185
|
promptSnippet: "Execute PowerShell commands.";
|
|
186
|
-
promptGuidelines: ("Choose foreground or background shell observation as needed without asking the user each time. Background yields after admission; foreground waits for its optional budget then the same command continues in background. Omitted wait uses owner-configured automatic background yield (default 10s). Observation never
|
|
186
|
+
promptGuidelines: ("A command has no time limit: it runs until it exits, kill({ id: taskId }) stops it, or this session ends. Set timeout (in seconds) only when it must stop by a deadline; timeout: 600 stops it after 10 minutes. Up to 64 commands run at once in a session; at that limit a new command is refused until one finishes or is stopped." | "Choose foreground or background shell observation as needed without asking the user each time. Background yields after admission; foreground waits for its optional budget then the same command continues in background. Omitted wait uses owner-configured automatic background yield (default 10s). Observation never stops the command. Background requires a supported task owner; unbound foreground waits until completion regardless of budget." | "For ordinary commands, omit wait to use the owner's observation policy (normally 10s). Do not routinely request one-second waits: premature yields add tool calls without making the command faster. Use a short budget only for a concrete responsiveness need, or explicit background observation when you have independent work to do. Explicit budgets, including zero for polling, remain available." | "Use { action: \"wait\", id: taskId } to observe an existing shell task with the owner policy. Avoid repeated short polls; await completion notifications when no dependent work is blocked. Never relaunch a yielded command. Waiting never stops a command or changes when it stops." | "You can inspect ATOMIC_* or PI_* environment variables for current model and session details.")[] | undefined;
|
|
187
187
|
};
|
|
188
188
|
export declare function createPowerShellTool(cwd: string, options?: PowerShellToolOptions): import("@bastani/atomic-agent-core").AgentTool<import("typebox").TUnsafe<({
|
|
189
189
|
command: string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { __toESM } from "../../_shared/rolldown-runtime-BGM3D5V3.js";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { getAgentDir } from "../../_shared/p0-cli-BB45ZQY6.js";
|
|
4
|
-
import { sessionScratchDir } from "../../_shared/startup-0-1-
|
|
4
|
+
import { sessionScratchDir } from "../../_shared/startup-0-1-GIY75K46.js";
|
|
5
5
|
import { lookup } from "node:dns/promises";
|
|
6
6
|
import { channel, tracingChannel } from "node:diagnostics_channel";
|
|
7
7
|
import { require_turndown_cjs } from "../../_shared/turndown.cjs-7Z43JOED.js";
|
|
8
8
|
import { require_undici } from "../../_shared/http-undici-FVPTZA4G.js";
|
|
9
9
|
import { findAsciiCaseInsensitive, isAsciiWordCode } from "../../_shared/p1b-elig-ENCUPKKJ.js";
|
|
10
|
-
import { applyReadLineSelection, decodeReadableUrl, extractDocumentMarkdown, getArtifactManager, isDocumentPath } from "../../_shared/startup-8-1-
|
|
11
|
-
import { isReadableUrlPath, repairCollapsedScheme } from "../../_shared/startup-0-0-
|
|
10
|
+
import { applyReadLineSelection, decodeReadableUrl, extractDocumentMarkdown, getArtifactManager, isDocumentPath } from "../../_shared/startup-8-1-X32CYSXB.js";
|
|
11
|
+
import { isReadableUrlPath, repairCollapsedScheme } from "../../_shared/startup-0-0-57KF6LZH.js";
|
|
12
12
|
import { isIP } from "node:net";
|
|
13
13
|
// ../../node_modules/lru-cache/dist/esm/node/index.min.js
|
|
14
14
|
var S = channel("lru-cache:metrics");
|
|
@@ -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.
|
|
9
|
+
const key = `${root.href}#0.10.11-alpha.1`;
|
|
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.
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.
|
|
30
|
+
if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using this feature.", {
|
|
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.
|
|
9
|
+
const key = `${root.href}#0.10.11-alpha.1`;
|
|
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.
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.
|
|
30
|
+
if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -3,13 +3,21 @@ import type { ModelImageResizeOptions } from "@bastani/atomic-ai/compat";
|
|
|
3
3
|
import { type Static, Type } from "@bastani/atomic-ai/utils/typebox/index";
|
|
4
4
|
import type { ToolDefinition } from "../extensions/types.ts";
|
|
5
5
|
import { type DirectoryTreeEntry } from "./directory-tree.ts";
|
|
6
|
+
import { type HistoryTaskRegistry } from "./history-tasks.ts";
|
|
6
7
|
import { type TruncationResult } from "./truncate.ts";
|
|
7
|
-
declare const
|
|
8
|
+
declare const readBaseSchema: Type.TObject<{
|
|
8
9
|
path: Type.TString;
|
|
10
|
+
wait: Type.TOptional<Type.TUnsafe<import("../tasks/contracts.ts").WaitPolicy>>;
|
|
9
11
|
}>;
|
|
12
|
+
type ReadCallInput = Static<typeof readBaseSchema> & {
|
|
13
|
+
action?: never;
|
|
14
|
+
id?: never;
|
|
15
|
+
budgetMs?: never;
|
|
16
|
+
};
|
|
17
|
+
declare const readSchema: Type.TUnsafe<ReadCallInput>;
|
|
10
18
|
export declare const readToolSystemPromptContribution: Readonly<{
|
|
11
19
|
readonly snippet: "Read a path selector.";
|
|
12
|
-
readonly guidelines: readonly ["Use read to inspect file and resource contents; use path selectors for line ranges, raw output, and conflict views."];
|
|
20
|
+
readonly guidelines: readonly ["Use read to inspect file and resource contents; use path selectors for line ranges, raw output, and conflict views.", "A history:// read or search waits for its result like bash does: 10 seconds by default, or as set by wait (wait: { kind: \"background\" } returns at once). If it is still running then, it keeps running in the background with no time limit and returns a task ID, and its result arrives later as a completion notice. To wait for that result, call the same tool with { action: \"wait\", id }; to stop it, call kill({ id }). Never repeat the call to get its result. Up to 4 run at once in a session; at that limit a new one is refused until one finishes or is stopped."];
|
|
13
21
|
}>;
|
|
14
22
|
export type ReadToolInput = Static<typeof readSchema>;
|
|
15
23
|
declare const readOutputSchema: Type.TUnion<[Type.TString, Type.TObject<{
|
|
@@ -68,6 +76,8 @@ export interface ReadToolOptions {
|
|
|
68
76
|
/** Fallback resize profile when the execution context has no model metadata. */
|
|
69
77
|
resizeOptions?: ModelImageResizeOptions;
|
|
70
78
|
operations?: ReadOperations;
|
|
79
|
+
/** The session's background history tasks, resolved per call; without them a history:// read runs inline. */
|
|
80
|
+
historyTasks?: () => HistoryTaskRegistry | undefined;
|
|
71
81
|
}
|
|
72
82
|
export interface ReadRenderState {
|
|
73
83
|
resolving?: string;
|
|
@@ -88,6 +88,8 @@ export declare function searchArchiveSelector(selector: ArchiveSelector, pattern
|
|
|
88
88
|
/** One router from several: each operation goes to the first router that handles the URL. */
|
|
89
89
|
export declare function composeInternalRouters(...routers: readonly InternalResourceRouter[]): InternalResourceRouter;
|
|
90
90
|
export declare function resolveInternalSelector(value: string, cwd: string): Promise<string | undefined>;
|
|
91
|
+
/** The filesystem path an internal URL names, asking the session's routers before the workspace fallback. */
|
|
92
|
+
export declare function resolveInternalPath(value: string, cwd: string, context?: InternalResourceContext): Promise<string | undefined>;
|
|
91
93
|
export declare function readInternalSelector(value: string, cwd: string, context?: InternalResourceContext): Promise<string>;
|
|
92
94
|
export declare function readInternalSelected(value: string, selection: InternalReadSelection, context?: InternalResourceContext): Promise<string | undefined>;
|
|
93
95
|
export declare function writeInternalSelector(value: string, cwd: string, content: string, context?: InternalResourceContext): Promise<void>;
|
|
@@ -2,24 +2,34 @@ import type { AgentTool } from "@bastani/atomic-agent-core";
|
|
|
2
2
|
import { type Static, Type } from "@bastani/atomic-ai/utils/typebox/index";
|
|
3
3
|
import type { ToolDefinition } from "../extensions/types.ts";
|
|
4
4
|
import { type GrepToolOptions } from "./grep.ts";
|
|
5
|
+
import { type HistoryTaskRegistry } from "./history-tasks.ts";
|
|
5
6
|
import { type SearchToolDetails } from "./search-details.ts";
|
|
6
7
|
export type { SearchToolDetails } from "./search-details.ts";
|
|
7
|
-
declare const
|
|
8
|
+
declare const searchBaseSchema: Type.TObject<{
|
|
8
9
|
pattern: Type.TString;
|
|
9
10
|
paths: Type.TOptional<Type.TUnion<[Type.TString, Type.TArray<Type.TString>]>>;
|
|
10
11
|
i: Type.TOptional<Type.TBoolean>;
|
|
11
12
|
gitignore: Type.TOptional<Type.TBoolean>;
|
|
12
13
|
case: Type.TOptional<Type.TBoolean>;
|
|
13
14
|
skip: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
|
|
15
|
+
wait: Type.TOptional<Type.TUnsafe<import("../tasks/contracts.ts").WaitPolicy>>;
|
|
14
16
|
}>;
|
|
17
|
+
type SearchCallInput = Static<typeof searchBaseSchema> & {
|
|
18
|
+
action?: never;
|
|
19
|
+
id?: never;
|
|
20
|
+
budgetMs?: never;
|
|
21
|
+
};
|
|
22
|
+
declare const searchSchema: Type.TUnsafe<SearchCallInput>;
|
|
15
23
|
export declare const searchToolSystemPromptContribution: Readonly<{
|
|
16
24
|
readonly snippet: "Search file contents with regex patterns.";
|
|
17
|
-
readonly guidelines: readonly [];
|
|
25
|
+
readonly guidelines: readonly ["A history:// read or search waits for its result like bash does: 10 seconds by default, or as set by wait (wait: { kind: \"background\" } returns at once). If it is still running then, it keeps running in the background with no time limit and returns a task ID, and its result arrives later as a completion notice. To wait for that result, call the same tool with { action: \"wait\", id }; to stop it, call kill({ id }). Never repeat the call to get its result. Up to 4 run at once in a session; at that limit a new one is refused until one finishes or is stopped."];
|
|
18
26
|
}>;
|
|
19
27
|
export type SearchToolInput = Static<typeof searchSchema>;
|
|
20
28
|
export type SearchToolOptions = GrepToolOptions & {
|
|
21
29
|
contextBefore?: number;
|
|
22
30
|
contextAfter?: number;
|
|
31
|
+
/** The session's background history tasks, resolved per call; without them a history:// search runs inline. */
|
|
32
|
+
historyTasks?: () => HistoryTaskRegistry | undefined;
|
|
23
33
|
};
|
|
24
34
|
export declare function createSearchToolDefinition(cwd: string, options?: SearchToolOptions): ToolDefinition<typeof searchSchema, SearchToolDetails | undefined>;
|
|
25
35
|
export declare function createSearchTool(cwd: string, options?: SearchToolOptions): AgentTool<typeof searchSchema>;
|
|
@@ -269,7 +269,16 @@ export declare class SqlSnapshotBlobStore implements SnapshotBlobStore {
|
|
|
269
269
|
* binds more than one chunk (#4954); the chunks of a blob stored already are not written again. Unknown ages
|
|
270
270
|
* remain protected until collection stamps them.
|
|
271
271
|
*/
|
|
272
|
-
putBlobs(
|
|
272
|
+
putBlobs(unordered: readonly SnapshotBlob[]): Promise<void>;
|
|
273
|
+
/**
|
|
274
|
+
* How a put or a refresh of this table's blobs runs: a serial transaction of the blob table's own domain (#6560). On
|
|
275
|
+
* PostgreSQL it holds the database-wide lock shared, so it waits for and excludes collection, whose writes hold that
|
|
276
|
+
* lock exclusively, and the blob writers of this table exclude one another, but session writes, which hold the
|
|
277
|
+
* database-wide lock shared with their session's domain, run beside it. Rows it writes again (`created_at`) are locked
|
|
278
|
+
* in hash order, as an append's check of the blobs it records locks them (`missingBlob`), so neither waits on the
|
|
279
|
+
* other in a cycle. Its callback only uses the transaction, so a transient failure runs it again.
|
|
280
|
+
*/
|
|
281
|
+
private blobWrite;
|
|
273
282
|
/**
|
|
274
283
|
* The blob's bytes, read a chunk per statement when it has chunks, so no response holds more than one chunk. A
|
|
275
284
|
* chunked blob whose chunks are not all there, as when a collection deleted it during the read, is not returned.
|
|
@@ -291,7 +300,10 @@ export declare class SqlSnapshotBlobStore implements SnapshotBlobStore {
|
|
|
291
300
|
* outside a transaction to check in the request that writes it (#5077); undefined when they name no blob.
|
|
292
301
|
*/
|
|
293
302
|
storedFence(snapshots: readonly WorktreeSnapshot[]): SqliteStatement | undefined;
|
|
294
|
-
/**
|
|
303
|
+
/**
|
|
304
|
+
* The first of `snapshots`' blobs this table does not hold in full, read in `transaction`; undefined when none. The
|
|
305
|
+
* rows it finds stay locked FOR SHARE until the transaction ends, taken in hash order as a blob write takes them.
|
|
306
|
+
*/
|
|
295
307
|
missingBlob(transaction: SqliteExecutor, snapshots: readonly WorktreeSnapshot[]): Promise<string | undefined>;
|
|
296
308
|
/**
|
|
297
309
|
* Installs the index triggers of every referencing table that lacks them, each with a watermark, the highest rowid
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { transactionFinisher } from "../storage/added-exports.js";
|
|
1
2
|
import { dialectOf } from "../storage/dialect.js";
|
|
2
3
|
import { StorageWriteLockTimeoutError } from "../storage/errors.js";
|
|
3
4
|
import { applyStorageMigrations, withShortSchemaLockWaits } from "../storage/migrations.js";
|
|
4
5
|
import { renderStorageIdentifiers, storageMigrationTable, validateStoragePrefix } from "../storage/prefix.js";
|
|
6
|
+
import { schemaCatalogOf } from "../storage/schema-catalog.js";
|
|
5
7
|
import { statementBatch } from "../storage/statement-batches.js";
|
|
6
8
|
/**
|
|
7
9
|
* The key under which a failed rename's error carries the trigger or view that stopped it, once confirmed in the
|
|
@@ -40,6 +42,13 @@ export function snapshotBlobHashes(snapshot) {
|
|
|
40
42
|
hashes.push(snapshot.bundle.blob);
|
|
41
43
|
return [...new Set(hashes)];
|
|
42
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Compares two blob hashes as `ORDER BY hash` with the dialect's `byteOrderCollation` does: the hashes are ASCII (hex
|
|
47
|
+
* digests), whose UTF-16 code unit order is their byte order.
|
|
48
|
+
*/
|
|
49
|
+
function byteOrder(first, second) {
|
|
50
|
+
return first < second ? -1 : first > second ? 1 : 0;
|
|
51
|
+
}
|
|
43
52
|
/**
|
|
44
53
|
* The blob hashes a recorded snapshot names, read as the reference index reads them: a write never fails on a record
|
|
45
54
|
* whose chain or bundle is not well formed, which references nothing it cannot read.
|
|
@@ -964,17 +973,30 @@ export class SqlSnapshotBlobStore {
|
|
|
964
973
|
static async open(database, prefix = "") {
|
|
965
974
|
const t = snapshotIndexTables(prefix);
|
|
966
975
|
const dialect = dialectOf(database);
|
|
976
|
+
const columns = [
|
|
977
|
+
[t.blobs, "created_at"],
|
|
978
|
+
[t.blobs, "chunks"],
|
|
979
|
+
...SESSION_REF_COLUMNS.map((column) => [t.sessionRefs, column]),
|
|
980
|
+
];
|
|
981
|
+
const triggers = [`${t.blobs}_chunks_delete_all`, `${t.blobs}_chunks_delete`];
|
|
967
982
|
const probes = [
|
|
968
983
|
...Object.values(t).map((table) => dialect.tableExists(table)),
|
|
969
|
-
dialect.columnExists(
|
|
970
|
-
dialect.
|
|
971
|
-
dialect.schemaObjects([`${t.blobs}_chunks_delete_all`, `${t.blobs}_chunks_delete`]),
|
|
972
|
-
...SESSION_REF_COLUMNS.map((column) => dialect.columnExists(t.sessionRefs, column)),
|
|
984
|
+
...columns.map(([table, column]) => dialect.columnExists(table, column)),
|
|
985
|
+
dialect.schemaObjects(triggers),
|
|
973
986
|
];
|
|
974
|
-
|
|
987
|
+
// A versioned database checks its ledger whatever the probes find, so it does not ask them. Elsewhere the catalog
|
|
988
|
+
// an open read answers them all, in one read instead of a read each (#6560).
|
|
989
|
+
const catalog = dialect.versionedMigrations ? undefined : await schemaCatalogOf(database);
|
|
990
|
+
const current = dialect.versionedMigrations
|
|
991
|
+
? false
|
|
992
|
+
: catalog !== undefined
|
|
993
|
+
? Object.values(t).every((table) => catalog.hasTable(table)) &&
|
|
994
|
+
columns.every(([table, column]) => catalog.hasColumn(table, column)) &&
|
|
995
|
+
triggers.some((trigger) => catalog.hasObject(trigger))
|
|
996
|
+
: (await Promise.all(probes.map((probe) => database.get(probe.sql, ...probe.params)))).every((row) => row !== undefined);
|
|
975
997
|
// A versioned database always checks its ledger: a newer schema with the same tables is refused, and a step it
|
|
976
998
|
// lacks, such as the index triggers, runs even when every table exists.
|
|
977
|
-
if (
|
|
999
|
+
if (!current) {
|
|
978
1000
|
await applyStorageMigrations(database, SNAPSHOT_BLOB_DOMAIN, [
|
|
979
1001
|
{ version: 1, up: (transaction, dialect) => createSnapshotIndexTables(transaction, t, prefix, dialect) },
|
|
980
1002
|
// Where a ledger records the steps, it records the index triggers too, installed under the migration lock.
|
|
@@ -1085,9 +1107,11 @@ export class SqlSnapshotBlobStore {
|
|
|
1085
1107
|
* binds more than one chunk (#4954); the chunks of a blob stored already are not written again. Unknown ages
|
|
1086
1108
|
* remain protected until collection stamps them.
|
|
1087
1109
|
*/
|
|
1088
|
-
async putBlobs(
|
|
1089
|
-
if (
|
|
1110
|
+
async putBlobs(unordered) {
|
|
1111
|
+
if (unordered.length === 0)
|
|
1090
1112
|
return;
|
|
1113
|
+
// In hash order, so the rows it locks are taken in the order every other write of them takes them.
|
|
1114
|
+
const blobs = [...unordered].sort((first, second) => byteOrder(first.hash, second.hash));
|
|
1091
1115
|
const now = this.dialect.nowSeconds;
|
|
1092
1116
|
const header = `INSERT INTO ${this.table} (hash, bytes, data, created_at, chunks) VALUES (?, ?, ?, ${now}, ?) ON CONFLICT(hash) DO UPDATE SET created_at = ${now} WHERE ${this.table}.created_at > 0`;
|
|
1093
1117
|
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`;
|
|
@@ -1112,9 +1136,27 @@ export class SqlSnapshotBlobStore {
|
|
|
1112
1136
|
return;
|
|
1113
1137
|
}
|
|
1114
1138
|
await this.database.transaction(async (transaction) => {
|
|
1139
|
+
// On a pipelined connection the statements go out with the commit: one round trip after the locks.
|
|
1140
|
+
if (transactionFinisher(transaction)?.(statements) === true)
|
|
1141
|
+
return;
|
|
1115
1142
|
for (const statement of statements)
|
|
1116
1143
|
await transaction.run(statement.sql, ...statement.params);
|
|
1117
|
-
});
|
|
1144
|
+
}, this.blobWrite());
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* How a put or a refresh of this table's blobs runs: a serial transaction of the blob table's own domain (#6560). On
|
|
1148
|
+
* PostgreSQL it holds the database-wide lock shared, so it waits for and excludes collection, whose writes hold that
|
|
1149
|
+
* lock exclusively, and the blob writers of this table exclude one another, but session writes, which hold the
|
|
1150
|
+
* database-wide lock shared with their session's domain, run beside it. Rows it writes again (`created_at`) are locked
|
|
1151
|
+
* in hash order, as an append's check of the blobs it records locks them (`missingBlob`), so neither waits on the
|
|
1152
|
+
* other in a cycle. Its callback only uses the transaction, so a transient failure runs it again.
|
|
1153
|
+
*/
|
|
1154
|
+
blobWrite(leading) {
|
|
1155
|
+
return {
|
|
1156
|
+
retryTransientFailures: true,
|
|
1157
|
+
concurrency: { kind: "serial", domain: this.table },
|
|
1158
|
+
...(leading === undefined ? {} : { leading }),
|
|
1159
|
+
};
|
|
1118
1160
|
}
|
|
1119
1161
|
/**
|
|
1120
1162
|
* The blob's bytes, read a chunk per statement when it has chunks, so no response holds more than one chunk. A
|
|
@@ -1154,10 +1196,18 @@ export class SqlSnapshotBlobStore {
|
|
|
1154
1196
|
]);
|
|
1155
1197
|
return rows.length === unique.length;
|
|
1156
1198
|
}
|
|
1199
|
+
// The rows present, locked in hash order before the update writes them (see `blobWrite`). On a pipelined connection
|
|
1200
|
+
// this read goes out with the transaction's start and the update with its commit.
|
|
1201
|
+
const locked = {
|
|
1202
|
+
sql: `${present} ORDER BY hash${this.dialect.byteOrderCollation}${this.dialect.lockClause("update")}`,
|
|
1203
|
+
params,
|
|
1204
|
+
};
|
|
1157
1205
|
return this.database.transaction(async (transaction) => {
|
|
1158
|
-
await transaction.
|
|
1159
|
-
|
|
1160
|
-
|
|
1206
|
+
const rows = await transaction.all(locked.sql, ...locked.params);
|
|
1207
|
+
if (transactionFinisher(transaction)?.([{ sql: update, params }]) !== true)
|
|
1208
|
+
await transaction.run(update, ...params);
|
|
1209
|
+
return rows.length === unique.length;
|
|
1210
|
+
}, this.blobWrite([locked]));
|
|
1161
1211
|
}
|
|
1162
1212
|
async listBlobHashes() {
|
|
1163
1213
|
const rows = await this.database.all(`SELECT hash FROM ${this.table}`);
|
|
@@ -1191,12 +1241,15 @@ export class SqlSnapshotBlobStore {
|
|
|
1191
1241
|
params: [JSON.stringify(hashes), hashes.length],
|
|
1192
1242
|
};
|
|
1193
1243
|
}
|
|
1194
|
-
/**
|
|
1244
|
+
/**
|
|
1245
|
+
* The first of `snapshots`' blobs this table does not hold in full, read in `transaction`; undefined when none. The
|
|
1246
|
+
* rows it finds stay locked FOR SHARE until the transaction ends, taken in hash order as a blob write takes them.
|
|
1247
|
+
*/
|
|
1195
1248
|
async missingBlob(transaction, snapshots) {
|
|
1196
1249
|
const hashes = [...new Set(snapshots.flatMap(wellFormedBlobHashes))];
|
|
1197
1250
|
if (hashes.length === 0)
|
|
1198
1251
|
return undefined;
|
|
1199
|
-
const rows = await transaction.all(`SELECT hash FROM ${this.table} AS b WHERE hash IN (SELECT value FROM ${this.dialect.jsonValues("?")}) AND (chunks = 0 OR chunks = (SELECT COUNT(*) FROM ${this.tables.blobChunks} AS c WHERE c.hash = b.hash))${this.dialect.lockClause("share")}`, JSON.stringify(hashes));
|
|
1252
|
+
const rows = await transaction.all(`SELECT hash FROM ${this.table} AS b WHERE hash IN (SELECT value FROM ${this.dialect.jsonValues("?")}) AND (chunks = 0 OR chunks = (SELECT COUNT(*) FROM ${this.tables.blobChunks} AS c WHERE c.hash = b.hash)) ORDER BY hash${this.dialect.byteOrderCollation}${this.dialect.lockClause("share")}`, JSON.stringify(hashes));
|
|
1200
1253
|
const stored = new Set(rows.map((row) => row.hash));
|
|
1201
1254
|
return hashes.find((hash) => !stored.has(hash));
|
|
1202
1255
|
}
|
|
@@ -1993,7 +2046,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
1993
2046
|
return (async () => {
|
|
1994
2047
|
const root = new URL("../../", import.meta.url);
|
|
1995
2048
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
1996
|
-
const key = `${root.href}#0.10.
|
|
2049
|
+
const key = `${root.href}#0.10.11-alpha.1`;
|
|
1997
2050
|
let release = releases.get(key);
|
|
1998
2051
|
if (release === undefined) {
|
|
1999
2052
|
const current = (async () => {
|
|
@@ -2021,7 +2074,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
2021
2074
|
} catch {
|
|
2022
2075
|
// No installation to read, as in a bundle of the package: the release the process runs decides.
|
|
2023
2076
|
}
|
|
2024
|
-
const updatedTo = typeof installed === "string" && installed !== "0.10.
|
|
2077
|
+
const updatedTo = typeof installed === "string" && installed !== "0.10.11-alpha.1" ? installed : running !== undefined && running.version !== "0.10.11-alpha.1" ? "0.10.11-alpha.1" : undefined;
|
|
2025
2078
|
if (updatedTo === undefined) throw error;
|
|
2026
2079
|
const application = typeof running?.name === "string" ? running.name : "atomic";
|
|
2027
2080
|
const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {
|