@bastani/atomic 0.10.20-alpha.1 → 0.10.20-alpha.2

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 (335) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/_shared/dist-KOELCESV.js +2 -2
  3. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  4. package/dist/_shared/lib-4PES5P4V.js +2 -2
  5. package/dist/_shared/mode-interactive-sdk-JXBZ3H27.js +72 -39
  6. package/dist/_shared/mode-interactive-sdk-JXBZ3H27.js.map +1 -1
  7. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +57 -18
  8. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
  9. package/dist/_shared/mode-shared-2QJSCUM6.js +59 -14
  10. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
  11. package/dist/_shared/p0-cli-BB45ZQY6.js +2 -2
  12. package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
  13. package/dist/_shared/p1b-elig-BY2G5BUE.js +6 -3
  14. package/dist/_shared/p1b-elig-BY2G5BUE.js.map +1 -1
  15. package/dist/_shared/runtime-O4KCSG4C.js +4 -4
  16. package/dist/_shared/sdk-5ZFNDXUJ.js +208 -54
  17. package/dist/_shared/sdk-5ZFNDXUJ.js.map +1 -1
  18. package/dist/_shared/session-data-AHTU7IS6.js +14 -7
  19. package/dist/_shared/session-data-AHTU7IS6.js.map +1 -1
  20. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  21. package/dist/_shared/settings-startup-HXQLSUWM.js +2 -2
  22. package/dist/_shared/settings-startup-HXQLSUWM.js.map +1 -1
  23. package/dist/_shared/{startup-0-0-FPPQF42L.js → startup-0-0-OWBJIX35.js} +161 -86
  24. package/dist/_shared/startup-0-0-OWBJIX35.js.map +1 -0
  25. package/dist/_shared/{startup-0-1-Q7GBLBEL.js → startup-0-1-DZYE4E5Z.js} +321 -17
  26. package/dist/_shared/startup-0-1-DZYE4E5Z.js.map +1 -0
  27. package/dist/_shared/{startup-0-2-JNYN24UI.js → startup-0-2-WFLTE4SC.js} +113 -6
  28. package/dist/_shared/startup-0-2-WFLTE4SC.js.map +1 -0
  29. package/dist/_shared/startup-0-3-DE2NCS6A.js +47 -23
  30. package/dist/_shared/startup-0-3-DE2NCS6A.js.map +1 -1
  31. package/dist/_shared/{startup-0-4-ZZXFKE55.js → startup-0-4-6XXL4JMZ.js} +37 -13
  32. package/dist/_shared/startup-0-4-6XXL4JMZ.js.map +1 -0
  33. package/dist/_shared/{startup-0-5-WN2IYA25.js → startup-0-5-DNS6FYS7.js} +126 -150
  34. package/dist/_shared/startup-0-5-DNS6FYS7.js.map +1 -0
  35. package/dist/_shared/startup-10-0-O6DAT7U4.js +93 -72
  36. package/dist/_shared/startup-10-0-O6DAT7U4.js.map +1 -1
  37. package/dist/_shared/startup-12-0-55AAXBJZ.js +3 -3
  38. package/dist/_shared/startup-14-0-MLX36RBG.js +5 -5
  39. package/dist/_shared/startup-15-0-E7RYG5YF.js +6 -6
  40. package/dist/_shared/startup-15-1-WQZBOTMZ.js +289 -122
  41. package/dist/_shared/startup-15-1-WQZBOTMZ.js.map +1 -1
  42. package/dist/_shared/startup-8-0-34CBHPZH.js +263 -145
  43. package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
  44. package/dist/_shared/{startup-8-1-QZMXUGHI.js → startup-8-1-VXBL37AI.js} +325 -10
  45. package/dist/_shared/startup-8-1-VXBL37AI.js.map +1 -0
  46. package/dist/_shared/storage-command-7MGXLJGZ.js +11 -273
  47. package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
  48. package/dist/_shared/storage-status-T6FUXRIM.js +4 -4
  49. package/dist/_shared/task-reference-stream-JWMUZSJX.js +1 -1
  50. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  51. package/dist/_shared/team-DOQKICG2.js +2 -2
  52. package/dist/_shared/tree-outline-MUEPK5B7.js +9 -2
  53. package/dist/_shared/tree-outline-MUEPK5B7.js.map +1 -1
  54. package/dist/binary-self-update.js +3 -3
  55. package/dist/builtin/intercom/broker/broker.bundle.mjs +46 -8
  56. package/dist/builtin/intercom/broker/broker.ts +1 -0
  57. package/dist/builtin/intercom/broker/client.ts +5 -1
  58. package/dist/builtin/intercom/broker/departed-children.ts +12 -6
  59. package/dist/builtin/intercom/broker/ended-child-wakes.ts +2 -0
  60. package/dist/builtin/intercom/index.bundle.mjs +130 -264
  61. package/dist/builtin/intercom/message-display.ts +42 -0
  62. package/dist/builtin/intercom/package.json +1 -1
  63. package/dist/builtin/intercom/types.ts +1 -0
  64. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  65. package/dist/builtin/mcp/package.json +1 -1
  66. package/dist/builtin/subagents/package.json +1 -1
  67. package/dist/builtin/subagents/src/extension/index.bundle.mjs +99 -20
  68. package/dist/builtin/web-access/index.bundle.mjs +15 -9
  69. package/dist/builtin/web-access/package.json +1 -1
  70. package/dist/cli/args.js +2 -2
  71. package/dist/cli/auth-cli.code.js +6 -6
  72. package/dist/cli/auth-cli.impl.js +3 -3
  73. package/dist/cli/auth-cli.js +3 -3
  74. package/dist/cli/blueprint-command.code.js +4 -4
  75. package/dist/cli/blueprint-command.impl.js +3 -3
  76. package/dist/cli/blueprint-command.js +3 -3
  77. package/dist/cli/intercom-command.code.js +3 -3
  78. package/dist/cli/intercom-command.impl.js +3 -3
  79. package/dist/cli/intercom-command.js +3 -3
  80. package/dist/cli/list-models.code.js +3 -3
  81. package/dist/cli/list-models.impl.js +3 -3
  82. package/dist/cli/list-models.js +3 -3
  83. package/dist/cli/session-picker.code.js +2 -2
  84. package/dist/cli/session-picker.impl.js +3 -3
  85. package/dist/cli/session-picker.js +3 -3
  86. package/dist/cli/startup-ui.code.js +2 -2
  87. package/dist/cli/startup-ui.impl.js +3 -3
  88. package/dist/cli/startup-ui.js +3 -3
  89. package/dist/cli/storage-command.impl.js +3 -3
  90. package/dist/cli/storage-command.js +3 -3
  91. package/dist/cli/storage-search-session.code.js +2 -2
  92. package/dist/cli/storage-search-session.impl.js +3 -3
  93. package/dist/cli/storage-search-session.js +3 -3
  94. package/dist/cli/team-command.code.js +2 -2
  95. package/dist/cli/team-command.impl.js +3 -3
  96. package/dist/cli/team-command.js +3 -3
  97. package/dist/cli.js +2 -2
  98. package/dist/core/agent-session-runtime.d.ts +14 -3
  99. package/dist/core/agent-session-types.d.ts +5 -1
  100. package/dist/core/debug.impl.js +3 -3
  101. package/dist/core/debug.js +3 -3
  102. package/dist/core/export-html/card-projection.code.js +74 -72
  103. package/dist/core/export-html/card-projection.code.js.map +1 -1
  104. package/dist/core/export-html/card-projection.impl.js +3 -3
  105. package/dist/core/export-html/card-projection.js +3 -3
  106. package/dist/core/export-html/index.code.js +12 -4
  107. package/dist/core/export-html/index.code.js.map +1 -1
  108. package/dist/core/export-html/index.impl.js +3 -3
  109. package/dist/core/export-html/index.js +3 -3
  110. package/dist/core/export-html/json-spans.impl.js +3 -3
  111. package/dist/core/export-html/json-spans.js +3 -3
  112. package/dist/core/export-html/oversized-render-inputs.code.js +1 -1
  113. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  114. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  115. package/dist/core/export-html/template.js +24 -23
  116. package/dist/core/export-html/tool-renderer.code.js +1 -1
  117. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  118. package/dist/core/export-html/tool-renderer.js +3 -3
  119. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  120. package/dist/core/extensions/jiti-loader.js +3 -3
  121. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  122. package/dist/core/extensions/jiti-static-loader.js +3 -3
  123. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  124. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  125. package/dist/core/extensions/loader-host-modules.js +3 -3
  126. package/dist/core/extensions/loader-virtual-modules.js +2 -2
  127. package/dist/core/extensions/runner-context.js +2 -2
  128. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  129. package/dist/core/intercom-broker-control-host.js +3 -3
  130. package/dist/core/intercom-broker-control.code.js +3 -3
  131. package/dist/core/intercom-broker-control.impl.js +3 -3
  132. package/dist/core/intercom-broker-control.js +3 -3
  133. package/dist/core/model-registry.js +2 -2
  134. package/dist/core/package-manager-storage-adapters.code.js +1 -1
  135. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  136. package/dist/core/package-manager-storage-adapters.js +3 -3
  137. package/dist/core/resume/failure.d.ts +1 -1
  138. package/dist/core/sdk.code.js +4 -4
  139. package/dist/core/sdk.impl.js +3 -3
  140. package/dist/core/sdk.js +3 -3
  141. package/dist/core/session-claims.d.ts +13 -2
  142. package/dist/core/session-load-events.d.ts +42 -0
  143. package/dist/core/session-manager-core.d.ts +13 -2
  144. package/dist/core/session-manager-core.js +211 -98
  145. package/dist/core/session-manager-core.js.map +1 -1
  146. package/dist/core/session-manager-errors.d.ts +2 -2
  147. package/dist/core/session-manager-list.impl.js +3 -3
  148. package/dist/core/session-manager-list.js +3 -3
  149. package/dist/core/session-manager.code.js +1 -1
  150. package/dist/core/session-manager.impl.js +3 -3
  151. package/dist/core/session-manager.js +3 -3
  152. package/dist/core/session-storage.code.js +1 -1
  153. package/dist/core/session-storage.impl.js +3 -3
  154. package/dist/core/session-storage.js +3 -3
  155. package/dist/core/settings-manager.js +2 -2
  156. package/dist/core/storage/index.js +2 -2
  157. package/dist/core/storage/node-sqlite-thread.js +2 -2
  158. package/dist/core/storage/node-sqlite.js +2 -2
  159. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  160. package/dist/core/storage/offline-snapshot-file.js +3 -3
  161. package/dist/core/storage/provider.js +2 -2
  162. package/dist/core/storage/schema-catalog.d.ts +2 -1
  163. package/dist/core/storage/schema-catalog.js +25 -6
  164. package/dist/core/storage/schema-catalog.js.map +1 -1
  165. package/dist/core/storage/selection.js +2 -2
  166. package/dist/core/storage/session/branch-fork-source.code.js +17 -4
  167. package/dist/core/storage/session/branch-fork-source.code.js.map +1 -1
  168. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  169. package/dist/core/storage/session/branch-fork-source.js +3 -3
  170. package/dist/core/storage/session/card-view.impl.js +3 -3
  171. package/dist/core/storage/session/card-view.js +3 -3
  172. package/dist/core/storage/session/child-reader.code.js +3 -3
  173. package/dist/core/storage/session/child-reader.impl.js +3 -3
  174. package/dist/core/storage/session/child-reader.js +3 -3
  175. package/dist/core/storage/session/chunked-resume-projection.code.js +1 -1
  176. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  177. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  178. package/dist/core/storage/session/expanded-child-details.code.js +3 -3
  179. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  180. package/dist/core/storage/session/expanded-child-details.js +3 -3
  181. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  182. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  183. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  184. package/dist/core/storage/session/fork-row-index.js +3 -3
  185. package/dist/core/storage/session/fork-staging.code.js +8 -4
  186. package/dist/core/storage/session/fork-staging.code.js.map +1 -1
  187. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  188. package/dist/core/storage/session/fork-staging.js +3 -3
  189. package/dist/core/storage/session/fork-window.code.js +29 -14
  190. package/dist/core/storage/session/fork-window.code.js.map +1 -1
  191. package/dist/core/storage/session/fork-window.impl.js +3 -3
  192. package/dist/core/storage/session/fork-window.js +3 -3
  193. package/dist/core/storage/session/history-pages.impl.js +3 -3
  194. package/dist/core/storage/session/history-pages.js +3 -3
  195. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  196. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  197. package/dist/core/storage/session/jsonl-session-store.d.ts +8 -4
  198. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  199. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  200. package/dist/core/storage/session/memory-session-store.d.ts +3 -3
  201. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  202. package/dist/core/storage/session/memory-session-store.js +3 -3
  203. package/dist/core/storage/session/parent-links.d.ts +122 -0
  204. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  205. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  206. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  207. package/dist/core/storage/session/released-history-files.code.js +3 -3
  208. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  209. package/dist/core/storage/session/released-history-files.js +3 -3
  210. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  211. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  212. package/dist/core/storage/session/session-resume.impl.js +3 -3
  213. package/dist/core/storage/session/session-resume.js +3 -3
  214. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  215. package/dist/core/storage/session/snapshot-cut.js +3 -3
  216. package/dist/core/storage/session/snapshot-history.code.js +5 -6
  217. package/dist/core/storage/session/snapshot-history.code.js.map +1 -1
  218. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  219. package/dist/core/storage/session/snapshot-history.js +3 -3
  220. package/dist/core/storage/session/sql-session-store.d.ts +4 -3
  221. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  222. package/dist/core/storage/session/sql-session-store.js +3 -3
  223. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  224. package/dist/core/storage/session/tree-outline.js +3 -3
  225. package/dist/core/storage/session/tree-presentation.code.js +1 -1
  226. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  227. package/dist/core/storage/session/tree-presentation.js +3 -3
  228. package/dist/core/storage/session/types.d.ts +9 -3
  229. package/dist/core/storage/session/usage-observations.js +1 -1
  230. package/dist/core/storage/storage-status.impl.js +3 -3
  231. package/dist/core/storage/storage-status.js +3 -3
  232. package/dist/core/storage/team.impl.js +3 -3
  233. package/dist/core/storage/team.js +3 -3
  234. package/dist/core/structured-output/index.impl.js +3 -3
  235. package/dist/core/structured-output/index.js +3 -3
  236. package/dist/core/tasks/task-completion-entry.code.js +1 -1
  237. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  238. package/dist/core/tasks/task-completion-entry.js +3 -3
  239. package/dist/core/tasks/task-file-history.code.js +3 -3
  240. package/dist/core/tasks/task-file-history.impl.js +3 -3
  241. package/dist/core/tasks/task-file-history.js +3 -3
  242. package/dist/core/tasks/task-reference-archive.code.js +5 -5
  243. package/dist/core/tasks/task-reference-archive.js +3 -3
  244. package/dist/core/tasks/task-reference-identity.code.js +1 -1
  245. package/dist/core/tasks/task-reference-identity.js +3 -3
  246. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  247. package/dist/core/tasks/task-reference-stream.js +3 -3
  248. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  249. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  250. package/dist/core/tasks/task-view-source.code.js +1 -1
  251. package/dist/core/tasks/task-view-source.impl.js +3 -3
  252. package/dist/core/tasks/task-view-source.js +3 -3
  253. package/dist/core/tools/read-url.code.js +3 -3
  254. package/dist/core/tools/read-url.impl.js +3 -3
  255. package/dist/core/tools/read-url.js +3 -3
  256. package/dist/core/worktree-snapshot/blob-store.js +2 -2
  257. package/dist/core/worktree-snapshot/errors.code.js +3 -3
  258. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  259. package/dist/core/worktree-snapshot/errors.js +3 -3
  260. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  261. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  262. package/dist/extensions/codemode/execute.code.js +2 -2
  263. package/dist/extensions/codemode/execute.impl.js +3 -3
  264. package/dist/extensions/codemode/execute.js +3 -3
  265. package/dist/extensions/codemode/renderer.code.js +12 -7
  266. package/dist/extensions/codemode/renderer.code.js.map +1 -1
  267. package/dist/extensions/codemode/renderer.impl.js +3 -3
  268. package/dist/extensions/codemode/renderer.js +3 -3
  269. package/dist/extensions/mcp/cli.code.js +2 -2
  270. package/dist/extensions/mcp/cli.impl.js +3 -3
  271. package/dist/extensions/mcp/cli.js +3 -3
  272. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  273. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  274. package/dist/extensions/mcp/cli.lazy.js +3 -3
  275. package/dist/extensions/mcp/runtime.impl.js +3 -3
  276. package/dist/extensions/mcp/runtime.js +3 -3
  277. package/dist/index.d.ts +5 -2
  278. package/dist/index.js +7 -7
  279. package/dist/main-first-time-setup.code.js +2 -2
  280. package/dist/main-first-time-setup.impl.js +3 -3
  281. package/dist/main-first-time-setup.js +3 -3
  282. package/dist/main.js +1 -1
  283. package/dist/modes/index.d.ts +1 -1
  284. package/dist/modes/interactive/components/intercom-wake-notice.d.ts +4 -0
  285. package/dist/modes/interactive/components/notice-line.d.ts +1 -1
  286. package/dist/modes/interactive/components/stored-tree-view.code.js +6 -5
  287. package/dist/modes/interactive/components/stored-tree-view.code.js.map +1 -1
  288. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  289. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  290. package/dist/modes/interactive/components/tool-block.d.ts +5 -1
  291. package/dist/modes/interactive/components/user-message-selector-archive.code.js +1 -1
  292. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  293. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  294. package/dist/modes/interactive-engine/isolated-runtime.d.ts +3 -3
  295. package/dist/modes/interactive-engine/protocol.d.ts +0 -4
  296. package/dist/modes/rpc/rpc-client-api.d.ts +5 -0
  297. package/dist/modes/rpc/rpc-types.d.ts +23 -5
  298. package/dist/package-manager-cli.code.js +7 -7
  299. package/dist/package-manager-cli.impl.js +3 -3
  300. package/dist/package-manager-cli.js +3 -3
  301. package/dist/rpc-entry.js +1 -1
  302. package/dist/startup-files.json +1 -1
  303. package/dist/startup-stages/10.js +1 -1
  304. package/dist/startup-stages/12.js +1 -1
  305. package/dist/startup-stages/13.js +2 -1
  306. package/dist/startup-stages/14.js +1 -0
  307. package/dist/startup-stages/4.js +1 -1
  308. package/dist/startup-stages/6.js +1 -1
  309. package/dist/startup-stages/7.js +1 -1
  310. package/dist/startup-stages/8.js +1 -1
  311. package/dist/startup-stages/stages.json +1 -1
  312. package/dist/utils/startup-database-spare.code.js +3 -3
  313. package/dist/utils/startup-database-spare.impl.js +3 -3
  314. package/dist/utils/startup-database-spare.js +3 -3
  315. package/dist/utils/tools-manager.code.js +1 -1
  316. package/dist/utils/tools-manager.impl.js +3 -3
  317. package/dist/utils/tools-manager.js +3 -3
  318. package/docs/.agents/context/DESIGN.md +30 -0
  319. package/docs/changelog.mdx +23 -0
  320. package/docs/docs.json +1 -1
  321. package/docs/guides/subscription-usage.md +3 -3
  322. package/docs/intercom.md +3 -1
  323. package/docs/json.md +3 -3
  324. package/docs/providers.md +2 -0
  325. package/docs/rpc/protocol.md +1 -1
  326. package/docs/sdk.md +2 -0
  327. package/docs/sessions.md +36 -1
  328. package/docs/subagents.md +2 -0
  329. package/package.json +8 -8
  330. package/dist/_shared/startup-0-0-FPPQF42L.js.map +0 -1
  331. package/dist/_shared/startup-0-1-Q7GBLBEL.js.map +0 -1
  332. package/dist/_shared/startup-0-2-JNYN24UI.js.map +0 -1
  333. package/dist/_shared/startup-0-4-ZZXFKE55.js.map +0 -1
  334. package/dist/_shared/startup-0-5-WN2IYA25.js.map +0 -1
  335. package/dist/_shared/startup-8-1-QZMXUGHI.js.map +0 -1
@@ -11090,6 +11090,39 @@ import { Socket } from "node:net";
11090
11090
  // dist/builtin/intercom/broker/departed-children.ts
11091
11091
  init_group();
11092
11092
  import { randomUUID as randomUUID6 } from "node:crypto";
11093
+
11094
+ // dist/builtin/intercom/message-display.ts
11095
+ function splitsUtf16SurrogatePair(text, index) {
11096
+ if (index <= 0 || index >= text.length)
11097
+ return false;
11098
+ const prev = text.charCodeAt(index - 1);
11099
+ const curr = text.charCodeAt(index);
11100
+ return prev >= 55296 && prev <= 56319 && curr >= 56320 && curr <= 57343;
11101
+ }
11102
+ function extractProjectedDisplayText(content) {
11103
+ const text = content.text;
11104
+ const ranges = content.displayRanges;
11105
+ if (!Array.isArray(ranges) || ranges.length === 0)
11106
+ return text;
11107
+ const parts = [];
11108
+ let lastEnd = 0;
11109
+ let totalProjectedLength = 0;
11110
+ for (const range of ranges) {
11111
+ if (typeof range !== "object" || range === null || Array.isArray(range) || typeof range.start !== "number" || typeof range.end !== "number" || !Number.isSafeInteger(range.start) || !Number.isSafeInteger(range.end) || range.start < lastEnd || range.end <= range.start || range.end > text.length || splitsUtf16SurrogatePair(text, range.start) || splitsUtf16SurrogatePair(text, range.end)) {
11112
+ return text;
11113
+ }
11114
+ const sliceLength = range.end - range.start;
11115
+ totalProjectedLength += sliceLength;
11116
+ if (totalProjectedLength > text.length)
11117
+ return text;
11118
+ parts.push(text.slice(range.start, range.end));
11119
+ lastEnd = range.end;
11120
+ }
11121
+ const projected = parts.join("");
11122
+ return projected.trim().length > 0 ? projected : text;
11123
+ }
11124
+
11125
+ // dist/builtin/intercom/broker/departed-children.ts
11093
11126
  init_ended_child_wakes();
11094
11127
  init_group_membership();
11095
11128
  init_recipient_gone_errors();
@@ -11238,7 +11271,7 @@ class DepartedChildren {
11238
11271
  this.journalAll(departure);
11239
11272
  if (messages === "wake" && departure.wake === undefined) {
11240
11273
  const first = this.firstWaker(departure);
11241
- const started = first === undefined ? undefined : this.startWake(departure, first);
11274
+ const started = first === undefined ? undefined : this.startWake(departure, first.sender, first.held);
11242
11275
  if (started?.ok === false)
11243
11276
  this.failQueued(departure, () => notResumedReason(departure.childName, started.why));
11244
11277
  else if (started !== undefined)
@@ -11470,7 +11503,7 @@ class DepartedChildren {
11470
11503
  }
11471
11504
  let wake;
11472
11505
  if (messages === "wake" && verdict !== undefined && ownerHere && departure.wake === undefined && !ownerHolds) {
11473
- const started = this.startWake(departure, sender);
11506
+ const started = this.startWake(departure, sender, held);
11474
11507
  if (!started.ok) {
11475
11508
  const error = this.errorFor(departure, ended, target);
11476
11509
  return { kind: "refused", error, reason: `${error.message} It was not resumed for this message: ${started.why}.` };
@@ -11505,7 +11538,7 @@ class DepartedChildren {
11505
11538
  this.heldTotal += 1;
11506
11539
  this.queuedIds.set(held.messageId, departure);
11507
11540
  }
11508
- startWake(departure, sender) {
11541
+ startWake(departure, sender, held) {
11509
11542
  const budget = this.wakes?.budget?.check(departure.key, sender.wakeKey) ?? { ok: true, depth: 1 };
11510
11543
  if (!budget.ok)
11511
11544
  return budget;
@@ -11515,6 +11548,8 @@ class DepartedChildren {
11515
11548
  this.armQueueTimer(departure, ENDED_CHILD_WAKE_ANSWER_MS, "its launching session did not answer");
11516
11549
  this.wakes?.journal?.wake(this.journalDeparture(departure), { id, depth: budget.depth });
11517
11550
  const childId = departure.verdict?.kind === "ended" ? departure.verdict.childId : departure.restored?.childId;
11551
+ const content = held.clientMessage.message?.content;
11552
+ const messageText = typeof content?.text === "string" ? extractProjectedDisplayText(content) : undefined;
11518
11553
  return {
11519
11554
  ok: true,
11520
11555
  wake: {
@@ -11523,7 +11558,8 @@ class DepartedChildren {
11523
11558
  ...childId === undefined ? {} : { childId },
11524
11559
  wakeId: id,
11525
11560
  waker: sender.waker,
11526
- depth: budget.depth
11561
+ depth: budget.depth,
11562
+ ...messageText === undefined ? {} : { messageText }
11527
11563
  }
11528
11564
  };
11529
11565
  }
@@ -11565,7 +11601,7 @@ class DepartedChildren {
11565
11601
  this.wakes.journal?.ownerAway([this.journalDeparture(departure)], departure.awaySince);
11566
11602
  } else if (departure.verdict?.kind === "ended" && departure.verdict.messages === "wake" && departure.wake === undefined) {
11567
11603
  const first = this.firstWaker(departure);
11568
- const started = first === undefined ? undefined : this.startWake(departure, first);
11604
+ const started = first === undefined ? undefined : this.startWake(departure, first.sender, first.held);
11569
11605
  if (started?.ok === false)
11570
11606
  this.failQueued(departure, () => notResumedReason(departure.childName, started.why));
11571
11607
  else if (started !== undefined)
@@ -11576,8 +11612,9 @@ class DepartedChildren {
11576
11612
  return wakes;
11577
11613
  }
11578
11614
  firstWaker(departure) {
11579
- const first = departure.queued.find((held) => !isMaybeDelivered(held));
11580
- return first === undefined ? undefined : this.wakeSenders.get(first);
11615
+ const held = departure.queued.find((message) => !isMaybeDelivered(message));
11616
+ const sender = held === undefined ? undefined : this.wakeSenders.get(held);
11617
+ return held === undefined || sender === undefined ? undefined : { held, sender };
11581
11618
  }
11582
11619
  dropQueued(messageIds, own) {
11583
11620
  const dropped = [];
@@ -20257,7 +20294,8 @@ class IntercomBroker {
20257
20294
  ...wake.childId === undefined ? {} : { childId: wake.childId },
20258
20295
  wakeId: wake.wakeId,
20259
20296
  from: wake.waker,
20260
- depth: wake.depth
20297
+ depth: wake.depth,
20298
+ ...wake.messageText === undefined ? {} : { messageText: wake.messageText }
20261
20299
  });
20262
20300
  }
20263
20301
  failQueuedForWake(failures) {
@@ -2770,6 +2770,7 @@ class IntercomBroker {
2770
2770
  wakeId: wake.wakeId,
2771
2771
  from: wake.waker,
2772
2772
  depth: wake.depth,
2773
+ ...(wake.messageText === undefined ? {} : { messageText: wake.messageText }),
2773
2774
  });
2774
2775
  }
2775
2776
 
@@ -293,6 +293,8 @@ export interface EndedChildWakeNotice {
293
293
  readonly wakeId: string;
294
294
  /** The sender of the message that woke it. */
295
295
  readonly from: { readonly id: string; readonly name?: string };
296
+ /** Display text only; older brokers do not send it. */
297
+ readonly messageText?: string;
296
298
  /** How far down a chain of wakes this one is (1: its sender was not itself woken). */
297
299
  readonly depth: number;
298
300
  }
@@ -1199,7 +1201,7 @@ export class IntercomClient extends EventEmitter {
1199
1201
  break;
1200
1202
  }
1201
1203
  case "ended_child_wake": {
1202
- const { childName, childId, wakeId, from, depth } = brokerMessage;
1204
+ const { childName, childId, wakeId, from, depth, messageText } = brokerMessage;
1203
1205
  const waker = from as { id?: unknown; name?: unknown } | undefined;
1204
1206
  if (
1205
1207
  typeof childName !== "string" ||
@@ -1209,6 +1211,7 @@ export class IntercomClient extends EventEmitter {
1209
1211
  waker === null ||
1210
1212
  typeof waker.id !== "string" ||
1211
1213
  (waker.name !== undefined && typeof waker.name !== "string") ||
1214
+ (messageText !== undefined && typeof messageText !== "string") ||
1212
1215
  typeof depth !== "number"
1213
1216
  ) {
1214
1217
  throw new Error("Invalid ended_child_wake message");
@@ -1220,6 +1223,7 @@ export class IntercomClient extends EventEmitter {
1220
1223
  wakeId,
1221
1224
  from: { id: waker.id, ...(typeof waker.name === "string" ? { name: waker.name } : {}) },
1222
1225
  depth,
1226
+ ...(messageText === undefined ? {} : { messageText }),
1223
1227
  };
1224
1228
  this.emit("ended_child_wake", notice);
1225
1229
  break;
@@ -1,5 +1,6 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { hasGroup, normalizeGroup } from "../group.js";
3
+ import { extractProjectedDisplayText } from "../message-display.js";
3
4
  import type { ReleasedChildRefusal } from "../types.js";
4
5
  import { intercomMessageBytes } from "../message-size.js";
5
6
  import type { Message } from "../types.js";
@@ -473,7 +474,7 @@ export class DepartedChildren {
473
474
  if (restored !== undefined && restored.messages !== messages) this.journalAll(departure);
474
475
  if (messages === "wake" && departure.wake === undefined) {
475
476
  const first = this.firstWaker(departure);
476
- const started = first === undefined ? undefined : this.startWake(departure, first);
477
+ const started = first === undefined ? undefined : this.startWake(departure, first.sender, first.held);
477
478
  if (started?.ok === false)
478
479
  this.failQueued(departure, () => notResumedReason(departure.childName, started.why));
479
480
  else if (started !== undefined) wakes.push(started.wake);
@@ -788,7 +789,7 @@ export class DepartedChildren {
788
789
  // A child stopped on purpose is not woken: the message waits for its owner to continue it. Nor is one whose owner is
789
790
  // away, or has not reported it since a restart: its owner is asked once it is back and has.
790
791
  if (messages === "wake" && verdict !== undefined && ownerHere && departure.wake === undefined && !ownerHolds) {
791
- const started = this.startWake(departure, sender);
792
+ const started = this.startWake(departure, sender, held);
792
793
  if (!started.ok) {
793
794
  const error = this.errorFor(departure, ended, target);
794
795
  return { kind: "refused", error, reason: `${error.message} It was not resumed for this message: ${started.why}.` };
@@ -838,6 +839,7 @@ export class DepartedChildren {
838
839
  private startWake(
839
840
  departure: Departure,
840
841
  sender: WakeSender,
842
+ held: HeldSend,
841
843
  ): { readonly ok: true; readonly wake: EndedChildWakeRequest } | { readonly ok: false; readonly why: string } {
842
844
  const budget = this.wakes?.budget?.check(departure.key, sender.wakeKey) ?? { ok: true as const, depth: 1 };
843
845
  if (!budget.ok) return budget;
@@ -847,6 +849,8 @@ export class DepartedChildren {
847
849
  this.armQueueTimer(departure, ENDED_CHILD_WAKE_ANSWER_MS, "its launching session did not answer");
848
850
  this.wakes?.journal?.wake(this.journalDeparture(departure), { id, depth: budget.depth });
849
851
  const childId = departure.verdict?.kind === "ended" ? departure.verdict.childId : departure.restored?.childId;
852
+ const content = (held.clientMessage.message as Message | undefined)?.content;
853
+ const messageText = typeof content?.text === "string" ? extractProjectedDisplayText(content) : undefined;
850
854
  return {
851
855
  ok: true,
852
856
  wake: {
@@ -856,6 +860,7 @@ export class DepartedChildren {
856
860
  wakeId: id,
857
861
  waker: sender.waker,
858
862
  depth: budget.depth,
863
+ ...(messageText === undefined ? {} : { messageText }),
859
864
  },
860
865
  };
861
866
  }
@@ -919,7 +924,7 @@ export class DepartedChildren {
919
924
  this.wakes.journal?.ownerAway([this.journalDeparture(departure)], departure.awaySince);
920
925
  } else if (departure.verdict?.kind === "ended" && departure.verdict.messages === "wake" && departure.wake === undefined) {
921
926
  const first = this.firstWaker(departure);
922
- const started = first === undefined ? undefined : this.startWake(departure, first);
927
+ const started = first === undefined ? undefined : this.startWake(departure, first.sender, first.held);
923
928
  if (started?.ok === false) this.failQueued(departure, () => notResumedReason(departure.childName, started.why));
924
929
  else if (started !== undefined) wakes.push(started.wake);
925
930
  }
@@ -932,9 +937,10 @@ export class DepartedChildren {
932
937
  * Who to name as waking the child for its queue: the sender of its first message never handed over to it. Undefined
933
938
  * when every message may already have reached it (an earlier broker handed them over): those wake nobody.
934
939
  */
935
- private firstWaker(departure: Departure): WakeSender | undefined {
936
- const first = departure.queued.find((held) => !isMaybeDelivered(held));
937
- return first === undefined ? undefined : this.wakeSenders.get(first);
940
+ private firstWaker(departure: Departure): { held: HeldSend; sender: WakeSender } | undefined {
941
+ const held = departure.queued.find((message) => !isMaybeDelivered(message));
942
+ const sender = held === undefined ? undefined : this.wakeSenders.get(held);
943
+ return held === undefined || sender === undefined ? undefined : { held, sender };
938
944
  }
939
945
 
940
946
  /**
@@ -85,6 +85,8 @@ export interface EndedChildWakeRequest {
85
85
  /** Names this wake; the owner's answer must carry it. */
86
86
  readonly wakeId: string;
87
87
  readonly waker: EndedChildWaker;
88
+ /** The waking message's display text, without attachments. */
89
+ readonly messageText?: string;
88
90
  /** How far down a chain of wakes this one is (1: its sender was not itself woken). */
89
91
  readonly depth: number;
90
92
  }