pim-agent 0.13.0 → 0.14.0

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 (253) hide show
  1. package/package.json +3 -3
  2. package/packages/core/src/attachments/AttachmentStore.ts +8 -13
  3. package/packages/core/src/attachments/Attachments.ts +2 -4
  4. package/packages/core/src/extensions/CoreExtensions.ts +1 -1
  5. package/packages/core/src/extensions/apply-patch/coordinator.ts +1 -1
  6. package/packages/core/src/extensions/apply-patch/executor.ts +21 -25
  7. package/packages/core/src/extensions/apply-patch/matcher.ts +1 -1
  8. package/packages/core/src/extensions/apply-patch/model.ts +2 -6
  9. package/packages/core/src/extensions/apply-patch/parser.ts +60 -162
  10. package/packages/core/src/extensions/apply-patch/schema.ts +0 -1
  11. package/packages/core/src/extensions/bash/MemoryCap.ts +5 -4
  12. package/packages/core/src/extensions/bash/capture.ts +16 -23
  13. package/packages/core/src/extensions/bash/format.ts +2 -2
  14. package/packages/core/src/extensions/bash/image.ts +4 -8
  15. package/packages/core/src/extensions/bash/index.ts +1 -1
  16. package/packages/core/src/extensions/bash/render.ts +1 -1
  17. package/packages/core/src/extensions/bash/run.ts +9 -15
  18. package/packages/core/src/extensions/bash/schema.ts +4 -4
  19. package/packages/core/src/extensions/edit/edit.ts +14 -33
  20. package/packages/core/src/extensions/glob/glob.ts +1 -3
  21. package/packages/core/src/extensions/glob/index.ts +7 -9
  22. package/packages/core/src/extensions/glob/render.ts +2 -4
  23. package/packages/core/src/extensions/glob/schema.ts +1 -1
  24. package/packages/core/src/extensions/grep/grep.ts +7 -7
  25. package/packages/core/src/extensions/grep/render.ts +5 -6
  26. package/packages/core/src/extensions/grep/schema.ts +3 -7
  27. package/packages/core/src/extensions/read/ImageMemory.ts +2 -8
  28. package/packages/core/src/extensions/read/image.ts +3 -3
  29. package/packages/core/src/extensions/read/index.ts +2 -14
  30. package/packages/core/src/extensions/read/read.ts +5 -6
  31. package/packages/core/src/extensions/read/render.ts +1 -1
  32. package/packages/core/src/extensions/read/schema.ts +2 -2
  33. package/packages/core/src/extensions/subagent/render.ts +2 -2
  34. package/packages/core/src/extensions/subagent/subagent.ts +10 -21
  35. package/packages/core/src/extensions/system-prompt/index.ts +1 -2
  36. package/packages/core/src/extensions/system-prompt/prompt.ts +2 -4
  37. package/packages/core/src/extensions/todo/render.ts +1 -4
  38. package/packages/core/src/extensions/todo/todo.ts +16 -23
  39. package/packages/core/src/extensions/web-fetch/JinaReaderClient.ts +3 -11
  40. package/packages/core/src/extensions/web-fetch/WebViewFetchClient.ts +1 -3
  41. package/packages/core/src/extensions/web-fetch/fetch.ts +4 -12
  42. package/packages/core/src/extensions/web-fetch/image.ts +3 -4
  43. package/packages/core/src/extensions/web-fetch/index.ts +2 -13
  44. package/packages/core/src/extensions/web-fetch/render.ts +3 -4
  45. package/packages/core/src/extensions/web-fetch/schema.ts +3 -4
  46. package/packages/core/src/extensions/web-search/ExaMcpClient.ts +23 -31
  47. package/packages/core/src/extensions/web-search/SearchBreaker.ts +1 -1
  48. package/packages/core/src/extensions/web-search/SearchChain.ts +6 -5
  49. package/packages/core/src/extensions/web-search/providers/DuckDuckGoProvider.ts +2 -2
  50. package/packages/core/src/extensions/web-search/providers/FirecrawlProvider.ts +1 -2
  51. package/packages/core/src/extensions/web-search/providers/SearchProvider.ts +3 -3
  52. package/packages/core/src/extensions/write/write.ts +1 -1
  53. package/packages/core/src/picker/InProcessFilePickerSuggestionEngine.ts +1 -3
  54. package/packages/core/src/picker/PickerItem.ts +1 -1
  55. package/packages/core/src/picker/PickerService.ts +3 -7
  56. package/packages/core/src/picker/RemoteFilePickerSuggestionEngine.ts +1 -2
  57. package/packages/core/src/picker/catalog.ts +7 -15
  58. package/packages/core/src/picker/filePickerWorker.ts +1 -3
  59. package/packages/core/src/picker/ranker.ts +1 -1
  60. package/packages/core/src/picker/token.ts +3 -4
  61. package/packages/core/src/session/AgentRuntime.ts +5 -8
  62. package/packages/core/src/session/EventLog.ts +6 -12
  63. package/packages/core/src/session/ReadCursors.ts +3 -4
  64. package/packages/core/src/session/SearchIndex.ts +49 -86
  65. package/packages/core/src/session/SearchTokens.ts +4 -7
  66. package/packages/core/src/session/SessionCache.ts +8 -6
  67. package/packages/core/src/session/SessionDigest.ts +10 -19
  68. package/packages/core/src/session/SessionHost.ts +53 -83
  69. package/packages/core/src/session/SessionLease.ts +12 -15
  70. package/packages/core/src/session/SessionMeta.ts +16 -32
  71. package/packages/core/src/session/SessionName.ts +3 -7
  72. package/packages/core/src/session/SessionRegistry.ts +13 -29
  73. package/packages/core/src/session/SessionUi.ts +12 -16
  74. package/packages/core/src/session/WriteMark.ts +7 -16
  75. package/packages/core/src/shared/Cli.ts +1 -1
  76. package/packages/core/src/shared/DaemonUnit.ts +1 -2
  77. package/packages/core/src/shared/DiffLines.ts +16 -34
  78. package/packages/core/src/shared/DiffRenderer.ts +8 -27
  79. package/packages/core/src/shared/Directories.ts +4 -4
  80. package/packages/core/src/shared/EditMatcher.ts +18 -50
  81. package/packages/core/src/shared/ExtensionToggles.ts +3 -6
  82. package/packages/core/src/shared/FileEnumerator.ts +73 -57
  83. package/packages/core/src/shared/FileScanner.ts +5 -13
  84. package/packages/core/src/shared/FileWatch.ts +13 -17
  85. package/packages/core/src/shared/Format.ts +2 -3
  86. package/packages/core/src/shared/FuzzyMatcher.ts +18 -19
  87. package/packages/core/src/shared/Git.ts +22 -47
  88. package/packages/core/src/shared/GitMonitor.ts +12 -23
  89. package/packages/core/src/shared/GlobExclusions.ts +0 -4
  90. package/packages/core/src/shared/Http.ts +1 -1
  91. package/packages/core/src/shared/ImageMime.ts +3 -5
  92. package/packages/core/src/shared/Images.ts +17 -27
  93. package/packages/core/src/shared/Languages.ts +2 -2
  94. package/packages/core/src/shared/Levenshtein.ts +1 -6
  95. package/packages/core/src/shared/Lines.ts +1 -1
  96. package/packages/core/src/shared/McpClient.ts +2 -2
  97. package/packages/core/src/shared/PatchSummary.ts +1 -1
  98. package/packages/core/src/shared/Paths.ts +4 -1
  99. package/packages/core/src/shared/PiExtensions.ts +5 -12
  100. package/packages/core/src/shared/PimSettings.ts +14 -15
  101. package/packages/core/src/shared/Proc.ts +2 -3
  102. package/packages/core/src/shared/RateLimiter.ts +1 -1
  103. package/packages/core/src/shared/Renderer.ts +1 -3
  104. package/packages/core/src/shared/RepoDiff.ts +24 -46
  105. package/packages/core/src/shared/SearchRender.ts +3 -4
  106. package/packages/core/src/shared/SpillCache.ts +2 -3
  107. package/packages/core/src/shared/SubagentLogs.ts +4 -6
  108. package/packages/core/src/shared/Supervisor.ts +19 -32
  109. package/packages/core/src/shared/Surface.ts +1 -1
  110. package/packages/core/src/shared/Sweeper.ts +1 -1
  111. package/packages/core/src/shared/Tools.ts +17 -30
  112. package/packages/core/src/shared/Updater.ts +15 -15
  113. package/packages/core/src/view/BodyRenderer.ts +1 -1
  114. package/packages/core/src/view/DiffBlocks.ts +0 -1
  115. package/packages/core/src/view/DiffExpand.ts +10 -25
  116. package/packages/core/src/view/DiffLayout.ts +2 -2
  117. package/packages/core/src/view/DiffPairs.ts +2 -2
  118. package/packages/core/src/view/MarkdownPainter.ts +2 -19
  119. package/packages/core/src/view/MovePath.ts +4 -17
  120. package/packages/core/src/view/Painting.ts +4 -4
  121. package/packages/core/src/view/ViewBlock.ts +11 -12
  122. package/packages/daemon/src/Daemon.ts +2 -7
  123. package/packages/daemon/src/DaemonInstall.ts +5 -12
  124. package/packages/daemon/src/Surfaces.ts +3 -12
  125. package/packages/daemon/src/TelegramSurface.ts +0 -1
  126. package/packages/daemon/src/index.ts +0 -1
  127. package/packages/protocol/src/Command.ts +33 -41
  128. package/packages/protocol/src/Diff.ts +0 -5
  129. package/packages/protocol/src/ImageRoute.ts +2 -5
  130. package/packages/protocol/src/ServerEvent.ts +68 -105
  131. package/packages/server/src/AttachmentEndpoint.ts +45 -19
  132. package/packages/server/src/ClientConnection.ts +11 -12
  133. package/packages/server/src/ImageEndpoint.ts +3 -4
  134. package/packages/server/src/ProbeClient.ts +26 -59
  135. package/packages/server/src/Reloader.ts +4 -7
  136. package/packages/server/src/SendFileTool.ts +1 -1
  137. package/packages/server/src/SessionCatalogue.ts +35 -47
  138. package/packages/server/src/SessionProjection.ts +7 -12
  139. package/packages/server/src/SessionStream.ts +33 -80
  140. package/packages/server/src/StaticClient.ts +7 -8
  141. package/packages/server/src/WebOptions.ts +2 -6
  142. package/packages/server/src/WsGateway.ts +35 -96
  143. package/packages/server/src/probe.ts +6 -18
  144. package/packages/telegram/src/Bot.ts +2 -2
  145. package/packages/telegram/src/Commands.ts +108 -65
  146. package/packages/telegram/src/Config.ts +1 -6
  147. package/packages/telegram/src/Markdown.ts +4 -13
  148. package/packages/telegram/src/Renderer.ts +1 -1
  149. package/packages/telegram/src/Session.ts +3 -10
  150. package/packages/telegram/src/TaskScheduler.ts +31 -10
  151. package/packages/telegram/src/TaskStore.ts +11 -1
  152. package/packages/telegram/src/TaskTool.ts +1 -1
  153. package/packages/telegram/src/UpdateConfirm.ts +2 -2
  154. package/packages/tui/src/extensions/_init/index.ts +2 -5
  155. package/packages/tui/src/extensions/file-picker/index.ts +2 -6
  156. package/packages/tui/src/extensions/footer/index.ts +0 -1
  157. package/packages/tui/src/extensions/footer/powerline.ts +16 -28
  158. package/packages/tui/src/extensions/pim/index.ts +1 -1
  159. package/packages/tui/src/extensions/session-lease/index.ts +5 -6
  160. package/packages/tui/src/extensions/working-indicator/index.ts +1 -2
  161. package/packages/tui/src/themes/themeCliArgs.ts +1 -1
  162. package/packages/web/dist/client/assets/{abnfDiagram-O67JEVCF-CZ7V84ot.js → abnfDiagram-O67JEVCF-WweOU5DK.js} +1 -1
  163. package/packages/web/dist/client/assets/{arc-DiHGkUvc.js → arc-O2PmZXWt.js} +1 -1
  164. package/packages/web/dist/client/assets/architecture-7GRP2DOG-COBxVilU.js +1 -0
  165. package/packages/web/dist/client/assets/{architectureDiagram-NJMV4G6O-XS5DhfJB.js → architectureDiagram-NJMV4G6O-DwYq1YaM.js} +1 -1
  166. package/packages/web/dist/client/assets/{blockDiagram-BEXU5L5S-BCsgLvy1.js → blockDiagram-BEXU5L5S-CVab041n.js} +1 -1
  167. package/packages/web/dist/client/assets/{c4Diagram-YGBWAQC7-Bj9LcWNm.js → c4Diagram-YGBWAQC7-BmotHez3.js} +1 -1
  168. package/packages/web/dist/client/assets/channel-BKV-IcTA.js +1 -0
  169. package/packages/web/dist/client/assets/{chunk-3FUC2YCW-BmDurFxp.js → chunk-3FUC2YCW-CWNS7-n4.js} +1 -1
  170. package/packages/web/dist/client/assets/{chunk-5DYCD2WN-DAjG-pqn.js → chunk-5DYCD2WN-DflvXohu.js} +1 -1
  171. package/packages/web/dist/client/assets/{chunk-742MDFTN-Bmxs5puY.js → chunk-742MDFTN-B_0t6_RE.js} +1 -1
  172. package/packages/web/dist/client/assets/{chunk-7INBJB4K-Di7kIxrQ.js → chunk-7INBJB4K-wKj0Q3Kv.js} +1 -1
  173. package/packages/web/dist/client/assets/{chunk-7M6MHVWA-CSc8sR0b.js → chunk-7M6MHVWA-BMvUghc8.js} +1 -1
  174. package/packages/web/dist/client/assets/{chunk-7PRAP22T-C8kd5QvY.js → chunk-7PRAP22T-BY41wkcT.js} +1 -1
  175. package/packages/web/dist/client/assets/{chunk-GTNCS2PH-DG2b2LYE.js → chunk-GTNCS2PH-PqY_YoS0.js} +1 -1
  176. package/packages/web/dist/client/assets/{chunk-GWA4HPMP-DdLaLQCu.js → chunk-GWA4HPMP-fozSU5ty.js} +1 -1
  177. package/packages/web/dist/client/assets/{chunk-MBY4JIJT-C1j0yQlk.js → chunk-MBY4JIJT-CrHrC3jw.js} +1 -1
  178. package/packages/web/dist/client/assets/{chunk-NETBCI7D-Bfq9H74p.js → chunk-NETBCI7D-DWdAxieG.js} +1 -1
  179. package/packages/web/dist/client/assets/{chunk-O7XYJQB3-ZHvBmBO-.js → chunk-O7XYJQB3-B6uOn9iS.js} +1 -1
  180. package/packages/web/dist/client/assets/{chunk-UA2S7LBM-ku1JeHSK.js → chunk-UA2S7LBM-BxYSHqyy.js} +1 -1
  181. package/packages/web/dist/client/assets/{chunk-WEXAMYUT-BP1iga_7.js → chunk-WEXAMYUT-CtwIaQDa.js} +1 -1
  182. package/packages/web/dist/client/assets/{chunk-XXDRQBXY-BBeccPcX.js → chunk-XXDRQBXY-fgBFe-PX.js} +1 -1
  183. package/packages/web/dist/client/assets/{chunk-Z7XXMR3K-SMHZugaR.js → chunk-Z7XXMR3K-CPonoV3p.js} +1 -1
  184. package/packages/web/dist/client/assets/{chunk-ZIGJFQKS-CFU_JLG4.js → chunk-ZIGJFQKS-Cdu87cTj.js} +1 -1
  185. package/packages/web/dist/client/assets/{classDiagram-v2-NBCMYWYE-CYviuQzJ.js → classDiagram-v2-NBCMYWYE-DSWsPaa7.js} +1 -1
  186. package/packages/web/dist/client/assets/{core-DyHsgs5k.js → core-CBoS7AST.js} +1 -1
  187. package/packages/web/dist/client/assets/{cose-bilkent-JH36ORCC-9v2ZkJzo.js → cose-bilkent-JH36ORCC-CTwlldtJ.js} +1 -1
  188. package/packages/web/dist/client/assets/{cynefin-OW5HDTMX-Bx5xRadi.js → cynefin-OW5HDTMX-CZQ4EPNJ.js} +1 -1
  189. package/packages/web/dist/client/assets/{cynefinDiagram-VND7K2PF-BRfGDKqa.js → cynefinDiagram-VND7K2PF-C2gp6H_Q.js} +1 -1
  190. package/packages/web/dist/client/assets/{dagre-6A5THRUB-C4l-2L2e.js → dagre-6A5THRUB-CDxTP47t.js} +1 -1
  191. package/packages/web/dist/client/assets/{diagram-22UHCM2B-d_hQ3kyi.js → diagram-22UHCM2B-BIohE1lI.js} +1 -1
  192. package/packages/web/dist/client/assets/{diagram-3UASUU5V-DrEeguPI.js → diagram-3UASUU5V-TwAUir-w.js} +1 -1
  193. package/packages/web/dist/client/assets/{diagram-ATOU4E4O-BmfQ22pD.js → diagram-ATOU4E4O-BM1JQrIu.js} +1 -1
  194. package/packages/web/dist/client/assets/{diagram-CDSNMT55-BjVWjuPF.js → diagram-CDSNMT55-BKIqhxSI.js} +1 -1
  195. package/packages/web/dist/client/assets/{diagram-MLGK6HIB-wDjk-O8i.js → diagram-MLGK6HIB-CVe3QDHr.js} +1 -1
  196. package/packages/web/dist/client/assets/{diagram-MPIPVDR6-DqXQFE1s.js → diagram-MPIPVDR6-Bj-MQIFI.js} +1 -1
  197. package/packages/web/dist/client/assets/{dist-BddGOpie.js → dist-DlZpcyc2.js} +1 -1
  198. package/packages/web/dist/client/assets/{ebnfDiagram-ZINNZB2B-UB8kOITM.js → ebnfDiagram-ZINNZB2B-C06mmvmz.js} +1 -1
  199. package/packages/web/dist/client/assets/{elk-276RUBZZ-D4miYQnD.js → elk-276RUBZZ-CizJSNEj.js} +1 -1
  200. package/packages/web/dist/client/assets/{erDiagram-OPXOYQCR--RXKv7KH.js → erDiagram-OPXOYQCR-M3FQkKI1.js} +1 -1
  201. package/packages/web/dist/client/assets/eventmodeling-NTZA5JFV-D_UXLpIu.js +1 -0
  202. package/packages/web/dist/client/assets/flowDiagram-KWPJA3E3-BT4eEEVm.js +1 -0
  203. package/packages/web/dist/client/assets/{ganttDiagram-FUAMR5RP-C0CFpE5x.js → ganttDiagram-FUAMR5RP-CojF9Q16.js} +1 -1
  204. package/packages/web/dist/client/assets/{gitGraph-4MIJSDKK-VPL7nv2c.js → gitGraph-4MIJSDKK-YvKqGEPk.js} +1 -1
  205. package/packages/web/dist/client/assets/{gitGraphDiagram-X574FWY7-CgxJA-T8.js → gitGraphDiagram-X574FWY7-XqNqIFo9.js} +1 -1
  206. package/packages/web/dist/client/assets/index--2CDtzvY.css +1 -0
  207. package/packages/web/dist/client/assets/{index-XTlTnQmx.js → index-bT6QPJZs.js} +7 -7
  208. package/packages/web/dist/client/assets/{info-A6RAGUB7-P0-o68pj.js → info-A6RAGUB7-B_1BCzM2.js} +1 -1
  209. package/packages/web/dist/client/assets/{infoDiagram-VRGFBTTK-DFJZNRUP.js → infoDiagram-VRGFBTTK-zFX8B-dP.js} +1 -1
  210. package/packages/web/dist/client/assets/{ishikawaDiagram-OU5B5YK6-ZkyhNd1T.js → ishikawaDiagram-OU5B5YK6-DLzQ_Uyf.js} +1 -1
  211. package/packages/web/dist/client/assets/{journeyDiagram-ZHPQQLJL-DFevH8my.js → journeyDiagram-ZHPQQLJL-S3WRMmoa.js} +1 -1
  212. package/packages/web/dist/client/assets/{kanban-definition-PNTS6WVX-l7e7ZZDC.js → kanban-definition-PNTS6WVX-B5Z8I-kM.js} +1 -1
  213. package/packages/web/dist/client/assets/{line-DO_s6Ujd.js → line-BGMH-i2X.js} +1 -1
  214. package/packages/web/dist/client/assets/{linear-C4xH5PPc.js → linear-KsrestXG.js} +1 -1
  215. package/packages/web/dist/client/assets/{mermaid-parser.core-nQaTP3VY.js → mermaid-parser.core-DNffyJJA.js} +3 -3
  216. package/packages/web/dist/client/assets/{mermaid.core-Cz05yTZh.js → mermaid.core-Cz3vJeQG.js} +4 -4
  217. package/packages/web/dist/client/assets/{mindmap-definition-NLK3R4M7-CHOEuHm2.js → mindmap-definition-NLK3R4M7-CzA61XUf.js} +1 -1
  218. package/packages/web/dist/client/assets/{packet-AYTQ26CC-BH3ehPMo.js → packet-AYTQ26CC-BO55e7cR.js} +1 -1
  219. package/packages/web/dist/client/assets/{pegDiagram-GJSIUBJH-CkWBLtad.js → pegDiagram-GJSIUBJH-DeRiXYNd.js} +1 -1
  220. package/packages/web/dist/client/assets/{pie-WAS4IAKB-nNVEq3dx.js → pie-WAS4IAKB-D9ibrQRe.js} +1 -1
  221. package/packages/web/dist/client/assets/{pieDiagram-5QR66LMP-DimUBAgN.js → pieDiagram-5QR66LMP-BaBpPP33.js} +1 -1
  222. package/packages/web/dist/client/assets/{quadrantDiagram-O4NWA36T-BR0XpRGQ.js → quadrantDiagram-O4NWA36T-DIfn4GjM.js} +1 -1
  223. package/packages/web/dist/client/assets/{radar-RG4KPBEZ-paA-H3mb.js → radar-RG4KPBEZ-Dmn5-nJq.js} +1 -1
  224. package/packages/web/dist/client/assets/{railroad-74A4TZTK-yEiKB3rz.js → railroad-74A4TZTK-ZCWNEd2Z.js} +1 -1
  225. package/packages/web/dist/client/assets/railroad-abnf-HS5TGJTU-_swqhy0y.js +1 -0
  226. package/packages/web/dist/client/assets/railroad-ebnf-LZEXJU2U-CytbazPx.js +1 -0
  227. package/packages/web/dist/client/assets/railroad-peg-WCYAUIDC-Bg8QW17T.js +1 -0
  228. package/packages/web/dist/client/assets/{railroadDiagram-XR7U4H2S--TXe6rdU.js → railroadDiagram-XR7U4H2S-CDPZ39sy.js} +1 -1
  229. package/packages/web/dist/client/assets/{requirementDiagram-PLB6GJNP-DyqH36Za.js → requirementDiagram-PLB6GJNP-CyCI8Yul.js} +1 -1
  230. package/packages/web/dist/client/assets/{sankeyDiagram-IPEJSGJF-Bg6e3BlM.js → sankeyDiagram-IPEJSGJF-p_XAPv72.js} +1 -1
  231. package/packages/web/dist/client/assets/{sequenceDiagram-PO4LG4MO-ClGf85My.js → sequenceDiagram-PO4LG4MO-DmR6IP_o.js} +1 -1
  232. package/packages/web/dist/client/assets/{src-DF7hQfMh.js → src-gnv7pJ1z.js} +1 -1
  233. package/packages/web/dist/client/assets/{stateDiagram-v2-GCMORJYK-BK8TpxNo.js → stateDiagram-v2-GCMORJYK-7ZTHl6ih.js} +1 -1
  234. package/packages/web/dist/client/assets/{swimlanes-2SLR337P-DDnTIT9M.js → swimlanes-2SLR337P-N6bj71pw.js} +1 -1
  235. package/packages/web/dist/client/assets/swimlanesDiagram-TC7HE7FX-BJQ2CBsp.js +8 -0
  236. package/packages/web/dist/client/assets/{timeline-definition-EJHVYXUP-mBBbH3bk.js → timeline-definition-EJHVYXUP-GNez0kW8.js} +1 -1
  237. package/packages/web/dist/client/assets/{treeView-Q6P3EWNA-CTK7tRwR.js → treeView-Q6P3EWNA-DyQZkboR.js} +1 -1
  238. package/packages/web/dist/client/assets/{treemap-WGGIJYW6-vOI-Ef_m.js → treemap-WGGIJYW6-_J8Pw2TM.js} +1 -1
  239. package/packages/web/dist/client/assets/{usecaseDiagram-POWQR4AR-COcii8x-.js → usecaseDiagram-POWQR4AR-Bg-CzKjl.js} +1 -1
  240. package/packages/web/dist/client/assets/{vennDiagram-UO4OBE2U-D6kmDGpM.js → vennDiagram-UO4OBE2U-DBQKHXhK.js} +1 -1
  241. package/packages/web/dist/client/assets/{wardley-WFR3VGLG-CtE2KI9r.js → wardley-WFR3VGLG-B5aAsQ3F.js} +1 -1
  242. package/packages/web/dist/client/assets/{wardleyDiagram-VNRHLVJA-ncxNGWnW.js → wardleyDiagram-VNRHLVJA-BKUQ1LK6.js} +1 -1
  243. package/packages/web/dist/client/assets/{xychartDiagram-PMCCYNJV-DUvd2Qze.js → xychartDiagram-PMCCYNJV-BI2sVbks.js} +1 -1
  244. package/packages/web/dist/client/index.html +2 -2
  245. package/packages/web/dist/client/assets/architecture-7GRP2DOG-HIzEIkwQ.js +0 -1
  246. package/packages/web/dist/client/assets/channel-BCA6qe9I.js +0 -1
  247. package/packages/web/dist/client/assets/eventmodeling-NTZA5JFV-l6SYFw1s.js +0 -1
  248. package/packages/web/dist/client/assets/flowDiagram-KWPJA3E3-CWW9qnqm.js +0 -1
  249. package/packages/web/dist/client/assets/index-D9_XJLSc.css +0 -1
  250. package/packages/web/dist/client/assets/railroad-abnf-HS5TGJTU-mVQx9aVM.js +0 -1
  251. package/packages/web/dist/client/assets/railroad-ebnf-LZEXJU2U-CllXx1OJ.js +0 -1
  252. package/packages/web/dist/client/assets/railroad-peg-WCYAUIDC-BBD2Q5W_.js +0 -1
  253. package/packages/web/dist/client/assets/swimlanesDiagram-TC7HE7FX-CM8UnP5t.js +0 -8
@@ -12,30 +12,29 @@ import { BodyRenderer } from "../view/BodyRenderer";
12
12
  import type { ToolView } from "../view/ViewBlock";
13
13
 
14
14
  export type ToolViewInput<TParams extends TSchema, TDetails> = {
15
- /** Partially streamed while the call is in flight; treat fields as optional. */
15
+ /** Partial while streaming; treat fields as optional. */
16
16
  readonly args: Static<TParams>;
17
- /** A streaming snapshot rather than the final result while `isPartial`. */
17
+ /** A snapshot, not the final result, while `isPartial`. */
18
18
  readonly result?: AgentToolResult<TDetails>;
19
19
  readonly isPartial: boolean;
20
20
  readonly cwd: string;
21
21
  };
22
22
 
23
- /** What a call to this tool can do to the host machine; declaring nothing means `unbounded`. */
24
- export type ToolEffect<TParams extends TSchema = TSchema> =
23
+ /** What a call can do to the host machine. */
24
+ type ToolEffect<TParams extends TSchema = TSchema> =
25
25
  | { readonly kind: "readOnly" }
26
26
  | {
27
27
  readonly kind: "writesPaths";
28
- /** Paths as the model wrote them; throwing means "unknown" and is treated as `unbounded`. */
28
+ /** Paths as the model wrote them. Throwing is treated as `unbounded`. */
29
29
  readonly paths: (args: Static<TParams>) => readonly string[];
30
30
  }
31
31
  | { readonly kind: "unbounded" };
32
32
 
33
- /** `ToolEffect` with its parameter type erased, for name-keyed lookup. */
34
- export type ErasedToolEffect = ToolEffect<TSchema> & {
33
+ type ErasedToolEffect = ToolEffect<TSchema> & {
35
34
  readonly paths?: (args: unknown) => readonly string[];
36
35
  };
37
36
 
38
- /** Pi's tool definition plus pim's view model, which must be pure over `(args, result, cwd)` to replay. */
37
+ /** `toViewModel` must be pure over `(args, result, cwd)` so sessions can replay. */
39
38
  export type PimToolDefinition<
40
39
  TParams extends TSchema,
41
40
  TDetails = unknown,
@@ -46,13 +45,14 @@ export type PimToolDefinition<
46
45
  readonly effect?: ToolEffect<TParams>;
47
46
  };
48
47
 
49
- /** A registered `toViewModel` with its parameter types erased, for name-keyed lookup. */
50
- export type ToolViewFactory = (input: {
48
+ type ViewCall = {
51
49
  readonly args: unknown;
52
50
  readonly result?: AgentToolResult<unknown>;
53
51
  readonly isPartial: boolean;
54
52
  readonly cwd: string;
55
- }) => ToolView;
53
+ };
54
+
55
+ type ToolViewFactory = (input: ViewCall) => ToolView;
56
56
 
57
57
  type ViewRenderState<TDetails> = {
58
58
  viewResult?: AgentToolResult<TDetails>;
@@ -73,20 +73,12 @@ type JsonSchema = {
73
73
  const viewFactories = new Map<string, ToolViewFactory>();
74
74
  const effects = new Map<string, ErasedToolEffect>();
75
75
 
76
- /** What a registered tool declared it can do; absent reads as `unbounded`. */
76
+ /** Undefined means `unbounded`. */
77
77
  function effectOf(toolName: string): ErasedToolEffect | undefined {
78
78
  return effects.get(toolName);
79
79
  }
80
80
 
81
- function baseView(
82
- toolName: string,
83
- call: {
84
- readonly args: unknown;
85
- readonly result?: AgentToolResult<unknown>;
86
- readonly isPartial: boolean;
87
- readonly cwd: string;
88
- }
89
- ): ToolView {
81
+ function baseView(toolName: string, call: ViewCall): ToolView {
90
82
  return (
91
83
  viewFactories.get(toolName)?.(call) ?? genericView(toolName, call.args)
92
84
  );
@@ -95,7 +87,7 @@ function baseView(
95
87
  const branchesOf = (schema?: JsonSchema): readonly JsonSchema[] | undefined =>
96
88
  schema?.anyOf ?? schema?.oneOf;
97
89
 
98
- /** The view for one call, with a generic fallback for a tool that registered none. */
90
+ /** Falls back to a generic view for tools without a view model. */
99
91
  function viewOf(input: {
100
92
  readonly name: string;
101
93
  readonly args: unknown;
@@ -116,11 +108,7 @@ function viewOf(input: {
116
108
 
117
109
  function errorView(
118
110
  name: string,
119
- call: {
120
- readonly args: unknown;
121
- readonly isPartial: boolean;
122
- readonly cwd: string;
123
- },
111
+ call: Omit<ViewCall, "result">,
124
112
  result: AgentToolResult<unknown> | undefined
125
113
  ): ToolView {
126
114
  const view = baseView(name, call);
@@ -135,7 +123,7 @@ function errorView(
135
123
  };
136
124
  }
137
125
 
138
- /** Wrap a tool definition so pi's validator errors are rewritten before reaching the model. */
126
+ /** Registers pim-only fields and rewrites pi's validation errors into clearer ones. */
139
127
  function wrap<TParams extends TSchema, TDetails = unknown, TState = unknown>(
140
128
  def: PimToolDefinition<TParams, TDetails, TState>
141
129
  ): ToolDefinition<TParams, TDetails, TState> {
@@ -192,7 +180,6 @@ function register<
192
180
  pi.registerTool(wrap(def));
193
181
  }
194
182
 
195
- /** Rewrite a `validateToolArguments` error string into a clearer form. */
196
183
  function rewriteValidationError(
197
184
  toolName: string,
198
185
  schema: JsonSchema,
@@ -271,7 +258,7 @@ function synthesizeRenderers<TParams extends TSchema, TDetails, TState>(
271
258
  def.renderResult ??
272
259
  ((result, options, theme, context) => {
273
260
  const state = context.state as ViewRenderState<TDetails>;
274
- // Defer the redraw: invalidating re-entrantly makes pi paint the body twice.
261
+ // Deferred: a re-entrant invalidate makes pi paint the body twice.
275
262
  if (!options.isPartial && state.viewResult === undefined) {
276
263
  state.viewResult = result;
277
264
  queueMicrotask(() => context.invalidate());
@@ -8,7 +8,7 @@ import { Supervisor, type Install } from "./Supervisor";
8
8
 
9
9
  const STAGING = "staging";
10
10
 
11
- // Relative to `packages/web`: the vite root `web:build` cds into.
11
+ // Relative to `packages/web`, the vite root.
12
12
  const STAGING_OUT_DIR = `dist/${STAGING}`;
13
13
 
14
14
  type ClientDirs = {
@@ -17,7 +17,6 @@ type ClientDirs = {
17
17
  readonly previous: string;
18
18
  };
19
19
 
20
- /** A spawned command, or filesystem work — never both. */
21
20
  export type UpdateStep =
22
21
  | {
23
22
  readonly label: string;
@@ -26,14 +25,14 @@ export type UpdateStep =
26
25
  }
27
26
  | { readonly label: string; readonly act: () => Promise<void> };
28
27
 
29
- /** Work the plan declined to do; `blocking` means the run did less than asked. */
28
+ /** `blocking` means the update did less than asked. */
30
29
  export type UpdateSkip = {
31
30
  readonly label: string;
32
31
  readonly reason: string;
33
32
  readonly blocking: boolean;
34
33
  };
35
34
 
36
- export type UpdatePlan = {
35
+ type UpdatePlan = {
37
36
  readonly steps: ReadonlyArray<UpdateStep>;
38
37
  readonly skipped: ReadonlyArray<UpdateSkip>;
39
38
  };
@@ -41,24 +40,24 @@ export type UpdatePlan = {
41
40
  export type UpdateFacts = {
42
41
  readonly at: Install;
43
42
  readonly packageName: string;
44
- /** A dev checkout with no uncommitted changes; irrelevant to a prod install. */
43
+ /** Dev only: no uncommitted changes. */
45
44
  readonly cleanTree: boolean;
46
- /** The dev checkout's branch tracks a remote one, so a pull has somewhere to pull from; irrelevant to a prod install. */
45
+ /** Dev only: the branch has an upstream. */
47
46
  readonly tracked: boolean;
48
- /** The newest published release, or undefined when the registry was silent. */
47
+ /** Undefined when the registry could not be reached. */
49
48
  readonly latest: string | undefined;
50
49
  };
51
50
 
52
51
  export type UpdateOutcome = {
53
52
  readonly ok: boolean;
54
53
  readonly from: string;
55
- /** Re-read from disk after the steps ran, never the version that was asked for. */
54
+ /** Re-read from disk after the steps ran. */
56
55
  readonly to: string;
57
56
  readonly skipped: ReadonlyArray<UpdateSkip>;
58
57
  readonly error: string | undefined;
59
58
  };
60
59
 
61
- export type UpdateOptions = {
60
+ type UpdateOptions = {
62
61
  readonly onStep?: (label: string) => void | Promise<void>;
63
62
  };
64
63
 
@@ -71,7 +70,7 @@ function clientDirs(packageRoot: string): ClientDirs {
71
70
  };
72
71
  }
73
72
 
74
- // `vite build` empties its outDir: build to staging and swap, or a failed build deletes the live bundle.
73
+ // `vite build` empties its outDir, so build to staging and swap; a failed build keeps the live bundle.
75
74
  async function swapClient(packageRoot: string): Promise<void> {
76
75
  const dirs = clientDirs(packageRoot);
77
76
  await rm(dirs.previous, { recursive: true, force: true });
@@ -83,7 +82,6 @@ async function swapClient(packageRoot: string): Promise<void> {
83
82
  await rename(dirs.staging, dirs.client);
84
83
  }
85
84
 
86
- /** Why this checkout cannot be pulled, or undefined when it can. */
87
85
  function pullBlocker(facts: UpdateFacts): string | undefined {
88
86
  if (!facts.tracked) {
89
87
  return "this branch has no upstream to pull from";
@@ -137,11 +135,11 @@ function plan(facts: UpdateFacts): UpdatePlan {
137
135
  blocking: true,
138
136
  });
139
137
  } else {
140
- // Install the exact version, never `@latest`: a tag cannot be reported truthfully.
138
+ // Exact version, not `@latest`, so the reported version is accurate.
141
139
  steps.push({
142
140
  label: `install ${packageName}@${latest}`,
143
141
  command: ["bun", "install", "-g", `${packageName}@${latest}`],
144
- // No cwd: a global install must not adopt the tree it is replacing.
142
+ // No cwd: the global install must not run inside the tree it replaces.
145
143
  cwd: undefined,
146
144
  });
147
145
  }
@@ -156,14 +154,16 @@ async function gather(): Promise<UpdateFacts> {
156
154
  ? Git.fetchStatus(at.packageRoot).then((git) => git.dirtyCount === 0)
157
155
  : Promise.resolve(true),
158
156
  at.kind === "dev"
159
- ? Git.upstreamOf(at.packageRoot).then((at) => at !== undefined)
157
+ ? Git.upstreamOf(at.packageRoot).then(
158
+ (upstream) => upstream !== undefined
159
+ )
160
160
  : Promise.resolve(true),
161
161
  at.kind === "prod" ? PimVersion.latest() : Promise.resolve(undefined),
162
162
  ]);
163
163
  return { at, packageName, cleanTree, tracked, latest };
164
164
  }
165
165
 
166
- /** Never restarts or exits: the caller owns that. */
166
+ /** Never restarts or exits; that's the caller's job. */
167
167
  async function run(options: UpdateOptions = {}): Promise<UpdateOutcome> {
168
168
  const from = await PimVersion.current();
169
169
  const { steps, skipped } = plan(await gather());
@@ -98,5 +98,5 @@ const SUMMARY_BUILDERS: FrameBuilders = {
98
98
  flow: gutter(Renderer.GAPPED_PREFIX),
99
99
  };
100
100
 
101
- /** Turns painted body lines into the pi-tui components that frame them. */
101
+ /** Renders view blocks into pi-tui components. */
102
102
  export const BodyRenderer = { render };
@@ -48,5 +48,4 @@ function fileView(args: {
48
48
  };
49
49
  }
50
50
 
51
- /** View-model fragments shared by every tool that reports a file diff. */
52
51
  export const DiffBlocks = { statSpans, stats, body, fileView };
@@ -1,11 +1,7 @@
1
1
  import type { ToolDiffHunk, ToolDiffLine } from "../shared/DiffLines";
2
2
  import type { LineSpan } from "../shared/RepoDiff";
3
3
 
4
- /**
5
- * A stretch of a file neither side changed and no hunk shows, numbered on the
6
- * new side. `above` and `below` say which ends of it sit against a hunk, which
7
- * is where a reader asking for more of it is given it.
8
- */
4
+ /** Unchanged lines no hunk shows, in new-side numbers. `above`/`below`: that end touches a hunk. */
9
5
  export type DiffGap = {
10
6
  readonly start: number;
11
7
  readonly end: number;
@@ -14,7 +10,7 @@ export type DiffGap = {
14
10
  readonly below: boolean;
15
11
  };
16
12
 
17
- /** What a diff is painted from, top to bottom: hunks and the gaps between them. */
13
+ /** Hunks and gaps in display order. */
18
14
  export type DiffPart =
19
15
  | { readonly hunk: ToolDiffHunk }
20
16
  | { readonly gap: DiffGap };
@@ -22,7 +18,7 @@ export type DiffPart =
22
18
  /** Lines one click reveals at each end of a gap. */
23
19
  const STEP = 25;
24
20
 
25
- /** A remainder this small is taken with the click rather than left as a row of its own. */
21
+ /** A smaller remainder is revealed with the click instead of left as its own gap. */
26
22
  const MIN_REMAINDER = 10;
27
23
 
28
24
  function newEnd(hunk: ToolDiffHunk): number {
@@ -44,11 +40,7 @@ function gapOf(
44
40
  : [{ start, end, count: end - start + 1, above, below }];
45
41
  }
46
42
 
47
- /**
48
- * Every gap in one file's hunks: before the first, between each pair, and
49
- * after the last once `total` says where the file ends. A file with no new
50
- * side to number has none of them.
51
- */
43
+ /** Gaps before, between and (given `total` lines) after the hunks. */
52
44
  function gaps(
53
45
  hunks: readonly ToolDiffHunk[],
54
46
  total?: number
@@ -71,10 +63,7 @@ function gaps(
71
63
  ];
72
64
  }
73
65
 
74
- /**
75
- * What to ask the server for when a reader opens a gap: a step against each
76
- * hunk it touches, or the whole gap when what would be left of it is a sliver.
77
- */
66
+ /** Line spans to fetch when a gap is opened: `STEP` lines at each hunk-facing end, or the whole gap if little would remain. */
78
67
  function spans(gap: DiffGap): readonly LineSpan[] {
79
68
  const edges = (gap.above ? 1 : 0) + (gap.below ? 1 : 0);
80
69
  if (gap.count <= edges * STEP + MIN_REMAINDER) {
@@ -86,7 +75,7 @@ function spans(gap: DiffGap): readonly LineSpan[] {
86
75
  ];
87
76
  }
88
77
 
89
- /** How many lines opening a gap would put on the page. */
78
+ /** Lines that opening `gap` would reveal. */
90
79
  function revealed(gap: DiffGap): number {
91
80
  return spans(gap).reduce(
92
81
  (total, span) => total + span.end - span.start + 1,
@@ -94,15 +83,13 @@ function revealed(gap: DiffGap): number {
94
83
  );
95
84
  }
96
85
 
97
- /** The hunks with each gap in its place among them. */
98
86
  function parts(
99
87
  hunks: readonly ToolDiffHunk[],
100
88
  total?: number
101
89
  ): readonly DiffPart[] {
102
90
  const found = gaps(hunks, total);
103
91
  const tail = found.find((gap) => !gap.below);
104
- // Keyed by the line a gap ends on, which is the line before the hunk it
105
- // leads into: one lookup per hunk rather than a scan of every gap.
92
+ // Keyed by end line, i.e. the line before the hunk it leads into.
106
93
  const leading = new Map(found.map((gap) => [gap.end, gap]));
107
94
  return [
108
95
  ...hunks.flatMap((hunk) => {
@@ -117,7 +104,7 @@ type Run = {
117
104
  readonly oldStart: number;
118
105
  readonly newStart: number;
119
106
  readonly lines: ToolDiffLine[];
120
- /** Lines of the run that stand on the new side, counted as they are added. */
107
+ /** New-side line count. */
121
108
  newCount: number;
122
109
  };
123
110
 
@@ -140,10 +127,8 @@ function hunkOf(run: Run): ToolDiffHunk {
140
127
  }
141
128
 
142
129
  /**
143
- * The hunks with every line a reader has since been given spliced back into
144
- * the gaps around them, and hunks that now touch merged into one. Only lines
145
- * running from a hunk's own edge are taken: an island in the middle of a gap
146
- * is not a thing this ever asks for.
130
+ * Splices `known` lines (by new-side number) into the hunks as context and
131
+ * merges hunks that now touch. Only lines contiguous with a hunk edge are used.
147
132
  */
148
133
  function expand(
149
134
  hunks: readonly ToolDiffHunk[],
@@ -6,7 +6,7 @@ function detab(text: string): string {
6
6
  return text.replace(/\t/g, TAB);
7
7
  }
8
8
 
9
- // Highlight each side as one block, never line by line, or multi-line strings and comments mis-tokenise.
9
+ /** Highlights each side as one block so multi-line strings and comments tokenise correctly. */
10
10
  function mapSides<T>(
11
11
  lines: readonly ToolDiffLine[],
12
12
  highlight: (block: string) => readonly T[]
@@ -17,7 +17,7 @@ function mapSides<T>(
17
17
  const newBlock: string[] = [];
18
18
 
19
19
  for (const line of lines) {
20
- // A context line must hold a slot in both blocks to keep tokeniser state aligned.
20
+ // Context lines go into both sides.
21
21
  if (line.kind !== "added") {
22
22
  oldIndices.push(oldBlock.length);
23
23
  oldBlock.push(line.text);
@@ -1,6 +1,6 @@
1
1
  import type { ToolDiffHunk, ToolDiffLine } from "../shared/DiffLines";
2
2
 
3
- /** One row of a split view: the old side, the new side, or both. */
3
+ /** One split-view row. */
4
4
  export type DiffPair = {
5
5
  readonly left?: ToolDiffLine;
6
6
  readonly right?: ToolDiffLine;
@@ -32,7 +32,7 @@ function pair(hunk: ToolDiffHunk): readonly DiffPair[] {
32
32
  continue;
33
33
  }
34
34
 
35
- // A removal after an addition starts a new replacement rather than joining the last.
35
+ // A removal after an addition starts a new replacement block.
36
36
  if (added.length > 0) {
37
37
  zip();
38
38
  }
@@ -13,14 +13,6 @@ import type {
13
13
 
14
14
  type Mode = "inline" | "block";
15
15
 
16
- /** How a block sits in a body; `embed` payloads must never be re-wrapped. */
17
- export type MarkdownFrame = "flow" | "embed" | "heading";
18
-
19
- export type MarkdownGroup = {
20
- readonly frame: MarkdownFrame;
21
- readonly lines: readonly string[];
22
- };
23
-
24
16
  export type PaintedTool = {
25
17
  readonly icon: string;
26
18
  readonly lines: readonly string[];
@@ -50,20 +42,13 @@ function paintInline(blocks: readonly ViewBlock[]): string {
50
42
  .join(" ");
51
43
  }
52
44
 
53
- function paintBody(blocks: readonly ViewBlock[]): MarkdownGroup[] {
54
- return Painting.groupByFrame(blocks, Painting.FRAMES).map((group) => ({
55
- frame: group.frame,
56
- lines: group.blocks.flatMap((block) => paintBlock(block, "block")),
57
- }));
58
- }
59
-
60
45
  function icon(toolIcon: ToolIcon | undefined): string {
61
46
  return toolIcon === undefined ? DEFAULT_ICON : ICONS[toolIcon];
62
47
  }
63
48
 
64
49
  function paintTool(view: ToolView): PaintedTool {
65
50
  const head = [view.title, view.summary ?? []]
66
- .map((blocks) => paintInline(blocks))
51
+ .map(paintInline)
67
52
  .filter((text) => text !== "")
68
53
  .join(" ");
69
54
  const outline = outlined(view.body ?? []).flatMap((block) =>
@@ -76,7 +61,7 @@ function paintTool(view: ToolView): PaintedTool {
76
61
  };
77
62
  }
78
63
 
79
- /** A chat row carries a body's headings and any payload that fits a line; an embedded one needs a screen. */
64
+ /** Body blocks shown in a chat row: headings and single-line payloads. */
80
65
  function outlined(blocks: readonly ViewBlock[]): readonly ViewBlock[] {
81
66
  return blocks.filter((block) => {
82
67
  const frame = Painting.FRAMES[block.kind];
@@ -308,7 +293,5 @@ export const MarkdownPainter = {
308
293
  escape,
309
294
  paint,
310
295
  paintInline,
311
- paintBody,
312
- icon,
313
296
  paintTool,
314
297
  };
@@ -1,29 +1,16 @@
1
- /**
2
- * A file that moved, read as one path rather than two. Everything the old and
3
- * new paths agree on is said once, and only the segments that actually changed
4
- * are named on both sides — `packages/{web ➝ tui}/src/App.tsx` rather than two
5
- * near-identical paths a reader has to diff by eye.
6
- */
1
+ /** A move split for display as `packages/{web ➝ tui}/src/App.tsx`. */
7
2
  export type MoveParts = {
8
- /** The leading directories both paths share, with its trailing `/`. */
3
+ /** Shared leading segments, with a trailing `/`. */
9
4
  readonly prefix: string;
10
- /** What those segments used to be. */
11
5
  readonly from: string;
12
- /** What they are now. */
13
6
  readonly to: string;
14
- /** The trailing segments both paths share, with its leading `/`. */
7
+ /** Shared trailing segments, with a leading `/`. */
15
8
  readonly suffix: string;
16
9
  };
17
10
 
18
- /** The arrow every surface draws a move with. */
19
11
  const ARROW = "➝";
20
12
 
21
- /**
22
- * The shared head and tail of a move, or `undefined` when there is nothing
23
- * worth folding: two paths that share no segment read better whole, since a
24
- * brace around the entire path only adds punctuation. Two bare filenames are
25
- * the exception — `{old.ts ➝ new.ts}` shares no segment but is still one name.
26
- */
13
+ /** Undefined when the paths share no segment, unless both are bare filenames. */
27
14
  function fold(oldPath: string, newPath: string): MoveParts | undefined {
28
15
  const oldParts = oldPath.split("/");
29
16
  const newParts = newPath.split("/");
@@ -22,7 +22,7 @@ function dispatch<TOut, TArgs extends readonly unknown[]>(
22
22
  return painter(block, ...args);
23
23
  }
24
24
 
25
- /** How a block sits in its container: `embed` must not be restyled or re-wrapped, `tight` paints its own leading column. */
25
+ /** `embed` is never restyled or re-wrapped; `tight` paints its own leading column. */
26
26
  export type BlockFrame = "flow" | "embed" | "tight" | "heading";
27
27
 
28
28
  const FRAMES = {
@@ -41,7 +41,7 @@ const FRAMES = {
41
41
  notice: "flow",
42
42
  } as const satisfies Record<ViewBlock["kind"], BlockFrame>;
43
43
 
44
- /** What a block is to the tool that emitted it: its result, or the chrome around one. */
44
+ /** Whether a block is the tool's result or the chrome around it. */
45
45
  export type BlockWeight = "payload" | "chrome";
46
46
 
47
47
  const WEIGHT = {
@@ -107,12 +107,12 @@ function linkLabel(block: {
107
107
  : block.label;
108
108
  }
109
109
 
110
- /** What a painter that cannot draw the picture says instead: `[image 1200×800 png · 240 KB]`. */
110
+ /** Text fallback, e.g. `[image 1200×800 png · 240 KB]`. */
111
111
  function imageSummary(block: BlockOf<"image">): string {
112
112
  return `[image ${block.width}×${block.height} ${ImageMime.extensionOf(block.mimeType)} · ${Format.bytes(block.bytes)}]`;
113
113
  }
114
114
 
115
- /** The picture plus what it cannot show about itself; `extra` is whatever only the calling tool knows. */
115
+ /** The image block plus a kv block of its details; `extra` is appended to the pairs. */
116
116
  function imageBlocks(
117
117
  details: ImageDetails,
118
118
  alt: string,
@@ -41,11 +41,10 @@ export type KvPair = readonly [string, string];
41
41
 
42
42
  export type ViewBlock =
43
43
  | { readonly kind: "text"; readonly text: string; readonly tone?: Tone }
44
- /** Markdown source; framed as an embed and never re-coloured or re-wrapped. */
44
+ /** Never re-coloured or re-wrapped. */
45
45
  | { readonly kind: "markdown"; readonly text: string }
46
- /** One line of mixed-tone text, e.g. a `+5`/`-2` diff stat or a rename. */
46
+ /** One line of mixed-tone text, e.g. a `+5`/`-2` diff stat. */
47
47
  | { readonly kind: "spans"; readonly spans: readonly Span[] }
48
- /** Introduces a sub-item inside a body; painters draw it as a separated heading. */
49
48
  | {
50
49
  readonly kind: "section";
51
50
  readonly label: string;
@@ -66,7 +65,7 @@ export type ViewBlock =
66
65
  | {
67
66
  readonly kind: "file";
68
67
  readonly path: string;
69
- /** An undefined end is an open-ended range (`:40`), not a missing one. */
68
+ /** An undefined end means open-ended (`:40`). */
70
69
  readonly range?: readonly [number, number | undefined];
71
70
  readonly truncated?: boolean;
72
71
  }
@@ -80,15 +79,15 @@ export type ViewBlock =
80
79
  readonly pairs: readonly KvPair[];
81
80
  }
82
81
  | { readonly kind: "link"; readonly href: string; readonly label: string }
83
- /** A file delivered to the reader, not a path on the agent's machine; `url` is server-relative. */
84
82
  | {
85
83
  readonly kind: "attachment";
86
- /** What to call it on screen; never a path. */
84
+ /** Display name, never a path. */
87
85
  readonly name: string;
86
+ /** Server-relative. */
88
87
  readonly url: string;
89
88
  readonly isImage: boolean;
90
89
  }
91
- /** A picture the model was shown, addressed by digest; the bytes never ride the wire, and the client that fetches them builds the URL. */
90
+ /** An image the model saw, addressed by digest; the client builds the URL. */
92
91
  | {
93
92
  readonly kind: "image";
94
93
  readonly sha256: string;
@@ -110,15 +109,15 @@ export type BlockOf<TKind extends ViewBlock["kind"]> = Extract<
110
109
  >;
111
110
 
112
111
  export type ToolView = {
113
- /** Display label for the title row, e.g. `"Read"`; defaults to the definition's label. */
112
+ /** Defaults to the tool definition's label. */
114
113
  readonly label?: string;
115
- /** Tints the label; defaults to the title colour. */
114
+ /** Defaults to the title colour. */
116
115
  readonly labelTone?: Tone;
117
116
  readonly icon?: ToolIcon;
118
- /** Painted as one line; a lone `markdown` block is handed over unpainted instead. */
117
+ /** Painted as one line; a lone `markdown` block is passed through unpainted. */
119
118
  readonly title: readonly ViewBlock[];
120
- /** Status content rendered in every state: streaming, collapsed and expanded. */
119
+ /** Shown in every state, including streaming. */
121
120
  readonly summary?: readonly ViewBlock[];
122
- /** Rendered only once the row is expanded, and never while streaming. */
121
+ /** Shown only when expanded, never while streaming. */
123
122
  readonly body?: readonly ViewBlock[];
124
123
  };
@@ -1,21 +1,16 @@
1
1
  import type { SurfaceName } from "./Surfaces";
2
2
 
3
- /** A running surface, and the only thing the daemon asks of one. */
4
3
  export type SurfaceHandle = {
5
4
  readonly stop: () => Promise<void>;
6
5
  };
7
6
 
8
7
  export type Surface = {
9
8
  readonly name: SurfaceName;
10
- /** Brings the surface up, resolving once it is serving rather than when it stops. */
9
+ /** Resolves once the surface is serving. */
11
10
  readonly start: () => Promise<SurfaceHandle>;
12
11
  };
13
12
 
14
- /**
15
- * Every surface in one process, and none of them able to take another down: a
16
- * bot that cannot reach Telegram leaves the browser served, and a port already
17
- * bound leaves the bot polling.
18
- */
13
+ /** Runs every surface in one process; one failing never stops the others. */
19
14
  export class Daemon {
20
15
  private readonly surfaces: ReadonlyArray<Surface>;
21
16
  private readonly live = new Map<SurfaceName, SurfaceHandle>();
@@ -8,7 +8,6 @@ import { Surfaces, type SurfaceName } from "./Surfaces";
8
8
 
9
9
  type FrozenUnit = Unit & { readonly args: ReadonlyArray<string> };
10
10
 
11
- /** What this machine serves today: the unit being replaced, or the ones it supersedes. */
12
11
  export type Installed = {
13
12
  readonly surfaces: ReadonlyArray<SurfaceName>;
14
13
  readonly args: ReadonlyArray<string>;
@@ -17,10 +16,8 @@ export type Installed = {
17
16
  const NOTHING: Installed = { surfaces: [], args: [] };
18
17
 
19
18
  /**
20
- * A supervisor starts the daemon with no argv: every flag it needs must be
21
- * frozen in here. What is installed already is the base the new argv overrides
22
- * flag by flag, so installing one surface keeps the other one — and its
23
- * settings. Naming `--surfaces` outright is how a daemon is shrunk again.
19
+ * The supervisor starts the daemon with no argv, so every flag is frozen here.
20
+ * `argv` overrides `installed` flag by flag; an explicit `--surfaces` replaces the surface list.
24
21
  */
25
22
  function unit(
26
23
  argv: ReadonlyArray<string>,
@@ -35,7 +32,7 @@ function unit(
35
32
  description: `${DaemonUnit.description} (${surfaces.join(", ")})`,
36
33
  args: [
37
34
  "--surfaces",
38
- Surfaces.format(surfaces),
35
+ surfaces.join(","),
39
36
  ...(surfaces.includes("web")
40
37
  ? WebOptions.freeze(WebOptions.parse(merged))
41
38
  : []),
@@ -43,10 +40,7 @@ function unit(
43
40
  };
44
41
  }
45
42
 
46
- /**
47
- * The merged unit's own argv, or — before the cutover — whatever the per-surface
48
- * units were installed with, so a tailnet hostname frozen months ago survives.
49
- */
43
+ /** The daemon unit's argv, falling back to the superseded per-surface units'. */
50
44
  async function installed(): Promise<Installed> {
51
45
  const current = await Supervisor.installedArgs(DaemonUnit);
52
46
  if (current.length > 0) {
@@ -63,7 +57,7 @@ async function installed(): Promise<Installed> {
63
57
  };
64
58
  }
65
59
 
66
- // `--web-cwd` becomes `--cwd` on the way in, or it would outrank a new `--cwd`.
60
+ // Map `--web-cwd` back to `--cwd` so a new `--cwd` can override it.
67
61
  function carriedOver(args: ReadonlyArray<string>): ReadonlyArray<string> {
68
62
  return args.map((arg) => (arg === "--web-cwd" ? "--cwd" : arg));
69
63
  }
@@ -93,7 +87,6 @@ async function uninstall(): Promise<void> {
93
87
 
94
88
  async function buildClient(): Promise<void> {
95
89
  const at = await Supervisor.detectInstall();
96
- // Probe `index.html`, not the directory: a half-emptied `dist/client` is still a broken bundle.
97
90
  const bundled = await Bun.file(
98
91
  join(DEFAULT_CLIENT_DIR, "index.html")
99
92
  ).exists();