@bastani/atomic 0.10.11-alpha.2 → 0.10.11-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (447) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/README.md +5 -8
  3. package/dist/_shared/dist-KOELCESV.js +2 -2
  4. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  5. package/dist/_shared/lib-4PES5P4V.js +2 -2
  6. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +6 -6
  7. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +5 -5
  8. package/dist/_shared/mode-shared-2QJSCUM6.js +6 -6
  9. package/dist/_shared/p0-cli-BB45ZQY6.js +46 -67
  10. package/dist/_shared/p0-cli-BB45ZQY6.js.map +1 -1
  11. package/dist/_shared/p1a-prewarm-XIU57JHF.js +7 -8
  12. package/dist/_shared/p1a-prewarm-XIU57JHF.js.map +1 -1
  13. package/dist/_shared/{p1b-elig-ENCUPKKJ.js → p1b-elig-TVB5CBLL.js} +36 -8
  14. package/dist/_shared/p1b-elig-TVB5CBLL.js.map +1 -0
  15. package/dist/_shared/p2-shell-main-B2WIALFD.js +6 -3
  16. package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
  17. package/dist/_shared/runtime-O4KCSG4C.js +3 -3
  18. package/dist/_shared/{sdk-IQMULKFU.js → sdk-B5LEWGGI.js} +1218 -657
  19. package/dist/_shared/sdk-B5LEWGGI.js.map +1 -0
  20. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  21. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  22. package/dist/_shared/{startup-0-0-3IXNMFM2.js → startup-0-0-XJJDOIEC.js} +50 -48
  23. package/dist/_shared/startup-0-0-XJJDOIEC.js.map +1 -0
  24. package/dist/_shared/{startup-0-1-7T2IAE7J.js → startup-0-1-M6OWAYHH.js} +540 -136
  25. package/dist/_shared/startup-0-1-M6OWAYHH.js.map +1 -0
  26. package/dist/_shared/startup-0-2-5QHPCEON.js +47 -48
  27. package/dist/_shared/startup-0-2-5QHPCEON.js.map +1 -1
  28. package/dist/_shared/startup-0-3-4ZYBYQNM.js +5 -5
  29. package/dist/_shared/startup-0-4-ZMJV547D.js +12 -7
  30. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -1
  31. package/dist/_shared/startup-0-5-YDW47QX6.js +7 -7
  32. package/dist/_shared/startup-0-5-YDW47QX6.js.map +1 -1
  33. package/dist/_shared/startup-10-0-TDQNBDDL.js +6 -6
  34. package/dist/_shared/startup-12-0-55AAXBJZ.js +2 -2
  35. package/dist/_shared/startup-14-0-MLX36RBG.js +4 -5
  36. package/dist/_shared/startup-14-0-MLX36RBG.js.map +1 -1
  37. package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
  38. package/dist/_shared/startup-15-1-4S7FLMNG.js +19 -27
  39. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  40. package/dist/_shared/startup-8-0-34CBHPZH.js +2144 -249
  41. package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
  42. package/dist/_shared/{startup-8-1-X32CYSXB.js → startup-8-1-LZFXSD3Z.js} +98 -1184
  43. package/dist/_shared/startup-8-1-LZFXSD3Z.js.map +1 -0
  44. package/dist/_shared/storage-command-7MGXLJGZ.js +188 -37
  45. package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
  46. package/dist/_shared/storage-status-K7PX2RXA.js +557 -0
  47. package/dist/_shared/storage-status-K7PX2RXA.js.map +1 -0
  48. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  49. package/dist/_shared/team-DOQKICG2.js +376 -0
  50. package/dist/_shared/team-DOQKICG2.js.map +1 -0
  51. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  52. package/dist/builtin/intercom/CHANGELOG.md +42 -0
  53. package/dist/builtin/intercom/README.md +2 -2
  54. package/dist/builtin/intercom/broker/broker.bundle.mjs +1917 -381
  55. package/dist/builtin/intercom/broker/client.ts +8 -0
  56. package/dist/builtin/intercom/broker/database-wake-up-bus.ts +324 -68
  57. package/dist/builtin/intercom/broker/multinode-router.ts +256 -39
  58. package/dist/builtin/intercom/broker/multinode-state-store.ts +71 -5
  59. package/dist/builtin/intercom/broker/open-broker-state.ts +14 -0
  60. package/dist/builtin/intercom/broker/send-order-gate.ts +5 -2
  61. package/dist/builtin/intercom/broker/sql-add-column.ts +50 -5
  62. package/dist/builtin/intercom/broker/sql-ended-child-queue-store.ts +3 -2
  63. package/dist/builtin/intercom/broker/sql-held-send-store.ts +2 -2
  64. package/dist/builtin/intercom/broker/sql-known-session-store.ts +43 -19
  65. package/dist/builtin/intercom/broker/sql-lease-store.ts +473 -121
  66. package/dist/builtin/intercom/broker/sql-outbox-store.ts +821 -79
  67. package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +8 -5
  68. package/dist/builtin/intercom/broker/sql-released-ask-store.ts +12 -5
  69. package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +256 -8
  70. package/dist/builtin/intercom/broker/sql-retention.ts +150 -0
  71. package/dist/builtin/intercom/broker/sql-schema.ts +175 -24
  72. package/dist/builtin/intercom/broker/sql-sent-message-authority.ts +74 -19
  73. package/dist/builtin/intercom/broker/wake-up-bus.ts +6 -0
  74. package/dist/builtin/intercom/index.bundle.mjs +14 -4
  75. package/dist/builtin/intercom/package.json +1 -1
  76. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  77. package/dist/builtin/mcp/package.json +1 -1
  78. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  79. package/dist/builtin/subagents/package.json +1 -1
  80. package/dist/builtin/subagents/skills/skill-creator/eval-viewer/generate_review.py +8 -1
  81. package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
  82. package/dist/builtin/web-access/index.bundle.mjs +2 -10
  83. package/dist/builtin/web-access/package.json +1 -1
  84. package/dist/bun/bundled-sqlite.js +41 -0
  85. package/dist/bun/bundled-sqlite.js.map +1 -0
  86. package/dist/cli/args.js +2 -2
  87. package/dist/cli/auth-cli.code.js +4 -4
  88. package/dist/cli/auth-cli.impl.js +3 -3
  89. package/dist/cli/auth-cli.js +3 -3
  90. package/dist/cli/blueprint-command.code.js +3 -3
  91. package/dist/cli/blueprint-command.impl.js +3 -3
  92. package/dist/cli/blueprint-command.js +3 -3
  93. package/dist/cli/intercom-command.code.js +3 -3
  94. package/dist/cli/intercom-command.code.js.map +1 -1
  95. package/dist/cli/intercom-command.impl.js +3 -3
  96. package/dist/cli/intercom-command.js +3 -3
  97. package/dist/cli/list-models.code.js +2 -2
  98. package/dist/cli/list-models.impl.js +3 -3
  99. package/dist/cli/list-models.js +3 -3
  100. package/dist/cli/session-picker.code.js +1 -1
  101. package/dist/cli/session-picker.impl.js +3 -3
  102. package/dist/cli/session-picker.js +3 -3
  103. package/dist/cli/startup-ui.code.js +1 -1
  104. package/dist/cli/startup-ui.impl.js +3 -3
  105. package/dist/cli/startup-ui.js +3 -3
  106. package/dist/cli/storage-command.impl.js +3 -3
  107. package/dist/cli/storage-command.js +3 -3
  108. package/dist/cli/storage-search-session.code.js +3 -3
  109. package/dist/cli/storage-search-session.impl.js +3 -3
  110. package/dist/cli/storage-search-session.js +3 -3
  111. package/dist/cli/team-command.code.js +19 -113
  112. package/dist/cli/team-command.code.js.map +1 -1
  113. package/dist/cli/team-command.impl.js +3 -3
  114. package/dist/cli/team-command.js +3 -3
  115. package/dist/cli.js +5 -18
  116. package/dist/cli.js.map +1 -1
  117. package/dist/core/agent-rehydrate-errors.d.ts +4 -9
  118. package/dist/core/compaction/compactor.d.ts +3 -3
  119. package/dist/core/debug.code.js +1 -1
  120. package/dist/core/debug.impl.js +3 -3
  121. package/dist/core/debug.js +3 -3
  122. package/dist/core/export-html/card-projection.impl.js +3 -3
  123. package/dist/core/export-html/card-projection.js +3 -3
  124. package/dist/core/export-html/index.code.js +4 -4
  125. package/dist/core/export-html/index.code.js.map +1 -1
  126. package/dist/core/export-html/index.impl.js +3 -3
  127. package/dist/core/export-html/index.js +3 -3
  128. package/dist/core/export-html/json-spans.impl.js +3 -3
  129. package/dist/core/export-html/json-spans.js +3 -3
  130. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  131. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  132. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  133. package/dist/core/export-html/tool-renderer.js +3 -3
  134. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  135. package/dist/core/extensions/jiti-loader.js +3 -3
  136. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  137. package/dist/core/extensions/jiti-static-loader.js +3 -3
  138. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  139. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  140. package/dist/core/extensions/loader-host-modules.js +3 -3
  141. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  142. package/dist/core/extensions/runner-context.js +2 -2
  143. package/dist/core/intercom-broker-control-host.code.js +2 -2
  144. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  145. package/dist/core/intercom-broker-control-host.js +3 -3
  146. package/dist/core/intercom-broker-control.code.js +3 -3
  147. package/dist/core/intercom-broker-control.impl.js +3 -3
  148. package/dist/core/intercom-broker-control.js +3 -3
  149. package/dist/core/package-manager-storage-adapters.code.js +1 -1
  150. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  151. package/dist/core/package-manager-storage-adapters.js +3 -3
  152. package/dist/core/process-start-token.d.ts +12 -3
  153. package/dist/core/process-tree-containment.d.ts +16 -0
  154. package/dist/core/sdk-types.d.ts +1 -2
  155. package/dist/core/sdk-types.js.map +1 -1
  156. package/dist/core/sdk.code.js +3 -3
  157. package/dist/core/sdk.impl.js +3 -3
  158. package/dist/core/sdk.js +3 -3
  159. package/dist/core/session-manager-core.js +5 -5
  160. package/dist/core/session-manager-list.impl.js +3 -3
  161. package/dist/core/session-manager-list.js +3 -3
  162. package/dist/core/session-manager.code.js +1 -1
  163. package/dist/core/session-manager.impl.js +3 -3
  164. package/dist/core/session-manager.js +3 -3
  165. package/dist/core/session-storage.code.js +1 -1
  166. package/dist/core/session-storage.impl.js +3 -3
  167. package/dist/core/session-storage.js +3 -3
  168. package/dist/core/settings-schema.d.ts +0 -3
  169. package/dist/core/storage/added-exports-0-10-11.js +19 -0
  170. package/dist/core/storage/added-exports-0-10-11.js.map +1 -0
  171. package/dist/core/storage/creation-time.js +105 -0
  172. package/dist/core/storage/creation-time.js.map +1 -0
  173. package/dist/core/storage/database.d.ts +25 -5
  174. package/dist/core/storage/database.js.map +1 -1
  175. package/dist/core/storage/dialect.d.ts +1 -1
  176. package/dist/core/storage/dialect.js +1 -1
  177. package/dist/core/storage/dialect.js.map +1 -1
  178. package/dist/core/storage/errors.d.ts +13 -13
  179. package/dist/core/storage/errors.js +10 -16
  180. package/dist/core/storage/errors.js.map +1 -1
  181. package/dist/core/storage/fenced-paths.d.ts +18 -6
  182. package/dist/core/storage/fenced-paths.js +18 -6
  183. package/dist/core/storage/fenced-paths.js.map +1 -1
  184. package/dist/core/storage/file-identity.d.ts +2 -0
  185. package/dist/core/storage/file-identity.js +24 -8
  186. package/dist/core/storage/file-identity.js.map +1 -1
  187. package/dist/core/storage/index.d.ts +3 -2
  188. package/dist/core/storage/index.js +5 -3
  189. package/dist/core/storage/index.js.map +1 -1
  190. package/dist/core/storage/libsql-removed.d.ts +71 -0
  191. package/dist/core/storage/libsql-removed.js +123 -0
  192. package/dist/core/storage/libsql-removed.js.map +1 -0
  193. package/dist/core/storage/migrations.d.ts +78 -14
  194. package/dist/core/storage/migrations.js +375 -49
  195. package/dist/core/storage/migrations.js.map +1 -1
  196. package/dist/core/storage/node-sqlite-file-gate.js +0 -15
  197. package/dist/core/storage/node-sqlite-file-gate.js.map +1 -1
  198. package/dist/core/storage/node-sqlite-thread.js +215 -30
  199. package/dist/core/storage/node-sqlite-thread.js.map +1 -1
  200. package/dist/core/storage/node-sqlite.js +484 -72
  201. package/dist/core/storage/node-sqlite.js.map +1 -1
  202. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  203. package/dist/core/storage/offline-snapshot-file.js +3 -3
  204. package/dist/core/storage/prefix.d.ts +1 -1
  205. package/dist/core/storage/prefix.js +9 -2
  206. package/dist/core/storage/prefix.js.map +1 -1
  207. package/dist/core/storage/process-selection.d.ts +5 -5
  208. package/dist/core/storage/provider.js +2 -2
  209. package/dist/core/storage/schema-catalog.d.ts +76 -15
  210. package/dist/core/storage/schema-catalog.js +359 -68
  211. package/dist/core/storage/schema-catalog.js.map +1 -1
  212. package/dist/core/storage/selection.d.ts +7 -82
  213. package/dist/core/storage/selection.js +20 -235
  214. package/dist/core/storage/selection.js.map +1 -1
  215. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  216. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  217. package/dist/core/storage/session/branch-fork-source.js +3 -3
  218. package/dist/core/storage/session/card-view.impl.js +3 -3
  219. package/dist/core/storage/session/card-view.js +3 -3
  220. package/dist/core/storage/session/child-reader.code.js +3 -3
  221. package/dist/core/storage/session/child-reader.impl.js +3 -3
  222. package/dist/core/storage/session/child-reader.js +3 -3
  223. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  224. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  225. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  226. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  227. package/dist/core/storage/session/expanded-child-details.js +3 -3
  228. package/dist/core/storage/session/fork-detach.d.ts +11 -1
  229. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  230. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  231. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  232. package/dist/core/storage/session/fork-row-index.js +3 -3
  233. package/dist/core/storage/session/fork-staging.code.js +4 -7
  234. package/dist/core/storage/session/fork-staging.code.js.map +1 -1
  235. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  236. package/dist/core/storage/session/fork-staging.js +3 -3
  237. package/dist/core/storage/session/fork-sweep.js +31 -7
  238. package/dist/core/storage/session/fork-sweep.js.map +1 -1
  239. package/dist/core/storage/session/fork-window.code.js +3 -3
  240. package/dist/core/storage/session/fork-window.impl.js +3 -3
  241. package/dist/core/storage/session/fork-window.js +3 -3
  242. package/dist/core/storage/session/history-pages.impl.js +3 -3
  243. package/dist/core/storage/session/history-pages.js +3 -3
  244. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  245. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  246. package/dist/core/storage/session/jsonl-session-lock.d.ts +100 -0
  247. package/dist/core/storage/session/jsonl-session-store.d.ts +46 -24
  248. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  249. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  250. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  251. package/dist/core/storage/session/memory-session-store.js +3 -3
  252. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  253. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  254. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  255. package/dist/core/storage/session/released-history-files.code.js +9 -9
  256. package/dist/core/storage/session/released-history-files.code.js.map +1 -1
  257. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  258. package/dist/core/storage/session/released-history-files.js +3 -3
  259. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  260. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  261. package/dist/core/storage/session/session-resume.impl.js +3 -3
  262. package/dist/core/storage/session/session-resume.js +3 -3
  263. package/dist/core/storage/session/session-search-index.d.ts +52 -5
  264. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  265. package/dist/core/storage/session/snapshot-cut.js +3 -3
  266. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  267. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  268. package/dist/core/storage/session/snapshot-history.js +3 -3
  269. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  270. package/dist/core/storage/session/sql-session-store.d.ts +99 -18
  271. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  272. package/dist/core/storage/session/sql-session-store.js +3 -3
  273. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  274. package/dist/core/storage/session/tree-outline.js +3 -3
  275. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  276. package/dist/core/storage/session/tree-presentation.js +3 -3
  277. package/dist/core/storage/sqlite-facade.d.ts +12 -1
  278. package/dist/core/storage/sqlite-facade.js +310 -33
  279. package/dist/core/storage/sqlite-facade.js.map +1 -1
  280. package/dist/core/storage/sqlite-open-batch.js +10 -0
  281. package/dist/core/storage/sqlite-open-batch.js.map +1 -0
  282. package/dist/core/storage/storage-status.code.js +1 -1
  283. package/dist/core/storage/storage-status.impl.js +3 -3
  284. package/dist/core/storage/storage-status.js +3 -3
  285. package/dist/core/storage/team.code.js +1 -1
  286. package/dist/core/storage/team.d.ts +26 -115
  287. package/dist/core/storage/team.impl.js +3 -3
  288. package/dist/core/storage/team.js +3 -3
  289. package/dist/core/structured-output/index.code.js +1 -1
  290. package/dist/core/structured-output/index.impl.js +3 -3
  291. package/dist/core/structured-output/index.js +3 -3
  292. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  293. package/dist/core/tasks/task-completion-entry.js +3 -3
  294. package/dist/core/tasks/task-file-history.code.js +3 -3
  295. package/dist/core/tasks/task-file-history.impl.js +3 -3
  296. package/dist/core/tasks/task-file-history.js +3 -3
  297. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  298. package/dist/core/tasks/task-reference-archive.js +3 -3
  299. package/dist/core/tasks/task-reference-identity.js +3 -3
  300. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  301. package/dist/core/tasks/task-reference-stream.js +3 -3
  302. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  303. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  304. package/dist/core/tasks/task-view-source.code.js +1 -1
  305. package/dist/core/tasks/task-view-source.impl.js +3 -3
  306. package/dist/core/tasks/task-view-source.js +3 -3
  307. package/dist/core/tools/history-tasks.d.ts +3 -2
  308. package/dist/core/tools/read-url.code.js +4 -4
  309. package/dist/core/tools/read-url.impl.js +3 -3
  310. package/dist/core/tools/read-url.js +3 -3
  311. package/dist/core/worktree-snapshot/blob-store.d.ts +44 -5
  312. package/dist/core/worktree-snapshot/blob-store.js +553 -30
  313. package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
  314. package/dist/core/worktree-snapshot/errors.code.js +2 -2
  315. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  316. package/dist/core/worktree-snapshot/errors.js +3 -3
  317. package/dist/core/worktree-snapshot/fork-blob-guard.js +81 -0
  318. package/dist/core/worktree-snapshot/fork-blob-guard.js.map +1 -0
  319. package/dist/core/worktree-snapshot/fork-snapshot-index.js +208 -50
  320. package/dist/core/worktree-snapshot/fork-snapshot-index.js.map +1 -1
  321. package/dist/core/worktree-snapshot/session-index-reset.code.js +4 -0
  322. package/dist/core/worktree-snapshot/session-index-reset.code.js.map +1 -1
  323. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  324. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  325. package/dist/extensions/codemode/execute.code.js +1 -1
  326. package/dist/extensions/codemode/execute.impl.js +3 -3
  327. package/dist/extensions/codemode/execute.js +3 -3
  328. package/dist/extensions/codemode/renderer.code.js +2 -2
  329. package/dist/extensions/codemode/renderer.impl.js +3 -3
  330. package/dist/extensions/codemode/renderer.js +3 -3
  331. package/dist/extensions/mcp/cli.code.js +3 -3
  332. package/dist/extensions/mcp/cli.impl.js +3 -3
  333. package/dist/extensions/mcp/cli.js +3 -3
  334. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  335. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  336. package/dist/extensions/mcp/cli.lazy.js +3 -3
  337. package/dist/extensions/mcp/runtime.code.js +1 -1
  338. package/dist/extensions/mcp/runtime.impl.js +3 -3
  339. package/dist/extensions/mcp/runtime.js +3 -3
  340. package/dist/index.d.ts +3 -1
  341. package/dist/index.js +5 -5
  342. package/dist/main-first-time-setup.code.js +1 -1
  343. package/dist/main-first-time-setup.impl.js +3 -3
  344. package/dist/main-first-time-setup.js +3 -3
  345. package/dist/main.js +1 -1
  346. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  347. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  348. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  349. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  350. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  351. package/dist/modes/interactive/startup-shell-eligibility.js +1 -1
  352. package/dist/modes/interactive-engine/engine-prewarm.d.ts +1 -1
  353. package/dist/modes/print-mode.js +1 -1
  354. package/dist/package-manager-cli.code.js +6 -6
  355. package/dist/package-manager-cli.impl.js +3 -3
  356. package/dist/package-manager-cli.js +3 -3
  357. package/dist/rpc-entry.js +1 -1
  358. package/dist/startup-files.json +1 -1
  359. package/dist/startup-stages/10.js +1 -1
  360. package/dist/startup-stages/11.js +1 -1
  361. package/dist/startup-stages/12.js +1 -1
  362. package/dist/startup-stages/2.js +2 -4
  363. package/dist/startup-stages/3.js +1 -3
  364. package/dist/startup-stages/4.js +1 -2
  365. package/dist/startup-stages/5.js +1 -1
  366. package/dist/startup-stages/6.js +5 -7
  367. package/dist/startup-stages/7.js +3 -10
  368. package/dist/startup-stages/8.js +7 -2
  369. package/dist/startup-stages/9.js +1 -7
  370. package/dist/startup-stages/stages.json +1 -1
  371. package/dist/utils/compile-cache-deferral.js +8 -13
  372. package/dist/utils/compile-cache-deferral.js.map +1 -1
  373. package/dist/utils/compile-cache-warmup-host.js +3 -4
  374. package/dist/utils/compile-cache-warmup-host.js.map +1 -1
  375. package/dist/utils/compile-cache.js +12 -100
  376. package/dist/utils/compile-cache.js.map +1 -1
  377. package/dist/utils/startup-database-spare.code.js +2 -2
  378. package/dist/utils/startup-database-spare.impl.js +3 -3
  379. package/dist/utils/startup-database-spare.js +3 -3
  380. package/dist/utils/tools-manager.code.js +1 -1
  381. package/dist/utils/tools-manager.impl.js +3 -3
  382. package/dist/utils/tools-manager.js +3 -3
  383. package/dist/utils/worker-threads.js +2 -15
  384. package/dist/utils/worker-threads.js.map +1 -1
  385. package/docs/build.md +3 -3
  386. package/docs/changelog.mdx +1470 -69
  387. package/docs/compaction/reference.md +5 -5
  388. package/docs/compaction.md +7 -9
  389. package/docs/containerization.md +2 -2
  390. package/docs/custom-provider/api-reference.md +1 -1
  391. package/docs/docs.json +37 -10
  392. package/docs/environment-variables.md +0 -2
  393. package/docs/extensions/api-reference.md +4 -4
  394. package/docs/getting-started/installation.md +3 -0
  395. package/docs/guides/configuration.md +1 -1
  396. package/docs/guides/non-interactive.md +1 -1
  397. package/docs/guides/resume-on-any-machine.md +14 -22
  398. package/docs/guides/team-setup.md +56 -83
  399. package/docs/guides.md +2 -4
  400. package/docs/herdr.md +1 -1
  401. package/docs/index.md +1 -1
  402. package/docs/intercom/operations.md +26 -21
  403. package/docs/intercom/reference.md +2 -2
  404. package/docs/intercom.md +1 -1
  405. package/docs/libraries/storage-postgres.md +9 -9
  406. package/docs/libraries.md +2 -3
  407. package/docs/models-configuration.md +2 -2
  408. package/docs/models.md +2 -3
  409. package/docs/packages/authoring.md +7 -7
  410. package/docs/packages.md +1 -1
  411. package/docs/programmatic.md +2 -2
  412. package/docs/quickstart.md +1 -1
  413. package/docs/reference/cli.md +6 -11
  414. package/docs/reference.md +2 -2
  415. package/docs/rpc/extension-ui.md +2 -2
  416. package/docs/sdk/reference.md +5 -4
  417. package/docs/sdk/storage.md +8 -92
  418. package/docs/sdk/structured-decisions.md +1 -1
  419. package/docs/sdk/web-server.md +3 -3
  420. package/docs/sdk.md +14 -4
  421. package/docs/security.md +1 -1
  422. package/docs/session-format.md +5 -5
  423. package/docs/sessions.md +29 -49
  424. package/docs/settings.md +7 -8
  425. package/docs/storage/custom-adapters.md +255 -0
  426. package/docs/storage/jsonl.md +117 -0
  427. package/docs/{guides/postgres-pgbouncer.md → storage/postgres/pgbouncer.md} +66 -68
  428. package/docs/storage/postgres/tuning.md +337 -0
  429. package/docs/storage/postgres.md +556 -0
  430. package/docs/storage/sqlite.md +99 -0
  431. package/docs/storage.md +326 -990
  432. package/docs/subagents/authoring.md +1 -1
  433. package/docs/subagents.md +2 -2
  434. package/docs/tools.md +1 -1
  435. package/docs/worktree-snapshots.md +2 -2
  436. package/package.json +9 -9
  437. package/schemas/models.schema.json +2 -2
  438. package/schemas/settings.schema.json +0 -14
  439. package/dist/_shared/p1b-elig-ENCUPKKJ.js.map +0 -1
  440. package/dist/_shared/sdk-IQMULKFU.js.map +0 -1
  441. package/dist/_shared/startup-0-0-3IXNMFM2.js.map +0 -1
  442. package/dist/_shared/startup-0-1-7T2IAE7J.js.map +0 -1
  443. package/dist/_shared/startup-8-1-X32CYSXB.js.map +0 -1
  444. package/dist/core/intercom-broker-control.d.ts +0 -129
  445. package/dist/startup-stages/13.js +0 -1
  446. package/docs/guides/postgres-tuning.md +0 -311
  447. package/docs/libraries/storage-libsql.md +0 -97
@@ -1 +1 @@
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,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAQzE,MAAM,eAAe,GAAoB,UAAU,CAAC;AAEpD,yGAAyG;AACz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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,CAAC,YAAY,IAAI,KAAK,CAAC,WAAW;QAAE,OAAO,QAAQ,CAAC;IAC3F,IAAI,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,aAAa;QAAE,OAAO,QAAQ,CAAC;IAC1G,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;AAC1C,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,wBAAwB,CAAC,GAAsB;IAC9D,OAAO,CAAC,SAAS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AAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACzE,MAAM,OAAO,GAAG,mBAAmB,CAAC,GAAG,OAAO,IAAI,CAAC,GAAG,KAAK,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;QAClF,MAAM,IAAI,GAAG,qBAAqB,CAAC;YAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,YAAY;YACZ,WAAW;YACX,cAAc;YACd,QAAQ;YACR,WAAW,EAAE,OAAO,CAAC,WAAW,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;YACxE,aAAa,EAAE,OAAO,KAAK,SAAS;YACpC,IAAI,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC;SAC9D,CAAC,CAAC;QACH,IAAI,IAAI,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 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-7T2IAE7J.js";
4
+ import { parseArgs } from "../_shared/startup-0-1-M6OWAYHH.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
7
  import { previewProcessStorageSelection, previewSessionSettingSelection } from "../_shared/startup-0-2-5QHPCEON.js";
8
- import { parsePackageCommand } from "../_shared/startup-0-0-3IXNMFM2.js";
8
+ import { parsePackageCommand } from "../_shared/startup-0-0-XJJDOIEC.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.2`;
9
+ const key = `${root.href}#0.10.11-alpha.4`;
10
10
  let release = releases.get(key);
11
11
  if (release === undefined) {
12
12
  const current = (async () => {
@@ -27,8 +27,8 @@ try {
27
27
  release = current;
28
28
  }
29
29
  const running = await release;
30
- if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 while this session was running; restart it to keep using this feature.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.4") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.4 while this session was running; restart it to keep using 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.2`;
9
+ const key = `${root.href}#0.10.11-alpha.4`;
10
10
  let release = releases.get(key);
11
11
  if (release === undefined) {
12
12
  const current = (async () => {
@@ -27,8 +27,8 @@ try {
27
27
  release = current;
28
28
  }
29
29
  const running = await release;
30
- if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 while this session was running; restart it to keep using this feature.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.4") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.4 while this session was running; restart it to keep using this feature.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -1,3 +1,3 @@
1
1
  import "../_shared/rolldown-runtime-BGM3D5V3.js";
2
- export { GIT_RELEASE, detectLinuxLibc, ensureTool, getGitDistributionTarget, getGitInstallDir, getGitReleaseMarker, getGitShellEnvironment, getGitShellEnvironmentAsync, getGitStatus, getGitStatusAsync, getLatestVersion, getToolEnv, getToolPath, parseGitVersion, plainStatMtimeMs, resetGitProvisionStateForTest, resolveGit, resolveGitSync, resolveInstalledGit, withGitProvisionSettingsForTest } from "../_shared/startup-0-1-7T2IAE7J.js";
2
+ export { GIT_RELEASE, detectLinuxLibc, ensureTool, getGitDistributionTarget, getGitInstallDir, getGitReleaseMarker, getGitShellEnvironment, getGitShellEnvironmentAsync, getGitStatus, getGitStatusAsync, getLatestVersion, getToolEnv, getToolPath, parseGitVersion, plainStatMtimeMs, resetGitProvisionStateForTest, resolveGit, resolveGitSync, resolveInstalledGit, withGitProvisionSettingsForTest } from "../_shared/startup-0-1-M6OWAYHH.js";
3
3
  //# sourceMappingURL=tools-manager.code.js.map
@@ -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.2`;
9
+ const key = `${root.href}#0.10.11-alpha.4`;
10
10
  let release = releases.get(key);
11
11
  if (release === undefined) {
12
12
  const current = (async () => {
@@ -27,8 +27,8 @@ try {
27
27
  release = current;
28
28
  }
29
29
  const running = await release;
30
- if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 while this session was running; restart it to keep using this feature.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.4") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.4 while this session was running; restart it to keep using 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.2`;
9
+ const key = `${root.href}#0.10.11-alpha.4`;
10
10
  let release = releases.get(key);
11
11
  if (release === undefined) {
12
12
  const current = (async () => {
@@ -27,8 +27,8 @@ try {
27
27
  release = current;
28
28
  }
29
29
  const running = await release;
30
- if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 while this session was running; restart it to keep using this feature.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.4") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.4 while this session was running; restart it to keep using this feature.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -18,18 +18,6 @@ export function evalWorkerExecArgv() {
18
18
  * as under the permission model (#6110). Elsewhere `builtin` is that `require`.
19
19
  */
20
20
  export const EVAL_WORKER_BUILTIN = 'const builtin = typeof require === "function" ? require : (id) => process.getBuiltinModule(id);';
21
- const ENGINE_WORKER_HEAP_MB_SYMBOL = Symbol.for("atomic.engine-worker-heap-mb.v1");
22
- function withInheritedEngineHeapLimit(options) {
23
- if (options.resourceLimits?.maxOldGenerationSizeMb !== undefined)
24
- return options;
25
- const heapMb = globalThis[ENGINE_WORKER_HEAP_MB_SYMBOL];
26
- if (typeof heapMb !== "number" || !Number.isSafeInteger(heapMb) || heapMb <= 0)
27
- return options;
28
- return {
29
- ...options,
30
- resourceLimits: { ...options.resourceLimits, maxOldGenerationSizeMb: heapMb },
31
- };
32
- }
33
21
  /**
34
22
  * Starts a worker thread that runs Atomic's own ES module at `url` with the process's flags, which can include the
35
23
  * loaders the module needs. Node refuses `--input-type` for an ES module given as a worker's entry, and a worker
@@ -37,9 +25,8 @@ function withInheritedEngineHeapLimit(options) {
37
25
  * module from evaluated source instead (#6079).
38
26
  */
39
27
  export function startModuleWorker(url, options = {}) {
40
- const resolved = withInheritedEngineHeapLimit(options);
41
28
  if (!startedWithInputType())
42
- return new Worker(url, resolved);
43
- return new Worker(`import(${JSON.stringify(url.href)});`, { ...resolved, eval: true });
29
+ return new Worker(url, options);
30
+ return new Worker(`import(${JSON.stringify(url.href)});`, { ...options, eval: true });
44
31
  }
45
32
  //# sourceMappingURL=worker-threads.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker-threads.js","sourceRoot":"","sources":["../../src/utils/worker-threads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB;IACjC,OAAO,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAC/B,iGAAiG,CAAC;AAEnG,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;AAEnF,SAAS,4BAA4B,CAAC,OAAsB;IAC3D,IAAI,OAAO,CAAC,cAAc,EAAE,sBAAsB,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IACjF,MAAM,MAAM,GAAI,UAAsC,CAAC,4BAA4B,CAAC,CAAC;IACrF,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC;IAC/F,OAAO;QACN,GAAG,OAAO;QACV,cAAc,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,sBAAsB,EAAE,MAAM,EAAE;KAC7E,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAQ,EAAE,OAAO,GAAkB,EAAE;IACtE,MAAM,QAAQ,GAAG,4BAA4B,CAAC,OAAO,CAAC,CAAC;IACvD,IAAI,CAAC,oBAAoB,EAAE;QAAE,OAAO,IAAI,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC9D,OAAO,IAAI,MAAM,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import { Worker, type WorkerOptions } from \"node:worker_threads\";\nimport { startedWithInputType } from \"@bastani/atomic-codemode/node-options\";\n\n/**\n * The `execArgv` for a worker thread that evaluates Atomic's own source (`new Worker(source, { eval: true })`).\n *\n * None of the process's command-line flags: the host's `--import`/`--require` preloads would run again in every worker,\n * and its `--input-type=module` would make the source a module (#6079). Under Node's permission model a worker is restricted only by the flags it starts with, so there it keeps the\n * process's flags (`undefined` inherits them) and stays as restricted as the process.\n */\nexport function evalWorkerExecArgv(): string[] | undefined {\n\treturn process.permission === undefined ? [] : undefined;\n}\n\n/**\n * The first line of a worker's evaluated source, which then loads Node's built-in modules with `builtin(id)` instead of\n * `require(id)`. Node evaluates the source as an ES module, which has no `require`, when `--input-type=module` reaches\n * the worker: from `NODE_OPTIONS`, which Node parses again, as it holds then, for a worker given its own `execArgv` (as\n * these workers are), or from the options the process started with, which a worker started without `execArgv` keeps,\n * as under the permission model (#6110). Elsewhere `builtin` is that `require`.\n */\nexport const EVAL_WORKER_BUILTIN =\n\t'const builtin = typeof require === \"function\" ? require : (id) => process.getBuiltinModule(id);';\n\nconst ENGINE_WORKER_HEAP_MB_SYMBOL = Symbol.for(\"atomic.engine-worker-heap-mb.v1\");\n\nfunction withInheritedEngineHeapLimit(options: WorkerOptions): WorkerOptions {\n\tif (options.resourceLimits?.maxOldGenerationSizeMb !== undefined) return options;\n\tconst heapMb = (globalThis as Record<symbol, unknown>)[ENGINE_WORKER_HEAP_MB_SYMBOL];\n\tif (typeof heapMb !== \"number\" || !Number.isSafeInteger(heapMb) || heapMb <= 0) return options;\n\treturn {\n\t\t...options,\n\t\tresourceLimits: { ...options.resourceLimits, maxOldGenerationSizeMb: heapMb },\n\t};\n}\n\n/**\n * Starts a worker thread that runs Atomic's own ES module at `url` with the process's flags, which can include the\n * loaders the module needs. Node refuses `--input-type` for an ES module given as a worker's entry, and a worker\n * inherits it from a process started with it (`node --input-type=module --eval ...`), so there the worker imports the\n * module from evaluated source instead (#6079).\n */\nexport function startModuleWorker(url: URL, options: WorkerOptions = {}): Worker {\n\tconst resolved = withInheritedEngineHeapLimit(options);\n\tif (!startedWithInputType()) return new Worker(url, resolved);\n\treturn new Worker(`import(${JSON.stringify(url.href)});`, { ...resolved, eval: true });\n}\n"]}
1
+ {"version":3,"file":"worker-threads.js","sourceRoot":"","sources":["../../src/utils/worker-threads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB;IACjC,OAAO,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAC/B,iGAAiG,CAAC;AAEnG;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAQ,EAAE,OAAO,GAAkB,EAAE;IACtE,IAAI,CAAC,oBAAoB,EAAE;QAAE,OAAO,IAAI,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC7D,OAAO,IAAI,MAAM,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACvF,CAAC","sourcesContent":["import { Worker, type WorkerOptions } from \"node:worker_threads\";\nimport { startedWithInputType } from \"@bastani/atomic-codemode/node-options\";\n\n/**\n * The `execArgv` for a worker thread that evaluates Atomic's own source (`new Worker(source, { eval: true })`).\n *\n * None of the process's command-line flags: the host's `--import`/`--require` preloads would run again in every worker,\n * and its `--input-type=module` would make the source a module (#6079). Under Node's permission model a worker is restricted only by the flags it starts with, so there it keeps the\n * process's flags (`undefined` inherits them) and stays as restricted as the process.\n */\nexport function evalWorkerExecArgv(): string[] | undefined {\n\treturn process.permission === undefined ? [] : undefined;\n}\n\n/**\n * The first line of a worker's evaluated source, which then loads Node's built-in modules with `builtin(id)` instead of\n * `require(id)`. Node evaluates the source as an ES module, which has no `require`, when `--input-type=module` reaches\n * the worker: from `NODE_OPTIONS`, which Node parses again, as it holds then, for a worker given its own `execArgv` (as\n * these workers are), or from the options the process started with, which a worker started without `execArgv` keeps,\n * as under the permission model (#6110). Elsewhere `builtin` is that `require`.\n */\nexport const EVAL_WORKER_BUILTIN =\n\t'const builtin = typeof require === \"function\" ? require : (id) => process.getBuiltinModule(id);';\n\n/**\n * Starts a worker thread that runs Atomic's own ES module at `url` with the process's flags, which can include the\n * loaders the module needs. Node refuses `--input-type` for an ES module given as a worker's entry, and a worker\n * inherits it from a process started with it (`node --input-type=module --eval ...`), so there the worker imports the\n * module from evaluated source instead (#6079).\n */\nexport function startModuleWorker(url: URL, options: WorkerOptions = {}): Worker {\n\tif (!startedWithInputType()) return new Worker(url, options);\n\treturn new Worker(`import(${JSON.stringify(url.href)});`, { ...options, eval: true });\n}\n"]}
package/docs/build.md CHANGED
@@ -20,7 +20,7 @@ Work down this list and stop at the first mechanism that solves your problem.
20
20
  6. [Orchestration](/orchestration). Use codemode to launch children, check results, and pick up after an interruption.
21
21
  7. [Environment blueprints](/guides/resume-on-any-machine#set-the-environment-up-with-a-blueprint). Define `.atomic/blueprint.yaml` so restored worktrees rebuild dependencies and caches automatically on any machine or CI runner.
22
22
  8. [Extensions](/extensions). Write TypeScript that adds tools, commands, events, and custom UI when nothing lighter fits.
23
- 9. [Atomic packages](/packages). Bundle and distribute your extensions, skills, prompt templates, themes, subagents, MCP servers, or [storage adapters](/storage#adapters-from-atomic-packages).
23
+ 9. [Atomic packages](/packages). Bundle and distribute your extensions, skills, prompt templates, themes, subagents, MCP servers, or [storage adapters](/storage/custom-adapters#adapters-from-atomic-packages).
24
24
 
25
25
  ## Change the model layer
26
26
 
@@ -38,10 +38,10 @@ Work down this list and stop at the first mechanism that solves your problem.
38
38
  [Programmatic modes](/programmatic) compares JSON mode, RPC, and the SDK, and links each one to its protocol or API reference.
39
39
 
40
40
  - [TypeScript SDK](/sdk). Embed Atomic in Node.js applications.
41
- - [SDK storage backends](/sdk/storage). Wire local SQLite, JSONL, in-memory, libSQL/Turso, or PostgreSQL into `createAgentSession()` and `createAgentSessionRuntime()`.
41
+ - [SDK storage backends](/sdk/storage). Wire local SQLite, JSONL, in-memory, or PostgreSQL into `createAgentSession()` and `createAgentSessionRuntime()`.
42
42
  - [Structured decisions](/sdk/structured-decisions). Run typed classifier or chat decisions with `decide()` and `generateStructuredOutput()`.
43
43
  - [Web server guide](/sdk/web-server). Stream agent runs from an HTTP server or Next.js App Router endpoint.
44
44
  - [RPC mode](/rpc). Integrate over stdin and stdout JSONL.
45
45
  - [JSON event stream mode](/json). Run print mode with structured events.
46
46
  - [TUI components](/tui). Build custom terminal UI for extensions.
47
- - [Standalone libraries](/libraries). Use Atomic's six core packages (`ai`, `tui`, `agent-core`, `codemode`, `schema`, `telemetry`) and optional storage adapters ([`@bastani/atomic-storage-postgres`](/libraries/storage-postgres) and [`@bastani/atomic-storage-libsql`](/libraries/storage-libsql)) directly.
47
+ - [Standalone libraries](/libraries). Use Atomic's six core packages (`ai`, `tui`, `agent-core`, `codemode`, `schema`, `telemetry`) and optional storage adapters ([`@bastani/atomic-storage-postgres`](/libraries/storage-postgres)) directly.