@bastani/atomic 0.10.11-alpha.1 → 0.10.11-alpha.3
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 +155 -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 +9 -9
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +8 -8
- package/dist/_shared/mode-shared-2QJSCUM6.js +9 -9
- 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} +14 -2
- package/dist/_shared/{p1b-elig-ENCUPKKJ.js.map → p1b-elig-TVB5CBLL.js.map} +1 -1
- package/dist/_shared/runtime-O4KCSG4C.js +5 -5
- package/dist/_shared/{sdk-AVFII7NK.js → sdk-B5LEWGGI.js} +2633 -488
- package/dist/_shared/sdk-B5LEWGGI.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/settings-startup-8-DNZ2RIHM.js +1 -1
- package/dist/_shared/{settings-startup-4QCVCI53.js → settings-startup-HXQLSUWM.js} +8 -2
- package/dist/_shared/settings-startup-HXQLSUWM.js.map +1 -0
- package/dist/_shared/{startup-0-0-57KF6LZH.js → startup-0-0-EZUKEP4Q.js} +436 -51
- package/dist/_shared/startup-0-0-EZUKEP4Q.js.map +1 -0
- package/dist/_shared/{startup-0-1-GIY75K46.js → startup-0-1-RTOHJFDJ.js} +240 -279
- package/dist/_shared/startup-0-1-RTOHJFDJ.js.map +1 -0
- package/dist/_shared/{startup-0-2-27OWFHV6.js → startup-0-2-5QHPCEON.js} +254 -46
- package/dist/_shared/startup-0-2-5QHPCEON.js.map +1 -0
- package/dist/_shared/{startup-0-3-T4DVFYWX.js → startup-0-3-4ZYBYQNM.js} +273 -14
- package/dist/_shared/startup-0-3-4ZYBYQNM.js.map +1 -0
- package/dist/_shared/startup-0-4-ZMJV547D.js +14 -9
- package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -1
- package/dist/_shared/startup-0-5-YDW47QX6.js +10 -10
- package/dist/_shared/startup-0-5-YDW47QX6.js.map +1 -1
- package/dist/_shared/startup-10-0-TDQNBDDL.js +9 -9
- package/dist/_shared/startup-12-0-55AAXBJZ.js +3 -3
- package/dist/_shared/startup-14-0-MLX36RBG.js +6 -7
- package/dist/_shared/startup-14-0-MLX36RBG.js.map +1 -1
- package/dist/_shared/startup-15-0-YUKGAC63.js +7 -7
- package/dist/_shared/startup-15-1-4S7FLMNG.js +22 -30
- package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +455 -102
- package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
- package/dist/_shared/{startup-8-1-X32CYSXB.js → startup-8-1-LZFXSD3Z.js} +162 -1184
- package/dist/_shared/startup-8-1-LZFXSD3Z.js.map +1 -0
- package/dist/_shared/storage-command-7MGXLJGZ.js +189 -36
- 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 +3 -3
- package/dist/builtin/intercom/CHANGELOG.md +34 -0
- package/dist/builtin/intercom/README.md +2 -2
- package/dist/builtin/intercom/broker/broker.bundle.mjs +1091 -344
- package/dist/builtin/intercom/broker/database-wake-up-bus.ts +243 -64
- package/dist/builtin/intercom/broker/multinode-router.ts +154 -22
- package/dist/builtin/intercom/broker/multinode-state-store.ts +30 -3
- package/dist/builtin/intercom/broker/open-broker-state.ts +14 -0
- package/dist/builtin/intercom/broker/sql-add-column.ts +29 -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 +208 -101
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +516 -102
- 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 +24 -7
- package/dist/builtin/intercom/broker/sql-retention.ts +141 -0
- package/dist/builtin/intercom/broker/sql-schema.ts +199 -27
- 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 +2 -3
- 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/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 +6 -6
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.code.js +4 -4
- package/dist/cli/blueprint-command.impl.js +3 -3
- package/dist/cli/blueprint-command.js +3 -3
- package/dist/cli/intercom-command.code.js +4 -4
- 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 +2 -2
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/startup-ui.code.js +2 -2
- 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 +20 -114
- 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 +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 +1 -1
- package/dist/core/extensions/runner-context.js +3 -3
- 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 +8 -0
- 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 +4 -4
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.js +27 -15
- 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 +3 -3
- package/dist/core/session-manager.impl.js +3 -3
- package/dist/core/session-manager.js +3 -3
- package/dist/core/session-open-markers.js +3 -0
- package/dist/core/session-open-markers.js.map +1 -0
- 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/added-exports.js +3 -0
- package/dist/core/storage/added-exports.js.map +1 -1
- 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 +56 -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 +11 -0
- package/dist/core/storage/fenced-paths.js +11 -0
- 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 +4 -3
- 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 +81 -8
- package/dist/core/storage/migrations.js +386 -47
- 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 +36 -12
- package/dist/core/storage/node-sqlite-thread.js.map +1 -1
- package/dist/core/storage/node-sqlite.js +135 -3
- 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 +14 -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 +82 -5
- package/dist/core/storage/schema-catalog.js +244 -34
- 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 +9 -8
- 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 +4 -4
- 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/errors.js +1 -1
- 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-detach.d.ts +118 -0
- 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-schema.js +53 -0
- package/dist/core/storage/session/fork-schema.js.map +1 -0
- package/dist/core/storage/session/fork-segments.d.ts +58 -0
- package/dist/core/storage/session/fork-staging.code.js +5 -8
- 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 +61 -0
- package/dist/core/storage/session/fork-sweep.js.map +1 -0
- package/dist/core/storage/session/fork-window.code.js +4 -4
- 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.d.ts +42 -2
- 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 +4 -4
- 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.code.js +1 -1
- 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 +43 -4
- 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 +4 -4
- 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 +394 -20
- 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.impl.js +3 -3
- package/dist/core/storage/session/tree-presentation.js +3 -3
- package/dist/core/storage/session/types.d.ts +22 -0
- package/dist/core/storage/sqlite-facade.d.ts +23 -2
- package/dist/core/storage/sqlite-facade.js +34 -0
- package/dist/core/storage/sqlite-facade.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.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 +4 -4
- 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 +5 -5
- 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-session.d.ts +2 -0
- 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 +71 -3
- package/dist/core/worktree-snapshot/blob-store.js +575 -67
- package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
- package/dist/core/worktree-snapshot/errors.code.js +3 -3
- 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 +162 -0
- package/dist/core/worktree-snapshot/fork-snapshot-index.js.map +1 -0
- 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 +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.d.ts +3 -1
- package/dist/index.js +8 -8
- package/dist/main-first-time-setup.code.js +2 -2
- 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 +3 -3
- 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 +7 -7
- 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 -3
- 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 -6
- 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 +3 -3
- 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 +1421 -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 +31 -42
- 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} +73 -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 +333 -956
- 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/sdk-AVFII7NK.js.map +0 -1
- package/dist/_shared/settings-startup-4QCVCI53.js.map +0 -1
- package/dist/_shared/startup-0-0-57KF6LZH.js.map +0 -1
- package/dist/_shared/startup-0-1-GIY75K46.js.map +0 -1
- package/dist/_shared/startup-0-2-27OWFHV6.js.map +0 -1
- package/dist/_shared/startup-0-3-T4DVFYWX.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
package/dist/startup-files.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":2,"self":"@bastani/atomic","packages":[["@bastani/atomic",-1],["@bastani/atomic-tui",0],["@bastani/atomic-codemode",0],["proper-lockfile",0],["graceful-fs",3],["retry",3],["signal-exit",3],["get-east-asian-width",1],["marked",1],["marked-cjk-friendly",1],["chalk",0],["@bastani/atomic-ai",0],["@bastani/atomic-schema",11],["@bastani/atomic-agent-core",0],["glob",0]],"files":[[0,"dist/modes/interactive-engine/engine-prewarm.js"],[0,"dist/_shared/rolldown-runtime-BGM3D5V3.js"],[0,"dist/_shared/p1a-prewarm-XIU57JHF.js"],[0,"dist/_shared/p0-cli-BB45ZQY6.js"],[1,"dist/helper-programs/index.js"],[1,"dist/_main-ea49a2e6.js"],[1,"dist/_rolldown-runtime-e937a250.js"],[1,"dist/_lazy-eb232bf4.js"],[0,"dist/utils/canonical-path.js"],[0,"dist/utils/path-exists.js"],[0,"dist/utils/worker-threads.js"],[2,"dist/node-options.js"],[0,"dist/_shared/p1-shared-RG5I5LJ6.js"],[0,"dist/core/storage/node-sqlite-thread.js"],[0,"dist/core/storage/dialect.js"],[0,"dist/modes/interactive/startup-shell-eligibility.js"],[0,"dist/_shared/p1b-elig-
|
|
1
|
+
{"version":2,"self":"@bastani/atomic","packages":[["@bastani/atomic",-1],["@bastani/atomic-tui",0],["@bastani/atomic-codemode",0],["proper-lockfile",0],["graceful-fs",3],["retry",3],["signal-exit",3],["get-east-asian-width",1],["marked",1],["marked-cjk-friendly",1],["chalk",0],["@bastani/atomic-ai",0],["@bastani/atomic-schema",11],["@bastani/atomic-agent-core",0],["glob",0]],"files":[[0,"dist/modes/interactive-engine/engine-prewarm.js"],[0,"dist/_shared/rolldown-runtime-BGM3D5V3.js"],[0,"dist/_shared/p1a-prewarm-XIU57JHF.js"],[0,"dist/_shared/p0-cli-BB45ZQY6.js"],[1,"dist/helper-programs/index.js"],[1,"dist/_main-ea49a2e6.js"],[1,"dist/_rolldown-runtime-e937a250.js"],[1,"dist/_lazy-eb232bf4.js"],[0,"dist/utils/canonical-path.js"],[0,"dist/utils/path-exists.js"],[0,"dist/utils/worker-threads.js"],[2,"dist/node-options.js"],[0,"dist/_shared/p1-shared-RG5I5LJ6.js"],[0,"dist/core/storage/node-sqlite-thread.js"],[0,"dist/core/storage/dialect.js"],[0,"dist/modes/interactive/startup-shell-eligibility.js"],[0,"dist/_shared/p1b-elig-TVB5CBLL.js"],[3,"index.js"],[0,"dist/_shared/p1-elig-shell-WWRO3L2R.js"],[3,"lib/lockfile.js"],[4,"graceful-fs.js"],[4,"polyfills.js"],[4,"legacy-streams.js"],[4,"clone.js"],[5,"index.js"],[5,"lib/retry.js"],[5,"lib/retry_operation.js"],[6,"index.js"],[6,"signals.js"],[3,"lib/mtime-precision.js"],[3,"lib/adapter.js"],[0,"dist/modes/interactive/startup-shell.js"],[0,"dist/_shared/p2-shell-TJBYQMCJ.js"],[1,"dist/index.js"],[1,"dist/_main-eb08764b.js"],[1,"dist/_main-e8b70ad5.js"],[7,"index.js"],[7,"lookup.js"],[7,"lookup-data.js"],[7,"utilities.js"],[1,"dist/_main-ee570765.js"],[1,"dist/_main-e3d2c0ee.js"],[1,"dist/_main-e6811217.js"],[1,"dist/_main-eb967ea2.js"],[1,"dist/_main-eadbd863.js"],[8,"lib/marked.esm.js"],[9,"dist/index.js"],[1,"dist/_main-ec392c93.js"],[1,"dist/_main-e6ce3ee9.js"],[1,"dist/native-modifiers.js"],[1,"dist/native-platform.js"],[1,"dist/native-module-path.js"],[1,"dist/_main-ee2a1713.js"],[0,"dist/_shared/p2-shell-main-B2WIALFD.js"],[10,"source/index.js"],[10,"source/utilities.js"],[10,"source/vendor/ansi-styles/index.js"],[10,"source/vendor/supports-color/index.js"],[0,"dist/utils/memoize-async.js"],[0,"dist/_shared/p2-common-YLSYXMDQ.js"],[0,"dist/utils/startup-stages.js"],[0,"dist/_shared/p3a-stages-66VAGJL3.js"],[0,"dist/core/http-dispatcher.js"],[0,"dist/_shared/http-undici-FVPTZA4G.js"],[0,"dist/_shared/http-YFAPTIZD.js"],[11,"dist/utils/node-http-proxy.js"],[11,"dist/_main-ea922b06.js"],[11,"dist/_rolldown-runtime-ee51c298.js"],[11,"dist/utils/tls-certificate.js"],[11,"dist/utils/request-admission.js"],[0,"dist/main.js"],[0,"dist/_shared/startup-8-1-LZFXSD3Z.js"],[0,"dist/_shared/startup-0-0-EZUKEP4Q.js"],[0,"dist/_shared/settings-startup-HXQLSUWM.js"],[0,"dist/core/storage/errors.js"],[1,"dist/builtin-command-names.js"],[0,"dist/core/storage/creation-time.js"],[0,"dist/_shared/startup-0-1-RTOHJFDJ.js"],[11,"dist/index.js"],[11,"dist/_main-e4862ae1.js"],[11,"dist/_main-efb2d8b1.js"],[11,"dist/_main-e1febd93.js"],[11,"dist/_main-e19a4fd4.js"],[11,"dist/_main-e86630a4.js"],[12,"dist/index.js"],[12,"dist/_main-ed41ae74.js"],[12,"dist/formats/index.js"],[11,"dist/_main-ed8b8540.js"],[0,"dist/core/storage/prefix.js"],[11,"dist/compat.js"],[11,"dist/_main-e37d27e2.js"],[11,"dist/_main-e1dba9af.js"],[11,"dist/_main-e7f59317.js"],[11,"dist/_main-eccef551.js"],[11,"dist/_main-ee0779df.js"],[11,"dist/_main-e60c088d.js"],[11,"dist/_main-e81c781b.js"],[11,"dist/_main-e6977171.js"],[11,"dist/_main-ea4d6cec.js"],[11,"dist/_main-e6043ae3.js"],[11,"dist/_main-eaf19101.js"],[11,"dist/_main-e57a13a1.js"],[11,"dist/providers/github-copilot.js"],[11,"dist/utils/typebox/index.js"],[11,"dist/_lazy-e41faaec.js"],[0,"dist/core/storage/added-exports.js"],[0,"dist/core/storage/migrations.js"],[0,"dist/core/storage/added-exports-0-10-11.js"],[0,"dist/core/storage/schema-catalog.js"],[0,"dist/core/storage/statement-sequence.js"],[0,"dist/core/storage/fenced-paths.js"],[11,"dist/providers/model-schema.js"],[11,"dist/utils/provider-env.js"],[11,"dist/api/transform-messages.js"],[0,"dist/_shared/startup-0-2-5QHPCEON.js"],[13,"dist/index.js"],[13,"dist/_main-e87dd55a.js"],[13,"dist/_rolldown-runtime-e937a250.js"],[13,"dist/_main-ebff8f0f.js"],[0,"dist/core/storage/file-identity.js"],[11,"dist/api/llama-cpp-classify.lazy.js"],[11,"dist/_lazy-e9c3f321.js"],[11,"dist/api/typesafe-system-one.lazy.js"],[11,"dist/providers/compat-schema.js"],[11,"dist/utils/typebox/compile.js"],[11,"dist/utils/models-dev-catalog.js"],[11,"dist/utils/retry-hints.js"],[11,"dist/api/anthropic-assistant-content.js"],[11,"dist/utils/typebox/value.js"],[0,"dist/core/storage/libsql-removed.js"],[0,"dist/core/storage/selection.js"],[0,"dist/_shared/startup-0-3-4ZYBYQNM.js"],[2,"dist/declarations.js"],[2,"dist/identifier.js"],[2,"dist/source.js"],[11,"dist/utils/provider-retry.js"],[11,"dist/utils/retry-sleep.js"],[0,"dist/_shared/startup-8-0-34CBHPZH.js"],[0,"dist/core/storage/session/errors.js"],[0,"dist/core/storage/node-sqlite.js"],[0,"dist/core/storage/node-sqlite-file-gate.js"],[0,"dist/core/storage/write-ahead-log.js"],[0,"dist/_shared/startup-0-5-YDW47QX6.js"],[0,"dist/_shared/startup-0-4-ZMJV547D.js"],[0,"dist/core/worktree-snapshot/blob-store.js"],[0,"dist/core/storage/statement-batches.js"],[0,"dist/core/worktree-snapshot/fork-blob-guard.js"],[0,"dist/core/worktree-snapshot/fork-snapshot-index.js"],[0,"dist/core/storage/session/fork-schema.js"],[0,"dist/core/storage/provider.js"],[14,"dist/esm/index.min.js"],[11,"dist/providers/all.js"],[11,"dist/providers/openrouter.js"],[11,"dist/api/openai-codex-responses.js"],[11,"dist/_lazy-e39678ca.js"],[11,"dist/_lazy-ec4528be.js"],[11,"dist/providers/github-copilot-env.js"],[0,"dist/_shared/startup-15-1-4S7FLMNG.js"],[0,"dist/_shared/startup-15-0-YUKGAC63.js"],[0,"dist/_shared/startup-14-0-MLX36RBG.js"],[0,"dist/_shared/startup-10-0-TDQNBDDL.js"],[0,"dist/core/session-manager-core.js"],[11,"dist/api/strict-tool-limits.js"],[0,"dist/_shared/session-manager-list-2BLEEZVG.js"],[0,"dist/_shared/startup-12-0-55AAXBJZ.js"],[0,"dist/core/extensions/runner-context.js"],[0,"dist/core/model-registry.js"],[11,"dist/api/anthropic-serialized-body.js"],[0,"dist/cli/settings-startup.js"],[0,"dist/_shared/settings-startup-8-DNZ2RIHM.js"],[0,"dist/modes/interactive/interactive-mode.js"],[0,"dist/_shared/mode-shared-2QJSCUM6.js"],[0,"dist/_shared/mode-interactive-sdk-7KXUFI2F.js"],[1,"dist/layout-node.js"],[0,"dist/modes/rpc/rpc-mode.js"],[0,"dist/_shared/mode-rpc-sdk-IOPGDYR4.js"],[0,"dist/index.js"],[0,"dist/_shared/sdk-B5LEWGGI.js"],[0,"dist/core/storage/schema.js"],[11,"dist/api/cloudflare-gateway-binding.js"],[0,"dist/core/storage/sqlite-facade.js"],[11,"dist/utils/oauth-page.js"],[0,"dist/core/storage/index.js"],[0,"dist/core/extensions/loader-virtual-modules.js"],[0,"dist/builtin/intercom/index.bundle.mjs"],[0,"dist/builtin/subagents/src/extension/index.bundle.mjs"],[0,"dist/builtin/mcp/index.bundle.mjs"],[0,"dist/builtin/web-access/index.bundle.mjs"]]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import "@bastani/atomic-codemode/node-options";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import "../_shared/startup-8-1-LZFXSD3Z.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import "../
|
|
1
|
+
import "../main.js";
|
package/dist/startup-stages/2.js
CHANGED
|
@@ -3,6 +3,5 @@ import "../cli/settings-startup.js";
|
|
|
3
3
|
import "@bastani/atomic-tui";
|
|
4
4
|
import "../core/storage/errors.js";
|
|
5
5
|
import "proper-lockfile";
|
|
6
|
-
import "
|
|
7
|
-
import "../core/storage/
|
|
8
|
-
import "../core/storage/statement-batches.js";
|
|
6
|
+
import "@bastani/atomic-tui/dist/builtin-command-names.js";
|
|
7
|
+
import "../core/storage/creation-time.js";
|
package/dist/startup-stages/3.js
CHANGED
package/dist/startup-stages/4.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "@bastani/atomic-tui/dist/builtin-command-names.js";
|
|
1
|
+
import "@bastani/atomic-ai";
|
package/dist/startup-stages/5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "../_shared/startup-0-
|
|
1
|
+
import "../_shared/startup-0-1-RTOHJFDJ.js";
|
package/dist/startup-stages/6.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "@bastani/atomic-
|
|
3
|
-
import "@bastani/atomic-
|
|
4
|
-
import "@bastani/atomic-ai/utils/
|
|
5
|
-
import "@bastani/atomic-ai/
|
|
6
|
-
import "@bastani/atomic-ai/utils/provider-env";
|
|
7
|
-
import "@bastani/atomic-ai/api/transform-messages";
|
|
1
|
+
import "../_shared/startup-0-2-5QHPCEON.js";
|
|
2
|
+
import "@bastani/atomic-codemode/declarations";
|
|
3
|
+
import "@bastani/atomic-codemode/source";
|
|
4
|
+
import "@bastani/atomic-ai/utils/provider-retry";
|
|
5
|
+
import "@bastani/atomic-ai/utils/retry-sleep";
|
package/dist/startup-stages/7.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import "../_shared/startup-0-
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import "@bastani/atomic-ai/api/typesafe-system-one.lazy";
|
|
5
|
-
import "@bastani/atomic-ai/providers/compat-schema";
|
|
6
|
-
import "@bastani/atomic-ai/utils/typebox/compile";
|
|
1
|
+
import "../_shared/startup-0-3-4ZYBYQNM.js";
|
|
2
|
+
import "../_shared/startup-8-0-34CBHPZH.js";
|
|
3
|
+
import "../core/worktree-snapshot/blob-store.js";
|
package/dist/startup-stages/8.js
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import "../_shared/startup-0-
|
|
2
|
-
import "../
|
|
1
|
+
import "../_shared/startup-0-4-ZMJV547D.js";
|
|
2
|
+
import "../core/storage/provider.js";
|
|
3
|
+
import "glob";
|
|
4
|
+
import "@bastani/atomic-ai/providers/all";
|
|
5
|
+
import "@bastani/atomic-ai/providers/openrouter";
|
|
6
|
+
import "@bastani/atomic-ai/api/openai-codex-responses";
|
|
7
|
+
import "@bastani/atomic-ai/providers/github-copilot-env";
|
package/dist/startup-stages/9.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import "../_shared/startup-
|
|
2
|
-
import "../_shared/startup-0-4-ZMJV547D.js";
|
|
3
|
-
import "glob";
|
|
4
|
-
import "@bastani/atomic-ai/providers/all";
|
|
5
|
-
import "@bastani/atomic-ai/providers/openrouter";
|
|
6
|
-
import "@bastani/atomic-ai/api/openai-codex-responses";
|
|
7
|
-
import "@bastani/atomic-ai/providers/github-copilot-env";
|
|
1
|
+
import "../_shared/startup-0-5-YDW47QX6.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":1,"stages":
|
|
1
|
+
{"version":1,"stages":13}
|
|
@@ -12,22 +12,17 @@ const deferrals = compileCache;
|
|
|
12
12
|
export function processCompileCacheDeferral() {
|
|
13
13
|
return deferrals.compileCacheDeferral?.();
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Gives an engine child no environment. Node.js 22 engines needed it to align their compile-cache tag with their host's
|
|
17
|
+
* (#6222); still exported because a process of 0.10.4 that an in-place update caught imports it from this module's
|
|
18
|
+
* shared file.
|
|
19
|
+
*/
|
|
20
|
+
export function engineCompileCacheMatchHostEnv(_engineRuntimeArgs) {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
15
23
|
/** The environment an engine child gets when this process leaves its cold cache to a helper that warms the engine's too. */
|
|
16
24
|
export function engineCompileCacheWarmupEnv() {
|
|
17
25
|
const name = deferrals.COMPILE_CACHE_ENGINE_WARMUP_ENV;
|
|
18
26
|
return name !== undefined && processCompileCacheDeferral() ? { [name]: "1" } : {};
|
|
19
27
|
}
|
|
20
|
-
/**
|
|
21
|
-
* The environment an auto-sized Node engine child gets so on Node 22 it aligns its compile-cache tag with the
|
|
22
|
-
* untouched host (#6222). Omitted on Bun or when the host itself passed an explicit heap size.
|
|
23
|
-
*/
|
|
24
|
-
export function engineCompileCacheMatchHostEnv(engineRuntimeArgs) {
|
|
25
|
-
if ("bun" in process.versions)
|
|
26
|
-
return {};
|
|
27
|
-
const name = deferrals.COMPILE_CACHE_ENGINE_MATCH_HOST_ENV;
|
|
28
|
-
const check = deferrals.hostAutoSizedEngineHeap;
|
|
29
|
-
if (name === undefined || check === undefined)
|
|
30
|
-
return {};
|
|
31
|
-
return check(process.execArgv, process.env.NODE_OPTIONS, engineRuntimeArgs) ? { [name]: "1" } : {};
|
|
32
|
-
}
|
|
33
28
|
//# sourceMappingURL=compile-cache-deferral.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-cache-deferral.js","sourceRoot":"","sources":["../../src/utils/compile-cache-deferral.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AAEnD,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"compile-cache-deferral.js","sourceRoot":"","sources":["../../src/utils/compile-cache-deferral.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AAEnD,MAAM,SAAS,GACd,YAAY,CAAC;AAEd,6DAA6D;AAC7D,MAAM,UAAU,2BAA2B;IAC1C,OAAO,SAAS,CAAC,oBAAoB,EAAE,EAAE,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAC,kBAAqC;IACnF,OAAO,EAAE,CAAC;AACX,CAAC;AAED,4HAA4H;AAC5H,MAAM,UAAU,2BAA2B;IAC1C,MAAM,IAAI,GAAG,SAAS,CAAC,+BAA+B,CAAC;IACvD,OAAO,IAAI,KAAK,SAAS,IAAI,2BAA2B,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,CAAC","sourcesContent":["/**\n * This process's compile-cache deferral (see `compile-cache.ts`), for the modules that load after the process's entry.\n *\n * `compile-cache.ts` loads with the entry (`cli.ts`), so a process that started before an update replaced the\n * installation keeps the copy it started with while it loads later modules from the update. 0.10.3's copy has neither\n * a deferral nor the engine warmup variable, and a named import of either would fail to link there; read through here,\n * such a process is one that never deferred its cache, which it is.\n */\n\nimport type { CompileCacheDeferral } from \"./compile-cache.ts\";\nimport * as compileCache from \"./compile-cache.ts\";\n\nconst deferrals: Partial<Pick<typeof compileCache, \"compileCacheDeferral\" | \"COMPILE_CACHE_ENGINE_WARMUP_ENV\">> =\n\tcompileCache;\n\n/** The cache this process left cold for a helper, if any. */\nexport function processCompileCacheDeferral(): CompileCacheDeferral | undefined {\n\treturn deferrals.compileCacheDeferral?.();\n}\n\n/**\n * Gives an engine child no environment. Node.js 22 engines needed it to align their compile-cache tag with their host's\n * (#6222); still exported because a process of 0.10.4 that an in-place update caught imports it from this module's\n * shared file.\n */\nexport function engineCompileCacheMatchHostEnv(_engineRuntimeArgs: readonly string[]): Record<string, string> {\n\treturn {};\n}\n\n/** The environment an engine child gets when this process leaves its cold cache to a helper that warms the engine's too. */\nexport function engineCompileCacheWarmupEnv(): Record<string, string> {\n\tconst name = deferrals.COMPILE_CACHE_ENGINE_WARMUP_ENV;\n\treturn name !== undefined && processCompileCacheDeferral() ? { [name]: \"1\" } : {};\n}\n"]}
|
|
@@ -103,9 +103,8 @@ export function startCompileCacheHelper(launch) {
|
|
|
103
103
|
}
|
|
104
104
|
let warmupStarted = false;
|
|
105
105
|
/**
|
|
106
|
-
* Helper runtimes to run in sequence: one when host and engine share a compile-cache tag (
|
|
107
|
-
*
|
|
108
|
-
* natively), else engine first then host.
|
|
106
|
+
* Helper runtimes to run in sequence: one when host and engine share a compile-cache tag (identical flags, or an
|
|
107
|
+
* auto-sized `--max-old-space-size=<N>`, which leaves V8's cache tag unchanged), else engine first then host.
|
|
109
108
|
*/
|
|
110
109
|
export function compileCacheWarmupRuntimes(own, engineExecArgv) {
|
|
111
110
|
const engine = { execArgv: engineExecArgv, nodeOptions: own.nodeOptions };
|
|
@@ -114,7 +113,7 @@ export function compileCacheWarmupRuntimes(own, engineExecArgv) {
|
|
|
114
113
|
if (same)
|
|
115
114
|
return [own];
|
|
116
115
|
// An auto-sized engine only adds `--max-old-space-size=<N>` when the host had no heap flag; both processes share
|
|
117
|
-
// the host's tag
|
|
116
|
+
// the host's tag, so one host helper warms both (#6222).
|
|
118
117
|
const heapFlag = /^--max[-_]old[-_]space[-_]size=\d+$/;
|
|
119
118
|
const onlyAddedAutoHeap = own.execArgv.length === 0 &&
|
|
120
119
|
!heapFlag.test(own.nodeOptions) &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-cache-warmup-host.js","sourceRoot":"","sources":["../../src/utils/compile-cache-warmup-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EACN,2BAA2B,EAC3B,8BAA8B,EAC9B,qBAAqB,EACrB,gCAAgC,EAChC,uCAAuC,EACvC,gBAAgB,GAChB,MAAM,kBAAkB,CAAC;AAU1B,MAAM,UAAU,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QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACtF,uBAAuB,CACtB,wBAAwB,CAAC,KAAM,EAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAChG,CAAC;AACH,CAAC","sourcesContent":["/**\n * Starts the compile-cache helpers of an interactive session that left a cold cache alone (see `compile-cache.ts`).\n *\n * The helper for the engine's runtime flags runs first and the helper for this host's own flags last, so the host's\n * marker, which decides whether later sessions defer, is written only once both caches are warm. The session starts\n * the first helper; each helper starts the next one when it is done. A helper does not stop when its session ends: a\n * session that ends before its helpers do still leaves the cache warm. Each helper ends by itself when it is done and\n * after five minutes at most.\n */\nimport { spawn } from \"node:child_process\";\nimport { isAbsolute, resolve, win32 } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { CompileCacheHelperRuntime } from \"./compile-cache.ts\";\nimport { processCompileCacheDeferral } from \"./compile-cache-deferral.ts\";\nimport {\n\tcollectInstallProtectedDirs,\n\tDEFAULT_WINDOWS_CWD_TIMEOUT_MS,\n\tisAbsoluteWindowsPath,\n\tresolveSafeWindowsKillCwdLexical,\n\tresolveSafeWindowsWorkingDirectoryAsync,\n\twindowsDriveRoot,\n} from \"./windows-cwd.js\";\n\n/** What a helper does after its own cache: the helpers still to run, and the markers that must still stand. */\nexport interface CompileCacheWarmupPlan {\n\t/** Runtimes of the helpers to start after this one, in order. */\n\treadonly next: readonly CompileCacheHelperRuntime[];\n\t/** Markers of earlier helpers; this helper marks its cache warm only while they all exist. */\n\treadonly required: readonly string[];\n}\n\nexport function encodeCompileCacheWarmupPlan(plan: CompileCacheWarmupPlan): string {\n\treturn Buffer.from(JSON.stringify(plan), \"utf8\").toString(\"base64url\");\n}\n\nexport function decodeCompileCacheWarmupPlan(encoded: string | undefined): CompileCacheWarmupPlan {\n\tif (!encoded) return { next: [], required: [] };\n\tconst plan = JSON.parse(Buffer.from(encoded, \"base64url\").toString(\"utf8\")) as CompileCacheWarmupPlan;\n\treturn { next: plan.next ?? [], required: plan.required ?? [] };\n}\n\n/** How a helper process starts: everything `spawn` gets. */\nexport interface CompileCacheHelperLaunch {\n\treadonly command: string;\n\treadonly args: readonly string[];\n\treadonly cwd: string;\n\treadonly env: NodeJS.ProcessEnv;\n\t/** Without a console: it reads and writes none, and never joins the session's console when that closes. */\n\treadonly detached: true;\n}\n\nfunction resolveWarmupScriptPath(script: string): string {\n\tif (process.platform === \"win32\") {\n\t\tif (isAbsoluteWindowsPath(script)) return script;\n\t\ttry {\n\t\t\treturn win32.resolve(process.cwd(), script);\n\t\t} catch {\n\t\t\treturn script;\n\t\t}\n\t}\n\treturn isAbsolute(script) ? script : resolve(script);\n}\n\nfunction resolveWarmupHelperCwd(resolvedScript: string): string {\n\tif (process.platform !== \"win32\") return \"/\";\n\tconst scriptDir = win32.dirname(resolvedScript);\n\treturn (\n\t\tresolveSafeWindowsKillCwdLexical({\n\t\t\tprotectedDirs: collectInstallProtectedDirs(scriptDir),\n\t\t\tcommandPath: process.execPath,\n\t\t}) ??\n\t\twindowsDriveRoot(scriptDir) ??\n\t\t\"C:\\\\\"\n\t);\n}\n\n/**\n * The helper for `runtime`: this runtime with its heap size and without preloads, loading no native module\n * (`--no-addons`), working outside the installation (an upgrade or an uninstall replaces it while the helper may run).\n */\nexport function compileCacheHelperLaunch(\n\truntime: CompileCacheHelperRuntime,\n\tbuildId: string,\n\tscript: string = fileURLToPath(new URL(\"./compile-cache-warmup.js\", import.meta.url)),\n\tenv: NodeJS.ProcessEnv = process.env,\n\tplan: CompileCacheWarmupPlan = { next: [], required: [] },\n): CompileCacheHelperLaunch {\n\tconst helperEnv = { ...env };\n\tif (runtime.nodeOptions) helperEnv.NODE_OPTIONS = runtime.nodeOptions;\n\telse delete helperEnv.NODE_OPTIONS;\n\tconst resolvedScript = resolveWarmupScriptPath(script);\n\treturn {\n\t\tcommand: process.execPath,\n\t\targs: [...runtime.execArgv, \"--no-addons\", resolvedScript, buildId, encodeCompileCacheWarmupPlan(plan)],\n\t\tcwd: resolveWarmupHelperCwd(resolvedScript),\n\t\tenv: helperEnv,\n\t\tdetached: true,\n\t};\n}\n\n/** Start a helper that runs on its own: nothing of it keeps this process alive, and it outlives this process. */\nexport function startCompileCacheHelper(launch: CompileCacheHelperLaunch): boolean {\n\tconst spawnWithCwd = (cwd: string, allowRetry: boolean): boolean => {\n\t\ttry {\n\t\t\tconst child = spawn(launch.command, [...launch.args], {\n\t\t\t\tcwd,\n\t\t\t\tenv: launch.env,\n\t\t\t\tdetached: launch.detached,\n\t\t\t\tstdio: \"ignore\",\n\t\t\t\twindowsHide: true,\n\t\t\t});\n\t\t\tchild.on(\"error\", (error: NodeJS.ErrnoException) => {\n\t\t\t\tif (allowRetry && process.platform === \"win32\" && error.code === \"ENOENT\") {\n\t\t\t\t\tconst scriptArg = launch.args[launch.args.length - 3];\n\t\t\t\t\tconst scriptDir = scriptArg ? win32.dirname(resolveWarmupScriptPath(scriptArg)) : undefined;\n\t\t\t\t\tvoid resolveSafeWindowsWorkingDirectoryAsync({\n\t\t\t\t\t\tinstallDirs: scriptDir ? [scriptDir] : undefined,\n\t\t\t\t\t\tcommandPath: launch.command,\n\t\t\t\t\t\ttimeoutMs: DEFAULT_WINDOWS_CWD_TIMEOUT_MS,\n\t\t\t\t\t})\n\t\t\t\t\t\t.then((freshCwd) => {\n\t\t\t\t\t\t\tif (freshCwd !== undefined && freshCwd.toLowerCase() !== cwd.toLowerCase()) {\n\t\t\t\t\t\t\t\tspawnWithCwd(freshCwd, false);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch(() => {});\n\t\t\t\t}\n\t\t\t});\n\t\t\tchild.unref();\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t};\n\treturn spawnWithCwd(launch.cwd, true);\n}\n\nlet warmupStarted = false;\n\n/**\n * Helper runtimes to run in sequence: one when host and engine share a compile-cache tag (either identical flags, or\n * an auto-sized `--max-old-space-size=<N>` which Node 22 engines align back to the host's tag and Node 24 shares\n * natively), else engine first then host.\n */\nexport function compileCacheWarmupRuntimes(\n\town: CompileCacheHelperRuntime,\n\tengineExecArgv: readonly string[],\n): readonly CompileCacheHelperRuntime[] {\n\tconst engine: CompileCacheHelperRuntime = { execArgv: engineExecArgv, nodeOptions: own.nodeOptions };\n\tconst same =\n\t\tengine.execArgv.length === own.execArgv.length &&\n\t\tengine.execArgv.every((arg, index) => arg === own.execArgv[index]);\n\tif (same) return [own];\n\t// An auto-sized engine only adds `--max-old-space-size=<N>` when the host had no heap flag; both processes share\n\t// the host's tag (Node 22 via engine reset, Node 24 natively), so one host helper warms both (#6222).\n\tconst heapFlag = /^--max[-_]old[-_]space[-_]size=\\d+$/;\n\tconst onlyAddedAutoHeap =\n\t\town.execArgv.length === 0 &&\n\t\t!heapFlag.test(own.nodeOptions) &&\n\t\tengine.execArgv.length === 1 &&\n\t\theapFlag.test(engine.execArgv[0]!);\n\treturn onlyAddedAutoHeap ? [own] : [engine, own];\n}\n\n/**\n * Warm the cache this session left cold: first for the engine's runtime flags (`engineExecArgv`), then for this\n * process's own. Called once the session is on screen, and when it exits before that, so even a session that ends at\n * once leaves the cache warm; only the first call starts the helpers. A helper that finds another one warming this\n * build, or fails, ends the chain; the next session that finds the cache cold starts it again.\n */\nexport function warmCompileCache(engineExecArgv: readonly string[]): void {\n\tconst deferral = processCompileCacheDeferral();\n\tif (!deferral?.helper || warmupStarted) return;\n\twarmupStarted = true;\n\tconst [first, ...next] = compileCacheWarmupRuntimes(deferral.runtime, engineExecArgv);\n\tstartCompileCacheHelper(\n\t\tcompileCacheHelperLaunch(first!, deferral.buildId, undefined, undefined, { next, required: [] }),\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compile-cache-warmup-host.js","sourceRoot":"","sources":["../../src/utils/compile-cache-warmup-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,O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CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,cAAiC;IACjE,MAAM,QAAQ,GAAG,2BAA2B,EAAE,CAAC;IAC/C,IAAI,CAAC,QAAQ,EAAE,MAAM,IAAI,aAAa;QAAE,OAAO;IAC/C,aAAa,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,0BAA0B,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACtF,uBAAuB,CACtB,wBAAwB,CAAC,KAAM,EAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAChG,CAAC;AACH,CAAC","sourcesContent":["/**\n * Starts the compile-cache helpers of an interactive session that left a cold cache alone (see `compile-cache.ts`).\n *\n * The helper for the engine's runtime flags runs first and the helper for this host's own flags last, so the host's\n * marker, which decides whether later sessions defer, is written only once both caches are warm. The session starts\n * the first helper; each helper starts the next one when it is done. A helper does not stop when its session ends: a\n * session that ends before its helpers do still leaves the cache warm. Each helper ends by itself when it is done and\n * after five minutes at most.\n */\nimport { spawn } from \"node:child_process\";\nimport { isAbsolute, resolve, win32 } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { CompileCacheHelperRuntime } from \"./compile-cache.ts\";\nimport { processCompileCacheDeferral } from \"./compile-cache-deferral.ts\";\nimport {\n\tcollectInstallProtectedDirs,\n\tDEFAULT_WINDOWS_CWD_TIMEOUT_MS,\n\tisAbsoluteWindowsPath,\n\tresolveSafeWindowsKillCwdLexical,\n\tresolveSafeWindowsWorkingDirectoryAsync,\n\twindowsDriveRoot,\n} from \"./windows-cwd.js\";\n\n/** What a helper does after its own cache: the helpers still to run, and the markers that must still stand. */\nexport interface CompileCacheWarmupPlan {\n\t/** Runtimes of the helpers to start after this one, in order. */\n\treadonly next: readonly CompileCacheHelperRuntime[];\n\t/** Markers of earlier helpers; this helper marks its cache warm only while they all exist. */\n\treadonly required: readonly string[];\n}\n\nexport function encodeCompileCacheWarmupPlan(plan: CompileCacheWarmupPlan): string {\n\treturn Buffer.from(JSON.stringify(plan), \"utf8\").toString(\"base64url\");\n}\n\nexport function decodeCompileCacheWarmupPlan(encoded: string | undefined): CompileCacheWarmupPlan {\n\tif (!encoded) return { next: [], required: [] };\n\tconst plan = JSON.parse(Buffer.from(encoded, \"base64url\").toString(\"utf8\")) as CompileCacheWarmupPlan;\n\treturn { next: plan.next ?? [], required: plan.required ?? [] };\n}\n\n/** How a helper process starts: everything `spawn` gets. */\nexport interface CompileCacheHelperLaunch {\n\treadonly command: string;\n\treadonly args: readonly string[];\n\treadonly cwd: string;\n\treadonly env: NodeJS.ProcessEnv;\n\t/** Without a console: it reads and writes none, and never joins the session's console when that closes. */\n\treadonly detached: true;\n}\n\nfunction resolveWarmupScriptPath(script: string): string {\n\tif (process.platform === \"win32\") {\n\t\tif (isAbsoluteWindowsPath(script)) return script;\n\t\ttry {\n\t\t\treturn win32.resolve(process.cwd(), script);\n\t\t} catch {\n\t\t\treturn script;\n\t\t}\n\t}\n\treturn isAbsolute(script) ? script : resolve(script);\n}\n\nfunction resolveWarmupHelperCwd(resolvedScript: string): string {\n\tif (process.platform !== \"win32\") return \"/\";\n\tconst scriptDir = win32.dirname(resolvedScript);\n\treturn (\n\t\tresolveSafeWindowsKillCwdLexical({\n\t\t\tprotectedDirs: collectInstallProtectedDirs(scriptDir),\n\t\t\tcommandPath: process.execPath,\n\t\t}) ??\n\t\twindowsDriveRoot(scriptDir) ??\n\t\t\"C:\\\\\"\n\t);\n}\n\n/**\n * The helper for `runtime`: this runtime with its heap size and without preloads, loading no native module\n * (`--no-addons`), working outside the installation (an upgrade or an uninstall replaces it while the helper may run).\n */\nexport function compileCacheHelperLaunch(\n\truntime: CompileCacheHelperRuntime,\n\tbuildId: string,\n\tscript: string = fileURLToPath(new URL(\"./compile-cache-warmup.js\", import.meta.url)),\n\tenv: NodeJS.ProcessEnv = process.env,\n\tplan: CompileCacheWarmupPlan = { next: [], required: [] },\n): CompileCacheHelperLaunch {\n\tconst helperEnv = { ...env };\n\tif (runtime.nodeOptions) helperEnv.NODE_OPTIONS = runtime.nodeOptions;\n\telse delete helperEnv.NODE_OPTIONS;\n\tconst resolvedScript = resolveWarmupScriptPath(script);\n\treturn {\n\t\tcommand: process.execPath,\n\t\targs: [...runtime.execArgv, \"--no-addons\", resolvedScript, buildId, encodeCompileCacheWarmupPlan(plan)],\n\t\tcwd: resolveWarmupHelperCwd(resolvedScript),\n\t\tenv: helperEnv,\n\t\tdetached: true,\n\t};\n}\n\n/** Start a helper that runs on its own: nothing of it keeps this process alive, and it outlives this process. */\nexport function startCompileCacheHelper(launch: CompileCacheHelperLaunch): boolean {\n\tconst spawnWithCwd = (cwd: string, allowRetry: boolean): boolean => {\n\t\ttry {\n\t\t\tconst child = spawn(launch.command, [...launch.args], {\n\t\t\t\tcwd,\n\t\t\t\tenv: launch.env,\n\t\t\t\tdetached: launch.detached,\n\t\t\t\tstdio: \"ignore\",\n\t\t\t\twindowsHide: true,\n\t\t\t});\n\t\t\tchild.on(\"error\", (error: NodeJS.ErrnoException) => {\n\t\t\t\tif (allowRetry && process.platform === \"win32\" && error.code === \"ENOENT\") {\n\t\t\t\t\tconst scriptArg = launch.args[launch.args.length - 3];\n\t\t\t\t\tconst scriptDir = scriptArg ? win32.dirname(resolveWarmupScriptPath(scriptArg)) : undefined;\n\t\t\t\t\tvoid resolveSafeWindowsWorkingDirectoryAsync({\n\t\t\t\t\t\tinstallDirs: scriptDir ? [scriptDir] : undefined,\n\t\t\t\t\t\tcommandPath: launch.command,\n\t\t\t\t\t\ttimeoutMs: DEFAULT_WINDOWS_CWD_TIMEOUT_MS,\n\t\t\t\t\t})\n\t\t\t\t\t\t.then((freshCwd) => {\n\t\t\t\t\t\t\tif (freshCwd !== undefined && freshCwd.toLowerCase() !== cwd.toLowerCase()) {\n\t\t\t\t\t\t\t\tspawnWithCwd(freshCwd, false);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch(() => {});\n\t\t\t\t}\n\t\t\t});\n\t\t\tchild.unref();\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t};\n\treturn spawnWithCwd(launch.cwd, true);\n}\n\nlet warmupStarted = false;\n\n/**\n * Helper runtimes to run in sequence: one when host and engine share a compile-cache tag (identical flags, or an\n * auto-sized `--max-old-space-size=<N>`, which leaves V8's cache tag unchanged), else engine first then host.\n */\nexport function compileCacheWarmupRuntimes(\n\town: CompileCacheHelperRuntime,\n\tengineExecArgv: readonly string[],\n): readonly CompileCacheHelperRuntime[] {\n\tconst engine: CompileCacheHelperRuntime = { execArgv: engineExecArgv, nodeOptions: own.nodeOptions };\n\tconst same =\n\t\tengine.execArgv.length === own.execArgv.length &&\n\t\tengine.execArgv.every((arg, index) => arg === own.execArgv[index]);\n\tif (same) return [own];\n\t// An auto-sized engine only adds `--max-old-space-size=<N>` when the host had no heap flag; both processes share\n\t// the host's tag, so one host helper warms both (#6222).\n\tconst heapFlag = /^--max[-_]old[-_]space[-_]size=\\d+$/;\n\tconst onlyAddedAutoHeap =\n\t\town.execArgv.length === 0 &&\n\t\t!heapFlag.test(own.nodeOptions) &&\n\t\tengine.execArgv.length === 1 &&\n\t\theapFlag.test(engine.execArgv[0]!);\n\treturn onlyAddedAutoHeap ? [own] : [engine, own];\n}\n\n/**\n * Warm the cache this session left cold: first for the engine's runtime flags (`engineExecArgv`), then for this\n * process's own. Called once the session is on screen, and when it exits before that, so even a session that ends at\n * once leaves the cache warm; only the first call starts the helpers. A helper that finds another one warming this\n * build, or fails, ends the chain; the next session that finds the cache cold starts it again.\n */\nexport function warmCompileCache(engineExecArgv: readonly string[]): void {\n\tconst deferral = processCompileCacheDeferral();\n\tif (!deferral?.helper || warmupStarted) return;\n\twarmupStarted = true;\n\tconst [first, ...next] = compileCacheWarmupRuntimes(deferral.runtime, engineExecArgv);\n\tstartCompileCacheHelper(\n\t\tcompileCacheHelperLaunch(first!, deferral.buildId, undefined, undefined, { next, required: [] }),\n\t);\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Best-effort wrappers around the runtime's on-disk compile cache. On Node
|
|
3
|
-
*
|
|
2
|
+
* Best-effort wrappers around the runtime's on-disk compile cache. On Node the
|
|
3
|
+
* cache persists compiled module bytecode across runs, which substantially
|
|
4
4
|
* reduces module-graph load time on platforms with slow cold starts (Windows).
|
|
5
5
|
* Bun implements the same calls and keeps its own bytecode for the modules it
|
|
6
|
-
* loads afterwards.
|
|
7
|
-
*
|
|
6
|
+
* loads afterwards. A runtime without these APIs makes both wrappers silent
|
|
7
|
+
* no-ops.
|
|
8
8
|
*
|
|
9
9
|
* Node writes one cache file per compiled module when the process exits, and an
|
|
10
10
|
* interactive session compiles a few thousand modules. While the cache is warm
|
|
@@ -23,17 +23,17 @@ import { existsSync } from "node:fs";
|
|
|
23
23
|
import nodeModule from "node:module";
|
|
24
24
|
import { tmpdir } from "node:os";
|
|
25
25
|
import { join } from "node:path";
|
|
26
|
-
import { cachedDataVersionTag
|
|
26
|
+
import { cachedDataVersionTag } from "node:v8";
|
|
27
27
|
import { splitNodeOptions } from "@bastani/atomic-codemode/node-options";
|
|
28
28
|
const compileCacheApi = nodeModule;
|
|
29
29
|
/** Set by a host that warms its engine's cache, so the engine leaves a cold cache to that helper too. */
|
|
30
30
|
export const COMPILE_CACHE_ENGINE_WARMUP_ENV = "ATOMIC_INTERNAL_COMPILE_CACHE_WARMUP";
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* Read by no release since Atomic needs Node.js 24.20.0: Node.js 22 engines used it to align their compile-cache tag
|
|
33
|
+
* with their host's (#6222). Still exported because a process of 0.10.4 that an in-place update caught imports it from
|
|
34
|
+
* this module's shared file.
|
|
34
35
|
*/
|
|
35
36
|
export const COMPILE_CACHE_ENGINE_MATCH_HOST_ENV = "ATOMIC_INTERNAL_COMPILE_CACHE_MATCH_HOST";
|
|
36
|
-
const ENGINE_WORKER_HEAP_MB_SYMBOL = Symbol.for("atomic.engine-worker-heap-mb.v1");
|
|
37
37
|
/**
|
|
38
38
|
* `defer`: run without the cache now and let a helper write it. `enable`: use it as before. Only an interactive
|
|
39
39
|
* process on Windows whose cache is cold for this build defers. The marker is read last, after every cheaper reason to
|
|
@@ -59,68 +59,8 @@ export function isCiValue(value) {
|
|
|
59
59
|
}
|
|
60
60
|
/** The only runtime flag a helper keeps: the heap size, which the engine gets from its host. */
|
|
61
61
|
const HEAP_SIZE_FLAG = /^--max[-_]old[-_]space[-_]size=\d+$/;
|
|
62
|
-
/** Heap size option names recognized on Node's command line (mirroring `engine-heap.ts`). */
|
|
63
|
-
const HEAP_SIZE_OPTION_NAMES = new Set([
|
|
64
|
-
"--max-old-space-size",
|
|
65
|
-
"--max-old-space-size-percentage",
|
|
66
|
-
"--max-heap-size",
|
|
67
|
-
]);
|
|
68
|
-
/** V8 heap size option names that Node also forwards with a single leading dash. */
|
|
69
|
-
const V8_HEAP_SIZE_OPTION_NAMES = new Set(["--max-old-space-size", "--max-heap-size"]);
|
|
70
62
|
/** Flags that load user code before Atomic does. A helper drops them with their values. */
|
|
71
63
|
const PRELOAD_FLAGS = new Set(["-r", "--require", "--import", "--loader", "--experimental-loader"]);
|
|
72
|
-
function flagsSetHeapSize(flags) {
|
|
73
|
-
for (const flag of flags) {
|
|
74
|
-
if (flag === "--")
|
|
75
|
-
break;
|
|
76
|
-
if (!flag.startsWith("-"))
|
|
77
|
-
continue;
|
|
78
|
-
const dashes = flag.startsWith("--") ? 2 : 1;
|
|
79
|
-
const equals = flag.indexOf("=");
|
|
80
|
-
const name = `--${(equals === -1 ? flag : flag.slice(0, equals)).slice(dashes).replaceAll("_", "-")}`;
|
|
81
|
-
if (!HEAP_SIZE_OPTION_NAMES.has(name))
|
|
82
|
-
continue;
|
|
83
|
-
if (dashes === 1 && !V8_HEAP_SIZE_OPTION_NAMES.has(name))
|
|
84
|
-
continue;
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
function parseAutoHeapMb(flag) {
|
|
90
|
-
if (!HEAP_SIZE_FLAG.test(flag))
|
|
91
|
-
return undefined;
|
|
92
|
-
const mb = Number(flag.slice(flag.indexOf("=") + 1));
|
|
93
|
-
return Number.isSafeInteger(mb) && mb > 0 ? mb : undefined;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Whether `engineRuntimeArgs` adds an auto-synthesized `--max-old-space-size=<N>` while the host itself had no
|
|
97
|
-
* explicit heap size on `execArgv` or `NODE_OPTIONS`.
|
|
98
|
-
*/
|
|
99
|
-
export function hostAutoSizedEngineHeap(hostExecArgv, nodeOptions, engineRuntimeArgs) {
|
|
100
|
-
if (flagsSetHeapSize(hostExecArgv))
|
|
101
|
-
return false;
|
|
102
|
-
const words = splitNodeOptions(nodeOptions ?? "");
|
|
103
|
-
if (!words || flagsSetHeapSize(words))
|
|
104
|
-
return false;
|
|
105
|
-
const added = engineRuntimeArgs.filter((flag) => parseAutoHeapMb(flag) !== undefined && !hostExecArgv.includes(flag));
|
|
106
|
-
return added.length === 1;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* The raised `--max-old-space-size=<N>` MiB value an auto-sized engine should reset to `0` before enabling the compile
|
|
110
|
-
* cache so its Node 22 cache tag matches the untouched host while retaining its raised isolate and worker heap caps
|
|
111
|
-
* (#6222). Returns `undefined` when the host did not auto-size the engine, the cache is pre-enabled/disabled/unsupported,
|
|
112
|
-
* running under Bun, or `NODE_OPTIONS` already sets a heap size.
|
|
113
|
-
*/
|
|
114
|
-
export function engineCompileCacheResetHeapMb(input) {
|
|
115
|
-
if (input.runtimeIsBun || input.unsupported || input.alreadyEnabled || input.disabled || !input.matchHostTag) {
|
|
116
|
-
return undefined;
|
|
117
|
-
}
|
|
118
|
-
const words = splitNodeOptions(input.nodeOptions ?? "");
|
|
119
|
-
if (!words || flagsSetHeapSize(words))
|
|
120
|
-
return undefined;
|
|
121
|
-
const heapValues = input.execArgv.map(parseAutoHeapMb).filter((mb) => mb !== undefined);
|
|
122
|
-
return heapValues.length === 1 ? heapValues[0] : undefined;
|
|
123
|
-
}
|
|
124
64
|
function keptFlags(flags) {
|
|
125
65
|
const kept = [];
|
|
126
66
|
for (let index = 0; index < flags.length; index++) {
|
|
@@ -170,8 +110,8 @@ export function compileCacheBaseDir() {
|
|
|
170
110
|
}
|
|
171
111
|
/**
|
|
172
112
|
* The marker for a build in the cache directory Node uses for this runtime version and these runtime flags. Node
|
|
173
|
-
* names that directory after its version, architecture and V8's cache tag (which changes with flags
|
|
174
|
-
*
|
|
113
|
+
* names that directory after its version, architecture and V8's cache tag (which changes with some V8 flags), plus the
|
|
114
|
+
* user id on POSIX, so each flag set has its own marker.
|
|
175
115
|
*/
|
|
176
116
|
export function compileCacheWarmMarker(options) {
|
|
177
117
|
const tag = `${options.nodeVersion}-${options.arch}-${(options.versionTag >>> 0).toString(16).padStart(8, "0")}${options.uid === undefined ? "" : `-${options.uid}`}`;
|
|
@@ -190,12 +130,8 @@ export function currentCompileCacheWarmMarker(buildId) {
|
|
|
190
130
|
}
|
|
191
131
|
let deferral;
|
|
192
132
|
/**
|
|
193
|
-
* Enable the compile cache for this process.
|
|
194
|
-
*
|
|
195
|
-
* cache tag with the untouched host while preserving its raised isolate heap limit and passing its original heap size
|
|
196
|
-
* to workers via `resourceLimits` (#6222). On Node 24 the tag is unchanged, so the flag is restored untouched.
|
|
197
|
-
* An `interactive` process on Windows whose cache is cold for `build` runs without it instead, and its host starts a
|
|
198
|
-
* helper that writes it.
|
|
133
|
+
* Enable the compile cache for this process. An `interactive` process on Windows whose cache is cold for `build` runs
|
|
134
|
+
* without it instead, and its host starts a helper that writes it.
|
|
199
135
|
*/
|
|
200
136
|
export function enablePersistentCompileCache(options = {}) {
|
|
201
137
|
try {
|
|
@@ -203,30 +139,6 @@ export function enablePersistentCompileCache(options = {}) {
|
|
|
203
139
|
const unsupported = typeof compileCacheApi.enableCompileCache !== "function";
|
|
204
140
|
const alreadyEnabled = compileCacheApi.getCompileCacheDir?.() !== undefined;
|
|
205
141
|
const disabled = process.env.NODE_DISABLE_COMPILE_CACHE !== undefined;
|
|
206
|
-
const resetHeapMb = engineCompileCacheResetHeapMb({
|
|
207
|
-
runtimeIsBun,
|
|
208
|
-
unsupported,
|
|
209
|
-
alreadyEnabled,
|
|
210
|
-
disabled,
|
|
211
|
-
matchHostTag: options.matchHostTag === true,
|
|
212
|
-
execArgv: process.execArgv,
|
|
213
|
-
nodeOptions: process.env.NODE_OPTIONS,
|
|
214
|
-
});
|
|
215
|
-
if (resetHeapMb !== undefined) {
|
|
216
|
-
try {
|
|
217
|
-
const beforeTag = cachedDataVersionTag();
|
|
218
|
-
setFlagsFromString("--max-old-space-size=0");
|
|
219
|
-
if (cachedDataVersionTag() === beforeTag) {
|
|
220
|
-
setFlagsFromString(`--max-old-space-size=${resetHeapMb}`);
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
globalThis[ENGINE_WORKER_HEAP_MB_SYMBOL] = resetHeapMb;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
catch {
|
|
227
|
-
// Best effort: keep the runtime's existing flags if V8 rejects the flag.
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
142
|
const runtime = compileCacheHelperRuntime(process.execArgv, process.env);
|
|
231
143
|
const buildId = compileCacheBuildId(`${import.meta.url}\0${options.build ?? ""}`);
|
|
232
144
|
const mode = compileCacheStartMode({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-cache.js","sourceRoot":"","sources":["../../src/utils/compile-cache.ts"],"names":[],"mappings":"AAAA;;;;;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,KAAK,OAAO,IAAI,OAAO,EAAE,CAAC;YACjC,QAAQ,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,wBAAwB,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/E,OAAO;QACR,CAAC;QACD,eAAe,CAAC,kBAAkB,EAAE,EAAE,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACR,uEAAuE;IACxE,CAAC;AACF,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,oBAAoB;IACnC,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B;IAC1C,IAAI,CAAC;QACJ,eAAe,CAAC,iBAAiB,EAAE,EAAE,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACR,eAAe;IAChB,CAAC;AACF,CAAC","sourcesContent":["/**\n * Best-effort wrappers around the runtime's on-disk compile cache. On Node >= 22.8\n * the cache persists compiled module bytecode across runs, which substantially\n * reduces module-graph load time on platforms with slow cold starts (Windows).\n * Bun implements the same calls and keeps its own bytecode for the modules it\n * loads afterwards. Older Node versions do not expose these APIs, so both\n * wrappers are silent no-ops there.\n *\n * Node writes one cache file per compiled module when the process exits, and an\n * interactive session compiles a few thousand modules. While the cache is warm\n * that write is empty; on the first run after an install or an upgrade it covers\n * the whole module graph, which takes seconds on Windows after the session has\n * ended (#6132). On Windows an interactive session therefore leaves a cold cache\n * alone: it runs without it (after an install there is nothing to read; after an\n * upgrade it gives up the entries of files the upgrade left unchanged), and a\n * helper process that owns nothing else loads the same modules and writes the\n * cache (`compile-cache-warmup-host.ts`), finishing after the session if the\n * session ends first. The helper marks the cache warm for this Atomic build when\n * it is done, and later sessions use the cache as before. Elsewhere the exit-time write takes a fraction of a second and\n * the cache works as it always did.\n */\nimport { existsSync } from \"node:fs\";\nimport nodeModule from \"node:module\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { cachedDataVersionTag, setFlagsFromString } from \"node:v8\";\nimport { splitNodeOptions } from \"@bastani/atomic-codemode/node-options\";\n\ninterface CompileCacheApi {\n\tenableCompileCache?: () => unknown;\n\tflushCompileCache?: () => void;\n\tgetCompileCacheDir?: () => string | undefined;\n}\n\nconst compileCacheApi: CompileCacheApi = nodeModule;\n\n/** Set by a host that warms its engine's cache, so the engine leaves a cold cache to that helper too. */\nexport const COMPILE_CACHE_ENGINE_WARMUP_ENV = \"ATOMIC_INTERNAL_COMPILE_CACHE_WARMUP\";\n/**\n * Set by a Node host when it auto-sized the engine's heap (`--max-old-space-size=<N>`), so on Node 22 the engine\n * aligns its V8 compile-cache tag back to the host's default tag while keeping its raised main and worker heap caps.\n */\nexport const COMPILE_CACHE_ENGINE_MATCH_HOST_ENV = \"ATOMIC_INTERNAL_COMPILE_CACHE_MATCH_HOST\";\nconst ENGINE_WORKER_HEAP_MB_SYMBOL = Symbol.for(\"atomic.engine-worker-heap-mb.v1\");\n\n/** What decides how a process starts with the compile cache. */\nexport interface CompileCacheStartInput {\n\treadonly platform: NodeJS.Platform;\n\t/** Bun keeps its own cache: nothing here applies. */\n\treadonly runtimeIsBun: boolean;\n\t/** This Node has no compile cache API. */\n\treadonly unsupported: boolean;\n\t/** The runtime enabled the cache before Atomic ran (NODE_COMPILE_CACHE). */\n\treadonly alreadyEnabled: boolean;\n\t/** NODE_DISABLE_COMPILE_CACHE is present, whatever its value: Node never enables the cache. */\n\treadonly disabled: boolean;\n\t/** An interactive session, or the engine of one whose host warms the engine's cache. */\n\treadonly interactive: boolean;\n\t/** Runtime flags and environment a helper can repeat; see `compileCacheHelperRuntime`. */\n\treadonly helperRuntime: boolean;\n\t/** Reads the marker a helper leaves when it has written the cache for this build, runtime and flags. */\n\treadonly warm: () => boolean;\n}\n\n/**\n * `defer`: run without the cache now and let a helper write it. `enable`: use it as before. Only an interactive\n * process on Windows whose cache is cold for this build defers. The marker is read last, after every cheaper reason to\n * keep the cache as it was.\n */\nexport function compileCacheStartMode(input: CompileCacheStartInput): \"enable\" | \"defer\" {\n\tif (input.platform !== \"win32\" || input.runtimeIsBun || input.unsupported) return \"enable\";\n\tif (input.alreadyEnabled || input.disabled || !input.interactive || !input.helperRuntime) return \"enable\";\n\treturn input.warm() ? \"enable\" : \"defer\";\n}\n\n/** Whether a session that left its cold cache alone starts a helper to write it: never under CI. */\nexport function startsCompileCacheHelper(env: NodeJS.ProcessEnv): boolean {\n\treturn !isCiValue(env.CI);\n}\n\n/** Whether `CI` names a CI run, as the fullscreen TUI reads it: any value but empty, `0` and `false`. */\nexport function isCiValue(value: string | undefined): boolean {\n\tif (value === undefined) return false;\n\tconst normalized = value.trim().toLowerCase();\n\treturn normalized !== \"\" && normalized !== \"0\" && normalized !== \"false\";\n}\n\n/** The only runtime flag a helper keeps: the heap size, which the engine gets from its host. */\nconst HEAP_SIZE_FLAG = /^--max[-_]old[-_]space[-_]size=\\d+$/;\n/** Heap size option names recognized on Node's command line (mirroring `engine-heap.ts`). */\nconst HEAP_SIZE_OPTION_NAMES: ReadonlySet<string> = new Set([\n\t\"--max-old-space-size\",\n\t\"--max-old-space-size-percentage\",\n\t\"--max-heap-size\",\n]);\n/** V8 heap size option names that Node also forwards with a single leading dash. */\nconst V8_HEAP_SIZE_OPTION_NAMES: ReadonlySet<string> = new Set([\"--max-old-space-size\", \"--max-heap-size\"]);\n/** Flags that load user code before Atomic does. A helper drops them with their values. */\nconst PRELOAD_FLAGS = new Set([\"-r\", \"--require\", \"--import\", \"--loader\", \"--experimental-loader\"]);\n\n/** What decides whether an auto-sized engine resets its V8 heap flag so its compile-cache tag matches the host's. */\nexport interface CompileCacheEngineResetInput {\n\treadonly runtimeIsBun: boolean;\n\treadonly unsupported: boolean;\n\treadonly alreadyEnabled: boolean;\n\treadonly disabled: boolean;\n\treadonly matchHostTag: boolean;\n\treadonly execArgv: readonly string[];\n\treadonly nodeOptions: string | undefined;\n}\n\nfunction flagsSetHeapSize(flags: readonly string[]): boolean {\n\tfor (const flag of flags) {\n\t\tif (flag === \"--\") break;\n\t\tif (!flag.startsWith(\"-\")) continue;\n\t\tconst dashes = flag.startsWith(\"--\") ? 2 : 1;\n\t\tconst equals = flag.indexOf(\"=\");\n\t\tconst name = `--${(equals === -1 ? flag : flag.slice(0, equals)).slice(dashes).replaceAll(\"_\", \"-\")}`;\n\t\tif (!HEAP_SIZE_OPTION_NAMES.has(name)) continue;\n\t\tif (dashes === 1 && !V8_HEAP_SIZE_OPTION_NAMES.has(name)) continue;\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nfunction parseAutoHeapMb(flag: string): number | undefined {\n\tif (!HEAP_SIZE_FLAG.test(flag)) return undefined;\n\tconst mb = Number(flag.slice(flag.indexOf(\"=\") + 1));\n\treturn Number.isSafeInteger(mb) && mb > 0 ? mb : undefined;\n}\n\n/**\n * Whether `engineRuntimeArgs` adds an auto-synthesized `--max-old-space-size=<N>` while the host itself had no\n * explicit heap size on `execArgv` or `NODE_OPTIONS`.\n */\nexport function hostAutoSizedEngineHeap(\n\thostExecArgv: readonly string[],\n\tnodeOptions: string | undefined,\n\tengineRuntimeArgs: readonly string[],\n): boolean {\n\tif (flagsSetHeapSize(hostExecArgv)) return false;\n\tconst words = splitNodeOptions(nodeOptions ?? \"\");\n\tif (!words || flagsSetHeapSize(words)) return false;\n\tconst added = engineRuntimeArgs.filter(\n\t\t(flag) => parseAutoHeapMb(flag) !== undefined && !hostExecArgv.includes(flag),\n\t);\n\treturn added.length === 1;\n}\n\n/**\n * The raised `--max-old-space-size=<N>` MiB value an auto-sized engine should reset to `0` before enabling the compile\n * cache so its Node 22 cache tag matches the untouched host while retaining its raised isolate and worker heap caps\n * (#6222). Returns `undefined` when the host did not auto-size the engine, the cache is pre-enabled/disabled/unsupported,\n * running under Bun, or `NODE_OPTIONS` already sets a heap size.\n */\nexport function engineCompileCacheResetHeapMb(input: CompileCacheEngineResetInput): number | undefined {\n\tif (input.runtimeIsBun || input.unsupported || input.alreadyEnabled || input.disabled || !input.matchHostTag) {\n\t\treturn undefined;\n\t}\n\tconst words = splitNodeOptions(input.nodeOptions ?? \"\");\n\tif (!words || flagsSetHeapSize(words)) return undefined;\n\tconst heapValues = input.execArgv.map(parseAutoHeapMb).filter((mb): mb is number => mb !== undefined);\n\treturn heapValues.length === 1 ? heapValues[0] : undefined;\n}\n\n/** Runtime flags and `NODE_OPTIONS` for a helper, or undefined when these cannot be repeated without side effects. */\nexport interface CompileCacheHelperRuntime {\n\treadonly execArgv: readonly string[];\n\treadonly nodeOptions: string;\n}\n\nfunction keptFlags(flags: readonly string[]): string[] | undefined {\n\tconst kept: string[] = [];\n\tfor (let index = 0; index < flags.length; index++) {\n\t\tconst flag = flags[index]!;\n\t\tif (HEAP_SIZE_FLAG.test(flag)) {\n\t\t\tkept.push(flag);\n\t\t\tcontinue;\n\t\t}\n\t\tconst name = flag.includes(\"=\") ? flag.slice(0, flag.indexOf(\"=\")) : flag;\n\t\tif (!PRELOAD_FLAGS.has(name)) return undefined;\n\t\tif (!flag.includes(\"=\")) index++;\n\t}\n\treturn kept;\n}\n\n/**\n * The runtime a helper repeats: this process's heap size, without the preloads (`--require`, `--import`, loaders)\n * that would run user code a second time. Anything else on the command line or in `NODE_OPTIONS` (an inspector, a\n * profiler, coverage, other V8 flags that would give the helper a different cache), and a `NODE_OPTIONS` value Node\n * refuses, with which a helper would not start, leaves the cache as it always was.\n */\nexport function compileCacheHelperRuntime(\n\texecArgv: readonly string[],\n\tenv: NodeJS.ProcessEnv,\n): CompileCacheHelperRuntime | undefined {\n\tif (env.NODE_V8_COVERAGE !== undefined) return undefined;\n\tconst words = splitNodeOptions(env.NODE_OPTIONS ?? \"\");\n\tif (!words) return undefined;\n\tconst command = keptFlags(execArgv);\n\tconst options = keptFlags(words);\n\tif (!command || !options) return undefined;\n\treturn { execArgv: command, nodeOptions: options.join(\" \") };\n}\n\n/** FNV-1a: a short, stable name for this Atomic build, without loading a hash library at startup. */\nexport function compileCacheBuildId(build: string): string {\n\tlet hash = 0x811c9dc5;\n\tfor (let index = 0; index < build.length; index++) {\n\t\thash ^= build.charCodeAt(index);\n\t\thash = Math.imul(hash, 0x01000193) >>> 0;\n\t}\n\treturn hash.toString(16).padStart(8, \"0\");\n}\n\n/** Node's own default when the cache is enabled without a directory. */\nexport function compileCacheBaseDir(): string {\n\treturn join(tmpdir(), \"node-compile-cache\");\n}\n\n/**\n * The marker for a build in the cache directory Node uses for this runtime version and these runtime flags. Node\n * names that directory after its version, architecture and V8's cache tag (which changes with flags such as the\n * engine's heap size on Node 22), plus the user id on POSIX, so each flag set has its own marker.\n */\nexport function compileCacheWarmMarker(options: {\n\treadonly baseDir: string;\n\treadonly nodeVersion: string;\n\treadonly arch: string;\n\treadonly versionTag: number;\n\treadonly uid: number | undefined;\n\treadonly buildId: string;\n}): string {\n\tconst tag = `${options.nodeVersion}-${options.arch}-${(options.versionTag >>> 0).toString(16).padStart(8, \"0\")}${\n\t\toptions.uid === undefined ? \"\" : `-${options.uid}`\n\t}`;\n\treturn join(options.baseDir, tag, `atomic-warm-${options.buildId}`);\n}\n\n/** This process's marker for a build. */\nexport function currentCompileCacheWarmMarker(buildId: string): string {\n\treturn compileCacheWarmMarker({\n\t\tbaseDir: compileCacheBaseDir(),\n\t\tnodeVersion: process.version,\n\t\tarch: process.arch,\n\t\tversionTag: cachedDataVersionTag(),\n\t\tuid: typeof process.getuid === \"function\" ? process.getuid() : undefined,\n\t\tbuildId,\n\t});\n}\n\n/** A process that left its cold cache alone: the build, how a helper repeats this runtime, and whether one starts. */\nexport interface CompileCacheDeferral {\n\treadonly buildId: string;\n\treadonly runtime: CompileCacheHelperRuntime;\n\t/** False under CI: the session still quits without writing the cache, and nothing warms it. */\n\treadonly helper: boolean;\n}\n\nlet deferral: CompileCacheDeferral | undefined;\n\n/**\n * Enable the compile cache for this process. When `matchHostTag` is set (an isolated engine whose heap was auto-sized\n * by its Node host) and resetting `--max-old-space-size=0` changes V8's cache tag (Node 22), the engine aligns its\n * cache tag with the untouched host while preserving its raised isolate heap limit and passing its original heap size\n * to workers via `resourceLimits` (#6222). On Node 24 the tag is unchanged, so the flag is restored untouched.\n * An `interactive` process on Windows whose cache is cold for `build` runs without it instead, and its host starts a\n * helper that writes it.\n */\nexport function enablePersistentCompileCache(\n\toptions: { interactive?: boolean; build?: string; matchHostTag?: boolean } = {},\n): void {\n\ttry {\n\t\tconst runtimeIsBun = \"bun\" in process.versions;\n\t\tconst unsupported = typeof compileCacheApi.enableCompileCache !== \"function\";\n\t\tconst alreadyEnabled = compileCacheApi.getCompileCacheDir?.() !== undefined;\n\t\tconst disabled = process.env.NODE_DISABLE_COMPILE_CACHE !== undefined;\n\t\tconst resetHeapMb = engineCompileCacheResetHeapMb({\n\t\t\truntimeIsBun,\n\t\t\tunsupported,\n\t\t\talreadyEnabled,\n\t\t\tdisabled,\n\t\t\tmatchHostTag: options.matchHostTag === true,\n\t\t\texecArgv: process.execArgv,\n\t\t\tnodeOptions: process.env.NODE_OPTIONS,\n\t\t});\n\t\tif (resetHeapMb !== undefined) {\n\t\t\ttry {\n\t\t\t\tconst beforeTag = cachedDataVersionTag();\n\t\t\t\tsetFlagsFromString(\"--max-old-space-size=0\");\n\t\t\t\tif (cachedDataVersionTag() === beforeTag) {\n\t\t\t\t\tsetFlagsFromString(`--max-old-space-size=${resetHeapMb}`);\n\t\t\t\t} else {\n\t\t\t\t\t(globalThis as Record<symbol, unknown>)[ENGINE_WORKER_HEAP_MB_SYMBOL] = resetHeapMb;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Best effort: keep the runtime's existing flags if V8 rejects the flag.\n\t\t\t}\n\t\t}\n\t\tconst runtime = compileCacheHelperRuntime(process.execArgv, process.env);\n\t\tconst buildId = compileCacheBuildId(`${import.meta.url}\\0${options.build ?? \"\"}`);\n\t\tconst mode = compileCacheStartMode({\n\t\t\tplatform: process.platform,\n\t\t\truntimeIsBun,\n\t\t\tunsupported,\n\t\t\talreadyEnabled,\n\t\t\tdisabled,\n\t\t\tinteractive: options.interactive === true && options.build !== undefined,\n\t\t\thelperRuntime: runtime !== undefined,\n\t\t\twarm: () => existsSync(currentCompileCacheWarmMarker(buildId)),\n\t\t});\n\t\tif (mode === \"defer\" && runtime) {\n\t\t\tdeferral = { buildId, runtime, helper: startsCompileCacheHelper(process.env) };\n\t\t\treturn;\n\t\t}\n\t\tcompileCacheApi.enableCompileCache?.();\n\t} catch {\n\t\t// Best effort: an unwritable cache directory must never break startup.\n\t}\n}\n\n/** The cache this process left cold for a helper, if any. */\nexport function compileCacheDeferral(): CompileCacheDeferral | undefined {\n\treturn deferral;\n}\n\n/**\n * Persist the compile cache accumulated so far. Called before spawning the\n * interactive engine child so the child's load of the same module graph hits\n * the cache even on the very first run after an install.\n */\nexport function flushPersistentCompileCache(): void {\n\ttry {\n\t\tcompileCacheApi.flushCompileCache?.();\n\t} catch {\n\t\t// Best effort.\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compile-cache.js","sourceRoot":"","sources":["../../src/utils/compile-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAQzE,MAAM,eAAe,GAAoB,UAAU,CAAC;AAEpD,yGAAyG;AACzG,MAAM,CAAC,MAAM,+BAA+B,GAAG,sCAAsC,CAAC;AACtF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,0CAA0C,CAAC;AAqB9F;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAA6B;IAClE,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO,IAAI,KAAK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,MAAM,UAAU,oBAAoB;IACnC,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B;IAC1C,IAAI,CAAC;QACJ,eAAe,CAAC,iBAAiB,EAAE,EAAE,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACR,eAAe;IAChB,CAAC;AACF,CAAC","sourcesContent":["/**\n * Best-effort wrappers around the runtime's on-disk compile cache. On Node the\n * cache persists compiled module bytecode across runs, which substantially\n * reduces module-graph load time on platforms with slow cold starts (Windows).\n * Bun implements the same calls and keeps its own bytecode for the modules it\n * loads afterwards. A runtime without these APIs makes both wrappers silent\n * no-ops.\n *\n * Node writes one cache file per compiled module when the process exits, and an\n * interactive session compiles a few thousand modules. While the cache is warm\n * that write is empty; on the first run after an install or an upgrade it covers\n * the whole module graph, which takes seconds on Windows after the session has\n * ended (#6132). On Windows an interactive session therefore leaves a cold cache\n * alone: it runs without it (after an install there is nothing to read; after an\n * upgrade it gives up the entries of files the upgrade left unchanged), and a\n * helper process that owns nothing else loads the same modules and writes the\n * cache (`compile-cache-warmup-host.ts`), finishing after the session if the\n * session ends first. The helper marks the cache warm for this Atomic build when\n * it is done, and later sessions use the cache as before. Elsewhere the exit-time write takes a fraction of a second and\n * the cache works as it always did.\n */\nimport { existsSync } from \"node:fs\";\nimport nodeModule from \"node:module\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { cachedDataVersionTag } from \"node:v8\";\nimport { splitNodeOptions } from \"@bastani/atomic-codemode/node-options\";\n\ninterface CompileCacheApi {\n\tenableCompileCache?: () => unknown;\n\tflushCompileCache?: () => void;\n\tgetCompileCacheDir?: () => string | undefined;\n}\n\nconst compileCacheApi: CompileCacheApi = nodeModule;\n\n/** Set by a host that warms its engine's cache, so the engine leaves a cold cache to that helper too. */\nexport const COMPILE_CACHE_ENGINE_WARMUP_ENV = \"ATOMIC_INTERNAL_COMPILE_CACHE_WARMUP\";\n/**\n * Read by no release since Atomic needs Node.js 24.20.0: Node.js 22 engines used it to align their compile-cache tag\n * with their host's (#6222). Still exported because a process of 0.10.4 that an in-place update caught imports it from\n * this module's shared file.\n */\nexport const COMPILE_CACHE_ENGINE_MATCH_HOST_ENV = \"ATOMIC_INTERNAL_COMPILE_CACHE_MATCH_HOST\";\n\n/** What decides how a process starts with the compile cache. */\nexport interface CompileCacheStartInput {\n\treadonly platform: NodeJS.Platform;\n\t/** Bun keeps its own cache: nothing here applies. */\n\treadonly runtimeIsBun: boolean;\n\t/** This Node has no compile cache API. */\n\treadonly unsupported: boolean;\n\t/** The runtime enabled the cache before Atomic ran (NODE_COMPILE_CACHE). */\n\treadonly alreadyEnabled: boolean;\n\t/** NODE_DISABLE_COMPILE_CACHE is present, whatever its value: Node never enables the cache. */\n\treadonly disabled: boolean;\n\t/** An interactive session, or the engine of one whose host warms the engine's cache. */\n\treadonly interactive: boolean;\n\t/** Runtime flags and environment a helper can repeat; see `compileCacheHelperRuntime`. */\n\treadonly helperRuntime: boolean;\n\t/** Reads the marker a helper leaves when it has written the cache for this build, runtime and flags. */\n\treadonly warm: () => boolean;\n}\n\n/**\n * `defer`: run without the cache now and let a helper write it. `enable`: use it as before. Only an interactive\n * process on Windows whose cache is cold for this build defers. The marker is read last, after every cheaper reason to\n * keep the cache as it was.\n */\nexport function compileCacheStartMode(input: CompileCacheStartInput): \"enable\" | \"defer\" {\n\tif (input.platform !== \"win32\" || input.runtimeIsBun || input.unsupported) return \"enable\";\n\tif (input.alreadyEnabled || input.disabled || !input.interactive || !input.helperRuntime) return \"enable\";\n\treturn input.warm() ? \"enable\" : \"defer\";\n}\n\n/** Whether a session that left its cold cache alone starts a helper to write it: never under CI. */\nexport function startsCompileCacheHelper(env: NodeJS.ProcessEnv): boolean {\n\treturn !isCiValue(env.CI);\n}\n\n/** Whether `CI` names a CI run, as the fullscreen TUI reads it: any value but empty, `0` and `false`. */\nexport function isCiValue(value: string | undefined): boolean {\n\tif (value === undefined) return false;\n\tconst normalized = value.trim().toLowerCase();\n\treturn normalized !== \"\" && normalized !== \"0\" && normalized !== \"false\";\n}\n\n/** The only runtime flag a helper keeps: the heap size, which the engine gets from its host. */\nconst HEAP_SIZE_FLAG = /^--max[-_]old[-_]space[-_]size=\\d+$/;\n/** Flags that load user code before Atomic does. A helper drops them with their values. */\nconst PRELOAD_FLAGS = new Set([\"-r\", \"--require\", \"--import\", \"--loader\", \"--experimental-loader\"]);\n\n/** Runtime flags and `NODE_OPTIONS` for a helper, or undefined when these cannot be repeated without side effects. */\nexport interface CompileCacheHelperRuntime {\n\treadonly execArgv: readonly string[];\n\treadonly nodeOptions: string;\n}\n\nfunction keptFlags(flags: readonly string[]): string[] | undefined {\n\tconst kept: string[] = [];\n\tfor (let index = 0; index < flags.length; index++) {\n\t\tconst flag = flags[index]!;\n\t\tif (HEAP_SIZE_FLAG.test(flag)) {\n\t\t\tkept.push(flag);\n\t\t\tcontinue;\n\t\t}\n\t\tconst name = flag.includes(\"=\") ? flag.slice(0, flag.indexOf(\"=\")) : flag;\n\t\tif (!PRELOAD_FLAGS.has(name)) return undefined;\n\t\tif (!flag.includes(\"=\")) index++;\n\t}\n\treturn kept;\n}\n\n/**\n * The runtime a helper repeats: this process's heap size, without the preloads (`--require`, `--import`, loaders)\n * that would run user code a second time. Anything else on the command line or in `NODE_OPTIONS` (an inspector, a\n * profiler, coverage, other V8 flags that would give the helper a different cache), and a `NODE_OPTIONS` value Node\n * refuses, with which a helper would not start, leaves the cache as it always was.\n */\nexport function compileCacheHelperRuntime(\n\texecArgv: readonly string[],\n\tenv: NodeJS.ProcessEnv,\n): CompileCacheHelperRuntime | undefined {\n\tif (env.NODE_V8_COVERAGE !== undefined) return undefined;\n\tconst words = splitNodeOptions(env.NODE_OPTIONS ?? \"\");\n\tif (!words) return undefined;\n\tconst command = keptFlags(execArgv);\n\tconst options = keptFlags(words);\n\tif (!command || !options) return undefined;\n\treturn { execArgv: command, nodeOptions: options.join(\" \") };\n}\n\n/** FNV-1a: a short, stable name for this Atomic build, without loading a hash library at startup. */\nexport function compileCacheBuildId(build: string): string {\n\tlet hash = 0x811c9dc5;\n\tfor (let index = 0; index < build.length; index++) {\n\t\thash ^= build.charCodeAt(index);\n\t\thash = Math.imul(hash, 0x01000193) >>> 0;\n\t}\n\treturn hash.toString(16).padStart(8, \"0\");\n}\n\n/** Node's own default when the cache is enabled without a directory. */\nexport function compileCacheBaseDir(): string {\n\treturn join(tmpdir(), \"node-compile-cache\");\n}\n\n/**\n * The marker for a build in the cache directory Node uses for this runtime version and these runtime flags. Node\n * names that directory after its version, architecture and V8's cache tag (which changes with some V8 flags), plus the\n * user id on POSIX, so each flag set has its own marker.\n */\nexport function compileCacheWarmMarker(options: {\n\treadonly baseDir: string;\n\treadonly nodeVersion: string;\n\treadonly arch: string;\n\treadonly versionTag: number;\n\treadonly uid: number | undefined;\n\treadonly buildId: string;\n}): string {\n\tconst tag = `${options.nodeVersion}-${options.arch}-${(options.versionTag >>> 0).toString(16).padStart(8, \"0\")}${\n\t\toptions.uid === undefined ? \"\" : `-${options.uid}`\n\t}`;\n\treturn join(options.baseDir, tag, `atomic-warm-${options.buildId}`);\n}\n\n/** This process's marker for a build. */\nexport function currentCompileCacheWarmMarker(buildId: string): string {\n\treturn compileCacheWarmMarker({\n\t\tbaseDir: compileCacheBaseDir(),\n\t\tnodeVersion: process.version,\n\t\tarch: process.arch,\n\t\tversionTag: cachedDataVersionTag(),\n\t\tuid: typeof process.getuid === \"function\" ? process.getuid() : undefined,\n\t\tbuildId,\n\t});\n}\n\n/** A process that left its cold cache alone: the build, how a helper repeats this runtime, and whether one starts. */\nexport interface CompileCacheDeferral {\n\treadonly buildId: string;\n\treadonly runtime: CompileCacheHelperRuntime;\n\t/** False under CI: the session still quits without writing the cache, and nothing warms it. */\n\treadonly helper: boolean;\n}\n\nlet deferral: CompileCacheDeferral | undefined;\n\n/**\n * Enable the compile cache for this process. An `interactive` process on Windows whose cache is cold for `build` runs\n * without it instead, and its host starts a helper that writes it.\n */\nexport function enablePersistentCompileCache(options: { interactive?: boolean; build?: string } = {}): void {\n\ttry {\n\t\tconst runtimeIsBun = \"bun\" in process.versions;\n\t\tconst unsupported = typeof compileCacheApi.enableCompileCache !== \"function\";\n\t\tconst alreadyEnabled = compileCacheApi.getCompileCacheDir?.() !== undefined;\n\t\tconst disabled = process.env.NODE_DISABLE_COMPILE_CACHE !== undefined;\n\t\tconst runtime = compileCacheHelperRuntime(process.execArgv, process.env);\n\t\tconst buildId = compileCacheBuildId(`${import.meta.url}\\0${options.build ?? \"\"}`);\n\t\tconst mode = compileCacheStartMode({\n\t\t\tplatform: process.platform,\n\t\t\truntimeIsBun,\n\t\t\tunsupported,\n\t\t\talreadyEnabled,\n\t\t\tdisabled,\n\t\t\tinteractive: options.interactive === true && options.build !== undefined,\n\t\t\thelperRuntime: runtime !== undefined,\n\t\t\twarm: () => existsSync(currentCompileCacheWarmMarker(buildId)),\n\t\t});\n\t\tif (mode === \"defer\" && runtime) {\n\t\t\tdeferral = { buildId, runtime, helper: startsCompileCacheHelper(process.env) };\n\t\t\treturn;\n\t\t}\n\t\tcompileCacheApi.enableCompileCache?.();\n\t} catch {\n\t\t// Best effort: an unwritable cache directory must never break startup.\n\t}\n}\n\n/** The cache this process left cold for a helper, if any. */\nexport function compileCacheDeferral(): CompileCacheDeferral | undefined {\n\treturn deferral;\n}\n\n/**\n * Persist the compile cache accumulated so far. Called before spawning the\n * interactive engine child so the child's load of the same module graph hits\n * the cache even on the very first run after an install.\n */\nexport function flushPersistentCompileCache(): void {\n\ttry {\n\t\tcompileCacheApi.flushCompileCache?.();\n\t} catch {\n\t\t// Best effort.\n\t}\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../_shared/rolldown-runtime-BGM3D5V3.js";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { parseArgs } from "../_shared/startup-0-1-
|
|
4
|
+
import { parseArgs } from "../_shared/startup-0-1-RTOHJFDJ.js";
|
|
5
5
|
import { CONFIG_DIR_NAME, ENV_AGENT_DIR, INTERACTIVE_ENGINE_PREWARM_NO_DATABASE, getEnvNames, isPlainInteractiveSessionInvocation, normalizePath, stripBom } from "../_shared/p0-cli-BB45ZQY6.js";
|
|
6
6
|
import { parseConfigCommand } from "../_shared/config-command-parser-XRBNVMBV.js";
|
|
7
|
-
import { previewProcessStorageSelection, previewSessionSettingSelection } from "../_shared/startup-0-2-
|
|
8
|
-
import { parsePackageCommand } from "../_shared/startup-0-0-
|
|
7
|
+
import { previewProcessStorageSelection, previewSessionSettingSelection } from "../_shared/startup-0-2-5QHPCEON.js";
|
|
8
|
+
import { parsePackageCommand } from "../_shared/startup-0-0-EZUKEP4Q.js";
|
|
9
9
|
// dist/utils/startup-database-spare.js
|
|
10
10
|
const DIRECT_SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
11
11
|
"auth",
|
|
@@ -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.3`;
|
|
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.3") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.3 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.11-alpha.
|
|
9
|
+
const key = `${root.href}#0.10.11-alpha.3`;
|
|
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.3") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.3 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|