@punch-bot/cli 0.85.1 → 1.3.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 (1121) hide show
  1. package/CHANGELOG.md +609 -3
  2. package/README.md +82 -174
  3. package/dist/bun/cli.d.ts.map +1 -1
  4. package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
  5. package/dist/bun/restore-sandbox-env.js.map +1 -1
  6. package/dist/bun/runtime-setup.d.ts.map +1 -1
  7. package/dist/bun/runtime-setup.js +4 -1
  8. package/dist/bun/runtime-setup.js.map +1 -1
  9. package/dist/bun/sandbox-env-setup.d.ts.map +1 -1
  10. package/dist/bundle/chunks/anthropic-messages-BUUFZMRE.js +6 -0
  11. package/dist/bundle/chunks/anthropic.js +2 -2
  12. package/dist/bundle/chunks/azure-openai-responses-WZ4GZHD2.js +2 -0
  13. package/dist/bundle/chunks/bedrock-converse-stream.js +10 -2
  14. package/dist/bundle/chunks/chunk-22CYIUS4.js +2 -0
  15. package/dist/bundle/chunks/chunk-2M76JOVH.js +8 -0
  16. package/dist/bundle/chunks/chunk-6C5VKHGV.js +50 -0
  17. package/dist/bundle/chunks/chunk-6WNF4BLC.js +2 -0
  18. package/dist/bundle/chunks/chunk-6YKFJ7FQ.js +1188 -0
  19. package/dist/bundle/chunks/chunk-BYHXHV4K.js +11 -0
  20. package/dist/bundle/chunks/chunk-F5ZABL6Z.js +20 -0
  21. package/dist/bundle/chunks/chunk-HACVPRBJ.js +11 -0
  22. package/dist/bundle/chunks/chunk-ITZNWD4K.js +2 -0
  23. package/dist/bundle/chunks/chunk-J7I2NFJ7.js +82 -0
  24. package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
  25. package/dist/bundle/chunks/chunk-OO6DJ3CL.js +31 -0
  26. package/dist/bundle/chunks/chunk-OWCYH5W2.js +2 -0
  27. package/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
  28. package/dist/bundle/chunks/{chunk-TRDNDS6A.js → chunk-PYGXRV27.js} +5 -2
  29. package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
  30. package/dist/bundle/chunks/{chunk-XDUWOHPL.js → chunk-S3GGRYIO.js} +2 -2
  31. package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
  32. package/dist/bundle/chunks/chunk-WUIPA42N.js +14 -0
  33. package/dist/bundle/chunks/chunk-XIX7LUWI.js +2 -0
  34. package/dist/bundle/chunks/{chunk-3DNTDXPG.js → chunk-YGGF2ZM6.js} +3 -3
  35. package/dist/bundle/chunks/chunk-YWHGLBPB.js +2 -0
  36. package/dist/bundle/chunks/chunk-ZBURYEWF.js +2 -0
  37. package/dist/bundle/chunks/cli-QAQLORRY.js +51 -0
  38. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-UTBL2KOF.js +2 -0
  39. package/dist/bundle/chunks/codemode-worker.js +478 -0
  40. package/dist/bundle/chunks/execute-2Z6BN5R3.js +499 -0
  41. package/dist/bundle/chunks/github-copilot.js +1 -1
  42. package/dist/bundle/chunks/google-generative-ai-S2KXX5PQ.js +2 -0
  43. package/dist/bundle/chunks/google-vertex-LQOUTFJN.js +2 -0
  44. package/dist/bundle/chunks/image-resize-worker.js +1 -1
  45. package/dist/bundle/chunks/jiti-loader-C3NU2SDH.js +21 -0
  46. package/dist/bundle/chunks/jiti-static-loader-E6ANQD5T.js +2 -0
  47. package/dist/bundle/chunks/{lib-HGQMNYVT.js → lib-TEDK3E5I.js} +2 -2
  48. package/dist/bundle/chunks/llama-cpp-classify-FYN623RH.js +22 -0
  49. package/dist/bundle/chunks/meta.js +2 -0
  50. package/dist/bundle/chunks/mistral-conversations-VNJYBSRF.js +5 -0
  51. package/dist/bundle/chunks/node-N5BSDOA5.js +16 -0
  52. package/dist/bundle/chunks/{node-4PXJTSWH.js → node-TWVVAGPO.js} +1 -1
  53. package/dist/bundle/chunks/openai-chatgpt.js +75 -0
  54. package/dist/bundle/chunks/openai-codex-responses-E6BLZPYJ.js +10 -0
  55. package/dist/bundle/chunks/openai-codex.js +2 -2
  56. package/dist/bundle/chunks/openai-completions-LUDIAWSG.js +7 -0
  57. package/dist/bundle/chunks/openai-decisions-WVPMQ4JD.js +5 -0
  58. package/dist/bundle/chunks/openai-responses-IOCBEIVC.js +3 -0
  59. package/dist/bundle/chunks/{openrouter-images-N4XVVFSD.js → openrouter-images-YU24TD7D.js} +1 -1
  60. package/dist/bundle/chunks/openrouter.js +2 -2
  61. package/dist/bundle/chunks/{pi-messages-ZRYGTSON.js → pi-messages-V27DSLVC.js} +2 -2
  62. package/dist/bundle/chunks/radius.js +2 -2
  63. package/dist/bundle/chunks/runtime-R6O72Q4R.js +2 -0
  64. package/dist/bundle/chunks/typesafe-system-one-ZSK3RN4B.js +2 -0
  65. package/dist/bundle/chunks/virtual-modules-GZVZPCK3.js +2 -0
  66. package/dist/bundle/cli-runtime.js +3 -0
  67. package/dist/bundle/cli.js +4 -2
  68. package/dist/bundle/index.js +1 -1
  69. package/dist/bundle/rpc-entry.js +1 -1
  70. package/dist/cli/args.d.ts +1 -2
  71. package/dist/cli/args.d.ts.map +1 -1
  72. package/dist/cli/args.js +73 -53
  73. package/dist/cli/args.js.map +1 -1
  74. package/dist/cli/auth-check.d.ts.map +1 -1
  75. package/dist/cli/auth-check.js.map +1 -1
  76. package/dist/cli/auth-command.d.ts.map +1 -1
  77. package/dist/cli/auth-command.js.map +1 -1
  78. package/dist/cli/credential-print.d.ts.map +1 -1
  79. package/dist/cli/credential-print.js +4 -4
  80. package/dist/cli/credential-print.js.map +1 -1
  81. package/dist/cli/experimental/transport-address.d.ts +21 -0
  82. package/dist/cli/experimental/transport-address.d.ts.map +1 -0
  83. package/dist/cli/experimental/transport-address.js +89 -0
  84. package/dist/cli/experimental/transport-address.js.map +1 -0
  85. package/dist/cli/file-processor.d.ts +1 -1
  86. package/dist/cli/file-processor.d.ts.map +1 -1
  87. package/dist/cli/file-processor.js.map +1 -1
  88. package/dist/cli/initial-message.d.ts +1 -1
  89. package/dist/cli/initial-message.d.ts.map +1 -1
  90. package/dist/cli/initial-message.js.map +1 -1
  91. package/dist/cli/list-models.d.ts.map +1 -1
  92. package/dist/cli/list-models.js +1 -1
  93. package/dist/cli/list-models.js.map +1 -1
  94. package/dist/cli/project-trust.d.ts.map +1 -1
  95. package/dist/cli/project-trust.js +5 -35
  96. package/dist/cli/project-trust.js.map +1 -1
  97. package/dist/cli/setup.d.ts.map +1 -1
  98. package/dist/cli/setup.js.map +1 -1
  99. package/dist/cli.d.ts.map +1 -1
  100. package/dist/config.d.ts +30 -11
  101. package/dist/config.d.ts.map +1 -1
  102. package/dist/config.js +72 -21
  103. package/dist/config.js.map +1 -1
  104. package/dist/core/agent-session-runtime.d.ts +4 -3
  105. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  106. package/dist/core/agent-session-runtime.js +37 -27
  107. package/dist/core/agent-session-runtime.js.map +1 -1
  108. package/dist/core/agent-session-services.d.ts.map +1 -1
  109. package/dist/core/agent-session-services.js +13 -0
  110. package/dist/core/agent-session-services.js.map +1 -1
  111. package/dist/core/agent-session.d.ts +270 -22
  112. package/dist/core/agent-session.d.ts.map +1 -1
  113. package/dist/core/agent-session.js +1174 -410
  114. package/dist/core/agent-session.js.map +1 -1
  115. package/dist/core/auth-guidance.d.ts.map +1 -1
  116. package/dist/core/auth-guidance.js.map +1 -1
  117. package/dist/core/auth-storage.d.ts.map +1 -1
  118. package/dist/core/auth-storage.js +20 -13
  119. package/dist/core/auth-storage.js.map +1 -1
  120. package/dist/core/bash-executor.d.ts.map +1 -1
  121. package/dist/core/bash-executor.js +42 -52
  122. package/dist/core/bash-executor.js.map +1 -1
  123. package/dist/core/bug-report-upload.d.ts +12 -0
  124. package/dist/core/bug-report-upload.d.ts.map +1 -0
  125. package/dist/core/bug-report-upload.js +22 -0
  126. package/dist/core/bug-report-upload.js.map +1 -0
  127. package/dist/core/bug-report.d.ts +184 -0
  128. package/dist/core/bug-report.d.ts.map +1 -0
  129. package/dist/core/bug-report.js +292 -0
  130. package/dist/core/bug-report.js.map +1 -0
  131. package/dist/core/cache-stats.d.ts.map +1 -1
  132. package/dist/core/cache-stats.js +12 -1
  133. package/dist/core/cache-stats.js.map +1 -1
  134. package/dist/core/cache-warmer.d.ts +103 -0
  135. package/dist/core/cache-warmer.d.ts.map +1 -0
  136. package/dist/core/cache-warmer.js +356 -0
  137. package/dist/core/cache-warmer.js.map +1 -0
  138. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  139. package/dist/core/compaction/branch-summarization.js +2 -2
  140. package/dist/core/compaction/branch-summarization.js.map +1 -1
  141. package/dist/core/compaction/compaction.d.ts +5 -3
  142. package/dist/core/compaction/compaction.d.ts.map +1 -1
  143. package/dist/core/compaction/compaction.js +164 -88
  144. package/dist/core/compaction/compaction.js.map +1 -1
  145. package/dist/core/compaction/index.d.ts.map +1 -1
  146. package/dist/core/compaction/utils.d.ts +8 -1
  147. package/dist/core/compaction/utils.d.ts.map +1 -1
  148. package/dist/core/compaction/utils.js +32 -26
  149. package/dist/core/compaction/utils.js.map +1 -1
  150. package/dist/core/crash-log.d.ts +27 -0
  151. package/dist/core/crash-log.d.ts.map +1 -0
  152. package/dist/core/crash-log.js +140 -0
  153. package/dist/core/crash-log.js.map +1 -0
  154. package/dist/core/defaults.d.ts.map +1 -1
  155. package/dist/core/delivery.d.ts.map +1 -1
  156. package/dist/core/delivery.js.map +1 -1
  157. package/dist/core/diagnostics.d.ts.map +1 -1
  158. package/dist/core/event-bus.d.ts.map +1 -1
  159. package/dist/core/event-bus.js.map +1 -1
  160. package/dist/core/exec.d.ts.map +1 -1
  161. package/dist/core/exec.js.map +1 -1
  162. package/dist/core/experimental.d.ts.map +1 -1
  163. package/dist/core/experimental.js.map +1 -1
  164. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  165. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  166. package/dist/core/export-html/index.d.ts.map +1 -1
  167. package/dist/core/export-html/index.js +1 -1
  168. package/dist/core/export-html/index.js.map +1 -1
  169. package/dist/core/export-html/template.css +10 -0
  170. package/dist/core/export-html/template.js +93 -34
  171. package/dist/core/export-html/tool-renderer.d.ts +5 -11
  172. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  173. package/dist/core/export-html/tool-renderer.js +8 -99
  174. package/dist/core/export-html/tool-renderer.js.map +1 -1
  175. package/dist/core/extensions/index.d.ts +1 -1
  176. package/dist/core/extensions/index.d.ts.map +1 -1
  177. package/dist/core/extensions/index.js.map +1 -1
  178. package/dist/core/extensions/jiti-loader.d.ts +2 -0
  179. package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
  180. package/dist/core/extensions/jiti-loader.js +4 -0
  181. package/dist/core/extensions/jiti-loader.js.map +1 -0
  182. package/dist/core/extensions/jiti-static-loader.d.ts +2 -0
  183. package/dist/core/extensions/jiti-static-loader.d.ts.map +1 -0
  184. package/dist/core/extensions/jiti-static-loader.js +4 -0
  185. package/dist/core/extensions/jiti-static-loader.js.map +1 -0
  186. package/dist/core/extensions/loader.d.ts.map +1 -1
  187. package/dist/core/extensions/loader.js +102 -74
  188. package/dist/core/extensions/loader.js.map +1 -1
  189. package/dist/core/extensions/runner.d.ts +44 -14
  190. package/dist/core/extensions/runner.d.ts.map +1 -1
  191. package/dist/core/extensions/runner.js +297 -169
  192. package/dist/core/extensions/runner.js.map +1 -1
  193. package/dist/core/extensions/types.d.ts +482 -238
  194. package/dist/core/extensions/types.d.ts.map +1 -1
  195. package/dist/core/extensions/types.js.map +1 -1
  196. package/dist/core/extensions/virtual-modules.d.ts +3 -0
  197. package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
  198. package/dist/core/extensions/virtual-modules.js +35 -0
  199. package/dist/core/extensions/virtual-modules.js.map +1 -0
  200. package/dist/core/extensions/wrapper.d.ts +2 -2
  201. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  202. package/dist/core/extensions/wrapper.js +3 -22
  203. package/dist/core/extensions/wrapper.js.map +1 -1
  204. package/dist/core/footer-data-provider.d.ts.map +1 -1
  205. package/dist/core/footer-data-provider.js.map +1 -1
  206. package/dist/core/http-dispatcher.d.ts +13 -0
  207. package/dist/core/http-dispatcher.d.ts.map +1 -1
  208. package/dist/core/http-dispatcher.js +13 -4
  209. package/dist/core/http-dispatcher.js.map +1 -1
  210. package/dist/core/index.d.ts +2 -1
  211. package/dist/core/index.d.ts.map +1 -1
  212. package/dist/core/index.js.map +1 -1
  213. package/dist/core/mcp-servers.d.ts +139 -0
  214. package/dist/core/mcp-servers.d.ts.map +1 -0
  215. package/dist/core/mcp-servers.js +232 -0
  216. package/dist/core/mcp-servers.js.map +1 -0
  217. package/dist/core/messages.d.ts.map +1 -1
  218. package/dist/core/messages.js +1 -0
  219. package/dist/core/messages.js.map +1 -1
  220. package/dist/{modes/interactive → core}/model-catalog-refresh.d.ts +2 -2
  221. package/dist/core/model-catalog-refresh.d.ts.map +1 -0
  222. package/dist/{modes/interactive → core}/model-catalog-refresh.js +2 -2
  223. package/dist/core/model-catalog-refresh.js.map +1 -0
  224. package/dist/core/model-config.d.ts +886 -80
  225. package/dist/core/model-config.d.ts.map +1 -1
  226. package/dist/core/model-config.js +33 -148
  227. package/dist/core/model-config.js.map +1 -1
  228. package/dist/core/model-registry.d.ts +15 -1
  229. package/dist/core/model-registry.d.ts.map +1 -1
  230. package/dist/core/model-registry.js +29 -0
  231. package/dist/core/model-registry.js.map +1 -1
  232. package/dist/core/model-resolver.d.ts +61 -46
  233. package/dist/core/model-resolver.d.ts.map +1 -1
  234. package/dist/core/model-resolver.js +338 -363
  235. package/dist/core/model-resolver.js.map +1 -1
  236. package/dist/core/model-runtime.d.ts +51 -3
  237. package/dist/core/model-runtime.d.ts.map +1 -1
  238. package/dist/core/model-runtime.js +211 -44
  239. package/dist/core/model-runtime.js.map +1 -1
  240. package/dist/core/model-suffix-variants.d.ts +14 -0
  241. package/dist/core/model-suffix-variants.d.ts.map +1 -0
  242. package/dist/core/model-suffix-variants.js +27 -0
  243. package/dist/core/model-suffix-variants.js.map +1 -0
  244. package/dist/core/models-store.d.ts.map +1 -1
  245. package/dist/core/models-store.js.map +1 -1
  246. package/dist/core/nested-tool-calls.d.ts +103 -0
  247. package/dist/core/nested-tool-calls.d.ts.map +1 -0
  248. package/dist/core/nested-tool-calls.js +179 -0
  249. package/dist/core/nested-tool-calls.js.map +1 -0
  250. package/dist/core/output-guard.d.ts.map +1 -1
  251. package/dist/core/output-guard.js.map +1 -1
  252. package/dist/core/package-manager.d.ts +4 -0
  253. package/dist/core/package-manager.d.ts.map +1 -1
  254. package/dist/core/package-manager.js +62 -15
  255. package/dist/core/package-manager.js.map +1 -1
  256. package/dist/core/pi-manifest.d.ts.map +1 -1
  257. package/dist/core/pi-manifest.js.map +1 -1
  258. package/dist/core/project-trust.d.ts.map +1 -1
  259. package/dist/core/project-trust.js +2 -1
  260. package/dist/core/project-trust.js.map +1 -1
  261. package/dist/core/prompt-templates.d.ts +6 -1
  262. package/dist/core/prompt-templates.d.ts.map +1 -1
  263. package/dist/core/prompt-templates.js +68 -37
  264. package/dist/core/prompt-templates.js.map +1 -1
  265. package/dist/core/provider-attribution.d.ts.map +1 -1
  266. package/dist/core/provider-attribution.js.map +1 -1
  267. package/dist/core/provider-composer.d.ts +42 -20
  268. package/dist/core/provider-composer.d.ts.map +1 -1
  269. package/dist/core/provider-composer.js +126 -40
  270. package/dist/core/provider-composer.js.map +1 -1
  271. package/dist/core/radius.d.ts +5 -0
  272. package/dist/core/radius.d.ts.map +1 -1
  273. package/dist/core/radius.js +8 -0
  274. package/dist/core/radius.js.map +1 -1
  275. package/dist/core/remote-catalog-provider.d.ts +19 -1
  276. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  277. package/dist/core/remote-catalog-provider.js +102 -34
  278. package/dist/core/remote-catalog-provider.js.map +1 -1
  279. package/dist/core/resolve-config-value.d.ts.map +1 -1
  280. package/dist/core/resolve-config-value.js.map +1 -1
  281. package/dist/core/resource-loader.d.ts +11 -2
  282. package/dist/core/resource-loader.d.ts.map +1 -1
  283. package/dist/core/resource-loader.js +170 -42
  284. package/dist/core/resource-loader.js.map +1 -1
  285. package/dist/core/runtime-credentials.d.ts.map +1 -1
  286. package/dist/core/runtime-credentials.js.map +1 -1
  287. package/dist/core/sdk.d.ts +14 -5
  288. package/dist/core/sdk.d.ts.map +1 -1
  289. package/dist/core/sdk.js +108 -52
  290. package/dist/core/sdk.js.map +1 -1
  291. package/dist/core/session-cwd.d.ts.map +1 -1
  292. package/dist/core/session-cwd.js.map +1 -1
  293. package/dist/core/session-export.d.ts +6 -2
  294. package/dist/core/session-export.d.ts.map +1 -1
  295. package/dist/core/session-export.js +14 -13
  296. package/dist/core/session-export.js.map +1 -1
  297. package/dist/core/session-manager.d.ts +72 -13
  298. package/dist/core/session-manager.d.ts.map +1 -1
  299. package/dist/core/session-manager.js +277 -124
  300. package/dist/core/session-manager.js.map +1 -1
  301. package/dist/core/settings-defaults.d.ts +65 -0
  302. package/dist/core/settings-defaults.d.ts.map +1 -0
  303. package/dist/core/settings-defaults.js +66 -0
  304. package/dist/core/settings-defaults.js.map +1 -0
  305. package/dist/core/settings-diagnostics.d.ts.map +1 -1
  306. package/dist/core/settings-diagnostics.js.map +1 -1
  307. package/dist/core/settings-manager.d.ts +41 -126
  308. package/dist/core/settings-manager.d.ts.map +1 -1
  309. package/dist/core/settings-manager.js +165 -52
  310. package/dist/core/settings-manager.js.map +1 -1
  311. package/dist/core/settings-schema.d.ts +224 -0
  312. package/dist/core/settings-schema.d.ts.map +1 -0
  313. package/dist/core/settings-schema.js +285 -0
  314. package/dist/core/settings-schema.js.map +1 -0
  315. package/dist/core/skills.d.ts +4 -1
  316. package/dist/core/skills.d.ts.map +1 -1
  317. package/dist/core/skills.js +6 -1
  318. package/dist/core/skills.js.map +1 -1
  319. package/dist/core/slash-commands.d.ts.map +1 -1
  320. package/dist/core/slash-commands.js +3 -2
  321. package/dist/core/slash-commands.js.map +1 -1
  322. package/dist/core/source-info.d.ts +8 -0
  323. package/dist/core/source-info.d.ts.map +1 -1
  324. package/dist/core/source-info.js +16 -0
  325. package/dist/core/source-info.js.map +1 -1
  326. package/dist/core/system-prompt.d.ts +55 -6
  327. package/dist/core/system-prompt.d.ts.map +1 -1
  328. package/dist/core/system-prompt.js +128 -93
  329. package/dist/core/system-prompt.js.map +1 -1
  330. package/dist/core/telemetry.d.ts +2 -0
  331. package/dist/core/telemetry.d.ts.map +1 -1
  332. package/dist/core/telemetry.js +45 -0
  333. package/dist/core/telemetry.js.map +1 -1
  334. package/dist/core/theme/dark.json +78 -0
  335. package/dist/core/theme/light.json +78 -0
  336. package/dist/core/theme/system-theme.d.ts +54 -0
  337. package/dist/core/theme/system-theme.d.ts.map +1 -0
  338. package/dist/core/theme/system-theme.js +547 -0
  339. package/dist/core/theme/system-theme.js.map +1 -0
  340. package/dist/core/theme/theme-schema.d.ts +28 -0
  341. package/dist/core/theme/theme-schema.d.ts.map +1 -0
  342. package/dist/core/theme/theme-schema.js +105 -0
  343. package/dist/core/theme/theme-schema.js.map +1 -0
  344. package/dist/core/theme/theme-tokens.d.ts +257 -0
  345. package/dist/core/theme/theme-tokens.d.ts.map +1 -0
  346. package/dist/core/theme/theme-tokens.js +94 -0
  347. package/dist/core/theme/theme-tokens.js.map +1 -0
  348. package/dist/core/theme/theme.d.ts +162 -0
  349. package/dist/core/theme/theme.d.ts.map +1 -0
  350. package/dist/{modes/interactive → core}/theme/theme.js +265 -402
  351. package/dist/core/theme/theme.js.map +1 -0
  352. package/dist/core/timings.d.ts.map +1 -1
  353. package/dist/core/timings.js.map +1 -1
  354. package/dist/core/tools/bash.d.ts +14 -1
  355. package/dist/core/tools/bash.d.ts.map +1 -1
  356. package/dist/core/tools/bash.js +43 -6
  357. package/dist/core/tools/bash.js.map +1 -1
  358. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  359. package/dist/core/tools/edit-diff.js.map +1 -1
  360. package/dist/core/tools/edit.d.ts +1 -2
  361. package/dist/core/tools/edit.d.ts.map +1 -1
  362. package/dist/core/tools/edit.js +0 -3
  363. package/dist/core/tools/edit.js.map +1 -1
  364. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  365. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  366. package/dist/core/tools/find.d.ts.map +1 -1
  367. package/dist/core/tools/find.js +0 -2
  368. package/dist/core/tools/find.js.map +1 -1
  369. package/dist/core/tools/grep.d.ts.map +1 -1
  370. package/dist/core/tools/grep.js +0 -2
  371. package/dist/core/tools/grep.js.map +1 -1
  372. package/dist/core/tools/index.d.ts.map +1 -1
  373. package/dist/core/tools/index.js.map +1 -1
  374. package/dist/core/tools/ls.d.ts.map +1 -1
  375. package/dist/core/tools/ls.js +0 -2
  376. package/dist/core/tools/ls.js.map +1 -1
  377. package/dist/core/tools/output-accumulator.d.ts +11 -0
  378. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  379. package/dist/core/tools/output-accumulator.js +40 -10
  380. package/dist/core/tools/output-accumulator.js.map +1 -1
  381. package/dist/core/tools/path-utils.d.ts.map +1 -1
  382. package/dist/core/tools/path-utils.js.map +1 -1
  383. package/dist/core/tools/powershell.d.ts.map +1 -1
  384. package/dist/core/tools/powershell.js.map +1 -1
  385. package/dist/core/tools/read.d.ts +17 -1
  386. package/dist/core/tools/read.d.ts.map +1 -1
  387. package/dist/core/tools/read.js +23 -4
  388. package/dist/core/tools/read.js.map +1 -1
  389. package/dist/core/tools/tool-definition-wrapper.d.ts +5 -3
  390. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  391. package/dist/core/tools/tool-definition-wrapper.js +3 -1
  392. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  393. package/dist/core/tools/truncate.d.ts +14 -0
  394. package/dist/core/tools/truncate.d.ts.map +1 -1
  395. package/dist/core/tools/truncate.js +29 -0
  396. package/dist/core/tools/truncate.js.map +1 -1
  397. package/dist/core/tools/write.d.ts.map +1 -1
  398. package/dist/core/tools/write.js +0 -2
  399. package/dist/core/tools/write.js.map +1 -1
  400. package/dist/core/trust-manager.d.ts.map +1 -1
  401. package/dist/core/trust-manager.js +1 -0
  402. package/dist/core/trust-manager.js.map +1 -1
  403. package/dist/core/usage-totals.d.ts +3 -1
  404. package/dist/core/usage-totals.d.ts.map +1 -1
  405. package/dist/core/usage-totals.js +28 -1
  406. package/dist/core/usage-totals.js.map +1 -1
  407. package/dist/core/virtual-models.d.ts +117 -0
  408. package/dist/core/virtual-models.d.ts.map +1 -0
  409. package/dist/core/virtual-models.js +124 -0
  410. package/dist/core/virtual-models.js.map +1 -0
  411. package/dist/extensions/browser/index.d.ts.map +1 -1
  412. package/dist/extensions/browser/index.js.map +1 -1
  413. package/dist/extensions/codemode/execute.d.ts +16 -0
  414. package/dist/extensions/codemode/execute.d.ts.map +1 -0
  415. package/dist/extensions/codemode/execute.js +665 -0
  416. package/dist/extensions/codemode/execute.js.map +1 -0
  417. package/dist/extensions/codemode/execute.lazy.d.ts +3 -0
  418. package/dist/extensions/codemode/execute.lazy.d.ts.map +1 -0
  419. package/dist/extensions/codemode/execute.lazy.js +3 -0
  420. package/dist/extensions/codemode/execute.lazy.js.map +1 -0
  421. package/dist/extensions/codemode/index.d.ts +21 -0
  422. package/dist/extensions/codemode/index.d.ts.map +1 -0
  423. package/dist/extensions/codemode/index.js +33 -0
  424. package/dist/extensions/codemode/index.js.map +1 -0
  425. package/dist/extensions/codemode/tool.d.ts +124 -0
  426. package/dist/extensions/codemode/tool.d.ts.map +1 -0
  427. package/dist/extensions/codemode/tool.js +286 -0
  428. package/dist/extensions/codemode/tool.js.map +1 -0
  429. package/dist/extensions/codemode/worker.d.ts +7 -0
  430. package/dist/extensions/codemode/worker.d.ts.map +1 -0
  431. package/dist/extensions/codemode/worker.js +7 -0
  432. package/dist/extensions/codemode/worker.js.map +1 -0
  433. package/dist/extensions/context-pruning/compress_context.d.ts.map +1 -1
  434. package/dist/extensions/context-pruning/compress_context.js +1 -3
  435. package/dist/extensions/context-pruning/compress_context.js.map +1 -1
  436. package/dist/extensions/context-pruning/context-pruning-state.d.ts.map +1 -1
  437. package/dist/extensions/context-pruning/context-pruning-state.js.map +1 -1
  438. package/dist/extensions/index.d.ts.map +1 -1
  439. package/dist/extensions/index.js +6 -2
  440. package/dist/extensions/index.js.map +1 -1
  441. package/dist/extensions/llama/client.d.ts +2 -0
  442. package/dist/extensions/llama/client.d.ts.map +1 -1
  443. package/dist/extensions/llama/client.js +7 -3
  444. package/dist/extensions/llama/client.js.map +1 -1
  445. package/dist/extensions/llama/huggingface.d.ts.map +1 -1
  446. package/dist/extensions/llama/huggingface.js.map +1 -1
  447. package/dist/extensions/llama/index.d.ts.map +1 -1
  448. package/dist/extensions/llama/index.js +0 -4
  449. package/dist/extensions/llama/index.js.map +1 -1
  450. package/dist/extensions/llama/provider.d.ts +1 -1
  451. package/dist/extensions/llama/provider.d.ts.map +1 -1
  452. package/dist/extensions/llama/provider.js +103 -13
  453. package/dist/extensions/llama/provider.js.map +1 -1
  454. package/dist/extensions/llama/ui.d.ts +3 -2
  455. package/dist/extensions/llama/ui.d.ts.map +1 -1
  456. package/dist/extensions/llama/ui.js +106 -364
  457. package/dist/extensions/llama/ui.js.map +1 -1
  458. package/dist/extensions/mcp/cli.d.ts +21 -0
  459. package/dist/extensions/mcp/cli.d.ts.map +1 -0
  460. package/dist/extensions/mcp/cli.js +494 -0
  461. package/dist/extensions/mcp/cli.js.map +1 -0
  462. package/dist/extensions/mcp/cli.lazy.d.ts +3 -0
  463. package/dist/extensions/mcp/cli.lazy.d.ts.map +1 -0
  464. package/dist/extensions/mcp/cli.lazy.js +3 -0
  465. package/dist/extensions/mcp/cli.lazy.js.map +1 -0
  466. package/dist/extensions/mcp/config.d.ts +84 -0
  467. package/dist/extensions/mcp/config.d.ts.map +1 -0
  468. package/dist/extensions/mcp/config.js +196 -0
  469. package/dist/extensions/mcp/config.js.map +1 -0
  470. package/dist/extensions/mcp/index.d.ts +71 -2
  471. package/dist/extensions/mcp/index.d.ts.map +1 -1
  472. package/dist/extensions/mcp/index.js +839 -131
  473. package/dist/extensions/mcp/index.js.map +1 -1
  474. package/dist/extensions/mcp/log.d.ts +16 -0
  475. package/dist/extensions/mcp/log.d.ts.map +1 -0
  476. package/dist/extensions/mcp/log.js +66 -0
  477. package/dist/extensions/mcp/log.js.map +1 -0
  478. package/dist/extensions/mcp/oauth.d.ts +102 -0
  479. package/dist/extensions/mcp/oauth.d.ts.map +1 -0
  480. package/dist/extensions/mcp/oauth.js +428 -0
  481. package/dist/extensions/mcp/oauth.js.map +1 -0
  482. package/dist/extensions/mcp/resources.d.ts +36 -0
  483. package/dist/extensions/mcp/resources.d.ts.map +1 -0
  484. package/dist/extensions/mcp/resources.js +261 -0
  485. package/dist/extensions/mcp/resources.js.map +1 -0
  486. package/dist/extensions/mcp/runtime.d.ts +98 -0
  487. package/dist/extensions/mcp/runtime.d.ts.map +1 -0
  488. package/dist/extensions/mcp/runtime.js +378 -0
  489. package/dist/extensions/mcp/runtime.js.map +1 -0
  490. package/dist/extensions/mcp/runtime.lazy.d.ts +3 -0
  491. package/dist/extensions/mcp/runtime.lazy.d.ts.map +1 -0
  492. package/dist/extensions/mcp/runtime.lazy.js +3 -0
  493. package/dist/extensions/mcp/runtime.lazy.js.map +1 -0
  494. package/dist/extensions/mcp/tools.d.ts +84 -0
  495. package/dist/extensions/mcp/tools.d.ts.map +1 -0
  496. package/dist/extensions/mcp/tools.js +263 -0
  497. package/dist/extensions/mcp/tools.js.map +1 -0
  498. package/dist/extensions/punch/a2a-listen.d.ts +9 -0
  499. package/dist/extensions/punch/a2a-listen.d.ts.map +1 -0
  500. package/dist/extensions/punch/a2a-listen.js +88 -0
  501. package/dist/extensions/punch/a2a-listen.js.map +1 -0
  502. package/dist/extensions/punch/a2a.d.ts +12 -0
  503. package/dist/extensions/punch/a2a.d.ts.map +1 -0
  504. package/dist/extensions/punch/a2a.js +106 -0
  505. package/dist/extensions/punch/a2a.js.map +1 -0
  506. package/dist/extensions/punch/auth.d.ts +2 -1
  507. package/dist/extensions/punch/auth.d.ts.map +1 -1
  508. package/dist/extensions/punch/auth.js +5 -1
  509. package/dist/extensions/punch/auth.js.map +1 -1
  510. package/dist/extensions/punch/collabs.d.ts.map +1 -1
  511. package/dist/extensions/punch/collabs.js.map +1 -1
  512. package/dist/extensions/punch/index.d.ts.map +1 -1
  513. package/dist/extensions/punch/index.js +11 -15
  514. package/dist/extensions/punch/index.js.map +1 -1
  515. package/dist/extensions/punch/routines.d.ts +1 -3
  516. package/dist/extensions/punch/routines.d.ts.map +1 -1
  517. package/dist/extensions/punch/routines.js +1 -121
  518. package/dist/extensions/punch/routines.js.map +1 -1
  519. package/dist/extensions/punch/server.d.ts +3 -0
  520. package/dist/extensions/punch/server.d.ts.map +1 -1
  521. package/dist/extensions/punch/server.js +41 -3
  522. package/dist/extensions/punch/server.js.map +1 -1
  523. package/dist/extensions/punch/timezone.d.ts.map +1 -1
  524. package/dist/extensions/punch/timezone.js.map +1 -1
  525. package/dist/extensions/punch/todo-store.d.ts +15 -0
  526. package/dist/extensions/punch/todo-store.d.ts.map +1 -0
  527. package/dist/extensions/punch/todo-store.js +208 -0
  528. package/dist/extensions/punch/todo-store.js.map +1 -0
  529. package/dist/extensions/punch/todos.d.ts +7 -3
  530. package/dist/extensions/punch/todos.d.ts.map +1 -1
  531. package/dist/extensions/punch/todos.js +40 -17
  532. package/dist/extensions/punch/todos.js.map +1 -1
  533. package/dist/extensions/report-progress/index.d.ts.map +1 -1
  534. package/dist/extensions/report-progress/index.js.map +1 -1
  535. package/dist/extensions/subagent/agents.d.ts.map +1 -1
  536. package/dist/extensions/subagent/agents.js.map +1 -1
  537. package/dist/extensions/subagent/index.d.ts.map +1 -1
  538. package/dist/extensions/subagent/index.js +0 -372
  539. package/dist/extensions/subagent/index.js.map +1 -1
  540. package/dist/extensions/tool-search/index.d.ts +12 -0
  541. package/dist/extensions/tool-search/index.d.ts.map +1 -0
  542. package/dist/extensions/tool-search/index.js +15 -0
  543. package/dist/extensions/tool-search/index.js.map +1 -0
  544. package/dist/extensions/tool-search/tool.d.ts +71 -0
  545. package/dist/extensions/tool-search/tool.d.ts.map +1 -0
  546. package/dist/extensions/tool-search/tool.js +187 -0
  547. package/dist/extensions/tool-search/tool.js.map +1 -0
  548. package/dist/extensions/webfetch/index.d.ts.map +1 -1
  549. package/dist/extensions/webfetch/index.js.map +1 -1
  550. package/dist/extensions/websearch/index.d.ts.map +1 -1
  551. package/dist/extensions/websearch/index.js.map +1 -1
  552. package/dist/index.d.ts +13 -6
  553. package/dist/index.d.ts.map +1 -1
  554. package/dist/index.js +9 -6
  555. package/dist/index.js.map +1 -1
  556. package/dist/main.d.ts +1 -1
  557. package/dist/main.d.ts.map +1 -1
  558. package/dist/main.js +140 -173
  559. package/dist/main.js.map +1 -1
  560. package/dist/migrations.d.ts.map +1 -1
  561. package/dist/migrations.js +0 -20
  562. package/dist/migrations.js.map +1 -1
  563. package/dist/modes/index.d.ts +0 -1
  564. package/dist/modes/index.d.ts.map +1 -1
  565. package/dist/modes/index.js +0 -1
  566. package/dist/modes/index.js.map +1 -1
  567. package/dist/modes/json-event.d.ts.map +1 -1
  568. package/dist/modes/json-event.js.map +1 -1
  569. package/dist/modes/print-mode.d.ts.map +1 -1
  570. package/dist/modes/print-mode.js +4 -0
  571. package/dist/modes/print-mode.js.map +1 -1
  572. package/dist/modes/rpc/jsonl.d.ts.map +1 -1
  573. package/dist/modes/rpc/jsonl.js.map +1 -1
  574. package/dist/modes/rpc/rpc-client.d.ts +10 -6
  575. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  576. package/dist/modes/rpc/rpc-client.js +19 -8
  577. package/dist/modes/rpc/rpc-client.js.map +1 -1
  578. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  579. package/dist/modes/rpc/rpc-mode.js +30 -48
  580. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  581. package/dist/modes/rpc/rpc-types.d.ts +21 -1
  582. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  583. package/dist/modes/rpc/rpc-types.js.map +1 -1
  584. package/dist/package-manager-cli.d.ts.map +1 -1
  585. package/dist/package-manager-cli.js +43 -43
  586. package/dist/package-manager-cli.js.map +1 -1
  587. package/dist/rpc-entry.d.ts.map +1 -1
  588. package/dist/rpc-entry.js.map +1 -1
  589. package/dist/server/a2a/harness-runner.d.ts.map +1 -1
  590. package/dist/server/a2a/harness-runner.js.map +1 -1
  591. package/dist/server/a2a/run-server.d.ts.map +1 -1
  592. package/dist/server/a2a/run-server.js.map +1 -1
  593. package/dist/utils/abort.d.ts.map +1 -1
  594. package/dist/utils/abort.js.map +1 -1
  595. package/dist/utils/ansi.d.ts +8 -0
  596. package/dist/utils/ansi.d.ts.map +1 -1
  597. package/dist/utils/ansi.js +30 -11
  598. package/dist/utils/ansi.js.map +1 -1
  599. package/dist/utils/changelog.d.ts.map +1 -1
  600. package/dist/utils/changelog.js +5 -2
  601. package/dist/utils/changelog.js.map +1 -1
  602. package/dist/utils/child-process.d.ts.map +1 -1
  603. package/dist/utils/child-process.js.map +1 -1
  604. package/dist/utils/clipboard-command.d.ts.map +1 -1
  605. package/dist/utils/clipboard-command.js.map +1 -1
  606. package/dist/utils/clipboard-image.d.ts.map +1 -1
  607. package/dist/utils/clipboard-image.js +15 -41
  608. package/dist/utils/clipboard-image.js.map +1 -1
  609. package/dist/utils/clipboard.d.ts.map +1 -1
  610. package/dist/utils/clipboard.js +96 -38
  611. package/dist/utils/clipboard.js.map +1 -1
  612. package/dist/utils/colors.d.ts +73 -0
  613. package/dist/utils/colors.d.ts.map +1 -0
  614. package/dist/utils/colors.js +273 -0
  615. package/dist/utils/colors.js.map +1 -0
  616. package/dist/utils/deprecation.d.ts.map +1 -1
  617. package/dist/utils/deprecation.js.map +1 -1
  618. package/dist/utils/exif-orientation.d.ts.map +1 -1
  619. package/dist/utils/exif-orientation.js.map +1 -1
  620. package/dist/utils/frontmatter.d.ts.map +1 -1
  621. package/dist/utils/frontmatter.js.map +1 -1
  622. package/dist/utils/fs-watch.d.ts.map +1 -1
  623. package/dist/utils/fs-watch.js.map +1 -1
  624. package/dist/utils/fuzzy.d.ts +16 -0
  625. package/dist/utils/fuzzy.d.ts.map +1 -0
  626. package/dist/utils/fuzzy.js +111 -0
  627. package/dist/utils/fuzzy.js.map +1 -0
  628. package/dist/utils/git.d.ts.map +1 -1
  629. package/dist/utils/git.js.map +1 -1
  630. package/dist/utils/html.d.ts.map +1 -1
  631. package/dist/utils/html.js.map +1 -1
  632. package/dist/utils/image-convert.d.ts.map +1 -1
  633. package/dist/utils/image-convert.js.map +1 -1
  634. package/dist/utils/image-process.d.ts.map +1 -1
  635. package/dist/utils/image-process.js.map +1 -1
  636. package/dist/utils/image-resize-core.d.ts +12 -0
  637. package/dist/utils/image-resize-core.d.ts.map +1 -1
  638. package/dist/utils/image-resize-core.js +5 -0
  639. package/dist/utils/image-resize-core.js.map +1 -1
  640. package/dist/utils/image-resize-worker.d.ts.map +1 -1
  641. package/dist/utils/image-resize-worker.js +3 -2
  642. package/dist/utils/image-resize-worker.js.map +1 -1
  643. package/dist/utils/image-resize.d.ts.map +1 -1
  644. package/dist/utils/image-resize.js +9 -10
  645. package/dist/utils/image-resize.js.map +1 -1
  646. package/dist/utils/json.d.ts.map +1 -1
  647. package/dist/utils/json.js.map +1 -1
  648. package/dist/utils/management-http.d.ts.map +1 -1
  649. package/dist/utils/management-http.js.map +1 -1
  650. package/dist/utils/mime.d.ts.map +1 -1
  651. package/dist/utils/mime.js +1 -1
  652. package/dist/utils/mime.js.map +1 -1
  653. package/dist/utils/oklab.d.ts +43 -0
  654. package/dist/utils/oklab.d.ts.map +1 -0
  655. package/dist/utils/oklab.js +210 -0
  656. package/dist/utils/oklab.js.map +1 -0
  657. package/dist/utils/open-browser.d.ts.map +1 -1
  658. package/dist/utils/open-browser.js.map +1 -1
  659. package/dist/utils/output-files.d.ts +15 -0
  660. package/dist/utils/output-files.d.ts.map +1 -0
  661. package/dist/utils/output-files.js +30 -0
  662. package/dist/utils/output-files.js.map +1 -0
  663. package/dist/utils/paths.d.ts +3 -3
  664. package/dist/utils/paths.d.ts.map +1 -1
  665. package/dist/utils/paths.js +5 -4
  666. package/dist/utils/paths.js.map +1 -1
  667. package/dist/utils/photon.d.ts.map +1 -1
  668. package/dist/utils/photon.js.map +1 -1
  669. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  670. package/dist/utils/pi-user-agent.js.map +1 -1
  671. package/dist/utils/shell.d.ts +1 -3
  672. package/dist/utils/shell.d.ts.map +1 -1
  673. package/dist/utils/shell.js +3 -30
  674. package/dist/utils/shell.js.map +1 -1
  675. package/dist/utils/sleep.d.ts.map +1 -1
  676. package/dist/utils/sleep.js.map +1 -1
  677. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  678. package/dist/utils/syntax-highlight.js +8 -1
  679. package/dist/utils/syntax-highlight.js.map +1 -1
  680. package/dist/utils/text.d.ts.map +1 -1
  681. package/dist/utils/text.js.map +1 -1
  682. package/dist/utils/tool-result-images.d.ts +3 -1
  683. package/dist/utils/tool-result-images.d.ts.map +1 -1
  684. package/dist/utils/tool-result-images.js +4 -1
  685. package/dist/utils/tool-result-images.js.map +1 -1
  686. package/dist/utils/tools-manager.d.ts.map +1 -1
  687. package/dist/utils/tools-manager.js.map +1 -1
  688. package/dist/utils/version-check.d.ts.map +1 -1
  689. package/dist/utils/version-check.js.map +1 -1
  690. package/dist/utils/windows-self-update.d.ts.map +1 -1
  691. package/dist/utils/windows-self-update.js.map +1 -1
  692. package/dist/utils/wsl.d.ts +3 -0
  693. package/dist/utils/wsl.d.ts.map +1 -0
  694. package/dist/utils/wsl.js +15 -0
  695. package/dist/utils/wsl.js.map +1 -0
  696. package/dist/utils/zip.d.ts +7 -0
  697. package/dist/utils/zip.d.ts.map +1 -0
  698. package/dist/utils/zip.js +60 -0
  699. package/dist/utils/zip.js.map +1 -0
  700. package/docs/cli-integration.md +106 -0
  701. package/docs/cli.md +333 -0
  702. package/docs/codemode.md +230 -0
  703. package/docs/compaction.md +47 -28
  704. package/docs/configuration.md +47 -0
  705. package/docs/containerization.md +109 -82
  706. package/docs/custom-provider.md +109 -713
  707. package/docs/docs.json +152 -96
  708. package/docs/environment-variables.md +18 -3
  709. package/docs/extensions.md +284 -604
  710. package/docs/how-pi-works.md +49 -0
  711. package/docs/images/interactive-mode.png +0 -0
  712. package/docs/index.md +24 -69
  713. package/docs/json.md +193 -65
  714. package/docs/keybindings.md +58 -103
  715. package/docs/llama-cpp.md +24 -4
  716. package/docs/mcp.md +272 -0
  717. package/docs/message-types.md +279 -0
  718. package/docs/models.md +124 -489
  719. package/docs/nvidia-rtx-llama-cpp.md +96 -0
  720. package/docs/packages.md +67 -166
  721. package/docs/prompt-templates.md +31 -68
  722. package/docs/providers.md +158 -228
  723. package/docs/punch-todos.md +24 -0
  724. package/docs/quickstart.md +61 -106
  725. package/docs/rpc-commands.md +888 -0
  726. package/docs/rpc-extension-ui.md +200 -0
  727. package/docs/rpc.md +131 -1554
  728. package/docs/sdk.md +79 -1158
  729. package/docs/security.md +72 -32
  730. package/docs/session-format.md +58 -215
  731. package/docs/sessions.md +35 -114
  732. package/docs/settings.md +98 -326
  733. package/docs/shell-aliases.md +85 -5
  734. package/docs/skills.md +51 -190
  735. package/docs/slash-commands.md +60 -0
  736. package/docs/subagents.md +2 -0
  737. package/docs/terminal-setup.md +7 -182
  738. package/docs/termux.md +74 -83
  739. package/docs/themes.md +89 -273
  740. package/docs/tmux.md +31 -39
  741. package/docs/tui.md +74 -910
  742. package/docs/usage.md +52 -129
  743. package/docs/virtual-models.md +114 -0
  744. package/docs/windows.md +45 -17
  745. package/examples/README.md +13 -5
  746. package/examples/extensions/README.md +4 -30
  747. package/examples/extensions/custom-provider-anthropic/index.ts +18 -12
  748. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  749. package/examples/extensions/custom-provider-anthropic/package.json +17 -17
  750. package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
  751. package/examples/extensions/custom-provider-gitlab-duo/package.json +14 -14
  752. package/examples/extensions/custom-provider-gitlab-duo/test.ts +5 -5
  753. package/examples/extensions/debug-provider.ts +69 -0
  754. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  755. package/examples/extensions/gondolin/package-lock.json +5 -5
  756. package/examples/extensions/gondolin/package.json +1 -1
  757. package/examples/extensions/jev-router.ts +113 -0
  758. package/examples/extensions/prompt-customizer.ts +19 -67
  759. package/examples/extensions/sandbox/package-lock.json +2 -2
  760. package/examples/extensions/sandbox/package.json +1 -1
  761. package/examples/extensions/with-deps/package-lock.json +2 -2
  762. package/examples/extensions/with-deps/package.json +20 -20
  763. package/examples/rpc-client.ts +35 -0
  764. package/examples/sdk/14-codemode-mcp.ts +61 -0
  765. package/examples/sdk/README.md +3 -2
  766. package/npm-shrinkwrap.json +2425 -0
  767. package/package.json +30 -29
  768. package/schemas/models.schema.json +1157 -0
  769. package/schemas/settings.schema.json +734 -0
  770. package/schemas/theme.schema.json +365 -0
  771. package/src/extensions/punch/sqlite-bun.mjs +1 -0
  772. package/src/extensions/punch/sqlite-driver.d.mts +15 -0
  773. package/src/extensions/punch/sqlite-node.mjs +1 -0
  774. package/dist/bundle/chunks/anthropic-messages-ASRU76PT.js +0 -6
  775. package/dist/bundle/chunks/azure-openai-responses-UGF6LMEX.js +0 -2
  776. package/dist/bundle/chunks/chunk-5PRUVL6W.js +0 -1770
  777. package/dist/bundle/chunks/chunk-6R7UI4IY.js +0 -2
  778. package/dist/bundle/chunks/chunk-A3JYRWB6.js +0 -2
  779. package/dist/bundle/chunks/chunk-CHB3CEFP.js +0 -2
  780. package/dist/bundle/chunks/chunk-ELBMWBDG.js +0 -11
  781. package/dist/bundle/chunks/chunk-GMWCTUPB.js +0 -2
  782. package/dist/bundle/chunks/chunk-GTBU4EAF.js +0 -2
  783. package/dist/bundle/chunks/chunk-NUHFSC37.js +0 -25
  784. package/dist/bundle/chunks/chunk-UIWY7TU5.js +0 -42
  785. package/dist/bundle/chunks/chunk-XNGRGP62.js +0 -2
  786. package/dist/bundle/chunks/google-generative-ai-VCD2PGIY.js +0 -2
  787. package/dist/bundle/chunks/google-vertex-L6U34ZRC.js +0 -2
  788. package/dist/bundle/chunks/mistral-conversations-IXWQ2YKN.js +0 -5
  789. package/dist/bundle/chunks/node-5YXRXMVN.js +0 -16
  790. package/dist/bundle/chunks/openai-codex-responses-P7HKQLIT.js +0 -10
  791. package/dist/bundle/chunks/openai-completions-O7BFLP3U.js +0 -7
  792. package/dist/bundle/chunks/openai-responses-QAKWAYVG.js +0 -2
  793. package/dist/cli/config-selector.d.ts +0 -16
  794. package/dist/cli/config-selector.d.ts.map +0 -1
  795. package/dist/cli/config-selector.js +0 -32
  796. package/dist/cli/config-selector.js.map +0 -1
  797. package/dist/cli/session-picker.d.ts +0 -10
  798. package/dist/cli/session-picker.d.ts.map +0 -1
  799. package/dist/cli/session-picker.js +0 -36
  800. package/dist/cli/session-picker.js.map +0 -1
  801. package/dist/cli/startup-ui.d.ts +0 -20
  802. package/dist/cli/startup-ui.d.ts.map +0 -1
  803. package/dist/cli/startup-ui.js +0 -185
  804. package/dist/cli/startup-ui.js.map +0 -1
  805. package/dist/core/keybindings.d.ts +0 -428
  806. package/dist/core/keybindings.d.ts.map +0 -1
  807. package/dist/core/keybindings.js +0 -321
  808. package/dist/core/keybindings.js.map +0 -1
  809. package/dist/core/tools/render-utils.d.ts +0 -24
  810. package/dist/core/tools/render-utils.d.ts.map +0 -1
  811. package/dist/core/tools/render-utils.js +0 -65
  812. package/dist/core/tools/render-utils.js.map +0 -1
  813. package/dist/core/tools/renderers/bash.d.ts +0 -12
  814. package/dist/core/tools/renderers/bash.d.ts.map +0 -1
  815. package/dist/core/tools/renderers/bash.js +0 -130
  816. package/dist/core/tools/renderers/bash.js.map +0 -1
  817. package/dist/core/tools/renderers/edit.d.ts +0 -23
  818. package/dist/core/tools/renderers/edit.d.ts.map +0 -1
  819. package/dist/core/tools/renderers/edit.js +0 -167
  820. package/dist/core/tools/renderers/edit.js.map +0 -1
  821. package/dist/core/tools/renderers/find.d.ts +0 -10
  822. package/dist/core/tools/renderers/find.d.ts.map +0 -1
  823. package/dist/core/tools/renderers/find.js +0 -64
  824. package/dist/core/tools/renderers/find.js.map +0 -1
  825. package/dist/core/tools/renderers/grep.d.ts +0 -10
  826. package/dist/core/tools/renderers/grep.d.ts.map +0 -1
  827. package/dist/core/tools/renderers/grep.js +0 -69
  828. package/dist/core/tools/renderers/grep.js.map +0 -1
  829. package/dist/core/tools/renderers/index.d.ts +0 -28
  830. package/dist/core/tools/renderers/index.d.ts.map +0 -1
  831. package/dist/core/tools/renderers/index.js +0 -47
  832. package/dist/core/tools/renderers/index.js.map +0 -1
  833. package/dist/core/tools/renderers/ls.d.ts +0 -10
  834. package/dist/core/tools/renderers/ls.d.ts.map +0 -1
  835. package/dist/core/tools/renderers/ls.js +0 -58
  836. package/dist/core/tools/renderers/ls.js.map +0 -1
  837. package/dist/core/tools/renderers/read.d.ts +0 -11
  838. package/dist/core/tools/renderers/read.d.ts.map +0 -1
  839. package/dist/core/tools/renderers/read.js +0 -129
  840. package/dist/core/tools/renderers/read.js.map +0 -1
  841. package/dist/core/tools/renderers/write.d.ts +0 -10
  842. package/dist/core/tools/renderers/write.d.ts.map +0 -1
  843. package/dist/core/tools/renderers/write.js +0 -153
  844. package/dist/core/tools/renderers/write.js.map +0 -1
  845. package/dist/extensions/mcp/mcp-client.d.ts +0 -31
  846. package/dist/extensions/mcp/mcp-client.d.ts.map +0 -1
  847. package/dist/extensions/mcp/mcp-client.js +0 -149
  848. package/dist/extensions/mcp/mcp-client.js.map +0 -1
  849. package/dist/extensions/mcp/mcp-config.d.ts +0 -47
  850. package/dist/extensions/mcp/mcp-config.d.ts.map +0 -1
  851. package/dist/extensions/mcp/mcp-config.js +0 -281
  852. package/dist/extensions/mcp/mcp-config.js.map +0 -1
  853. package/dist/extensions/mcp/mcp-transport.d.ts +0 -65
  854. package/dist/extensions/mcp/mcp-transport.d.ts.map +0 -1
  855. package/dist/extensions/mcp/mcp-transport.js +0 -278
  856. package/dist/extensions/mcp/mcp-transport.js.map +0 -1
  857. package/dist/modes/interactive/assets/clankolas.png +0 -0
  858. package/dist/modes/interactive/chat-viewport.d.ts +0 -20
  859. package/dist/modes/interactive/chat-viewport.d.ts.map +0 -1
  860. package/dist/modes/interactive/chat-viewport.js +0 -28
  861. package/dist/modes/interactive/chat-viewport.js.map +0 -1
  862. package/dist/modes/interactive/components/armin.d.ts +0 -34
  863. package/dist/modes/interactive/components/armin.d.ts.map +0 -1
  864. package/dist/modes/interactive/components/armin.js +0 -333
  865. package/dist/modes/interactive/components/armin.js.map +0 -1
  866. package/dist/modes/interactive/components/assistant-message.d.ts +0 -26
  867. package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  868. package/dist/modes/interactive/components/assistant-message.js +0 -158
  869. package/dist/modes/interactive/components/assistant-message.js.map +0 -1
  870. package/dist/modes/interactive/components/bash-execution.d.ts +0 -34
  871. package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  872. package/dist/modes/interactive/components/bash-execution.js +0 -175
  873. package/dist/modes/interactive/components/bash-execution.js.map +0 -1
  874. package/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
  875. package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  876. package/dist/modes/interactive/components/bordered-loader.js +0 -54
  877. package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  878. package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -16
  879. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  880. package/dist/modes/interactive/components/branch-summary-message.js +0 -44
  881. package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  882. package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -16
  883. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  884. package/dist/modes/interactive/components/compaction-summary-message.js +0 -45
  885. package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  886. package/dist/modes/interactive/components/config-selector.d.ts +0 -102
  887. package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  888. package/dist/modes/interactive/components/config-selector.js +0 -761
  889. package/dist/modes/interactive/components/config-selector.js.map +0 -1
  890. package/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
  891. package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  892. package/dist/modes/interactive/components/countdown-timer.js +0 -33
  893. package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  894. package/dist/modes/interactive/components/custom-editor.d.ts +0 -30
  895. package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  896. package/dist/modes/interactive/components/custom-editor.js +0 -115
  897. package/dist/modes/interactive/components/custom-editor.js.map +0 -1
  898. package/dist/modes/interactive/components/custom-entry.d.ts +0 -19
  899. package/dist/modes/interactive/components/custom-entry.d.ts.map +0 -1
  900. package/dist/modes/interactive/components/custom-entry.js +0 -52
  901. package/dist/modes/interactive/components/custom-entry.js.map +0 -1
  902. package/dist/modes/interactive/components/custom-message.d.ts +0 -22
  903. package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  904. package/dist/modes/interactive/components/custom-message.js +0 -87
  905. package/dist/modes/interactive/components/custom-message.js.map +0 -1
  906. package/dist/modes/interactive/components/daxnuts.d.ts +0 -23
  907. package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
  908. package/dist/modes/interactive/components/daxnuts.js +0 -140
  909. package/dist/modes/interactive/components/daxnuts.js.map +0 -1
  910. package/dist/modes/interactive/components/diff.d.ts +0 -12
  911. package/dist/modes/interactive/components/diff.d.ts.map +0 -1
  912. package/dist/modes/interactive/components/diff.js +0 -133
  913. package/dist/modes/interactive/components/diff.js.map +0 -1
  914. package/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
  915. package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  916. package/dist/modes/interactive/components/dynamic-border.js +0 -21
  917. package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  918. package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -5
  919. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
  920. package/dist/modes/interactive/components/earendil-announcement.js +0 -40
  921. package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
  922. package/dist/modes/interactive/components/extension-editor.d.ts +0 -21
  923. package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  924. package/dist/modes/interactive/components/extension-editor.js +0 -98
  925. package/dist/modes/interactive/components/extension-editor.js.map +0 -1
  926. package/dist/modes/interactive/components/extension-input.d.ts +0 -23
  927. package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  928. package/dist/modes/interactive/components/extension-input.js +0 -61
  929. package/dist/modes/interactive/components/extension-input.js.map +0 -1
  930. package/dist/modes/interactive/components/extension-selector.d.ts +0 -26
  931. package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  932. package/dist/modes/interactive/components/extension-selector.js +0 -83
  933. package/dist/modes/interactive/components/extension-selector.js.map +0 -1
  934. package/dist/modes/interactive/components/first-time-setup.d.ts +0 -25
  935. package/dist/modes/interactive/components/first-time-setup.d.ts.map +0 -1
  936. package/dist/modes/interactive/components/first-time-setup.js +0 -103
  937. package/dist/modes/interactive/components/first-time-setup.js.map +0 -1
  938. package/dist/modes/interactive/components/footer.d.ts +0 -32
  939. package/dist/modes/interactive/components/footer.d.ts.map +0 -1
  940. package/dist/modes/interactive/components/footer.js +0 -222
  941. package/dist/modes/interactive/components/footer.js.map +0 -1
  942. package/dist/modes/interactive/components/index.d.ts +0 -34
  943. package/dist/modes/interactive/components/index.d.ts.map +0 -1
  944. package/dist/modes/interactive/components/index.js +0 -35
  945. package/dist/modes/interactive/components/index.js.map +0 -1
  946. package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -13
  947. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  948. package/dist/modes/interactive/components/keybinding-hints.js +0 -36
  949. package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  950. package/dist/modes/interactive/components/login-dialog.d.ts +0 -52
  951. package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  952. package/dist/modes/interactive/components/login-dialog.js +0 -188
  953. package/dist/modes/interactive/components/login-dialog.js.map +0 -1
  954. package/dist/modes/interactive/components/markdown-transform.d.ts +0 -3
  955. package/dist/modes/interactive/components/markdown-transform.d.ts.map +0 -1
  956. package/dist/modes/interactive/components/markdown-transform.js +0 -19
  957. package/dist/modes/interactive/components/markdown-transform.js.map +0 -1
  958. package/dist/modes/interactive/components/mermaid.d.ts +0 -11
  959. package/dist/modes/interactive/components/mermaid.d.ts.map +0 -1
  960. package/dist/modes/interactive/components/mermaid.js +0 -75
  961. package/dist/modes/interactive/components/mermaid.js.map +0 -1
  962. package/dist/modes/interactive/components/model-selector.d.ts +0 -60
  963. package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  964. package/dist/modes/interactive/components/model-selector.js +0 -361
  965. package/dist/modes/interactive/components/model-selector.js.map +0 -1
  966. package/dist/modes/interactive/components/oauth-selector.d.ts +0 -33
  967. package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  968. package/dist/modes/interactive/components/oauth-selector.js +0 -163
  969. package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  970. package/dist/modes/interactive/components/question-selector.d.ts +0 -24
  971. package/dist/modes/interactive/components/question-selector.d.ts.map +0 -1
  972. package/dist/modes/interactive/components/question-selector.js +0 -158
  973. package/dist/modes/interactive/components/question-selector.js.map +0 -1
  974. package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -46
  975. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  976. package/dist/modes/interactive/components/scoped-models-selector.js +0 -326
  977. package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  978. package/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
  979. package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  980. package/dist/modes/interactive/components/session-selector-search.js +0 -155
  981. package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  982. package/dist/modes/interactive/components/session-selector.d.ts +0 -95
  983. package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  984. package/dist/modes/interactive/components/session-selector.js +0 -867
  985. package/dist/modes/interactive/components/session-selector.js.map +0 -1
  986. package/dist/modes/interactive/components/settings-selector.d.ts +0 -92
  987. package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  988. package/dist/modes/interactive/components/settings-selector.js +0 -709
  989. package/dist/modes/interactive/components/settings-selector.js.map +0 -1
  990. package/dist/modes/interactive/components/settings-submenu.d.ts +0 -72
  991. package/dist/modes/interactive/components/settings-submenu.d.ts.map +0 -1
  992. package/dist/modes/interactive/components/settings-submenu.js +0 -165
  993. package/dist/modes/interactive/components/settings-submenu.js.map +0 -1
  994. package/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
  995. package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  996. package/dist/modes/interactive/components/show-images-selector.js +0 -39
  997. package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  998. package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -17
  999. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  1000. package/dist/modes/interactive/components/skill-invocation-message.js +0 -47
  1001. package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  1002. package/dist/modes/interactive/components/status-indicator.d.ts +0 -30
  1003. package/dist/modes/interactive/components/status-indicator.d.ts.map +0 -1
  1004. package/dist/modes/interactive/components/status-indicator.js +0 -67
  1005. package/dist/modes/interactive/components/status-indicator.js.map +0 -1
  1006. package/dist/modes/interactive/components/theme-selector.d.ts +0 -11
  1007. package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  1008. package/dist/modes/interactive/components/theme-selector.js +0 -50
  1009. package/dist/modes/interactive/components/theme-selector.js.map +0 -1
  1010. package/dist/modes/interactive/components/thinking-selector.d.ts +0 -23
  1011. package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  1012. package/dist/modes/interactive/components/thinking-selector.js +0 -109
  1013. package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  1014. package/dist/modes/interactive/components/tool-execution.d.ts +0 -80
  1015. package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  1016. package/dist/modes/interactive/components/tool-execution.js +0 -328
  1017. package/dist/modes/interactive/components/tool-execution.js.map +0 -1
  1018. package/dist/modes/interactive/components/tree-selector.d.ts +0 -94
  1019. package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  1020. package/dist/modes/interactive/components/tree-selector.js +0 -1245
  1021. package/dist/modes/interactive/components/tree-selector.js.map +0 -1
  1022. package/dist/modes/interactive/components/trust-selector.d.ts +0 -23
  1023. package/dist/modes/interactive/components/trust-selector.d.ts.map +0 -1
  1024. package/dist/modes/interactive/components/trust-selector.js +0 -91
  1025. package/dist/modes/interactive/components/trust-selector.js.map +0 -1
  1026. package/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
  1027. package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  1028. package/dist/modes/interactive/components/user-message-selector.js +0 -114
  1029. package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  1030. package/dist/modes/interactive/components/user-message.d.ts +0 -16
  1031. package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  1032. package/dist/modes/interactive/components/user-message.js +0 -49
  1033. package/dist/modes/interactive/components/user-message.js.map +0 -1
  1034. package/dist/modes/interactive/components/visual-truncate.d.ts +0 -24
  1035. package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  1036. package/dist/modes/interactive/components/visual-truncate.js +0 -33
  1037. package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  1038. package/dist/modes/interactive/external-editor.d.ts +0 -12
  1039. package/dist/modes/interactive/external-editor.d.ts.map +0 -1
  1040. package/dist/modes/interactive/external-editor.js +0 -38
  1041. package/dist/modes/interactive/external-editor.js.map +0 -1
  1042. package/dist/modes/interactive/interactive-mode.d.ts +0 -443
  1043. package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  1044. package/dist/modes/interactive/interactive-mode.js +0 -5604
  1045. package/dist/modes/interactive/interactive-mode.js.map +0 -1
  1046. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +0 -1
  1047. package/dist/modes/interactive/model-catalog-refresh.js.map +0 -1
  1048. package/dist/modes/interactive/model-search.d.ts +0 -12
  1049. package/dist/modes/interactive/model-search.d.ts.map +0 -1
  1050. package/dist/modes/interactive/model-search.js +0 -15
  1051. package/dist/modes/interactive/model-search.js.map +0 -1
  1052. package/dist/modes/interactive/session-share.d.ts +0 -16
  1053. package/dist/modes/interactive/session-share.d.ts.map +0 -1
  1054. package/dist/modes/interactive/session-share.js +0 -184
  1055. package/dist/modes/interactive/session-share.js.map +0 -1
  1056. package/dist/modes/interactive/theme/dark.json +0 -91
  1057. package/dist/modes/interactive/theme/light.json +0 -90
  1058. package/dist/modes/interactive/theme/theme-controller.d.ts +0 -41
  1059. package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
  1060. package/dist/modes/interactive/theme/theme-controller.js +0 -130
  1061. package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
  1062. package/dist/modes/interactive/theme/theme-json.d.ts +0 -84
  1063. package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
  1064. package/dist/modes/interactive/theme/theme-json.js +0 -130
  1065. package/dist/modes/interactive/theme/theme-json.js.map +0 -1
  1066. package/dist/modes/interactive/theme/theme-schema.json +0 -356
  1067. package/dist/modes/interactive/theme/theme.d.ts +0 -131
  1068. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  1069. package/dist/modes/interactive/theme/theme.js.map +0 -1
  1070. package/dist/modes/interactive/tui-renderer.d.ts +0 -21
  1071. package/dist/modes/interactive/tui-renderer.d.ts.map +0 -1
  1072. package/dist/modes/interactive/tui-renderer.js +0 -66
  1073. package/dist/modes/interactive/tui-renderer.js.map +0 -1
  1074. package/docs/development.md +0 -90
  1075. package/examples/extensions/border-status-editor.ts +0 -145
  1076. package/examples/extensions/built-in-tool-renderer.ts +0 -249
  1077. package/examples/extensions/custom-footer.ts +0 -64
  1078. package/examples/extensions/custom-header.ts +0 -73
  1079. package/examples/extensions/doom-overlay/README.md +0 -46
  1080. package/examples/extensions/doom-overlay/doom/build/doom.js +0 -21
  1081. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  1082. package/examples/extensions/doom-overlay/doom/build.sh +0 -152
  1083. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +0 -72
  1084. package/examples/extensions/doom-overlay/doom-component.ts +0 -132
  1085. package/examples/extensions/doom-overlay/doom-engine.ts +0 -173
  1086. package/examples/extensions/doom-overlay/doom-keys.ts +0 -104
  1087. package/examples/extensions/doom-overlay/index.ts +0 -74
  1088. package/examples/extensions/doom-overlay/wad-finder.ts +0 -55
  1089. package/examples/extensions/entry-renderer.ts +0 -41
  1090. package/examples/extensions/github-issue-autocomplete.ts +0 -185
  1091. package/examples/extensions/handoff.ts +0 -190
  1092. package/examples/extensions/interactive-shell.ts +0 -196
  1093. package/examples/extensions/kimi-deferred-tools.ts +0 -61
  1094. package/examples/extensions/message-renderer.ts +0 -59
  1095. package/examples/extensions/minimal-mode.ts +0 -426
  1096. package/examples/extensions/modal-editor.ts +0 -85
  1097. package/examples/extensions/overlay-qa-tests.ts +0 -1450
  1098. package/examples/extensions/overlay-test.ts +0 -153
  1099. package/examples/extensions/plan-mode/README.md +0 -66
  1100. package/examples/extensions/plan-mode/index.ts +0 -390
  1101. package/examples/extensions/plan-mode/utils.ts +0 -168
  1102. package/examples/extensions/preset.ts +0 -436
  1103. package/examples/extensions/qna.ts +0 -118
  1104. package/examples/extensions/question.ts +0 -278
  1105. package/examples/extensions/questionnaire.ts +0 -440
  1106. package/examples/extensions/rainbow-editor.ts +0 -88
  1107. package/examples/extensions/snake.ts +0 -343
  1108. package/examples/extensions/space-invaders.ts +0 -560
  1109. package/examples/extensions/structured-output.ts +0 -65
  1110. package/examples/extensions/summarize.ts +0 -199
  1111. package/examples/extensions/tic-tac-toe.ts +0 -1008
  1112. package/examples/extensions/todo.ts +0 -297
  1113. package/examples/extensions/tools.ts +0 -146
  1114. package/examples/extensions/truncated-tool.ts +0 -195
  1115. package/examples/plugins/pi-example-plugin/README.md +0 -38
  1116. package/examples/plugins/pi-example-plugin/package.json +0 -10
  1117. package/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
  1118. package/examples/plugins/pi-example-plugin/src/session.ts +0 -23
  1119. package/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
  1120. package/examples/rpc-extension-ui.ts +0 -641
  1121. /package/dist/bundle/chunks/{chunk-PATAL4PO.js → chunk-7ZC4UXSL.js} +0 -0
@@ -1,28 +0,0 @@
1
- /**
2
- * Built-in tool renderers, without the tools themselves.
3
- *
4
- * A presentation displays tool calls and results; it does not execute them and does not need their
5
- * typebox parameter schemas. Importing this instead of `core/tools/index.ts` keeps ~17 MB of module
6
- * graph out of a process that only renders.
7
- */
8
- import type { ToolDefinition } from "../../extensions/types.ts";
9
- import type { ToolName } from "../index.ts";
10
- import { createShellRenderers } from "./bash.ts";
11
- import { editRenderers } from "./edit.ts";
12
- import { findRenderers } from "./find.ts";
13
- import { grepRenderers } from "./grep.ts";
14
- import { lsRenderers } from "./ls.ts";
15
- import { readRenderers } from "./read.ts";
16
- import { writeRenderers } from "./write.ts";
17
- export type ToolRenderers = Pick<ToolDefinition<any, any>, "renderCall" | "renderResult">;
18
- export { createShellRenderers, editRenderers, findRenderers, grepRenderers, lsRenderers, readRenderers, writeRenderers, };
19
- /** Renderers for every built-in tool, keyed by tool name. */
20
- export declare function createAllToolRenderers(): Record<ToolName, ToolRenderers>;
21
- /**
22
- * Merge built-in renderers into a tool definition that does not supply its own.
23
- *
24
- * `ToolExecutionComponent` used to do this lookup itself, which forced every presentation to import
25
- * the tool implementations. Callers do it now, so a process that renders can import renderers alone.
26
- */
27
- export declare function withBuiltInRenderers<TDefinition extends ToolRenderers>(toolName: string, definition: TDefinition | undefined): TDefinition | ToolRenderers | undefined;
28
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/renderers/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC,CAAC;AAE1F,OAAO,EACN,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,cAAc,GACd,CAAC;AAEF,6DAA6D;AAC7D,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,CAWxE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,SAAS,aAAa,EACrE,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,WAAW,GAAG,SAAS,GACjC,WAAW,GAAG,aAAa,GAAG,SAAS,CASzC","sourcesContent":["/**\n * Built-in tool renderers, without the tools themselves.\n *\n * A presentation displays tool calls and results; it does not execute them and does not need their\n * typebox parameter schemas. Importing this instead of `core/tools/index.ts` keeps ~17 MB of module\n * graph out of a process that only renders.\n */\n\nimport type { ToolDefinition } from \"../../extensions/types.ts\";\nimport type { ToolName } from \"../index.ts\";\nimport { createShellRenderers } from \"./bash.ts\";\nimport { editRenderers } from \"./edit.ts\";\nimport { findRenderers } from \"./find.ts\";\nimport { grepRenderers } from \"./grep.ts\";\nimport { lsRenderers } from \"./ls.ts\";\nimport { readRenderers } from \"./read.ts\";\nimport { writeRenderers } from \"./write.ts\";\n\nexport type ToolRenderers = Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\">;\n\nexport {\n\tcreateShellRenderers,\n\teditRenderers,\n\tfindRenderers,\n\tgrepRenderers,\n\tlsRenderers,\n\treadRenderers,\n\twriteRenderers,\n};\n\n/** Renderers for every built-in tool, keyed by tool name. */\nexport function createAllToolRenderers(): Record<ToolName, ToolRenderers> {\n\treturn {\n\t\tread: readRenderers,\n\t\tbash: createShellRenderers(\"$\"),\n\t\tpowershell: createShellRenderers(\"PS>\"),\n\t\tedit: editRenderers,\n\t\twrite: writeRenderers,\n\t\tgrep: grepRenderers,\n\t\tfind: findRenderers,\n\t\tls: lsRenderers,\n\t};\n}\n\n/**\n * Merge built-in renderers into a tool definition that does not supply its own.\n *\n * `ToolExecutionComponent` used to do this lookup itself, which forced every presentation to import\n * the tool implementations. Callers do it now, so a process that renders can import renderers alone.\n */\nexport function withBuiltInRenderers<TDefinition extends ToolRenderers>(\n\ttoolName: string,\n\tdefinition: TDefinition | undefined,\n): TDefinition | ToolRenderers | undefined {\n\tconst builtIn = createAllToolRenderers()[toolName as ToolName];\n\tif (!definition) return builtIn;\n\tif (!builtIn) return definition;\n\treturn {\n\t\t...definition,\n\t\trenderCall: definition.renderCall ?? builtIn.renderCall,\n\t\trenderResult: definition.renderResult ?? builtIn.renderResult,\n\t};\n}\n"]}
@@ -1,47 +0,0 @@
1
- /**
2
- * Built-in tool renderers, without the tools themselves.
3
- *
4
- * A presentation displays tool calls and results; it does not execute them and does not need their
5
- * typebox parameter schemas. Importing this instead of `core/tools/index.ts` keeps ~17 MB of module
6
- * graph out of a process that only renders.
7
- */
8
- import { createShellRenderers } from "./bash.js";
9
- import { editRenderers } from "./edit.js";
10
- import { findRenderers } from "./find.js";
11
- import { grepRenderers } from "./grep.js";
12
- import { lsRenderers } from "./ls.js";
13
- import { readRenderers } from "./read.js";
14
- import { writeRenderers } from "./write.js";
15
- export { createShellRenderers, editRenderers, findRenderers, grepRenderers, lsRenderers, readRenderers, writeRenderers, };
16
- /** Renderers for every built-in tool, keyed by tool name. */
17
- export function createAllToolRenderers() {
18
- return {
19
- read: readRenderers,
20
- bash: createShellRenderers("$"),
21
- powershell: createShellRenderers("PS>"),
22
- edit: editRenderers,
23
- write: writeRenderers,
24
- grep: grepRenderers,
25
- find: findRenderers,
26
- ls: lsRenderers,
27
- };
28
- }
29
- /**
30
- * Merge built-in renderers into a tool definition that does not supply its own.
31
- *
32
- * `ToolExecutionComponent` used to do this lookup itself, which forced every presentation to import
33
- * the tool implementations. Callers do it now, so a process that renders can import renderers alone.
34
- */
35
- export function withBuiltInRenderers(toolName, definition) {
36
- const builtIn = createAllToolRenderers()[toolName];
37
- if (!definition)
38
- return builtIn;
39
- if (!builtIn)
40
- return definition;
41
- return {
42
- ...definition,
43
- renderCall: definition.renderCall ?? builtIn.renderCall,
44
- renderResult: definition.renderResult ?? builtIn.renderResult,
45
- };
46
- }
47
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/tools/renderers/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5C,OAAO,EACN,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,cAAc,GACd,CAAC;AAEF,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,GAAoC;IACzE,OAAO;QACN,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,oBAAoB,CAAC,GAAG,CAAC;QAC/B,UAAU,EAAE,oBAAoB,CAAC,KAAK,CAAC;QACvC,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,aAAa;QACnB,EAAE,EAAE,WAAW;KACf,CAAC;AAAA,CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CACnC,QAAgB,EAChB,UAAmC,EACO;IAC1C,MAAM,OAAO,GAAG,sBAAsB,EAAE,CAAC,QAAoB,CAAC,CAAC;IAC/D,IAAI,CAAC,UAAU;QAAE,OAAO,OAAO,CAAC;IAChC,IAAI,CAAC,OAAO;QAAE,OAAO,UAAU,CAAC;IAChC,OAAO;QACN,GAAG,UAAU;QACb,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU;QACvD,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,OAAO,CAAC,YAAY;KAC7D,CAAC;AAAA,CACF","sourcesContent":["/**\n * Built-in tool renderers, without the tools themselves.\n *\n * A presentation displays tool calls and results; it does not execute them and does not need their\n * typebox parameter schemas. Importing this instead of `core/tools/index.ts` keeps ~17 MB of module\n * graph out of a process that only renders.\n */\n\nimport type { ToolDefinition } from \"../../extensions/types.ts\";\nimport type { ToolName } from \"../index.ts\";\nimport { createShellRenderers } from \"./bash.ts\";\nimport { editRenderers } from \"./edit.ts\";\nimport { findRenderers } from \"./find.ts\";\nimport { grepRenderers } from \"./grep.ts\";\nimport { lsRenderers } from \"./ls.ts\";\nimport { readRenderers } from \"./read.ts\";\nimport { writeRenderers } from \"./write.ts\";\n\nexport type ToolRenderers = Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\">;\n\nexport {\n\tcreateShellRenderers,\n\teditRenderers,\n\tfindRenderers,\n\tgrepRenderers,\n\tlsRenderers,\n\treadRenderers,\n\twriteRenderers,\n};\n\n/** Renderers for every built-in tool, keyed by tool name. */\nexport function createAllToolRenderers(): Record<ToolName, ToolRenderers> {\n\treturn {\n\t\tread: readRenderers,\n\t\tbash: createShellRenderers(\"$\"),\n\t\tpowershell: createShellRenderers(\"PS>\"),\n\t\tedit: editRenderers,\n\t\twrite: writeRenderers,\n\t\tgrep: grepRenderers,\n\t\tfind: findRenderers,\n\t\tls: lsRenderers,\n\t};\n}\n\n/**\n * Merge built-in renderers into a tool definition that does not supply its own.\n *\n * `ToolExecutionComponent` used to do this lookup itself, which forced every presentation to import\n * the tool implementations. Callers do it now, so a process that renders can import renderers alone.\n */\nexport function withBuiltInRenderers<TDefinition extends ToolRenderers>(\n\ttoolName: string,\n\tdefinition: TDefinition | undefined,\n): TDefinition | ToolRenderers | undefined {\n\tconst builtIn = createAllToolRenderers()[toolName as ToolName];\n\tif (!definition) return builtIn;\n\tif (!builtIn) return definition;\n\treturn {\n\t\t...definition,\n\t\trenderCall: definition.renderCall ?? builtIn.renderCall,\n\t\trenderResult: definition.renderResult ?? builtIn.renderResult,\n\t};\n}\n"]}
@@ -1,10 +0,0 @@
1
- /**
2
- * Presentation for the ls tool.
3
- *
4
- * Renderers live apart from the implementation so a process that only displays tool output does not
5
- * load the execution path or its typebox parameter schema. `ls.ts` spreads these into its
6
- * definition, so the tool's public shape is unchanged.
7
- */
8
- import type { ToolDefinition } from "../../extensions/types.ts";
9
- export declare const lsRenderers: Pick<ToolDefinition<any, any>, "renderCall" | "renderResult">;
10
- //# sourceMappingURL=ls.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/renderers/ls.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,2BAA2B,CAAC;AA+CzF,eAAO,MAAM,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,cAAc,CAWrF,CAAC","sourcesContent":["/**\n * Presentation for the ls tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `ls.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { Text } from \"@punch-bot/tui\";\nimport { keyHint } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport type { LsToolDetails } from \"../ls.ts\";\nimport { getTextOutput, renderToolPath, str } from \"../render-utils.ts\";\nimport { DEFAULT_MAX_BYTES, formatSize } from \"../truncate.ts\";\n\nfunction formatLsCall(args: { path?: string; limit?: number } | undefined, theme: Theme, cwd: string): string {\n\tconst limit = args?.limit;\n\tconst pathDisplay = renderToolPath(str(args?.path), theme, cwd, { emptyFallback: \".\" });\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"ls\"))} ${pathDisplay}`;\n\tif (limit !== undefined) {\n\t\ttext += theme.fg(\"toolOutput\", ` (limit ${limit})`);\n\t}\n\treturn text;\n}\nfunction formatLsResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: LsToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n): string {\n\tconst output = getTextOutput(result, showImages).trim();\n\tlet text = \"\";\n\tif (output) {\n\t\tconst lines = output.split(\"\\n\");\n\t\tconst maxLines = options.expanded ? lines.length : 20;\n\t\tconst displayLines = lines.slice(0, maxLines);\n\t\tconst remaining = lines.length - maxLines;\n\t\ttext += `\\n${displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\")}`;\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t}\n\n\tconst entryLimit = result.details?.entryLimitReached;\n\tconst truncation = result.details?.truncation;\n\tif (entryLimit || truncation?.truncated) {\n\t\tconst warnings: string[] = [];\n\t\tif (entryLimit) warnings.push(`${entryLimit} entries limit`);\n\t\tif (truncation?.truncated) warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);\n\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${warnings.join(\", \")}]`)}`;\n\t}\n\treturn text;\n}\n\nexport const lsRenderers: Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatLsCall(args as any, theme, context.cwd));\n\t\treturn text;\n\t},\n\trenderResult(result, options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatLsResult(result as any, options, theme, context.showImages));\n\t\treturn text;\n\t},\n};\n"]}
@@ -1,58 +0,0 @@
1
- /**
2
- * Presentation for the ls tool.
3
- *
4
- * Renderers live apart from the implementation so a process that only displays tool output does not
5
- * load the execution path or its typebox parameter schema. `ls.ts` spreads these into its
6
- * definition, so the tool's public shape is unchanged.
7
- */
8
- import { Text } from "@punch-bot/tui";
9
- import { keyHint } from "../../../modes/interactive/components/keybinding-hints.js";
10
- import { getTextOutput, renderToolPath, str } from "../render-utils.js";
11
- import { DEFAULT_MAX_BYTES, formatSize } from "../truncate.js";
12
- function formatLsCall(args, theme, cwd) {
13
- const limit = args?.limit;
14
- const pathDisplay = renderToolPath(str(args?.path), theme, cwd, { emptyFallback: "." });
15
- let text = `${theme.fg("toolTitle", theme.bold("ls"))} ${pathDisplay}`;
16
- if (limit !== undefined) {
17
- text += theme.fg("toolOutput", ` (limit ${limit})`);
18
- }
19
- return text;
20
- }
21
- function formatLsResult(result, options, theme, showImages) {
22
- const output = getTextOutput(result, showImages).trim();
23
- let text = "";
24
- if (output) {
25
- const lines = output.split("\n");
26
- const maxLines = options.expanded ? lines.length : 20;
27
- const displayLines = lines.slice(0, maxLines);
28
- const remaining = lines.length - maxLines;
29
- text += `\n${displayLines.map((line) => theme.fg("toolOutput", line)).join("\n")}`;
30
- if (remaining > 0) {
31
- text += `${theme.fg("muted", `\n... (${remaining} more lines,`)} ${keyHint("app.tools.expand", "to expand")}${theme.fg("muted", ")")}`;
32
- }
33
- }
34
- const entryLimit = result.details?.entryLimitReached;
35
- const truncation = result.details?.truncation;
36
- if (entryLimit || truncation?.truncated) {
37
- const warnings = [];
38
- if (entryLimit)
39
- warnings.push(`${entryLimit} entries limit`);
40
- if (truncation?.truncated)
41
- warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);
42
- text += `\n${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
43
- }
44
- return text;
45
- }
46
- export const lsRenderers = {
47
- renderCall(args, theme, context) {
48
- const text = context.lastComponent ?? new Text("", 0, 0);
49
- text.setText(formatLsCall(args, theme, context.cwd));
50
- return text;
51
- },
52
- renderResult(result, options, theme, context) {
53
- const text = context.lastComponent ?? new Text("", 0, 0);
54
- text.setText(formatLsResult(result, options, theme, context.showImages));
55
- return text;
56
- },
57
- };
58
- //# sourceMappingURL=ls.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ls.js","sourceRoot":"","sources":["../../../../src/core/tools/renderers/ls.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM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,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAW,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC;IAAA,CACZ;IACD,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QAC7C,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAa,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QAChF,OAAO,IAAI,CAAC;IAAA,CACZ;CACD,CAAC","sourcesContent":["/**\n * Presentation for the ls tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `ls.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { Text } from \"@punch-bot/tui\";\nimport { keyHint } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport type { LsToolDetails } from \"../ls.ts\";\nimport { getTextOutput, renderToolPath, str } from \"../render-utils.ts\";\nimport { DEFAULT_MAX_BYTES, formatSize } from \"../truncate.ts\";\n\nfunction formatLsCall(args: { path?: string; limit?: number } | undefined, theme: Theme, cwd: string): string {\n\tconst limit = args?.limit;\n\tconst pathDisplay = renderToolPath(str(args?.path), theme, cwd, { emptyFallback: \".\" });\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"ls\"))} ${pathDisplay}`;\n\tif (limit !== undefined) {\n\t\ttext += theme.fg(\"toolOutput\", ` (limit ${limit})`);\n\t}\n\treturn text;\n}\nfunction formatLsResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: LsToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n): string {\n\tconst output = getTextOutput(result, showImages).trim();\n\tlet text = \"\";\n\tif (output) {\n\t\tconst lines = output.split(\"\\n\");\n\t\tconst maxLines = options.expanded ? lines.length : 20;\n\t\tconst displayLines = lines.slice(0, maxLines);\n\t\tconst remaining = lines.length - maxLines;\n\t\ttext += `\\n${displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\")}`;\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t}\n\n\tconst entryLimit = result.details?.entryLimitReached;\n\tconst truncation = result.details?.truncation;\n\tif (entryLimit || truncation?.truncated) {\n\t\tconst warnings: string[] = [];\n\t\tif (entryLimit) warnings.push(`${entryLimit} entries limit`);\n\t\tif (truncation?.truncated) warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);\n\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${warnings.join(\", \")}]`)}`;\n\t}\n\treturn text;\n}\n\nexport const lsRenderers: Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatLsCall(args as any, theme, context.cwd));\n\t\treturn text;\n\t},\n\trenderResult(result, options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatLsResult(result as any, options, theme, context.showImages));\n\t\treturn text;\n\t},\n};\n"]}
@@ -1,11 +0,0 @@
1
- /**
2
- * Presentation for the read tool.
3
- *
4
- * Renderers live apart from the implementation so a process that only displays tool output does not
5
- * load the execution path or its typebox parameter schema. `read.ts` spreads these into its
6
- * definition, so the tool's public shape is unchanged.
7
- */
8
- import type { ToolDefinition } from "../../extensions/types.ts";
9
- import type { ReadToolDetails } from "../read.ts";
10
- export declare const readRenderers: Pick<ToolDefinition<any, ReadToolDetails | undefined>, "renderCall" | "renderResult">;
11
- //# sourceMappingURL=read.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/renderers/read.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,2BAA2B,CAAC;AAEzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAoIlD,eAAO,MAAM,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,eAAe,GAAG,SAAS,CAAC,EAAE,YAAY,GAAG,cAAc,CAyB/G,CAAC","sourcesContent":["/**\n * Presentation for the read tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `read.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { basename, dirname, isAbsolute, relative, resolve as resolvePath, sep } from \"node:path\";\nimport type { ImageContent, TextContent } from \"@punch-bot/ai\";\nimport { Text } from \"@punch-bot/tui\";\nimport { getReadmePath } from \"../../../config.ts\";\nimport { keyHint, keyText } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport { getLanguageFromPath, highlightCode, type Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport { formatPathRelativeToCwdOrAbsolute } from \"../../../utils/paths.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport { resolveToCwd } from \"../path-utils.ts\";\nimport type { ReadToolDetails } from \"../read.ts\";\nimport { getTextOutput, renderToolPath, replaceTabs, str } from \"../render-utils.ts\";\nimport { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize } from \"../truncate.ts\";\n\ninterface CompactReadClassification {\n\tkind: \"docs\" | \"resource\" | \"skill\";\n\tlabel: string;\n}\nconst COMPACT_RESOURCE_FILE_NAMES = new Set([\"AGENTS.override.md\", \"AGENTS.md\", \"AGENTS.MD\", \"CLAUDE.md\", \"CLAUDE.MD\"]);\ntype ReadRenderArgs = { path?: string; file_path?: string; offset?: number; limit?: number };\nfunction formatReadLineRange(args: ReadRenderArgs | undefined, theme: Theme): string {\n\tif (args?.offset === undefined && args?.limit === undefined) return \"\";\n\tconst startLine = args.offset ?? 1;\n\tconst endLine = args.limit !== undefined ? startLine + args.limit - 1 : \"\";\n\treturn theme.fg(\"warning\", `:${startLine}${endLine ? `-${endLine}` : \"\"}`);\n}\nfunction formatReadCall(args: ReadRenderArgs | undefined, theme: Theme, cwd: string): string {\n\tconst pathDisplay = renderToolPath(str(args?.file_path ?? args?.path), theme, cwd);\n\treturn `${theme.fg(\"toolTitle\", theme.bold(\"read\"))} ${pathDisplay}${formatReadLineRange(args, theme)}`;\n}\nfunction trimTrailingEmptyLines(lines: string[]): string[] {\n\tlet end = lines.length;\n\twhile (end > 0 && lines[end - 1] === \"\") {\n\t\tend--;\n\t}\n\treturn lines.slice(0, end);\n}\nfunction toPosixPath(filePath: string): string {\n\treturn filePath.split(sep).join(\"/\");\n}\nfunction getPiDocsClassification(absolutePath: string): CompactReadClassification | undefined {\n\tconst packageRoot = dirname(getReadmePath());\n\tconst relativePath = relative(resolvePath(packageRoot), resolvePath(absolutePath));\n\tif (\n\t\trelativePath === \"\" ||\n\t\trelativePath === \"..\" ||\n\t\trelativePath.startsWith(`..${sep}`) ||\n\t\tisAbsolute(relativePath)\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst label = toPosixPath(relativePath);\n\tif (label === \"README.md\" || label.startsWith(\"docs/\") || label.startsWith(\"examples/\")) {\n\t\treturn { kind: \"docs\", label };\n\t}\n\treturn undefined;\n}\nfunction getCompactReadClassification(\n\targs: ReadRenderArgs | undefined,\n\tcwd: string,\n): CompactReadClassification | undefined {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tif (!rawPath) return undefined;\n\n\tconst absolutePath = resolveToCwd(rawPath, cwd);\n\tconst fileName = basename(absolutePath);\n\tif (fileName === \"SKILL.md\") {\n\t\treturn { kind: \"skill\", label: basename(dirname(absolutePath)) || fileName };\n\t}\n\n\tconst docsClassification = getPiDocsClassification(absolutePath);\n\tif (docsClassification) return docsClassification;\n\n\tif (COMPACT_RESOURCE_FILE_NAMES.has(fileName)) {\n\t\treturn { kind: \"resource\", label: formatPathRelativeToCwdOrAbsolute(absolutePath, cwd) };\n\t}\n\n\treturn undefined;\n}\nfunction formatCompactReadCall(\n\tclassification: CompactReadClassification,\n\targs: ReadRenderArgs | undefined,\n\ttheme: Theme,\n): string {\n\tconst expandHint = theme.fg(\"dim\", ` (${keyText(\"app.tools.expand\")} to expand)`);\n\tif (classification.kind === \"skill\") {\n\t\treturn (\n\t\t\ttheme.fg(\"customMessageLabel\", `\\x1b[1m[skill]\\x1b[22m `) +\n\t\t\ttheme.fg(\"customMessageText\", classification.label) +\n\t\t\tformatReadLineRange(args, theme) +\n\t\t\texpandHint\n\t\t);\n\t}\n\n\treturn (\n\t\ttheme.fg(\"toolTitle\", theme.bold(`read ${classification.kind}`)) +\n\t\t\" \" +\n\t\ttheme.fg(\"accent\", classification.label) +\n\t\tformatReadLineRange(args, theme) +\n\t\texpandHint\n\t);\n}\nfunction formatReadResult(\n\targs: ReadRenderArgs | undefined,\n\tresult: { content: (TextContent | ImageContent)[]; details?: ReadToolDetails },\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n\t_cwd: string,\n\tisError: boolean,\n): string {\n\tif (!options.expanded && !isError) {\n\t\treturn \"\";\n\t}\n\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst output = getTextOutput(result, showImages);\n\tconst lang = !isError && rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tconst renderedLines = lang ? highlightCode(replaceTabs(output), lang) : output.split(\"\\n\");\n\tconst lines = trimTrailingEmptyLines(renderedLines);\n\tconst maxLines = options.expanded ? lines.length : 10;\n\tconst displayLines = lines.slice(0, maxLines);\n\tconst remaining = lines.length - maxLines;\n\tlet text = `\\n${displayLines.map((line) => (lang ? replaceTabs(line) : theme.fg(\"toolOutput\", replaceTabs(line)))).join(\"\\n\")}`;\n\tif (remaining > 0) {\n\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t}\n\n\tconst truncation = result.details?.truncation;\n\tif (truncation?.truncated) {\n\t\tif (truncation.firstLineExceedsLimit) {\n\t\t\ttext += `\\n${theme.fg(\"warning\", `[First line exceeds ${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit]`)}`;\n\t\t} else if (truncation.truncatedBy === \"lines\") {\n\t\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines (${truncation.maxLines ?? DEFAULT_MAX_LINES} line limit)]`)}`;\n\t\t} else {\n\t\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)]`)}`;\n\t\t}\n\t}\n\treturn text;\n}\n\nexport const readRenderers: Pick<ToolDefinition<any, ReadToolDetails | undefined>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(rawArgs, theme, context) {\n\t\tconst args = rawArgs as ReadRenderArgs | undefined;\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\tconst classification = !context.expanded ? getCompactReadClassification(args, context.cwd) : undefined;\n\t\ttext.setText(\n\t\t\tclassification ? formatCompactReadCall(classification, args, theme) : formatReadCall(args, theme, context.cwd),\n\t\t);\n\t\treturn text;\n\t},\n\trenderResult(result, options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(\n\t\t\tformatReadResult(\n\t\t\t\tcontext.args as ReadRenderArgs | undefined,\n\t\t\t\tresult,\n\t\t\t\toptions,\n\t\t\t\ttheme,\n\t\t\t\tcontext.showImages,\n\t\t\t\tcontext.cwd,\n\t\t\t\tcontext.isError,\n\t\t\t),\n\t\t);\n\t\treturn text;\n\t},\n};\n"]}
@@ -1,129 +0,0 @@
1
- /**
2
- * Presentation for the read tool.
3
- *
4
- * Renderers live apart from the implementation so a process that only displays tool output does not
5
- * load the execution path or its typebox parameter schema. `read.ts` spreads these into its
6
- * definition, so the tool's public shape is unchanged.
7
- */
8
- import { basename, dirname, isAbsolute, relative, resolve as resolvePath, sep } from "node:path";
9
- import { Text } from "@punch-bot/tui";
10
- import { getReadmePath } from "../../../config.js";
11
- import { keyHint, keyText } from "../../../modes/interactive/components/keybinding-hints.js";
12
- import { getLanguageFromPath, highlightCode } from "../../../modes/interactive/theme/theme.js";
13
- import { formatPathRelativeToCwdOrAbsolute } from "../../../utils/paths.js";
14
- import { resolveToCwd } from "../path-utils.js";
15
- import { getTextOutput, renderToolPath, replaceTabs, str } from "../render-utils.js";
16
- import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize } from "../truncate.js";
17
- const COMPACT_RESOURCE_FILE_NAMES = new Set(["AGENTS.override.md", "AGENTS.md", "AGENTS.MD", "CLAUDE.md", "CLAUDE.MD"]);
18
- function formatReadLineRange(args, theme) {
19
- if (args?.offset === undefined && args?.limit === undefined)
20
- return "";
21
- const startLine = args.offset ?? 1;
22
- const endLine = args.limit !== undefined ? startLine + args.limit - 1 : "";
23
- return theme.fg("warning", `:${startLine}${endLine ? `-${endLine}` : ""}`);
24
- }
25
- function formatReadCall(args, theme, cwd) {
26
- const pathDisplay = renderToolPath(str(args?.file_path ?? args?.path), theme, cwd);
27
- return `${theme.fg("toolTitle", theme.bold("read"))} ${pathDisplay}${formatReadLineRange(args, theme)}`;
28
- }
29
- function trimTrailingEmptyLines(lines) {
30
- let end = lines.length;
31
- while (end > 0 && lines[end - 1] === "") {
32
- end--;
33
- }
34
- return lines.slice(0, end);
35
- }
36
- function toPosixPath(filePath) {
37
- return filePath.split(sep).join("/");
38
- }
39
- function getPiDocsClassification(absolutePath) {
40
- const packageRoot = dirname(getReadmePath());
41
- const relativePath = relative(resolvePath(packageRoot), resolvePath(absolutePath));
42
- if (relativePath === "" ||
43
- relativePath === ".." ||
44
- relativePath.startsWith(`..${sep}`) ||
45
- isAbsolute(relativePath)) {
46
- return undefined;
47
- }
48
- const label = toPosixPath(relativePath);
49
- if (label === "README.md" || label.startsWith("docs/") || label.startsWith("examples/")) {
50
- return { kind: "docs", label };
51
- }
52
- return undefined;
53
- }
54
- function getCompactReadClassification(args, cwd) {
55
- const rawPath = str(args?.file_path ?? args?.path);
56
- if (!rawPath)
57
- return undefined;
58
- const absolutePath = resolveToCwd(rawPath, cwd);
59
- const fileName = basename(absolutePath);
60
- if (fileName === "SKILL.md") {
61
- return { kind: "skill", label: basename(dirname(absolutePath)) || fileName };
62
- }
63
- const docsClassification = getPiDocsClassification(absolutePath);
64
- if (docsClassification)
65
- return docsClassification;
66
- if (COMPACT_RESOURCE_FILE_NAMES.has(fileName)) {
67
- return { kind: "resource", label: formatPathRelativeToCwdOrAbsolute(absolutePath, cwd) };
68
- }
69
- return undefined;
70
- }
71
- function formatCompactReadCall(classification, args, theme) {
72
- const expandHint = theme.fg("dim", ` (${keyText("app.tools.expand")} to expand)`);
73
- if (classification.kind === "skill") {
74
- return (theme.fg("customMessageLabel", `\x1b[1m[skill]\x1b[22m `) +
75
- theme.fg("customMessageText", classification.label) +
76
- formatReadLineRange(args, theme) +
77
- expandHint);
78
- }
79
- return (theme.fg("toolTitle", theme.bold(`read ${classification.kind}`)) +
80
- " " +
81
- theme.fg("accent", classification.label) +
82
- formatReadLineRange(args, theme) +
83
- expandHint);
84
- }
85
- function formatReadResult(args, result, options, theme, showImages, _cwd, isError) {
86
- if (!options.expanded && !isError) {
87
- return "";
88
- }
89
- const rawPath = str(args?.file_path ?? args?.path);
90
- const output = getTextOutput(result, showImages);
91
- const lang = !isError && rawPath ? getLanguageFromPath(rawPath) : undefined;
92
- const renderedLines = lang ? highlightCode(replaceTabs(output), lang) : output.split("\n");
93
- const lines = trimTrailingEmptyLines(renderedLines);
94
- const maxLines = options.expanded ? lines.length : 10;
95
- const displayLines = lines.slice(0, maxLines);
96
- const remaining = lines.length - maxLines;
97
- let text = `\n${displayLines.map((line) => (lang ? replaceTabs(line) : theme.fg("toolOutput", replaceTabs(line)))).join("\n")}`;
98
- if (remaining > 0) {
99
- text += `${theme.fg("muted", `\n... (${remaining} more lines,`)} ${keyHint("app.tools.expand", "to expand")}${theme.fg("muted", ")")}`;
100
- }
101
- const truncation = result.details?.truncation;
102
- if (truncation?.truncated) {
103
- if (truncation.firstLineExceedsLimit) {
104
- text += `\n${theme.fg("warning", `[First line exceeds ${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit]`)}`;
105
- }
106
- else if (truncation.truncatedBy === "lines") {
107
- text += `\n${theme.fg("warning", `[Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines (${truncation.maxLines ?? DEFAULT_MAX_LINES} line limit)]`)}`;
108
- }
109
- else {
110
- text += `\n${theme.fg("warning", `[Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)]`)}`;
111
- }
112
- }
113
- return text;
114
- }
115
- export const readRenderers = {
116
- renderCall(rawArgs, theme, context) {
117
- const args = rawArgs;
118
- const text = context.lastComponent ?? new Text("", 0, 0);
119
- const classification = !context.expanded ? getCompactReadClassification(args, context.cwd) : undefined;
120
- text.setText(classification ? formatCompactReadCall(classification, args, theme) : formatReadCall(args, theme, context.cwd));
121
- return text;
122
- },
123
- renderResult(result, options, theme, context) {
124
- const text = context.lastComponent ?? new Text("", 0, 0);
125
- text.setText(formatReadResult(context.args, result, options, theme, context.showImages, context.cwd, context.isError));
126
- return text;
127
- },
128
- };
129
- //# sourceMappingURL=read.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../src/core/tools/renderers/read.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,IAAI,WAAW,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEjG,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,2DAA2D,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAc,MAAM,2CAA2C,CAAC;AAC3G,OAAO,EAAE,iCAAiC,EAAE,MAAM,yBAAyB,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMlF,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAC,CAAC,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AAExH,SAAS,mBAAmB,CAAC,IAAgC,EAAE,KAAY,EAAU;IACpF,IAAI,IAAI,EAAE,MAAM,KAAK,SAAS,IAAI,IAAI,EAAE,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACvE,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,KAA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C;IAAA,CACZ;IACD,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QAC7C,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,CACX,gBAAgB,CACf,OAAO,CAAC,IAAkC,EAC1C,MAAM,EACN,OAAO,EACP,KAAK,EACL,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,GAAG,EACX,OAAO,CAAC,OAAO,CACf,CACD,CAAC;QACF,OAAO,IAAI,CAAC;IAAA,CACZ;CACD,CAAC","sourcesContent":["/**\n * Presentation for the read tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `read.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { basename, dirname, isAbsolute, relative, resolve as resolvePath, sep } from \"node:path\";\nimport type { ImageContent, TextContent } from \"@punch-bot/ai\";\nimport { Text } from \"@punch-bot/tui\";\nimport { getReadmePath } from \"../../../config.ts\";\nimport { keyHint, keyText } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport { getLanguageFromPath, highlightCode, type Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport { formatPathRelativeToCwdOrAbsolute } from \"../../../utils/paths.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport { resolveToCwd } from \"../path-utils.ts\";\nimport type { ReadToolDetails } from \"../read.ts\";\nimport { getTextOutput, renderToolPath, replaceTabs, str } from \"../render-utils.ts\";\nimport { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize } from \"../truncate.ts\";\n\ninterface CompactReadClassification {\n\tkind: \"docs\" | \"resource\" | \"skill\";\n\tlabel: string;\n}\nconst COMPACT_RESOURCE_FILE_NAMES = new Set([\"AGENTS.override.md\", \"AGENTS.md\", \"AGENTS.MD\", \"CLAUDE.md\", \"CLAUDE.MD\"]);\ntype ReadRenderArgs = { path?: string; file_path?: string; offset?: number; limit?: number };\nfunction formatReadLineRange(args: ReadRenderArgs | undefined, theme: Theme): string {\n\tif (args?.offset === undefined && args?.limit === undefined) return \"\";\n\tconst startLine = args.offset ?? 1;\n\tconst endLine = args.limit !== undefined ? startLine + args.limit - 1 : \"\";\n\treturn theme.fg(\"warning\", `:${startLine}${endLine ? `-${endLine}` : \"\"}`);\n}\nfunction formatReadCall(args: ReadRenderArgs | undefined, theme: Theme, cwd: string): string {\n\tconst pathDisplay = renderToolPath(str(args?.file_path ?? args?.path), theme, cwd);\n\treturn `${theme.fg(\"toolTitle\", theme.bold(\"read\"))} ${pathDisplay}${formatReadLineRange(args, theme)}`;\n}\nfunction trimTrailingEmptyLines(lines: string[]): string[] {\n\tlet end = lines.length;\n\twhile (end > 0 && lines[end - 1] === \"\") {\n\t\tend--;\n\t}\n\treturn lines.slice(0, end);\n}\nfunction toPosixPath(filePath: string): string {\n\treturn filePath.split(sep).join(\"/\");\n}\nfunction getPiDocsClassification(absolutePath: string): CompactReadClassification | undefined {\n\tconst packageRoot = dirname(getReadmePath());\n\tconst relativePath = relative(resolvePath(packageRoot), resolvePath(absolutePath));\n\tif (\n\t\trelativePath === \"\" ||\n\t\trelativePath === \"..\" ||\n\t\trelativePath.startsWith(`..${sep}`) ||\n\t\tisAbsolute(relativePath)\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst label = toPosixPath(relativePath);\n\tif (label === \"README.md\" || label.startsWith(\"docs/\") || label.startsWith(\"examples/\")) {\n\t\treturn { kind: \"docs\", label };\n\t}\n\treturn undefined;\n}\nfunction getCompactReadClassification(\n\targs: ReadRenderArgs | undefined,\n\tcwd: string,\n): CompactReadClassification | undefined {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tif (!rawPath) return undefined;\n\n\tconst absolutePath = resolveToCwd(rawPath, cwd);\n\tconst fileName = basename(absolutePath);\n\tif (fileName === \"SKILL.md\") {\n\t\treturn { kind: \"skill\", label: basename(dirname(absolutePath)) || fileName };\n\t}\n\n\tconst docsClassification = getPiDocsClassification(absolutePath);\n\tif (docsClassification) return docsClassification;\n\n\tif (COMPACT_RESOURCE_FILE_NAMES.has(fileName)) {\n\t\treturn { kind: \"resource\", label: formatPathRelativeToCwdOrAbsolute(absolutePath, cwd) };\n\t}\n\n\treturn undefined;\n}\nfunction formatCompactReadCall(\n\tclassification: CompactReadClassification,\n\targs: ReadRenderArgs | undefined,\n\ttheme: Theme,\n): string {\n\tconst expandHint = theme.fg(\"dim\", ` (${keyText(\"app.tools.expand\")} to expand)`);\n\tif (classification.kind === \"skill\") {\n\t\treturn (\n\t\t\ttheme.fg(\"customMessageLabel\", `\\x1b[1m[skill]\\x1b[22m `) +\n\t\t\ttheme.fg(\"customMessageText\", classification.label) +\n\t\t\tformatReadLineRange(args, theme) +\n\t\t\texpandHint\n\t\t);\n\t}\n\n\treturn (\n\t\ttheme.fg(\"toolTitle\", theme.bold(`read ${classification.kind}`)) +\n\t\t\" \" +\n\t\ttheme.fg(\"accent\", classification.label) +\n\t\tformatReadLineRange(args, theme) +\n\t\texpandHint\n\t);\n}\nfunction formatReadResult(\n\targs: ReadRenderArgs | undefined,\n\tresult: { content: (TextContent | ImageContent)[]; details?: ReadToolDetails },\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n\t_cwd: string,\n\tisError: boolean,\n): string {\n\tif (!options.expanded && !isError) {\n\t\treturn \"\";\n\t}\n\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst output = getTextOutput(result, showImages);\n\tconst lang = !isError && rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tconst renderedLines = lang ? highlightCode(replaceTabs(output), lang) : output.split(\"\\n\");\n\tconst lines = trimTrailingEmptyLines(renderedLines);\n\tconst maxLines = options.expanded ? lines.length : 10;\n\tconst displayLines = lines.slice(0, maxLines);\n\tconst remaining = lines.length - maxLines;\n\tlet text = `\\n${displayLines.map((line) => (lang ? replaceTabs(line) : theme.fg(\"toolOutput\", replaceTabs(line)))).join(\"\\n\")}`;\n\tif (remaining > 0) {\n\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t}\n\n\tconst truncation = result.details?.truncation;\n\tif (truncation?.truncated) {\n\t\tif (truncation.firstLineExceedsLimit) {\n\t\t\ttext += `\\n${theme.fg(\"warning\", `[First line exceeds ${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit]`)}`;\n\t\t} else if (truncation.truncatedBy === \"lines\") {\n\t\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines (${truncation.maxLines ?? DEFAULT_MAX_LINES} line limit)]`)}`;\n\t\t} else {\n\t\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)]`)}`;\n\t\t}\n\t}\n\treturn text;\n}\n\nexport const readRenderers: Pick<ToolDefinition<any, ReadToolDetails | undefined>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(rawArgs, theme, context) {\n\t\tconst args = rawArgs as ReadRenderArgs | undefined;\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\tconst classification = !context.expanded ? getCompactReadClassification(args, context.cwd) : undefined;\n\t\ttext.setText(\n\t\t\tclassification ? formatCompactReadCall(classification, args, theme) : formatReadCall(args, theme, context.cwd),\n\t\t);\n\t\treturn text;\n\t},\n\trenderResult(result, options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(\n\t\t\tformatReadResult(\n\t\t\t\tcontext.args as ReadRenderArgs | undefined,\n\t\t\t\tresult,\n\t\t\t\toptions,\n\t\t\t\ttheme,\n\t\t\t\tcontext.showImages,\n\t\t\t\tcontext.cwd,\n\t\t\t\tcontext.isError,\n\t\t\t),\n\t\t);\n\t\treturn text;\n\t},\n};\n"]}
@@ -1,10 +0,0 @@
1
- /**
2
- * Presentation for the write tool.
3
- *
4
- * Renderers live apart from the implementation so a process that only displays tool output does not
5
- * load the execution path or its typebox parameter schema. `write.ts` spreads these into its
6
- * definition, so the tool's public shape is unchanged.
7
- */
8
- import type { ToolDefinition } from "../../extensions/types.ts";
9
- export declare const writeRenderers: Pick<ToolDefinition<any, any>, "renderCall" | "renderResult">;
10
- //# sourceMappingURL=write.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/renderers/write.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,2BAA2B,CAAC;AAqIzF,eAAO,MAAM,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,cAAc,CAoCxF,CAAC","sourcesContent":["/**\n * Presentation for the write tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `write.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { Container, Text } from \"@punch-bot/tui\";\nimport { keyHint } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport { getLanguageFromPath, highlightCode, type Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport { normalizeDisplayText, renderToolPath, replaceTabs, str } from \"../render-utils.ts\";\n\ntype WriteHighlightCache = {\n\trawPath: string | null;\n\tlang: string;\n\trawContent: string;\n\tnormalizedLines: string[];\n\thighlightedLines: string[];\n};\nclass WriteCallRenderComponent extends Text {\n\tcache?: WriteHighlightCache;\n\n\tconstructor() {\n\t\tsuper(\"\", 0, 0);\n\t}\n}\nconst WRITE_PARTIAL_FULL_HIGHLIGHT_LINES = 50;\nfunction highlightSingleLine(line: string, lang: string): string {\n\tconst highlighted = highlightCode(line, lang);\n\treturn highlighted[0] ?? \"\";\n}\nfunction refreshWriteHighlightPrefix(cache: WriteHighlightCache): void {\n\tconst prefixCount = Math.min(WRITE_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);\n\tif (prefixCount === 0) return;\n\tconst prefixSource = cache.normalizedLines.slice(0, prefixCount).join(\"\\n\");\n\tconst prefixHighlighted = highlightCode(prefixSource, cache.lang);\n\tfor (let i = 0; i < prefixCount; i++) {\n\t\tcache.highlightedLines[i] =\n\t\t\tprefixHighlighted[i] ?? highlightSingleLine(cache.normalizedLines[i] ?? \"\", cache.lang);\n\t}\n}\nfunction rebuildWriteHighlightCacheFull(rawPath: string | null, fileContent: string): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tconst displayContent = normalizeDisplayText(fileContent);\n\tconst normalized = replaceTabs(displayContent);\n\treturn {\n\t\trawPath,\n\t\tlang,\n\t\trawContent: fileContent,\n\t\tnormalizedLines: normalized.split(\"\\n\"),\n\t\thighlightedLines: highlightCode(normalized, lang),\n\t};\n}\nfunction updateWriteHighlightCacheIncremental(\n\tcache: WriteHighlightCache | undefined,\n\trawPath: string | null,\n\tfileContent: string,\n): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tif (!cache) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (cache.lang !== lang || cache.rawPath !== rawPath) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (!fileContent.startsWith(cache.rawContent)) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (fileContent.length === cache.rawContent.length) return cache;\n\n\tconst deltaRaw = fileContent.slice(cache.rawContent.length);\n\tconst deltaDisplay = normalizeDisplayText(deltaRaw);\n\tconst deltaNormalized = replaceTabs(deltaDisplay);\n\tcache.rawContent = fileContent;\n\tif (cache.normalizedLines.length === 0) {\n\t\tcache.normalizedLines.push(\"\");\n\t\tcache.highlightedLines.push(\"\");\n\t}\n\n\tconst segments = deltaNormalized.split(\"\\n\");\n\tconst lastIndex = cache.normalizedLines.length - 1;\n\tcache.normalizedLines[lastIndex] += segments[0];\n\tcache.highlightedLines[lastIndex] = highlightSingleLine(cache.normalizedLines[lastIndex], cache.lang);\n\tfor (let i = 1; i < segments.length; i++) {\n\t\tcache.normalizedLines.push(segments[i]);\n\t\tcache.highlightedLines.push(highlightSingleLine(segments[i], cache.lang));\n\t}\n\trefreshWriteHighlightPrefix(cache);\n\treturn cache;\n}\nfunction trimTrailingEmptyLines(lines: string[]): string[] {\n\tlet end = lines.length;\n\twhile (end > 0 && lines[end - 1] === \"\") {\n\t\tend--;\n\t}\n\treturn lines.slice(0, end);\n}\nfunction formatWriteCall(\n\targs: { path?: string; file_path?: string; content?: string } | undefined,\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tcache: WriteHighlightCache | undefined,\n\tcwd: string,\n): string {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst fileContent = str(args?.content);\n\tconst pathDisplay = renderToolPath(rawPath, theme, cwd);\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"write\"))} ${pathDisplay}`;\n\n\tif (fileContent === null) {\n\t\ttext += `\\n\\n${theme.fg(\"error\", \"[invalid content arg - expected string]\")}`;\n\t} else if (fileContent) {\n\t\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\t\tconst renderedLines = lang\n\t\t\t? (cache?.highlightedLines ?? highlightCode(replaceTabs(normalizeDisplayText(fileContent)), lang))\n\t\t\t: normalizeDisplayText(fileContent).split(\"\\n\");\n\t\tconst lines = trimTrailingEmptyLines(renderedLines);\n\t\tconst totalLines = lines.length;\n\t\tconst maxLines = options.expanded ? lines.length : 10;\n\t\tconst displayLines = lines.slice(0, maxLines);\n\t\tconst remaining = lines.length - maxLines;\n\t\ttext += `\\n\\n${displayLines.map((line) => (lang ? line : theme.fg(\"toolOutput\", replaceTabs(line)))).join(\"\\n\")}`;\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines, ${totalLines} total,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t}\n\n\treturn text;\n}\nfunction formatWriteResult(\n\tresult: { content: Array<{ type: string; text?: string; data?: string; mimeType?: string }>; isError?: boolean },\n\ttheme: Theme,\n): string | undefined {\n\tif (!result.isError) {\n\t\treturn undefined;\n\t}\n\tconst output = result.content\n\t\t.filter((c) => c.type === \"text\")\n\t\t.map((c) => c.text || \"\")\n\t\t.join(\"\\n\");\n\tif (!output) {\n\t\treturn undefined;\n\t}\n\treturn `\\n${theme.fg(\"error\", output)}`;\n}\n\nexport const writeRenderers: Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst renderArgs = args as { path?: string; file_path?: string; content?: string } | undefined;\n\t\tconst rawPath = str(renderArgs?.file_path ?? renderArgs?.path);\n\t\tconst fileContent = str(renderArgs?.content);\n\t\tconst component =\n\t\t\t(context.lastComponent as WriteCallRenderComponent | undefined) ?? new WriteCallRenderComponent();\n\t\tif (fileContent !== null) {\n\t\t\tcomponent.cache = context.argsComplete\n\t\t\t\t? rebuildWriteHighlightCacheFull(rawPath, fileContent)\n\t\t\t\t: updateWriteHighlightCacheIncremental(component.cache, rawPath, fileContent);\n\t\t} else {\n\t\t\tcomponent.cache = undefined;\n\t\t}\n\t\tcomponent.setText(\n\t\t\tformatWriteCall(\n\t\t\t\trenderArgs,\n\t\t\t\t{ expanded: context.expanded, isPartial: context.isPartial },\n\t\t\t\ttheme,\n\t\t\t\tcomponent.cache,\n\t\t\t\tcontext.cwd,\n\t\t\t),\n\t\t);\n\t\treturn component;\n\t},\n\trenderResult(result, _options, theme, context) {\n\t\tconst output = formatWriteResult({ ...result, isError: context.isError }, theme);\n\t\tif (!output) {\n\t\t\tconst component = (context.lastComponent as Container | undefined) ?? new Container();\n\t\t\tcomponent.clear();\n\t\t\treturn component;\n\t\t}\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(output);\n\t\treturn text;\n\t},\n};\n"]}
@@ -1,153 +0,0 @@
1
- /**
2
- * Presentation for the write tool.
3
- *
4
- * Renderers live apart from the implementation so a process that only displays tool output does not
5
- * load the execution path or its typebox parameter schema. `write.ts` spreads these into its
6
- * definition, so the tool's public shape is unchanged.
7
- */
8
- import { Container, Text } from "@punch-bot/tui";
9
- import { keyHint } from "../../../modes/interactive/components/keybinding-hints.js";
10
- import { getLanguageFromPath, highlightCode } from "../../../modes/interactive/theme/theme.js";
11
- import { normalizeDisplayText, renderToolPath, replaceTabs, str } from "../render-utils.js";
12
- class WriteCallRenderComponent extends Text {
13
- cache;
14
- constructor() {
15
- super("", 0, 0);
16
- }
17
- }
18
- const WRITE_PARTIAL_FULL_HIGHLIGHT_LINES = 50;
19
- function highlightSingleLine(line, lang) {
20
- const highlighted = highlightCode(line, lang);
21
- return highlighted[0] ?? "";
22
- }
23
- function refreshWriteHighlightPrefix(cache) {
24
- const prefixCount = Math.min(WRITE_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);
25
- if (prefixCount === 0)
26
- return;
27
- const prefixSource = cache.normalizedLines.slice(0, prefixCount).join("\n");
28
- const prefixHighlighted = highlightCode(prefixSource, cache.lang);
29
- for (let i = 0; i < prefixCount; i++) {
30
- cache.highlightedLines[i] =
31
- prefixHighlighted[i] ?? highlightSingleLine(cache.normalizedLines[i] ?? "", cache.lang);
32
- }
33
- }
34
- function rebuildWriteHighlightCacheFull(rawPath, fileContent) {
35
- const lang = rawPath ? getLanguageFromPath(rawPath) : undefined;
36
- if (!lang)
37
- return undefined;
38
- const displayContent = normalizeDisplayText(fileContent);
39
- const normalized = replaceTabs(displayContent);
40
- return {
41
- rawPath,
42
- lang,
43
- rawContent: fileContent,
44
- normalizedLines: normalized.split("\n"),
45
- highlightedLines: highlightCode(normalized, lang),
46
- };
47
- }
48
- function updateWriteHighlightCacheIncremental(cache, rawPath, fileContent) {
49
- const lang = rawPath ? getLanguageFromPath(rawPath) : undefined;
50
- if (!lang)
51
- return undefined;
52
- if (!cache)
53
- return rebuildWriteHighlightCacheFull(rawPath, fileContent);
54
- if (cache.lang !== lang || cache.rawPath !== rawPath)
55
- return rebuildWriteHighlightCacheFull(rawPath, fileContent);
56
- if (!fileContent.startsWith(cache.rawContent))
57
- return rebuildWriteHighlightCacheFull(rawPath, fileContent);
58
- if (fileContent.length === cache.rawContent.length)
59
- return cache;
60
- const deltaRaw = fileContent.slice(cache.rawContent.length);
61
- const deltaDisplay = normalizeDisplayText(deltaRaw);
62
- const deltaNormalized = replaceTabs(deltaDisplay);
63
- cache.rawContent = fileContent;
64
- if (cache.normalizedLines.length === 0) {
65
- cache.normalizedLines.push("");
66
- cache.highlightedLines.push("");
67
- }
68
- const segments = deltaNormalized.split("\n");
69
- const lastIndex = cache.normalizedLines.length - 1;
70
- cache.normalizedLines[lastIndex] += segments[0];
71
- cache.highlightedLines[lastIndex] = highlightSingleLine(cache.normalizedLines[lastIndex], cache.lang);
72
- for (let i = 1; i < segments.length; i++) {
73
- cache.normalizedLines.push(segments[i]);
74
- cache.highlightedLines.push(highlightSingleLine(segments[i], cache.lang));
75
- }
76
- refreshWriteHighlightPrefix(cache);
77
- return cache;
78
- }
79
- function trimTrailingEmptyLines(lines) {
80
- let end = lines.length;
81
- while (end > 0 && lines[end - 1] === "") {
82
- end--;
83
- }
84
- return lines.slice(0, end);
85
- }
86
- function formatWriteCall(args, options, theme, cache, cwd) {
87
- const rawPath = str(args?.file_path ?? args?.path);
88
- const fileContent = str(args?.content);
89
- const pathDisplay = renderToolPath(rawPath, theme, cwd);
90
- let text = `${theme.fg("toolTitle", theme.bold("write"))} ${pathDisplay}`;
91
- if (fileContent === null) {
92
- text += `\n\n${theme.fg("error", "[invalid content arg - expected string]")}`;
93
- }
94
- else if (fileContent) {
95
- const lang = rawPath ? getLanguageFromPath(rawPath) : undefined;
96
- const renderedLines = lang
97
- ? (cache?.highlightedLines ?? highlightCode(replaceTabs(normalizeDisplayText(fileContent)), lang))
98
- : normalizeDisplayText(fileContent).split("\n");
99
- const lines = trimTrailingEmptyLines(renderedLines);
100
- const totalLines = lines.length;
101
- const maxLines = options.expanded ? lines.length : 10;
102
- const displayLines = lines.slice(0, maxLines);
103
- const remaining = lines.length - maxLines;
104
- text += `\n\n${displayLines.map((line) => (lang ? line : theme.fg("toolOutput", replaceTabs(line)))).join("\n")}`;
105
- if (remaining > 0) {
106
- text += `${theme.fg("muted", `\n... (${remaining} more lines, ${totalLines} total,`)} ${keyHint("app.tools.expand", "to expand")}${theme.fg("muted", ")")}`;
107
- }
108
- }
109
- return text;
110
- }
111
- function formatWriteResult(result, theme) {
112
- if (!result.isError) {
113
- return undefined;
114
- }
115
- const output = result.content
116
- .filter((c) => c.type === "text")
117
- .map((c) => c.text || "")
118
- .join("\n");
119
- if (!output) {
120
- return undefined;
121
- }
122
- return `\n${theme.fg("error", output)}`;
123
- }
124
- export const writeRenderers = {
125
- renderCall(args, theme, context) {
126
- const renderArgs = args;
127
- const rawPath = str(renderArgs?.file_path ?? renderArgs?.path);
128
- const fileContent = str(renderArgs?.content);
129
- const component = context.lastComponent ?? new WriteCallRenderComponent();
130
- if (fileContent !== null) {
131
- component.cache = context.argsComplete
132
- ? rebuildWriteHighlightCacheFull(rawPath, fileContent)
133
- : updateWriteHighlightCacheIncremental(component.cache, rawPath, fileContent);
134
- }
135
- else {
136
- component.cache = undefined;
137
- }
138
- component.setText(formatWriteCall(renderArgs, { expanded: context.expanded, isPartial: context.isPartial }, theme, component.cache, context.cwd));
139
- return component;
140
- },
141
- renderResult(result, _options, theme, context) {
142
- const output = formatWriteResult({ ...result, isError: context.isError }, theme);
143
- if (!output) {
144
- const component = context.lastComponent ?? new Container();
145
- component.clear();
146
- return component;
147
- }
148
- const text = context.lastComponent ?? new Text("", 0, 0);
149
- text.setText(output);
150
- return text;
151
- },
152
- };
153
- //# sourceMappingURL=write.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"write.js","sourceRoot":"","sources":["../../../../src/core/tools/renderers/write.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,2DAA2D,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAc,MAAM,2CAA2C,CAAC;AAE3G,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAS5F,MAAM,wBAAyB,SAAQ,IAAI;IAC1C,KAAK,CAAuB;IAE5B,cAAc;QACb,KAAK,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAAA,CAChB;CACD;AACD,MAAM,kCAAkC,GAAG,EAAE,CAAC;AAC9C,SAAS,mBAAmB,CAAC,IAAY,EAAE,IAAY,EAAU;IAChE,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9C,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAAA,CAC5B;AACD,SAAS,2BAA2B,CAAC,KAA0B,EAAQ;IACtE,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,kCAAkC,EAAE,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/F,IAAI,WAAW,KAAK,CAAC;QAAE,OAAO;IAC9B,MAAM,YAAY,GAAG,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5E,MAAM,iBAAiB,G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ACd,UAAU,EACV,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,EAC5D,KAAK,EACL,SAAS,CAAC,KAAK,EACf,OAAO,CAAC,GAAG,CACX,CACD,CAAC;QACF,OAAO,SAAS,CAAC;IAAA,CACjB;IACD,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;QAC9C,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;QACjF,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,SAAS,GAAI,OAAO,CAAC,aAAuC,IAAI,IAAI,SAAS,EAAE,CAAC;YACtF,SAAS,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IAAA,CACZ;CACD,CAAC","sourcesContent":["/**\n * Presentation for the write tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `write.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { Container, Text } from \"@punch-bot/tui\";\nimport { keyHint } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport { getLanguageFromPath, highlightCode, type Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport { normalizeDisplayText, renderToolPath, replaceTabs, str } from \"../render-utils.ts\";\n\ntype WriteHighlightCache = {\n\trawPath: string | null;\n\tlang: string;\n\trawContent: string;\n\tnormalizedLines: string[];\n\thighlightedLines: string[];\n};\nclass WriteCallRenderComponent extends Text {\n\tcache?: WriteHighlightCache;\n\n\tconstructor() {\n\t\tsuper(\"\", 0, 0);\n\t}\n}\nconst WRITE_PARTIAL_FULL_HIGHLIGHT_LINES = 50;\nfunction highlightSingleLine(line: string, lang: string): string {\n\tconst highlighted = highlightCode(line, lang);\n\treturn highlighted[0] ?? \"\";\n}\nfunction refreshWriteHighlightPrefix(cache: WriteHighlightCache): void {\n\tconst prefixCount = Math.min(WRITE_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);\n\tif (prefixCount === 0) return;\n\tconst prefixSource = cache.normalizedLines.slice(0, prefixCount).join(\"\\n\");\n\tconst prefixHighlighted = highlightCode(prefixSource, cache.lang);\n\tfor (let i = 0; i < prefixCount; i++) {\n\t\tcache.highlightedLines[i] =\n\t\t\tprefixHighlighted[i] ?? highlightSingleLine(cache.normalizedLines[i] ?? \"\", cache.lang);\n\t}\n}\nfunction rebuildWriteHighlightCacheFull(rawPath: string | null, fileContent: string): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tconst displayContent = normalizeDisplayText(fileContent);\n\tconst normalized = replaceTabs(displayContent);\n\treturn {\n\t\trawPath,\n\t\tlang,\n\t\trawContent: fileContent,\n\t\tnormalizedLines: normalized.split(\"\\n\"),\n\t\thighlightedLines: highlightCode(normalized, lang),\n\t};\n}\nfunction updateWriteHighlightCacheIncremental(\n\tcache: WriteHighlightCache | undefined,\n\trawPath: string | null,\n\tfileContent: string,\n): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tif (!cache) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (cache.lang !== lang || cache.rawPath !== rawPath) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (!fileContent.startsWith(cache.rawContent)) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (fileContent.length === cache.rawContent.length) return cache;\n\n\tconst deltaRaw = fileContent.slice(cache.rawContent.length);\n\tconst deltaDisplay = normalizeDisplayText(deltaRaw);\n\tconst deltaNormalized = replaceTabs(deltaDisplay);\n\tcache.rawContent = fileContent;\n\tif (cache.normalizedLines.length === 0) {\n\t\tcache.normalizedLines.push(\"\");\n\t\tcache.highlightedLines.push(\"\");\n\t}\n\n\tconst segments = deltaNormalized.split(\"\\n\");\n\tconst lastIndex = cache.normalizedLines.length - 1;\n\tcache.normalizedLines[lastIndex] += segments[0];\n\tcache.highlightedLines[lastIndex] = highlightSingleLine(cache.normalizedLines[lastIndex], cache.lang);\n\tfor (let i = 1; i < segments.length; i++) {\n\t\tcache.normalizedLines.push(segments[i]);\n\t\tcache.highlightedLines.push(highlightSingleLine(segments[i], cache.lang));\n\t}\n\trefreshWriteHighlightPrefix(cache);\n\treturn cache;\n}\nfunction trimTrailingEmptyLines(lines: string[]): string[] {\n\tlet end = lines.length;\n\twhile (end > 0 && lines[end - 1] === \"\") {\n\t\tend--;\n\t}\n\treturn lines.slice(0, end);\n}\nfunction formatWriteCall(\n\targs: { path?: string; file_path?: string; content?: string } | undefined,\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tcache: WriteHighlightCache | undefined,\n\tcwd: string,\n): string {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst fileContent = str(args?.content);\n\tconst pathDisplay = renderToolPath(rawPath, theme, cwd);\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"write\"))} ${pathDisplay}`;\n\n\tif (fileContent === null) {\n\t\ttext += `\\n\\n${theme.fg(\"error\", \"[invalid content arg - expected string]\")}`;\n\t} else if (fileContent) {\n\t\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\t\tconst renderedLines = lang\n\t\t\t? (cache?.highlightedLines ?? highlightCode(replaceTabs(normalizeDisplayText(fileContent)), lang))\n\t\t\t: normalizeDisplayText(fileContent).split(\"\\n\");\n\t\tconst lines = trimTrailingEmptyLines(renderedLines);\n\t\tconst totalLines = lines.length;\n\t\tconst maxLines = options.expanded ? lines.length : 10;\n\t\tconst displayLines = lines.slice(0, maxLines);\n\t\tconst remaining = lines.length - maxLines;\n\t\ttext += `\\n\\n${displayLines.map((line) => (lang ? line : theme.fg(\"toolOutput\", replaceTabs(line)))).join(\"\\n\")}`;\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines, ${totalLines} total,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t}\n\n\treturn text;\n}\nfunction formatWriteResult(\n\tresult: { content: Array<{ type: string; text?: string; data?: string; mimeType?: string }>; isError?: boolean },\n\ttheme: Theme,\n): string | undefined {\n\tif (!result.isError) {\n\t\treturn undefined;\n\t}\n\tconst output = result.content\n\t\t.filter((c) => c.type === \"text\")\n\t\t.map((c) => c.text || \"\")\n\t\t.join(\"\\n\");\n\tif (!output) {\n\t\treturn undefined;\n\t}\n\treturn `\\n${theme.fg(\"error\", output)}`;\n}\n\nexport const writeRenderers: Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst renderArgs = args as { path?: string; file_path?: string; content?: string } | undefined;\n\t\tconst rawPath = str(renderArgs?.file_path ?? renderArgs?.path);\n\t\tconst fileContent = str(renderArgs?.content);\n\t\tconst component =\n\t\t\t(context.lastComponent as WriteCallRenderComponent | undefined) ?? new WriteCallRenderComponent();\n\t\tif (fileContent !== null) {\n\t\t\tcomponent.cache = context.argsComplete\n\t\t\t\t? rebuildWriteHighlightCacheFull(rawPath, fileContent)\n\t\t\t\t: updateWriteHighlightCacheIncremental(component.cache, rawPath, fileContent);\n\t\t} else {\n\t\t\tcomponent.cache = undefined;\n\t\t}\n\t\tcomponent.setText(\n\t\t\tformatWriteCall(\n\t\t\t\trenderArgs,\n\t\t\t\t{ expanded: context.expanded, isPartial: context.isPartial },\n\t\t\t\ttheme,\n\t\t\t\tcomponent.cache,\n\t\t\t\tcontext.cwd,\n\t\t\t),\n\t\t);\n\t\treturn component;\n\t},\n\trenderResult(result, _options, theme, context) {\n\t\tconst output = formatWriteResult({ ...result, isError: context.isError }, theme);\n\t\tif (!output) {\n\t\t\tconst component = (context.lastComponent as Container | undefined) ?? new Container();\n\t\t\tcomponent.clear();\n\t\t\treturn component;\n\t\t}\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(output);\n\t\treturn text;\n\t},\n};\n"]}