@bastani/atomic 0.10.4-alpha.2 → 0.10.5-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (614) hide show
  1. package/CHANGELOG.md +238 -0
  2. package/dist/_shared/chunk-CDOYTDYM.js +4 -0
  3. package/dist/_shared/chunk-CDOYTDYM.js.map +1 -0
  4. package/dist/_shared/compile-cache-warmup-host-RU5L7I7A.js +1 -1
  5. package/dist/_shared/dist-KOELCESV.js +48 -3
  6. package/dist/_shared/fork-row-index-UAUAQRD5.js +47 -2
  7. package/dist/_shared/http-YFAPTIZD.js +16 -4
  8. package/dist/_shared/http-YFAPTIZD.js.map +1 -1
  9. package/dist/_shared/lib-4PES5P4V.js +59 -14
  10. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +1706 -258
  11. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
  12. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +317 -64
  13. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
  14. package/dist/_shared/{mode-shared-HP7GUA7J.js → mode-shared-2QJSCUM6.js} +432 -81
  15. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -0
  16. package/dist/_shared/p0-cli-BB45ZQY6.js +3482 -0
  17. package/dist/_shared/p0-cli-BB45ZQY6.js.map +1 -0
  18. package/dist/_shared/p0-cli-GUFK7TPN.js +2 -2838
  19. package/dist/_shared/p0-cli-GUFK7TPN.js.map +1 -1
  20. package/dist/_shared/{p1a-prewarm-YK3KDTLN.js → p1a-prewarm-UQY3X2UK.js} +270 -73
  21. package/dist/_shared/p1a-prewarm-UQY3X2UK.js.map +1 -0
  22. package/dist/_shared/{p1b-elig-PXQA2FYP.js → p1b-elig-ENCUPKKJ.js} +190 -121
  23. package/dist/_shared/p1b-elig-ENCUPKKJ.js.map +1 -0
  24. package/dist/_shared/p2-common-YLSYXMDQ.js +1 -3
  25. package/dist/_shared/p2-common-YLSYXMDQ.js.map +1 -1
  26. package/dist/_shared/p2-shell-TJBYQMCJ.js +1 -1
  27. package/dist/_shared/p2-shell-main-B2WIALFD.js +500 -127
  28. package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
  29. package/dist/_shared/runtime-O4KCSG4C.js +4 -4
  30. package/dist/_shared/sdk-WQIOHVKO.js +56 -11
  31. package/dist/_shared/session-data-AHTU7IS6.js +48 -3
  32. package/dist/_shared/session-manager-list-2BLEEZVG.js +2 -2
  33. package/dist/_shared/settings-startup-65YEWRV2.js.map +1 -1
  34. package/dist/_shared/sql-session-store-5FD3WBMZ.js +57 -12
  35. package/dist/_shared/{startup-0-0-X4NF3GKM.js → startup-0-0-TYUFUOJZ.js} +528 -321
  36. package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +1 -0
  37. package/dist/_shared/{startup-0-1-7QTG6VJZ.js → startup-0-1-D4LGGINF.js} +284 -81
  38. package/dist/_shared/startup-0-1-D4LGGINF.js.map +1 -0
  39. package/dist/_shared/{startup-0-2-KFDYPDJK.js → startup-0-2-SZGQIWHI.js} +483 -154
  40. package/dist/_shared/startup-0-2-SZGQIWHI.js.map +1 -0
  41. package/dist/_shared/startup-0-3-T4DVFYWX.js +340 -110
  42. package/dist/_shared/startup-0-3-T4DVFYWX.js.map +1 -1
  43. package/dist/_shared/startup-0-4-HN5EB4K7.js +261 -59
  44. package/dist/_shared/startup-0-4-HN5EB4K7.js.map +1 -1
  45. package/dist/_shared/startup-0-5-OHJNE6JH.js +421 -148
  46. package/dist/_shared/startup-0-5-OHJNE6JH.js.map +1 -1
  47. package/dist/_shared/startup-10-0-TDQNBDDL.js +62 -11
  48. package/dist/_shared/startup-10-0-TDQNBDDL.js.map +1 -1
  49. package/dist/_shared/startup-12-0-55AAXBJZ.js +3 -3
  50. package/dist/_shared/startup-14-0-MLX36RBG.js +12 -11
  51. package/dist/_shared/startup-14-0-MLX36RBG.js.map +1 -1
  52. package/dist/_shared/startup-15-0-YUKGAC63.js +53 -158
  53. package/dist/_shared/startup-15-0-YUKGAC63.js.map +1 -1
  54. package/dist/_shared/startup-15-1-4S7FLMNG.js +231 -46
  55. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  56. package/dist/_shared/startup-8-0-34CBHPZH.js +115 -35
  57. package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
  58. package/dist/_shared/{startup-8-1-KQJBDKRU.js → startup-8-1-SJW2GMAM.js} +203 -62
  59. package/dist/_shared/startup-8-1-SJW2GMAM.js.map +1 -0
  60. package/dist/_shared/storage-command-7MGXLJGZ.js +55 -10
  61. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +47 -2
  62. package/dist/_shared/tree-outline-MUEPK5B7.js +48 -3
  63. package/dist/builtin/intercom/CHANGELOG.md +59 -0
  64. package/dist/builtin/intercom/README.md +0 -1
  65. package/dist/builtin/intercom/broker/broker-instance.ts +13 -57
  66. package/dist/builtin/intercom/broker/broker-process.ts +30 -10
  67. package/dist/builtin/intercom/broker/broker-routing.ts +12 -2
  68. package/dist/builtin/intercom/broker/broker.bundle.mjs +2557 -498
  69. package/dist/builtin/intercom/broker/broker.ts +164 -55
  70. package/dist/builtin/intercom/broker/client.ts +36 -16
  71. package/dist/builtin/intercom/broker/control.ts +83 -20
  72. package/dist/builtin/intercom/broker/durable-ended-queue.ts +65 -19
  73. package/dist/builtin/intercom/broker/host-command-environment.ts +7 -2
  74. package/dist/builtin/intercom/broker/multinode-router.ts +1675 -387
  75. package/dist/builtin/intercom/broker/multinode-state-store.ts +10 -0
  76. package/dist/builtin/intercom/broker/paths.ts +68 -6
  77. package/dist/builtin/intercom/broker/pending-send-registry.ts +5 -0
  78. package/dist/builtin/intercom/broker/registration-bounds.ts +38 -0
  79. package/dist/builtin/intercom/broker/retiring-broker-check.ts +178 -0
  80. package/dist/builtin/intercom/broker/return-paths.ts +268 -7
  81. package/dist/builtin/intercom/broker/send-handler.ts +253 -28
  82. package/dist/builtin/intercom/broker/send-order-gate.ts +410 -0
  83. package/dist/builtin/intercom/broker/spawn.ts +950 -202
  84. package/dist/builtin/intercom/broker/sql-lease-store.ts +37 -0
  85. package/dist/builtin/intercom/broker/sql-outbox-store.ts +7 -0
  86. package/dist/builtin/intercom/broker/windows-cwd.ts +546 -0
  87. package/dist/builtin/intercom/index.bundle.mjs +3506 -2328
  88. package/dist/builtin/intercom/package.json +1 -1
  89. package/dist/builtin/intercom/retry-policy.ts +4 -0
  90. package/dist/builtin/intercom/types.ts +2 -0
  91. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  92. package/dist/builtin/mcp/package.json +1 -1
  93. package/dist/builtin/subagents/CHANGELOG.md +46 -0
  94. package/dist/builtin/subagents/package.json +1 -1
  95. package/dist/builtin/subagents/src/extension/index.bundle.mjs +336 -86
  96. package/dist/builtin/web-access/CHANGELOG.md +12 -0
  97. package/dist/builtin/web-access/index.bundle.mjs +23 -38
  98. package/dist/builtin/web-access/package.json +1 -1
  99. package/dist/bun/cli.js +1 -1
  100. package/dist/bun/cli.js.map +1 -1
  101. package/dist/bun/internal-intercom-broker.js +119 -4
  102. package/dist/bun/internal-intercom-broker.js.map +1 -1
  103. package/dist/bun/register-theme-validator.js +6 -0
  104. package/dist/bun/register-theme-validator.js.map +1 -0
  105. package/dist/cli/args.js +2 -2
  106. package/dist/cli/auth-cli.code.js +1102 -0
  107. package/dist/cli/auth-cli.code.js.map +1 -0
  108. package/dist/cli/auth-cli.impl.js +36 -0
  109. package/dist/cli/auth-cli.impl.js.map +1 -0
  110. package/dist/cli/auth-cli.js +30 -1096
  111. package/dist/cli/auth-cli.js.map +1 -1
  112. package/dist/cli/blueprint-command.code.js +906 -0
  113. package/dist/cli/blueprint-command.code.js.map +1 -0
  114. package/dist/cli/blueprint-command.impl.js +36 -0
  115. package/dist/cli/blueprint-command.impl.js.map +1 -0
  116. package/dist/cli/blueprint-command.js +30 -900
  117. package/dist/cli/blueprint-command.js.map +1 -1
  118. package/dist/cli/intercom-command.code.js +153 -0
  119. package/dist/cli/intercom-command.code.js.map +1 -0
  120. package/dist/cli/intercom-command.impl.js +36 -0
  121. package/dist/cli/intercom-command.impl.js.map +1 -0
  122. package/dist/cli/intercom-command.js +33 -105
  123. package/dist/cli/intercom-command.js.map +1 -1
  124. package/dist/cli/list-models.code.js +60 -0
  125. package/dist/cli/list-models.code.js.map +1 -0
  126. package/dist/cli/list-models.impl.js +36 -0
  127. package/dist/cli/list-models.impl.js.map +1 -0
  128. package/dist/cli/list-models.js +33 -57
  129. package/dist/cli/list-models.js.map +1 -1
  130. package/dist/cli/session-picker.code.js +55 -0
  131. package/dist/cli/session-picker.code.js.map +1 -0
  132. package/dist/cli/session-picker.impl.js +36 -0
  133. package/dist/cli/session-picker.impl.js.map +1 -0
  134. package/dist/cli/session-picker.js +33 -52
  135. package/dist/cli/session-picker.js.map +1 -1
  136. package/dist/cli/startup-ui.code.js +5 -0
  137. package/dist/cli/startup-ui.code.js.map +1 -0
  138. package/dist/cli/startup-ui.impl.js +36 -0
  139. package/dist/cli/startup-ui.impl.js.map +1 -0
  140. package/dist/cli/startup-ui.js +35 -4
  141. package/dist/cli/storage-command.code.js +3 -0
  142. package/dist/cli/storage-command.code.js.map +1 -0
  143. package/dist/cli/storage-command.impl.js +36 -0
  144. package/dist/cli/storage-command.impl.js.map +1 -0
  145. package/dist/cli/storage-command.js +35 -2
  146. package/dist/cli/storage-search-session.code.js +189 -0
  147. package/dist/cli/storage-search-session.code.js.map +1 -0
  148. package/dist/cli/storage-search-session.impl.js +36 -0
  149. package/dist/cli/storage-search-session.impl.js.map +1 -0
  150. package/dist/cli/storage-search-session.js +33 -186
  151. package/dist/cli/storage-search-session.js.map +1 -1
  152. package/dist/cli/team-command.code.js +217 -0
  153. package/dist/cli/team-command.code.js.map +1 -0
  154. package/dist/cli/team-command.impl.js +36 -0
  155. package/dist/cli/team-command.impl.js.map +1 -0
  156. package/dist/cli/team-command.js +32 -213
  157. package/dist/cli/team-command.js.map +1 -1
  158. package/dist/cli.js +60 -11
  159. package/dist/cli.js.map +1 -1
  160. package/dist/config.js +1 -1
  161. package/dist/core/agent-session-methods.d.ts +4 -3
  162. package/dist/core/agent-session-methods.js.map +1 -1
  163. package/dist/core/agent-session-types.d.ts +5 -0
  164. package/dist/core/compaction/compaction.d.ts +6 -0
  165. package/dist/core/compaction/model-resolver.d.ts +1 -1
  166. package/dist/core/debug.code.js +3 -0
  167. package/dist/core/debug.code.js.map +1 -0
  168. package/dist/core/debug.impl.js +36 -0
  169. package/dist/core/debug.impl.js.map +1 -0
  170. package/dist/core/debug.js +35 -2
  171. package/dist/core/default-model-api-prewarm.d.ts +5 -0
  172. package/dist/core/export-html/card-projection.code.js +257 -0
  173. package/dist/core/export-html/card-projection.code.js.map +1 -0
  174. package/dist/core/export-html/card-projection.impl.js +36 -0
  175. package/dist/core/export-html/card-projection.impl.js.map +1 -0
  176. package/dist/core/export-html/card-projection.js +34 -255
  177. package/dist/core/export-html/card-projection.js.map +1 -1
  178. package/dist/core/export-html/index.code.js +655 -0
  179. package/dist/core/export-html/index.code.js.map +1 -0
  180. package/dist/core/export-html/index.impl.js +36 -0
  181. package/dist/core/export-html/index.impl.js.map +1 -0
  182. package/dist/core/export-html/index.js +30 -604
  183. package/dist/core/export-html/index.js.map +1 -1
  184. package/dist/core/export-html/json-spans.code.js +3 -0
  185. package/dist/core/export-html/json-spans.code.js.map +1 -0
  186. package/dist/core/export-html/json-spans.impl.js +36 -0
  187. package/dist/core/export-html/json-spans.impl.js.map +1 -0
  188. package/dist/core/export-html/json-spans.js +35 -2
  189. package/dist/core/export-html/oversized-render-inputs.code.js +125 -0
  190. package/dist/core/export-html/oversized-render-inputs.code.js.map +1 -0
  191. package/dist/core/export-html/oversized-render-inputs.impl.js +36 -0
  192. package/dist/core/export-html/oversized-render-inputs.impl.js.map +1 -0
  193. package/dist/core/export-html/oversized-render-inputs.js +31 -120
  194. package/dist/core/export-html/oversized-render-inputs.js.map +1 -1
  195. package/dist/core/export-html/tool-renderer.code.js +350 -0
  196. package/dist/core/export-html/tool-renderer.code.js.map +1 -0
  197. package/dist/core/export-html/tool-renderer.impl.js +36 -0
  198. package/dist/core/export-html/tool-renderer.impl.js.map +1 -0
  199. package/dist/core/export-html/tool-renderer.js +33 -347
  200. package/dist/core/export-html/tool-renderer.js.map +1 -1
  201. package/dist/core/extensions/jiti-loader.code.js +3 -0
  202. package/dist/core/extensions/jiti-loader.code.js.map +1 -0
  203. package/dist/core/extensions/jiti-loader.impl.js +36 -0
  204. package/dist/core/extensions/jiti-loader.impl.js.map +1 -0
  205. package/dist/core/extensions/jiti-loader.js +35 -2
  206. package/dist/core/extensions/jiti-static-loader.code.js +3 -0
  207. package/dist/core/extensions/jiti-static-loader.code.js.map +1 -0
  208. package/dist/core/extensions/jiti-static-loader.impl.js +36 -0
  209. package/dist/core/extensions/jiti-static-loader.impl.js.map +1 -0
  210. package/dist/core/extensions/jiti-static-loader.js +35 -2
  211. package/dist/core/extensions/loader-host-modules.code.js +3 -0
  212. package/dist/core/extensions/loader-host-modules.code.js.map +1 -0
  213. package/dist/core/extensions/loader-host-modules.impl.js +36 -0
  214. package/dist/core/extensions/loader-host-modules.impl.js.map +1 -0
  215. package/dist/core/extensions/loader-host-modules.js +35 -2
  216. package/dist/core/extensions/loader-virtual-modules.d.ts +1 -6
  217. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  218. package/dist/core/extensions/runner-context.js +3 -3
  219. package/dist/core/extensions/session-events.d.ts +4 -0
  220. package/dist/core/extensions/session-events.js.map +1 -1
  221. package/dist/core/intercom-broker-control-host.code.js +5 -0
  222. package/dist/core/intercom-broker-control-host.code.js.map +1 -0
  223. package/dist/core/intercom-broker-control-host.impl.js +36 -0
  224. package/dist/core/intercom-broker-control-host.impl.js.map +1 -0
  225. package/dist/core/intercom-broker-control-host.js +35 -4
  226. package/dist/core/intercom-broker-control.code.js +63 -0
  227. package/dist/core/intercom-broker-control.code.js.map +1 -0
  228. package/dist/core/intercom-broker-control.d.ts +21 -0
  229. package/dist/core/intercom-broker-control.impl.js +36 -0
  230. package/dist/core/intercom-broker-control.impl.js.map +1 -0
  231. package/dist/core/intercom-broker-control.js +35 -17
  232. package/dist/core/intercom-broker-control.js.map +1 -1
  233. package/dist/core/package-manager-storage-adapters.code.js +3 -0
  234. package/dist/core/package-manager-storage-adapters.code.js.map +1 -0
  235. package/dist/core/package-manager-storage-adapters.impl.js +36 -0
  236. package/dist/core/package-manager-storage-adapters.impl.js.map +1 -0
  237. package/dist/core/package-manager-storage-adapters.js +35 -2
  238. package/dist/core/process-start-token.d.ts +8 -2
  239. package/dist/core/process-tree-containment.d.ts +27 -0
  240. package/dist/core/queued-message-delivery.d.ts +5 -2
  241. package/dist/core/resume/blueprint/process.d.ts +3 -1
  242. package/dist/core/sdk.code.js +9 -0
  243. package/dist/core/sdk.code.js.map +1 -0
  244. package/dist/core/sdk.impl.js +36 -0
  245. package/dist/core/sdk.impl.js.map +1 -0
  246. package/dist/core/sdk.js +35 -8
  247. package/dist/core/session-manager-core.d.ts +15 -5
  248. package/dist/core/session-manager-core.js +195 -38
  249. package/dist/core/session-manager-core.js.map +1 -1
  250. package/dist/core/session-manager-list.code.js +3 -0
  251. package/dist/core/session-manager-list.code.js.map +1 -0
  252. package/dist/core/session-manager-list.impl.js +36 -0
  253. package/dist/core/session-manager-list.impl.js.map +1 -0
  254. package/dist/core/session-manager-list.js +35 -2
  255. package/dist/core/session-manager-types.d.ts +20 -0
  256. package/dist/core/session-manager.code.js +8 -0
  257. package/dist/core/session-manager.code.js.map +1 -0
  258. package/dist/core/session-manager.d.ts +1 -1
  259. package/dist/core/session-manager.impl.js +36 -0
  260. package/dist/core/session-manager.impl.js.map +1 -0
  261. package/dist/core/session-manager.js +35 -7
  262. package/dist/core/session-storage.code.js +3 -0
  263. package/dist/core/session-storage.code.js.map +1 -0
  264. package/dist/core/session-storage.impl.js +36 -0
  265. package/dist/core/session-storage.impl.js.map +1 -0
  266. package/dist/core/session-storage.js +35 -2
  267. package/dist/core/storage/file-identity.d.ts +3 -0
  268. package/dist/core/storage/file-identity.js +296 -86
  269. package/dist/core/storage/file-identity.js.map +1 -1
  270. package/dist/core/storage/index.d.ts +1 -1
  271. package/dist/core/storage/index.js +52 -7
  272. package/dist/core/storage/index.js.map +1 -1
  273. package/dist/core/storage/node-sqlite-thread.js +47 -2
  274. package/dist/core/storage/node-sqlite.js +49 -4
  275. package/dist/core/storage/node-sqlite.js.map +1 -1
  276. package/dist/core/storage/offline-snapshot-file.code.js +37 -0
  277. package/dist/core/storage/offline-snapshot-file.code.js.map +1 -0
  278. package/dist/core/storage/offline-snapshot-file.impl.js +36 -0
  279. package/dist/core/storage/offline-snapshot-file.impl.js.map +1 -0
  280. package/dist/core/storage/offline-snapshot-file.js +33 -34
  281. package/dist/core/storage/offline-snapshot-file.js.map +1 -1
  282. package/dist/core/storage/provider.js +52 -7
  283. package/dist/core/storage/selection.js +49 -4
  284. package/dist/core/storage/session/branch-fork-source.code.js +146 -0
  285. package/dist/core/storage/session/branch-fork-source.code.js.map +1 -0
  286. package/dist/core/storage/session/branch-fork-source.impl.js +36 -0
  287. package/dist/core/storage/session/branch-fork-source.impl.js.map +1 -0
  288. package/dist/core/storage/session/branch-fork-source.js +32 -97
  289. package/dist/core/storage/session/branch-fork-source.js.map +1 -1
  290. package/dist/core/storage/session/card-view.code.js +60 -0
  291. package/dist/core/storage/session/card-view.code.js.map +1 -0
  292. package/dist/core/storage/session/card-view.impl.js +36 -0
  293. package/dist/core/storage/session/card-view.impl.js.map +1 -0
  294. package/dist/core/storage/session/card-view.js +34 -58
  295. package/dist/core/storage/session/card-view.js.map +1 -1
  296. package/dist/core/storage/session/child-reader.code.js +139 -0
  297. package/dist/core/storage/session/child-reader.code.js.map +1 -0
  298. package/dist/core/storage/session/child-reader.d.ts +1 -0
  299. package/dist/core/storage/session/child-reader.impl.js +36 -0
  300. package/dist/core/storage/session/child-reader.impl.js.map +1 -0
  301. package/dist/core/storage/session/child-reader.js +33 -91
  302. package/dist/core/storage/session/child-reader.js.map +1 -1
  303. package/dist/core/storage/session/chunked-resume-projection.code.js +3 -0
  304. package/dist/core/storage/session/chunked-resume-projection.code.js.map +1 -0
  305. package/dist/core/storage/session/chunked-resume-projection.impl.js +36 -0
  306. package/dist/core/storage/session/chunked-resume-projection.impl.js.map +1 -0
  307. package/dist/core/storage/session/chunked-resume-projection.js +35 -2
  308. package/dist/core/storage/session/expanded-child-details.code.js +684 -0
  309. package/dist/core/storage/session/expanded-child-details.code.js.map +1 -0
  310. package/dist/core/storage/session/expanded-child-details.impl.js +36 -0
  311. package/dist/core/storage/session/expanded-child-details.impl.js.map +1 -0
  312. package/dist/core/storage/session/expanded-child-details.js +31 -634
  313. package/dist/core/storage/session/expanded-child-details.js.map +1 -1
  314. package/dist/core/storage/session/fork-row-bytes.code.js +3 -0
  315. package/dist/core/storage/session/fork-row-bytes.code.js.map +1 -0
  316. package/dist/core/storage/session/fork-row-bytes.impl.js +36 -0
  317. package/dist/core/storage/session/fork-row-bytes.impl.js.map +1 -0
  318. package/dist/core/storage/session/fork-row-bytes.js +35 -2
  319. package/dist/core/storage/session/fork-row-index.code.js +3 -0
  320. package/dist/core/storage/session/fork-row-index.code.js.map +1 -0
  321. package/dist/core/storage/session/fork-row-index.impl.js +36 -0
  322. package/dist/core/storage/session/fork-row-index.impl.js.map +1 -0
  323. package/dist/core/storage/session/fork-row-index.js +35 -2
  324. package/dist/core/storage/session/fork-staging.code.js +580 -0
  325. package/dist/core/storage/session/fork-staging.code.js.map +1 -0
  326. package/dist/core/storage/session/fork-staging.impl.js +36 -0
  327. package/dist/core/storage/session/fork-staging.impl.js.map +1 -0
  328. package/dist/core/storage/session/fork-staging.js +30 -574
  329. package/dist/core/storage/session/fork-staging.js.map +1 -1
  330. package/dist/core/storage/session/fork-window.code.js +522 -0
  331. package/dist/core/storage/session/fork-window.code.js.map +1 -0
  332. package/dist/core/storage/session/fork-window.impl.js +36 -0
  333. package/dist/core/storage/session/fork-window.impl.js.map +1 -0
  334. package/dist/core/storage/session/fork-window.js +30 -471
  335. package/dist/core/storage/session/fork-window.js.map +1 -1
  336. package/dist/core/storage/session/history-pages.code.js +3 -0
  337. package/dist/core/storage/session/history-pages.code.js.map +1 -0
  338. package/dist/core/storage/session/history-pages.impl.js +36 -0
  339. package/dist/core/storage/session/history-pages.impl.js.map +1 -0
  340. package/dist/core/storage/session/history-pages.js +35 -2
  341. package/dist/core/storage/session/jsonl-entry-projection.code.js +3 -0
  342. package/dist/core/storage/session/jsonl-entry-projection.code.js.map +1 -0
  343. package/dist/core/storage/session/jsonl-entry-projection.impl.js +36 -0
  344. package/dist/core/storage/session/jsonl-entry-projection.impl.js.map +1 -0
  345. package/dist/core/storage/session/jsonl-entry-projection.js +35 -2
  346. package/dist/core/storage/session/jsonl-session-store.code.js +3 -0
  347. package/dist/core/storage/session/jsonl-session-store.code.js.map +1 -0
  348. package/dist/core/storage/session/jsonl-session-store.impl.js +36 -0
  349. package/dist/core/storage/session/jsonl-session-store.impl.js.map +1 -0
  350. package/dist/core/storage/session/jsonl-session-store.js +35 -2
  351. package/dist/core/storage/session/memory-session-store.code.js +3 -0
  352. package/dist/core/storage/session/memory-session-store.code.js.map +1 -0
  353. package/dist/core/storage/session/memory-session-store.impl.js +36 -0
  354. package/dist/core/storage/session/memory-session-store.impl.js.map +1 -0
  355. package/dist/core/storage/session/memory-session-store.js +35 -2
  356. package/dist/core/storage/session/pinned-branch-resume.code.js +117 -0
  357. package/dist/core/storage/session/pinned-branch-resume.code.js.map +1 -0
  358. package/dist/core/storage/session/pinned-branch-resume.impl.js +36 -0
  359. package/dist/core/storage/session/pinned-branch-resume.impl.js.map +1 -0
  360. package/dist/core/storage/session/pinned-branch-resume.js +33 -69
  361. package/dist/core/storage/session/pinned-branch-resume.js.map +1 -1
  362. package/dist/core/storage/session/released-history-files.code.js +465 -0
  363. package/dist/core/storage/session/released-history-files.code.js.map +1 -0
  364. package/dist/core/storage/session/released-history-files.impl.js +36 -0
  365. package/dist/core/storage/session/released-history-files.impl.js.map +1 -0
  366. package/dist/core/storage/session/released-history-files.js +32 -461
  367. package/dist/core/storage/session/released-history-files.js.map +1 -1
  368. package/dist/core/storage/session/resident-fork-rows.code.js +57 -0
  369. package/dist/core/storage/session/resident-fork-rows.code.js.map +1 -0
  370. package/dist/core/storage/session/resident-fork-rows.impl.js +36 -0
  371. package/dist/core/storage/session/resident-fork-rows.impl.js.map +1 -0
  372. package/dist/core/storage/session/resident-fork-rows.js +32 -53
  373. package/dist/core/storage/session/resident-fork-rows.js.map +1 -1
  374. package/dist/core/storage/session/session-resume.code.js +3 -0
  375. package/dist/core/storage/session/session-resume.code.js.map +1 -0
  376. package/dist/core/storage/session/session-resume.impl.js +36 -0
  377. package/dist/core/storage/session/session-resume.impl.js.map +1 -0
  378. package/dist/core/storage/session/session-resume.js +35 -2
  379. package/dist/core/storage/session/snapshot-cut.code.js +3 -0
  380. package/dist/core/storage/session/snapshot-cut.code.js.map +1 -0
  381. package/dist/core/storage/session/snapshot-cut.impl.js +36 -0
  382. package/dist/core/storage/session/snapshot-cut.impl.js.map +1 -0
  383. package/dist/core/storage/session/snapshot-cut.js +35 -2
  384. package/dist/core/storage/session/snapshot-history.code.js +107 -0
  385. package/dist/core/storage/session/snapshot-history.code.js.map +1 -0
  386. package/dist/core/storage/session/snapshot-history.impl.js +36 -0
  387. package/dist/core/storage/session/snapshot-history.impl.js.map +1 -0
  388. package/dist/core/storage/session/snapshot-history.js +34 -60
  389. package/dist/core/storage/session/snapshot-history.js.map +1 -1
  390. package/dist/core/storage/session/sql-session-store.code.js +3 -0
  391. package/dist/core/storage/session/sql-session-store.code.js.map +1 -0
  392. package/dist/core/storage/session/sql-session-store.impl.js +36 -0
  393. package/dist/core/storage/session/sql-session-store.impl.js.map +1 -0
  394. package/dist/core/storage/session/sql-session-store.js +35 -2
  395. package/dist/core/storage/session/tree-outline.code.js +3 -0
  396. package/dist/core/storage/session/tree-outline.code.js.map +1 -0
  397. package/dist/core/storage/session/tree-outline.impl.js +36 -0
  398. package/dist/core/storage/session/tree-outline.impl.js.map +1 -0
  399. package/dist/core/storage/session/tree-outline.js +35 -2
  400. package/dist/core/storage/session/tree-presentation.code.js +342 -0
  401. package/dist/core/storage/session/tree-presentation.code.js.map +1 -0
  402. package/dist/core/storage/session/tree-presentation.impl.js +36 -0
  403. package/dist/core/storage/session/tree-presentation.impl.js.map +1 -0
  404. package/dist/core/storage/session/tree-presentation.js +31 -337
  405. package/dist/core/storage/session/tree-presentation.js.map +1 -1
  406. package/dist/core/storage/session/types.d.ts +26 -0
  407. package/dist/core/storage/storage-status.code.js +3 -0
  408. package/dist/core/storage/storage-status.code.js.map +1 -0
  409. package/dist/core/storage/storage-status.impl.js +36 -0
  410. package/dist/core/storage/storage-status.impl.js.map +1 -0
  411. package/dist/core/storage/storage-status.js +35 -2
  412. package/dist/core/storage/team.code.js +3 -0
  413. package/dist/core/storage/team.code.js.map +1 -0
  414. package/dist/core/storage/team.impl.js +36 -0
  415. package/dist/core/storage/team.impl.js.map +1 -0
  416. package/dist/core/storage/team.js +35 -2
  417. package/dist/core/structured-output/index.code.js +3 -0
  418. package/dist/core/structured-output/index.code.js.map +1 -0
  419. package/dist/core/structured-output/index.impl.js +36 -0
  420. package/dist/core/structured-output/index.impl.js.map +1 -0
  421. package/dist/core/structured-output/index.js +35 -2
  422. package/dist/core/tasks/command-output.d.ts +4 -1
  423. package/dist/core/tasks/supervisor.d.ts +2 -0
  424. package/dist/core/tasks/task-completion-entry.code.js +254 -0
  425. package/dist/core/tasks/task-completion-entry.code.js.map +1 -0
  426. package/dist/core/tasks/task-completion-entry.impl.js +36 -0
  427. package/dist/core/tasks/task-completion-entry.impl.js.map +1 -0
  428. package/dist/core/tasks/task-completion-entry.js +33 -251
  429. package/dist/core/tasks/task-completion-entry.js.map +1 -1
  430. package/dist/core/tasks/task-file-history.code.js +424 -0
  431. package/dist/core/tasks/task-file-history.code.js.map +1 -0
  432. package/dist/core/tasks/task-file-history.impl.js +36 -0
  433. package/dist/core/tasks/task-file-history.impl.js.map +1 -0
  434. package/dist/core/tasks/task-file-history.js +32 -375
  435. package/dist/core/tasks/task-file-history.js.map +1 -1
  436. package/dist/core/tasks/task-reference-archive.code.js +514 -0
  437. package/dist/core/tasks/task-reference-archive.code.js.map +1 -0
  438. package/dist/core/tasks/task-reference-archive.js +34 -467
  439. package/dist/core/tasks/task-reference-archive.js.map +1 -1
  440. package/dist/core/tasks/task-reference-identity.code.js +164 -0
  441. package/dist/core/tasks/task-reference-identity.code.js.map +1 -0
  442. package/dist/core/tasks/task-reference-identity.js +32 -160
  443. package/dist/core/tasks/task-reference-identity.js.map +1 -1
  444. package/dist/core/tasks/task-reference-stream.code.js +3 -0
  445. package/dist/core/tasks/task-reference-stream.code.js.map +1 -0
  446. package/dist/core/tasks/task-reference-stream.impl.js +36 -0
  447. package/dist/core/tasks/task-reference-stream.impl.js.map +1 -0
  448. package/dist/core/tasks/task-reference-stream.js +35 -2
  449. package/dist/core/tasks/task-unsaved-answer.code.js +3 -0
  450. package/dist/core/tasks/task-unsaved-answer.code.js.map +1 -0
  451. package/dist/core/tasks/task-unsaved-answer.impl.js +36 -0
  452. package/dist/core/tasks/task-unsaved-answer.impl.js.map +1 -0
  453. package/dist/core/tasks/task-unsaved-answer.js +35 -2
  454. package/dist/core/tasks/task-view-source.code.js +3 -0
  455. package/dist/core/tasks/task-view-source.code.js.map +1 -0
  456. package/dist/core/tasks/task-view-source.d.ts +9 -0
  457. package/dist/core/tasks/task-view-source.impl.js +36 -0
  458. package/dist/core/tasks/task-view-source.impl.js.map +1 -0
  459. package/dist/core/tasks/task-view-source.js +35 -2
  460. package/dist/core/tools/read-url.code.js +1530 -0
  461. package/dist/core/tools/read-url.code.js.map +1 -0
  462. package/dist/core/tools/read-url.impl.js +36 -0
  463. package/dist/core/tools/read-url.impl.js.map +1 -0
  464. package/dist/core/tools/read-url.js +30 -1524
  465. package/dist/core/tools/read-url.js.map +1 -1
  466. package/dist/core/worktree-snapshot/blob-store.js +50 -5
  467. package/dist/core/worktree-snapshot/errors.code.js +6 -0
  468. package/dist/core/worktree-snapshot/errors.code.js.map +1 -0
  469. package/dist/core/worktree-snapshot/errors.impl.js +36 -0
  470. package/dist/core/worktree-snapshot/errors.impl.js.map +1 -0
  471. package/dist/core/worktree-snapshot/errors.js +35 -5
  472. package/dist/core/worktree-snapshot/session-index-reset.code.js +136 -0
  473. package/dist/core/worktree-snapshot/session-index-reset.code.js.map +1 -0
  474. package/dist/core/worktree-snapshot/session-index-reset.impl.js +36 -0
  475. package/dist/core/worktree-snapshot/session-index-reset.impl.js.map +1 -0
  476. package/dist/core/worktree-snapshot/session-index-reset.js +34 -134
  477. package/dist/core/worktree-snapshot/session-index-reset.js.map +1 -1
  478. package/dist/extensions/codemode/execute.code.js +618 -0
  479. package/dist/extensions/codemode/execute.code.js.map +1 -0
  480. package/dist/extensions/codemode/execute.impl.js +36 -0
  481. package/dist/extensions/codemode/execute.impl.js.map +1 -0
  482. package/dist/extensions/codemode/execute.js +30 -612
  483. package/dist/extensions/codemode/execute.js.map +1 -1
  484. package/dist/extensions/codemode/renderer.code.js +110 -0
  485. package/dist/extensions/codemode/renderer.code.js.map +1 -0
  486. package/dist/extensions/codemode/renderer.impl.js +36 -0
  487. package/dist/extensions/codemode/renderer.impl.js.map +1 -0
  488. package/dist/extensions/codemode/renderer.js +33 -107
  489. package/dist/extensions/codemode/renderer.js.map +1 -1
  490. package/dist/extensions/mcp/cli.code.js +565 -0
  491. package/dist/extensions/mcp/cli.code.js.map +1 -0
  492. package/dist/extensions/mcp/cli.impl.js +36 -0
  493. package/dist/extensions/mcp/cli.impl.js.map +1 -0
  494. package/dist/extensions/mcp/cli.js +32 -561
  495. package/dist/extensions/mcp/cli.js.map +1 -1
  496. package/dist/extensions/mcp/cli.lazy.code.js +52 -0
  497. package/dist/extensions/mcp/cli.lazy.code.js.map +1 -0
  498. package/dist/extensions/mcp/cli.lazy.impl.js +36 -0
  499. package/dist/extensions/mcp/cli.lazy.impl.js.map +1 -0
  500. package/dist/extensions/mcp/cli.lazy.js +36 -7
  501. package/dist/extensions/mcp/cli.lazy.js.map +1 -1
  502. package/dist/extensions/mcp/client/transports/stdio.d.ts +2 -0
  503. package/dist/extensions/mcp/runtime.code.js +5 -0
  504. package/dist/extensions/mcp/runtime.code.js.map +1 -0
  505. package/dist/extensions/mcp/runtime.impl.js +36 -0
  506. package/dist/extensions/mcp/runtime.impl.js.map +1 -0
  507. package/dist/extensions/mcp/runtime.js +35 -4
  508. package/dist/index.d.ts +1 -1
  509. package/dist/index.js +8 -8
  510. package/dist/main-first-time-setup.code.js +12 -0
  511. package/dist/main-first-time-setup.code.js.map +1 -0
  512. package/dist/main-first-time-setup.impl.js +36 -0
  513. package/dist/main-first-time-setup.impl.js.map +1 -0
  514. package/dist/main-first-time-setup.js +35 -11
  515. package/dist/main-first-time-setup.js.map +1 -1
  516. package/dist/main.d.ts +1 -1
  517. package/dist/main.js +2 -2
  518. package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts +6 -1
  519. package/dist/modes/interactive/agent-view/contracts.d.ts +4 -0
  520. package/dist/modes/interactive/chat-reader-records.d.ts +1 -1
  521. package/dist/modes/interactive/components/stored-tree-view.code.js +338 -0
  522. package/dist/modes/interactive/components/stored-tree-view.code.js.map +1 -0
  523. package/dist/modes/interactive/components/stored-tree-view.impl.js +36 -0
  524. package/dist/modes/interactive/components/stored-tree-view.impl.js.map +1 -0
  525. package/dist/modes/interactive/components/stored-tree-view.js +33 -290
  526. package/dist/modes/interactive/components/stored-tree-view.js.map +1 -1
  527. package/dist/modes/interactive/components/task-selection-state.d.ts +8 -3
  528. package/dist/modes/interactive/components/task-transcript-page.d.ts +1 -0
  529. package/dist/modes/interactive/components/user-message-selector-archive.code.js +191 -0
  530. package/dist/modes/interactive/components/user-message-selector-archive.code.js.map +1 -0
  531. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +36 -0
  532. package/dist/modes/interactive/components/user-message-selector-archive.impl.js.map +1 -0
  533. package/dist/modes/interactive/components/user-message-selector-archive.js +34 -189
  534. package/dist/modes/interactive/components/user-message-selector-archive.js.map +1 -1
  535. package/dist/modes/interactive/interactive-mode-base.d.ts +6 -0
  536. package/dist/modes/interactive/interactive-mode-deps.js +4 -0
  537. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -0
  538. package/dist/modes/interactive/interactive-mode.js +1 -1
  539. package/dist/modes/interactive/interactive-queueing.d.ts +4 -0
  540. package/dist/modes/interactive/interactive-render-chat.d.ts +22 -0
  541. package/dist/modes/interactive/interactive-startup.d.ts +2 -0
  542. package/dist/modes/interactive/program-status-reporter.d.ts +2 -1
  543. package/dist/modes/interactive/startup-shell-eligibility.js +1 -1
  544. package/dist/modes/interactive/steering-queue-controller.d.ts +4 -0
  545. package/dist/modes/interactive/theme/theme-schema-factory.d.ts +26 -0
  546. package/dist/modes/interactive/theme/theme-schema.d.ts +4 -5
  547. package/dist/modes/interactive-engine/engine-prewarm.d.ts +30 -5
  548. package/dist/modes/interactive-engine/engine-prewarm.js +1 -1
  549. package/dist/modes/interactive-engine/isolated-runtime.d.ts +7 -0
  550. package/dist/modes/interactive-engine/protocol.d.ts +32 -1
  551. package/dist/modes/rpc/agent-view-rpc-types.d.ts +12 -1
  552. package/dist/modes/rpc/agent-view-rpc-types.js.map +1 -1
  553. package/dist/modes/rpc/rpc-client-api.d.ts +3 -1
  554. package/dist/modes/rpc/rpc-types.d.ts +12 -0
  555. package/dist/package-manager-cli.code.js +1140 -0
  556. package/dist/package-manager-cli.code.js.map +1 -0
  557. package/dist/package-manager-cli.impl.js +36 -0
  558. package/dist/package-manager-cli.impl.js.map +1 -0
  559. package/dist/package-manager-cli.js +36 -1067
  560. package/dist/package-manager-cli.js.map +1 -1
  561. package/dist/rpc-entry.js +2 -2
  562. package/dist/startup-files.json +1 -1
  563. package/dist/startup-stages/10.js +1 -1
  564. package/dist/startup-stages/11.js +1 -1
  565. package/dist/startup-stages/12.js +1 -1
  566. package/dist/startup-stages/13.js +1 -0
  567. package/dist/startup-stages/2.js +1 -7
  568. package/dist/startup-stages/3.js +6 -2
  569. package/dist/startup-stages/4.js +2 -1
  570. package/dist/startup-stages/5.js +1 -7
  571. package/dist/startup-stages/6.js +7 -10
  572. package/dist/startup-stages/7.js +10 -3
  573. package/dist/startup-stages/8.js +3 -6
  574. package/dist/startup-stages/9.js +6 -1
  575. package/dist/startup-stages/stages.json +1 -1
  576. package/dist/utils/canonical-path.js +2 -0
  577. package/dist/utils/canonical-path.js.map +1 -1
  578. package/dist/utils/child-process.d.ts +41 -1
  579. package/dist/utils/compile-cache-warmup-host.js +63 -18
  580. package/dist/utils/compile-cache-warmup-host.js.map +1 -1
  581. package/dist/utils/credential-redaction.d.ts +50 -1
  582. package/dist/utils/interactive-engine-bootstrap.d.ts +2 -0
  583. package/dist/utils/interactive-engine-env.d.ts +2 -0
  584. package/dist/utils/memoize-async.d.ts +32 -0
  585. package/dist/utils/memoize-async.js +91 -0
  586. package/dist/utils/memoize-async.js.map +1 -0
  587. package/dist/utils/photon.js +19 -29
  588. package/dist/utils/photon.js.map +1 -1
  589. package/dist/utils/shell.d.ts +7 -4
  590. package/dist/utils/startup-database-spare.code.js +108 -0
  591. package/dist/utils/startup-database-spare.code.js.map +1 -0
  592. package/dist/utils/startup-database-spare.impl.js +36 -0
  593. package/dist/utils/startup-database-spare.impl.js.map +1 -0
  594. package/dist/utils/startup-database-spare.js +33 -105
  595. package/dist/utils/startup-database-spare.js.map +1 -1
  596. package/dist/utils/tools-manager.code.js +3 -0
  597. package/dist/utils/tools-manager.code.js.map +1 -0
  598. package/dist/utils/tools-manager.impl.js +36 -0
  599. package/dist/utils/tools-manager.impl.js.map +1 -0
  600. package/dist/utils/tools-manager.js +35 -2
  601. package/dist/utils/windows-cwd.js +585 -0
  602. package/dist/utils/windows-cwd.js.map +1 -0
  603. package/docs/extensions.md +1 -1
  604. package/docs/getting-started/installation.md +2 -0
  605. package/docs/intercom/operations.md +1 -0
  606. package/docs/reference/cli.md +2 -2
  607. package/package.json +24 -24
  608. package/dist/_shared/mode-shared-HP7GUA7J.js.map +0 -1
  609. package/dist/_shared/p1a-prewarm-YK3KDTLN.js.map +0 -1
  610. package/dist/_shared/p1b-elig-PXQA2FYP.js.map +0 -1
  611. package/dist/_shared/startup-0-0-X4NF3GKM.js.map +0 -1
  612. package/dist/_shared/startup-0-1-7QTG6VJZ.js.map +0 -1
  613. package/dist/_shared/startup-0-2-KFDYPDJK.js.map +0 -1
  614. package/dist/_shared/startup-8-1-KQJBDKRU.js.map +0 -1
@@ -1,17 +1,17 @@
1
1
  import { __name } from "./rolldown-runtime-BGM3D5V3.js";
2
- import { ENV_TIMING, createModuleRequire, getAgentDir, getCustomThemesDir, getEnvValue, getThemesDir, stripBom } from "./p0-cli-GUFK7TPN.js";
3
- import { realpath } from "node:fs/promises";
2
+ import { ENV_TIMING, createModuleRequire, getAgentDir, getCustomThemesDir, getEnvValue, getThemesDir, stripBom } from "./p0-cli-BB45ZQY6.js";
3
+ import { readFile, realpath } from "node:fs/promises";
4
4
  import { existsSync, readFileSync } from "fs";
5
5
  import * as path$1 from "path";
6
6
  import { join } from "path";
7
7
  import * as path$2 from "node:path";
8
+ import { dirname as dirname$1, resolve as resolve$1 } from "node:path";
8
9
  import * as fs$2 from "node:fs";
9
10
  import { realpathSync as realpathSync$1, watch } from "node:fs";
10
11
  import { KeybindingsManager, TUI_KEYBINDINGS, clickableHintText, clickableKeyTextHint, clickableKeysHint, colorToHex, colorToOkhsl, colorToOklch, colorToRgb, getKeybindings, hintKeyParts, hintKeyParts as hintKeyParts$1, okhslColor, oklabToOkhslLightness, oklchColor, parseColor, rgbColor, slashCommandHint, truncateToWidth, visibleWidth } from "@bastani/atomic-tui";
11
12
  import { Chalk } from "chalk";
12
13
  import { access as access$1, readFile as readFile$1 } from "fs/promises";
13
- import { Compile } from "@bastani/atomic-ai/utils/typebox/compile";
14
- import { Type } from "@bastani/atomic-ai/utils/typebox/index";
14
+ import { memoizeAsync } from "../utils/memoize-async.js";
15
15
  import { createRequire } from "module";
16
16
  import { fileURLToPath } from "url";
17
17
  // dist/core/keybindings.js
@@ -518,14 +518,14 @@ function printTimings() {
518
518
  for (const [namespace, timingNamespace] of timingNamespaces) printTimingGroup(`Startup Timings: ${namespace}`, timingNamespace);
519
519
  }
520
520
  // dist/main-early-input.js
521
- const __atomicDistModuleUrl$2 = new URL("../main-early-input.js", import.meta.url).href;
521
+ const __atomicDistModuleUrl$3 = new URL("../main-early-input.js", import.meta.url).href;
522
522
  const STARTUP_DIALOG_INPUT_GRACE_MS = 25;
523
523
  const STARTUP_DIALOG_INPUT_DRAIN_MAX_MS = 2e3;
524
524
  const STARTUP_DIALOG_INPUT_DRAIN_POLL_MS = 5;
525
525
  let nativePendingInput;
526
526
  function osStdinPendingInput() {
527
527
  if (nativePendingInput === void 0) try {
528
- const read = createModuleRequire(__atomicDistModuleUrl$2)("@bastani/atomic-natives").pendingStdinInput;
528
+ const read = createModuleRequire(__atomicDistModuleUrl$3)("@bastani/atomic-natives").pendingStdinInput;
529
529
  nativePendingInput = typeof read === "function" ? () => read() ?? null : null;
530
530
  } catch {
531
531
  nativePendingInput = null;
@@ -2677,68 +2677,144 @@ var Theme = class {
2677
2677
  return (str) => this.fg("bashMode", str);
2678
2678
  }
2679
2679
  };
2680
- // dist/modes/interactive/theme/theme-schema.js
2681
- function colorValue(description) {
2680
+ // dist/modes/interactive/theme/theme-schema-factory.js
2681
+ function createColorValueSchema(Type, description) {
2682
2682
  return Type.Union([Type.String({ description: "Hex color (#RRGGBB), OKHSL color (okhsl(H S L)), variable reference, or empty string for terminal default" }), Type.Integer({
2683
2683
  minimum: 0,
2684
2684
  maximum: 255,
2685
2685
  description: "256-color palette index (0-255)"
2686
2686
  })], description ? { description } : {});
2687
2687
  }
2688
- const ColorValueSchema = colorValue();
2689
- function themeTokenProperties(tokens) {
2688
+ function themeTokenProperties(Type, tokens) {
2690
2689
  const properties = {};
2691
2690
  for (const [name, descriptor] of Object.entries(tokens)) {
2692
- const schema = colorValue(descriptor.description);
2691
+ const schema = createColorValueSchema(Type, descriptor.description);
2693
2692
  properties[name] = descriptor.fallback === void 0 ? schema : Type.Optional(schema);
2694
2693
  }
2695
2694
  return properties;
2696
2695
  }
2697
- const ThemeColorsSchema = Type.Unsafe(Type.Object(themeTokenProperties(THEME_TOKENS), {
2698
- description: "Theme color definitions (scrollbarThumb and the search highlight colors are optional and fall back to compatible colors)",
2699
- additionalProperties: false
2700
- }));
2701
- const ThemeJsonSchema = Type.Object({
2702
- $schema: Type.Optional(Type.String({ description: "JSON schema reference" })),
2703
- name: Type.String({
2704
- pattern: "^[^/]+$",
2705
- description: "Theme name. Must not contain '/' because it is reserved for automatic light/dark theme settings."
2706
- }),
2707
- vars: Type.Optional(Type.Record(Type.String(), ColorValueSchema, { description: "Reusable color variables" })),
2708
- colors: ThemeColorsSchema,
2709
- workingIndicator: Type.Optional(Type.Object({
2710
- dark: Type.Optional(ColorValueSchema),
2711
- lift: Type.Optional(ColorValueSchema),
2712
- muted: Type.Optional(ColorValueSchema),
2713
- accent: Type.Optional(ColorValueSchema),
2714
- bright: Type.Optional(ColorValueSchema),
2715
- peak: Type.Optional(ColorValueSchema)
2716
- }, {
2717
- description: "Optional partial six-tone palette for Atomic's ordinary working identity",
2696
+ function createThemeJsonSchema(Type) {
2697
+ const ColorValueSchema = createColorValueSchema(Type);
2698
+ const ThemeColorsSchema = Type.Unsafe(Type.Object(themeTokenProperties(Type, THEME_TOKENS), {
2699
+ description: "Theme color definitions (scrollbarThumb and the search highlight colors are optional and fall back to compatible colors)",
2718
2700
  additionalProperties: false
2719
- })),
2720
- export: Type.Optional(Type.Object({
2721
- pageBg: Type.Optional(colorValue("Page background color")),
2722
- cardBg: Type.Optional(colorValue("Card/container background color")),
2723
- infoBg: Type.Optional(colorValue("Info sections background (system prompt, notices)"))
2701
+ }));
2702
+ return Type.Object({
2703
+ $schema: Type.Optional(Type.String({ description: "JSON schema reference" })),
2704
+ name: Type.String({
2705
+ pattern: "^[^/]+$",
2706
+ description: "Theme name. Must not contain '/' because it is reserved for automatic light/dark theme settings."
2707
+ }),
2708
+ vars: Type.Optional(Type.Record(Type.String(), ColorValueSchema, { description: "Reusable color variables" })),
2709
+ colors: ThemeColorsSchema,
2710
+ workingIndicator: Type.Optional(Type.Object({
2711
+ dark: Type.Optional(ColorValueSchema),
2712
+ lift: Type.Optional(ColorValueSchema),
2713
+ muted: Type.Optional(ColorValueSchema),
2714
+ accent: Type.Optional(ColorValueSchema),
2715
+ bright: Type.Optional(ColorValueSchema),
2716
+ peak: Type.Optional(ColorValueSchema)
2717
+ }, {
2718
+ description: "Optional partial six-tone palette for Atomic's ordinary working identity",
2719
+ additionalProperties: false
2720
+ })),
2721
+ export: Type.Optional(Type.Object({
2722
+ pageBg: Type.Optional(createColorValueSchema(Type, "Page background color")),
2723
+ cardBg: Type.Optional(createColorValueSchema(Type, "Card/container background color")),
2724
+ infoBg: Type.Optional(createColorValueSchema(Type, "Info sections background (system prompt, notices)"))
2725
+ }, {
2726
+ description: "Optional colors for HTML export (defaults derived from userMessageBg if not specified)",
2727
+ additionalProperties: false
2728
+ }))
2724
2729
  }, {
2725
- description: "Optional colors for HTML export (defaults derived from userMessageBg if not specified)",
2730
+ title: "Atomic Coding Agent Theme",
2731
+ description: "Theme schema for the Atomic coding agent",
2726
2732
  additionalProperties: false
2727
- }))
2728
- }, {
2729
- title: "Atomic Coding Agent Theme",
2730
- description: "Theme schema for the Atomic coding agent",
2731
- additionalProperties: false
2732
- });
2733
- const validateThemeJson = Compile(ThemeJsonSchema);
2733
+ });
2734
+ }
2734
2735
  // dist/modes/interactive/theme/theme-parse.js
2736
+ const __atomicDistModuleUrl$2 = new URL("../modes/interactive/theme/theme-parse.js", import.meta.url).href;
2737
+ const THEME_TOKEN_MAP = THEME_TOKENS;
2738
+ const TOP_LEVEL_KEYS = /* @__PURE__ */ new Set([
2739
+ "$schema",
2740
+ "name",
2741
+ "vars",
2742
+ "colors",
2743
+ "workingIndicator",
2744
+ "export"
2745
+ ]);
2746
+ const WORKING_INDICATOR_KEYS = /* @__PURE__ */ new Set([
2747
+ "dark",
2748
+ "lift",
2749
+ "muted",
2750
+ "accent",
2751
+ "bright",
2752
+ "peak"
2753
+ ]);
2754
+ const EXPORT_KEYS = /* @__PURE__ */ new Set([
2755
+ "pageBg",
2756
+ "cardBg",
2757
+ "infoBg"
2758
+ ]);
2759
+ const REQUIRED_COLOR_TOKENS = Object.entries(THEME_TOKEN_MAP).filter(([, descriptor]) => descriptor.fallback === void 0).map(([name]) => name);
2760
+ const TYPEBOX_THEME_DEPS_SYMBOL = /* @__PURE__ */ Symbol.for("atomic.typeboxThemeDeps.v1");
2761
+ let cachedValidator;
2762
+ function getThemeValidator() {
2763
+ if (cachedValidator !== void 0) return cachedValidator;
2764
+ const bundledDeps = globalThis[TYPEBOX_THEME_DEPS_SYMBOL];
2765
+ if (bundledDeps !== void 0) {
2766
+ cachedValidator = bundledDeps.Compile(createThemeJsonSchema(bundledDeps.Type));
2767
+ return cachedValidator;
2768
+ }
2769
+ const req = createModuleRequire(__atomicDistModuleUrl$2);
2770
+ const { Type } = req("@bastani/atomic-ai/utils/typebox/index");
2771
+ const { Compile } = req("@bastani/atomic-ai/utils/typebox/compile");
2772
+ cachedValidator = Compile(createThemeJsonSchema(Type));
2773
+ return cachedValidator;
2774
+ }
2775
+ function isPlainJsonObject(value) {
2776
+ if (typeof value !== "object" || value === null) return false;
2777
+ const proto = Object.getPrototypeOf(value);
2778
+ if (proto !== Object.prototype && proto !== null) return false;
2779
+ return Object.keys(value).length === Object.getOwnPropertyNames(value).length;
2780
+ }
2781
+ function isColorValue(value) {
2782
+ return typeof value === "string" || typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 255;
2783
+ }
2784
+ function isValidOptionalColorSection(value, allowedKeys) {
2785
+ if (!isPlainJsonObject(value)) return false;
2786
+ for (const [key, entry] of Object.entries(value)) if (!allowedKeys.has(key) || !isColorValue(entry)) return false;
2787
+ return true;
2788
+ }
2789
+ function isValidThemeJsonFast(json) {
2790
+ if (!isPlainJsonObject(json)) return false;
2791
+ for (const key of Object.keys(json)) if (!TOP_LEVEL_KEYS.has(key)) return false;
2792
+ if (Object.hasOwn(json, "$schema") && typeof json.$schema !== "string") return false;
2793
+ if (!Object.hasOwn(json, "name") || typeof json.name !== "string") return false;
2794
+ if (json.name.length === 0 || json.name.includes("/")) return false;
2795
+ if (Object.hasOwn(json, "vars")) {
2796
+ if (!isPlainJsonObject(json.vars)) return false;
2797
+ for (const entry of Object.values(json.vars)) if (!isColorValue(entry)) return false;
2798
+ }
2799
+ if (!Object.hasOwn(json, "colors") || !isPlainJsonObject(json.colors)) return false;
2800
+ for (const token of REQUIRED_COLOR_TOKENS) if (!Object.hasOwn(json.colors, token)) return false;
2801
+ for (const [key, entry] of Object.entries(json.colors)) if (!Object.hasOwn(THEME_TOKEN_MAP, key) || !isColorValue(entry)) return false;
2802
+ if (Object.hasOwn(json, "workingIndicator") && !isValidOptionalColorSection(json.workingIndicator, WORKING_INDICATOR_KEYS)) return false;
2803
+ if (Object.hasOwn(json, "export") && !isValidOptionalColorSection(json.export, EXPORT_KEYS)) return false;
2804
+ return true;
2805
+ }
2735
2806
  function assertThemeNameIsValid(name) {
2736
2807
  if (name.includes("/")) throw new Error(`Invalid theme name "${name}": theme names cannot contain "/" because it is reserved for automatic light/dark theme settings.`);
2737
2808
  }
2738
2809
  function parseThemeJson(label, json) {
2739
2810
  if (typeof json === "object" && json !== null && "name" in json && typeof json.name === "string") assertThemeNameIsValid(json.name);
2740
- if (!validateThemeJson.Check(json)) {
2741
- const errors = Array.from(validateThemeJson.Errors(json));
2811
+ if (isValidThemeJsonFast(json)) {
2812
+ assertThemeNameIsValid(json.name);
2813
+ return json;
2814
+ }
2815
+ const validator = getThemeValidator();
2816
+ if (!validator.Check(json)) {
2817
+ const errors = Array.from(validator.Errors(json));
2742
2818
  const missingColors = /* @__PURE__ */ new Set();
2743
2819
  const otherErrors = [];
2744
2820
  for (const error of errors) {
@@ -2750,14 +2826,20 @@ function parseThemeJson(label, json) {
2750
2826
  const path = error.instancePath || "/";
2751
2827
  otherErrors.push(` - ${path}: ${error.message}`);
2752
2828
  }
2753
- let errorMessage = `Invalid theme "${label}":\n`;
2829
+ let errorMessage = `Invalid theme "${label}":
2830
+ `;
2754
2831
  if (missingColors.size > 0) {
2755
2832
  errorMessage += "\nMissing required color tokens:\n";
2756
2833
  errorMessage += Array.from(missingColors).sort().map((color) => ` - ${color}`).join("\n");
2757
- errorMessage += "\n\nPlease add these colors to your theme's \"colors\" object.";
2834
+ errorMessage += `
2835
+
2836
+ Please add these colors to your theme's "colors" object.`;
2758
2837
  errorMessage += "\nSee the built-in themes (dark.json, light.json) for reference values.";
2759
2838
  }
2760
- if (otherErrors.length > 0) errorMessage += `\n\nOther errors:\n${otherErrors.join("\n")}`;
2839
+ if (otherErrors.length > 0) errorMessage += `
2840
+
2841
+ Other errors:
2842
+ ${otherErrors.join("\n")}`;
2761
2843
  throw new Error(errorMessage);
2762
2844
  }
2763
2845
  const themeJson = json;
@@ -3183,83 +3265,377 @@ function decodeHtmlEntityAt(html, index) {
3183
3265
  }
3184
3266
  // dist/utils/syntax-highlight.js
3185
3267
  const __atomicDistModuleUrl$1 = new URL("../utils/syntax-highlight.js", import.meta.url).href;
3186
- const EAGER_LANGUAGE_SPECIFIERS = [
3187
- ["python", "highlight.js/lib/languages/python.js"],
3188
- ["java", "highlight.js/lib/languages/java.js"],
3189
- ["go", "highlight.js/lib/languages/go.js"],
3190
- ["javascript", "highlight.js/lib/languages/javascript.js"],
3191
- ["cpp", "highlight.js/lib/languages/cpp.js"],
3192
- ["typescript", "highlight.js/lib/languages/typescript.js"],
3193
- ["php", "highlight.js/lib/languages/php.js"],
3194
- ["ruby", "highlight.js/lib/languages/ruby.js"],
3195
- ["c", "highlight.js/lib/languages/c.js"],
3196
- ["csharp", "highlight.js/lib/languages/csharp.js"],
3197
- ["nix", "highlight.js/lib/languages/nix.js"],
3198
- ["bash", "highlight.js/lib/languages/bash.js"],
3199
- ["rust", "highlight.js/lib/languages/rust.js"],
3200
- ["scala", "highlight.js/lib/languages/scala.js"],
3201
- ["kotlin", "highlight.js/lib/languages/kotlin.js"],
3202
- ["swift", "highlight.js/lib/languages/swift.js"],
3203
- ["dart", "highlight.js/lib/languages/dart.js"],
3204
- ["groovy", "highlight.js/lib/languages/groovy.js"],
3205
- ["perl", "highlight.js/lib/languages/perl.js"],
3206
- ["lua", "highlight.js/lib/languages/lua.js"]
3268
+ const EAGER_LANGUAGE_ENTRIES = [
3269
+ {
3270
+ name: "python",
3271
+ specifier: "highlight.js/lib/languages/python.js",
3272
+ aliases: [
3273
+ "py",
3274
+ "gyp",
3275
+ "ipython"
3276
+ ]
3277
+ },
3278
+ {
3279
+ name: "java",
3280
+ specifier: "highlight.js/lib/languages/java.js",
3281
+ aliases: ["jsp"]
3282
+ },
3283
+ {
3284
+ name: "go",
3285
+ specifier: "highlight.js/lib/languages/go.js",
3286
+ aliases: ["golang"]
3287
+ },
3288
+ {
3289
+ name: "javascript",
3290
+ specifier: "highlight.js/lib/languages/javascript.js",
3291
+ aliases: [
3292
+ "js",
3293
+ "jsx",
3294
+ "mjs",
3295
+ "cjs"
3296
+ ]
3297
+ },
3298
+ {
3299
+ name: "cpp",
3300
+ specifier: "highlight.js/lib/languages/cpp.js",
3301
+ aliases: [
3302
+ "cc",
3303
+ "c++",
3304
+ "h++",
3305
+ "hpp",
3306
+ "hh",
3307
+ "hxx",
3308
+ "cxx"
3309
+ ]
3310
+ },
3311
+ {
3312
+ name: "typescript",
3313
+ specifier: "highlight.js/lib/languages/typescript.js",
3314
+ aliases: ["ts", "tsx"]
3315
+ },
3316
+ {
3317
+ name: "php",
3318
+ specifier: "highlight.js/lib/languages/php.js",
3319
+ aliases: [
3320
+ "php3",
3321
+ "php4",
3322
+ "php5",
3323
+ "php6",
3324
+ "php7",
3325
+ "php8"
3326
+ ]
3327
+ },
3328
+ {
3329
+ name: "ruby",
3330
+ specifier: "highlight.js/lib/languages/ruby.js",
3331
+ aliases: [
3332
+ "rb",
3333
+ "gemspec",
3334
+ "podspec",
3335
+ "thor",
3336
+ "irb"
3337
+ ]
3338
+ },
3339
+ {
3340
+ name: "c",
3341
+ specifier: "highlight.js/lib/languages/c.js",
3342
+ aliases: ["h"]
3343
+ },
3344
+ {
3345
+ name: "csharp",
3346
+ specifier: "highlight.js/lib/languages/csharp.js",
3347
+ aliases: ["cs", "c#"]
3348
+ },
3349
+ {
3350
+ name: "nix",
3351
+ specifier: "highlight.js/lib/languages/nix.js",
3352
+ aliases: ["nixos"]
3353
+ },
3354
+ {
3355
+ name: "bash",
3356
+ specifier: "highlight.js/lib/languages/bash.js",
3357
+ aliases: ["sh", "zsh"]
3358
+ },
3359
+ {
3360
+ name: "rust",
3361
+ specifier: "highlight.js/lib/languages/rust.js",
3362
+ aliases: ["rs"]
3363
+ },
3364
+ {
3365
+ name: "scala",
3366
+ specifier: "highlight.js/lib/languages/scala.js",
3367
+ aliases: []
3368
+ },
3369
+ {
3370
+ name: "kotlin",
3371
+ specifier: "highlight.js/lib/languages/kotlin.js",
3372
+ aliases: ["kt", "kts"]
3373
+ },
3374
+ {
3375
+ name: "swift",
3376
+ specifier: "highlight.js/lib/languages/swift.js",
3377
+ aliases: []
3378
+ },
3379
+ {
3380
+ name: "dart",
3381
+ specifier: "highlight.js/lib/languages/dart.js",
3382
+ aliases: []
3383
+ },
3384
+ {
3385
+ name: "groovy",
3386
+ specifier: "highlight.js/lib/languages/groovy.js",
3387
+ aliases: []
3388
+ },
3389
+ {
3390
+ name: "perl",
3391
+ specifier: "highlight.js/lib/languages/perl.js",
3392
+ aliases: ["pl", "pm"]
3393
+ },
3394
+ {
3395
+ name: "lua",
3396
+ specifier: "highlight.js/lib/languages/lua.js",
3397
+ aliases: []
3398
+ }
3207
3399
  ];
3208
3400
  const BUNDLED_HIGHLIGHT_CORE_SYMBOL = /* @__PURE__ */ Symbol.for("atomic.bundledHighlightCore");
3401
+ const LAZY_EAGER_ENTRY_SYMBOL = /* @__PURE__ */ Symbol("atomic.lazyEagerHighlightEntry");
3209
3402
  let hljsCore;
3403
+ let hljsRequire;
3404
+ const loadedEagerLanguages = /* @__PURE__ */ new Set();
3405
+ function getHighlightRequire() {
3406
+ if (hljsRequire === void 0) hljsRequire = createModuleRequire(__atomicDistModuleUrl$1);
3407
+ return hljsRequire;
3408
+ }
3409
+ function materializeEagerEntry(core, entry) {
3410
+ const existing = core.getLanguage(entry.name);
3411
+ if (existing && existing[LAZY_EAGER_ENTRY_SYMBOL] !== entry) {
3412
+ loadedEagerLanguages.add(entry.name);
3413
+ return existing;
3414
+ }
3415
+ const mod = getHighlightRequire()(entry.specifier);
3416
+ const built = (mod.default ?? mod)(core);
3417
+ const aliases = built.aliases;
3418
+ core.registerLanguage(entry.name, () => ({
3419
+ ...built,
3420
+ aliases: void 0
3421
+ }));
3422
+ const registered = core.getLanguage(entry.name);
3423
+ if (aliases !== void 0) registered.aliases = [...aliases];
3424
+ else delete registered.aliases;
3425
+ loadedEagerLanguages.add(entry.name);
3426
+ return registered;
3427
+ }
3428
+ function registerLazyEagerProxy(core, entry) {
3429
+ const placeholder = { name: entry.name };
3430
+ let materialized;
3431
+ let registering = true;
3432
+ const materialize = () => {
3433
+ if (materialized === void 0) materialized = materializeEagerEntry(core, entry);
3434
+ return materialized;
3435
+ };
3436
+ const proxy = new Proxy(placeholder, {
3437
+ get(_target, prop) {
3438
+ if (prop === LAZY_EAGER_ENTRY_SYMBOL) return entry;
3439
+ if (registering && (prop === "name" || prop === "aliases")) return prop === "name" ? entry.name : void 0;
3440
+ const real = materialize();
3441
+ const value = Reflect.get(real, prop, real);
3442
+ return typeof value === "function" ? value.bind(real) : value;
3443
+ },
3444
+ set(_target, prop, value) {
3445
+ if (registering && (prop === "rawDefinition" || prop === "name")) {
3446
+ placeholder[prop] = value;
3447
+ return true;
3448
+ }
3449
+ const real = materialize();
3450
+ return Reflect.set(real, prop, value, real);
3451
+ },
3452
+ has(_target, prop) {
3453
+ if (prop === LAZY_EAGER_ENTRY_SYMBOL) return true;
3454
+ return Reflect.has(materialize(), prop);
3455
+ },
3456
+ ownKeys() {
3457
+ return Reflect.ownKeys(materialize());
3458
+ },
3459
+ getOwnPropertyDescriptor(_target, prop) {
3460
+ return Reflect.getOwnPropertyDescriptor(materialize(), prop);
3461
+ },
3462
+ defineProperty(_target, prop, descriptor) {
3463
+ return Reflect.defineProperty(materialize(), prop, descriptor);
3464
+ },
3465
+ deleteProperty(_target, prop) {
3466
+ return Reflect.deleteProperty(materialize(), prop);
3467
+ },
3468
+ getPrototypeOf() {
3469
+ return Reflect.getPrototypeOf(materialize());
3470
+ }
3471
+ });
3472
+ core.registerLanguage(entry.name, () => proxy);
3473
+ registering = false;
3474
+ }
3210
3475
  function getHighlightCore() {
3211
3476
  if (hljsCore !== void 0) return hljsCore;
3212
3477
  const bundled = globalThis[BUNDLED_HIGHLIGHT_CORE_SYMBOL];
3213
3478
  if (bundled !== void 0) {
3214
3479
  hljsCore = bundled;
3480
+ for (const entry of EAGER_LANGUAGE_ENTRIES) loadedEagerLanguages.add(entry.name);
3215
3481
  return bundled;
3216
3482
  }
3217
- const req = createModuleRequire(__atomicDistModuleUrl$1);
3218
- const loaded = req("highlight.js/lib/core.js");
3483
+ const loaded = getHighlightRequire()("highlight.js/lib/core.js");
3219
3484
  const core = loaded.default ?? loaded;
3220
- const eagerBuilt = EAGER_LANGUAGE_SPECIFIERS.map(([name, specifier]) => {
3221
- const mod = req(specifier);
3222
- return {
3485
+ for (const entry of EAGER_LANGUAGE_ENTRIES) if (core.getLanguage(entry.name) !== void 0) loadedEagerLanguages.add(entry.name);
3486
+ else registerLazyEagerProxy(core, entry);
3487
+ for (const entry of EAGER_LANGUAGE_ENTRIES) {
3488
+ const freeAliases = entry.aliases.filter((alias) => core.getLanguage(alias) === void 0);
3489
+ if (freeAliases.length > 0) core.registerAliases(freeAliases, { languageName: entry.name });
3490
+ }
3491
+ hljsCore = core;
3492
+ return core;
3493
+ }
3494
+ function materializeLanguageIfLazy(core, name) {
3495
+ const lazyEntry = core.getLanguage(name)?.[LAZY_EAGER_ENTRY_SYMBOL];
3496
+ if (lazyEntry !== void 0) materializeEagerEntry(core, lazyEntry);
3497
+ }
3498
+ function ensureAllEagerLanguages(core) {
3499
+ if (loadedEagerLanguages.size >= EAGER_LANGUAGE_ENTRIES.length) return;
3500
+ for (const entry of EAGER_LANGUAGE_ENTRIES) if (!loadedEagerLanguages.has(entry.name)) materializeEagerEntry(core, entry);
3501
+ }
3502
+ const HIGHLIGHT_INDEX_REGISTER_PREFIX = "hljs.registerLanguage('";
3503
+ const HIGHLIGHT_INDEX_REQUIRE_MARKER = "', require('";
3504
+ const HIGHLIGHT_INDEX_REQUIRE_SUFFIX = "'));";
3505
+ const HIGHLIGHT_CHUNK_BATCH_SIZE = 4;
3506
+ const HIGHLIGHT_CHUNK_SLICE_BUDGET_MS = 12;
3507
+ let allLanguagesLoaded = false;
3508
+ let highlightIndexEntries;
3509
+ let preloadedEagerIndex = 0;
3510
+ let registeredIndexCursor = 0;
3511
+ let activeHighlightLoadToken;
3512
+ const activeHighlightWaiters = /* @__PURE__ */ new Set();
3513
+ function parseHighlightIndexEntries(source, indexDir) {
3514
+ const entries = [];
3515
+ for (const rawLine of source.split("\n")) {
3516
+ const line = rawLine.trim();
3517
+ if (!line.startsWith(HIGHLIGHT_INDEX_REGISTER_PREFIX) || !line.endsWith(HIGHLIGHT_INDEX_REQUIRE_SUFFIX)) continue;
3518
+ const markerIndex = line.indexOf(HIGHLIGHT_INDEX_REQUIRE_MARKER, 23);
3519
+ if (markerIndex === -1) continue;
3520
+ const name = line.slice(23, markerIndex);
3521
+ const relPath = line.slice(markerIndex + 12, line.length - 4);
3522
+ if (name.length === 0 || !relPath.startsWith("./languages/") || relPath.includes("..")) continue;
3523
+ entries.push({
3223
3524
  name,
3224
- built: (mod.default ?? mod)(core)
3225
- };
3525
+ filePath: resolve$1(indexDir, relPath)
3526
+ });
3527
+ }
3528
+ return entries;
3529
+ }
3530
+ function nextEventLoopTurn() {
3531
+ return new Promise((resolveTurn) => {
3532
+ setImmediate(resolveTurn);
3226
3533
  });
3227
- const newlyRegistered = /* @__PURE__ */ new Set();
3228
- for (const { name, built } of eagerBuilt) if (core.getLanguage(name) === void 0) {
3229
- core.registerLanguage(name, () => ({
3230
- ...built,
3231
- aliases: void 0
3232
- }));
3233
- newlyRegistered.add(name);
3534
+ }
3535
+ function hasLiveHighlightWaiter() {
3536
+ for (const waiter of activeHighlightWaiters) if (!waiter.signal?.aborted) return true;
3537
+ return false;
3538
+ }
3539
+ async function resolveHighlightIndexEntries(req) {
3540
+ if (highlightIndexEntries !== void 0) return highlightIndexEntries;
3541
+ try {
3542
+ const indexPath = req.resolve("highlight.js/lib/index.js");
3543
+ const entries = parseHighlightIndexEntries(await readFile(indexPath, "utf8"), dirname$1(indexPath));
3544
+ if (entries.length > 0) {
3545
+ highlightIndexEntries = entries;
3546
+ return entries;
3547
+ }
3548
+ return null;
3549
+ } catch {
3550
+ return null;
3234
3551
  }
3235
- for (const { name, built } of eagerBuilt) {
3236
- const freeAliases = (built.aliases ?? []).filter((alias) => core.getLanguage(alias) === void 0);
3237
- if (freeAliases.length > 0) core.registerAliases(freeAliases, { languageName: name });
3238
- if (newlyRegistered.has(name)) {
3239
- const registered = core.getLanguage(name);
3240
- if (registered !== void 0) {
3241
- if (built.aliases !== void 0) registered.aliases = built.aliases;
3242
- else delete registered.aliases;
3552
+ }
3553
+ async function runChunkedHighlightLoad(token) {
3554
+ try {
3555
+ await nextEventLoopTurn();
3556
+ if (!hasLiveHighlightWaiter()) return;
3557
+ const req = globalThis[BUNDLED_HIGHLIGHT_CORE_SYMBOL] === void 0 ? createModuleRequire(__atomicDistModuleUrl$1) : void 0;
3558
+ const entries = req ? await resolveHighlightIndexEntries(req) : null;
3559
+ if (!hasLiveHighlightWaiter()) return;
3560
+ if (!req || entries === null) {
3561
+ try {
3562
+ const mod = await import("highlight.js/lib/index.js");
3563
+ const loaded = mod.default ?? mod;
3564
+ if (typeof loaded?.highlight === "function") {
3565
+ if (hljsCore === void 0) hljsCore = loaded;
3566
+ allLanguagesLoaded = true;
3567
+ }
3568
+ } catch {}
3569
+ return;
3570
+ }
3571
+ if (loadedEagerLanguages.size < EAGER_LANGUAGE_ENTRIES.length && preloadedEagerIndex < EAGER_LANGUAGE_ENTRIES.length) {
3572
+ if (hljsCore === void 0) {
3573
+ req("highlight.js/lib/core.js");
3574
+ await nextEventLoopTurn();
3243
3575
  }
3576
+ while (preloadedEagerIndex < EAGER_LANGUAGE_ENTRIES.length && hasLiveHighlightWaiter()) {
3577
+ const sliceStart = performance.now();
3578
+ const batchEnd = Math.min(EAGER_LANGUAGE_ENTRIES.length, preloadedEagerIndex + HIGHLIGHT_CHUNK_BATCH_SIZE);
3579
+ while (preloadedEagerIndex < batchEnd && hasLiveHighlightWaiter()) {
3580
+ const entry = EAGER_LANGUAGE_ENTRIES[preloadedEagerIndex];
3581
+ if (!loadedEagerLanguages.has(entry.name)) req(entry.specifier);
3582
+ preloadedEagerIndex += 1;
3583
+ if (performance.now() - sliceStart >= HIGHLIGHT_CHUNK_SLICE_BUDGET_MS) break;
3584
+ }
3585
+ if (preloadedEagerIndex < EAGER_LANGUAGE_ENTRIES.length && hasLiveHighlightWaiter()) await nextEventLoopTurn();
3586
+ }
3587
+ if (!hasLiveHighlightWaiter()) return;
3588
+ }
3589
+ const core = getHighlightCore();
3590
+ ensureAllEagerLanguages(core);
3591
+ while (registeredIndexCursor < entries.length && hasLiveHighlightWaiter()) {
3592
+ const sliceStart = performance.now();
3593
+ const batchEnd = Math.min(entries.length, registeredIndexCursor + HIGHLIGHT_CHUNK_BATCH_SIZE);
3594
+ while (registeredIndexCursor < batchEnd && hasLiveHighlightWaiter()) {
3595
+ const { name, filePath } = entries[registeredIndexCursor];
3596
+ if (!core.listLanguages().includes(name)) {
3597
+ const mod = req(filePath);
3598
+ const factory = mod.default ?? mod;
3599
+ core.registerLanguage(name, factory);
3600
+ }
3601
+ registeredIndexCursor += 1;
3602
+ if (performance.now() - sliceStart >= HIGHLIGHT_CHUNK_SLICE_BUDGET_MS) break;
3603
+ }
3604
+ if (registeredIndexCursor < entries.length && hasLiveHighlightWaiter()) await nextEventLoopTurn();
3605
+ }
3606
+ if (registeredIndexCursor >= entries.length) allLanguagesLoaded = true;
3607
+ } catch {} finally {
3608
+ if (activeHighlightLoadToken === token) activeHighlightLoadToken = void 0;
3609
+ const completed = [...activeHighlightWaiters];
3610
+ activeHighlightWaiters.clear();
3611
+ for (const waiter of completed) {
3612
+ waiter.cleanup();
3613
+ waiter.resolve();
3244
3614
  }
3245
3615
  }
3246
- hljsCore = core;
3247
- return core;
3248
3616
  }
3249
- let allLanguagesPromise;
3250
- function loadAllHighlightLanguages() {
3251
- if (!allLanguagesPromise) allLanguagesPromise = new Promise((resolve) => {
3252
- setImmediate(() => {
3253
- import("highlight.js/lib/index.js").then((mod) => {
3254
- const loaded = mod.default ?? mod;
3255
- if (hljsCore === void 0 && typeof loaded?.highlight === "function") hljsCore = loaded;
3256
- resolve();
3257
- }, () => {
3258
- resolve();
3259
- });
3260
- });
3617
+ function loadAllHighlightLanguages(options) {
3618
+ if (allLanguagesLoaded || options?.signal?.aborted) return Promise.resolve();
3619
+ return new Promise((resolveWaiter) => {
3620
+ const signal = options?.signal;
3621
+ const onAbort = () => {
3622
+ if (!activeHighlightWaiters.delete(waiter)) return;
3623
+ waiter.cleanup();
3624
+ resolveWaiter();
3625
+ };
3626
+ const waiter = {
3627
+ signal,
3628
+ resolve: resolveWaiter,
3629
+ cleanup: () => signal?.removeEventListener("abort", onAbort)
3630
+ };
3631
+ activeHighlightWaiters.add(waiter);
3632
+ signal?.addEventListener("abort", onAbort, { once: true });
3633
+ if (activeHighlightLoadToken === void 0) {
3634
+ const token = /* @__PURE__ */ Symbol("highlight-load");
3635
+ activeHighlightLoadToken = token;
3636
+ runChunkedHighlightLoad(token);
3637
+ }
3261
3638
  });
3262
- return allLanguagesPromise;
3263
3639
  }
3264
3640
  const SPAN_CLOSE = "</span>";
3265
3641
  const HIGHLIGHT_CLASS_PREFIX = "hljs-";
@@ -3341,6 +3717,9 @@ function renderHighlightedHtml(html, theme = {}) {
3341
3717
  }
3342
3718
  function highlight(code, options = {}) {
3343
3719
  const hljs = getHighlightCore();
3720
+ if (options.language) materializeLanguageIfLazy(hljs, options.language);
3721
+ else if (options.languageSubset) for (const lang of options.languageSubset) materializeLanguageIfLazy(hljs, lang);
3722
+ else ensureAllEagerLanguages(hljs);
3344
3723
  return renderHighlightedHtml(options.language ? hljs.highlight(code, {
3345
3724
  language: options.language,
3346
3725
  ignoreIllegals: options.ignoreIllegals
@@ -3770,7 +4149,7 @@ var CodeHighlighter = class {
3770
4149
  code,
3771
4150
  lang,
3772
4151
  theme: currentTheme,
3773
- languageCount,
4152
+ languageCount: getHighlightLanguageCount(),
3774
4153
  lines
3775
4154
  };
3776
4155
  return lines;
@@ -3880,8 +4259,6 @@ const requireFromHere = createRequire(__atomicDistModuleUrl);
3880
4259
  const fs$1 = requireFromHere("fs");
3881
4260
  const unpatchedReadFile = fs$1.readFileSync.bind(fs$1);
3882
4261
  const WASM_FILENAME = "photon_rs_bg.wasm";
3883
- let photonModule = null;
3884
- let loadPromise = null;
3885
4262
  function pathOrNull(file) {
3886
4263
  if (typeof file === "string") return file;
3887
4264
  if (file instanceof URL) return fileURLToPath(file);
@@ -3948,24 +4325,20 @@ function installPhotonWasmRead(wasmBytes) {
3948
4325
  }
3949
4326
  };
3950
4327
  }
3951
- async function loadPhoton() {
3952
- if (photonModule) return photonModule;
3953
- if (loadPromise) return loadPromise;
3954
- loadPromise = (async () => {
4328
+ const loadPhotonOnce = memoizeAsync(async () => {
4329
+ try {
4330
+ const restoreWasmRead = installPhotonWasmRead(await readPhotonWasmBytes());
3955
4331
  try {
3956
- const restoreWasmRead = installPhotonWasmRead(await readPhotonWasmBytes());
3957
- try {
3958
- photonModule = await import("@silvia-odwyer/photon-node");
3959
- return photonModule;
3960
- } finally {
3961
- restoreWasmRead();
3962
- }
3963
- } catch {
3964
- photonModule = null;
3965
- return photonModule;
4332
+ return await import("@silvia-odwyer/photon-node");
4333
+ } finally {
4334
+ restoreWasmRead();
3966
4335
  }
3967
- })();
3968
- return loadPromise;
4336
+ } catch {
4337
+ return null;
4338
+ }
4339
+ }, { shouldCache: (mod) => mod !== null });
4340
+ function loadPhoton() {
4341
+ return loadPhotonOnce();
3969
4342
  }
3970
4343
  // dist/utils/terminal-text.js
3971
4344
  /**