@ensocode/server 0.3.3 → 0.3.5

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 (378) hide show
  1. package/README.md +10 -0
  2. package/out/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +117 -0
  3. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic-messages-MGNURJ72.js +6 -0
  4. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{azure-openai-responses-FSC6BAW3.js → azure-openai-responses-4WDOP7MF.js} +1 -1
  5. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/bedrock-converse-stream.js +3 -3
  6. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-4KSTFUIK.js +19 -0
  7. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-4UNPP53I.js +55 -0
  8. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-CCYGJPSU.js +2 -0
  9. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-4EYXVSA5.js → chunk-FF6XOTWB.js} +9 -9
  10. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-FMPAMX2W.js +82 -0
  11. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-GFUN2N5K.js +2 -0
  12. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-C2WU32PX.js → chunk-H4W2F2IO.js} +1 -1
  13. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-IEBK4HQA.js +2 -0
  14. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-EOO47QGR.js → chunk-JLFZH7C6.js} +1 -1
  15. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-LCB5FO32.js +4 -0
  16. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-GN3QYODH.js → chunk-LQUBM7HF.js} +1 -1
  17. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-MABPTPMF.js +30 -0
  18. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-MPEFJ3RP.js +2 -0
  19. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-EBFHJFEE.js → chunk-PYBKJQVF.js} +1 -1
  20. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-VKJQ6CME.js +8 -0
  21. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-B46VJEHW.js → chunk-VUPOM3AH.js} +1 -1
  22. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-3TGLJEWK.js → chunk-WL4TUXY7.js} +1 -1
  23. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-V6KH5QG4.js → chunk-XM4MQFQV.js} +1 -1
  24. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-YZKQS34S.js → chunk-Y55SJART.js} +5 -1
  25. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
  26. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-ZKNSXGL5.js +1243 -0
  27. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{cli-MCOUW5WS.js → cli-35W4A75E.js} +7 -7
  28. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{cloudflare-workers-ai-system-one-WLAFJSP6.js → cloudflare-workers-ai-system-one-WKRH5HZA.js} +1 -1
  29. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/codemode-worker.js +2 -0
  30. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{easter-egg-3d-WMBNSJ4M.js → easter-egg-3d-GEVPKQF6.js} +1 -1
  31. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{execute-4CEBORGZ.js → execute-L2EEDV3L.js} +5 -3
  32. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/github-copilot.js +1 -1
  33. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{google-generative-ai-INGKNW72.js → google-generative-ai-VSMFCHJU.js} +1 -1
  34. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{google-vertex-IBTX6MBF.js → google-vertex-35UTLZJN.js} +1 -1
  35. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{llama-cpp-classify-V5U3QKXI.js → llama-cpp-classify-Z3SS4FP4.js} +1 -1
  36. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{mistral-conversations-S4OWXIXQ.js → mistral-conversations-LWJTUFIM.js} +1 -1
  37. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex-responses-YYIXDJWF.js +10 -0
  38. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openai-completions-EJNYB6IX.js → openai-completions-X2I4TQ2L.js} +3 -3
  39. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openai-decisions-IXI34BYG.js → openai-decisions-GG3FBAIF.js} +1 -1
  40. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-responses-5CX3GG6R.js +4 -0
  41. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openrouter-images-PISKSFMS.js → openrouter-images-WHNK2UQG.js} +1 -1
  42. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{pi-messages-NORUKF4E.js → pi-messages-5CXWY5I7.js} +1 -1
  43. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{runtime-FQB7RU7U.js → runtime-J5ZSBGTX.js} +1 -1
  44. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{typesafe-system-one-CHVC2UUI.js → typesafe-system-one-KA2SBSSD.js} +1 -1
  45. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/virtual-modules-7ZY53V4K.js +2 -0
  46. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli-runtime.js +1 -1
  47. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/index.js +1 -1
  48. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
  49. package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js +1 -1
  50. package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-command.js +26 -2
  51. package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-login.d.ts +15 -0
  52. package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-login.js +232 -0
  53. package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-logout.d.ts +14 -0
  54. package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-logout.js +57 -0
  55. package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-terminal.d.ts +17 -0
  56. package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-terminal.js +63 -0
  57. package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/config-selector.js +3 -1
  58. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.d.ts +5 -0
  59. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js +7 -0
  60. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts +25 -6
  61. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +139 -50
  62. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +3 -2
  63. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.js +3 -1
  64. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/cache-warmer.d.ts +4 -37
  65. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/cache-warmer.js +11 -89
  66. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js +2 -1
  67. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
  68. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +10 -5
  69. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts +1 -0
  70. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js +9 -1
  71. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts +28 -6
  72. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts +2 -2
  73. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.js +1 -1
  74. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.d.ts +12 -37
  75. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.js +42 -121
  76. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.d.ts +52 -0
  77. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js +20 -19
  78. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts +5 -0
  79. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js +11 -4
  80. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts +10 -1
  81. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +50 -5
  82. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/pi-ai-schemas.d.ts +4 -0
  83. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/preferred-providers.d.ts +17 -0
  84. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/preferred-providers.js +24 -0
  85. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js +18 -2
  86. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-composer.js +3 -1
  87. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-matching.d.ts +6 -0
  88. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-matching.js +8 -0
  89. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/radius-mcp.d.ts +13 -0
  90. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/radius-mcp.js +29 -0
  91. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.js +2 -0
  92. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/runtime-credentials.d.ts +8 -0
  93. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/runtime-credentials.js +15 -1
  94. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.d.ts +1 -1
  95. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.js +1 -1
  96. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +35 -5
  97. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.d.ts +23 -14
  98. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.js +182 -41
  99. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +8 -7
  100. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js +82 -36
  101. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.d.ts +5 -3
  102. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js +87 -75
  103. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js +2 -1
  104. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/powershell.js +15 -2
  105. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts +8 -0
  106. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +141 -25
  107. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.d.ts +4 -14
  108. package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.js +23 -29
  109. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.js +4 -4
  110. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.js +34 -12
  111. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/client.d.ts +2 -0
  112. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/client.js +23 -2
  113. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/ui.js +15 -3
  114. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.d.ts +2 -0
  115. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.js +49 -14
  116. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/config.js +4 -7
  117. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/index.js +4 -3
  118. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.d.ts +11 -49
  119. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.js +56 -319
  120. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.d.ts +1 -1
  121. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.js +4 -3
  122. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.d.ts +4 -3
  123. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.js +7 -5
  124. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.d.ts +2 -23
  125. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.js +6 -58
  126. package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.js +18 -6
  127. package/out/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts +1 -1
  128. package/out/node_modules/@earendil-works/pi-coding-agent/dist/main.js +46 -0
  129. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +5 -1
  130. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js +12 -4
  131. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +5 -1
  132. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +12 -4
  133. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.d.ts +5 -2
  134. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.js +10 -3
  135. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/diff.js +11 -5
  136. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-selector.js +9 -1
  137. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +1 -18
  138. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/mermaid.d.ts +2 -1
  139. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/mermaid.js +25 -20
  140. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.js +14 -6
  141. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/oauth-selector.d.ts +10 -3
  142. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/oauth-selector.js +32 -5
  143. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/provider-brand.d.ts +14 -0
  144. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/provider-brand.js +66 -0
  145. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/radius-login-selector.d.ts +1 -2
  146. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/radius-login-selector.js +6 -37
  147. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +5 -1
  148. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +12 -4
  149. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts +1 -0
  150. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +19 -10
  151. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +11 -1
  152. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +110 -63
  153. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +4 -0
  154. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.js +19 -10
  155. package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +53 -23
  156. package/out/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +39 -8
  157. package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.d.ts +2 -2
  158. package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.js +12 -6
  159. package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js +3 -1
  160. package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/terminal-question.d.ts +8 -0
  161. package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/terminal-question.js +24 -0
  162. package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/web-url.d.ts +12 -0
  163. package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/web-url.js +20 -0
  164. package/out/node_modules/@earendil-works/pi-coding-agent/docs/cli.md +14 -1
  165. package/out/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +27 -7
  166. package/out/node_modules/@earendil-works/pi-coding-agent/docs/keybindings.md +1 -1
  167. package/out/node_modules/@earendil-works/pi-coding-agent/docs/llama-cpp.md +4 -7
  168. package/out/node_modules/@earendil-works/pi-coding-agent/docs/models-configuration.md +6 -1
  169. package/out/node_modules/@earendil-works/pi-coding-agent/docs/models.md +2 -1
  170. package/out/node_modules/@earendil-works/pi-coding-agent/docs/prompt-templates.md +1 -1
  171. package/out/node_modules/@earendil-works/pi-coding-agent/docs/providers.md +1 -1
  172. package/out/node_modules/@earendil-works/pi-coding-agent/docs/rpc.md +4 -2
  173. package/out/node_modules/@earendil-works/pi-coding-agent/docs/settings.md +1 -1
  174. package/out/node_modules/@earendil-works/pi-coding-agent/docs/tui.md +1 -1
  175. package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  176. package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
  177. package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  178. package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package-lock.json +2 -2
  179. package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package.json +1 -1
  180. package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/plan-mode/index.ts +23 -13
  181. package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/plan-mode/utils.ts +42 -16
  182. package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/README.md +14 -11
  183. package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/index.ts +392 -171
  184. package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package-lock.json +2 -2
  185. package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
  186. package/out/node_modules/@earendil-works/pi-coding-agent/examples/tsconfig.json +63 -35
  187. package/out/node_modules/@earendil-works/pi-coding-agent/package.json +7 -7
  188. package/out/node_modules/@earendil-works/pi-coding-agent/schemas/models.schema.json +29 -0
  189. package/out/node_modules/@earendil-works/pi-coding-agent/schemas/settings.schema.json +1 -1
  190. package/out/phone/assets/{abnfDiagram-VCTEODGH-CLgfII9z.js → abnfDiagram-VCTEODGH-k76opPl1.js} +1 -1
  191. package/out/phone/assets/architecture-7GRP2DOG-DFA8x3QF.js +1 -0
  192. package/out/phone/assets/{architectureDiagram-5GKGNRK7-I2RDn32D.js → architectureDiagram-5GKGNRK7-yxQH9IuZ.js} +1 -1
  193. package/out/phone/assets/{blockDiagram-I7D4REHJ-D5xNQZkS.js → blockDiagram-I7D4REHJ-DoHteZpO.js} +1 -1
  194. package/out/phone/assets/{c4Diagram-7LVT6UL2-CRKpzdlA.js → c4Diagram-7LVT6UL2-DQVO6L4q.js} +1 -1
  195. package/out/phone/assets/channel-BBjWfdZr.js +1 -0
  196. package/out/phone/assets/{chunk-4HAMMTFA-CcezrqKz.js → chunk-4HAMMTFA-N9Rw4SGW.js} +1 -1
  197. package/out/phone/assets/{chunk-75Z2AOVW-DDCXp4y1.js → chunk-75Z2AOVW-DKJ8pOxp.js} +1 -1
  198. package/out/phone/assets/{chunk-DU6HZSFF-CjWveEkB.js → chunk-DU6HZSFF-BqGW8Nbd.js} +1 -1
  199. package/out/phone/assets/{chunk-F27PBJKO-Bgl_xI02.js → chunk-F27PBJKO-PkFmkghF.js} +1 -1
  200. package/out/phone/assets/{chunk-GMAD6QVW-EmL8nOme.js → chunk-GMAD6QVW-C9VeD3Jk.js} +1 -1
  201. package/out/phone/assets/{chunk-GVQU2GXP-Dox_nphF.js → chunk-GVQU2GXP-COhntOeE.js} +1 -1
  202. package/out/phone/assets/{chunk-IMKFNOWR-BapGpI4S.js → chunk-IMKFNOWR-B87ghLVD.js} +1 -1
  203. package/out/phone/assets/{chunk-L3NEJ4N5-Cq_UZI8A.js → chunk-L3NEJ4N5-C3N2izjg.js} +1 -1
  204. package/out/phone/assets/{chunk-OSK3NFVY-2VVlErAd.js → chunk-OSK3NFVY-DaAlvVhz.js} +1 -1
  205. package/out/phone/assets/{chunk-P2QGCYS3-Cci-G-p1.js → chunk-P2QGCYS3-BQpKr8IZ.js} +1 -1
  206. package/out/phone/assets/{chunk-POPQ4Y6H-CJ47EOfE.js → chunk-POPQ4Y6H-B2TZMY6U.js} +1 -1
  207. package/out/phone/assets/{chunk-PWAF6VOD-D9dLdFqC.js → chunk-PWAF6VOD-CgRhpUJy.js} +1 -1
  208. package/out/phone/assets/{chunk-SHT3W25Y-BlGSiWZn.js → chunk-SHT3W25Y-BySMFA99.js} +1 -1
  209. package/out/phone/assets/{chunk-SVP7TREG-C0zdsa_A.js → chunk-SVP7TREG-EDGanDUX.js} +1 -1
  210. package/out/phone/assets/{chunk-TICWLB2K-DAQW8nQU.js → chunk-TICWLB2K-BtCZ8R2k.js} +1 -1
  211. package/out/phone/assets/classDiagram-ZZMXUADV-CXXjdIIU.js +1 -0
  212. package/out/phone/assets/classDiagram-v2-VYDZK3BY-CXXjdIIU.js +1 -0
  213. package/out/phone/assets/{cynefin-OW5HDTMX-_zsx5mdV.js → cynefin-OW5HDTMX-CdZmp44V.js} +1 -1
  214. package/out/phone/assets/{cynefinDiagram-5FMLGOSQ-Cww-w0ex.js → cynefinDiagram-5FMLGOSQ-BCz9KwUb.js} +1 -1
  215. package/out/phone/assets/{dagre-GXQ25YYZ-C0i7DPqX.js → dagre-GXQ25YYZ-CgFeNgh6.js} +1 -1
  216. package/out/phone/assets/desk-C_b7mE6l.js +2 -0
  217. package/out/phone/assets/{diagram-S7CK7UJ4-Bx-G5hYz.js → diagram-S7CK7UJ4-CwvaZIBf.js} +1 -1
  218. package/out/phone/assets/{diagram-UQ7AKVKN-DaTblkjV.js → diagram-UQ7AKVKN-DqnD4XoZ.js} +1 -1
  219. package/out/phone/assets/{diagram-VSXAHHWV-gmN2e1b4.js → diagram-VSXAHHWV-Kqc9GudQ.js} +1 -1
  220. package/out/phone/assets/{diagram-VX7I27RA-WYtRtOo8.js → diagram-VX7I27RA-B_0DLDQ0.js} +1 -1
  221. package/out/phone/assets/{diagram-Z3DM3KII-Cr6uUB5B.js → diagram-Z3DM3KII-CppKBEPW.js} +1 -1
  222. package/out/phone/assets/{ebnfDiagram-PWID7BFC-BCicfvpA.js → ebnfDiagram-PWID7BFC-DeYPNCu9.js} +1 -1
  223. package/out/phone/assets/{erDiagram-RLTQ6QDP-B3QlJvfQ.js → erDiagram-RLTQ6QDP-MsfxDUmk.js} +1 -1
  224. package/out/phone/assets/eventmodeling-NTZA5JFV-D4a6gbOs.js +1 -0
  225. package/out/phone/assets/flowDiagram-HODETNUW-BBTtB5oX.js +1 -0
  226. package/out/phone/assets/{ganttDiagram-EL5Y4UJY-LYy2mfCh.js → ganttDiagram-EL5Y4UJY-DaScS1os.js} +1 -1
  227. package/out/phone/assets/{gitGraph-4MIJSDKK-dT22Z2jG.js → gitGraph-4MIJSDKK-C-FzqpZm.js} +1 -1
  228. package/out/phone/assets/{gitGraphDiagram-WWUBYQGX-DHNdY57l.js → gitGraphDiagram-WWUBYQGX-4Yv-hAwf.js} +1 -1
  229. package/out/phone/assets/{info-A6RAGUB7-nIu8NSOs.js → info-A6RAGUB7-CGLEP4t7.js} +1 -1
  230. package/out/phone/assets/{infoDiagram-27XIBGKW-DGkWZIMT.js → infoDiagram-27XIBGKW-DapEgYQa.js} +1 -1
  231. package/out/phone/assets/{ishikawaDiagram-5VMMS53U-C8EPXru-.js → ishikawaDiagram-5VMMS53U-D1B2lZSG.js} +1 -1
  232. package/out/phone/assets/{journeyDiagram-3NMN7TZE-Dyd9L3l3.js → journeyDiagram-3NMN7TZE-BSAtMVJw.js} +1 -1
  233. package/out/phone/assets/{kanban-definition-UXKFOSKX-DehTYcsL.js → kanban-definition-UXKFOSKX-CfZ4oI7A.js} +1 -1
  234. package/out/phone/assets/{line-Db4SulF4.js → line-DAXmUM4p.js} +1 -1
  235. package/out/phone/assets/main-B0yD1pMI.js +1643 -0
  236. package/out/phone/assets/main-DNRbLxEx.css +1 -0
  237. package/out/phone/assets/{mermaid-parser.core-D7h_8WV8.js → mermaid-parser.core-IObm7oM0.js} +3 -3
  238. package/out/phone/assets/{mermaid.core-Dw_E5kj4.js → mermaid.core-C1wA-mhD.js} +4 -4
  239. package/out/phone/assets/{mindmap-definition-YA3MSWOX-_5Mxqxsy.js → mindmap-definition-YA3MSWOX-3ph0EaB9.js} +1 -1
  240. package/out/phone/assets/{packet-AYTQ26CC-_cgeMDdN.js → packet-AYTQ26CC-BbDAe9Au.js} +1 -1
  241. package/out/phone/assets/{pegDiagram-XKGWAZYB-BhBwaNEr.js → pegDiagram-XKGWAZYB-EsuDcX_3.js} +1 -1
  242. package/out/phone/assets/{pie-WAS4IAKB-BepY80_0.js → pie-WAS4IAKB-BQfIj1fu.js} +1 -1
  243. package/out/phone/assets/{pieDiagram-E7YTZNPT-CQQgqmI8.js → pieDiagram-E7YTZNPT-Cw19z5Ip.js} +1 -1
  244. package/out/phone/assets/{quadrantDiagram-AXDQQJYC-DEEatC1J.js → quadrantDiagram-AXDQQJYC-Bqwz_sa8.js} +1 -1
  245. package/out/phone/assets/{radar-RG4KPBEZ-BqsiI_qQ.js → radar-RG4KPBEZ-Dmp-89iD.js} +1 -1
  246. package/out/phone/assets/{railroad-74A4TZTK-C_2pEUjD.js → railroad-74A4TZTK-dq2H8w8Y.js} +1 -1
  247. package/out/phone/assets/railroad-abnf-HS5TGJTU-DddVaVQM.js +1 -0
  248. package/out/phone/assets/railroad-ebnf-LZEXJU2U-BjvyqMjh.js +1 -0
  249. package/out/phone/assets/railroad-peg-WCYAUIDC-lBl4CV1_.js +1 -0
  250. package/out/phone/assets/{railroadDiagram-O6MQD6OU-B7786u7W.js → railroadDiagram-O6MQD6OU-D2Sbc7Wn.js} +1 -1
  251. package/out/phone/assets/{requirementDiagram-BXWQKSXE-Ci3b5uwm.js → requirementDiagram-BXWQKSXE-CLNUqxbl.js} +1 -1
  252. package/out/phone/assets/{sankeyDiagram-P5KCCOFB-PwT2gJjH.js → sankeyDiagram-P5KCCOFB-Dme5iwcw.js} +1 -1
  253. package/out/phone/assets/{sequenceDiagram-WJ2MYXX4-H6sgB5RI.js → sequenceDiagram-WJ2MYXX4-C5dYSwPE.js} +1 -1
  254. package/out/phone/assets/{stateDiagram-D77RDMKH-BxyRe7OB.js → stateDiagram-D77RDMKH-BuxkPvJ6.js} +1 -1
  255. package/out/phone/assets/stateDiagram-v2-MP3YSRHH-Exd8xDBD.js +1 -0
  256. package/out/phone/assets/storage-p-WxHA1h.js +1 -0
  257. package/out/phone/assets/{swimlanes-42K2YHIH-DWT3f1Hk.js → swimlanes-42K2YHIH-DHyXnytv.js} +1 -1
  258. package/out/phone/assets/swimlanesDiagram-VR7AAH4N-B62_42fO.js +8 -0
  259. package/out/phone/assets/{timeline-definition-24CTP7MA-D67esSVY.js → timeline-definition-24CTP7MA-Bm8Z0u2Z.js} +1 -1
  260. package/out/phone/assets/{treeView-Q6P3EWNA-BTIfu3Qr.js → treeView-Q6P3EWNA-DFUxvDDO.js} +1 -1
  261. package/out/phone/assets/{treemap-WGGIJYW6-DkPf6LQc.js → treemap-WGGIJYW6-CMC-hwzt.js} +1 -1
  262. package/out/phone/assets/{vennDiagram-4TSXK5OY-DRMRxJ4f.js → vennDiagram-4TSXK5OY-CNL4gZsd.js} +1 -1
  263. package/out/phone/assets/{wardley-WFR3VGLG-hOvC_8-W.js → wardley-WFR3VGLG-CHQoq9KJ.js} +1 -1
  264. package/out/phone/assets/{wardleyDiagram-VM6X3IG4-a5aYRgrw.js → wardleyDiagram-VM6X3IG4-DAuBfK1O.js} +1 -1
  265. package/out/phone/assets/{xychartDiagram-S5SC5T6Z-DXjoRFDL.js → xychartDiagram-S5SC5T6Z-B2T9ECKd.js} +1 -1
  266. package/out/phone/desk.html +2 -2
  267. package/out/phone/index.html +3 -3
  268. package/out/renderer/assets/{abnfDiagram-VCTEODGH-DhskujJf.js → abnfDiagram-VCTEODGH-gdhrQbX6.js} +1 -1
  269. package/out/renderer/assets/{arc-BcW67t47.js → arc-D6-Q4l2d.js} +1 -1
  270. package/out/renderer/assets/{architectureDiagram-5GKGNRK7-D-x057Ia.js → architectureDiagram-5GKGNRK7-C4y0SbLT.js} +1 -1
  271. package/out/renderer/assets/{blockDiagram-I7D4REHJ-DR3sZkhW.js → blockDiagram-I7D4REHJ-DrsoSFRK.js} +1 -1
  272. package/out/renderer/assets/{c4Diagram-7LVT6UL2-CQ4lScWs.js → c4Diagram-7LVT6UL2-1DD8BlM8.js} +1 -1
  273. package/out/renderer/assets/channel-Sck-tAAK.js +1 -0
  274. package/out/renderer/assets/{chunk-2Q5K7J3B-CtT0yqF3.js → chunk-2Q5K7J3B-DRyc0B7g.js} +1 -1
  275. package/out/renderer/assets/{chunk-5VM5RSS4-DlCfddrY.js → chunk-5VM5RSS4-BJe8SghE.js} +1 -1
  276. package/out/renderer/assets/{chunk-F27PBJKO-BAJ5dGzo.js → chunk-F27PBJKO-BIipq4SK.js} +1 -1
  277. package/out/renderer/assets/{chunk-IMKFNOWR-Dlah_YbP.js → chunk-IMKFNOWR-D5Ak3Xd9.js} +1 -1
  278. package/out/renderer/assets/{chunk-JWPE2WC7-BiXd3nUZ.js → chunk-JWPE2WC7-BcaWCpW-.js} +1 -1
  279. package/out/renderer/assets/{chunk-POPQ4Y6H-Ch86i4EJ.js → chunk-POPQ4Y6H-C1TwLrrN.js} +1 -1
  280. package/out/renderer/assets/{chunk-SVP7TREG-z3inDV-H.js → chunk-SVP7TREG-DDOXG_t3.js} +1 -1
  281. package/out/renderer/assets/{chunk-TICWLB2K-B34A2AKD.js → chunk-TICWLB2K-BqT15hZi.js} +1 -1
  282. package/out/renderer/assets/{chunk-XXDRQBXY-Do_L0wRR.js → chunk-XXDRQBXY-D01ts6SC.js} +1 -1
  283. package/out/renderer/assets/classDiagram-ZZMXUADV-DnB4QNNe.js +1 -0
  284. package/out/renderer/assets/classDiagram-v2-VYDZK3BY-DnB4QNNe.js +1 -0
  285. package/out/renderer/assets/{cose-bilkent-JH36ORCC-BQraKmgl.js → cose-bilkent-JH36ORCC-C7NVrT2_.js} +1 -1
  286. package/out/renderer/assets/{cynefin-OW5HDTMX-BwixoR4r.js → cynefin-OW5HDTMX-2LxdFmSk.js} +1 -1
  287. package/out/renderer/assets/{cynefinDiagram-5FMLGOSQ-BLTBma3J.js → cynefinDiagram-5FMLGOSQ-_AN_Mulc.js} +1 -1
  288. package/out/renderer/assets/{cytoscape-fcose-BRpJ5tyq.js → cytoscape-fcose-COZkZZmX.js} +1 -1
  289. package/out/renderer/assets/{dagre-GXQ25YYZ-aWsjA_wn.js → dagre-GXQ25YYZ-BUTwlM6j.js} +1 -1
  290. package/out/renderer/assets/{diagram-S7CK7UJ4-Cur2zK4q.js → diagram-S7CK7UJ4-CseZZ-y2.js} +1 -1
  291. package/out/renderer/assets/{diagram-UQ7AKVKN-DlrY8YcD.js → diagram-UQ7AKVKN-Cb7llS-8.js} +1 -1
  292. package/out/renderer/assets/{diagram-VSXAHHWV-BBdjreqR.js → diagram-VSXAHHWV-CtuGqQvp.js} +1 -1
  293. package/out/renderer/assets/{diagram-VX7I27RA-XiWMdc8S.js → diagram-VX7I27RA-BA8eov-1.js} +1 -1
  294. package/out/renderer/assets/{diagram-Z3DM3KII-CBB5leat.js → diagram-Z3DM3KII-VZOjj6Hg.js} +1 -1
  295. package/out/renderer/assets/{ebnfDiagram-PWID7BFC-nl8RPo8j.js → ebnfDiagram-PWID7BFC-YBIrle6d.js} +1 -1
  296. package/out/renderer/assets/{erDiagram-RLTQ6QDP-C_oaG80x.js → erDiagram-RLTQ6QDP-BiKyPEqW.js} +1 -1
  297. package/out/renderer/assets/{flowDiagram-HODETNUW-nDoVZFS7.js → flowDiagram-HODETNUW-7wmZyLHw.js} +1 -1
  298. package/out/renderer/assets/{ganttDiagram-EL5Y4UJY-DOrcuM3Q.js → ganttDiagram-EL5Y4UJY-D4j4GJaT.js} +1 -1
  299. package/out/renderer/assets/{gitGraphDiagram-WWUBYQGX-D_DB3jro.js → gitGraphDiagram-WWUBYQGX-BqveM1NI.js} +1 -1
  300. package/out/renderer/assets/globals-C9M_MZZV.js +2539 -0
  301. package/out/renderer/assets/globals-l3kDGoYH.css +1 -0
  302. package/out/renderer/assets/index-BzSTiwH2.js +117 -0
  303. package/out/renderer/assets/{infoDiagram-27XIBGKW-BbBrANxo.js → infoDiagram-27XIBGKW-DLPLnIFP.js} +1 -1
  304. package/out/renderer/assets/{ishikawaDiagram-5VMMS53U-7UlfWlWV.js → ishikawaDiagram-5VMMS53U-48drIAMR.js} +1 -1
  305. package/out/renderer/assets/{journeyDiagram-3NMN7TZE-CJP9bosH.js → journeyDiagram-3NMN7TZE-vjigqUq_.js} +1 -1
  306. package/out/renderer/assets/{kanban-definition-UXKFOSKX-D772kW7T.js → kanban-definition-UXKFOSKX-CpsYVONZ.js} +1 -1
  307. package/out/renderer/assets/{layout-BzVfJEvx.js → layout-DqfoORoO.js} +1 -1
  308. package/out/renderer/assets/{linear-DBjhr05m.js → linear-CJzBBHcp.js} +1 -1
  309. package/out/renderer/assets/{mermaid.core-CJpNSowm.js → mermaid.core-DdrGP-Hn.js} +5 -5
  310. package/out/renderer/assets/{mindmap-definition-YA3MSWOX-C2oqlH5E.js → mindmap-definition-YA3MSWOX-D68tLNxp.js} +1 -1
  311. package/out/renderer/assets/{pegDiagram-XKGWAZYB-CcZ8Hae-.js → pegDiagram-XKGWAZYB-DkgLTcrv.js} +1 -1
  312. package/out/renderer/assets/{pieDiagram-E7YTZNPT-DTw-_k2D.js → pieDiagram-E7YTZNPT-bz5NuX1w.js} +1 -1
  313. package/out/renderer/assets/{quadrantDiagram-AXDQQJYC-D5eX0DO7.js → quadrantDiagram-AXDQQJYC-o_VKLyJA.js} +1 -1
  314. package/out/renderer/assets/{railroadDiagram-O6MQD6OU-DzpBB_Re.js → railroadDiagram-O6MQD6OU-Dkf03e07.js} +1 -1
  315. package/out/renderer/assets/{requirementDiagram-BXWQKSXE-UbOUXLgl.js → requirementDiagram-BXWQKSXE-CBUz_3YU.js} +1 -1
  316. package/out/renderer/assets/{sankeyDiagram-P5KCCOFB-jRbXLLsa.js → sankeyDiagram-P5KCCOFB-B0pjUr9g.js} +1 -1
  317. package/out/renderer/assets/{sequenceDiagram-WJ2MYXX4-s0WBQQPf.js → sequenceDiagram-WJ2MYXX4-ClugIL0e.js} +1 -1
  318. package/out/renderer/assets/settings-DvhrDn2q.js +34 -0
  319. package/out/renderer/assets/{sizeCapture-INFHLROL-DvUs5rDx.js → sizeCapture-INFHLROL-D6y0rctc.js} +1 -1
  320. package/out/renderer/assets/{stateDiagram-D77RDMKH-C1_V497y.js → stateDiagram-D77RDMKH-DiftQepS.js} +1 -1
  321. package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-DxB2-9tl.js +1 -0
  322. package/out/renderer/assets/{swimlanes-42K2YHIH-BulPeZ6y.js → swimlanes-42K2YHIH-DhuTjCNj.js} +1 -1
  323. package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-CYDUqExO.js +8 -0
  324. package/out/renderer/assets/{timeline-definition-24CTP7MA-gQ5OygZn.js → timeline-definition-24CTP7MA-CrXqgptd.js} +1 -1
  325. package/out/renderer/assets/{vennDiagram-4TSXK5OY-A8QyA5Ix.js → vennDiagram-4TSXK5OY-CDm8SO8U.js} +1 -1
  326. package/out/renderer/assets/{wardleyDiagram-VM6X3IG4-CfP6E41T.js → wardleyDiagram-VM6X3IG4-CxyunHwQ.js} +1 -1
  327. package/out/renderer/assets/{xychartDiagram-S5SC5T6Z-DTG5UHh7.js → xychartDiagram-S5SC5T6Z-CvC5YMSy.js} +1 -1
  328. package/out/renderer/index.html +3 -3
  329. package/out/renderer/plugin-view.html +39 -0
  330. package/out/renderer/settings.html +4 -4
  331. package/out/renderer/web-preload.js +1 -1
  332. package/out/server/agent.js +2022 -860
  333. package/out/server/chunks/{agent-BhQn6jGA.js → agent-_G_O-Cpa.js} +359 -227
  334. package/out/server/chunks/{gpuBackendInstall-CdExgjGi.js → gpuBackendInstall-Cb6TFh_8.js} +11 -9
  335. package/out/server/chunks/{loadProvider-BnkyjMSW.js → loadProvider-Be9Lu1Oi.js} +7 -20
  336. package/out/server/chunks/{manifest-2odvnxjZ.js → manifest-CB63GQ-i.js} +129 -6
  337. package/out/server/chunks/{workflowPresets-DqSsjOj6.js → workflowPresets-Djlp5LPV.js} +4004 -2054
  338. package/out/server/index.js +8251 -6660
  339. package/out/server/plugin-host.js +36 -26
  340. package/package.json +10 -10
  341. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic-messages-BWGCKOF4.js +0 -6
  342. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-44DLKSKE.js +0 -1234
  343. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-62VOPMLK.js +0 -65
  344. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-7O7QKK6A.js +0 -2
  345. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-CHWNPHIS.js +0 -82
  346. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-NL4X6LBY.js +0 -4
  347. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-NZY7EIPA.js +0 -4
  348. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-R2EGYMOO.js +0 -7
  349. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-UKVNB6C4.js +0 -2
  350. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-USJZMAIR.js +0 -2
  351. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-VOLAXWGI.js +0 -2
  352. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex-responses-QAWLOQSN.js +0 -10
  353. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-responses-MD3562FB.js +0 -4
  354. package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/virtual-modules-O76XM3OB.js +0 -2
  355. package/out/phone/assets/architecture-7GRP2DOG-CQOPTv6S.js +0 -1
  356. package/out/phone/assets/channel-DdXebl9x.js +0 -1
  357. package/out/phone/assets/classDiagram-ZZMXUADV-BCctWEp1.js +0 -1
  358. package/out/phone/assets/classDiagram-v2-VYDZK3BY-BCctWEp1.js +0 -1
  359. package/out/phone/assets/desk-mfuEW2n4.js +0 -2
  360. package/out/phone/assets/eventmodeling-NTZA5JFV-BtfapP6M.js +0 -1
  361. package/out/phone/assets/flowDiagram-HODETNUW-BsyiyBtD.js +0 -1
  362. package/out/phone/assets/main-Dv9ve8mT.css +0 -1
  363. package/out/phone/assets/main-uMMbioCA.js +0 -1638
  364. package/out/phone/assets/railroad-abnf-HS5TGJTU-TmODpceI.js +0 -1
  365. package/out/phone/assets/railroad-ebnf-LZEXJU2U-BTCjNR9u.js +0 -1
  366. package/out/phone/assets/railroad-peg-WCYAUIDC-DjhKNo8j.js +0 -1
  367. package/out/phone/assets/stateDiagram-v2-MP3YSRHH-Cncmf_cL.js +0 -1
  368. package/out/phone/assets/storage-D9RW_4__.js +0 -1
  369. package/out/phone/assets/swimlanesDiagram-VR7AAH4N-DAahG4fH.js +0 -8
  370. package/out/renderer/assets/channel-CudRig7z.js +0 -1
  371. package/out/renderer/assets/classDiagram-ZZMXUADV-DL20WkD0.js +0 -1
  372. package/out/renderer/assets/classDiagram-v2-VYDZK3BY-DL20WkD0.js +0 -1
  373. package/out/renderer/assets/globals-Bkw7iiQG.css +0 -1
  374. package/out/renderer/assets/globals-D1ocHHQV.js +0 -2533
  375. package/out/renderer/assets/index-Cm5iq85v.js +0 -117
  376. package/out/renderer/assets/settings-DxYo7s4h.js +0 -34
  377. package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-C9dfLXR8.js +0 -1
  378. package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-LXwy6qGO.js +0 -8
@@ -1,4 +1,4 @@
1
- import { readFile as fsReadFile, stat as fsStat } from "node:fs/promises";
1
+ import { stat as fsStat } from "node:fs/promises";
2
2
  import { createInterface } from "node:readline";
3
3
  import { spawn } from "child_process";
4
4
  import path from "path";
@@ -11,7 +11,9 @@ import { DEFAULT_MAX_BYTES, formatSize, GREP_MAX_LINE_LENGTH, truncateHead, trun
11
11
  const grepSchema = Type.Object({
12
12
  pattern: Type.String({ description: "Search pattern (regex or literal string)" }),
13
13
  path: Type.Optional(Type.String({ description: "Directory or file to search (default: current directory)" })),
14
- glob: Type.Optional(Type.String({ description: "Filter files by glob pattern, e.g. '*.ts' or '**/*.spec.ts'" })),
14
+ glob: Type.Optional(Type.String({
15
+ description: "Filter files by glob pattern, relative to path, e.g. '*.ts', 'src/**/*.ts' or '**/*.spec.ts'. A pattern without '/' matches file names at any depth",
16
+ })),
15
17
  ignoreCase: Type.Optional(Type.Boolean({ description: "Case-insensitive search (default: false)" })),
16
18
  literal: Type.Optional(Type.Boolean({ description: "Treat pattern as literal string instead of regex (default: false)" })),
17
19
  context: Type.Optional(Type.Number({ description: "Number of lines to show before and after each match (default: 0)" })),
@@ -24,8 +26,15 @@ export const grepToolSystemPromptContribution = {
24
26
  const DEFAULT_LIMIT = 100;
25
27
  const defaultGrepOperations = {
26
28
  isDirectory: async (p) => (await fsStat(p)).isDirectory(),
27
- readFile: (p) => fsReadFile(p, "utf-8"),
28
29
  };
30
+ /** Decode a ripgrep JSON text field (path or line). Non-UTF-8 data arrives base64-encoded in `bytes`. */
31
+ function decodeRgText(data) {
32
+ if (typeof data?.text === "string")
33
+ return data.text;
34
+ if (typeof data?.bytes === "string")
35
+ return Buffer.from(data.bytes, "base64").toString("utf-8");
36
+ return "";
37
+ }
29
38
  export function createGrepToolDefinition(cwd, options) {
30
39
  const customOps = options?.operations;
31
40
  return {
@@ -64,32 +73,18 @@ export function createGrepToolDefinition(cwd, options) {
64
73
  settle(() => reject(new Error(`Path not found: ${searchPath}`)));
65
74
  return;
66
75
  }
67
- const contextValue = context && context > 0 ? context : 0;
68
- const effectiveLimit = Math.max(1, limit ?? DEFAULT_LIMIT);
76
+ // Clamp so String() never yields exponent notation, which rg rejects.
77
+ const contextValue = context && context > 0 ? Math.min(Math.floor(context), Number.MAX_SAFE_INTEGER) : 0;
78
+ const effectiveLimit = Math.max(1, Math.floor(limit ?? DEFAULT_LIMIT));
69
79
  const formatPath = (filePath) => {
70
80
  if (isDirectory) {
71
- const relative = path.relative(searchPath, filePath);
81
+ const relative = path.relative(searchPath, path.resolve(searchPath, filePath));
72
82
  if (relative && !relative.startsWith("..")) {
73
83
  return relative.replace(/\\/g, "/");
74
84
  }
75
85
  }
76
86
  return path.basename(filePath);
77
87
  };
78
- const fileCache = new Map();
79
- const getFileLines = async (filePath) => {
80
- let lines = fileCache.get(filePath);
81
- if (!lines) {
82
- try {
83
- const content = await ops.readFile(filePath);
84
- lines = content.replace(/\r\n/g, "\n").split("\n");
85
- }
86
- catch {
87
- lines = [];
88
- }
89
- fileCache.set(filePath, lines);
90
- }
91
- return lines;
92
- };
93
88
  // --no-config: the tool contract (literal, glob, limit, ...) must not depend on
94
89
  // ambient user config like RIPGREP_CONFIG_PATH. Users can customize via bash or extensions.
95
90
  const args = ["--no-config", "--json", "--line-number", "--color=never", "--hidden"];
@@ -97,10 +92,20 @@ export function createGrepToolDefinition(cwd, options) {
97
92
  args.push("--ignore-case");
98
93
  if (literal)
99
94
  args.push("--fixed-strings");
95
+ // rg never matches a leading "./" ("./src/*.ts" finds nothing), so drop it; "!" negates.
100
96
  if (glob)
101
- args.push("--glob", glob);
102
- args.push("--", pattern, searchPath);
103
- const child = spawn(rgPath, args, { stdio: ["ignore", "pipe", "pipe"] });
97
+ args.push("--glob", glob.replace(/^(!?)(?:\.\/)+/, "$1"));
98
+ // rg emits the surrounding lines as `context` events, so no matched file is ever read here (#9276).
99
+ if (contextValue > 0)
100
+ args.push("--context", String(contextValue));
101
+ // rg roots --glob at its own cwd, so a directory search runs inside searchPath (#11807).
102
+ // It searches "." because rg canonicalizes its cwd: with an absolute path, a symlinked
103
+ // searchPath (macOS /tmp) would no longer lie under the glob root.
104
+ args.push("--", pattern, isDirectory ? "." : searchPath);
105
+ const child = spawn(rgPath, args, {
106
+ cwd: isDirectory ? searchPath : undefined,
107
+ stdio: ["ignore", "pipe", "pipe"],
108
+ });
104
109
  const rl = createInterface({ input: child.stdout });
105
110
  let stderr = "";
106
111
  let matchCount = 0;
@@ -127,33 +132,40 @@ export function createGrepToolDefinition(cwd, options) {
127
132
  child.stderr?.on("data", (chunk) => {
128
133
  stderr += chunk.toString();
129
134
  });
130
- const formatBlock = async (filePath, lineNumber) => {
135
+ // Size of the full output, including lines past the byte cap that are counted but not stored.
136
+ let outputBytes = 0;
137
+ let outputLineCount = 0;
138
+ let lastFile;
139
+ // Set at the last allowed match. rg still sends that match's trailing context, kept up to
140
+ // trailingContextEnd, and the limit notice waits for proof of one more match.
141
+ let limitHit = false;
142
+ let trailingContextEnd = 0;
143
+ let done = false;
144
+ const finish = () => {
145
+ done = true;
146
+ stopChild(true);
147
+ };
148
+ const pushLine = (filePath, lineNumber, lineText, isMatch) => {
149
+ lastFile = filePath;
131
150
  const relativePath = formatPath(filePath);
132
- const lines = await getFileLines(filePath);
133
- if (!lines.length)
134
- return [`${relativePath}:${lineNumber}: (unable to read file)`];
135
- const block = [];
136
- const start = contextValue > 0 ? Math.max(1, lineNumber - contextValue) : lineNumber;
137
- const end = contextValue > 0 ? Math.min(lines.length, lineNumber + contextValue) : lineNumber;
138
- for (let current = start; current <= end; current++) {
139
- const lineText = lines[current - 1] ?? "";
140
- const sanitized = lineText.replace(/\r/g, "");
141
- const isMatchLine = current === lineNumber;
142
- // Truncate long lines so grep output stays compact.
143
- const { text: truncatedText, wasTruncated } = truncateLine(sanitized);
144
- if (wasTruncated)
145
- linesTruncated = true;
146
- if (isMatchLine)
147
- block.push(`${relativePath}:${current}: ${truncatedText}`);
148
- else
149
- block.push(`${relativePath}-${current}- ${truncatedText}`);
150
- }
151
- return block;
151
+ // Strip only the line terminator: a lone CR inside a line is content, as in the read tool.
152
+ const sanitized = lineText.replace(/\r?\n?$/, "");
153
+ // Truncate long lines so grep output stays compact.
154
+ const { text: truncatedText, wasTruncated } = truncateLine(sanitized);
155
+ if (wasTruncated)
156
+ linesTruncated = true;
157
+ const line = isMatch
158
+ ? `${relativePath}:${lineNumber}: ${truncatedText}`
159
+ : `${relativePath}-${lineNumber}- ${truncatedText}`;
160
+ // Byte truncation below drops everything past the cap, so keep counting but stop storing (#9276).
161
+ // outputBytes counts a newline after every line; the joined output has one fewer.
162
+ if (outputBytes - 1 <= DEFAULT_MAX_BYTES)
163
+ outputLines.push(line);
164
+ outputBytes += Buffer.byteLength(line, "utf-8") + 1;
165
+ outputLineCount++;
152
166
  };
153
- // Collect matches during streaming, then format them after rg exits.
154
- const matches = [];
155
167
  rl.on("line", (line) => {
156
- if (!line.trim() || matchCount >= effectiveLimit)
168
+ if (done || !line.trim())
157
169
  return;
158
170
  let event;
159
171
  try {
@@ -162,24 +174,40 @@ export function createGrepToolDefinition(cwd, options) {
162
174
  catch {
163
175
  return;
164
176
  }
165
- if (event.type === "match") {
177
+ const isMatch = event.type === "match";
178
+ if (!isMatch && event.type !== "context")
179
+ return;
180
+ const filePath = decodeRgText(event.data?.path);
181
+ const lineNumber = event.data?.line_number;
182
+ if (!filePath || typeof lineNumber !== "number")
183
+ return;
184
+ const lineText = decodeRgText(event.data?.lines);
185
+ if (!limitHit) {
186
+ pushLine(filePath, lineNumber, lineText, isMatch);
187
+ if (!isMatch)
188
+ return;
166
189
  matchCount++;
167
- const filePath = event.data?.path?.text;
168
- const lineNumber = event.data?.line_number;
169
- const lineText = event.data?.lines?.text;
170
- if (filePath && typeof lineNumber === "number")
171
- matches.push({ filePath, lineNumber, lineText });
172
190
  if (matchCount >= effectiveLimit) {
173
- matchLimitReached = true;
174
- stopChild(true);
191
+ limitHit = true;
192
+ trailingContextEnd = lineNumber + contextValue;
175
193
  }
194
+ return;
176
195
  }
196
+ const inWindow = filePath === lastFile && lineNumber <= trailingContextEnd;
197
+ // A match inside the last match's trailing context is shown as context.
198
+ if (inWindow)
199
+ pushLine(filePath, lineNumber, lineText, false);
200
+ // Only another match proves that the limit cut results off.
201
+ if (isMatch)
202
+ matchLimitReached = true;
203
+ if (matchLimitReached && !(inWindow && lineNumber < trailingContextEnd))
204
+ finish();
177
205
  });
178
206
  child.on("error", (error) => {
179
207
  cleanup();
180
208
  settle(() => reject(new Error(`Failed to run ripgrep: ${error.message}`)));
181
209
  });
182
- child.on("close", async (code) => {
210
+ child.on("close", (code) => {
183
211
  cleanup();
184
212
  if (aborted) {
185
213
  settle(() => reject(new Error("Operation aborted")));
@@ -194,27 +222,11 @@ export function createGrepToolDefinition(cwd, options) {
194
222
  settle(() => resolve({ content: [{ type: "text", text: "No matches found" }], details: undefined }));
195
223
  return;
196
224
  }
197
- // Format matches after streaming finishes so custom readFile() backends can be async.
198
- for (const match of matches) {
199
- if (contextValue === 0 && match.lineText !== undefined) {
200
- const relativePath = formatPath(match.filePath);
201
- const sanitized = match.lineText
202
- .replace(/\r\n/g, "\n")
203
- .replace(/\r/g, "")
204
- .replace(/\n$/, "");
205
- const { text: truncatedText, wasTruncated } = truncateLine(sanitized);
206
- if (wasTruncated)
207
- linesTruncated = true;
208
- outputLines.push(`${relativePath}:${match.lineNumber}: ${truncatedText}`);
209
- }
210
- else {
211
- const block = await formatBlock(match.filePath, match.lineNumber);
212
- outputLines.push(...block);
213
- }
214
- }
215
225
  const rawOutput = outputLines.join("\n");
216
226
  // Apply byte truncation. There is no line limit here because the match limit already capped rows.
217
227
  const truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });
228
+ truncation.totalLines = outputLineCount;
229
+ truncation.totalBytes = outputBytes - 1;
218
230
  let output = truncation.content;
219
231
  const details = {};
220
232
  // Build actionable notices for truncation and match limits.
@@ -38,7 +38,8 @@ export function createLsToolDefinition(cwd, options) {
38
38
  (async () => {
39
39
  try {
40
40
  const dirPath = resolveToCwd(path || ".", ctx?.cwd || cwd);
41
- const effectiveLimit = limit ?? DEFAULT_LIMIT;
41
+ // A limit of 0 would list nothing and report "(empty directory)", so it means 1.
42
+ const effectiveLimit = Math.max(1, Math.floor(limit ?? DEFAULT_LIMIT));
42
43
  // Check if path exists.
43
44
  if (!(await ops.exists(dirPath))) {
44
45
  reject(new Error(`Path not found: ${dirPath}`));
@@ -1,15 +1,28 @@
1
+ import { win32 } from "node:path";
1
2
  import { getPowerShellConfig } from "../../utils/shell.js";
2
3
  import { createLocalShellOperations, createShellToolDefinition, } from "./bash.js";
3
4
  import { wrapToolDefinition } from "./tool-definition-wrapper.js";
4
5
  const UTF8_OUTPUT_PREFIX = "try { [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 } catch {}\n";
6
+ // Windows PowerShell 5.1 turns redirected native stderr into error records and sets $? to false, so
7
+ // `git push 2>&1 | Select-Object -Last 3` exits 1 although git exited 0 (#8842). PowerShell 7 does not.
8
+ // Exit 0 when the last failure is only such a record and the native command exited 0; otherwise keep the
9
+ // -Command rule: 0 when the last statement succeeded, 1 when it failed. The lone `;` keeps an unfinished last
10
+ // statement, such as `Get-ChildItem |`, a parse error instead of continuing into the suffix and running.
11
+ const WINDOWS_POWERSHELL_EXIT_SUFFIX = '\n;\nif ($?) { exit 0 }\nif (($LASTEXITCODE -eq 0) -and ("$($Error[0].FullyQualifiedErrorId)" -like "NativeCommandError*")) { exit 0 }\nexit 1';
5
12
  export const powershellToolSystemPromptContribution = {
6
13
  snippet: "Execute PowerShell commands",
7
14
  guidelines: ["You can inspect PI_* environment variables for current model and session details."],
8
15
  };
9
16
  export function createLocalPowerShellOperations() {
10
- const operations = createLocalShellOperations("PowerShell", getPowerShellConfig);
11
17
  return {
12
- exec: (command, cwd, options) => operations.exec(`${UTF8_OUTPUT_PREFIX}${command}`, cwd, options),
18
+ exec: async (command, cwd, options) => {
19
+ const shellConfig = getPowerShellConfig();
20
+ // A final backtick would continue the user's last line into the suffix, so leave such commands unchanged.
21
+ const suffix = win32.basename(shellConfig.shell).toLowerCase() === "powershell.exe" && !command.endsWith("`")
22
+ ? WINDOWS_POWERSHELL_EXIT_SUFFIX
23
+ : "";
24
+ return createLocalShellOperations("PowerShell", () => shellConfig).exec(`${UTF8_OUTPUT_PREFIX}${command}${suffix}`, cwd, options);
25
+ },
13
26
  };
14
27
  }
15
28
  const powershellToolConfig = {
@@ -40,6 +40,14 @@ export interface ReadOperations {
40
40
  access: (absolutePath: string) => Promise<void>;
41
41
  /** Detect image MIME type, return null or undefined for non-images */
42
42
  detectImageMimeType?: (absolutePath: string) => Promise<string | null | undefined>;
43
+ /**
44
+ * Stream file contents in chunks. When present, text files are read through it and only the lines
45
+ * that will be shown are kept in memory; otherwise readFile loads the whole file. Stop reading when
46
+ * the signal aborts; the read tool also stops consuming the stream then.
47
+ */
48
+ createReadStream?: (absolutePath: string, options: {
49
+ signal?: AbortSignal;
50
+ }) => AsyncIterable<Uint8Array>;
43
51
  }
44
52
  export interface ReadToolOptions {
45
53
  /** Whether to auto-resize images. Default: true */
@@ -1,6 +1,7 @@
1
1
  import { constants } from "fs";
2
- import { access as fsAccess, readFile as fsReadFile } from "fs/promises";
2
+ import { access as fsAccess, open as fsOpen, readFile as fsReadFile } from "fs/promises";
3
3
  import { Type } from "typebox";
4
+ import { TextDecoder } from "util";
4
5
  import { processImage } from "../../utils/image-process.js";
5
6
  import { detectSupportedImageMimeTypeFromFile } from "../../utils/mime.js";
6
7
  import { resolveReadPathAsync } from "./path-utils.js";
@@ -28,9 +29,26 @@ const readOutputSchema = Type.Union([
28
29
  ]);
29
30
  const defaultReadOperations = {
30
31
  readFile: (path) => fsReadFile(path),
32
+ createReadStream: readLocalFileChunks,
31
33
  access: (path) => fsAccess(path, constants.R_OK),
32
34
  detectImageMimeType: detectSupportedImageMimeTypeFromFile,
33
35
  };
36
+ /**
37
+ * Stream a local file the way fs.readFile reads it: a regular file up to its size when opened, so text
38
+ * appended during the read is not counted and a growing file still ends; a file reporting size 0 (such
39
+ * as /proc files) and other file types until EOF.
40
+ */
41
+ async function* readLocalFileChunks(path, { signal }) {
42
+ const handle = await fsOpen(path, "r");
43
+ try {
44
+ const stats = await handle.stat();
45
+ const end = stats.isFile() && stats.size > 0 ? stats.size - 1 : undefined;
46
+ yield* handle.createReadStream({ end, signal, autoClose: false });
47
+ }
48
+ finally {
49
+ await handle.close();
50
+ }
51
+ }
34
52
  /** The image block and its note, or the text for text files and images that could not be processed. */
35
53
  function toReadOutput(content) {
36
54
  const text = content.find((block) => block.type === "text")?.text ?? "";
@@ -43,6 +61,115 @@ function getNonVisionImageNote(model) {
43
61
  }
44
62
  return "[Current model does not support images. The image will be omitted from this request.]";
45
63
  }
64
+ /**
65
+ * Whether a range can be streamed. Other values (fractional, negative limit) keep the whole-file path,
66
+ * whose array slicing defines what they select, for example limit -1 as all lines but the last.
67
+ */
68
+ function isStreamableRange(offset, limit) {
69
+ return ((offset === undefined || Number.isInteger(offset)) &&
70
+ (limit === undefined || (Number.isInteger(limit) && limit >= 0)));
71
+ }
72
+ /** Select lines from a whole file in memory: for operations without createReadStream and unusual ranges. */
73
+ function selectLinesFromBuffer(buffer, startLine, limit) {
74
+ const allLines = buffer.toString("utf-8").split("\n");
75
+ const endLine = limit === undefined ? undefined : Math.min(startLine + limit, allLines.length);
76
+ const truncation = truncateHead(allLines.slice(startLine, endLine).join("\n"));
77
+ const firstLineBytes = truncation.firstLineExceedsLimit ? Buffer.byteLength(allLines[startLine], "utf-8") : 0;
78
+ return { totalFileLines: allLines.length, truncation, firstLineBytes };
79
+ }
80
+ /**
81
+ * Select lines from a file read in chunks. Only lines truncateHead can show are stored; the rest are
82
+ * counted, so memory does not grow with the file. Stops reading when the signal aborts.
83
+ */
84
+ async function selectLinesFromStream(chunks, startLine, limit, signal) {
85
+ const endLine = limit === undefined ? Number.POSITIVE_INFINITY : startLine + limit;
86
+ // Non-fatal UTF-8 that keeps a byte order mark decodes like Buffer.toString("utf-8").
87
+ const decoder = new TextDecoder("utf-8", { ignoreBOM: true });
88
+ const storedLines = [];
89
+ let storedBytes = 0;
90
+ let storedPastCaps = false;
91
+ let line = 0;
92
+ let selectedLines = 0;
93
+ let selectedBytes = 0;
94
+ let firstLineBytes = 0;
95
+ let lastLineEmpty = true;
96
+ // The selected line being read: its text, while it is stored, and its size.
97
+ let pieces = [];
98
+ let lineBytes = 0;
99
+ let lineHasText = false;
100
+ const appendToLine = (text, start, end) => {
101
+ lineHasText = true;
102
+ if (!pieces)
103
+ return;
104
+ const piece = text.slice(start, end);
105
+ // A line over the byte cap is never shown, and a first line over it is only measured: never store
106
+ // all of a 1 GB line.
107
+ if (lineBytes <= DEFAULT_MAX_BYTES)
108
+ pieces.push(piece);
109
+ lineBytes += Buffer.byteLength(piece, "utf-8");
110
+ };
111
+ const finishLine = () => {
112
+ if (pieces) {
113
+ if (selectedLines === 0)
114
+ firstLineBytes = lineBytes;
115
+ // Storing continues one line past the caps: truncateHead ignores a trailing empty line, so the
116
+ // line after the cap must be there for it to decide truncation as for the full text.
117
+ if (storedLines.length > DEFAULT_MAX_LINES || storedBytes > DEFAULT_MAX_BYTES)
118
+ storedPastCaps = true;
119
+ const text = pieces.join("");
120
+ storedBytes += Buffer.byteLength(text, "utf-8") + (storedLines.length > 0 ? 1 : 0);
121
+ storedLines.push(text);
122
+ }
123
+ selectedLines++;
124
+ lastLineEmpty = !lineHasText;
125
+ pieces = storedPastCaps ? undefined : [];
126
+ lineBytes = 0;
127
+ lineHasText = false;
128
+ };
129
+ const select = (text) => {
130
+ let position = 0;
131
+ // Start of the selected text in this piece, measured as a whole: the joined lines' size.
132
+ let selectionStart = -1;
133
+ while (true) {
134
+ const selected = line >= startLine && line < endLine;
135
+ if (selected && selectionStart === -1)
136
+ selectionStart = position;
137
+ const newline = text.indexOf("\n", position);
138
+ const end = newline === -1 ? text.length : newline;
139
+ if (selected && end > position)
140
+ appendToLine(text, position, end);
141
+ if (newline === -1)
142
+ break;
143
+ if (selected) {
144
+ finishLine();
145
+ if (line + 1 === endLine) {
146
+ selectedBytes += Buffer.byteLength(text.slice(selectionStart, newline), "utf-8");
147
+ selectionStart = -1;
148
+ }
149
+ }
150
+ line++;
151
+ position = newline + 1;
152
+ }
153
+ if (selectionStart !== -1)
154
+ selectedBytes += Buffer.byteLength(text.slice(selectionStart), "utf-8");
155
+ };
156
+ for await (const chunk of chunks) {
157
+ // Leaving the loop closes the stream.
158
+ if (signal?.aborted)
159
+ throw new Error("Operation aborted");
160
+ select(decoder.decode(chunk, { stream: true }));
161
+ }
162
+ select(decoder.decode());
163
+ if (line >= startLine && line < endLine)
164
+ finishLine();
165
+ const truncation = {
166
+ ...truncateHead(storedLines.join("\n")),
167
+ // truncateHead's counts for the joined selected lines, which drop a trailing empty line.
168
+ totalLines: selectedBytes === 0 ? 0 : selectedLines - (lastLineEmpty ? 1 : 0),
169
+ totalBytes: selectedBytes,
170
+ };
171
+ return { totalFileLines: line + 1, truncation, firstLineBytes };
172
+ }
46
173
  export function createReadToolDefinition(cwd, options) {
47
174
  const autoResizeImages = options?.autoResizeImages ?? true;
48
175
  const fallbackResizeOptions = options?.resizeOptions;
@@ -107,35 +234,24 @@ export function createReadToolDefinition(cwd, options) {
107
234
  }
108
235
  }
109
236
  else {
110
- // Read text content.
111
- const buffer = await ops.readFile(absolutePath);
112
- const textContent = buffer.toString("utf-8");
113
- const allLines = textContent.split("\n");
114
- const totalFileLines = allLines.length;
115
- // Apply offset if specified. Convert from 1-indexed input to 0-indexed array access.
237
+ // Read text content. Convert offset from 1-indexed input to 0-indexed line access.
116
238
  const startLine = offset ? Math.max(0, offset - 1) : 0;
117
239
  const startLineDisplay = startLine + 1;
240
+ const { totalFileLines, truncation, firstLineBytes } = ops.createReadStream && isStreamableRange(offset, limit)
241
+ ? await selectLinesFromStream(ops.createReadStream(absolutePath, { signal }), startLine, limit, signal)
242
+ : selectLinesFromBuffer(await ops.readFile(absolutePath), startLine, limit);
243
+ if (aborted)
244
+ return;
118
245
  // Check if offset is out of bounds.
119
- if (startLine >= allLines.length) {
120
- throw new Error(`Offset ${offset} is beyond end of file (${allLines.length} lines total)`);
121
- }
122
- let selectedContent;
123
- let userLimitedLines;
124
- // If limit is specified by the user, honor it first. Otherwise truncateHead decides.
125
- if (limit !== undefined) {
126
- const endLine = Math.min(startLine + limit, allLines.length);
127
- selectedContent = allLines.slice(startLine, endLine).join("\n");
128
- userLimitedLines = endLine - startLine;
129
- }
130
- else {
131
- selectedContent = allLines.slice(startLine).join("\n");
246
+ if (startLine >= totalFileLines) {
247
+ throw new Error(`Offset ${offset} is beyond end of file (${totalFileLines} lines total)`);
132
248
  }
133
- // Apply truncation, respecting both line and byte limits.
134
- const truncation = truncateHead(selectedContent);
249
+ // A user-specified limit is honored before truncation.
250
+ const userLimitedLines = limit === undefined ? undefined : Math.min(startLine + limit, totalFileLines) - startLine;
135
251
  let outputText;
136
252
  if (truncation.firstLineExceedsLimit) {
137
253
  // First line alone exceeds the byte limit. Point the model at a bash fallback.
138
- const firstLineSize = formatSize(Buffer.byteLength(allLines[startLine], "utf-8"));
254
+ const firstLineSize = formatSize(firstLineBytes);
139
255
  outputText = `[Line ${startLineDisplay} is ${firstLineSize}, exceeds ${formatSize(DEFAULT_MAX_BYTES)} limit. Use bash: sed -n '${startLineDisplay}p' ${path} | head -c ${DEFAULT_MAX_BYTES}]`;
140
256
  details = { truncation };
141
257
  }
@@ -152,9 +268,9 @@ export function createReadToolDefinition(cwd, options) {
152
268
  }
153
269
  details = { truncation };
154
270
  }
155
- else if (userLimitedLines !== undefined && startLine + userLimitedLines < allLines.length) {
271
+ else if (userLimitedLines !== undefined && startLine + userLimitedLines < totalFileLines) {
156
272
  // User-specified limit stopped early, but the file still has more content.
157
- const remaining = allLines.length - (startLine + userLimitedLines);
273
+ const remaining = totalFileLines - (startLine + userLimitedLines);
158
274
  const nextOffset = startLine + userLimitedLines + 1;
159
275
  outputText = `${truncation.content}\n\n[${remaining} more lines in file. Use offset=${nextOffset} to continue.]`;
160
276
  }
@@ -67,18 +67,8 @@ export declare function truncateLine(line: string, maxChars?: number): {
67
67
  text: string;
68
68
  wasTruncated: boolean;
69
69
  };
70
- export interface MiddleTruncationResult {
71
- /** The start and end of the content with a `…N chars truncated…` marker between them. */
72
- content: string;
73
- truncated: boolean;
74
- /** Characters left out. */
75
- removedChars: number;
76
- totalBytes: number;
77
- totalLines: number;
78
- }
79
- /**
80
- * Keep the start and the end of `content`, half of `maxBytes` each, and replace the middle with a
81
- * `…N chars truncated…` marker, like Codex does for tool output. Cuts only at character boundaries.
82
- */
83
- export declare function truncateMiddle(content: string, maxBytes: number): MiddleTruncationResult;
70
+ /** Returns at most the first `maxUnits` UTF-16 code units of `text`, without splitting a surrogate pair. */
71
+ export declare function sliceHead(text: string, maxUnits: number): string;
72
+ /** Returns at most the last `maxUnits` UTF-16 code units of `text`, without splitting a surrogate pair. */
73
+ export declare function sliceTail(text: string, maxUnits: number): string;
84
74
  //# sourceMappingURL=truncate.d.ts.map
@@ -210,35 +210,29 @@ export function truncateLine(line, maxChars = GREP_MAX_LINE_LENGTH) {
210
210
  if (line.length <= maxChars) {
211
211
  return { text: line, wasTruncated: false };
212
212
  }
213
- return { text: `${line.slice(0, maxChars)}... [truncated]`, wasTruncated: true };
213
+ return { text: `${sliceHead(line, maxChars)}... [truncated]`, wasTruncated: true };
214
214
  }
215
- /**
216
- * Keep the start and the end of `content`, half of `maxBytes` each, and replace the middle with a
217
- * `…N chars truncated…` marker, like Codex does for tool output. Cuts only at character boundaries.
218
- */
219
- export function truncateMiddle(content, maxBytes) {
220
- const buf = Buffer.from(content, "utf-8");
221
- const totalLines = splitLinesForCounting(content).length;
222
- if (buf.length <= maxBytes) {
223
- return { content, truncated: false, removedChars: 0, totalBytes: buf.length, totalLines };
224
- }
225
- // Continuation bytes (10xxxxxx) are not character starts.
226
- const isBoundary = (index) => index >= buf.length || (buf[index] & 0xc0) !== 0x80;
227
- let headEnd = Math.floor(maxBytes / 2);
228
- while (headEnd > 0 && !isBoundary(headEnd))
229
- headEnd--;
230
- let tailStart = buf.length - (maxBytes - Math.floor(maxBytes / 2));
231
- while (tailStart < buf.length && !isBoundary(tailStart))
232
- tailStart++;
233
- const head = buf.subarray(0, headEnd).toString("utf-8");
234
- const tail = buf.subarray(tailStart).toString("utf-8");
235
- const removedChars = Array.from(buf.subarray(headEnd, tailStart).toString("utf-8")).length;
236
- return {
237
- content: `${head}…${removedChars} chars truncated…${tail}`,
238
- truncated: true,
239
- removedChars,
240
- totalBytes: buf.length,
241
- totalLines,
242
- };
215
+ /** Returns at most the first `maxUnits` UTF-16 code units of `text`, without splitting a surrogate pair. */
216
+ export function sliceHead(text, maxUnits) {
217
+ const end = Math.max(0, maxUnits);
218
+ // A lone high surrogate before the cut would be invalid UTF-16; keep the whole character out instead.
219
+ return isHighSurrogate(text.charCodeAt(end - 1)) && isLowSurrogate(text.charCodeAt(end))
220
+ ? text.slice(0, end - 1)
221
+ : text.slice(0, end);
222
+ }
223
+ /** Returns at most the last `maxUnits` UTF-16 code units of `text`, without splitting a surrogate pair. */
224
+ export function sliceTail(text, maxUnits) {
225
+ if (maxUnits <= 0)
226
+ return "";
227
+ const start = Math.max(0, text.length - maxUnits);
228
+ return isLowSurrogate(text.charCodeAt(start)) && isHighSurrogate(text.charCodeAt(start - 1))
229
+ ? text.slice(start + 1)
230
+ : text.slice(start);
231
+ }
232
+ function isHighSurrogate(code) {
233
+ return code >= 0xd800 && code <= 0xdbff;
234
+ }
235
+ function isLowSurrogate(code) {
236
+ return code >= 0xdc00 && code <= 0xdfff;
243
237
  }
244
238
  //# sourceMappingURL=truncate.js.map
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { CodemodeSandbox, loadQuickJSWasm, parseCodemodeSource, renderToolSample, toCodemodeIdentifier, } from "@earendil-works/pi-codemode";
6
6
  import { getCodemodeWorkerSpecifier, getQuickJSWasmPath } from "../../config.js";
7
- import { formatSize } from "../../core/tools/truncate.js";
7
+ import { formatSize, sliceHead, sliceTail } from "../../core/tools/truncate.js";
8
8
  import { combineUsage } from "../../core/usage-totals.js";
9
9
  import { writeOutputFile } from "../../utils/output-files.js";
10
10
  import { Bm25Ranker, createToolSearchDocument, DEFAULT_TOOL_SEARCH_LIMIT } from "../tool-search/tool.js";
@@ -71,7 +71,7 @@ function releaseCodemodeWorker() {
71
71
  }
72
72
  const MODEL_TYPES = new Set(["chat", "image", "classifier"]);
73
73
  function truncateText(text, maxChars) {
74
- return text.length > maxChars ? `${text.slice(0, maxChars - 3)}...` : text;
74
+ return text.length > maxChars ? `${sliceHead(text, maxChars - 3)}...` : text;
75
75
  }
76
76
  function previewArgs(args) {
77
77
  if (args === undefined)
@@ -395,8 +395,8 @@ async function truncateOutput(items, maxTokens) {
395
395
  const headChars = Math.floor(budget / 2);
396
396
  const tailChars = budget - headChars;
397
397
  const removed = combined.length - headChars - tailChars;
398
- const head = combined.slice(0, headChars);
399
- const tail = tailChars > 0 ? combined.slice(-tailChars) : "";
398
+ const head = sliceHead(combined, headChars);
399
+ const tail = sliceTail(combined, tailChars);
400
400
  let text = `Warning: truncated output (original token count: ${Math.ceil(combined.length / CHARS_PER_TOKEN)})\nTotal output lines: ${combined.split("\n").length}\n\n${head}…${Math.ceil(removed / CHARS_PER_TOKEN)} tokens truncated…${tail}`;
401
401
  const spilled = await spillOutput(combined);
402
402
  text +=