@bastani/atomic 0.10.4-alpha.2 → 0.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/CHANGELOG.md +194 -0
  2. package/dist/_shared/chunk-CDOYTDYM.js +4 -0
  3. package/dist/_shared/chunk-CDOYTDYM.js.map +1 -0
  4. package/dist/_shared/fork-row-index-UAUAQRD5.js +1 -1
  5. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +2 -2
  6. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +1 -1
  7. package/dist/_shared/mode-shared-HP7GUA7J.js +4 -4
  8. package/dist/_shared/sdk-WQIOHVKO.js +1 -1
  9. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  10. package/dist/_shared/sql-session-store-5FD3WBMZ.js +9 -9
  11. package/dist/_shared/startup-0-0-X4NF3GKM.js +9 -5
  12. package/dist/_shared/startup-0-0-X4NF3GKM.js.map +1 -1
  13. package/dist/_shared/startup-0-2-KFDYPDJK.js +1 -1
  14. package/dist/_shared/startup-0-3-T4DVFYWX.js +2 -2
  15. package/dist/_shared/startup-0-4-HN5EB4K7.js +1 -1
  16. package/dist/_shared/startup-0-5-OHJNE6JH.js +3 -3
  17. package/dist/_shared/startup-10-0-TDQNBDDL.js +3 -3
  18. package/dist/_shared/startup-15-1-4S7FLMNG.js +14 -14
  19. package/dist/_shared/startup-8-0-34CBHPZH.js +23 -23
  20. package/dist/_shared/startup-8-1-KQJBDKRU.js +12 -12
  21. package/dist/_shared/storage-command-7MGXLJGZ.js +4 -4
  22. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +1 -1
  23. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  24. package/dist/builtin/intercom/CHANGELOG.md +38 -0
  25. package/dist/builtin/intercom/index.bundle.mjs +1 -1
  26. package/dist/builtin/intercom/package.json +1 -1
  27. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  28. package/dist/builtin/mcp/package.json +1 -1
  29. package/dist/builtin/subagents/CHANGELOG.md +40 -0
  30. package/dist/builtin/subagents/package.json +1 -1
  31. package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
  32. package/dist/builtin/web-access/CHANGELOG.md +12 -0
  33. package/dist/builtin/web-access/index.bundle.mjs +1 -1
  34. package/dist/builtin/web-access/package.json +1 -1
  35. package/dist/cli/auth-cli.impl.js +1102 -0
  36. package/dist/cli/auth-cli.impl.js.map +1 -0
  37. package/dist/cli/auth-cli.js +28 -1098
  38. package/dist/cli/auth-cli.js.map +1 -1
  39. package/dist/cli/blueprint-command.impl.js +906 -0
  40. package/dist/cli/blueprint-command.impl.js.map +1 -0
  41. package/dist/cli/blueprint-command.js +27 -901
  42. package/dist/cli/blueprint-command.js.map +1 -1
  43. package/dist/cli/intercom-command.impl.js +108 -0
  44. package/dist/cli/intercom-command.impl.js.map +1 -0
  45. package/dist/cli/intercom-command.js +29 -105
  46. package/dist/cli/intercom-command.js.map +1 -1
  47. package/dist/cli/list-models.impl.js +60 -0
  48. package/dist/cli/list-models.impl.js.map +1 -0
  49. package/dist/cli/list-models.js +29 -57
  50. package/dist/cli/list-models.js.map +1 -1
  51. package/dist/cli/session-picker.impl.js +55 -0
  52. package/dist/cli/session-picker.impl.js.map +1 -0
  53. package/dist/cli/session-picker.js +30 -53
  54. package/dist/cli/session-picker.js.map +1 -1
  55. package/dist/cli/startup-ui.impl.js +5 -0
  56. package/dist/cli/startup-ui.impl.js.map +1 -0
  57. package/dist/cli/startup-ui.js +31 -4
  58. package/dist/cli/storage-command.impl.js +3 -0
  59. package/dist/cli/storage-command.impl.js.map +1 -0
  60. package/dist/cli/storage-command.js +31 -2
  61. package/dist/cli/storage-search-session.impl.js +189 -0
  62. package/dist/cli/storage-search-session.impl.js.map +1 -0
  63. package/dist/cli/storage-search-session.js +29 -186
  64. package/dist/cli/storage-search-session.js.map +1 -1
  65. package/dist/cli/team-command.impl.js +217 -0
  66. package/dist/cli/team-command.impl.js.map +1 -0
  67. package/dist/cli/team-command.js +29 -214
  68. package/dist/cli/team-command.js.map +1 -1
  69. package/dist/core/debug.impl.js +3 -0
  70. package/dist/core/debug.impl.js.map +1 -0
  71. package/dist/core/debug.js +31 -2
  72. package/dist/core/export-html/card-projection.impl.js +257 -0
  73. package/dist/core/export-html/card-projection.impl.js.map +1 -0
  74. package/dist/core/export-html/card-projection.js +30 -255
  75. package/dist/core/export-html/card-projection.js.map +1 -1
  76. package/dist/core/export-html/index.impl.js +610 -0
  77. package/dist/core/export-html/index.impl.js.map +1 -0
  78. package/dist/core/export-html/index.js +28 -606
  79. package/dist/core/export-html/index.js.map +1 -1
  80. package/dist/core/export-html/json-spans.impl.js +3 -0
  81. package/dist/core/export-html/json-spans.impl.js.map +1 -0
  82. package/dist/core/export-html/json-spans.js +31 -2
  83. package/dist/core/export-html/oversized-render-inputs.impl.js +125 -0
  84. package/dist/core/export-html/oversized-render-inputs.impl.js.map +1 -0
  85. package/dist/core/export-html/oversized-render-inputs.js +28 -121
  86. package/dist/core/export-html/oversized-render-inputs.js.map +1 -1
  87. package/dist/core/export-html/tool-renderer.impl.js +350 -0
  88. package/dist/core/export-html/tool-renderer.impl.js.map +1 -0
  89. package/dist/core/export-html/tool-renderer.js +29 -347
  90. package/dist/core/export-html/tool-renderer.js.map +1 -1
  91. package/dist/core/extensions/jiti-loader.impl.js +3 -0
  92. package/dist/core/extensions/jiti-loader.impl.js.map +1 -0
  93. package/dist/core/extensions/jiti-loader.js +31 -2
  94. package/dist/core/extensions/jiti-static-loader.impl.js +3 -0
  95. package/dist/core/extensions/jiti-static-loader.impl.js.map +1 -0
  96. package/dist/core/extensions/jiti-static-loader.js +31 -2
  97. package/dist/core/extensions/loader-host-modules.impl.js +3 -0
  98. package/dist/core/extensions/loader-host-modules.impl.js.map +1 -0
  99. package/dist/core/extensions/loader-host-modules.js +31 -2
  100. package/dist/core/intercom-broker-control-host.impl.js +5 -0
  101. package/dist/core/intercom-broker-control-host.impl.js.map +1 -0
  102. package/dist/core/intercom-broker-control-host.js +31 -4
  103. package/dist/core/intercom-broker-control.impl.js +18 -0
  104. package/dist/core/intercom-broker-control.impl.js.map +1 -0
  105. package/dist/core/intercom-broker-control.js +31 -17
  106. package/dist/core/intercom-broker-control.js.map +1 -1
  107. package/dist/core/package-manager-storage-adapters.impl.js +3 -0
  108. package/dist/core/package-manager-storage-adapters.impl.js.map +1 -0
  109. package/dist/core/package-manager-storage-adapters.js +31 -2
  110. package/dist/core/sdk.impl.js +9 -0
  111. package/dist/core/sdk.impl.js.map +1 -0
  112. package/dist/core/sdk.js +31 -8
  113. package/dist/core/session-manager-core.js +21 -21
  114. package/dist/core/session-manager-list.impl.js +3 -0
  115. package/dist/core/session-manager-list.impl.js.map +1 -0
  116. package/dist/core/session-manager-list.js +31 -2
  117. package/dist/core/session-manager.impl.js +8 -0
  118. package/dist/core/session-manager.impl.js.map +1 -0
  119. package/dist/core/session-manager.js +31 -7
  120. package/dist/core/session-storage.impl.js +3 -0
  121. package/dist/core/session-storage.impl.js.map +1 -0
  122. package/dist/core/session-storage.js +31 -2
  123. package/dist/core/storage/index.js +6 -6
  124. package/dist/core/storage/node-sqlite-thread.js +1 -1
  125. package/dist/core/storage/node-sqlite.js +1 -1
  126. package/dist/core/storage/offline-snapshot-file.impl.js +37 -0
  127. package/dist/core/storage/offline-snapshot-file.impl.js.map +1 -0
  128. package/dist/core/storage/offline-snapshot-file.js +30 -35
  129. package/dist/core/storage/offline-snapshot-file.js.map +1 -1
  130. package/dist/core/storage/provider.js +5 -5
  131. package/dist/core/storage/selection.js +3 -3
  132. package/dist/core/storage/session/branch-fork-source.impl.js +101 -0
  133. package/dist/core/storage/session/branch-fork-source.impl.js.map +1 -0
  134. package/dist/core/storage/session/branch-fork-source.js +29 -98
  135. package/dist/core/storage/session/branch-fork-source.js.map +1 -1
  136. package/dist/core/storage/session/card-view.impl.js +60 -0
  137. package/dist/core/storage/session/card-view.impl.js.map +1 -0
  138. package/dist/core/storage/session/card-view.js +30 -58
  139. package/dist/core/storage/session/card-view.js.map +1 -1
  140. package/dist/core/storage/session/child-reader.impl.js +94 -0
  141. package/dist/core/storage/session/child-reader.impl.js.map +1 -0
  142. package/dist/core/storage/session/child-reader.js +29 -91
  143. package/dist/core/storage/session/child-reader.js.map +1 -1
  144. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -0
  145. package/dist/core/storage/session/chunked-resume-projection.impl.js.map +1 -0
  146. package/dist/core/storage/session/chunked-resume-projection.js +31 -2
  147. package/dist/core/storage/session/expanded-child-details.impl.js +639 -0
  148. package/dist/core/storage/session/expanded-child-details.impl.js.map +1 -0
  149. package/dist/core/storage/session/expanded-child-details.js +28 -635
  150. package/dist/core/storage/session/expanded-child-details.js.map +1 -1
  151. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -0
  152. package/dist/core/storage/session/fork-row-bytes.impl.js.map +1 -0
  153. package/dist/core/storage/session/fork-row-bytes.js +31 -2
  154. package/dist/core/storage/session/fork-row-index.impl.js +3 -0
  155. package/dist/core/storage/session/fork-row-index.impl.js.map +1 -0
  156. package/dist/core/storage/session/fork-row-index.js +31 -2
  157. package/dist/core/storage/session/fork-staging.impl.js +580 -0
  158. package/dist/core/storage/session/fork-staging.impl.js.map +1 -0
  159. package/dist/core/storage/session/fork-staging.js +27 -575
  160. package/dist/core/storage/session/fork-staging.js.map +1 -1
  161. package/dist/core/storage/session/fork-window.impl.js +477 -0
  162. package/dist/core/storage/session/fork-window.impl.js.map +1 -0
  163. package/dist/core/storage/session/fork-window.js +27 -472
  164. package/dist/core/storage/session/fork-window.js.map +1 -1
  165. package/dist/core/storage/session/history-pages.impl.js +3 -0
  166. package/dist/core/storage/session/history-pages.impl.js.map +1 -0
  167. package/dist/core/storage/session/history-pages.js +31 -2
  168. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -0
  169. package/dist/core/storage/session/jsonl-entry-projection.impl.js.map +1 -0
  170. package/dist/core/storage/session/jsonl-entry-projection.js +31 -2
  171. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -0
  172. package/dist/core/storage/session/jsonl-session-store.impl.js.map +1 -0
  173. package/dist/core/storage/session/jsonl-session-store.js +31 -2
  174. package/dist/core/storage/session/memory-session-store.impl.js +3 -0
  175. package/dist/core/storage/session/memory-session-store.impl.js.map +1 -0
  176. package/dist/core/storage/session/memory-session-store.js +31 -2
  177. package/dist/core/storage/session/pinned-branch-resume.impl.js +72 -0
  178. package/dist/core/storage/session/pinned-branch-resume.impl.js.map +1 -0
  179. package/dist/core/storage/session/pinned-branch-resume.js +29 -69
  180. package/dist/core/storage/session/pinned-branch-resume.js.map +1 -1
  181. package/dist/core/storage/session/released-history-files.impl.js +465 -0
  182. package/dist/core/storage/session/released-history-files.impl.js.map +1 -0
  183. package/dist/core/storage/session/released-history-files.js +29 -462
  184. package/dist/core/storage/session/released-history-files.js.map +1 -1
  185. package/dist/core/storage/session/resident-fork-rows.impl.js +57 -0
  186. package/dist/core/storage/session/resident-fork-rows.impl.js.map +1 -0
  187. package/dist/core/storage/session/resident-fork-rows.js +28 -53
  188. package/dist/core/storage/session/resident-fork-rows.js.map +1 -1
  189. package/dist/core/storage/session/session-resume.impl.js +3 -0
  190. package/dist/core/storage/session/session-resume.impl.js.map +1 -0
  191. package/dist/core/storage/session/session-resume.js +31 -2
  192. package/dist/core/storage/session/snapshot-cut.impl.js +3 -0
  193. package/dist/core/storage/session/snapshot-cut.impl.js.map +1 -0
  194. package/dist/core/storage/session/snapshot-cut.js +31 -2
  195. package/dist/core/storage/session/snapshot-history.impl.js +62 -0
  196. package/dist/core/storage/session/snapshot-history.impl.js.map +1 -0
  197. package/dist/core/storage/session/snapshot-history.js +30 -60
  198. package/dist/core/storage/session/snapshot-history.js.map +1 -1
  199. package/dist/core/storage/session/sql-session-store.impl.js +3 -0
  200. package/dist/core/storage/session/sql-session-store.impl.js.map +1 -0
  201. package/dist/core/storage/session/sql-session-store.js +31 -2
  202. package/dist/core/storage/session/tree-outline.impl.js +3 -0
  203. package/dist/core/storage/session/tree-outline.impl.js.map +1 -0
  204. package/dist/core/storage/session/tree-outline.js +31 -2
  205. package/dist/core/storage/session/tree-presentation.impl.js +342 -0
  206. package/dist/core/storage/session/tree-presentation.impl.js.map +1 -0
  207. package/dist/core/storage/session/tree-presentation.js +30 -340
  208. package/dist/core/storage/session/tree-presentation.js.map +1 -1
  209. package/dist/core/storage/storage-status.impl.js +3 -0
  210. package/dist/core/storage/storage-status.impl.js.map +1 -0
  211. package/dist/core/storage/storage-status.js +31 -2
  212. package/dist/core/storage/team.impl.js +3 -0
  213. package/dist/core/storage/team.impl.js.map +1 -0
  214. package/dist/core/storage/team.js +31 -2
  215. package/dist/core/structured-output/index.impl.js +3 -0
  216. package/dist/core/structured-output/index.impl.js.map +1 -0
  217. package/dist/core/structured-output/index.js +31 -2
  218. package/dist/core/tasks/task-completion-entry.impl.js +254 -0
  219. package/dist/core/tasks/task-completion-entry.impl.js.map +1 -0
  220. package/dist/core/tasks/task-completion-entry.js +30 -252
  221. package/dist/core/tasks/task-completion-entry.js.map +1 -1
  222. package/dist/core/tasks/task-file-history.impl.js +379 -0
  223. package/dist/core/tasks/task-file-history.impl.js.map +1 -0
  224. package/dist/core/tasks/task-file-history.js +28 -375
  225. package/dist/core/tasks/task-file-history.js.map +1 -1
  226. package/dist/core/tasks/task-reference-archive.impl.js +469 -0
  227. package/dist/core/tasks/task-reference-archive.impl.js.map +1 -0
  228. package/dist/core/tasks/task-reference-archive.js +31 -468
  229. package/dist/core/tasks/task-reference-archive.js.map +1 -1
  230. package/dist/core/tasks/task-reference-identity.impl.js +164 -0
  231. package/dist/core/tasks/task-reference-identity.impl.js.map +1 -0
  232. package/dist/core/tasks/task-reference-identity.js +28 -160
  233. package/dist/core/tasks/task-reference-identity.js.map +1 -1
  234. package/dist/core/tasks/task-reference-stream.impl.js +3 -0
  235. package/dist/core/tasks/task-reference-stream.impl.js.map +1 -0
  236. package/dist/core/tasks/task-reference-stream.js +31 -2
  237. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -0
  238. package/dist/core/tasks/task-unsaved-answer.impl.js.map +1 -0
  239. package/dist/core/tasks/task-unsaved-answer.js +31 -2
  240. package/dist/core/tasks/task-view-source.impl.js +3 -0
  241. package/dist/core/tasks/task-view-source.impl.js.map +1 -0
  242. package/dist/core/tasks/task-view-source.js +31 -2
  243. package/dist/core/tools/read-url.impl.js +1530 -0
  244. package/dist/core/tools/read-url.impl.js.map +1 -0
  245. package/dist/core/tools/read-url.js +27 -1525
  246. package/dist/core/tools/read-url.js.map +1 -1
  247. package/dist/core/worktree-snapshot/blob-store.js +4 -4
  248. package/dist/core/worktree-snapshot/errors.impl.js +6 -0
  249. package/dist/core/worktree-snapshot/errors.impl.js.map +1 -0
  250. package/dist/core/worktree-snapshot/errors.js +31 -5
  251. package/dist/core/worktree-snapshot/session-index-reset.impl.js +136 -0
  252. package/dist/core/worktree-snapshot/session-index-reset.impl.js.map +1 -0
  253. package/dist/core/worktree-snapshot/session-index-reset.js +30 -134
  254. package/dist/core/worktree-snapshot/session-index-reset.js.map +1 -1
  255. package/dist/extensions/codemode/execute.impl.js +618 -0
  256. package/dist/extensions/codemode/execute.impl.js.map +1 -0
  257. package/dist/extensions/codemode/execute.js +28 -614
  258. package/dist/extensions/codemode/execute.js.map +1 -1
  259. package/dist/extensions/codemode/renderer.impl.js +110 -0
  260. package/dist/extensions/codemode/renderer.impl.js.map +1 -0
  261. package/dist/extensions/codemode/renderer.js +29 -107
  262. package/dist/extensions/codemode/renderer.js.map +1 -1
  263. package/dist/extensions/mcp/cli.impl.js +565 -0
  264. package/dist/extensions/mcp/cli.impl.js.map +1 -0
  265. package/dist/extensions/mcp/cli.js +30 -563
  266. package/dist/extensions/mcp/cli.js.map +1 -1
  267. package/dist/extensions/mcp/cli.lazy.impl.js +7 -0
  268. package/dist/extensions/mcp/cli.lazy.impl.js.map +1 -0
  269. package/dist/extensions/mcp/cli.lazy.js +32 -7
  270. package/dist/extensions/mcp/cli.lazy.js.map +1 -1
  271. package/dist/extensions/mcp/runtime.impl.js +5 -0
  272. package/dist/extensions/mcp/runtime.impl.js.map +1 -0
  273. package/dist/extensions/mcp/runtime.js +31 -4
  274. package/dist/main-first-time-setup.impl.js +12 -0
  275. package/dist/main-first-time-setup.impl.js.map +1 -0
  276. package/dist/main-first-time-setup.js +31 -11
  277. package/dist/main-first-time-setup.js.map +1 -1
  278. package/dist/modes/interactive/components/stored-tree-view.impl.js +293 -0
  279. package/dist/modes/interactive/components/stored-tree-view.impl.js.map +1 -0
  280. package/dist/modes/interactive/components/stored-tree-view.js +30 -291
  281. package/dist/modes/interactive/components/stored-tree-view.js.map +1 -1
  282. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +191 -0
  283. package/dist/modes/interactive/components/user-message-selector-archive.impl.js.map +1 -0
  284. package/dist/modes/interactive/components/user-message-selector-archive.js +30 -189
  285. package/dist/modes/interactive/components/user-message-selector-archive.js.map +1 -1
  286. package/dist/modes/interactive/interactive-mode-deps.js +4 -0
  287. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -0
  288. package/dist/package-manager-cli.impl.js +1067 -0
  289. package/dist/package-manager-cli.impl.js.map +1 -0
  290. package/dist/package-manager-cli.js +32 -1067
  291. package/dist/package-manager-cli.js.map +1 -1
  292. package/dist/utils/startup-database-spare.impl.js +108 -0
  293. package/dist/utils/startup-database-spare.impl.js.map +1 -0
  294. package/dist/utils/startup-database-spare.js +30 -106
  295. package/dist/utils/startup-database-spare.js.map +1 -1
  296. package/dist/utils/tools-manager.impl.js +3 -0
  297. package/dist/utils/tools-manager.impl.js.map +1 -0
  298. package/dist/utils/tools-manager.js +31 -2
  299. package/docs/reference/cli.md +1 -1
  300. package/package.json +8 -8
@@ -1,639 +1,32 @@
1
- import { __name } from "../../../_shared/rolldown-runtime-BGM3D5V3.js";
2
- import { SESSION_HISTORY_CHUNK_BYTES, yieldSessionTurn } from "../../../_shared/settings-startup-65YEWRV2.js";
3
- import { historyChunks } from "../../../_shared/startup-8-0-34CBHPZH.js";
4
- import { read, skip, stringValue } from "../../../_shared/startup-0-5-OHJNE6JH.js";
5
- import { SessionConflictError } from "./errors.js";
6
- // dist/core/storage/session/card-message-projection.js
7
- function* object(first, fields) {
8
- if (first.name !== "startObject") {
9
- yield* skip(first);
10
- return;
11
- }
12
- const limit = Math.max(...Object.keys(fields).map((k) => k.length)) + 1;
13
- for (let k = yield; k.name !== "endObject"; k = yield) {
14
- const key = yield* stringValue(limit);
15
- const value = yield;
16
- if (Object.hasOwn(fields, key)) yield* fields[key](value);
17
- else yield* skip(value);
18
- }
19
- }
20
- /** A copy of a string a card keeps, so it holds that text and not the decoded page a streamed value is a slice of. */
21
- const own = (s) => s.length > 12 ? ` ${s}`.slice(1) : s;
22
- const isRecord$1 = /* @__PURE__ */ __name((v) => typeof v === "object" && v !== null && !Array.isArray(v), "isRecord");
23
- function* json(t) {
24
- if (t.name === "startObject") {
25
- const r = {};
26
- for (let k = yield; k.name !== "endObject"; k = yield) {
27
- const key = yield* stringValue();
28
- Object.defineProperty(r, key, {
29
- value: yield* json(yield),
30
- configurable: true,
31
- enumerable: true,
32
- writable: true
33
- });
34
- }
35
- return r;
36
- }
37
- if (t.name === "startArray") {
38
- const a = [];
39
- for (let v = yield; v.name !== "endArray"; v = yield) a.push(yield* json(v));
40
- return a;
41
- }
42
- if (t.name === "startString") return own(yield* stringValue());
43
- if (t.name === "numberValue") return Number(t.value);
44
- if (t.name === "trueValue" || t.name === "falseValue" || t.name === "nullValue") return t.value;
45
- throw new SyntaxError("Invalid stored JSON value");
46
- }
47
- const MARKER = "\n\nTask:\n";
48
- /** A text value read piece by piece: a streamed value in its chunks, a parsed one as one piece. */
49
- var TextReader = class {
50
- raw;
51
- preview = "";
52
- space = false;
53
- marker = false;
54
- left = "";
55
- right = "";
56
- constructor(full) {
57
- this.raw = full ? "" : void 0;
58
- }
59
- add(s) {
60
- if (this.raw !== void 0) this.raw += s;
61
- this.marker ||= (this.right + s).includes(MARKER);
62
- this.left += s.slice(0, Math.max(0, 8 - this.left.length));
63
- this.right = (this.right + s).slice(-8);
64
- if (this.preview.length > 201) return;
65
- for (const m of s.matchAll(/\s+|\S+/gu)) {
66
- if (/\s/u.test(m[0][0])) this.space = true;
67
- else {
68
- if (this.space && this.preview) this.preview += " ";
69
- this.preview += m[0].slice(0, 202 - this.preview.length);
70
- this.space = false;
71
- }
72
- if (this.preview.length >= 202) break;
73
- }
74
- }
75
- done() {
76
- return {
77
- raw: this.raw === void 0 ? void 0 : own(this.raw),
78
- preview: this.preview,
79
- marker: this.marker,
80
- left: this.left,
81
- right: this.right
82
- };
83
- }
84
- };
85
- function* text(t, full) {
86
- if (t.name !== "startString") {
87
- yield* skip(t);
88
- return;
89
- }
90
- const reader = new TextReader(full);
91
- for (let p = yield; p.name === "stringChunk"; p = yield) reader.add(p.value);
92
- return reader.done();
93
- }
94
- function textOf(s, full) {
95
- const reader = new TextReader(full);
96
- reader.add(s);
97
- return reader.done();
98
- }
99
- const emptyPiece = () => ({
100
- lines: [],
101
- calls: [],
102
- nonblank: false,
103
- marker: false
104
- });
105
- /** What one message's content shows on its card, whether its content was streamed or parsed. */
106
- var PieceBuilder = class {
107
- output;
108
- pieces = 0;
109
- tail = "";
110
- role;
111
- full;
112
- constructor(role, full) {
113
- this.role = role;
114
- this.full = full;
115
- this.output = {
116
- ...emptyPiece(),
117
- ...full ? { text: "" } : {}
118
- };
119
- }
120
- line(s) {
121
- if (s.length > 200) {
122
- let end = 199;
123
- if (/[\uD800-\uDBFF]/.test(s.charAt(end - 1)) && /[\uDC00-\uDFFF]/.test(s.charAt(end))) end--;
124
- s = `${s.slice(0, end)}…`;
125
- }
126
- this.output.lines.push(own(s));
127
- if (this.output.lines.length > 12) this.output.lines.shift();
128
- }
129
- part(v) {
130
- if (!v) return;
131
- const { output } = this;
132
- const join = this.pieces ? "\n" : "";
133
- output.nonblank ||= !!v.preview;
134
- output.marker ||= v.marker || (this.tail + join + v.left).includes(MARKER);
135
- this.tail = (this.tail + join + v.right).slice(-8);
136
- if (this.full) output.text += join + (v.raw ?? "");
137
- this.pieces++;
138
- if (v.preview) this.line((this.role === "user" ? "› " : "") + v.preview);
139
- }
140
- block(index, type, name, id, v, args) {
141
- if (type === "text") this.part(v);
142
- else if (type === "toolCall" && name) {
143
- this.line(`→ ${name}`);
144
- if (this.role === "assistant") this.output.calls.push({
145
- index,
146
- id,
147
- name,
148
- ...args === void 0 ? {} : { args: isRecord$1(args) ? args : {} }
149
- });
150
- }
151
- }
152
- done() {
153
- const { output } = this;
154
- if (output.text !== void 0) output.text = own(output.text);
155
- return output;
156
- }
157
- };
158
- function* content(t, role, full, args) {
159
- const builder = new PieceBuilder(role, full);
160
- if (t.name === "startString") builder.part(yield* text(t, full));
161
- else if (t.name === "startArray") {
162
- let index = 0;
163
- const wanted = (at) => args === "all" || !!args?.has(at);
164
- for (let b = yield; b.name !== "endArray"; b = yield, index++) {
165
- let type = "";
166
- let name = "";
167
- let id = "";
168
- let v;
169
- let argumentsValue;
170
- yield* object(b, {
171
- type: function* (x) {
172
- if (x.name === "startString") type = yield* stringValue(16);
173
- else yield* skip(x);
174
- },
175
- name: function* (x) {
176
- if (x.name === "startString") name = own(yield* stringValue());
177
- else yield* skip(x);
178
- },
179
- id: function* (x) {
180
- if (x.name === "startString") id = own(yield* stringValue());
181
- else yield* skip(x);
182
- },
183
- text: function* (x) {
184
- v = yield* text(x, full);
185
- },
186
- arguments: function* (x) {
187
- if (wanted(index)) argumentsValue = yield* json(x);
188
- else yield* skip(x);
1
+ // Written by the build (scripts/in-place-update-gate.mjs): when this module's code cannot load in a process of an earlier release
2
+ // that an in-place update left running, the process is told to restart.
3
+ let module;
4
+ try {
5
+ module = await import("./expanded-child-details.impl.js");
6
+ } catch (error) {
7
+ const root = new URL("../../../", import.meta.url);
8
+ const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
9
+ const key = `${root.href}#0.10.4`;
10
+ let release = releases.get(key);
11
+ if (release === undefined) {
12
+ release = (async () => {
13
+ for (const path of ["modes/interactive/interactive-mode-deps.js","_shared/chunk-CDOYTDYM.js","_shared/p0-cli-GUFK7TPN.js"]) {
14
+ try {
15
+ const held = await import(new URL(path, root).href);
16
+ if (typeof held.VERSION === "string") return { version: held.VERSION, name: held.APP_NAME };
17
+ } catch {
18
+ // Not a file this process can load: the next.
189
19
  }
190
- });
191
- builder.block(index, type, name, id, v, wanted(index) ? argumentsValue ?? null : void 0);
192
- }
193
- } else yield* skip(t);
194
- return builder.done();
195
- }
196
- async function cardPiece(chunks, role, edit, full = false, args) {
197
- return read(chunks, (function* () {
198
- let p = emptyPiece();
199
- yield* object(yield, { [edit ? "replacement" : "message"]: function* (t) {
200
- yield* object(t, { content: function* (c) {
201
- p = yield* content(c, role, full, args);
202
- } });
203
- } });
204
- return p;
205
- })());
206
- }
207
- /** The same projection as {@link cardPiece} of a message's `content`, when the row was parsed whole. */
208
- function cardPieceOf(value, role, full = false, args) {
209
- if (value === void 0) return emptyPiece();
210
- const builder = new PieceBuilder(role, full);
211
- if (typeof value === "string") builder.part(textOf(value, full));
212
- else if (Array.isArray(value)) value.forEach((b, index) => {
213
- if (!isRecord$1(b)) return;
214
- const withArgs = args === "all" || !!args?.has(index);
215
- builder.block(index, typeof b.type === "string" ? b.type.slice(0, 16) : "", typeof b.name === "string" ? b.name : "", typeof b.id === "string" ? b.id : "", typeof b.text === "string" ? textOf(b.text, full) : void 0, withArgs ? b.arguments ?? null : void 0);
216
- });
217
- return builder.done();
218
- }
219
- /** A row's kind, ID, role and tool call ID, read only as far into the entry as needed. Atomic writes `type` and `id`
220
- * before a row's payload, and `role` and `toolCallId` before a message's content, so a large row is not streamed to
221
- * find them. A key written later is still found by reading on. */
222
- async function cardHeader(chunks) {
223
- return read(chunks, (function* () {
224
- const h = {};
225
- const seen = /* @__PURE__ */ new Set();
226
- const known = () => seen.has("type") && (h.type !== "message" || seen.has("id") && seen.has("role") && (h.role !== "toolResult" || seen.has("toolCallId")));
227
- const first = yield;
228
- if (first.name !== "startObject") {
229
- yield* skip(first);
230
- return h;
231
- }
232
- for (let k = yield; k.name !== "endObject"; k = yield) {
233
- const key = yield* stringValue(8);
234
- const value = yield;
235
- if (key === "type") {
236
- seen.add(key);
237
- if (value.name === "startString") h.type = yield* stringValue(64);
238
- else yield* skip(value);
239
- } else if (key === "id") {
240
- seen.add(key);
241
- h.id = yield* json(value);
242
- } else if (key === "message" && value.name === "startObject") for (let m = yield; m.name !== "endObject"; m = yield) {
243
- const field = yield* stringValue(11);
244
- const v = yield;
245
- if (field === "role") {
246
- seen.add(field);
247
- if (v.name === "startString") h.role = yield* stringValue(64);
248
- else yield* skip(v);
249
- } else if (field === "toolCallId") {
250
- seen.add(field);
251
- h.toolCallId = yield* json(v);
252
- } else yield* skip(v);
253
- if (known()) return h;
254
- }
255
- else yield* skip(value);
256
- if (known()) return h;
257
- }
258
- return h;
259
- })());
260
- }
261
- async function cardFields(chunks, kind) {
262
- return read(chunks, (function* () {
263
- const r = {};
264
- const value = (k) => function* (t) {
265
- r[k] = yield* json(t);
266
- };
267
- const tag = (k) => function* (t) {
268
- if (t.name === "startString") r[k] = yield* stringValue(64);
269
- else yield* skip(t);
270
- };
271
- const child = (f) => function* (t) {
272
- yield* object(t, f);
273
- };
274
- const fields = kind === "boundary" ? { details: child({ backend: tag("backend") }) } : kind === "edit" ? {
275
- targetId: value("targetId"),
276
- replacement: function* (t) {
277
- r.omit = t.name === "nullValue";
278
- yield* skip(t);
279
20
  }
280
- } : kind === "replacement" ? { replacement: child({ content: value("content") }) } : kind === "result" || kind === "editedResult" ? { message: child({
281
- ...kind === "result" ? { content: value("content") } : {},
282
- details: value("details"),
283
- toolCallId: value("toolCallId"),
284
- isError: value("isError"),
285
- durationMs: value("durationMs")
286
- }) } : {
287
- type: tag("type"),
288
- customType: tag("customType"),
289
- id: value("id"),
290
- data: child({
291
- version: value("version"),
292
- state: tag("state"),
293
- runId: tag("runId"),
294
- agent: tag("agent"),
295
- cwd: tag("cwd"),
296
- index: value("index"),
297
- childId: value("childId"),
298
- launchLeafId: value("launchLeafId"),
299
- launchLeafSeq: value("launchLeafSeq"),
300
- forked: value("forked")
301
- })
302
- };
303
- yield* object(yield, fields);
304
- return r;
305
- })());
306
- }
307
- // dist/core/storage/session/expanded-child-details.js
308
- /** An operator explicitly expanded this card. Keep what its renderers are passed, but not thinking,
309
- * hidden notices, discarded answers, unmatched outputs, or the session manager. Reads use one generation. */
310
- async function readExpandedChildDetails(store, id, launch = {}, options = {}) {
311
- const { signal } = options;
312
- signal?.throwIfAborted();
313
- if (!store.readChildDisplayCut || !store.readEntrySizes || !store.readEntryChunk || !store.readBranchSpan) {
314
- const snap = await store.load(id);
315
- signal?.throwIfAborted();
316
- const { foldSessionResume, transcriptBranchSpan } = await import("./session-resume.js");
317
- const { childDisplayCut } = await import("./card-view.js");
318
- const index = foldSessionResume(void 0, snap.entries);
319
- const cut = childDisplayCut(index, launch, typeof launch.launchLeafId === "string" ? snap.entries.findLastIndex((e) => e.id === launch.launchLeafId) + 1 || void 0 : void 0);
320
- let cached;
321
- return projectExpanded({
322
- descriptor: store.descriptor,
323
- readEntrySizes: async (_id, from, to) => ({
324
- epoch: index.epoch,
325
- lastSeq: snap.lastSeq,
326
- sizes: snap.entries.slice(from - 1, to).map((e, i) => ({
327
- seq: from + i,
328
- bytes: Buffer.byteLength(JSON.stringify(e))
329
- }))
330
- }),
331
- readRange: async (_id, startSeq, end) => ({
332
- epoch: index.epoch,
333
- lastSeq: snap.lastSeq,
334
- startSeq,
335
- entries: snap.entries.slice(startSeq - 1, end)
336
- }),
337
- readTreeOutline: async (_id, from, to) => snap.entries.slice(from - 1, to).map((e, i) => ({
338
- seq: from + i,
339
- id: e.id,
340
- parentId: e.parentId,
341
- type: e.type,
342
- timestamp: e.timestamp,
343
- ...e.type === "message" ? { role: e.message.role } : {}
344
- })),
345
- readEntryChunk: async (ref, off) => {
346
- if (cached?.seq !== ref.seq) cached = {
347
- seq: ref.seq,
348
- bytes: Buffer.from(JSON.stringify(snap.entries[ref.seq - 1]))
349
- };
350
- return cached.bytes.subarray(off, off + SESSION_HISTORY_CHUNK_BYTES);
351
- },
352
- readBranchSpan: async (key, range) => transcriptBranchSpan(key, index, range)
353
- }, id, launch, cut, signal);
354
- }
355
- return projectExpanded(store, id, launch, await store.readChildDisplayCut(id, launch), signal);
356
- }
357
- /** Rows up to this size are read together, about this much at a time, and parsed whole; a larger row is streamed. */
358
- const BATCH_BYTES = 1048576;
359
- /** A row an outline shows the card never displays is read with its neighbours only when it is this small. */
360
- const PASSING_BYTES = 16384;
361
- const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
362
- async function projectExpanded(store, id, launch, cut, signal) {
363
- const at = (seq, bytes) => ({
364
- kind: "oversized",
365
- sessionId: id,
366
- epoch: cut.epoch,
367
- seq,
368
- bytes
21
+ return undefined;
22
+ })();
23
+ releases.set(key, release);
24
+ }
25
+ const running = await release;
26
+ if (running === undefined || running.version === "0.10.4") throw error;
27
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.4 while this session was running; restart it to keep using session storage.", {
28
+ cause: error,
369
29
  });
370
- let head;
371
- async function* chunks(ref) {
372
- let offset = 0;
373
- if (head?.seq === ref.seq) {
374
- offset = head.bytes.length;
375
- yield head.bytes;
376
- }
377
- if (offset < ref.bytes) yield* historyChunks(store, id, cut.epoch, ref, {
378
- signal,
379
- offset
380
- });
381
- }
382
- const headerOf = (ref) => {
383
- head = void 0;
384
- return cardHeader((async function* () {
385
- for await (const bytes of historyChunks(store, id, cut.epoch, ref, { signal })) {
386
- head ??= {
387
- seq: ref.seq,
388
- bytes
389
- };
390
- yield bytes;
391
- }
392
- })());
393
- };
394
- const shown = (type, role, seq) => type === "message" && (role === "user" || role === "assistant" || role === "toolResult") || !!cut.model && (type === "context_edit" || type === "compaction" && seq === cut.boundary);
395
- const argsOf = (role) => role === "assistant" ? "all" : void 0;
396
- let active = !cut.model || !launch.forked;
397
- let prompt;
398
- let answer;
399
- let lines = [];
400
- const calls = [];
401
- const wanted = /* @__PURE__ */ new Set();
402
- const results = /* @__PURE__ */ new Map();
403
- const show = (row) => {
404
- if (row.role === "toolResult") {
405
- if (active && typeof row.toolCallId === "string") results.set(row.toolCallId, row);
406
- return;
407
- }
408
- if (!active && row.role !== "user") return;
409
- const p = row.piece;
410
- if (!active) {
411
- if (!p.marker) return;
412
- active = true;
413
- }
414
- if (row.role === "user" && !prompt && p.nonblank) prompt = row;
415
- else if (row.role === "assistant" && p.nonblank) answer = row;
416
- lines.push(...p.lines);
417
- if (lines.length > 12) lines = lines.slice(-12);
418
- for (const c of p.calls) {
419
- calls.push(c);
420
- if (c.id) wanted.add(c.id);
421
- }
422
- };
423
- const held = [];
424
- const edits = /* @__PURE__ */ new Map();
425
- let boundary;
426
- const take = (row) => cut.model ? held.push(row) : show(row);
427
- const parsed = (seq, bytes, e) => {
428
- if (!isRecord(e) || typeof e.type !== "string") return;
429
- const message = isRecord(e.message) ? e.message : void 0;
430
- const role = typeof message?.role === "string" ? message.role : void 0;
431
- if (!shown(e.type, role, seq)) return;
432
- if (e.type === "message") {
433
- if (role === "toolResult") take({
434
- seq,
435
- bytes,
436
- role,
437
- id: e.id,
438
- toolCallId: message.toolCallId,
439
- fields: message
440
- });
441
- else take({
442
- seq,
443
- bytes,
444
- role,
445
- id: e.id,
446
- piece: cardPieceOf(message.content, role, false, argsOf(role))
447
- });
448
- } else if (e.type === "context_edit") {
449
- if (typeof e.targetId === "string") edits.set(e.targetId, e.replacement === null ? null : {
450
- seq,
451
- bytes,
452
- content: { value: isRecord(e.replacement) ? e.replacement.content : void 0 }
453
- });
454
- } else boundary = { backend: isRecord(e.details) && typeof e.details.backend === "string" ? e.details.backend.slice(0, 64) : void 0 };
455
- };
456
- const streamed = async (seq, bytes, outline) => {
457
- const ref = at(seq, bytes);
458
- const h = outline ?? await headerOf(ref);
459
- const role = typeof h.role === "string" ? h.role : void 0;
460
- if (typeof h.type !== "string" || !shown(h.type, role, seq)) return;
461
- if (h.type === "message") {
462
- if (role === "toolResult") take({
463
- seq,
464
- bytes,
465
- role,
466
- id: h.id,
467
- toolCallId: outline ? (await headerOf(ref)).toolCallId : h.toolCallId
468
- });
469
- else take({
470
- seq,
471
- bytes,
472
- role,
473
- id: h.id,
474
- piece: await cardPiece(chunks(ref), role, false, false, argsOf(role))
475
- });
476
- } else if (h.type === "context_edit") {
477
- const e = await cardFields(chunks(ref), "edit");
478
- if (typeof e.targetId === "string") edits.set(e.targetId, e.omit ? null : {
479
- seq,
480
- bytes
481
- });
482
- } else boundary = { backend: (await cardFields(chunks(ref), "boundary")).backend };
483
- };
484
- const batch = async (rows) => {
485
- if (!rows.length) return;
486
- if (!store.readRange) {
487
- for (const { seq, bytes } of rows) await streamed(seq, bytes);
488
- return;
489
- }
490
- const range = await store.readRange(id, rows[0].seq, rows.at(-1).seq, cut.epoch);
491
- if (range.epoch !== void 0 && range.epoch !== cut.epoch) throw new SessionConflictError(id, cut.through, range.lastSeq);
492
- const sizes = new Map(rows.map((r) => [r.seq, r.bytes]));
493
- range.entries.forEach((e, i) => {
494
- const seq = range.seqs?.[i] ?? range.startSeq + i;
495
- const bytes = sizes.get(seq);
496
- if (bytes !== void 0) parsed(seq, bytes, e);
497
- });
498
- await yieldSessionTurn();
499
- };
500
- const segments = cut.earlier.map((seq) => [seq, seq]);
501
- if (cut.from <= cut.leaf) segments.push([cut.from, cut.leaf]);
502
- for (const [first, last] of segments) for (let pivot = first; pivot <= last;) {
503
- signal?.throwIfAborted();
504
- const span = await store.readBranchSpan(id, {
505
- leaf: cut.leaf,
506
- first,
507
- last,
508
- pivot,
509
- backward: false,
510
- epoch: cut.epoch
511
- });
512
- if (!span) break;
513
- const hi = Math.min(span.end, span.start + 64 - 1);
514
- const sizes = await store.readEntrySizes(id, span.start, hi);
515
- if (sizes.epoch !== cut.epoch || sizes.lastSeq < cut.through) throw new SessionConflictError(id, cut.through, sizes.lastSeq);
516
- const outline = await store.readTreeOutline?.(id, span.start, hi, cut.epoch);
517
- let pending = [];
518
- let pendingBytes = 0;
519
- for (const { seq, bytes } of sizes.sizes) {
520
- signal?.throwIfAborted();
521
- const info = outline?.[seq - span.start];
522
- const known = info && !("streamed" in info) ? info : void 0;
523
- const skipped = known !== void 0 && !shown(known.type, known.role, seq);
524
- if (bytes > BATCH_BYTES || skipped && bytes > PASSING_BYTES || pendingBytes + bytes > BATCH_BYTES) {
525
- await batch(pending);
526
- pending = [];
527
- pendingBytes = 0;
528
- }
529
- if (skipped && bytes > PASSING_BYTES) continue;
530
- if (bytes > BATCH_BYTES) await streamed(seq, bytes, known);
531
- else {
532
- pending.push({
533
- seq,
534
- bytes
535
- });
536
- pendingBytes += bytes;
537
- }
538
- }
539
- await batch(pending);
540
- pivot = hi + 1;
541
- if (pivot <= last) await yieldSessionTurn();
542
- }
543
- if (cut.model) {
544
- const covered = boundary && boundary.backend !== "summary" ? cut.covered ?? 0 : 0;
545
- for (const row of held) {
546
- if (row.seq <= covered) continue;
547
- const edit = edits.get(row.id);
548
- if (edit === null) continue;
549
- if (edit) {
550
- row.edit = edit;
551
- if (row.role !== "toolResult") row.piece = edit.content ? cardPieceOf(edit.content.value, row.role, false, argsOf(row.role)) : await cardPiece(chunks(at(edit.seq, edit.bytes)), row.role, true, false, argsOf(row.role));
552
- }
553
- show(row);
554
- }
555
- held.length = 0;
556
- }
557
- const replacementOf = async (edit) => edit.content ? edit.content.value : (await cardFields(chunks(at(edit.seq, edit.bytes)), "replacement")).content;
558
- const values = /* @__PURE__ */ new Map();
559
- for (const [call, row] of results) {
560
- if (!wanted.has(call)) continue;
561
- const r = row.fields ?? await cardFields(chunks(at(row.seq, row.bytes)), row.edit ? "editedResult" : "result");
562
- const replacement = row.edit ? await replacementOf(row.edit) : void 0;
563
- const c = replacement === void 0 ? r.content : typeof replacement === "string" ? [{
564
- type: "text",
565
- text: replacement
566
- }] : replacement;
567
- const content = Array.isArray(c) ? c : [];
568
- values.set(call, {
569
- resultContent: content,
570
- ...r.details !== void 0 ? { resultDetails: r.details } : {},
571
- resultText: typeof c === "string" ? c : content.flatMap((b) => b?.type === "text" && typeof b.text === "string" ? [b.text] : []).join("\n"),
572
- isError: r.isError === true,
573
- ...typeof r.durationMs === "number" ? { durationMs: r.durationMs } : {},
574
- completed: true
575
- });
576
- }
577
- const toolCalls = calls.map((c) => ({
578
- id: c.id,
579
- name: c.name,
580
- args: c.args ?? {},
581
- ...values.get(c.id) ?? { completed: false }
582
- }));
583
- /** The whole text of the prompt or the answer: only the excerpt of each row was kept while reading. */
584
- const textOf = async (row) => {
585
- if (row.edit?.content) return cardPieceOf(row.edit.content.value, row.role, true).text;
586
- if (row.edit) return (await cardPiece(chunks(at(row.edit.seq, row.edit.bytes)), row.role, true, true)).text;
587
- if (row.bytes <= BATCH_BYTES && store.readRange) {
588
- const e = (await store.readRange(id, row.seq, row.seq, cut.epoch)).entries[0];
589
- return cardPieceOf(isRecord(e) && isRecord(e.message) ? e.message.content : void 0, row.role, true).text;
590
- }
591
- return (await cardPiece(chunks(at(row.seq, row.bytes)), row.role, false, true)).text;
592
- };
593
- signal?.throwIfAborted();
594
- return {
595
- ...prompt ? { prompt: await textOf(prompt) } : {},
596
- toolCalls,
597
- ...answer ? { result: (await textOf(answer))?.trim() } : {},
598
- lines
599
- };
600
- }
601
- /** Only the launch cursor is needed to choose a child's own rows; don't load the owner's unrelated children or its transcript. */
602
- async function readSavedChildLaunch(store, id, entryId, childId, signal) {
603
- if (!store.findEntrySeq || !store.readEntrySizes || !store.readEntryChunk) {
604
- const e = (await store.load(id)).entries.find((e) => e.id === entryId);
605
- if (e?.type === "custom" && e.customType === "subagent-child") {
606
- const d = e.data;
607
- if (d?.version === 1 && d.childId === childId && typeof d.runId === "string" && typeof d.agent === "string" && typeof d.cwd === "string" && typeof d.index === "number" && (d.state === "terminal" || d.state === "running")) return {
608
- launchLeafId: d.launchLeafId,
609
- launchLeafSeq: d.launchLeafSeq,
610
- forked: d.forked
611
- };
612
- return;
613
- }
614
- return;
615
- }
616
- const cut = await store.readEntrySizes(id, 1, 0);
617
- const seq = await store.findEntrySeq(id, entryId);
618
- if (!seq || seq > cut.lastSeq) return void 0;
619
- const sized = await store.readEntrySizes(id, seq, seq);
620
- if (sized.epoch !== cut.epoch || sized.lastSeq < cut.lastSeq) throw new SessionConflictError(id, cut.lastSeq, sized.lastSeq);
621
- const size = sized.sizes[0];
622
- if (!size) return void 0;
623
- const r = await cardFields(historyChunks(store, id, cut.epoch, {
624
- kind: "oversized",
625
- sessionId: id,
626
- epoch: cut.epoch,
627
- seq,
628
- bytes: size.bytes
629
- }, { signal }), "launch");
630
- if (r.id !== entryId || r.customType !== "subagent-child" || r.type !== "custom" || r.version !== 1 || typeof r.runId !== "string" || typeof r.agent !== "string" || typeof r.cwd !== "string" || typeof r.index !== "number" || r.state !== "terminal" && r.state !== "running" || r.childId !== childId) return void 0;
631
- return {
632
- ...typeof r.launchLeafId === "string" || r.launchLeafId === null ? { launchLeafId: r.launchLeafId } : {},
633
- ...typeof r.launchLeafSeq === "number" ? { launchLeafSeq: r.launchLeafSeq } : {},
634
- ...typeof r.forked === "boolean" ? { forked: r.forked } : {}
635
- };
636
30
  }
637
- export { readExpandedChildDetails, readSavedChildLaunch };
638
-
639
- //# sourceMappingURL=expanded-child-details.js.map
31
+ export const { readExpandedChildDetails, readSavedChildLaunch } = module;
32
+ //# sourceMappingURL=expanded-child-details.js.map