dal-code 1.0.49 → 1.0.51

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 (593) hide show
  1. package/CHANGELOG.md +1043 -5
  2. package/dist/bundle/chunks/anthropic-messages-2P3UGLIO.js +5 -0
  3. package/dist/bundle/chunks/anthropic.js +74 -0
  4. package/dist/bundle/chunks/azure-openai-responses-S4GNH2XC.js +1 -0
  5. package/dist/bundle/chunks/bedrock-converse-stream.js +88 -0
  6. package/dist/bundle/chunks/chunk-2KOJ4RNS.js +43 -0
  7. package/dist/bundle/chunks/chunk-3YGHTGYM.js +7 -0
  8. package/dist/bundle/chunks/chunk-4LDEEFCY.js +1 -0
  9. package/dist/bundle/chunks/chunk-4UTLMBZZ.js +13 -0
  10. package/dist/bundle/chunks/chunk-567OJLS7.js +1 -0
  11. package/dist/bundle/chunks/chunk-5AGIVGSV.js +5 -0
  12. package/dist/bundle/chunks/chunk-6QGV3IWD.js +5 -0
  13. package/dist/bundle/chunks/chunk-723ZGEZ2.js +1 -0
  14. package/dist/bundle/chunks/chunk-7DDKXS2Q.js +1 -0
  15. package/dist/bundle/chunks/chunk-7ZC4UXSL.js +1 -0
  16. package/dist/bundle/chunks/chunk-AL7NZVPP.js +1 -0
  17. package/dist/bundle/chunks/chunk-ATQJO2OE.js +3 -0
  18. package/dist/bundle/chunks/chunk-B7NRFMLU.js +8 -0
  19. package/dist/bundle/chunks/chunk-BEDAM2M7.js +81 -0
  20. package/dist/bundle/chunks/chunk-CF5GWZHW.js +30 -0
  21. package/dist/bundle/chunks/chunk-CFPQOC7P.js +1 -0
  22. package/dist/bundle/chunks/chunk-D2WTLI2T.js +19 -0
  23. package/dist/bundle/chunks/chunk-EH7SFF47.js +129 -0
  24. package/dist/bundle/chunks/chunk-FCKLBLA4.js +1 -0
  25. package/dist/bundle/chunks/chunk-FFMDRXC4.js +9 -0
  26. package/dist/bundle/chunks/chunk-GSGE3ULF.js +15 -0
  27. package/dist/bundle/chunks/chunk-H5FHS6BV.js +1 -0
  28. package/dist/bundle/chunks/chunk-HXK5EFBE.js +1172 -0
  29. package/dist/bundle/chunks/chunk-IEBK4HQA.js +1 -0
  30. package/dist/bundle/chunks/chunk-JE6UXK35.js +30 -0
  31. package/dist/bundle/chunks/chunk-JXWJOIH4.js +1 -0
  32. package/dist/bundle/chunks/chunk-K7VBBYTT.js +1 -0
  33. package/dist/bundle/chunks/chunk-L2ZPNLYD.js +1 -0
  34. package/dist/bundle/chunks/chunk-LVVZS2NO.js +11 -0
  35. package/dist/bundle/chunks/chunk-ML5DIOWR.js +1 -0
  36. package/dist/bundle/chunks/chunk-NUIR7PPD.js +25 -0
  37. package/dist/bundle/chunks/chunk-P7FPUEYA.js +1 -0
  38. package/dist/bundle/chunks/chunk-PGXDEOVV.js +1 -0
  39. package/dist/bundle/chunks/chunk-PJACZCIR.js +1 -0
  40. package/dist/bundle/chunks/chunk-PRRNXB7S.js +1 -0
  41. package/dist/bundle/chunks/chunk-PWZRJWNP.js +17 -0
  42. package/dist/bundle/chunks/chunk-R44HF4S5.js +9 -0
  43. package/dist/bundle/chunks/chunk-R47JBGS3.js +1 -0
  44. package/dist/bundle/chunks/chunk-RCVVRHMF.js +9 -0
  45. package/dist/bundle/chunks/chunk-RDZVAGPR.js +1 -0
  46. package/dist/bundle/chunks/chunk-RR3ZP63P.js +56 -0
  47. package/dist/bundle/chunks/chunk-SE42OS3U.js +21 -0
  48. package/dist/bundle/chunks/chunk-TMTOQ7H7.js +1 -0
  49. package/dist/bundle/chunks/chunk-UTB4DTYQ.js +1 -0
  50. package/dist/bundle/chunks/chunk-VNHNHA4V.js +1 -0
  51. package/dist/bundle/chunks/chunk-XJFQKN3N.js +2 -0
  52. package/dist/bundle/chunks/chunk-ZG74NES2.js +1 -0
  53. package/dist/bundle/chunks/cli-FWMQKBFA.js +30 -0
  54. package/dist/bundle/chunks/cli-ZEDY5U67.js +52 -0
  55. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-E6TEENDO.js +1 -0
  56. package/dist/bundle/chunks/codemode-worker.js +480 -0
  57. package/dist/bundle/chunks/dist-D3WIBXB5.js +10 -0
  58. package/dist/bundle/chunks/easter-egg-3d-5TFBCTIS.js +1 -0
  59. package/dist/bundle/chunks/execute-62LDYHXA.js +506 -0
  60. package/dist/bundle/chunks/github-copilot.js +1 -0
  61. package/dist/bundle/chunks/google-generative-ai-V5DLXTF7.js +1 -0
  62. package/dist/bundle/chunks/google-vertex-K3KYGGLI.js +1 -0
  63. package/dist/bundle/chunks/http-proxy-KF35JLJN.js +1 -0
  64. package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +12 -0
  65. package/dist/bundle/chunks/image-resize-worker.js +1 -0
  66. package/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +20 -0
  67. package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +1 -0
  68. package/dist/bundle/chunks/kimi-coding.js +1 -0
  69. package/dist/bundle/chunks/lib-4AVRLBHM.js +8 -0
  70. package/dist/bundle/chunks/llama-cpp-classify-JCTIEHTL.js +21 -0
  71. package/dist/bundle/chunks/mcp-VF7EY5WC.js +10 -0
  72. package/dist/bundle/chunks/meta.js +1 -0
  73. package/dist/bundle/chunks/mistral-conversations-LVBXTF6R.js +4 -0
  74. package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +2 -0
  75. package/dist/bundle/chunks/node-AUOGOBCN.js +1 -0
  76. package/dist/bundle/chunks/node-ZTHARAQV.js +15 -0
  77. package/dist/bundle/chunks/office-PONBADQP.js +419 -0
  78. package/dist/bundle/chunks/openai-chatgpt.js +74 -0
  79. package/dist/bundle/chunks/openai-codex-responses-WBZKNYLX.js +9 -0
  80. package/dist/bundle/chunks/openai-codex.js +74 -0
  81. package/dist/bundle/chunks/openai-completions-HMHQRGX4.js +6 -0
  82. package/dist/bundle/chunks/openai-decisions-R7OFRKLL.js +4 -0
  83. package/dist/bundle/chunks/openai-responses-BHXRQFCI.js +3 -0
  84. package/dist/bundle/chunks/openrouter-images-BIMNIXQZ.js +1 -0
  85. package/dist/bundle/chunks/openrouter.js +74 -0
  86. package/dist/bundle/chunks/pi-messages-X5YTLXQJ.js +7 -0
  87. package/dist/bundle/chunks/radius.js +74 -0
  88. package/dist/bundle/chunks/review-WCGIBVLM.js +80 -0
  89. package/dist/bundle/chunks/rewind-2OYLDDHH.js +8 -0
  90. package/dist/bundle/chunks/router-7E5LU7US.js +3 -0
  91. package/dist/bundle/chunks/runtime-5PTUOEM2.js +1 -0
  92. package/dist/bundle/chunks/sdk-ZUFIGPSS.js +1 -0
  93. package/dist/bundle/chunks/src-QKGKDFSU.js +3 -0
  94. package/dist/bundle/chunks/sync-LOX6TIM6.js +4 -0
  95. package/dist/bundle/chunks/typesafe-system-one-KOIOG3HP.js +1 -0
  96. package/dist/bundle/chunks/usage-2EVEFGNI.js +1 -0
  97. package/dist/bundle/chunks/virtual-modules-MYMONT3Y.js +1 -0
  98. package/dist/bundle/chunks/xai.js +1 -0
  99. package/dist/bundle/cli-runtime.js +2 -0
  100. package/dist/bundle/cli.js +2 -0
  101. package/dist/bundle/index.js +1 -0
  102. package/dist/bundle/rpc-entry.js +2 -0
  103. package/dist/cli/args.js +1 -1
  104. package/dist/cli/auth-command.js +9 -6
  105. package/dist/cli/auth-login.js +2 -0
  106. package/dist/cli/auth-logout.js +1 -0
  107. package/dist/cli/auth-terminal.js +5 -0
  108. package/dist/cli/config-selector.js +1 -1
  109. package/dist/config.d.ts +5 -0
  110. package/dist/config.js +1 -1
  111. package/dist/core/agent-session-runtime.js +1 -1
  112. package/dist/core/agent-session-services.js +1 -1
  113. package/dist/core/agent-session.d.ts +8 -1
  114. package/dist/core/agent-session.js +12 -9
  115. package/dist/core/auth-storage.js +1 -1
  116. package/dist/core/bash-executor.js +1 -1
  117. package/dist/core/bug-report.js +3 -3
  118. package/dist/core/cache-warmer.d.ts +3 -15
  119. package/dist/core/cache-warmer.js +1 -1
  120. package/dist/core/compaction/branch-summarization.d.ts +3 -2
  121. package/dist/core/compaction/branch-summarization.js +5 -5
  122. package/dist/core/compaction/compaction.d.ts +1 -0
  123. package/dist/core/compaction/compaction.js +14 -14
  124. package/dist/core/compaction/tool-output-pruning.js +1 -1
  125. package/dist/core/compaction/utils.d.ts +0 -1
  126. package/dist/core/compaction/utils.js +8 -8
  127. package/dist/core/exec.d.ts +2 -0
  128. package/dist/core/exec.js +1 -1
  129. package/dist/core/export-html/template.css +9 -0
  130. package/dist/core/export-html/template.js +46 -39
  131. package/dist/core/export-html/tool-renderer.js +1 -1
  132. package/dist/core/extensions/index.d.ts +1 -1
  133. package/dist/core/extensions/loader.js +1 -1
  134. package/dist/core/extensions/pi-ai-extension-view.js +1 -0
  135. package/dist/core/extensions/runner.js +1 -1
  136. package/dist/core/extensions/types.d.ts +25 -7
  137. package/dist/core/extensions/virtual-modules.js +1 -1
  138. package/dist/core/keybindings.d.ts +1 -1
  139. package/dist/core/keybindings.js +1 -1
  140. package/dist/core/mcp-servers.d.ts +6 -17
  141. package/dist/core/mcp-servers.js +1 -1
  142. package/dist/core/model-config.d.ts +1912 -2211
  143. package/dist/core/model-config.js +4 -4
  144. package/dist/core/model-resolver.js +1 -1
  145. package/dist/core/model-runtime.d.ts +1 -0
  146. package/dist/core/model-runtime.js +1 -1
  147. package/dist/core/package-manager.d.ts +10 -1
  148. package/dist/core/package-manager.js +2 -2
  149. package/dist/core/pi-ai-schemas.js +1 -0
  150. package/dist/core/pi-manifest.js +1 -1
  151. package/dist/core/preferred-providers.js +1 -0
  152. package/dist/core/project-trust.js +2 -2
  153. package/dist/core/prompt-templates.js +2 -2
  154. package/dist/core/provider-composer.js +1 -1
  155. package/dist/core/provider-matching.js +1 -0
  156. package/dist/core/radius-mcp.js +1 -0
  157. package/dist/core/remote-catalog-provider.js +1 -1
  158. package/dist/core/resource-loader.d.ts +3 -1
  159. package/dist/core/resource-loader.js +1 -1
  160. package/dist/core/runtime-credentials.js +1 -1
  161. package/dist/core/sdk.js +1 -1
  162. package/dist/core/session-cwd.js +3 -7
  163. package/dist/core/session-manager.d.ts +1 -0
  164. package/dist/core/session-manager.js +12 -12
  165. package/dist/core/settings-defaults.js +1 -1
  166. package/dist/core/settings-manager.d.ts +4 -0
  167. package/dist/core/settings-manager.js +1 -1
  168. package/dist/core/settings-schema.d.ts +4 -2
  169. package/dist/core/settings-schema.js +1 -1
  170. package/dist/core/skills.js +3 -3
  171. package/dist/core/slash-commands.js +1 -1
  172. package/dist/core/source-info.d.ts +8 -0
  173. package/dist/core/source-info.js +1 -1
  174. package/dist/core/system-prompt.js +3 -3
  175. package/dist/core/tools/bash.d.ts +2 -2
  176. package/dist/core/tools/bash.js +15 -15
  177. package/dist/core/tools/edit-diff.d.ts +9 -4
  178. package/dist/core/tools/edit-diff.js +22 -15
  179. package/dist/core/tools/edit.d.ts +3 -3
  180. package/dist/core/tools/edit.js +3 -3
  181. package/dist/core/tools/find.d.ts +2 -2
  182. package/dist/core/tools/find.js +10 -11
  183. package/dist/core/tools/grep.d.ts +3 -3
  184. package/dist/core/tools/grep.js +8 -12
  185. package/dist/core/tools/ls.d.ts +2 -2
  186. package/dist/core/tools/ls.js +4 -4
  187. package/dist/core/tools/powershell.js +6 -2
  188. package/dist/core/tools/read.d.ts +5 -2
  189. package/dist/core/tools/read.js +20 -19
  190. package/dist/core/tools/render-utils.js +5 -5
  191. package/dist/core/tools/renderers/write.js +10 -10
  192. package/dist/core/tools/tool-definition-wrapper.d.ts +11 -0
  193. package/dist/core/tools/truncate.d.ts +2 -8
  194. package/dist/core/tools/truncate.js +10 -10
  195. package/dist/core/tools/write.d.ts +2 -2
  196. package/dist/core/trust-manager.js +2 -2
  197. package/dist/core/usage-totals.js +1 -1
  198. package/dist/extensions/codemode/execute.js +12 -12
  199. package/dist/extensions/codemode/renderer.js +6 -6
  200. package/dist/extensions/codemode/tool.d.ts +2 -1
  201. package/dist/extensions/codemode/tool.js +11 -10
  202. package/dist/extensions/llama/client.js +5 -5
  203. package/dist/extensions/llama/ui.js +2 -2
  204. package/dist/extensions/mcp/cli.js +21 -19
  205. package/dist/extensions/mcp/config.js +2 -2
  206. package/dist/extensions/mcp/index.js +7 -7
  207. package/dist/extensions/mcp/oauth.d.ts +3 -22
  208. package/dist/extensions/mcp/oauth.js +2 -2
  209. package/dist/extensions/mcp/resources.d.ts +1 -1
  210. package/dist/extensions/mcp/resources.js +1 -1
  211. package/dist/extensions/mcp/runtime.d.ts +2 -2
  212. package/dist/extensions/mcp/runtime.js +3 -3
  213. package/dist/extensions/mcp/tools.d.ts +1 -8
  214. package/dist/extensions/mcp/tools.js +4 -9
  215. package/dist/extensions/mcp/ui.js +1 -1
  216. package/dist/extensions/tool-search/tool.js +4 -4
  217. package/dist/index.d.ts +2 -2
  218. package/dist/main.js +4 -4
  219. package/dist/modes/interactive/components/assistant-message.d.ts +4 -1
  220. package/dist/modes/interactive/components/assistant-message.js +2 -2
  221. package/dist/modes/interactive/components/branch-summary-message.d.ts +5 -1
  222. package/dist/modes/interactive/components/branch-summary-message.js +2 -2
  223. package/dist/modes/interactive/components/compaction-summary-message.d.ts +5 -1
  224. package/dist/modes/interactive/components/compaction-summary-message.js +2 -2
  225. package/dist/modes/interactive/components/config-selector.js +1 -1
  226. package/dist/modes/interactive/components/custom-editor.js +1 -1
  227. package/dist/modes/interactive/components/custom-entry.js +1 -1
  228. package/dist/modes/interactive/components/custom-message.d.ts +5 -2
  229. package/dist/modes/interactive/components/custom-message.js +3 -3
  230. package/dist/modes/interactive/components/diff.js +3 -3
  231. package/dist/modes/interactive/components/extension-editor.d.ts +1 -0
  232. package/dist/modes/interactive/components/extension-editor.js +1 -1
  233. package/dist/modes/interactive/components/extension-selector.js +2 -2
  234. package/dist/modes/interactive/components/login-dialog.d.ts +5 -0
  235. package/dist/modes/interactive/components/login-dialog.js +1 -1
  236. package/dist/modes/interactive/components/markdown-transform.js +1 -1
  237. package/dist/modes/interactive/components/mermaid.js +4 -4
  238. package/dist/modes/interactive/components/model-selector.d.ts +1 -0
  239. package/dist/modes/interactive/components/model-selector.js +2 -2
  240. package/dist/modes/interactive/components/oauth-selector.d.ts +2 -1
  241. package/dist/modes/interactive/components/oauth-selector.js +1 -1
  242. package/dist/modes/interactive/components/provider-brand.js +1 -0
  243. package/dist/modes/interactive/components/radius-login-selector.js +1 -1
  244. package/dist/modes/interactive/components/scoped-models-selector.d.ts +1 -0
  245. package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
  246. package/dist/modes/interactive/components/session-selector-search.js +1 -1
  247. package/dist/modes/interactive/components/session-selector.d.ts +2 -1
  248. package/dist/modes/interactive/components/session-selector.js +2 -2
  249. package/dist/modes/interactive/components/settings-submenu.js +1 -1
  250. package/dist/modes/interactive/components/skill-invocation-message.d.ts +5 -1
  251. package/dist/modes/interactive/components/skill-invocation-message.js +2 -2
  252. package/dist/modes/interactive/components/tool-execution.d.ts +1 -0
  253. package/dist/modes/interactive/components/tool-execution.js +3 -3
  254. package/dist/modes/interactive/components/tree-selector.d.ts +2 -0
  255. package/dist/modes/interactive/components/tree-selector.js +1 -1
  256. package/dist/modes/interactive/components/user-message-selector.d.ts +1 -0
  257. package/dist/modes/interactive/components/user-message-selector.js +1 -1
  258. package/dist/modes/interactive/components/user-message.d.ts +2 -1
  259. package/dist/modes/interactive/components/user-message.js +1 -1
  260. package/dist/modes/interactive/external-editor.js +3 -3
  261. package/dist/modes/interactive/interactive-mode.d.ts +10 -1
  262. package/dist/modes/interactive/interactive-mode.js +45 -40
  263. package/dist/modes/interactive/model-search.js +1 -1
  264. package/dist/modes/interactive/theme/theme.d.ts +4 -0
  265. package/dist/modes/interactive/theme/theme.js +3 -6
  266. package/dist/modes/print-mode.js +7 -7
  267. package/dist/modes/rpc/rpc-mode.js +1 -1
  268. package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
  269. package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
  270. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  271. package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
  272. package/dist/node_modules/@dalcode/dal-codeindex/package.json +2 -2
  273. package/dist/node_modules/@dalcode/dal-compat/package.json +3 -3
  274. package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
  275. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  276. package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
  277. package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
  278. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  279. package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
  280. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  281. package/dist/node_modules/@dalcode/dal-learn/package.json +3 -2
  282. package/dist/node_modules/@dalcode/dal-learn/src/index.js +16 -16
  283. package/dist/node_modules/@dalcode/dal-learn/src/lesson-events.js +1 -0
  284. package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
  285. package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
  286. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  287. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +4 -3
  288. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  289. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +4 -3
  290. package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
  291. package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
  292. package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
  293. package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
  294. package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
  295. package/dist/node_modules/@dalcode/dal-router/package.json +6 -6
  296. package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
  297. package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
  298. package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
  299. package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
  300. package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
  301. package/dist/node_modules/@dalcode/dal-sync/package.json +4 -4
  302. package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -4
  303. package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
  304. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  305. package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
  306. package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
  307. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  308. package/dist/node_modules/@dalcode/dal-workflow/src/image-budget.js +1 -0
  309. package/dist/node_modules/@dalcode/dal-workflow/src/index.js +4 -4
  310. package/dist/node_modules/@dalcode/dal-workflow/src/todo-snapshot.js +2 -2
  311. package/dist/node_modules/@dalcode/dal-workflow/src/todo.js +3 -3
  312. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  313. package/dist/node_modules/@earendil-works/pi-agent-core/README.md +8 -6
  314. package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +1 -1
  315. package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +2 -2
  316. package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +8 -5
  317. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  318. package/dist/node_modules/@earendil-works/pi-ai/README.md +58 -39
  319. package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +5 -5
  320. package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +1 -1
  321. package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +1 -1
  322. package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.d.ts +1 -0
  323. package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.js +1 -1
  324. package/dist/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js +1 -1
  325. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +1 -1
  326. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +2 -2
  327. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +1 -1
  328. package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts +1 -1
  329. package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.js +1 -1
  330. package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +4 -4
  331. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +1 -1
  332. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +2 -1
  333. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +5 -5
  334. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +9 -9
  335. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +3 -3
  336. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +1 -1
  337. package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +2 -0
  338. package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +3 -3
  339. package/dist/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -1
  340. package/dist/node_modules/@earendil-works/pi-ai/dist/api/strict-tool-limits.js +1 -0
  341. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js +1 -1
  342. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js +1 -1
  343. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/meta.js +1 -1
  344. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js +1 -1
  345. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/trusted-url.js +1 -0
  346. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +2 -0
  347. package/dist/node_modules/@earendil-works/pi-ai/dist/cache-warming.d.ts +21 -0
  348. package/dist/node_modules/@earendil-works/pi-ai/dist/cache-warming.js +1 -0
  349. package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +5 -5
  350. package/dist/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts +2 -0
  351. package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -1
  352. package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts +3 -3
  353. package/dist/node_modules/@earendil-works/pi-ai/dist/index.js +1 -1
  354. package/dist/node_modules/@earendil-works/pi-ai/dist/lazy-bedrock-provider.js +1 -0
  355. package/dist/node_modules/@earendil-works/pi-ai/dist/lazy-oauth.js +1 -0
  356. package/dist/node_modules/@earendil-works/pi-ai/dist/models.d.ts +1 -0
  357. package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +4 -0
  358. package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.js +1 -1
  359. package/dist/node_modules/@earendil-works/pi-ai/dist/models.js +1 -1
  360. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/all.js +1 -1
  361. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.d.ts +485 -498
  362. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js +1 -1
  363. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  364. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  365. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
  366. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/azure.json +1 -1
  367. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
  368. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  369. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
  370. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  371. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  372. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
  373. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
  374. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  375. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
  376. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/meta.json +1 -1
  377. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
  378. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -1
  379. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai.json +1 -1
  380. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  381. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
  382. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  383. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  384. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  385. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  386. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
  387. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual-cn.json +1 -0
  388. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual.json +1 -1
  389. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
  390. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
  391. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
  392. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  393. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
  394. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
  395. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
  396. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
  397. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -1
  398. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  399. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
  400. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +5 -5
  401. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.js +1 -1
  402. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.d.ts +65 -65
  403. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js +1 -1
  404. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js +1 -1
  405. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual-cn.js +1 -0
  406. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual-cn.models.d.ts +5 -0
  407. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual-cn.models.js +1 -0
  408. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.js +1 -1
  409. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/schema-builders.js +1 -0
  410. package/dist/node_modules/@earendil-works/pi-ai/dist/telemetry.js +1 -1
  411. package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts +4 -3
  412. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js +1 -1
  413. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/openrouter-cost.js +1 -0
  414. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +1 -1
  415. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +1 -1
  416. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/streaming-json.d.ts +26 -0
  417. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/streaming-json.js +4 -0
  418. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/{typebox-helpers.d.ts → string-enum.d.ts} +2 -2
  419. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/string-enum.js +1 -0
  420. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.d.ts +1 -0
  421. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.js +2 -2
  422. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/validation.js +4 -4
  423. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -1
  424. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -1
  425. package/dist/node_modules/@earendil-works/pi-ai/package.json +12 -5
  426. package/dist/node_modules/@earendil-works/pi-codemode/README.md +2 -2
  427. package/dist/node_modules/@earendil-works/pi-codemode/dist/declarations.d.ts +1 -0
  428. package/dist/node_modules/@earendil-works/pi-codemode/dist/declarations.js +4 -4
  429. package/dist/node_modules/@earendil-works/pi-codemode/dist/index.d.ts +1 -1
  430. package/dist/node_modules/@earendil-works/pi-codemode/dist/index.js +1 -1
  431. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js +2 -0
  432. package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
  433. package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  434. package/dist/node_modules/@earendil-works/pi-mcp/CHANGELOG.md +32 -0
  435. package/dist/node_modules/@earendil-works/pi-mcp/README.md +60 -5
  436. package/dist/node_modules/@earendil-works/pi-mcp/dist/config.d.ts +45 -0
  437. package/dist/node_modules/@earendil-works/pi-mcp/dist/config.js +1 -0
  438. package/dist/node_modules/@earendil-works/pi-mcp/dist/index.d.ts +5 -0
  439. package/dist/node_modules/@earendil-works/pi-mcp/dist/index.js +1 -1
  440. package/dist/node_modules/@earendil-works/pi-mcp/dist/input-schema.d.ts +1 -0
  441. package/dist/node_modules/@earendil-works/pi-mcp/dist/input-schema.js +1 -0
  442. package/dist/node_modules/@earendil-works/pi-mcp/dist/naming.d.ts +2 -0
  443. package/dist/node_modules/@earendil-works/pi-mcp/dist/naming.js +1 -0
  444. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/auth-provider.d.ts +18 -0
  445. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/auth-provider.js +1 -0
  446. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/callback.js +1 -1
  447. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/client-settings.d.ts +42 -0
  448. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/client-settings.js +1 -0
  449. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.d.ts +3 -0
  450. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.js +1 -1
  451. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.d.ts +2 -0
  452. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.js +1 -1
  453. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/index.d.ts +5 -1
  454. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/index.js +1 -1
  455. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/loopback.d.ts +22 -0
  456. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/loopback.js +1 -0
  457. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/sign-in.d.ts +28 -0
  458. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/sign-in.js +1 -0
  459. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/types.d.ts +1 -0
  460. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/types.js +1 -1
  461. package/dist/node_modules/@earendil-works/pi-mcp/dist/output-limit.d.ts +8 -0
  462. package/dist/node_modules/@earendil-works/pi-mcp/dist/output-limit.js +11 -0
  463. package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/lines.js +1 -0
  464. package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/pipe.d.ts +34 -0
  465. package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/pipe.js +2 -0
  466. package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/stdio.d.ts +1 -4
  467. package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/stdio.js +2 -2
  468. package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.js +6 -4
  469. package/dist/node_modules/@earendil-works/pi-mcp/package.json +2 -2
  470. package/dist/node_modules/@earendil-works/pi-schema/CHANGELOG.md +37 -0
  471. package/dist/node_modules/@earendil-works/pi-schema/LICENSE +21 -0
  472. package/dist/node_modules/@earendil-works/pi-schema/README.md +319 -0
  473. package/dist/node_modules/@earendil-works/pi-schema/THIRD_PARTY_NOTICES/typebox-LICENSE +23 -0
  474. package/dist/node_modules/@earendil-works/pi-schema/dist/annotations.js +1 -0
  475. package/dist/node_modules/@earendil-works/pi-schema/dist/builders.d.ts +89 -0
  476. package/dist/node_modules/@earendil-works/pi-schema/dist/builders.js +1 -0
  477. package/dist/node_modules/@earendil-works/pi-schema/dist/checks.d.ts +51 -0
  478. package/dist/node_modules/@earendil-works/pi-schema/dist/checks.js +1 -0
  479. package/dist/node_modules/@earendil-works/pi-schema/dist/coerce.js +1 -0
  480. package/dist/node_modules/@earendil-works/pi-schema/dist/compiler.js +1 -0
  481. package/dist/node_modules/@earendil-works/pi-schema/dist/explain.js +1 -0
  482. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/index.js +1 -0
  483. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/date.js +1 -0
  484. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/date_time.js +1 -0
  485. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/duration.js +1 -0
  486. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/email.js +1 -0
  487. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/hostname.js +1 -0
  488. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idn_email.js +1 -0
  489. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idn_hostname.js +1 -0
  490. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/format/bidi.js +1 -0
  491. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/format/puny.js +1 -0
  492. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/hostname.js +1 -0
  493. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/idn-hostname.js +1 -0
  494. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/index.js +1 -0
  495. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/label/ascii.js +1 -0
  496. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/label/puny.js +1 -0
  497. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/label/unicode.js +1 -0
  498. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/pattern/pattern.js +1 -0
  499. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/ipv4.js +1 -0
  500. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/ipv6.js +1 -0
  501. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/iri.js +1 -0
  502. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/iri_reference.js +1 -0
  503. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/json_pointer.js +1 -0
  504. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/json_pointer_uri_fragment.js +1 -0
  505. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/regex.js +1 -0
  506. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/relative_json_pointer.js +1 -0
  507. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/time.js +1 -0
  508. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uri.js +1 -0
  509. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uri_reference.js +1 -0
  510. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uri_template.js +1 -0
  511. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/url.js +1 -0
  512. package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uuid.js +1 -0
  513. package/dist/node_modules/@earendil-works/pi-schema/dist/index.d.ts +4 -0
  514. package/dist/node_modules/@earendil-works/pi-schema/dist/index.js +1 -0
  515. package/dist/node_modules/@earendil-works/pi-schema/dist/resolver.js +1 -0
  516. package/dist/node_modules/@earendil-works/pi-schema/dist/shared.js +1 -0
  517. package/dist/node_modules/@earendil-works/pi-schema/dist/typebox-static.d.ts +54 -0
  518. package/dist/node_modules/@earendil-works/pi-schema/dist/typebox-static.js +0 -0
  519. package/dist/node_modules/@earendil-works/pi-schema/dist/types.d.ts +25 -0
  520. package/dist/node_modules/@earendil-works/pi-schema/dist/types.js +0 -0
  521. package/dist/node_modules/@earendil-works/pi-schema/dist/validator.d.ts +20 -0
  522. package/dist/node_modules/@earendil-works/pi-schema/dist/validator.js +1 -0
  523. package/dist/node_modules/@earendil-works/pi-schema/package.json +43 -0
  524. package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.d.ts +1 -1
  525. package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.js +1 -1
  526. package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.d.ts +1 -0
  527. package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.js +1 -1
  528. package/dist/node_modules/@earendil-works/pi-telemetry/dist/render.js +2 -2
  529. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +3 -1
  530. package/dist/node_modules/@earendil-works/pi-tui/README.md +2 -0
  531. package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +1 -0
  532. package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.js +3 -3
  533. package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +4 -0
  534. package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +11 -10
  535. package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +1 -0
  536. package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +1 -1
  537. package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +1 -0
  538. package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +1 -1
  539. package/dist/node_modules/@earendil-works/pi-tui/dist/components/text.js +1 -1
  540. package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +1 -1
  541. package/dist/node_modules/@earendil-works/pi-tui/dist/index.d.ts +2 -2
  542. package/dist/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
  543. package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +1 -0
  544. package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.js +1 -1
  545. package/dist/node_modules/@earendil-works/pi-tui/dist/keys.js +5 -5
  546. package/dist/node_modules/@earendil-works/pi-tui/dist/layout.js +1 -1
  547. package/dist/node_modules/@earendil-works/pi-tui/dist/program-status.js +1 -1
  548. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +1 -0
  549. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +1 -1
  550. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.js +1 -1
  551. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +1 -1
  552. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +4 -4
  553. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js +13 -13
  554. package/dist/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +1 -0
  555. package/dist/node_modules/@earendil-works/pi-tui/dist/tui.js +2 -2
  556. package/dist/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +1 -0
  557. package/dist/node_modules/@earendil-works/pi-tui/dist/utils.js +1 -1
  558. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  559. package/dist/package-manager-cli.js +17 -16
  560. package/dist/utils/ansi.js +1 -1
  561. package/dist/utils/changelog.js +3 -3
  562. package/dist/utils/clipboard-command.js +1 -1
  563. package/dist/utils/image-resize-core.js +1 -1
  564. package/dist/utils/image-resize.js +1 -1
  565. package/dist/utils/open-browser.js +1 -1
  566. package/dist/utils/paths.js +1 -1
  567. package/dist/utils/shell.js +3 -3
  568. package/dist/utils/syntax-highlight.js +4 -4
  569. package/dist/utils/terminal-question.js +1 -0
  570. package/dist/utils/tools-manager.js +1 -1
  571. package/dist/utils/web-url.js +1 -0
  572. package/examples/extensions/README.md +2 -1
  573. package/examples/extensions/custom-provider-gitlab-duo/package.json +14 -14
  574. package/examples/extensions/debug-provider.ts +2 -2
  575. package/examples/extensions/gondolin/package-lock.json +19 -29
  576. package/examples/extensions/gondolin/package.json +2 -2
  577. package/examples/extensions/plan-mode/index.ts +20 -9
  578. package/examples/extensions/plan-mode/utils.ts +42 -16
  579. package/examples/extensions/preset.ts +2 -0
  580. package/examples/extensions/reload-runtime.ts +17 -5
  581. package/examples/extensions/subagent/README.md +14 -11
  582. package/examples/extensions/subagent/index.ts +392 -171
  583. package/examples/extensions/todo.ts +7 -0
  584. package/examples/extensions/tools.ts +2 -0
  585. package/examples/extensions/with-deps/package-lock.json +2 -2
  586. package/examples/extensions/with-deps/package.json +20 -20
  587. package/examples/tsconfig.json +208 -0
  588. package/npm-shrinkwrap.json +407 -383
  589. package/package.json +6 -7
  590. package/examples/extensions/sandbox/index.ts +0 -327
  591. package/examples/extensions/sandbox/package-lock.json +0 -92
  592. package/examples/extensions/sandbox/package.json +0 -19
  593. /package/dist/node_modules/@earendil-works/pi-mcp/{LICENSES → THIRD_PARTY_NOTICES}/modelcontextprotocol-typescript-sdk.txt +0 -0
@@ -1,6 +1,6 @@
1
- var F=Object.defineProperty;var u=(o,t)=>F(o,"name",{value:t,configurable:!0});import{Box as R,Container as T,getCapabilities as E,Image as O,Spacer as M,Text as c,truncateToWidth as y}from"@earendil-works/pi-tui";import{createAllToolDefinitions as A}from"../../../core/tools/index.js";import{compactToolArgHint as D,countOutputLines as S,formatCollapsedSummary as P,formatToolCallWithArgs as B,getTextOutput as L,prettyToolLabel as b}from"../../../core/tools/render-utils.js";import{fill as k,t as m}from"../../../dal/i18n.js";import{stripAnsi as v}from"../../../utils/ansi.js";import{ensurePngTranscoder as W}from"../../../utils/image-convert.js";import{theme as l}from"../theme/theme.js";import{keyHint as N}from"./keybinding-hints.js";import{PulseLabel as _}from"./status-indicator.js";const Q=0,C=" ";class q{static{u(this,"CollapsedToolRow")}call;result;marker;constructor(t,e,i=""){this.call=t,this.result=e,this.marker=i}invalidate(){this.call.invalidate?.(),this.result?.invalidate?.()}render(t){const e=this.marker?"":C,i=Math.max(1,t-C.length),n=(this.call.render(i)[0]??"").replace(/\s+$/,""),s=v((this.result?.render(i)??[]).map(h=>h.trim()).filter(h=>h.length>0).join(" \xB7 "));if(!n.trim()&&!s)return[];const r=s?`${n} ${l.fg("dim",s)}`:n,a=`${e}${this.marker}${r}`;return[y(a,Math.max(1,t),l.fg("dim","..."))]}}class j{static{u(this,"FocusMarkerRow")}inner;marker;constructor(t,e){this.inner=t,this.marker=e}invalidate(){this.inner.invalidate?.()}render(t){const e=v(this.marker).length,i=this.inner.render(Math.max(1,t-e));if(i.length===0)return i;const n=" ".repeat(e);return[`${this.marker}${i[0]}`,...i.slice(1).map(s=>`${n}${s}`)]}}class f extends T{static{u(this,"ToolExecutionComponent")}contentBox;contentText;selfRenderContainer;callRendererComponent;resultRendererComponent;rendererState={};imageComponents=[];imageSources=[];imageSpacers=[];toolName;toolCallId;args;expanded=!1;showImages;imageWidthCells;outputPad;isPartial=!0;toolDefinition;builtInToolDefinition;ui;cwd;executionStarted=!1;argsComplete=!1;result;hideComponent=!1;activityPulse;collapsedAway=!1;focused=!1;leadingStreak=0;constructor(t,e,i,n={},s,r,a){super(),this.toolName=t,this.toolCallId=e,this.args=i,this.toolDefinition=s,this.builtInToolDefinition=A(a)[t],this.showImages=n.showImages??!0,this.imageWidthCells=n.imageWidthCells??60,this.outputPad=n.outputPad??1,this.ui=r,this.cwd=a,this.contentBox=new R(0,0),this.contentText=new c("",0,0),this.selfRenderContainer=new T,this.hasRendererDefinition()?this.addChild(this.getRenderShell()==="self"?this.selfRenderContainer:this.contentBox):this.addChild(this.contentText),this.updateDisplay()}dispose(){this.activityPulse?.dispose(),this.activityPulse=void 0}isQuietFoldable(){return!this.expanded&&!!this.result&&!this.result.isError&&!this.isPartial}focusMarker(){return this.focused?l.fg("accent",this.expanded?"\u25BE ":"\u25B8 "):""}setFocused(t){this.focused!==t&&(this.focused=t,this.invalidate())}setStreakPresentation(t,e=0){this.collapsedAway=t,this.leadingStreak=t?0:e}getCallRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderCall??this.builtInToolDefinition.renderCall:this.builtInToolDefinition.renderCall:this.toolDefinition?.renderCall}getResultRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderResult??this.builtInToolDefinition.renderResult:this.builtInToolDefinition.renderResult:this.toolDefinition?.renderResult}hasRendererDefinition(){return this.builtInToolDefinition!==void 0||this.toolDefinition!==void 0}getRenderShell(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderShell??this.builtInToolDefinition.renderShell??"default":this.builtInToolDefinition.renderShell??"default":this.toolDefinition?.renderShell??"default"}getRenderContext(t){return{args:this.args,toolCallId:this.toolCallId,invalidate:u(()=>{this.invalidate(),this.ui.requestRender()},"invalidate"),lastComponent:t,state:this.rendererState,cwd:this.cwd,executionStarted:this.executionStarted,argsComplete:this.argsComplete,isPartial:this.isPartial,expanded:this.expanded,showImages:this.showImages,isError:this.result?.isError??!1,durationMs:this.isPartial?void 0:this.result?.durationMs,outputPad:this.outputPad}}createCallFallback(){const t=b(this.toolName);if(this.expanded)return new c(B(t,this.args,l,!0),0,0);const e=D(this.args),i=l.fg("toolTitle",l.bold(t));return new c(e?`${i} ${l.fg("dim",e)}`:i,0,0)}createResultFallback(){const t=this.getTextOutput();if(!t)return;if(!this.expanded&&!this.result?.isError){const r=S(t),a=P(l,r>0?[k(m("{count} \u884C"),{count:r})]:[]);return a?new c(a,0,0):void 0}const e=t.split(`
1
+ var E=Object.defineProperty;var u=(o,t)=>E(o,"name",{value:t,configurable:!0});import{Box as R,Container as T,getCapabilities as O,Image as M,Spacer as A,Text as c,truncateToWidth as y}from"@earendil-works/pi-tui";import{createAllToolDefinitions as B}from"../../../core/tools/index.js";import{compactToolArgHint as D,countOutputLines as P,formatCollapsedSummary as S,formatToolCallWithArgs as L,getTextOutput as W,prettyToolLabel as k}from"../../../core/tools/render-utils.js";import{fill as b,t as m}from"../../../dal/i18n.js";import{stripAnsi as v}from"../../../utils/ansi.js";import{ensurePngTranscoder as N}from"../../../utils/image-convert.js";import{theme as l}from"../theme/theme.js";import{keyHint as I,keyText as _}from"./keybinding-hints.js";import{PulseLabel as q}from"./status-indicator.js";const Q=0,C=" ";class H{static{u(this,"CollapsedToolRow")}call;result;marker;constructor(t,e,i=""){this.call=t,this.result=e,this.marker=i}invalidate(){this.call.invalidate?.(),this.result?.invalidate?.()}render(t){const e=this.marker?"":C,i=Math.max(1,t-C.length),n=(this.call.render(i)[0]??"").replace(/\s+$/,""),s=v((this.result?.render(i)??[]).map(h=>h.trim()).filter(h=>h.length>0).join(" \xB7 "));if(!n.trim()&&!s)return[];const r=s?`${n} ${l.fg("dim",s)}`:n,a=`${e}${this.marker}${r}`;return[y(a,Math.max(1,t),l.fg("dim","..."))]}}class j{static{u(this,"FocusMarkerRow")}inner;marker;constructor(t,e){this.inner=t,this.marker=e}invalidate(){this.inner.invalidate?.()}render(t){const e=v(this.marker).length,i=this.inner.render(Math.max(1,t-e));if(i.length===0)return i;const n=" ".repeat(e);return[`${this.marker}${i[0]}`,...i.slice(1).map(s=>`${n}${s}`)]}}class f extends T{static{u(this,"ToolExecutionComponent")}contentBox;contentText;selfRenderContainer;callRendererComponent;resultRendererComponent;rendererState={};imageComponents=[];imageSources=[];imageSpacers=[];toolName;toolCallId;args;expanded=!1;showImages;imageWidthCells;outputPad;isPartial=!0;toolDefinition;builtInToolDefinition;ui;cwd;executionStarted=!1;argsComplete=!1;argsPending=!1;result;hideComponent=!1;activityPulse;collapsedAway=!1;focused=!1;leadingStreak=0;constructor(t,e,i,n={},s,r,a){super(),this.toolName=t,this.toolCallId=e,this.args=i,this.toolDefinition=s,this.builtInToolDefinition=B(a)[t],this.showImages=n.showImages??!0,this.imageWidthCells=n.imageWidthCells??60,this.outputPad=n.outputPad??1,this.ui=r,this.cwd=a,this.contentBox=new R(0,0),this.contentText=new c("",0,0),this.selfRenderContainer=new T,this.hasRendererDefinition()?this.addChild(this.getRenderShell()==="self"?this.selfRenderContainer:this.contentBox):this.addChild(this.contentText),this.updateDisplay()}dispose(){this.activityPulse?.dispose(),this.activityPulse=void 0}isQuietFoldable(){return!this.expanded&&!!this.result&&!this.result.isError&&!this.isPartial}focusMarker(){return this.focused?l.fg("accent",this.expanded?"\u25BE ":"\u25B8 "):""}setFocused(t){this.focused!==t&&(this.focused=t,this.invalidate())}setStreakPresentation(t,e=0){this.collapsedAway=t,this.leadingStreak=t?0:e}getCallRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderCall??this.builtInToolDefinition.renderCall:this.builtInToolDefinition.renderCall:this.toolDefinition?.renderCall}getResultRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderResult??this.builtInToolDefinition.renderResult:this.builtInToolDefinition.renderResult:this.toolDefinition?.renderResult}hasRendererDefinition(){return this.builtInToolDefinition!==void 0||this.toolDefinition!==void 0}getRenderShell(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderShell??this.builtInToolDefinition.renderShell??"default":this.builtInToolDefinition.renderShell??"default":this.toolDefinition?.renderShell??"default"}getRenderContext(t){return{args:this.args,toolCallId:this.toolCallId,invalidate:u(()=>{this.invalidate(),this.ui.requestRender()},"invalidate"),lastComponent:t,state:this.rendererState,keyText:u(e=>_(e),"keyText"),keyHint:u((e,i)=>I(e,i),"keyHint"),cwd:this.cwd,executionStarted:this.executionStarted,argsComplete:this.argsComplete,isPartial:this.isPartial,expanded:this.expanded,showImages:this.showImages,isError:this.result?.isError??!1,durationMs:this.isPartial?void 0:this.result?.durationMs,outputPad:this.outputPad}}createCallFallback(){const t=k(this.toolName);if(this.expanded)return new c(L(t,this.args,l,!0),0,0);const e=D(this.args),i=l.fg("toolTitle",l.bold(t));return new c(e?`${i} ${l.fg("dim",e)}`:i,0,0)}createResultFallback(){const t=this.getTextOutput();if(!t)return;if(!this.expanded&&!this.result?.isError){const r=P(t),a=S(l,r>0?[b(m("{count} \u884C"),{count:r})]:[]);return a?new c(a,0,0):void 0}const e=t.split(`
2
2
  `),i=this.expanded?e:e.slice(0,Math.max(Q,0)),n=e.length-i.length;let s=i.map(r=>l.fg("toolOutput",r)).join(`
3
3
  `);return n>0&&(s+=`${l.fg("muted",`
4
- ${k(m("... (\u8FD8\u6709 {count} \u884C,"),{count:n})}`)} ${N("app.tools.expand",m("\u5C55\u5F00\u67E5\u770B"))}${l.fg("muted",")")}`),s?new c(s,0,0):void 0}updateArgs(t){this.args=t,this.updateDisplay()}markExecutionStarted(){this.executionStarted=!0,this.updateDisplay(),this.ui.requestRender()}setArgsComplete(){this.argsComplete=!0,this.updateDisplay(),this.ui.requestRender()}updateResult(t,e=!1){this.result=t,this.isPartial=e,this.updateDisplay()}setExpanded(t){this.expanded=t,this.updateDisplay()}setOutputPad(t){this.outputPad=t,this.updateDisplay()}setShowImages(t){this.showImages=t,this.updateDisplay()}setImageWidthCells(t){this.imageWidthCells=Math.max(1,Math.floor(t)),this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}render(t){if(this.hideComponent||this.collapsedAway)return[];let e;if(this.hasRendererDefinition()&&this.getRenderShell()==="self"){const i=this.selfRenderContainer.render(t);if(this.imageComponents.length===0&&i.every(n=>n.trim()===""))return[];e=[],i.length>0&&e.push(...i);for(let n=0;n<this.imageComponents.length;n++){const s=this.imageSpacers[n];s&&e.push(...s.render(t));const r=this.imageComponents[n];r&&e.push(...r.render(t))}}else e=super.render(t);if(this.activityPulse&&e.length>0){const i=this.activityPulse.render(2)[0]??"";e[0]=y(`${i} ${e[0]}`,Math.max(1,t),l.fg("dim","..."))}return this.leadingStreak>0?[l.fg("dim",`${this.leadingStreak} ${m("\u4E2A\u5DE5\u5177")}`),...e]:e}updateDisplay(){const t=this.result?.isError&&!this.isPartial?s=>l.bg("toolErrorBg",s):void 0;let e=!1;if(this.hideComponent=!1,this.hasRendererDefinition()){const s=this.getRenderShell()==="self"?this.selfRenderContainer:this.contentBox;s instanceof R&&(s.setBgFn(t),s.setPaddingX(this.outputPad)),s.clear();let r;const a=this.getCallRenderer();if(!a)r=this.createCallFallback();else try{r=a(this.args,l,this.getRenderContext(this.callRendererComponent)),this.callRendererComponent=r}catch{this.callRendererComponent=void 0,r=this.createCallFallback()}let h;if(this.result){const p=this.getResultRenderer();if(!p)h=this.createResultFallback();else try{h=p({content:this.result.content,details:this.result.details},{expanded:this.expanded,isPartial:this.isPartial},l,this.getRenderContext(this.resultRendererComponent)),this.resultRendererComponent=h}catch{this.resultRendererComponent=void 0,h=this.createResultFallback()}h&&this.isBlankComponent(h)&&(h=void 0)}!this.expanded&&!this.result?.isError&&!!r&&r.render(240).length<=1&&r?(s.addChild(new q(r,h,this.focusMarker())),e=!0):(r&&(s.addChild(new j(r,this.focusMarker()||C)),e=!0),h&&(s.addChild(h),e=!0))}else this.contentText.setCustomBgFn(t),this.contentText.setPaddingX(this.outputPad),this.contentText.setText(this.formatToolExecution()),e=!0;const i=this.imageComponents,n=this.imageSources;for(const s of this.imageComponents)this.removeChild(s);this.imageComponents=[],this.imageSources=[];for(const s of this.imageSpacers)this.removeChild(s);if(this.imageSpacers=[],this.result){const s=this.result.content.filter(a=>a.type==="image"),r=E();for(const a of s)if(r.images&&this.showImages&&a.data&&a.mimeType){const h=new M(1);this.addChild(h),this.imageSpacers.push(h);const d={data:a.data,mimeType:a.mimeType,widthCells:this.imageWidthCells},p=this.imageComponents.length,g=n[p],x=g?.data===d.data&&g.mimeType===d.mimeType&&g.widthCells===d.widthCells?i[p]:new O(d.data,d.mimeType,{fallbackColor:u($=>l.fg("toolOutput",$),"fallbackColor")},{maxWidthCells:d.widthCells});d.mimeType!=="image/png"&&W(()=>{this.invalidate(),this.ui.requestRender()}),this.imageComponents.push(x),this.imageSources.push(d),this.addChild(x)}}this.hasRendererDefinition()&&!e&&this.imageComponents.length===0&&(this.hideComponent=!0),this.syncActivityPulse()}syncActivityPulse(){if((!this.result||this.isPartial)&&!this.hideComponent){this.activityPulse||(this.activityPulse=new _(void 0,""));return}this.activityPulse?.dispose(),this.activityPulse=void 0}getTextOutput(){return L(this.result,this.showImages)}isBlankComponent(t){return t instanceof c?t.render(120).every(i=>i.trim()===""):!1}formatToolExecution(){const t=b(this.toolName),e=D(this.args);let i=l.fg("toolTitle",l.bold(t));e&&(i+=` ${l.fg("dim",e)}`);const n=this.getTextOutput();if(this.expanded||this.result?.isError)this.args&&this.expanded&&(i+=`
4
+ ${b(m("... (\u8FD8\u6709 {count} \u884C,"),{count:n})}`)} ${I("app.tools.expand",m("\u5C55\u5F00\u67E5\u770B"))}${l.fg("muted",")")}`),s?new c(s,0,0):void 0}updateArgs(t){this.args=t,this.argsPending=!0,this.ui.requestRender()}markExecutionStarted(){this.executionStarted=!0,this.updateDisplay(),this.ui.requestRender()}setArgsComplete(){this.argsComplete=!0,this.updateDisplay(),this.ui.requestRender()}updateResult(t,e=!1){this.result=t,this.isPartial=e,this.updateDisplay()}setExpanded(t){this.expanded=t,this.updateDisplay()}setOutputPad(t){this.outputPad=t,this.updateDisplay()}setShowImages(t){this.showImages=t,this.updateDisplay()}setImageWidthCells(t){this.imageWidthCells=Math.max(1,Math.floor(t)),this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}render(t){if(this.argsPending&&this.updateDisplay(),this.hideComponent||this.collapsedAway)return[];let e;if(this.hasRendererDefinition()&&this.getRenderShell()==="self"){const i=this.selfRenderContainer.render(t);if(this.imageComponents.length===0&&i.every(n=>n.trim()===""))return[];e=[],i.length>0&&e.push(...i);for(let n=0;n<this.imageComponents.length;n++){const s=this.imageSpacers[n];s&&e.push(...s.render(t));const r=this.imageComponents[n];r&&e.push(...r.render(t))}}else e=super.render(t);if(this.activityPulse&&e.length>0){const i=this.activityPulse.render(2)[0]??"";e[0]=y(`${i} ${e[0]}`,Math.max(1,t),l.fg("dim","..."))}return this.leadingStreak>0?[l.fg("dim",`${this.leadingStreak} ${m("\u4E2A\u5DE5\u5177")}`),...e]:e}updateDisplay(){this.argsPending=!1;const t=this.result?.isError&&!this.isPartial?s=>l.bg("toolErrorBg",s):void 0;let e=!1;if(this.hideComponent=!1,this.hasRendererDefinition()){const s=this.getRenderShell()==="self"?this.selfRenderContainer:this.contentBox;s instanceof R&&(s.setBgFn(t),s.setPaddingX(this.outputPad)),s.clear();let r;const a=this.getCallRenderer();if(!a)r=this.createCallFallback();else try{r=a(this.args,l,this.getRenderContext(this.callRendererComponent)),this.callRendererComponent=r}catch{this.callRendererComponent=void 0,r=this.createCallFallback()}let h;if(this.result){const p=this.getResultRenderer();if(!p)h=this.createResultFallback();else try{h=p({content:this.result.content,details:this.result.details},{expanded:this.expanded,isPartial:this.isPartial},l,this.getRenderContext(this.resultRendererComponent)),this.resultRendererComponent=h}catch{this.resultRendererComponent=void 0,h=this.createResultFallback()}h&&this.isBlankComponent(h)&&(h=void 0)}!this.expanded&&!this.result?.isError&&!!r&&r.render(240).length<=1&&r?(s.addChild(new H(r,h,this.focusMarker())),e=!0):(r&&(s.addChild(new j(r,this.focusMarker()||C)),e=!0),h&&(s.addChild(h),e=!0))}else this.contentText.setCustomBgFn(t),this.contentText.setPaddingX(this.outputPad),this.contentText.setText(this.formatToolExecution()),e=!0;const i=this.imageComponents,n=this.imageSources;for(const s of this.imageComponents)this.removeChild(s);this.imageComponents=[],this.imageSources=[];for(const s of this.imageSpacers)this.removeChild(s);if(this.imageSpacers=[],this.result){const s=this.result.content.filter(a=>a.type==="image"),r=O();for(const a of s)if(r.images&&this.showImages&&a.data&&a.mimeType){const h=new A(1);this.addChild(h),this.imageSpacers.push(h);const d={data:a.data,mimeType:a.mimeType,widthCells:this.imageWidthCells},p=this.imageComponents.length,g=n[p],x=g?.data===d.data&&g.mimeType===d.mimeType&&g.widthCells===d.widthCells?i[p]:new M(d.data,d.mimeType,{fallbackColor:u(F=>l.fg("toolOutput",F),"fallbackColor")},{maxWidthCells:d.widthCells});d.mimeType!=="image/png"&&N(()=>{this.invalidate(),this.ui.requestRender()}),this.imageComponents.push(x),this.imageSources.push(d),this.addChild(x)}}this.hasRendererDefinition()&&!e&&this.imageComponents.length===0&&(this.hideComponent=!0),this.syncActivityPulse()}syncActivityPulse(){if((!this.result||this.isPartial)&&!this.hideComponent){this.activityPulse||(this.activityPulse=new q(void 0,""));return}this.activityPulse?.dispose(),this.activityPulse=void 0}getTextOutput(){return W(this.result,this.showImages)}isBlankComponent(t){return t instanceof c?t.render(120).every(i=>i.trim()===""):!1}formatToolExecution(){const t=k(this.toolName),e=D(this.args);let i=l.fg("toolTitle",l.bold(t));e&&(i+=` ${l.fg("dim",e)}`);const n=this.getTextOutput();if(this.expanded||this.result?.isError)this.args&&this.expanded&&(i+=`
5
5
  ${l.fg("dim",JSON.stringify(this.args))}`),n&&(i+=`
6
- ${l.fg("toolOutput",n)}`);else if(n){const s=S(n);s>0&&(i+=P(l,[`${s} lines`]))}return i}}const H=3;function I(o){const t=o.isBlank;if(typeof t!="function")return!1;try{return t.call(o)===!0}catch{return!1}}u(I,"rendersNothing");function st(o,t="tail"){if(t==="all"){for(const n of o)n instanceof f&&n.setStreakPresentation(!1,0);let i=0;for(;i<o.length;){const n=K(o,i);if(n===null){i++;continue}w(n.members),i=Math.max(n.end,i+1)}return}const e=X(o);e.length>0&&w(e)}u(st,"foldQuietToolStreak");function w(o){if(!(o.length<H)){for(let t=0;t<o.length-1;t++)o[t].setStreakPresentation(!0,0);o[o.length-1].setStreakPresentation(!1,o.length-1)}}u(w,"applyRun");function K(o,t){const e=o[t];if(!(e instanceof f)||!e.isQuietFoldable())return null;const i=[e];let n=t+1,s=t+1;for(;s<o.length;){const r=o[s];if(r instanceof f&&r.isQuietFoldable()){i.push(r),s++,n=s;continue}if(!(r instanceof f)&&I(r)){s++;continue}break}return{members:i,end:n}}u(K,"collectRunFrom");function X(o){const t=[];for(let e=o.length-1;e>=0;e--){const i=o[e];if(i instanceof f&&i.isQuietFoldable()){t.unshift(i);continue}if(!(!(i instanceof f)&&I(i)))break}return t}u(X,"collectTrailingRun");export{f as ToolExecutionComponent,st as foldQuietToolStreak};
6
+ ${l.fg("toolOutput",n)}`);else if(n){const s=P(n);s>0&&(i+=S(l,[`${s} lines`]))}return i}}const K=3;function w(o){const t=o.isBlank;if(typeof t!="function")return!1;try{return t.call(o)===!0}catch{return!1}}u(w,"rendersNothing");function nt(o,t="tail"){if(t==="all"){for(const n of o)n instanceof f&&n.setStreakPresentation(!1,0);let i=0;for(;i<o.length;){const n=X(o,i);if(n===null){i++;continue}$(n.members),i=Math.max(n.end,i+1)}return}const e=J(o);e.length>0&&$(e)}u(nt,"foldQuietToolStreak");function $(o){if(!(o.length<K)){for(let t=0;t<o.length-1;t++)o[t].setStreakPresentation(!0,0);o[o.length-1].setStreakPresentation(!1,o.length-1)}}u($,"applyRun");function X(o,t){const e=o[t];if(!(e instanceof f)||!e.isQuietFoldable())return null;const i=[e];let n=t+1,s=t+1;for(;s<o.length;){const r=o[s];if(r instanceof f&&r.isQuietFoldable()){i.push(r),s++,n=s;continue}if(!(r instanceof f)&&w(r)){s++;continue}break}return{members:i,end:n}}u(X,"collectRunFrom");function J(o){const t=[];for(let e=o.length-1;e>=0;e--){const i=o[e];if(i instanceof f&&i.isQuietFoldable()){t.unshift(i);continue}if(!(!(i instanceof f)&&w(i)))break}return t}u(J,"collectTrailingRun");export{f as ToolExecutionComponent,nt as foldQuietToolStreak};
@@ -48,6 +48,7 @@ declare class TreeList implements Component {
48
48
  }
49
49
  export declare class TreeSelectorComponent extends Container implements Focusable {
50
50
  private treeList;
51
+ private searchLine;
51
52
  private labelInput;
52
53
  private labelInputContainer;
53
54
  private treeContainer;
@@ -59,6 +60,7 @@ export declare class TreeSelectorComponent extends Container implements Focusabl
59
60
  constructor(tree: SessionTreeNode[], currentLeafId: string | null, terminalHeight: number, onSelect: (entryId: string) => void, onCancel: () => void, onLabelChange?: (entryId: string, label: string | undefined) => void, initialSelectedId?: string, initialFilterMode?: FilterMode);
60
61
  private showLabelInput;
61
62
  private hideLabelInput;
63
+ get capturesViewportInput(): boolean;
62
64
  handleInput(keyData: string): void;
63
65
  getTreeList(): TreeList;
64
66
  }
@@ -1 +1 @@
1
- var z=Object.defineProperty;var b=(u,s)=>z(u,"name",{value:s,configurable:!0});import{Container as B,getKeybindings as P,Input as K,Spacer as W,sliceByColumn as Y,Text as X,truncateToWidth as w,visibleWidth as v,wrapTextWithAnsi as Q}from"@earendil-works/pi-tui";import{formatReadLineRange as G}from"../../../core/tools/render-utils.js";import{fill as S,t as h}from"../../../dal/i18n.js";import{theme as d}from"../theme/theme.js";import{chromeBottom as J,chromeTop as q,DynamicBorder as Z}from"./dynamic-border.js";import{formatKeyText as D,keyHint as U}from"./keybinding-hints.js";const ee=2,te=4,se=20,ne=2,ie=12;function le(u,s){const t=Math.max(0,s-ee),e=u.reduce((l,o)=>Math.max(l,o.bodyWidth),0),n=Math.max(0,e-t),i=u.find(l=>l.isSelected);let a=0;if(i&&n>0){const l=Math.min(se,Math.max(te,Math.floor(t/3)));if(i.anchorCol>t-l){const o=Math.min(ie,Math.max(ne,Math.floor(t/4)));a=Math.min(n,i.anchorCol-o)}}return u.map(l=>{const o=a>0?`${l.gutter}${Y(l.body,a,t,!0)}\x1B[0m`:l.gutter+l.body;return w(o,s,"")})}b(le,"renderHorizontalViewport");class oe{static{b(this,"TreeList")}flatNodes=[];filteredNodes=[];selectedIndex=0;currentLeafId;maxVisibleLines;filterMode="default";searchQuery="";toolCallMap=new Map;multipleRoots=!1;showLabelTimestamps=!1;activePathIds=new Set;visibleParentMap=new Map;visibleChildrenMap=new Map;lastSelectedId=null;foldedNodes=new Set;onSelect;onCancel;onCopy;onLabelEdit;constructor(s,t,e,n,i){this.currentLeafId=t,this.maxVisibleLines=e,this.filterMode=i??"default",this.multipleRoots=s.length>1,this.flatNodes=this.flattenTree(s),this.buildActivePath(),this.applyFilter();const a=n??t;this.selectedIndex=this.findNearestVisibleIndex(a),this.lastSelectedId=this.filteredNodes[this.selectedIndex]?.node.entry.id??null}findNearestVisibleIndex(s){if(this.filteredNodes.length===0)return 0;const t=new Map;for(const i of this.flatNodes)t.set(i.node.entry.id,i);const e=new Map(this.filteredNodes.map((i,a)=>[i.node.entry.id,a]));let n=s;for(;n!==null;){const i=e.get(n);if(i!==void 0)return i;const a=t.get(n);if(!a)break;n=a.node.entry.parentId??null}return this.filteredNodes.length-1}buildActivePath(){if(this.activePathIds.clear(),!this.currentLeafId)return;const s=new Map;for(const e of this.flatNodes)s.set(e.node.entry.id,e);let t=this.currentLeafId;for(;t;){this.activePathIds.add(t);const e=s.get(t);if(!e)break;t=e.node.entry.parentId??null}}flattenTree(s){const t=[];this.toolCallMap.clear();const e=[],n=new Map,i=this.currentLeafId;{const o=[],r=[...s];for(;r.length>0;){const c=r.pop();o.push(c);for(let f=c.children.length-1;f>=0;f--)r.push(c.children[f])}for(let c=o.length-1;c>=0;c--){const f=o[c];let I=i!==null&&f.entry.id===i;for(const C of f.children)n.get(C)&&(I=!0);n.set(f,I)}}const a=s.length>1,l=[...s].sort((o,r)=>Number(n.get(r))-Number(n.get(o)));for(let o=l.length-1;o>=0;o--){const r=o===l.length-1;e.push([l[o],a?1:0,a,a,r,[],a])}for(;e.length>0;){const[o,r,c,f,I,C,$]=e.pop(),g=o.entry;if(g.type==="message"&&g.message.role==="assistant"){const p=g.message.content;if(Array.isArray(p)){for(const m of p)if(typeof m=="object"&&m!==null&&"type"in m&&m.type==="toolCall"){const L=m;this.toolCallMap.set(L.id,{name:L.name,arguments:L.arguments})}}}t.push({node:o,indent:r,showConnector:f,isLast:I,gutters:C,isVirtualRootChild:$});const y=o.children,M=y.length>1,N=(()=>{const p=[],m=[];for(const L of y)n.get(L)?p.push(L):m.push(L);return[...p,...m]})();let x;M||c&&r>0?x=r+1:x=r;const R=f&&!$,T=this.multipleRoots?Math.max(0,r-1):r,_=Math.max(0,T-1),k=R?[...C,{position:_,show:!I}]:C;for(let p=N.length-1;p>=0;p--){const m=p===N.length-1;e.push([N[p],x,M,M,m,k,!1])}}return t}applyFilter(){this.filteredNodes.length>0&&(this.lastSelectedId=this.filteredNodes[this.selectedIndex]?.node.entry.id??this.lastSelectedId);const s=this.searchQuery.toLowerCase().split(/\s+/).filter(Boolean);if(this.filteredNodes=this.flatNodes.filter(t=>{const e=t.node.entry;if(e.type==="usage")return!1;const n=e.id===this.currentLeafId;if(e.type==="message"&&e.message.role==="assistant"&&!n){const l=e.message,o=this.hasTextContent(l.content),r=l.stopReason&&l.stopReason!=="stop"&&l.stopReason!=="toolUse";if(!o&&!r)return!1}let i=!0;const a=e.type==="label"||e.type==="context_edit"||e.type==="custom"||e.type==="model_change"||e.type==="thinking_level_change"||e.type==="session_info";switch(this.filterMode){case"user-only":i=e.type==="message"&&e.message.role==="user";break;case"no-tools":i=!a&&!(e.type==="message"&&e.message.role==="toolResult");break;case"labeled-only":i=t.node.label!==void 0;break;case"all":i=!0;break;default:i=!a;break}if(!i)return!1;if(s.length>0){const l=this.getSearchableText(t.node).toLowerCase();return s.every(o=>l.includes(o))}return!0}),this.foldedNodes.size>0){const t=new Set;for(const e of this.flatNodes){const{id:n,parentId:i}=e.node.entry;i!=null&&(this.foldedNodes.has(i)||t.has(i))&&t.add(n)}this.filteredNodes=this.filteredNodes.filter(e=>!t.has(e.node.entry.id))}this.recalculateVisualStructure(),this.lastSelectedId?this.selectedIndex=this.findNearestVisibleIndex(this.lastSelectedId):this.selectedIndex>=this.filteredNodes.length&&(this.selectedIndex=Math.max(0,this.filteredNodes.length-1)),this.filteredNodes.length>0&&(this.lastSelectedId=this.filteredNodes[this.selectedIndex]?.node.entry.id??this.lastSelectedId)}recalculateVisualStructure(){if(this.filteredNodes.length===0)return;const s=new Set(this.filteredNodes.map(r=>r.node.entry.id)),t=new Map;for(const r of this.flatNodes)t.set(r.node.entry.id,r);const e=b(r=>{let c=t.get(r)?.node.entry.parentId??null;for(;c!==null;){if(s.has(c))return c;c=t.get(c)?.node.entry.parentId??null}return null},"findVisibleAncestor"),n=new Map,i=new Map;i.set(null,[]);for(const r of this.filteredNodes){const c=r.node.entry.id,f=e(c);n.set(c,f),i.has(f)||i.set(f,[]),i.get(f).push(c)}const a=i.get(null);this.multipleRoots=a.length>1;const l=new Map;for(const r of this.filteredNodes)l.set(r.node.entry.id,r);const o=[];for(let r=a.length-1;r>=0;r--){const c=r===a.length-1;o.push([a[r],this.multipleRoots?1:0,this.multipleRoots,this.multipleRoots,c,[],this.multipleRoots])}for(;o.length>0;){const[r,c,f,I,C,$,g]=o.pop(),y=l.get(r);if(!y)continue;y.indent=c,y.showConnector=I,y.isLast=C,y.gutters=$,y.isVirtualRootChild=g;const M=i.get(r)||[],N=M.length>1;let x;N||f&&c>0?x=c+1:x=c;const R=I&&!g,T=this.multipleRoots?Math.max(0,c-1):c,_=Math.max(0,T-1),k=R?[...$,{position:_,show:!C}]:$;for(let p=M.length-1;p>=0;p--){const m=p===M.length-1;o.push([M[p],x,N,N,m,k,!1])}}this.visibleParentMap=n,this.visibleChildrenMap=i}getSearchableText(s){const t=s.entry,e=[];switch(s.label&&e.push(s.label),t.type){case"message":{const n=t.message;if(e.push(n.role),"content"in n&&n.content&&e.push(this.extractContent(n.content)),n.role==="bashExecution"){const i=n;i.command&&e.push(i.command)}break}case"custom_message":{e.push(t.customType),typeof t.content=="string"?e.push(t.content):e.push(this.extractContent(t.content));break}case"compaction":e.push("compaction");break;case"branch_summary":e.push("branch summary",t.summary);break;case"session_info":e.push("title"),t.name&&e.push(t.name);break;case"model_change":e.push("model",t.modelId);break;case"thinking_level_change":e.push("thinking",t.thinkingLevel);break;case"custom":e.push("custom",t.customType);break;case"context_edit":e.push("context edit",t.replacement===null?"omit":"replace",t.targetId);break;case"label":e.push("label",t.label??"");break}return e.join(" ")}invalidate(){}getSearchQuery(){return this.searchQuery}getSelectedNode(){return this.filteredNodes[this.selectedIndex]?.node}copySelected(){const s=this.getSelectedNode();this.onCopy?.(s?this.getEntryCopyText(s):void 0)}updateNodeLabel(s,t,e){for(const n of this.flatNodes)if(n.node.entry.id===s){n.node.label=t,n.node.labelTimestamp=t?e??new Date().toISOString():void 0;break}}getStatusLabels(){let s="";switch(this.filterMode){case"no-tools":s+=" [no-tools]";break;case"user-only":s+=" [user]";break;case"labeled-only":s+=" [labeled]";break;case"all":s+=" [all]";break}return this.showLabelTimestamps&&(s+=` [+${h("\u6807\u7B7E\u65F6\u95F4")}]`),s}render(s){const t=[];if(this.filteredNodes.length===0)return t.push(w(d.fg("muted",` ${h("\u6CA1\u6709\u627E\u5230\u6761\u76EE")}`),s)),t.push(w(d.fg("muted",` (0/0)${this.getStatusLabels()}`),s)),t;const e=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisibleLines/2),this.filteredNodes.length-this.maxVisibleLines)),n=Math.min(e+this.maxVisibleLines,this.filteredNodes.length),i=[];for(let a=e;a<n;a++){const l=this.filteredNodes[a],o=l.node.entry,r=a===this.selectedIndex,c=r?d.fg("accent","\u203A "):" ",f=this.multipleRoots?Math.max(0,l.indent-1):l.indent,I=l.showConnector&&!l.isVirtualRootChild?l.isLast?"\u2514\u2500 ":"\u251C\u2500 ":"",C=I?f-1:-1,$=f*3,g=[],y=this.foldedNodes.has(o.id);for(let E=0;E<$;E++){const H=Math.floor(E/3),A=E%3,j=l.gutters.find(V=>V.position===H);if(j)A===0?g.push(j.show?"\u2502":" "):g.push(" ");else if(I&&H===C)if(A===0)g.push(l.isLast?"\u2514":"\u251C");else if(A===1){const V=this.isFoldable(o.id);g.push(y?"\u229E":V?"\u229F":"\u2500")}else g.push(" ");else g.push(" ")}const M=g.join(""),N=l.showConnector&&!l.isVirtualRootChild,x=y&&!N?d.fg("accent","\u229E "):"",T=this.activePathIds.has(o.id)?d.fg("accent","\u2022 "):"",_=l.node.label?d.fg("warning",`[${l.node.label}] `):"",k=this.showLabelTimestamps&&l.node.label&&l.node.labelTimestamp?d.fg("muted",`${this.formatLabelTimestamp(l.node.labelTimestamp)} `):"",p=this.getEntryDisplayText(l.node,r),m=d.fg("dim",M)+x+T,L=v(m);let O=c,F=m+_+k+p;r&&(O=d.bg("selectedBg",O),F=d.bg("selectedBg",F)),i.push({gutter:O,body:F,anchorCol:L,bodyWidth:v(F),isSelected:r})}return t.push(...le(i,s)),t.push(w(d.fg("muted",` (${this.selectedIndex+1}/${this.filteredNodes.length})${this.getStatusLabels()}`),s)),t}getEntryDisplayText(s,t){const e=s.entry;let n;const i=b(a=>a.replace(/[\n\t]/g," ").trim(),"normalize");switch(e.type){case"message":{const a=e.message,l=a.role;if(l==="user"){const o=a,r=i(this.extractContent(o.content));n=d.fg("accent",h("\u7528\u6237\u6D88\u606F\uFF1A"))+r}else if(l==="assistant"){const o=a,r=i(this.extractContent(o.content));if(r)n=d.fg("success",h("AI\uFF1A"))+r;else if(o.stopReason==="aborted")n=d.fg("success",h("AI\uFF1A"))+d.fg("muted",h("\uFF08\u5DF2\u4E2D\u65AD\uFF09"));else if(o.errorMessage){const c=i(o.errorMessage).slice(0,80);n=d.fg("success",h("AI\uFF1A"))+d.fg("error",c)}else n=d.fg("success",h("AI\uFF1A"))+d.fg("muted",h("\uFF08\u65E0\u5185\u5BB9\uFF09"))}else if(l==="toolResult"){const o=a,r=o.toolCallId?this.toolCallMap.get(o.toolCallId):void 0;r?n=d.fg("muted",this.formatToolCall(r.name,r.arguments)):n=d.fg("muted",`[${o.toolName??"tool"}]`)}else if(l==="bashExecution"){const o=a;n=d.fg("dim",`[bash]: ${i(o.command??"")}`)}else n=d.fg("dim",`[${l}]`);break}case"custom_message":{const a=typeof e.content=="string"?e.content:e.content.filter(l=>l.type==="text").map(l=>l.text).join("");n=d.fg("customMessageLabel",`[${e.customType}]: `)+i(a);break}case"compaction":{const a=Math.round(e.tokensBefore/1e3);n=d.fg("borderAccent",`[${S(h("\u538B\u7F29\uFF1A{tokens}k tokens"),{tokens:a})}]`);break}case"branch_summary":n=d.fg("warning",`[${h("\u5206\u652F\u6458\u8981\u8BB0\u5F55")}]: `)+i(e.summary);break;case"model_change":n=d.fg("dim",`[${S(h("\u6A21\u578B\uFF1A{model}"),{model:e.modelId})}]`);break;case"thinking_level_change":n=d.fg("dim",`[${S(h("\u601D\u8003\uFF1A{level}"),{level:e.thinkingLevel})}]`);break;case"custom":n=d.fg("dim",`[${S(h("\u81EA\u5B9A\u4E49\uFF1A{type}"),{type:e.customType})}]`);break;case"context_edit":n=d.fg("dim",`[${S(e.replacement===null?h("\u4E0A\u4E0B\u6587\u7701\u7565\uFF1A{target}"):h("\u4E0A\u4E0B\u6587\u66FF\u6362\uFF1A{target}"),{target:e.targetId})}]`);break;case"label":n=d.fg("dim",`[${S(h("\u6807\u7B7E\uFF1A{label}"),{label:e.label??h("\uFF08\u5DF2\u6E05\u9664\uFF09")})}]`);break;case"session_info":n=e.name?[d.fg("dim","[title: "),d.fg("dim",e.name),d.fg("dim","]")].join(""):[d.fg("dim","[title: "),d.italic(d.fg("dim","empty")),d.fg("dim","]")].join("");break;default:n=""}return t?d.bold(n):n}formatLabelTimestamp(s){const t=new Date(s),e=new Date,n=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0"),a=`${n}:${i}`;if(t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate())return a;const l=t.getMonth()+1,o=t.getDate();return t.getFullYear()===e.getFullYear()?`${l}/${o} ${a}`:`${t.getFullYear().toString().slice(-2)}/${l}/${o} ${a}`}extractContent(s){return this.extractFullContent(s).slice(0,200)}extractFullContent(s){if(typeof s=="string")return s;if(!Array.isArray(s))return"";let t="";for(const e of s)typeof e=="object"&&e!==null&&"type"in e&&e.type==="text"&&(t+=e.text);return t}getEntryCopyText(s){const t=s.entry;let e;switch(t.type){case"message":t.message.role==="bashExecution"?e=t.message.command:"content"in t.message&&(e=this.extractFullContent(t.message.content),!e&&t.message.role==="assistant"&&(e=t.message.errorMessage));break;case"custom_message":e=this.extractFullContent(t.content);break;case"compaction":e=t.summary;break;case"branch_summary":e=t.summary;break}return e?.trim()?e:void 0}hasTextContent(s){if(typeof s=="string")return s.trim().length>0;if(Array.isArray(s)){for(const t of s)if(typeof t=="object"&&t!==null&&"type"in t&&t.type==="text"){const e=t.text;if(e&&e.trim().length>0)return!0}}return!1}formatToolCall(s,t){const e=b(n=>{const i=process.env.HOME||process.env.USERPROFILE||"";return i&&n.startsWith(i)?`~${n.slice(i.length)}`:n},"shortenPath");switch(s){case"read":return`[read: ${e(String(t.path||t.file_path||""))}${G(t.offset,t.limit)}]`;case"write":return`[write: ${e(String(t.path||t.file_path||""))}]`;case"edit":return`[edit: ${e(String(t.path||t.file_path||""))}]`;case"bash":{const n=String(t.command||"");return`[bash: ${n.replace(/[\n\t]/g," ").trim().slice(0,50)}${n.length>50?"...":""}]`}case"grep":{const n=String(t.pattern||""),i=e(String(t.path||"."));return`[grep: /${n}/ in ${i}]`}case"find":{const n=String(t.pattern||""),i=e(String(t.path||"."));return`[find: ${n} in ${i}]`}case"ls":return`[ls: ${e(String(t.path||"."))}]`;default:{const n=JSON.stringify(t).slice(0,40);return`[${s}: ${n}${JSON.stringify(t).length>40?"...":""}]`}}}handleInput(s){const t=P();if(t.matches(s,"tui.select.up"))this.selectedIndex=this.selectedIndex===0?this.filteredNodes.length-1:this.selectedIndex-1;else if(t.matches(s,"tui.select.down"))this.selectedIndex=this.selectedIndex===this.filteredNodes.length-1?0:this.selectedIndex+1;else if(t.matches(s,"app.tree.foldOrUp")){const e=this.filteredNodes[this.selectedIndex]?.node.entry.id;e&&this.isFoldable(e)&&!this.foldedNodes.has(e)?(this.foldedNodes.add(e),this.applyFilter()):this.selectedIndex=this.findBranchSegmentStart("up")}else if(t.matches(s,"app.tree.unfoldOrDown")){const e=this.filteredNodes[this.selectedIndex]?.node.entry.id;e&&this.foldedNodes.has(e)?(this.foldedNodes.delete(e),this.applyFilter()):this.selectedIndex=this.findBranchSegmentStart("down")}else if(t.matches(s,"tui.editor.cursorLeft")||t.matches(s,"tui.select.pageUp"))this.selectedIndex=Math.max(0,this.selectedIndex-this.maxVisibleLines);else if(t.matches(s,"tui.editor.cursorRight")||t.matches(s,"tui.select.pageDown"))this.selectedIndex=Math.min(this.filteredNodes.length-1,this.selectedIndex+this.maxVisibleLines);else if(t.matches(s,"tui.select.confirm")){const e=this.filteredNodes[this.selectedIndex];e&&this.onSelect&&this.onSelect(e.node.entry.id)}else if(t.matches(s,"app.message.copy"))this.copySelected();else if(t.matches(s,"tui.select.cancel"))this.searchQuery?(this.searchQuery="",this.foldedNodes.clear(),this.applyFilter()):this.onCancel?.();else if(t.matches(s,"app.tree.filter.default"))this.filterMode="default",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.noTools"))this.filterMode=this.filterMode==="no-tools"?"default":"no-tools",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.userOnly"))this.filterMode=this.filterMode==="user-only"?"default":"user-only",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.labeledOnly"))this.filterMode=this.filterMode==="labeled-only"?"default":"labeled-only",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.all"))this.filterMode=this.filterMode==="all"?"default":"all",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.cycleBackward")){const e=["default","no-tools","user-only","labeled-only","all"],n=e.indexOf(this.filterMode);this.filterMode=e[(n-1+e.length)%e.length],this.foldedNodes.clear(),this.applyFilter()}else if(t.matches(s,"app.tree.filter.cycleForward")){const e=["default","no-tools","user-only","labeled-only","all"],n=e.indexOf(this.filterMode);this.filterMode=e[(n+1)%e.length],this.foldedNodes.clear(),this.applyFilter()}else if(t.matches(s,"tui.editor.deleteCharBackward"))this.searchQuery.length>0&&(this.searchQuery=this.searchQuery.slice(0,-1),this.foldedNodes.clear(),this.applyFilter());else if(t.matches(s,"app.tree.editLabel")){const e=this.filteredNodes[this.selectedIndex];e&&this.onLabelEdit&&this.onLabelEdit(e.node.entry.id,e.node.label)}else t.matches(s,"app.tree.toggleLabelTimestamp")?this.showLabelTimestamps=!this.showLabelTimestamps:![...s].some(n=>{const i=n.charCodeAt(0);return i<32||i===127||i>=128&&i<=159})&&s.length>0&&(this.searchQuery+=s,this.foldedNodes.clear(),this.applyFilter())}isFoldable(s){const t=this.visibleChildrenMap.get(s);if(!t||t.length===0)return!1;const e=this.visibleParentMap.get(s);if(e==null)return!0;const n=this.visibleChildrenMap.get(e);return n!==void 0&&n.length>1}findBranchSegmentStart(s){const t=this.filteredNodes[this.selectedIndex]?.node.entry.id;if(!t)return this.selectedIndex;const e=new Map(this.filteredNodes.map((i,a)=>[i.node.entry.id,a]));let n=t;if(s==="down")for(;;){const i=this.visibleChildrenMap.get(n)??[];if(i.length===0)return e.get(n);if(i.length>1)return e.get(i[0]);n=i[0]}for(;;){const i=this.visibleParentMap.get(n)??null;if(i===null)return e.get(n);if((this.visibleChildrenMap.get(i)??[]).length>1){const l=e.get(n);if(l<this.selectedIndex)return l}n=i}}}class re{static{b(this,"SearchLine")}treeList;constructor(s){this.treeList=s}invalidate(){}render(s){const t=this.treeList.getSearchQuery();return t?[w(` ${d.fg("muted",h("\u8F93\u5165\u6587\u5B57\u641C\u7D22\uFF1A"))} ${d.fg("accent",t)}`,s)]:[w(` ${d.fg("muted",h("\u8F93\u5165\u6587\u5B57\u641C\u7D22\uFF1A"))}`,s)]}handleInput(s){}}class ae{static{b(this,"TreeHelp")}invalidate(){}render(s){const t=de().map(({keys:o,label:r,labelFirst:c})=>{const f=ce(o);return f?c?`${r} ${f}`:`${f} ${r}`:r}),e=Math.max(1,s),n=" ",i=" \xB7 ",a=[];let l="";for(const o of t){const r=l?`${l}${i}${o}`:v(`${n}${o}`)<=e?`${n}${o}`:o;if(!l||v(r)<=e){l=r;continue}a.push(...Q(l.trimEnd(),e)),l=v(`${n}${o}`)<=e?`${n}${o}`:o}return l&&a.push(...Q(l.trimEnd(),e)),a.map(o=>d.fg("muted",o))}}const de=b(()=>[{keys:["tui.select.up","tui.select.down"],label:h("\u79FB\u52A8")},{keys:["tui.editor.cursorLeft","tui.editor.cursorRight"],label:h("\u7FFB\u9875")},{keys:["app.tree.foldOrUp","app.tree.unfoldOrDown"],label:h("\u5206\u652F")},{keys:["app.message.copy"],label:h("\u590D\u5236")},{keys:["app.tree.editLabel"],label:h("\u6807\u7B7E")},{keys:["app.tree.toggleLabelTimestamp"],label:h("\u6807\u7B7E\u65F6\u95F4")},{keys:["app.tree.filter.default","app.tree.filter.noTools","app.tree.filter.userOnly","app.tree.filter.labeledOnly","app.tree.filter.all"],label:h("\u7B5B\u9009"),labelFirst:!0},{keys:["app.tree.filter.cycleForward","app.tree.filter.cycleBackward"],label:h("\u8F6E\u6362"),labelFirst:!0}],"treeHelpItems");function ce(u){const s=[];for(const t of u){const e=P().getKeys(t)[0];e!==void 0&&s.push(e)}return s.length===0?"":D(he(s)).replace(/\bpageUp\b/g,"pgup").replace(/\bpageDown\b/g,"pgdn").replace(/\bup\b/g,"\u2191").replace(/\bdown\b/g,"\u2193").replace(/\bleft\b/g,"\u2190").replace(/\bright\b/g,"\u2192")}b(ce,"formatHelpKeys");function he(u){if(u.length===1)return u[0];const s=u.map(e=>{const n=e.lastIndexOf("+");return n===-1?{prefix:"",suffix:e}:{prefix:e.slice(0,n+1),suffix:e.slice(n+1)}}),t=s[0].prefix;return t&&s.every(e=>e.prefix===t)?`${t}${s.map(e=>e.suffix).join("/")}`:u.join("/")}b(he,"compactRawKeys");class fe{static{b(this,"LabelInput")}input;entryId;onSubmit;onCancel;_focused=!1;get focused(){return this._focused}set focused(s){this._focused=s,this.input.focused=s}constructor(s,t){this.entryId=s,this.input=new K,t&&this.input.setValue(t)}invalidate(){}render(s){const t=[],n=s-2;return t.push(w(` ${d.fg("muted",h("\u6807\u7B7E\uFF08\u7559\u7A7A\u5373\u5220\u9664\uFF09\uFF1A"))}`,s)),t.push(...this.input.render(n).map(i=>w(` ${i}`,s))),t.push(w(` ${U("tui.select.confirm",h("\u4FDD\u5B58"))} ${U("tui.select.cancel",h("\u53D6\u6D88\u7F16\u8F91"))}`,s)),t}handleInput(s){const t=P();if(t.matches(s,"tui.select.confirm")){const e=this.input.getValue().trim();this.onSubmit?.(this.entryId,e||void 0)}else t.matches(s,"tui.select.cancel")?this.onCancel?.():this.input.handleInput(s)}}class xe extends B{static{b(this,"TreeSelectorComponent")}treeList;labelInput=null;labelInputContainer;treeContainer;onLabelChangeCallback;onCopy;_focused=!1;get focused(){return this._focused}set focused(s){this._focused=s,this.labelInput&&(this.labelInput.focused=s)}constructor(s,t,e,n,i,a,l,o){super(),this.onLabelChangeCallback=a;const r=Math.max(5,Math.floor(e/2));this.treeList=new oe(s,t,r,l,o),this.treeList.onSelect=n,this.treeList.onCancel=i,this.treeList.onCopy=c=>this.onCopy?.(c),this.treeList.onLabelEdit=(c,f)=>this.showLabelInput(c,f),this.treeContainer=new B,this.treeContainer.addChild(this.treeList),this.labelInputContainer=new B,this.addChild(new W(1)),this.addChild(q(h("\u4F1A\u8BDD\u6811"))),this.addChild(new X(d.bold(` ${h("\u6D4F\u89C8\u4F1A\u8BDD\u6811")}`),1,0)),this.addChild(new ae),this.addChild(new re(this.treeList)),this.addChild(new Z),this.addChild(new W(1)),this.addChild(this.treeContainer),this.addChild(this.labelInputContainer),this.addChild(new W(1)),this.addChild(J()),s.length===0&&setTimeout(()=>i(),100)}showLabelInput(s,t){this.labelInput=new fe(s,t),this.labelInput.onSubmit=(e,n)=>{this.treeList.updateNodeLabel(e,n),this.onLabelChangeCallback?.(e,n),this.hideLabelInput()},this.labelInput.onCancel=()=>this.hideLabelInput(),this.labelInput.focused=this._focused,this.treeContainer.clear(),this.labelInputContainer.clear(),this.labelInputContainer.addChild(this.labelInput)}hideLabelInput(){this.labelInput=null,this.labelInputContainer.clear(),this.treeContainer.clear(),this.treeContainer.addChild(this.treeList)}handleInput(s){this.labelInput?this.labelInput.handleInput(s):this.treeList.handleInput(s)}getTreeList(){return this.treeList}}export{xe as TreeSelectorComponent};
1
+ var z=Object.defineProperty;var b=(u,s)=>z(u,"name",{value:s,configurable:!0});import{Container as P,CURSOR_MARKER as K,getKeybindings as B,Input as Y,Spacer as H,sliceByColumn as X,Text as G,truncateToWidth as w,visibleWidth as v,wrapTextWithAnsi as Q}from"@earendil-works/pi-tui";import{formatReadLineRange as J}from"../../../core/tools/render-utils.js";import{fill as S,t as h}from"../../../dal/i18n.js";import{shortenHomePath as q}from"../../../utils/paths.js";import{theme as d}from"../theme/theme.js";import{chromeBottom as Z,chromeTop as D,DynamicBorder as ee}from"./dynamic-border.js";import{formatKeyText as te,keyHint as U}from"./keybinding-hints.js";const se=2,ne=4,ie=20,le=2,oe=12;function re(u,s){const t=Math.max(0,s-se),e=u.reduce((l,o)=>Math.max(l,o.bodyWidth),0),n=Math.max(0,e-t),i=u.find(l=>l.isSelected);let a=0;if(i&&n>0){const l=Math.min(ie,Math.max(ne,Math.floor(t/3)));if(i.anchorCol>t-l){const o=Math.min(oe,Math.max(le,Math.floor(t/4)));a=Math.min(n,i.anchorCol-o)}}return u.map(l=>{const o=a>0?`${l.gutter}${X(l.body,a,t,!0)}\x1B[0m`:l.gutter+l.body;return w(o,s,"")})}b(re,"renderHorizontalViewport");class ae{static{b(this,"TreeList")}flatNodes=[];filteredNodes=[];selectedIndex=0;currentLeafId;maxVisibleLines;filterMode="default";searchQuery="";toolCallMap=new Map;multipleRoots=!1;showLabelTimestamps=!1;activePathIds=new Set;visibleParentMap=new Map;visibleChildrenMap=new Map;lastSelectedId=null;foldedNodes=new Set;onSelect;onCancel;onCopy;onLabelEdit;constructor(s,t,e,n,i){this.currentLeafId=t,this.maxVisibleLines=e,this.filterMode=i??"default",this.multipleRoots=s.length>1,this.flatNodes=this.flattenTree(s),this.buildActivePath(),this.applyFilter();const a=n??t;this.selectedIndex=this.findNearestVisibleIndex(a),this.lastSelectedId=this.filteredNodes[this.selectedIndex]?.node.entry.id??null}findNearestVisibleIndex(s){if(this.filteredNodes.length===0)return 0;const t=new Map;for(const i of this.flatNodes)t.set(i.node.entry.id,i);const e=new Map(this.filteredNodes.map((i,a)=>[i.node.entry.id,a]));let n=s;for(;n!==null;){const i=e.get(n);if(i!==void 0)return i;const a=t.get(n);if(!a)break;n=a.node.entry.parentId??null}return this.filteredNodes.length-1}buildActivePath(){if(this.activePathIds.clear(),!this.currentLeafId)return;const s=new Map;for(const e of this.flatNodes)s.set(e.node.entry.id,e);let t=this.currentLeafId;for(;t;){this.activePathIds.add(t);const e=s.get(t);if(!e)break;t=e.node.entry.parentId??null}}flattenTree(s){const t=[];this.toolCallMap.clear();const e=[],n=new Map,i=this.currentLeafId;{const o=[],r=[...s];for(;r.length>0;){const c=r.pop();o.push(c);for(let f=c.children.length-1;f>=0;f--)r.push(c.children[f])}for(let c=o.length-1;c>=0;c--){const f=o[c];let I=i!==null&&f.entry.id===i;for(const C of f.children)n.get(C)&&(I=!0);n.set(f,I)}}const a=s.length>1,l=[...s].sort((o,r)=>Number(n.get(r))-Number(n.get(o)));for(let o=l.length-1;o>=0;o--){const r=o===l.length-1;e.push([l[o],a?1:0,a,a,r,[],a])}for(;e.length>0;){const[o,r,c,f,I,C,$]=e.pop(),g=o.entry;if(g.type==="message"&&g.message.role==="assistant"){const p=g.message.content;if(Array.isArray(p)){for(const m of p)if(typeof m=="object"&&m!==null&&"type"in m&&m.type==="toolCall"){const L=m;this.toolCallMap.set(L.id,{name:L.name,arguments:L.arguments})}}}t.push({node:o,indent:r,showConnector:f,isLast:I,gutters:C,isVirtualRootChild:$});const y=o.children,M=y.length>1,N=(()=>{const p=[],m=[];for(const L of y)n.get(L)?p.push(L):m.push(L);return[...p,...m]})();let x;M||c&&r>0?x=r+1:x=r;const R=f&&!$,T=this.multipleRoots?Math.max(0,r-1):r,_=Math.max(0,T-1),k=R?[...C,{position:_,show:!I}]:C;for(let p=N.length-1;p>=0;p--){const m=p===N.length-1;e.push([N[p],x,M,M,m,k,!1])}}return t}applyFilter(){this.filteredNodes.length>0&&(this.lastSelectedId=this.filteredNodes[this.selectedIndex]?.node.entry.id??this.lastSelectedId);const s=this.searchQuery.toLowerCase().split(/\s+/).filter(Boolean);if(this.filteredNodes=this.flatNodes.filter(t=>{const e=t.node.entry;if(e.type==="usage")return!1;const n=e.id===this.currentLeafId;if(e.type==="message"&&e.message.role==="assistant"&&!n){const l=e.message,o=this.hasTextContent(l.content),r=l.stopReason&&l.stopReason!=="stop"&&l.stopReason!=="toolUse";if(!o&&!r)return!1}let i=!0;const a=e.type==="label"||e.type==="context_edit"||e.type==="custom"||e.type==="model_change"||e.type==="thinking_level_change"||e.type==="session_info";switch(this.filterMode){case"user-only":i=e.type==="message"&&e.message.role==="user";break;case"no-tools":i=!a&&!(e.type==="message"&&e.message.role==="toolResult");break;case"labeled-only":i=t.node.label!==void 0;break;case"all":i=!0;break;default:i=!a;break}if(!i)return!1;if(s.length>0){const l=this.getSearchableText(t.node).toLowerCase();return s.every(o=>l.includes(o))}return!0}),this.foldedNodes.size>0){const t=new Set;for(const e of this.flatNodes){const{id:n,parentId:i}=e.node.entry;i!=null&&(this.foldedNodes.has(i)||t.has(i))&&t.add(n)}this.filteredNodes=this.filteredNodes.filter(e=>!t.has(e.node.entry.id))}this.recalculateVisualStructure(),this.lastSelectedId?this.selectedIndex=this.findNearestVisibleIndex(this.lastSelectedId):this.selectedIndex>=this.filteredNodes.length&&(this.selectedIndex=Math.max(0,this.filteredNodes.length-1)),this.filteredNodes.length>0&&(this.lastSelectedId=this.filteredNodes[this.selectedIndex]?.node.entry.id??this.lastSelectedId)}recalculateVisualStructure(){if(this.filteredNodes.length===0)return;const s=new Set(this.filteredNodes.map(r=>r.node.entry.id)),t=new Map;for(const r of this.flatNodes)t.set(r.node.entry.id,r);const e=b(r=>{let c=t.get(r)?.node.entry.parentId??null;for(;c!==null;){if(s.has(c))return c;c=t.get(c)?.node.entry.parentId??null}return null},"findVisibleAncestor"),n=new Map,i=new Map;i.set(null,[]);for(const r of this.filteredNodes){const c=r.node.entry.id,f=e(c);n.set(c,f),i.has(f)||i.set(f,[]),i.get(f).push(c)}const a=i.get(null);this.multipleRoots=a.length>1;const l=new Map;for(const r of this.filteredNodes)l.set(r.node.entry.id,r);const o=[];for(let r=a.length-1;r>=0;r--){const c=r===a.length-1;o.push([a[r],this.multipleRoots?1:0,this.multipleRoots,this.multipleRoots,c,[],this.multipleRoots])}for(;o.length>0;){const[r,c,f,I,C,$,g]=o.pop(),y=l.get(r);if(!y)continue;y.indent=c,y.showConnector=I,y.isLast=C,y.gutters=$,y.isVirtualRootChild=g;const M=i.get(r)||[],N=M.length>1;let x;N||f&&c>0?x=c+1:x=c;const R=I&&!g,T=this.multipleRoots?Math.max(0,c-1):c,_=Math.max(0,T-1),k=R?[...$,{position:_,show:!C}]:$;for(let p=M.length-1;p>=0;p--){const m=p===M.length-1;o.push([M[p],x,N,N,m,k,!1])}}this.visibleParentMap=n,this.visibleChildrenMap=i}getSearchableText(s){const t=s.entry,e=[];switch(s.label&&e.push(s.label),t.type){case"message":{const n=t.message;if(e.push(n.role),"content"in n&&n.content&&e.push(this.extractContent(n.content)),n.role==="bashExecution"){const i=n;i.command&&e.push(i.command)}break}case"custom_message":{e.push(t.customType),typeof t.content=="string"?e.push(t.content):e.push(this.extractContent(t.content));break}case"compaction":e.push("compaction");break;case"branch_summary":e.push("branch summary",t.summary);break;case"session_info":e.push("title"),t.name&&e.push(t.name);break;case"model_change":e.push("model",t.modelId);break;case"thinking_level_change":e.push("thinking",t.thinkingLevel);break;case"custom":e.push("custom",t.customType);break;case"context_edit":e.push("context edit",t.replacement===null?"omit":"replace",t.targetId);break;case"label":e.push("label",t.label??"");break}return e.join(" ")}invalidate(){}getSearchQuery(){return this.searchQuery}getSelectedNode(){return this.filteredNodes[this.selectedIndex]?.node}copySelected(){const s=this.getSelectedNode();this.onCopy?.(s?this.getEntryCopyText(s):void 0)}updateNodeLabel(s,t,e){for(const n of this.flatNodes)if(n.node.entry.id===s){n.node.label=t,n.node.labelTimestamp=t?e??new Date().toISOString():void 0;break}}getStatusLabels(){let s="";switch(this.filterMode){case"no-tools":s+=" [no-tools]";break;case"user-only":s+=" [user]";break;case"labeled-only":s+=" [labeled]";break;case"all":s+=" [all]";break}return this.showLabelTimestamps&&(s+=` [+${h("\u6807\u7B7E\u65F6\u95F4")}]`),s}render(s){const t=[];if(this.filteredNodes.length===0)return t.push(w(d.fg("muted",` ${h("\u6CA1\u6709\u627E\u5230\u6761\u76EE")}`),s)),t.push(w(d.fg("muted",` (0/0)${this.getStatusLabels()}`),s)),t;const e=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisibleLines/2),this.filteredNodes.length-this.maxVisibleLines)),n=Math.min(e+this.maxVisibleLines,this.filteredNodes.length),i=[];for(let a=e;a<n;a++){const l=this.filteredNodes[a],o=l.node.entry,r=a===this.selectedIndex,c=r?d.fg("accent","\u203A "):" ",f=this.multipleRoots?Math.max(0,l.indent-1):l.indent,I=l.showConnector&&!l.isVirtualRootChild?l.isLast?"\u2514\u2500 ":"\u251C\u2500 ":"",C=I?f-1:-1,$=f*3,g=[],y=this.foldedNodes.has(o.id);for(let E=0;E<$;E++){const W=Math.floor(E/3),A=E%3,j=l.gutters.find(V=>V.position===W);if(j)A===0?g.push(j.show?"\u2502":" "):g.push(" ");else if(I&&W===C)if(A===0)g.push(l.isLast?"\u2514":"\u251C");else if(A===1){const V=this.isFoldable(o.id);g.push(y?"\u229E":V?"\u229F":"\u2500")}else g.push(" ");else g.push(" ")}const M=g.join(""),N=l.showConnector&&!l.isVirtualRootChild,x=y&&!N?d.fg("accent","\u229E "):"",T=this.activePathIds.has(o.id)?d.fg("accent","\u2022 "):"",_=l.node.label?d.fg("warning",`[${l.node.label}] `):"",k=this.showLabelTimestamps&&l.node.label&&l.node.labelTimestamp?d.fg("muted",`${this.formatLabelTimestamp(l.node.labelTimestamp)} `):"",p=this.getEntryDisplayText(l.node,r),m=d.fg("dim",M)+x+T,L=v(m);let O=c,F=m+_+k+p;r&&(O=d.bg("selectedBg",O),F=d.bg("selectedBg",F)),i.push({gutter:O,body:F,anchorCol:L,bodyWidth:v(F),isSelected:r})}return t.push(...re(i,s)),t.push(w(d.fg("muted",` (${this.selectedIndex+1}/${this.filteredNodes.length})${this.getStatusLabels()}`),s)),t}getEntryDisplayText(s,t){const e=s.entry;let n;const i=b(a=>a.replace(/[\n\t]/g," ").trim(),"normalize");switch(e.type){case"message":{const a=e.message,l=a.role;if(l==="user"){const o=a,r=i(this.extractContent(o.content));n=d.fg("accent",h("\u7528\u6237\u6D88\u606F\uFF1A"))+r}else if(l==="assistant"){const o=a,r=i(this.extractContent(o.content));if(r)n=d.fg("success",h("AI\uFF1A"))+r;else if(o.stopReason==="aborted")n=d.fg("success",h("AI\uFF1A"))+d.fg("muted",h("\uFF08\u5DF2\u4E2D\u65AD\uFF09"));else if(o.errorMessage){const c=i(o.errorMessage).slice(0,80);n=d.fg("success",h("AI\uFF1A"))+d.fg("error",c)}else n=d.fg("success",h("AI\uFF1A"))+d.fg("muted",h("\uFF08\u65E0\u5185\u5BB9\uFF09"))}else if(l==="toolResult"){const o=a,r=o.toolCallId?this.toolCallMap.get(o.toolCallId):void 0;r?n=d.fg("muted",this.formatToolCall(r.name,r.arguments)):n=d.fg("muted",`[${o.toolName??"tool"}]`)}else if(l==="bashExecution"){const o=a;n=d.fg("dim",`[bash]: ${i(o.command??"")}`)}else n=d.fg("dim",`[${l}]`);break}case"custom_message":{const a=typeof e.content=="string"?e.content:e.content.filter(l=>l.type==="text").map(l=>l.text).join("");n=d.fg("customMessageLabel",`[${e.customType}]: `)+i(a);break}case"compaction":{const a=Math.round(e.tokensBefore/1e3);n=d.fg("borderAccent",`[${S(h("\u538B\u7F29\uFF1A{tokens}k tokens"),{tokens:a})}]`);break}case"branch_summary":n=d.fg("warning",`[${h("\u5206\u652F\u6458\u8981\u8BB0\u5F55")}]: `)+i(e.summary);break;case"model_change":n=d.fg("dim",`[${S(h("\u6A21\u578B\uFF1A{model}"),{model:e.modelId})}]`);break;case"thinking_level_change":n=d.fg("dim",`[${S(h("\u601D\u8003\uFF1A{level}"),{level:e.thinkingLevel})}]`);break;case"custom":n=d.fg("dim",`[${S(h("\u81EA\u5B9A\u4E49\uFF1A{type}"),{type:e.customType})}]`);break;case"context_edit":n=d.fg("dim",`[${S(e.replacement===null?h("\u4E0A\u4E0B\u6587\u7701\u7565\uFF1A{target}"):h("\u4E0A\u4E0B\u6587\u66FF\u6362\uFF1A{target}"),{target:e.targetId})}]`);break;case"label":n=d.fg("dim",`[${S(h("\u6807\u7B7E\uFF1A{label}"),{label:e.label??h("\uFF08\u5DF2\u6E05\u9664\uFF09")})}]`);break;case"session_info":n=e.name?[d.fg("dim","[title: "),d.fg("dim",e.name),d.fg("dim","]")].join(""):[d.fg("dim","[title: "),d.italic(d.fg("dim","empty")),d.fg("dim","]")].join("");break;default:n=""}return t?d.bold(n):n}formatLabelTimestamp(s){const t=new Date(s),e=new Date,n=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0"),a=`${n}:${i}`;if(t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate())return a;const l=t.getMonth()+1,o=t.getDate();return t.getFullYear()===e.getFullYear()?`${l}/${o} ${a}`:`${t.getFullYear().toString().slice(-2)}/${l}/${o} ${a}`}extractContent(s){return this.extractFullContent(s).slice(0,200)}extractFullContent(s){if(typeof s=="string")return s;if(!Array.isArray(s))return"";let t="";for(const e of s)typeof e=="object"&&e!==null&&"type"in e&&e.type==="text"&&(t+=e.text);return t}getEntryCopyText(s){const t=s.entry;let e;switch(t.type){case"message":t.message.role==="bashExecution"?e=t.message.command:"content"in t.message&&(e=this.extractFullContent(t.message.content),!e&&t.message.role==="assistant"&&(e=t.message.errorMessage));break;case"custom_message":e=this.extractFullContent(t.content);break;case"compaction":e=t.summary;break;case"branch_summary":e=t.summary;break}return e?.trim()?e:void 0}hasTextContent(s){if(typeof s=="string")return s.trim().length>0;if(Array.isArray(s)){for(const t of s)if(typeof t=="object"&&t!==null&&"type"in t&&t.type==="text"){const e=t.text;if(e&&e.trim().length>0)return!0}}return!1}formatToolCall(s,t){const e=b(n=>q(n,process.env.HOME||process.env.USERPROFILE||""),"shortenPath");switch(s){case"read":return`[read: ${e(String(t.path||t.file_path||""))}${J(t.offset,t.limit)}]`;case"write":return`[write: ${e(String(t.path||t.file_path||""))}]`;case"edit":return`[edit: ${e(String(t.path||t.file_path||""))}]`;case"bash":{const n=String(t.command||"");return`[bash: ${n.replace(/[\n\t]/g," ").trim().slice(0,50)}${n.length>50?"...":""}]`}case"grep":{const n=String(t.pattern||""),i=e(String(t.path||"."));return`[grep: /${n}/ in ${i}]`}case"find":{const n=String(t.pattern||""),i=e(String(t.path||"."));return`[find: ${n} in ${i}]`}case"ls":return`[ls: ${e(String(t.path||"."))}]`;default:{const n=JSON.stringify(t).slice(0,40);return`[${s}: ${n}${JSON.stringify(t).length>40?"...":""}]`}}}handleInput(s){const t=B();if(t.matches(s,"tui.select.up"))this.selectedIndex=this.selectedIndex===0?this.filteredNodes.length-1:this.selectedIndex-1;else if(t.matches(s,"tui.select.down"))this.selectedIndex=this.selectedIndex===this.filteredNodes.length-1?0:this.selectedIndex+1;else if(t.matches(s,"app.tree.foldOrUp")){const e=this.filteredNodes[this.selectedIndex]?.node.entry.id;e&&this.isFoldable(e)&&!this.foldedNodes.has(e)?(this.foldedNodes.add(e),this.applyFilter()):this.selectedIndex=this.findBranchSegmentStart("up")}else if(t.matches(s,"app.tree.unfoldOrDown")){const e=this.filteredNodes[this.selectedIndex]?.node.entry.id;e&&this.foldedNodes.has(e)?(this.foldedNodes.delete(e),this.applyFilter()):this.selectedIndex=this.findBranchSegmentStart("down")}else if(t.matches(s,"tui.editor.cursorLeft")||t.matches(s,"tui.select.pageUp"))this.selectedIndex=Math.max(0,this.selectedIndex-this.maxVisibleLines);else if(t.matches(s,"tui.editor.cursorRight")||t.matches(s,"tui.select.pageDown"))this.selectedIndex=Math.min(this.filteredNodes.length-1,this.selectedIndex+this.maxVisibleLines);else if(t.matches(s,"tui.select.confirm")){const e=this.filteredNodes[this.selectedIndex];e&&this.onSelect&&this.onSelect(e.node.entry.id)}else if(t.matches(s,"app.message.copy"))this.copySelected();else if(t.matches(s,"tui.select.cancel"))this.searchQuery?(this.searchQuery="",this.foldedNodes.clear(),this.applyFilter()):this.onCancel?.();else if(t.matches(s,"app.tree.filter.default"))this.filterMode="default",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.noTools"))this.filterMode=this.filterMode==="no-tools"?"default":"no-tools",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.userOnly"))this.filterMode=this.filterMode==="user-only"?"default":"user-only",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.labeledOnly"))this.filterMode=this.filterMode==="labeled-only"?"default":"labeled-only",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.all"))this.filterMode=this.filterMode==="all"?"default":"all",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.cycleBackward")){const e=["default","no-tools","user-only","labeled-only","all"],n=e.indexOf(this.filterMode);this.filterMode=e[(n-1+e.length)%e.length],this.foldedNodes.clear(),this.applyFilter()}else if(t.matches(s,"app.tree.filter.cycleForward")){const e=["default","no-tools","user-only","labeled-only","all"],n=e.indexOf(this.filterMode);this.filterMode=e[(n+1)%e.length],this.foldedNodes.clear(),this.applyFilter()}else if(t.matches(s,"tui.editor.deleteCharBackward"))this.searchQuery.length>0&&(this.searchQuery=this.searchQuery.slice(0,-1),this.foldedNodes.clear(),this.applyFilter());else if(t.matches(s,"app.tree.editLabel")){const e=this.filteredNodes[this.selectedIndex];e&&this.onLabelEdit&&this.onLabelEdit(e.node.entry.id,e.node.label)}else t.matches(s,"app.tree.toggleLabelTimestamp")?this.showLabelTimestamps=!this.showLabelTimestamps:![...s].some(n=>{const i=n.charCodeAt(0);return i<32||i===127||i>=128&&i<=159})&&s.length>0&&(this.searchQuery+=s,this.foldedNodes.clear(),this.applyFilter())}isFoldable(s){const t=this.visibleChildrenMap.get(s);if(!t||t.length===0)return!1;const e=this.visibleParentMap.get(s);if(e==null)return!0;const n=this.visibleChildrenMap.get(e);return n!==void 0&&n.length>1}findBranchSegmentStart(s){const t=this.filteredNodes[this.selectedIndex]?.node.entry.id;if(!t)return this.selectedIndex;const e=new Map(this.filteredNodes.map((i,a)=>[i.node.entry.id,a]));let n=t;if(s==="down")for(;;){const i=this.visibleChildrenMap.get(n)??[];if(i.length===0)return e.get(n);if(i.length>1)return e.get(i[0]);n=i[0]}for(;;){const i=this.visibleParentMap.get(n)??null;if(i===null)return e.get(n);if((this.visibleChildrenMap.get(i)??[]).length>1){const l=e.get(n);if(l<this.selectedIndex)return l}n=i}}}class de{static{b(this,"SearchLine")}focused=!1;treeList;constructor(s){this.treeList=s}invalidate(){}render(s){if(s<=0)return[""];const t=this.treeList.getSearchQuery(),e=t?` ${d.fg("muted",h("\u8F93\u5165\u6587\u5B57\u641C\u7D22\uFF1A"))} ${d.fg("accent",t)}`:` ${d.fg("muted",h("\u8F93\u5165\u6587\u5B57\u641C\u7D22\uFF1A"))} `;return this.focused?[`${w(e,Math.max(0,s-1))}${K}\x1B[7m \x1B[27m`]:[w(e,s)]}handleInput(s){}}class ce{static{b(this,"TreeHelp")}invalidate(){}render(s){const t=he().map(({keys:o,label:r,labelFirst:c})=>{const f=fe(o);return f?c?`${r} ${f}`:`${f} ${r}`:r}),e=Math.max(1,s),n=" ",i=" \xB7 ",a=[];let l="";for(const o of t){const r=l?`${l}${i}${o}`:v(`${n}${o}`)<=e?`${n}${o}`:o;if(!l||v(r)<=e){l=r;continue}a.push(...Q(l.trimEnd(),e)),l=v(`${n}${o}`)<=e?`${n}${o}`:o}return l&&a.push(...Q(l.trimEnd(),e)),a.map(o=>d.fg("muted",o))}}const he=b(()=>[{keys:["tui.select.up","tui.select.down"],label:h("\u79FB\u52A8")},{keys:["tui.editor.cursorLeft","tui.editor.cursorRight"],label:h("\u7FFB\u9875")},{keys:["app.tree.foldOrUp","app.tree.unfoldOrDown"],label:h("\u5206\u652F")},{keys:["app.message.copy"],label:h("\u590D\u5236")},{keys:["app.tree.editLabel"],label:h("\u6807\u7B7E")},{keys:["app.tree.toggleLabelTimestamp"],label:h("\u6807\u7B7E\u65F6\u95F4")},{keys:["app.tree.filter.default","app.tree.filter.noTools","app.tree.filter.userOnly","app.tree.filter.labeledOnly","app.tree.filter.all"],label:h("\u7B5B\u9009"),labelFirst:!0},{keys:["app.tree.filter.cycleForward","app.tree.filter.cycleBackward"],label:h("\u8F6E\u6362"),labelFirst:!0}],"treeHelpItems");function fe(u){const s=[];for(const t of u){const e=B().getKeys(t)[0];e!==void 0&&s.push(e)}return s.length===0?"":te(ue(s)).replace(/\bpageUp\b/g,"pgup").replace(/\bpageDown\b/g,"pgdn").replace(/\bup\b/g,"\u2191").replace(/\bdown\b/g,"\u2193").replace(/\bleft\b/g,"\u2190").replace(/\bright\b/g,"\u2192")}b(fe,"formatHelpKeys");function ue(u){if(u.length===1)return u[0];const s=u.map(e=>{const n=e.lastIndexOf("+");return n===-1?{prefix:"",suffix:e}:{prefix:e.slice(0,n+1),suffix:e.slice(n+1)}}),t=s[0].prefix;return t&&s.every(e=>e.prefix===t)?`${t}${s.map(e=>e.suffix).join("/")}`:u.join("/")}b(ue,"compactRawKeys");class pe{static{b(this,"LabelInput")}input;entryId;onSubmit;onCancel;_focused=!1;get focused(){return this._focused}set focused(s){this._focused=s,this.input.focused=s}constructor(s,t){this.entryId=s,this.input=new Y,t&&this.input.setValue(t)}invalidate(){}render(s){const t=[],n=s-2;return t.push(w(` ${d.fg("muted",h("\u6807\u7B7E\uFF08\u7559\u7A7A\u5373\u5220\u9664\uFF09\uFF1A"))}`,s)),t.push(...this.input.render(n).map(i=>w(` ${i}`,s))),t.push(w(` ${U("tui.select.confirm",h("\u4FDD\u5B58"))} ${U("tui.select.cancel",h("\u53D6\u6D88\u7F16\u8F91"))}`,s)),t}handleInput(s){const t=B();if(t.matches(s,"tui.select.confirm")){const e=this.input.getValue().trim();this.onSubmit?.(this.entryId,e||void 0)}else t.matches(s,"tui.select.cancel")?this.onCancel?.():this.input.handleInput(s)}}class Ne extends P{static{b(this,"TreeSelectorComponent")}treeList;searchLine;labelInput=null;labelInputContainer;treeContainer;onLabelChangeCallback;onCopy;_focused=!1;get focused(){return this._focused}set focused(s){this._focused=s,this.searchLine.focused=s&&this.labelInput===null,this.labelInput&&(this.labelInput.focused=s)}constructor(s,t,e,n,i,a,l,o){super(),this.onLabelChangeCallback=a;const r=Math.max(5,Math.floor(e/2));this.treeList=new ae(s,t,r,l,o),this.treeList.onSelect=n,this.treeList.onCancel=i,this.treeList.onCopy=c=>this.onCopy?.(c),this.treeList.onLabelEdit=(c,f)=>this.showLabelInput(c,f),this.searchLine=new de(this.treeList),this.treeContainer=new P,this.treeContainer.addChild(this.treeList),this.labelInputContainer=new P,this.addChild(new H(1)),this.addChild(D(h("\u4F1A\u8BDD\u6811"))),this.addChild(new G(d.bold(` ${h("\u6D4F\u89C8\u4F1A\u8BDD\u6811")}`),1,0)),this.addChild(new ce),this.addChild(this.searchLine),this.addChild(new ee),this.addChild(new H(1)),this.addChild(this.treeContainer),this.addChild(this.labelInputContainer),this.addChild(new H(1)),this.addChild(Z()),s.length===0&&setTimeout(()=>i(),100)}showLabelInput(s,t){this.labelInput=new pe(s,t),this.labelInput.onSubmit=(e,n)=>{this.treeList.updateNodeLabel(e,n),this.onLabelChangeCallback?.(e,n),this.hideLabelInput()},this.labelInput.onCancel=()=>this.hideLabelInput(),this.focused=this._focused,this.treeContainer.clear(),this.labelInputContainer.clear(),this.labelInputContainer.addChild(this.labelInput)}hideLabelInput(){this.labelInput=null,this.focused=this._focused,this.labelInputContainer.clear(),this.treeContainer.clear(),this.treeContainer.addChild(this.treeList)}get capturesViewportInput(){return this.labelInput===null}handleInput(s){this.labelInput?this.labelInput.handleInput(s):this.treeList.handleInput(s)}getTreeList(){return this.treeList}}export{Ne as TreeSelectorComponent};
@@ -5,6 +5,7 @@ interface UserMessageItem {
5
5
  timestamp?: string;
6
6
  }
7
7
  declare class UserMessageList implements Component {
8
+ readonly capturesViewportInput: boolean;
8
9
  private messages;
9
10
  private selectedIndex;
10
11
  onSelect?: (entryId: string) => void;
@@ -1 +1 @@
1
- var M=Object.defineProperty;var a=(l,s)=>M(l,"name",{value:s,configurable:!0});import{Container as L,getKeybindings as b,Spacer as d,Text as g,truncateToWidth as w}from"@earendil-works/pi-tui";import{t as c}from"../../../dal/i18n.js";import{theme as n}from"../theme/theme.js";import{chromeBottom as S,chromeTop as $}from"./dynamic-border.js";class T{static{a(this,"UserMessageList")}messages=[];selectedIndex=0;onSelect;onCancel;maxVisible=10;constructor(s,e){this.messages=s;const t=e?s.findIndex(h=>h.id===e):-1;this.selectedIndex=t>=0?t:Math.max(0,s.length-1)}invalidate(){}render(s){const e=[];if(this.messages.length===0)return e.push(n.fg("muted",` ${c("\u6CA1\u6709\u627E\u5230\u4F60\u53D1\u8FC7\u7684\u6D88\u606F")}`)),e;const t=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.messages.length-this.maxVisible)),h=Math.min(t+this.maxVisible,this.messages.length);for(let i=t;i<h;i++){const r=this.messages[i],o=i===this.selectedIndex,x=r.text.replace(/\n/g," ").trim(),u=o?n.fg("accent","\u203A "):" ",f=s-2,m=w(x,f),p=u+(o?n.bold(m):m);e.push(p);const I=` Message ${i+1} of ${this.messages.length}`,C=n.fg("muted",I);e.push(C),e.push("")}if(t>0||h<this.messages.length){const i=n.fg("muted",` (${this.selectedIndex+1}/${this.messages.length})`);e.push(i)}return e}handleInput(s){const e=b();if(e.matches(s,"tui.select.up"))this.selectedIndex=this.selectedIndex===0?this.messages.length-1:this.selectedIndex-1;else if(e.matches(s,"tui.select.down"))this.selectedIndex=this.selectedIndex===this.messages.length-1?0:this.selectedIndex+1;else if(e.matches(s,"tui.select.confirm")){const t=this.messages[this.selectedIndex];t&&this.onSelect&&this.onSelect(t.id)}else e.matches(s,"tui.select.cancel")&&this.onCancel&&this.onCancel()}}class K extends L{static{a(this,"UserMessageSelectorComponent")}messageList;constructor(s,e,t,h){super(),this.addChild(new d(1)),this.addChild(new g(n.bold(c("\u4ECE\u6D88\u606F\u5206\u53C9")),1,0)),this.addChild(new g(n.fg("muted",c("\u9009\u62E9\u4E00\u6761\u4F60\u53D1\u8FC7\u7684\u6D88\u606F\uFF0C\u628A\u622A\u81F3\u8FD9\u6761\u6D88\u606F\u7684\u5BF9\u8BDD\u590D\u5236\u5230\u65B0\u4F1A\u8BDD")),1,0)),this.addChild(new d(1)),this.addChild($(c("\u9009\u62E9\u6D88\u606F"))),this.addChild(new d(1)),this.messageList=new T(s,h),this.messageList.onSelect=e,this.messageList.onCancel=t,this.addChild(this.messageList),this.addChild(new d(1)),this.addChild(S()),s.length===0&&setTimeout(()=>t(),100)}getMessageList(){return this.messageList}}export{K as UserMessageSelectorComponent};
1
+ var M=Object.defineProperty;var a=(c,s)=>M(c,"name",{value:s,configurable:!0});import{Container as L,getKeybindings as b,getSelectPageIndex as w,Spacer as d,Text as g,truncateToWidth as S}from"@earendil-works/pi-tui";import{t as l}from"../../../dal/i18n.js";import{theme as h}from"../theme/theme.js";import{chromeBottom as V,chromeTop as $}from"./dynamic-border.js";class T{static{a(this,"UserMessageList")}capturesViewportInput=!0;messages=[];selectedIndex=0;onSelect;onCancel;maxVisible=10;constructor(s,e){this.messages=s;const t=e?s.findIndex(i=>i.id===e):-1;this.selectedIndex=t>=0?t:Math.max(0,s.length-1)}invalidate(){}render(s){const e=[];if(this.messages.length===0)return e.push(h.fg("muted",` ${l("\u6CA1\u6709\u627E\u5230\u4F60\u53D1\u8FC7\u7684\u6D88\u606F")}`)),e;const t=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.messages.length-this.maxVisible)),i=Math.min(t+this.maxVisible,this.messages.length);for(let n=t;n<i;n++){const r=this.messages[n],o=n===this.selectedIndex,x=r.text.replace(/\n/g," ").trim(),u=o?h.fg("accent","\u203A "):" ",f=s-2,m=S(x,f),p=u+(o?h.bold(m):m);e.push(p);const I=` Message ${n+1} of ${this.messages.length}`,C=h.fg("muted",I);e.push(C),e.push("")}if(t>0||i<this.messages.length){const n=h.fg("muted",` (${this.selectedIndex+1}/${this.messages.length})`);e.push(n)}return e}handleInput(s){const e=b(),t=w(e,s,this.selectedIndex,this.messages.length,this.maxVisible);if(e.matches(s,"tui.select.up"))this.selectedIndex=this.selectedIndex===0?this.messages.length-1:this.selectedIndex-1;else if(e.matches(s,"tui.select.down"))this.selectedIndex=this.selectedIndex===this.messages.length-1?0:this.selectedIndex+1;else if(t!==void 0){if(this.messages.length===0)return;this.selectedIndex=t}else if(e.matches(s,"tui.select.confirm")){const i=this.messages[this.selectedIndex];i&&this.onSelect&&this.onSelect(i.id)}else e.matches(s,"tui.select.cancel")&&this.onCancel&&this.onCancel()}}class P extends L{static{a(this,"UserMessageSelectorComponent")}messageList;constructor(s,e,t,i){super(),this.addChild(new d(1)),this.addChild(new g(h.bold(l("\u4ECE\u6D88\u606F\u5206\u53C9")),1,0)),this.addChild(new g(h.fg("muted",l("\u9009\u62E9\u4E00\u6761\u4F60\u53D1\u8FC7\u7684\u6D88\u606F\uFF0C\u628A\u622A\u81F3\u8FD9\u6761\u6D88\u606F\u7684\u5BF9\u8BDD\u590D\u5236\u5230\u65B0\u4F1A\u8BDD")),1,0)),this.addChild(new d(1)),this.addChild($(l("\u9009\u62E9\u6D88\u606F"))),this.addChild(new d(1)),this.messageList=new T(s,i),this.messageList.onSelect=e,this.messageList.onCancel=t,this.addChild(this.messageList),this.addChild(new d(1)),this.addChild(V()),s.length===0&&setTimeout(()=>t(),100)}getMessageList(){return this.messageList}}export{P as UserMessageSelectorComponent};
@@ -6,8 +6,9 @@ export declare class UserMessageComponent extends Container {
6
6
  private markdownTheme;
7
7
  private outputPad;
8
8
  private markdownTransformers;
9
+ private messageId;
9
10
  private timestamp;
10
- constructor(text: string, markdownTheme?: MarkdownTheme, outputPad?: number, markdownTransformers?: readonly MarkdownTransformer[], timestamp?: number);
11
+ constructor(text: string, markdownTheme?: MarkdownTheme, outputPad?: number, markdownTransformers?: readonly MarkdownTransformer[], messageId?: string, timestamp?: string);
11
12
  setOutputPad(padding: number): void;
12
13
  private rebuild;
13
14
  render(width: number): string[];
@@ -1 +1 @@
1
- var h=Object.defineProperty;var u=(n,t)=>h(n,"name",{value:t,configurable:!0});import{Container as c,Markdown as g}from"@earendil-works/pi-tui";import{getMarkdownTheme as l,theme as d}from"../theme/theme.js";import{createMarkdownTransform as f}from"./markdown-transform.js";const p="\x1B]133;A\x07",x="\x1B]133;B\x07",T="\x1B]133;C\x07";function k(n,t=new Date){if(!Number.isFinite(n)||n<=0)return;const e=new Date(n);if(Number.isNaN(e.getTime()))return;const a=e.getHours().toString().padStart(2,"0"),i=e.getMinutes().toString().padStart(2,"0"),s=`${a}:${i}`;if(e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate())return s;const r=e.getMonth()+1,o=e.getDate();return e.getFullYear()===t.getFullYear()?`${r}/${o} ${s}`:`${e.getFullYear().toString().slice(-2)}/${r}/${o} ${s}`}u(k,"formatTurnTime");class S extends c{static{u(this,"UserMessageComponent")}text;markdownTheme;outputPad;markdownTransformers;timestamp;constructor(t,e=l(),a=1,i=[],s){super(),this.text=t,this.markdownTheme=e,this.outputPad=a,this.markdownTransformers=i,this.timestamp=s,this.rebuild()}setOutputPad(t){this.outputPad=t,this.rebuild()}rebuild(){this.clear(),this.addChild(new g(this.text,0,0,this.markdownTheme,{color:u(t=>d.fg("userMessageText",t),"color")},{preserveOrderedListMarkers:!0,preserveBackslashEscapes:!0,transform:f("user",!1,this.markdownTransformers)}))}render(t){const a=Math.max(1,t-2),i=super.render(a),s=d.fg("accent","\u258D "),r=(i.length===0?[""]:i).map(m=>`${s}${m}`),o=k(this.timestamp??0);return o&&r.unshift(d.fg("dim",o)),this.outputPad>0&&r.push(""),r[0]=p+r[0],r[r.length-1]=x+T+r[r.length-1],r}}export{S as UserMessageComponent,k as formatTurnTime};
1
+ var h=Object.defineProperty;var m=(n,t)=>h(n,"name",{value:t,configurable:!0});import{Container as g,Markdown as c}from"@earendil-works/pi-tui";import{getMarkdownTheme as l,theme as u}from"../theme/theme.js";import{createMarkdownTransform as p}from"./markdown-transform.js";const f="\x1B]133;A\x07",x="\x1B]133;B\x07",T="\x1B]133;C\x07";function k(n,t=new Date){if(!Number.isFinite(n)||n<=0)return;const r=new Date(n);if(Number.isNaN(r.getTime()))return;const a=r.getHours().toString().padStart(2,"0"),i=r.getMinutes().toString().padStart(2,"0"),s=`${a}:${i}`;if(r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth()&&r.getDate()===t.getDate())return s;const e=r.getMonth()+1,o=r.getDate();return r.getFullYear()===t.getFullYear()?`${e}/${o} ${s}`:`${r.getFullYear().toString().slice(-2)}/${e}/${o} ${s}`}m(k,"formatTurnTime");class S extends g{static{m(this,"UserMessageComponent")}text;markdownTheme;outputPad;markdownTransformers;messageId;timestamp;constructor(t,r=l(),a=1,i=[],s,e){super(),this.text=t,this.markdownTheme=r,this.outputPad=a,this.markdownTransformers=i,this.messageId=s,this.timestamp=e,this.rebuild()}setOutputPad(t){this.outputPad=t,this.rebuild()}rebuild(){this.clear(),this.addChild(new c(this.text,0,0,this.markdownTheme,{color:m(t=>u.fg("userMessageText",t),"color")},{preserveOrderedListMarkers:!0,preserveBackslashEscapes:!0,transform:p("user",()=>!1,this.markdownTransformers,this.messageId,this.timestamp)}))}render(t){const a=Math.max(1,t-2),i=super.render(a),s=u.fg("accent","\u258D "),e=(i.length===0?[""]:i).map(d=>`${s}${d}`),o=k(this.timestamp?Date.parse(this.timestamp):0);return o&&e.unshift(u.fg("dim",o)),this.outputPad>0&&e.push(""),e[0]=f+e[0],e[e.length-1]=x+T+e[e.length-1],e}}export{S as UserMessageComponent,k as formatTurnTime};
@@ -1,3 +1,3 @@
1
- var f=Object.defineProperty;var m=(t,r)=>f(t,"name",{value:r,configurable:!0});import{spawn as u}from"node:child_process";import{mkdtempSync as y,readFileSync as w,rmSync as h,writeFileSync as x}from"node:fs";import{tmpdir as S}from"node:os";import{join as s}from"node:path";import{fill as $,t as d}from"../../dal/i18n.js";import{stripBom as A}from"../../utils/text.js";async function B(t){const r=y(s(S(),"dal-editor-")),e=s(r,"prompt.md");try{x(e,t.content,"utf-8");const i=t.command.match(/(?:[^\s"]+|"[^"]*")+/g)?.map(o=>o.replaceAll('"',""))??[],n=i[0]??"",l=i.slice(1),a=process.platform==="win32"&&n.includes(" ")?`"${n}"`:n;return process.stdout.write(`${$(d("\u6B63\u5728\u6253\u5F00\u5916\u90E8\u7F16\u8F91\u5668\uFF1A{command}"),{command:t.command})}
2
- ${d("\u5173\u95ED\u7F16\u8F91\u5668\u540E\u4F1A\u56DE\u5230 DAL\u3002")}
3
- `),await new Promise(o=>{const c=u(a,[...l,e],{stdio:"inherit",shell:process.platform==="win32"});c.on("error",()=>o(null)),c.on("close",p=>o(p))})!==0?{status:"failed"}:{status:"complete",content:A(w(e,"utf-8")).replace(/\n$/,"")}}finally{try{h(r,{recursive:!0,force:!0})}catch{}}}m(B,"editInExternalEditor");export{B as editInExternalEditor};
1
+ var w=Object.defineProperty;var d=(t,o)=>w(t,"name",{value:o,configurable:!0});import{spawn as h}from"node:child_process";import{mkdtempSync as g,readFileSync as S,rmSync as $,writeFileSync as x}from"node:fs";import{tmpdir as A}from"node:os";import{join as l}from"node:path";import{fill as m,t as e}from"../../dal/i18n.js";import{stripBom as E}from"../../utils/text.js";async function D(t){const o=g(l(A(),"dal-editor-")),c=l(o,"prompt.md");try{x(c,t.content,"utf-8");const i=t.command.match(/(?:[^\s"]+|"[^"]*")+/g)?.map(n=>n.replaceAll('"',""))??[],s=i[0]??"",f=i.slice(1),p=process.platform==="win32"&&s.includes(" ")?`"${s}"`:s;process.stdout.write(`${m(e("\u6B63\u5728\u6253\u5F00\u5916\u90E8\u7F16\u8F91\u5668\uFF1A{command}"),{command:t.command})}
2
+ ${e("\u5173\u95ED\u7F16\u8F91\u5668\u540E\u4F1A\u56DE\u5230 DAL\u3002")}
3
+ `);const r=await new Promise(n=>{const a=h(p,[...f,c],{stdio:"inherit",shell:process.platform==="win32"});a.on("error",()=>n(null)),a.on("close",(u,y)=>n(u??y))});return r===null?{status:"failed",message:m(e("\u65E0\u6CD5\u542F\u52A8\u5916\u90E8\u7F16\u8F91\u5668\uFF1A{command}"),{command:t.command})}:r!==0?{status:"failed",message:m(e("\u5916\u90E8\u7F16\u8F91\u5668\u4EE5 {status} \u9000\u51FA\uFF1B\u8F93\u5165\u5185\u5BB9\u672A\u6539\u52A8"),{status:typeof r=="number"?m(e("\u9000\u51FA\u7801 {code}"),{code:r}):r})}:{status:"complete",content:E(S(c,"utf-8")).replace(/\n$/,"")}}finally{try{$(o,{recursive:!0,force:!0})}catch{}}}d(D,"editInExternalEditor");export{D as editInExternalEditor};
@@ -64,7 +64,9 @@ export declare class InteractiveMode {
64
64
  private lastSigintTime;
65
65
  private lastEscapeTime;
66
66
  private changelogMarkdown;
67
+ private extensionChangelogUpdates;
67
68
  private startupNoticesShown;
69
+ private cacheWarmingNotice;
68
70
  private anthropicSubscriptionWarningShown;
69
71
  private lastStatusSpacer;
70
72
  private lastStatusText;
@@ -98,6 +100,8 @@ export declare class InteractiveMode {
98
100
  private bugReportHintShown;
99
101
  private installChangeWarningShown;
100
102
  private extensionDialogs;
103
+ private nextBlockingOverlayId;
104
+ private readonly extensionOverlays;
101
105
  private extensionTerminalInputSubscriptions;
102
106
  private extensionWidgetsAbove;
103
107
  private extensionWidgetsBelow;
@@ -132,12 +136,16 @@ export declare class InteractiveMode {
132
136
  private checkForPackageUpdates;
133
137
  private checkTmuxKeyboardSetup;
134
138
  private getChangelogForDisplay;
139
+ private getExtensionChangelogUpdates;
140
+ private readPackageJson;
135
141
  private reportInstallTelemetry;
136
142
  private getMarkdownThemeWithSettings;
137
143
  private formatDisplayPath;
138
144
  private formatExtensionDisplayPath;
139
145
  private formatContextPath;
140
146
  private getStartupExpansionState;
147
+ private getModelScopeNotice;
148
+ private showFullscreenModelScopeNotice;
141
149
  private shouldShowStartupDetails;
142
150
  private getShortPath;
143
151
  private getCompactPathLabel;
@@ -170,6 +178,7 @@ export declare class InteractiveMode {
170
178
  private renderCurrentSessionState;
171
179
  private getRegisteredToolDefinition;
172
180
  private getMarkdownTransformers;
181
+ private createChangelogMarkdown;
173
182
  private setupExtensionShortcuts;
174
183
  private setExtensionStatus;
175
184
  private setExtensionPanel;
@@ -296,9 +305,9 @@ export declare class InteractiveMode {
296
305
  private showTreeSelector;
297
306
  private showSessionSelector;
298
307
  private handleResumeSession;
308
+ private switchToForkedSession;
299
309
  private getLoginProviderOptions;
300
310
  private getLogoutProviderOptions;
301
- private findLoginProviderOptions;
302
311
  private handleLoginCommand;
303
312
  private startProviderLogin;
304
313
  private showLoginAuthTypeSelector;