pim-agent 0.12.1 → 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 (264) hide show
  1. package/package.json +4 -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 +3 -2
  36. package/packages/core/src/extensions/system-prompt/prompt.ts +13 -3
  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-WweOU5DK.js +1 -0
  163. package/packages/web/dist/client/assets/arc-O2PmZXWt.js +1 -0
  164. package/packages/web/dist/client/assets/architecture-7GRP2DOG-COBxVilU.js +1 -0
  165. package/packages/web/dist/client/assets/architectureDiagram-NJMV4G6O-DwYq1YaM.js +36 -0
  166. package/packages/web/dist/client/assets/array-BifhSqXX.js +1 -0
  167. package/packages/web/dist/client/assets/blockDiagram-BEXU5L5S-CVab041n.js +140 -0
  168. package/packages/web/dist/client/assets/c4Diagram-YGBWAQC7-BmotHez3.js +38 -0
  169. package/packages/web/dist/client/assets/channel-BKV-IcTA.js +1 -0
  170. package/packages/web/dist/client/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  171. package/packages/web/dist/client/assets/chunk-3FUC2YCW-CWNS7-n4.js +2 -0
  172. package/packages/web/dist/client/assets/chunk-5DYCD2WN-DflvXohu.js +1 -0
  173. package/packages/web/dist/client/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  174. package/packages/web/dist/client/assets/chunk-742MDFTN-B_0t6_RE.js +1 -0
  175. package/packages/web/dist/client/assets/chunk-7INBJB4K-wKj0Q3Kv.js +62 -0
  176. package/packages/web/dist/client/assets/chunk-7M6MHVWA-BMvUghc8.js +213 -0
  177. package/packages/web/dist/client/assets/chunk-7PRAP22T-BY41wkcT.js +1 -0
  178. package/packages/web/dist/client/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
  179. package/packages/web/dist/client/assets/chunk-FOHPRMQF-CoA4358r.js +161 -0
  180. package/packages/web/dist/client/assets/chunk-GTNCS2PH-PqY_YoS0.js +88 -0
  181. package/packages/web/dist/client/assets/chunk-GWA4HPMP-fozSU5ty.js +1 -0
  182. package/packages/web/dist/client/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
  183. package/packages/web/dist/client/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  184. package/packages/web/dist/client/assets/chunk-MBY4JIJT-CrHrC3jw.js +72 -0
  185. package/packages/web/dist/client/assets/chunk-NETBCI7D-DWdAxieG.js +1 -0
  186. package/packages/web/dist/client/assets/chunk-O7XYJQB3-B6uOn9iS.js +128 -0
  187. package/packages/web/dist/client/assets/chunk-UA2S7LBM-BxYSHqyy.js +1 -0
  188. package/packages/web/dist/client/assets/chunk-WEXAMYUT-CtwIaQDa.js +1 -0
  189. package/packages/web/dist/client/assets/chunk-XXDRQBXY-fgBFe-PX.js +1 -0
  190. package/packages/web/dist/client/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  191. package/packages/web/dist/client/assets/chunk-Z7XXMR3K-CPonoV3p.js +10 -0
  192. package/packages/web/dist/client/assets/chunk-ZIGJFQKS-Cdu87cTj.js +2 -0
  193. package/packages/web/dist/client/assets/classDiagram-v2-NBCMYWYE-DSWsPaa7.js +217 -0
  194. package/packages/web/dist/client/assets/core-CBoS7AST.js +3 -0
  195. package/packages/web/dist/client/assets/cose-bilkent-JH36ORCC-CTwlldtJ.js +1 -0
  196. package/packages/web/dist/client/assets/cynefin-OW5HDTMX-CZQ4EPNJ.js +1 -0
  197. package/packages/web/dist/client/assets/cynefinDiagram-VND7K2PF-C2gp6H_Q.js +62 -0
  198. package/packages/web/dist/client/assets/cytoscape.esm-B-1iW2ft.js +321 -0
  199. package/packages/web/dist/client/assets/dagre-6A5THRUB-CDxTP47t.js +4 -0
  200. package/packages/web/dist/client/assets/defaultLocale-BFoDCU3G.js +1 -0
  201. package/packages/web/dist/client/assets/diagram-22UHCM2B-BIohE1lI.js +200 -0
  202. package/packages/web/dist/client/assets/diagram-3UASUU5V-TwAUir-w.js +24 -0
  203. package/packages/web/dist/client/assets/diagram-ATOU4E4O-BM1JQrIu.js +3 -0
  204. package/packages/web/dist/client/assets/diagram-CDSNMT55-BKIqhxSI.js +30 -0
  205. package/packages/web/dist/client/assets/diagram-MLGK6HIB-CVe3QDHr.js +24 -0
  206. package/packages/web/dist/client/assets/diagram-MPIPVDR6-Bj-MQIFI.js +41 -0
  207. package/packages/web/dist/client/assets/dist-DlZpcyc2.js +1 -0
  208. package/packages/web/dist/client/assets/ebnfDiagram-ZINNZB2B-C06mmvmz.js +1 -0
  209. package/packages/web/dist/client/assets/elk-276RUBZZ-CizJSNEj.js +27 -0
  210. package/packages/web/dist/client/assets/erDiagram-OPXOYQCR-M3FQkKI1.js +99 -0
  211. package/packages/web/dist/client/assets/eventmodeling-NTZA5JFV-D_UXLpIu.js +1 -0
  212. package/packages/web/dist/client/assets/flowDiagram-KWPJA3E3-BT4eEEVm.js +1 -0
  213. package/packages/web/dist/client/assets/ganttDiagram-FUAMR5RP-CojF9Q16.js +292 -0
  214. package/packages/web/dist/client/assets/gitGraph-4MIJSDKK-YvKqGEPk.js +1 -0
  215. package/packages/web/dist/client/assets/gitGraphDiagram-X574FWY7-XqNqIFo9.js +106 -0
  216. package/packages/web/dist/client/assets/graphlib-DS17s2tU.js +1 -0
  217. package/packages/web/dist/client/assets/index--2CDtzvY.css +1 -0
  218. package/packages/web/dist/client/assets/index-bT6QPJZs.js +47 -0
  219. package/packages/web/dist/client/assets/info-A6RAGUB7-B_1BCzM2.js +1 -0
  220. package/packages/web/dist/client/assets/infoDiagram-VRGFBTTK-zFX8B-dP.js +2 -0
  221. package/packages/web/dist/client/assets/init-C-OQMol4.js +1 -0
  222. package/packages/web/dist/client/assets/ishikawaDiagram-OU5B5YK6-DLzQ_Uyf.js +70 -0
  223. package/packages/web/dist/client/assets/journeyDiagram-ZHPQQLJL-S3WRMmoa.js +139 -0
  224. package/packages/web/dist/client/assets/kanban-definition-PNTS6WVX-B5Z8I-kM.js +89 -0
  225. package/packages/web/dist/client/assets/katex-ZlcWpGUi.js +257 -0
  226. package/packages/web/dist/client/assets/line-BGMH-i2X.js +1 -0
  227. package/packages/web/dist/client/assets/linear-KsrestXG.js +1 -0
  228. package/packages/web/dist/client/assets/mermaid-parser.core-DNffyJJA.js +7 -0
  229. package/packages/web/dist/client/assets/mermaid.core-Cz3vJeQG.js +44 -0
  230. package/packages/web/dist/client/assets/mindmap-definition-NLK3R4M7-CzA61XUf.js +96 -0
  231. package/packages/web/dist/client/assets/ordinal-BDEzSJ7C.js +1 -0
  232. package/packages/web/dist/client/assets/packet-AYTQ26CC-BO55e7cR.js +1 -0
  233. package/packages/web/dist/client/assets/path-fybaL0A-.js +1 -0
  234. package/packages/web/dist/client/assets/pegDiagram-GJSIUBJH-DeRiXYNd.js +1 -0
  235. package/packages/web/dist/client/assets/pie-WAS4IAKB-D9ibrQRe.js +1 -0
  236. package/packages/web/dist/client/assets/pieDiagram-5QR66LMP-BaBpPP33.js +39 -0
  237. package/packages/web/dist/client/assets/quadrantDiagram-O4NWA36T-DIfn4GjM.js +7 -0
  238. package/packages/web/dist/client/assets/radar-RG4KPBEZ-Dmn5-nJq.js +1 -0
  239. package/packages/web/dist/client/assets/railroad-74A4TZTK-ZCWNEd2Z.js +1 -0
  240. package/packages/web/dist/client/assets/railroad-abnf-HS5TGJTU-_swqhy0y.js +1 -0
  241. package/packages/web/dist/client/assets/railroad-ebnf-LZEXJU2U-CytbazPx.js +1 -0
  242. package/packages/web/dist/client/assets/railroad-peg-WCYAUIDC-Bg8QW17T.js +1 -0
  243. package/packages/web/dist/client/assets/railroadDiagram-XR7U4H2S-CDPZ39sy.js +1 -0
  244. package/packages/web/dist/client/assets/requirementDiagram-PLB6GJNP-CyCI8Yul.js +84 -0
  245. package/packages/web/dist/client/assets/rough.esm-Dy-Kn_BL.js +1 -0
  246. package/packages/web/dist/client/assets/sankeyDiagram-IPEJSGJF-p_XAPv72.js +40 -0
  247. package/packages/web/dist/client/assets/sequenceDiagram-PO4LG4MO-DmR6IP_o.js +169 -0
  248. package/packages/web/dist/client/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
  249. package/packages/web/dist/client/assets/src-gnv7pJ1z.js +1 -0
  250. package/packages/web/dist/client/assets/stateDiagram-v2-GCMORJYK-7ZTHl6ih.js +291 -0
  251. package/packages/web/dist/client/assets/swimlanes-2SLR337P-N6bj71pw.js +1 -0
  252. package/packages/web/dist/client/assets/swimlanesDiagram-TC7HE7FX-BJQ2CBsp.js +8 -0
  253. package/packages/web/dist/client/assets/timeline-definition-EJHVYXUP-GNez0kW8.js +120 -0
  254. package/packages/web/dist/client/assets/treeView-Q6P3EWNA-DyQZkboR.js +1 -0
  255. package/packages/web/dist/client/assets/treemap-WGGIJYW6-_J8Pw2TM.js +1 -0
  256. package/packages/web/dist/client/assets/usecaseDiagram-POWQR4AR-Bg-CzKjl.js +328 -0
  257. package/packages/web/dist/client/assets/vennDiagram-UO4OBE2U-DBQKHXhK.js +34 -0
  258. package/packages/web/dist/client/assets/wardley-WFR3VGLG-B5aAsQ3F.js +1 -0
  259. package/packages/web/dist/client/assets/wardleyDiagram-VNRHLVJA-BKUQ1LK6.js +78 -0
  260. package/packages/web/dist/client/assets/xychartDiagram-PMCCYNJV-BI2sVbks.js +7 -0
  261. package/packages/web/dist/client/index.html +2 -2
  262. package/packages/web/dist/client/assets/core-C5fJJN75.js +0 -3
  263. package/packages/web/dist/client/assets/index-C5D7B_8d.js +0 -45
  264. package/packages/web/dist/client/assets/index-OVLzpES-.css +0 -1
@@ -1,6 +1,6 @@
1
1
  import { Cli as Argv } from "#core/shared/Cli";
2
2
 
3
- export const SURFACE_NAMES = ["web", "telegram"] as const;
3
+ const SURFACE_NAMES = ["web", "telegram"] as const;
4
4
 
5
5
  export type SurfaceName = (typeof SURFACE_NAMES)[number];
6
6
 
@@ -8,11 +8,7 @@ function isSurfaceName(value: string | undefined): value is SurfaceName {
8
8
  return SURFACE_NAMES.includes(value as SurfaceName);
9
9
  }
10
10
 
11
- /**
12
- * Which surfaces this process should bring up. `--mode web` and `--mode
13
- * telegram` are the single-surface spellings of `--surfaces`, so a Telegram-only
14
- * install needs no port and a web-only one needs no token.
15
- */
11
+ /** `--mode web` and `--mode telegram` are the single-surface spellings of `--surfaces`. */
16
12
  function parse(args: ReadonlyArray<string>): ReadonlyArray<SurfaceName> {
17
13
  let requested: string | undefined;
18
14
  let mode: string | undefined;
@@ -44,11 +40,6 @@ function parse(args: ReadonlyArray<string>): ReadonlyArray<SurfaceName> {
44
40
  return SURFACE_NAMES.filter((name) => names.includes(name));
45
41
  }
46
42
 
47
- function format(names: ReadonlyArray<SurfaceName>): string {
48
- return names.join(",");
49
- }
50
-
51
- /** Whether the caller named the surfaces outright, rather than implying them by mode. */
52
43
  function named(args: ReadonlyArray<string>): boolean {
53
44
  return args.some(
54
45
  (arg) => arg === "--surfaces" || arg.startsWith("--surfaces=")
@@ -63,4 +54,4 @@ function union(
63
54
  );
64
55
  }
65
56
 
66
- export const Surfaces = { parse, format, named, union };
57
+ export const Surfaces = { parse, named, union };
@@ -15,7 +15,6 @@ function create(args: ReadonlyArray<string>, runtime: AgentRuntime): Surface {
15
15
  };
16
16
  }
17
17
 
18
- /** `--print-config`, which resolves the bot's config the way a run would and stops there. */
19
18
  async function printConfig(args: ReadonlyArray<string>): Promise<void> {
20
19
  const config = await Config.load(Config.parseArgs(args));
21
20
  console.log(
@@ -4,7 +4,6 @@ import { Surfaces } from "./Surfaces";
4
4
  import { TelegramSurface } from "./TelegramSurface";
5
5
  import { WebSurface } from "./WebSurface";
6
6
 
7
- /** Every surface in this process shares one pi installation, and so one `auth.json`. */
8
7
  export function build(args: ReadonlyArray<string>): ReadonlyArray<Surface> {
9
8
  const runtime = new AgentRuntime();
10
9
  return Surfaces.parse(args).map((name) =>
@@ -1,6 +1,6 @@
1
1
  import type { DiffBase, LineSpan } from "./Diff";
2
2
 
3
- /** A file already uploaded via `POST /upload`, by the id that endpoint answered with; never a client-local path. */
3
+ /** A file already uploaded via `POST /upload`. */
4
4
  export type AttachmentRef = {
5
5
  readonly id: string;
6
6
  };
@@ -13,15 +13,15 @@ export type Command =
13
13
  readonly type: "attach";
14
14
  readonly sessionId?: string;
15
15
  readonly cwd?: string;
16
- /** Copy model, thinking level and cwd from this session; ignored when `sessionId` is set or the session is not held open. */
16
+ /** Copy model, thinking level and cwd from this session; ignored when `sessionId` is set or it is not open. */
17
17
  readonly like?: string;
18
18
  readonly fromSeq: number;
19
- /** Whether the client is looking at this session right now; absent means yes. */
19
+ /** Absent means true. */
20
20
  readonly attentive?: boolean;
21
21
  }
22
- /** Whether this connection's reader is present: an inattentive one never consumes a turn as read. */
22
+ /** An inattentive connection never marks a turn as read. */
23
23
  | { readonly id: string; readonly type: "attention"; readonly value: boolean }
24
- /** Sent into a running turn it steers that turn, landing before the next model call. */
24
+ /** Sent mid-turn, it steers the running turn. */
25
25
  | {
26
26
  readonly id: string;
27
27
  readonly type: "user_message";
@@ -30,7 +30,7 @@ export type Command =
30
30
  readonly attachments?: readonly AttachmentRef[];
31
31
  }
32
32
  | { readonly id: string; readonly type: "cancel"; readonly sessionId: string }
33
- /** Take back the queued messages without stopping the turn; they come back on `restored`. */
33
+ /** Take back queued messages without stopping the turn; returned in `restored`. */
34
34
  | {
35
35
  readonly id: string;
36
36
  readonly type: "dequeue";
@@ -56,102 +56,94 @@ export type Command =
56
56
  readonly sessionId: string;
57
57
  readonly value: string;
58
58
  }
59
- /** The session catalogue; answers before any `attach`. */
59
+ /** Works before any `attach`. */
60
60
  | {
61
61
  readonly id: string;
62
62
  readonly type: "list_sessions";
63
- /** Restrict to one working directory; omit for every session on disk. */
64
63
  readonly cwd?: string;
65
64
  readonly limit?: number;
66
- /** Keep at most this many sessions per working directory, so one busy project cannot fill the page. */
65
+ /** Max sessions per working directory. */
67
66
  readonly perProject?: number;
68
- /** List the archived sessions instead of the live ones. */
69
67
  readonly archived?: boolean;
70
68
  }
71
- /** Ranked search over every session on disk, titles and what was said; an empty `query` warms the index and answers with no hits. */
69
+ /** An empty `query` warms the index and returns no hits. */
72
70
  | {
73
71
  readonly id: string;
74
72
  readonly type: "search_sessions";
75
73
  readonly query: string;
76
74
  readonly limit?: number;
77
- /** Restrict to one working directory; omit for every session on disk. */
78
75
  readonly cwd?: string;
79
- /** Omitted, the archived are searched too and their hits say so; `false` leaves them out, `true` searches only them. */
76
+ /** Omitted searches everything; `false` excludes archived, `true` searches only archived. */
80
77
  readonly archived?: boolean;
81
78
  }
82
- /** Names a session through pi's own `session_info`, so its terminal picker shows the name too; `null` clears it. */
79
+ /** Written as pi's `session_info`; `null` clears it. */
83
80
  | {
84
81
  readonly id: string;
85
82
  readonly type: "set_session_name";
86
83
  readonly sessionId: string;
87
84
  readonly value: string | null;
88
85
  }
89
- /** pim's own overrides on a session: out of the default listing, or held unread until it is answered. */
90
86
  | {
91
87
  readonly id: string;
92
88
  readonly type: "set_session_archived" | "set_session_unread";
93
89
  readonly sessionId: string;
94
90
  readonly value: boolean;
95
91
  }
96
- /**
97
- * pim's own overrides on a working directory rather than a session: pinned
98
- * sorts it above every other, expanded stands its sidebar group unfolded.
99
- */
100
92
  | {
101
93
  readonly id: string;
102
94
  readonly type: "set_project_pinned" | "set_project_expanded";
103
95
  readonly cwd: string;
104
96
  readonly value: boolean;
105
97
  }
106
- /** Names a working directory for the listings; `null` puts it back to its base name, and the directory is never renamed. */
98
+ /** Display label only; `null` clears it. */
107
99
  | {
108
100
  readonly id: string;
109
101
  readonly type: "set_project_label";
110
102
  readonly cwd: string;
111
103
  readonly value: string | null;
112
104
  }
113
- /** Re-orders the pinned projects. The whole order, never a move: two surfaces settle on the last one sent. */
105
+ /** The full pinned order; last write wins. */
114
106
  | {
115
107
  readonly id: string;
116
108
  readonly type: "set_pin_order";
117
109
  readonly order: readonly string[];
118
110
  }
119
- /** The models this server can switch to, plus the current model's thinking levels; answers without a session. */
111
+ /** Also returns the current model's thinking levels. */
120
112
  | { readonly id: string; readonly type: "list_models" }
121
- /** The extensions this server can switch on and off, read against the connection's cwd when it has one. */
113
+ /** Read against the connection's cwd when it has one. */
122
114
  | { readonly id: string; readonly type: "list_extensions" }
123
- /** Switch one extension on or off; the sessions built from here pick it up as each rebuilds its agent. */
115
+ /** Sessions pick it up when they next rebuild their agent. */
124
116
  | {
125
117
  readonly id: string;
126
118
  readonly type: "set_extension";
127
119
  readonly extensionId: string;
128
120
  readonly value: boolean;
129
121
  }
130
- /** Subdirectories of `path` on the server's filesystem; errors rather than answering empty when it is not a readable directory. */
122
+ /** Errors when `path` is not a readable directory. */
131
123
  | { readonly id: string; readonly type: "list_dirs"; readonly path: string }
132
- /** Makes the directory `path` names, one level inside an existing one; answers empty, and the caller re-lists. */
124
+ /** Parent must exist. */
133
125
  | { readonly id: string; readonly type: "create_dir"; readonly path: string }
134
- /** Re-read the cwd's git state now; `fetch` asks the remote first, which is the only thing that moves ahead and behind. */
126
+ /** `fetch` fetches the remote first, updating ahead/behind. */
135
127
  | {
136
128
  readonly id: string;
137
129
  readonly type: "refresh_git";
138
130
  readonly sessionId: string;
139
131
  readonly fetch?: boolean;
140
132
  }
141
- /** The cwd's local branches, trunk first and the rest by how recently they were worked on. */
133
+ /** Trunk first, then most recent. */
142
134
  | {
143
135
  readonly id: string;
144
136
  readonly type: "list_branches";
145
137
  readonly sessionId: string;
146
138
  }
147
- /** Every changed file of one diff base, without a hunk of any of them; read-only, so never refused. */
139
+ /** Files only, no hunks. Allowed mid-turn. */
148
140
  | {
149
141
  readonly id: string;
150
142
  readonly type: "list_changes";
151
143
  readonly sessionId: string;
152
144
  readonly base: DiffBase;
153
145
  }
154
- /** One file's hunks, computed only once a reader expands it; `context` defaults to 3. */
146
+ /** `context` defaults to 3. */
155
147
  | {
156
148
  readonly id: string;
157
149
  readonly type: "file_diff";
@@ -160,7 +152,7 @@ export type Command =
160
152
  readonly path: string;
161
153
  readonly context?: number;
162
154
  }
163
- /** The file's own lines behind a gap between hunks, asked for when a reader opens one. */
155
+ /** Lines in the gaps between hunks. */
164
156
  | {
165
157
  readonly id: string;
166
158
  readonly type: "read_lines";
@@ -169,29 +161,29 @@ export type Command =
169
161
  readonly path: string;
170
162
  readonly spans: readonly LineSpan[];
171
163
  }
172
- /** Refused while any session in the same directory is mid-turn: the agent may be halfway through an edit. */
164
+ /** Refused while any session in the same cwd is mid-turn. */
173
165
  | {
174
166
  readonly id: string;
175
167
  readonly type: "checkout";
176
168
  readonly sessionId: string;
177
169
  readonly branch: string;
178
170
  }
179
- /** `pull` is fast-forward only; `push` adopts an upstream the first time a branch is published. */
171
+ /** `pull` is fast-forward only; `push` sets the upstream on first publish. */
180
172
  | {
181
173
  readonly id: string;
182
174
  readonly type: "pull" | "push";
183
175
  readonly sessionId: string;
184
176
  }
185
- /** Path-limited: exactly `paths` are staged and committed, everything else changed stays dirty. Refused mid-turn, like `checkout`. */
177
+ /** Commits exactly `paths`. Refused mid-turn, like `checkout`. */
186
178
  | {
187
179
  readonly id: string;
188
180
  readonly type: "commit";
189
181
  readonly sessionId: string;
190
182
  readonly message: string;
191
- /** A renamed file contributes both of its names, or its old one is left behind. */
183
+ /** Include both names of a renamed file. */
192
184
  readonly paths: readonly string[];
193
185
  }
194
- /** Read-only view of a subagent's transcript; `callId` is the parent's tool call and `sessionId` must be this connection's session. */
186
+ /** `callId` is the parent's tool call; `sessionId` must be this connection's session. */
195
187
  | {
196
188
  readonly id: string;
197
189
  readonly type: "watch_subagent";
@@ -199,15 +191,15 @@ export type Command =
199
191
  readonly callId: string;
200
192
  readonly fromSeq: number;
201
193
  }
202
- /** Stop watching; succeeds whether or not this connection holds the watch. */
194
+ /** Succeeds even if nothing is watched. */
203
195
  | {
204
196
  readonly id: string;
205
197
  readonly type: "unwatch_subagent";
206
198
  readonly callId: string;
207
199
  }
208
- /** Update this install and restart it unconditionally; refused while any session is mid-turn unless `force`. */
200
+ /** Update and restart; refused while any session is mid-turn unless `force`. */
209
201
  | { readonly id: string; readonly type: "reload"; readonly force?: boolean }
210
- /** Answers one `ui_request`; dismissal is `cancelled`, and a late answer to a settled request is refused. */
202
+ /** Answers a `ui_request`; refused once it is settled. */
211
203
  | {
212
204
  readonly id: string;
213
205
  readonly type: "ui_response";
@@ -227,13 +219,13 @@ export type CommandDraft = Command extends infer T
227
219
  : never
228
220
  : never;
229
221
 
230
- /** Which sessions a listing is asking for: the `list_sessions` payload, named so a client can pass it around. */
222
+ /** The `list_sessions` payload. */
231
223
  export type SessionScope = Omit<
232
224
  Extract<CommandDraft, { readonly type: "list_sessions" }>,
233
225
  "type"
234
226
  >;
235
227
 
236
- /** Which sessions a search may reach: the `search_sessions` payload without the query it is asked with. */
228
+ /** The `search_sessions` payload without `query`. */
237
229
  export type SearchScope = Omit<
238
230
  Extract<CommandDraft, { readonly type: "search_sessions" }>,
239
231
  "type" | "query"
@@ -1,8 +1,3 @@
1
- /**
2
- * The diff wire shape. Declared beside the git that produces it, the way
3
- * `GitBranch` and `ToolView` are, and named here so the two commands that
4
- * carry it read as protocol.
5
- */
6
1
  export type {
7
2
  ChangeList,
8
3
  ChangeStatus,
@@ -1,23 +1,20 @@
1
1
  const PREFIX = "/image/";
2
2
 
3
- /** Only the names a tool writes: a hex digest and one of the formats a provider takes. */
4
3
  const NAME = /^[0-9a-f]{64}\.(?:png|jpg|gif|webp)$/;
5
4
 
6
- /** Server-relative address of a picture a tool view names, the way an attachment's `url` is. */
7
5
  function url(sha256: string, extension: string): string {
8
6
  return `${PREFIX}${sha256}.${extension}`;
9
7
  }
10
8
 
11
- /** Whether the gateway should route this path to its picture handler. */
12
9
  function owns(pathname: string): boolean {
13
10
  return pathname.startsWith(PREFIX);
14
11
  }
15
12
 
16
- /** The `<sha256>.<ext>` a request addresses, or null when it is not a name we ever served. */
13
+ /** The `<sha256>.<ext>` a path addresses, or null when it is not a valid image name. */
17
14
  function nameOf(pathname: string): string | null {
18
15
  const name = pathname.slice(PREFIX.length);
19
16
  return owns(pathname) && NAME.test(name) ? name : null;
20
17
  }
21
18
 
22
- /** `GET /image/<sha256>.<ext>`: the one spelling the server answers and the client asks for. */
19
+ /** `GET /image/<sha256>.<ext>`. */
23
20
  export const ImageRoute = { url, owns, nameOf };