gsd-pi 2.9.0 → 2.10.1

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 (1074) hide show
  1. package/node_modules/@gsd/native/dist/ast/index.d.ts +4 -0
  2. package/node_modules/@gsd/native/dist/ast/index.js +7 -0
  3. package/node_modules/@gsd/native/dist/ast/types.d.ts +69 -0
  4. package/node_modules/@gsd/native/dist/clipboard/index.d.ts +28 -0
  5. package/node_modules/@gsd/native/dist/clipboard/index.js +33 -0
  6. package/node_modules/@gsd/native/dist/clipboard/types.d.ts +7 -0
  7. package/node_modules/@gsd/native/dist/fd/index.d.ts +25 -0
  8. package/node_modules/@gsd/native/dist/fd/index.js +26 -0
  9. package/node_modules/@gsd/native/dist/fd/types.d.ts +29 -0
  10. package/node_modules/@gsd/native/dist/glob/index.d.ts +28 -0
  11. package/node_modules/@gsd/native/dist/glob/index.js +31 -0
  12. package/node_modules/@gsd/native/dist/glob/types.d.ts +50 -0
  13. package/node_modules/@gsd/native/dist/glob/types.js +1 -0
  14. package/node_modules/@gsd/native/dist/grep/index.d.ts +20 -0
  15. package/node_modules/@gsd/native/dist/grep/index.js +23 -0
  16. package/node_modules/@gsd/native/dist/grep/types.d.ts +99 -0
  17. package/node_modules/@gsd/native/dist/grep/types.js +1 -0
  18. package/node_modules/@gsd/native/dist/gsd-parser/index.d.ts +45 -0
  19. package/node_modules/@gsd/native/dist/gsd-parser/index.js +54 -0
  20. package/node_modules/@gsd/native/dist/gsd-parser/types.d.ts +55 -0
  21. package/node_modules/@gsd/native/dist/gsd-parser/types.js +7 -0
  22. package/node_modules/@gsd/native/dist/highlight/index.d.ts +28 -0
  23. package/node_modules/@gsd/native/dist/highlight/index.js +33 -0
  24. package/node_modules/@gsd/native/dist/highlight/types.d.ts +25 -0
  25. package/node_modules/@gsd/native/dist/highlight/types.js +1 -0
  26. package/node_modules/@gsd/native/dist/html/index.d.ts +15 -0
  27. package/node_modules/@gsd/native/dist/html/index.js +16 -0
  28. package/node_modules/@gsd/native/dist/html/types.d.ts +7 -0
  29. package/node_modules/@gsd/native/dist/html/types.js +1 -0
  30. package/node_modules/@gsd/native/dist/image/index.d.ts +15 -0
  31. package/node_modules/@gsd/native/dist/image/index.js +18 -0
  32. package/node_modules/@gsd/native/dist/image/types.d.ts +35 -0
  33. package/node_modules/@gsd/native/dist/image/types.js +26 -0
  34. package/node_modules/@gsd/native/dist/index.d.ts +34 -0
  35. package/node_modules/@gsd/native/dist/index.js +25 -0
  36. package/node_modules/@gsd/native/dist/native.d.ts +33 -0
  37. package/node_modules/@gsd/native/dist/native.js +34 -0
  38. package/node_modules/@gsd/native/dist/ps/index.d.ts +38 -0
  39. package/node_modules/@gsd/native/dist/ps/index.js +47 -0
  40. package/node_modules/@gsd/native/dist/ps/types.d.ts +5 -0
  41. package/node_modules/@gsd/native/dist/ps/types.js +1 -0
  42. package/node_modules/@gsd/native/dist/text/index.d.ts +55 -0
  43. package/node_modules/@gsd/native/dist/text/index.js +66 -0
  44. package/node_modules/@gsd/native/dist/text/types.d.ts +27 -0
  45. package/node_modules/@gsd/native/dist/text/types.js +10 -0
  46. package/node_modules/@gsd/native/package.json +60 -0
  47. package/node_modules/@gsd/pi-coding-agent/dist/core/lsp/defaults.json +456 -0
  48. package/node_modules/@gsd/pi-coding-agent/dist/core/lsp/lsp.md +33 -0
  49. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/find.d.ts +1 -1
  50. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
  51. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/find.js +12 -77
  52. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/find.js.map +1 -1
  53. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline-edit.d.ts +60 -0
  54. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline-edit.d.ts.map +1 -0
  55. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline-edit.js +247 -0
  56. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline-edit.js.map +1 -0
  57. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline-read.d.ts +43 -0
  58. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline-read.d.ts.map +1 -0
  59. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline-read.js +146 -0
  60. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline-read.js.map +1 -0
  61. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline.d.ts +114 -0
  62. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline.d.ts.map +1 -0
  63. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline.js +522 -0
  64. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline.js.map +1 -0
  65. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline.test.d.ts +2 -0
  66. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline.test.d.ts.map +1 -0
  67. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline.test.js +376 -0
  68. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/hashline.test.js.map +1 -0
  69. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/index.d.ts +25 -0
  70. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/index.d.ts.map +1 -1
  71. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/index.js +23 -0
  72. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/index.js.map +1 -1
  73. package/node_modules/@gsd/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  74. package/node_modules/@gsd/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +6 -3
  75. package/node_modules/@gsd/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  76. package/node_modules/@gsd/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +0 -1
  77. package/node_modules/@gsd/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  78. package/node_modules/@gsd/pi-coding-agent/dist/modes/interactive/interactive-mode.js +8 -9
  79. package/node_modules/@gsd/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  80. package/node_modules/@gsd/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  81. package/node_modules/@gsd/pi-coding-agent/dist/modes/interactive/theme/theme.js +25 -40
  82. package/node_modules/@gsd/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  83. package/node_modules/@gsd/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -1
  84. package/node_modules/@gsd/pi-coding-agent/dist/utils/clipboard-image.js +17 -21
  85. package/node_modules/@gsd/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -1
  86. package/node_modules/@gsd/pi-coding-agent/dist/utils/clipboard-native.d.ts +7 -6
  87. package/node_modules/@gsd/pi-coding-agent/dist/utils/clipboard-native.d.ts.map +1 -1
  88. package/node_modules/@gsd/pi-coding-agent/dist/utils/clipboard-native.js +7 -13
  89. package/node_modules/@gsd/pi-coding-agent/dist/utils/clipboard-native.js.map +1 -1
  90. package/node_modules/@gsd/pi-coding-agent/dist/utils/clipboard.d.ts.map +1 -1
  91. package/node_modules/@gsd/pi-coding-agent/dist/utils/clipboard.js +3 -56
  92. package/node_modules/@gsd/pi-coding-agent/dist/utils/clipboard.js.map +1 -1
  93. package/node_modules/@gsd/pi-coding-agent/dist/utils/image-convert.d.ts.map +1 -1
  94. package/node_modules/@gsd/pi-coding-agent/dist/utils/image-convert.js +7 -17
  95. package/node_modules/@gsd/pi-coding-agent/dist/utils/image-convert.js.map +1 -1
  96. package/node_modules/@gsd/pi-coding-agent/dist/utils/image-resize.d.ts +1 -2
  97. package/node_modules/@gsd/pi-coding-agent/dist/utils/image-resize.d.ts.map +1 -1
  98. package/node_modules/@gsd/pi-coding-agent/dist/utils/image-resize.js +21 -29
  99. package/node_modules/@gsd/pi-coding-agent/dist/utils/image-resize.js.map +1 -1
  100. package/node_modules/@gsd/pi-coding-agent/package.json +2 -5
  101. package/node_modules/@gsd/pi-coding-agent/src/core/tools/find.ts +13 -88
  102. package/node_modules/@gsd/pi-coding-agent/src/core/tools/hashline-edit.ts +318 -0
  103. package/node_modules/@gsd/pi-coding-agent/src/core/tools/hashline-read.ts +196 -0
  104. package/node_modules/@gsd/pi-coding-agent/src/core/tools/hashline.test.ts +456 -0
  105. package/node_modules/@gsd/pi-coding-agent/src/core/tools/hashline.ts +594 -0
  106. package/node_modules/@gsd/pi-coding-agent/src/core/tools/index.ts +53 -0
  107. package/node_modules/@gsd/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +5 -3
  108. package/node_modules/@gsd/pi-coding-agent/src/modes/interactive/interactive-mode.ts +7 -10
  109. package/node_modules/@gsd/pi-coding-agent/src/modes/interactive/theme/theme.ts +26 -42
  110. package/node_modules/@gsd/pi-coding-agent/src/utils/clipboard-image.ts +17 -24
  111. package/node_modules/@gsd/pi-coding-agent/src/utils/clipboard-native.ts +11 -21
  112. package/node_modules/@gsd/pi-coding-agent/src/utils/clipboard.ts +3 -51
  113. package/node_modules/@gsd/pi-coding-agent/src/utils/image-convert.ts +7 -17
  114. package/node_modules/@gsd/pi-coding-agent/src/utils/image-resize.ts +28 -34
  115. package/node_modules/@gsd/pi-tui/dist/autocomplete.d.ts +1 -3
  116. package/node_modules/@gsd/pi-tui/dist/autocomplete.d.ts.map +1 -1
  117. package/node_modules/@gsd/pi-tui/dist/autocomplete.js +16 -95
  118. package/node_modules/@gsd/pi-tui/dist/autocomplete.js.map +1 -1
  119. package/node_modules/@gsd/pi-tui/dist/components/image.d.ts +7 -0
  120. package/node_modules/@gsd/pi-tui/dist/components/image.d.ts.map +1 -1
  121. package/node_modules/@gsd/pi-tui/dist/components/image.js +20 -1
  122. package/node_modules/@gsd/pi-tui/dist/components/image.js.map +1 -1
  123. package/node_modules/@gsd/pi-tui/dist/index.d.ts +1 -1
  124. package/node_modules/@gsd/pi-tui/dist/index.d.ts.map +1 -1
  125. package/node_modules/@gsd/pi-tui/dist/index.js +1 -1
  126. package/node_modules/@gsd/pi-tui/dist/index.js.map +1 -1
  127. package/node_modules/@gsd/pi-tui/dist/terminal-image.d.ts +5 -5
  128. package/node_modules/@gsd/pi-tui/dist/terminal-image.d.ts.map +1 -1
  129. package/node_modules/@gsd/pi-tui/dist/terminal-image.js +9 -120
  130. package/node_modules/@gsd/pi-tui/dist/terminal-image.js.map +1 -1
  131. package/node_modules/@gsd/pi-tui/dist/utils.d.ts +23 -26
  132. package/node_modules/@gsd/pi-tui/dist/utils.d.ts.map +1 -1
  133. package/node_modules/@gsd/pi-tui/dist/utils.js +47 -716
  134. package/node_modules/@gsd/pi-tui/dist/utils.js.map +1 -1
  135. package/node_modules/@gsd/pi-tui/package.json +1 -0
  136. package/node_modules/@gsd/pi-tui/src/autocomplete.ts +17 -112
  137. package/node_modules/@gsd/pi-tui/src/components/image.ts +23 -1
  138. package/node_modules/@gsd/pi-tui/src/index.ts +0 -4
  139. package/node_modules/@gsd/pi-tui/src/terminal-image.ts +9 -135
  140. package/node_modules/@gsd/pi-tui/src/utils.ts +51 -775
  141. package/package.json +7 -2
  142. package/packages/native/dist/ast/index.d.ts +4 -0
  143. package/packages/native/dist/ast/index.js +7 -0
  144. package/packages/native/dist/ast/types.d.ts +69 -0
  145. package/packages/native/dist/ast/types.js +1 -0
  146. package/packages/native/dist/clipboard/index.d.ts +28 -0
  147. package/packages/native/dist/clipboard/index.js +33 -0
  148. package/packages/native/dist/clipboard/types.d.ts +7 -0
  149. package/packages/native/dist/clipboard/types.js +1 -0
  150. package/packages/native/dist/fd/index.d.ts +25 -0
  151. package/packages/native/dist/fd/index.js +26 -0
  152. package/packages/native/dist/fd/types.d.ts +29 -0
  153. package/packages/native/dist/fd/types.js +1 -0
  154. package/packages/native/dist/glob/index.d.ts +28 -0
  155. package/packages/native/dist/glob/index.js +31 -0
  156. package/packages/native/dist/glob/types.d.ts +50 -0
  157. package/packages/native/dist/glob/types.js +1 -0
  158. package/packages/native/dist/grep/index.d.ts +20 -0
  159. package/packages/native/dist/grep/index.js +23 -0
  160. package/packages/native/dist/grep/types.d.ts +99 -0
  161. package/packages/native/dist/grep/types.js +1 -0
  162. package/packages/native/dist/gsd-parser/index.d.ts +45 -0
  163. package/packages/native/dist/gsd-parser/index.js +54 -0
  164. package/packages/native/dist/gsd-parser/types.d.ts +55 -0
  165. package/packages/native/dist/gsd-parser/types.js +7 -0
  166. package/packages/native/dist/highlight/index.d.ts +28 -0
  167. package/packages/native/dist/highlight/index.js +33 -0
  168. package/packages/native/dist/highlight/types.d.ts +25 -0
  169. package/packages/native/dist/highlight/types.js +1 -0
  170. package/packages/native/dist/html/index.d.ts +15 -0
  171. package/packages/native/dist/html/index.js +16 -0
  172. package/packages/native/dist/html/types.d.ts +7 -0
  173. package/packages/native/dist/html/types.js +1 -0
  174. package/packages/native/dist/image/index.d.ts +15 -0
  175. package/packages/native/dist/image/index.js +18 -0
  176. package/packages/native/dist/image/types.d.ts +35 -0
  177. package/packages/native/dist/image/types.js +26 -0
  178. package/packages/native/dist/index.d.ts +34 -0
  179. package/packages/native/dist/index.js +25 -0
  180. package/packages/native/dist/native.d.ts +33 -0
  181. package/packages/native/dist/native.js +34 -0
  182. package/packages/native/dist/ps/index.d.ts +38 -0
  183. package/packages/native/dist/ps/index.js +47 -0
  184. package/packages/native/dist/ps/types.d.ts +5 -0
  185. package/packages/native/dist/ps/types.js +1 -0
  186. package/packages/native/dist/text/index.d.ts +55 -0
  187. package/packages/native/dist/text/index.js +66 -0
  188. package/packages/native/dist/text/types.d.ts +27 -0
  189. package/packages/native/dist/text/types.js +10 -0
  190. package/packages/native/package.json +60 -0
  191. package/packages/native/src/__tests__/clipboard.test.mjs +79 -0
  192. package/packages/native/src/__tests__/fd.test.mjs +164 -0
  193. package/packages/native/src/__tests__/glob.test.mjs +237 -0
  194. package/packages/native/src/__tests__/grep.test.mjs +162 -0
  195. package/packages/native/src/__tests__/highlight.test.mjs +156 -0
  196. package/packages/native/src/__tests__/html.test.mjs +98 -0
  197. package/packages/native/src/__tests__/image.test.mjs +137 -0
  198. package/packages/native/src/__tests__/ps.test.mjs +109 -0
  199. package/packages/native/src/__tests__/text.test.mjs +262 -0
  200. package/packages/native/src/ast/index.ts +12 -0
  201. package/packages/native/src/ast/types.ts +75 -0
  202. package/packages/native/src/clipboard/index.ts +40 -0
  203. package/packages/native/src/clipboard/types.ts +7 -0
  204. package/packages/native/src/fd/index.ts +35 -0
  205. package/packages/native/src/fd/types.ts +31 -0
  206. package/packages/native/src/glob/index.ts +44 -0
  207. package/packages/native/src/glob/types.ts +53 -0
  208. package/packages/native/src/grep/index.ts +48 -0
  209. package/packages/native/src/grep/types.ts +105 -0
  210. package/packages/native/src/highlight/index.ts +44 -0
  211. package/packages/native/src/highlight/types.ts +25 -0
  212. package/packages/native/src/html/index.ts +24 -0
  213. package/packages/native/src/html/types.ts +7 -0
  214. package/packages/native/src/image/index.ts +28 -0
  215. package/packages/native/src/image/types.ts +41 -0
  216. package/packages/native/src/index.ts +85 -0
  217. package/packages/native/src/native.ts +91 -0
  218. package/packages/native/src/ps/index.ts +52 -0
  219. package/packages/native/src/ps/types.ts +5 -0
  220. package/packages/native/src/text/index.ts +125 -0
  221. package/packages/native/src/text/types.ts +29 -0
  222. package/packages/native/tsconfig.json +8 -0
  223. package/packages/pi-coding-agent/dist/core/lsp/defaults.json +456 -0
  224. package/packages/pi-coding-agent/dist/core/lsp/lsp.md +33 -0
  225. package/packages/pi-coding-agent/dist/core/tools/find.d.ts +1 -1
  226. package/packages/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
  227. package/packages/pi-coding-agent/dist/core/tools/find.js +12 -77
  228. package/packages/pi-coding-agent/dist/core/tools/find.js.map +1 -1
  229. package/packages/pi-coding-agent/dist/core/tools/hashline-edit.d.ts +60 -0
  230. package/packages/pi-coding-agent/dist/core/tools/hashline-edit.d.ts.map +1 -0
  231. package/packages/pi-coding-agent/dist/core/tools/hashline-edit.js +247 -0
  232. package/packages/pi-coding-agent/dist/core/tools/hashline-edit.js.map +1 -0
  233. package/packages/pi-coding-agent/dist/core/tools/hashline-read.d.ts +43 -0
  234. package/packages/pi-coding-agent/dist/core/tools/hashline-read.d.ts.map +1 -0
  235. package/packages/pi-coding-agent/dist/core/tools/hashline-read.js +146 -0
  236. package/packages/pi-coding-agent/dist/core/tools/hashline-read.js.map +1 -0
  237. package/packages/pi-coding-agent/dist/core/tools/hashline.d.ts +114 -0
  238. package/packages/pi-coding-agent/dist/core/tools/hashline.d.ts.map +1 -0
  239. package/packages/pi-coding-agent/dist/core/tools/hashline.js +522 -0
  240. package/packages/pi-coding-agent/dist/core/tools/hashline.js.map +1 -0
  241. package/packages/pi-coding-agent/dist/core/tools/hashline.test.d.ts +2 -0
  242. package/packages/pi-coding-agent/dist/core/tools/hashline.test.d.ts.map +1 -0
  243. package/packages/pi-coding-agent/dist/core/tools/hashline.test.js +376 -0
  244. package/packages/pi-coding-agent/dist/core/tools/hashline.test.js.map +1 -0
  245. package/packages/pi-coding-agent/dist/core/tools/index.d.ts +25 -0
  246. package/packages/pi-coding-agent/dist/core/tools/index.d.ts.map +1 -1
  247. package/packages/pi-coding-agent/dist/core/tools/index.js +23 -0
  248. package/packages/pi-coding-agent/dist/core/tools/index.js.map +1 -1
  249. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  250. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +6 -3
  251. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  252. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +0 -1
  253. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  254. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +8 -9
  255. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  256. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  257. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +25 -40
  258. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  259. package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -1
  260. package/packages/pi-coding-agent/dist/utils/clipboard-image.js +17 -21
  261. package/packages/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -1
  262. package/packages/pi-coding-agent/dist/utils/clipboard-native.d.ts +7 -6
  263. package/packages/pi-coding-agent/dist/utils/clipboard-native.d.ts.map +1 -1
  264. package/packages/pi-coding-agent/dist/utils/clipboard-native.js +7 -13
  265. package/packages/pi-coding-agent/dist/utils/clipboard-native.js.map +1 -1
  266. package/packages/pi-coding-agent/dist/utils/clipboard.d.ts.map +1 -1
  267. package/packages/pi-coding-agent/dist/utils/clipboard.js +3 -56
  268. package/packages/pi-coding-agent/dist/utils/clipboard.js.map +1 -1
  269. package/packages/pi-coding-agent/dist/utils/image-convert.d.ts.map +1 -1
  270. package/packages/pi-coding-agent/dist/utils/image-convert.js +7 -17
  271. package/packages/pi-coding-agent/dist/utils/image-convert.js.map +1 -1
  272. package/packages/pi-coding-agent/dist/utils/image-resize.d.ts +1 -2
  273. package/packages/pi-coding-agent/dist/utils/image-resize.d.ts.map +1 -1
  274. package/packages/pi-coding-agent/dist/utils/image-resize.js +21 -29
  275. package/packages/pi-coding-agent/dist/utils/image-resize.js.map +1 -1
  276. package/packages/pi-coding-agent/package.json +2 -5
  277. package/packages/pi-coding-agent/src/core/tools/find.ts +13 -88
  278. package/packages/pi-coding-agent/src/core/tools/hashline-edit.ts +318 -0
  279. package/packages/pi-coding-agent/src/core/tools/hashline-read.ts +196 -0
  280. package/packages/pi-coding-agent/src/core/tools/hashline.test.ts +456 -0
  281. package/packages/pi-coding-agent/src/core/tools/hashline.ts +594 -0
  282. package/packages/pi-coding-agent/src/core/tools/index.ts +53 -0
  283. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +5 -3
  284. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +7 -10
  285. package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +26 -42
  286. package/packages/pi-coding-agent/src/utils/clipboard-image.ts +17 -24
  287. package/packages/pi-coding-agent/src/utils/clipboard-native.ts +11 -21
  288. package/packages/pi-coding-agent/src/utils/clipboard.ts +3 -51
  289. package/packages/pi-coding-agent/src/utils/image-convert.ts +7 -17
  290. package/packages/pi-coding-agent/src/utils/image-resize.ts +28 -34
  291. package/packages/pi-tui/dist/autocomplete.d.ts +1 -3
  292. package/packages/pi-tui/dist/autocomplete.d.ts.map +1 -1
  293. package/packages/pi-tui/dist/autocomplete.js +16 -95
  294. package/packages/pi-tui/dist/autocomplete.js.map +1 -1
  295. package/packages/pi-tui/dist/components/image.d.ts +7 -0
  296. package/packages/pi-tui/dist/components/image.d.ts.map +1 -1
  297. package/packages/pi-tui/dist/components/image.js +20 -1
  298. package/packages/pi-tui/dist/components/image.js.map +1 -1
  299. package/packages/pi-tui/dist/index.d.ts +1 -1
  300. package/packages/pi-tui/dist/index.d.ts.map +1 -1
  301. package/packages/pi-tui/dist/index.js +1 -1
  302. package/packages/pi-tui/dist/index.js.map +1 -1
  303. package/packages/pi-tui/dist/terminal-image.d.ts +5 -5
  304. package/packages/pi-tui/dist/terminal-image.d.ts.map +1 -1
  305. package/packages/pi-tui/dist/terminal-image.js +9 -120
  306. package/packages/pi-tui/dist/terminal-image.js.map +1 -1
  307. package/packages/pi-tui/dist/utils.d.ts +23 -26
  308. package/packages/pi-tui/dist/utils.d.ts.map +1 -1
  309. package/packages/pi-tui/dist/utils.js +47 -716
  310. package/packages/pi-tui/dist/utils.js.map +1 -1
  311. package/packages/pi-tui/package.json +1 -0
  312. package/packages/pi-tui/src/autocomplete.ts +17 -112
  313. package/packages/pi-tui/src/components/image.ts +23 -1
  314. package/packages/pi-tui/src/index.ts +0 -4
  315. package/packages/pi-tui/src/terminal-image.ts +9 -135
  316. package/packages/pi-tui/src/utils.ts +51 -775
  317. package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  318. package/pkg/dist/modes/interactive/theme/theme.js +25 -40
  319. package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
  320. package/src/resources/extensions/bg-shell/index.ts +343 -14
  321. package/src/resources/extensions/gsd/git-service.ts +13 -1
  322. package/src/resources/extensions/universal-config/discovery.ts +78 -0
  323. package/src/resources/extensions/universal-config/format.ts +160 -0
  324. package/src/resources/extensions/universal-config/index.ts +118 -0
  325. package/src/resources/extensions/universal-config/package.json +11 -0
  326. package/src/resources/extensions/universal-config/scanners.ts +579 -0
  327. package/src/resources/extensions/universal-config/tests/discovery.test.ts +111 -0
  328. package/src/resources/extensions/universal-config/tests/format.test.ts +111 -0
  329. package/src/resources/extensions/universal-config/tests/scanners.test.ts +438 -0
  330. package/src/resources/extensions/universal-config/tools.ts +60 -0
  331. package/src/resources/extensions/universal-config/types.ts +116 -0
  332. package/node_modules/@mariozechner/clipboard/.yarnrc.yml +0 -1
  333. package/node_modules/@mariozechner/clipboard/Cargo.toml +0 -26
  334. package/node_modules/@mariozechner/clipboard/README.md +0 -58
  335. package/node_modules/@mariozechner/clipboard/build.rs +0 -5
  336. package/node_modules/@mariozechner/clipboard/exp.ts +0 -12
  337. package/node_modules/@mariozechner/clipboard/index.d.ts +0 -23
  338. package/node_modules/@mariozechner/clipboard/index.js +0 -317
  339. package/node_modules/@mariozechner/clipboard/package.json +0 -56
  340. package/node_modules/@mariozechner/clipboard/src/lib.rs +0 -191
  341. package/node_modules/@mariozechner/clipboard-darwin-arm64/README.md +0 -3
  342. package/node_modules/@mariozechner/clipboard-darwin-arm64/clipboard.darwin-arm64.node +0 -0
  343. package/node_modules/@mariozechner/clipboard-darwin-arm64/package.json +0 -22
  344. package/node_modules/@mariozechner/clipboard-darwin-universal/README.md +0 -3
  345. package/node_modules/@mariozechner/clipboard-darwin-universal/clipboard.darwin-universal.node +0 -0
  346. package/node_modules/@mariozechner/clipboard-darwin-universal/package.json +0 -19
  347. package/node_modules/ansi-styles/index.d.ts +0 -345
  348. package/node_modules/ansi-styles/index.js +0 -163
  349. package/node_modules/ansi-styles/license +0 -9
  350. package/node_modules/ansi-styles/package.json +0 -56
  351. package/node_modules/ansi-styles/readme.md +0 -152
  352. package/node_modules/any-promise/.jshintrc +0 -4
  353. package/node_modules/any-promise/.npmignore +0 -7
  354. package/node_modules/any-promise/LICENSE +0 -19
  355. package/node_modules/any-promise/README.md +0 -161
  356. package/node_modules/any-promise/implementation.d.ts +0 -3
  357. package/node_modules/any-promise/implementation.js +0 -1
  358. package/node_modules/any-promise/index.d.ts +0 -73
  359. package/node_modules/any-promise/index.js +0 -1
  360. package/node_modules/any-promise/loader.js +0 -78
  361. package/node_modules/any-promise/optional.js +0 -6
  362. package/node_modules/any-promise/package.json +0 -45
  363. package/node_modules/any-promise/register/bluebird.d.ts +0 -1
  364. package/node_modules/any-promise/register/bluebird.js +0 -2
  365. package/node_modules/any-promise/register/es6-promise.d.ts +0 -1
  366. package/node_modules/any-promise/register/es6-promise.js +0 -2
  367. package/node_modules/any-promise/register/lie.d.ts +0 -1
  368. package/node_modules/any-promise/register/lie.js +0 -2
  369. package/node_modules/any-promise/register/native-promise-only.d.ts +0 -1
  370. package/node_modules/any-promise/register/native-promise-only.js +0 -2
  371. package/node_modules/any-promise/register/pinkie.d.ts +0 -1
  372. package/node_modules/any-promise/register/pinkie.js +0 -2
  373. package/node_modules/any-promise/register/promise.d.ts +0 -1
  374. package/node_modules/any-promise/register/promise.js +0 -2
  375. package/node_modules/any-promise/register/q.d.ts +0 -1
  376. package/node_modules/any-promise/register/q.js +0 -2
  377. package/node_modules/any-promise/register/rsvp.d.ts +0 -1
  378. package/node_modules/any-promise/register/rsvp.js +0 -2
  379. package/node_modules/any-promise/register/vow.d.ts +0 -1
  380. package/node_modules/any-promise/register/vow.js +0 -2
  381. package/node_modules/any-promise/register/when.d.ts +0 -1
  382. package/node_modules/any-promise/register/when.js +0 -2
  383. package/node_modules/any-promise/register-shim.js +0 -18
  384. package/node_modules/any-promise/register.d.ts +0 -17
  385. package/node_modules/any-promise/register.js +0 -94
  386. package/node_modules/cli-highlight/LICENSE.txt +0 -15
  387. package/node_modules/cli-highlight/README.md +0 -88
  388. package/node_modules/cli-highlight/bin/highlight +0 -2
  389. package/node_modules/cli-highlight/dist/cli.js +0 -102
  390. package/node_modules/cli-highlight/dist/cli.js.map +0 -1
  391. package/node_modules/cli-highlight/dist/index.d.ts +0 -53
  392. package/node_modules/cli-highlight/dist/index.js +0 -112
  393. package/node_modules/cli-highlight/dist/index.js.map +0 -1
  394. package/node_modules/cli-highlight/dist/test/test.js +0 -62
  395. package/node_modules/cli-highlight/dist/test/test.js.map +0 -1
  396. package/node_modules/cli-highlight/dist/theme.d.ts +0 -270
  397. package/node_modules/cli-highlight/dist/theme.js +0 -265
  398. package/node_modules/cli-highlight/dist/theme.js.map +0 -1
  399. package/node_modules/cli-highlight/node_modules/chalk/index.d.ts +0 -415
  400. package/node_modules/cli-highlight/node_modules/chalk/license +0 -9
  401. package/node_modules/cli-highlight/node_modules/chalk/package.json +0 -68
  402. package/node_modules/cli-highlight/node_modules/chalk/readme.md +0 -341
  403. package/node_modules/cli-highlight/node_modules/chalk/source/index.js +0 -229
  404. package/node_modules/cli-highlight/node_modules/chalk/source/templates.js +0 -134
  405. package/node_modules/cli-highlight/node_modules/chalk/source/util.js +0 -39
  406. package/node_modules/cli-highlight/package.json +0 -129
  407. package/node_modules/cliui/CHANGELOG.md +0 -121
  408. package/node_modules/cliui/LICENSE.txt +0 -14
  409. package/node_modules/cliui/README.md +0 -141
  410. package/node_modules/cliui/build/index.cjs +0 -302
  411. package/node_modules/cliui/build/lib/index.js +0 -287
  412. package/node_modules/cliui/build/lib/string-utils.js +0 -27
  413. package/node_modules/cliui/index.mjs +0 -13
  414. package/node_modules/cliui/node_modules/ansi-regex/index.d.ts +0 -37
  415. package/node_modules/cliui/node_modules/ansi-regex/index.js +0 -10
  416. package/node_modules/cliui/node_modules/ansi-regex/license +0 -9
  417. package/node_modules/cliui/node_modules/ansi-regex/package.json +0 -55
  418. package/node_modules/cliui/node_modules/ansi-regex/readme.md +0 -78
  419. package/node_modules/cliui/node_modules/strip-ansi/index.d.ts +0 -17
  420. package/node_modules/cliui/node_modules/strip-ansi/index.js +0 -4
  421. package/node_modules/cliui/node_modules/strip-ansi/license +0 -9
  422. package/node_modules/cliui/node_modules/strip-ansi/package.json +0 -54
  423. package/node_modules/cliui/node_modules/strip-ansi/readme.md +0 -46
  424. package/node_modules/cliui/package.json +0 -83
  425. package/node_modules/color-convert/CHANGELOG.md +0 -54
  426. package/node_modules/color-convert/LICENSE +0 -21
  427. package/node_modules/color-convert/README.md +0 -68
  428. package/node_modules/color-convert/conversions.js +0 -839
  429. package/node_modules/color-convert/index.js +0 -81
  430. package/node_modules/color-convert/package.json +0 -48
  431. package/node_modules/color-convert/route.js +0 -97
  432. package/node_modules/color-name/LICENSE +0 -8
  433. package/node_modules/color-name/README.md +0 -11
  434. package/node_modules/color-name/index.js +0 -152
  435. package/node_modules/color-name/package.json +0 -28
  436. package/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
  437. package/node_modules/emoji-regex/README.md +0 -73
  438. package/node_modules/emoji-regex/es2015/index.js +0 -6
  439. package/node_modules/emoji-regex/es2015/text.js +0 -6
  440. package/node_modules/emoji-regex/index.d.ts +0 -23
  441. package/node_modules/emoji-regex/index.js +0 -6
  442. package/node_modules/emoji-regex/package.json +0 -50
  443. package/node_modules/emoji-regex/text.js +0 -6
  444. package/node_modules/escalade/dist/index.js +0 -22
  445. package/node_modules/escalade/dist/index.mjs +0 -22
  446. package/node_modules/escalade/index.d.mts +0 -11
  447. package/node_modules/escalade/index.d.ts +0 -15
  448. package/node_modules/escalade/license +0 -9
  449. package/node_modules/escalade/package.json +0 -74
  450. package/node_modules/escalade/readme.md +0 -211
  451. package/node_modules/escalade/sync/index.d.mts +0 -9
  452. package/node_modules/escalade/sync/index.d.ts +0 -13
  453. package/node_modules/escalade/sync/index.js +0 -18
  454. package/node_modules/escalade/sync/index.mjs +0 -18
  455. package/node_modules/esprima/ChangeLog +0 -235
  456. package/node_modules/get-caller-file/LICENSE.md +0 -6
  457. package/node_modules/get-caller-file/README.md +0 -41
  458. package/node_modules/get-caller-file/index.d.ts +0 -2
  459. package/node_modules/get-caller-file/index.js +0 -22
  460. package/node_modules/get-caller-file/index.js.map +0 -1
  461. package/node_modules/get-caller-file/package.json +0 -42
  462. package/node_modules/has-flag/index.d.ts +0 -39
  463. package/node_modules/has-flag/index.js +0 -8
  464. package/node_modules/has-flag/license +0 -9
  465. package/node_modules/has-flag/package.json +0 -46
  466. package/node_modules/has-flag/readme.md +0 -89
  467. package/node_modules/highlight.js/LICENSE +0 -29
  468. package/node_modules/highlight.js/README.md +0 -371
  469. package/node_modules/highlight.js/lib/core.js +0 -2517
  470. package/node_modules/highlight.js/lib/highlight.js +0 -2
  471. package/node_modules/highlight.js/lib/index.js +0 -195
  472. package/node_modules/highlight.js/lib/languages/1c.js +0 -521
  473. package/node_modules/highlight.js/lib/languages/abnf.js +0 -103
  474. package/node_modules/highlight.js/lib/languages/accesslog.js +0 -127
  475. package/node_modules/highlight.js/lib/languages/actionscript.js +0 -113
  476. package/node_modules/highlight.js/lib/languages/ada.js +0 -194
  477. package/node_modules/highlight.js/lib/languages/angelscript.js +0 -123
  478. package/node_modules/highlight.js/lib/languages/apache.js +0 -89
  479. package/node_modules/highlight.js/lib/languages/applescript.js +0 -189
  480. package/node_modules/highlight.js/lib/languages/arcade.js +0 -165
  481. package/node_modules/highlight.js/lib/languages/arduino.js +0 -576
  482. package/node_modules/highlight.js/lib/languages/armasm.js +0 -131
  483. package/node_modules/highlight.js/lib/languages/asciidoc.js +0 -303
  484. package/node_modules/highlight.js/lib/languages/aspectj.js +0 -186
  485. package/node_modules/highlight.js/lib/languages/autohotkey.js +0 -84
  486. package/node_modules/highlight.js/lib/languages/autoit.js +0 -183
  487. package/node_modules/highlight.js/lib/languages/avrasm.js +0 -80
  488. package/node_modules/highlight.js/lib/languages/awk.js +0 -73
  489. package/node_modules/highlight.js/lib/languages/axapta.js +0 -179
  490. package/node_modules/highlight.js/lib/languages/bash.js +0 -169
  491. package/node_modules/highlight.js/lib/languages/basic.js +0 -65
  492. package/node_modules/highlight.js/lib/languages/bnf.js +0 -38
  493. package/node_modules/highlight.js/lib/languages/brainfuck.js +0 -46
  494. package/node_modules/highlight.js/lib/languages/c-like.js +0 -501
  495. package/node_modules/highlight.js/lib/languages/c.js +0 -309
  496. package/node_modules/highlight.js/lib/languages/cal.js +0 -104
  497. package/node_modules/highlight.js/lib/languages/capnproto.js +0 -64
  498. package/node_modules/highlight.js/lib/languages/ceylon.js +0 -82
  499. package/node_modules/highlight.js/lib/languages/clean.js +0 -40
  500. package/node_modules/highlight.js/lib/languages/clojure-repl.js +0 -27
  501. package/node_modules/highlight.js/lib/languages/clojure.js +0 -158
  502. package/node_modules/highlight.js/lib/languages/cmake.js +0 -64
  503. package/node_modules/highlight.js/lib/languages/coffeescript.js +0 -356
  504. package/node_modules/highlight.js/lib/languages/coq.js +0 -79
  505. package/node_modules/highlight.js/lib/languages/cos.js +0 -138
  506. package/node_modules/highlight.js/lib/languages/cpp.js +0 -464
  507. package/node_modules/highlight.js/lib/languages/crmsh.js +0 -102
  508. package/node_modules/highlight.js/lib/languages/crystal.js +0 -326
  509. package/node_modules/highlight.js/lib/languages/csharp.js +0 -441
  510. package/node_modules/highlight.js/lib/languages/csp.js +0 -37
  511. package/node_modules/highlight.js/lib/languages/css.js +0 -608
  512. package/node_modules/highlight.js/lib/languages/d.js +0 -271
  513. package/node_modules/highlight.js/lib/languages/dart.js +0 -199
  514. package/node_modules/highlight.js/lib/languages/delphi.js +0 -126
  515. package/node_modules/highlight.js/lib/languages/diff.js +0 -85
  516. package/node_modules/highlight.js/lib/languages/django.js +0 -77
  517. package/node_modules/highlight.js/lib/languages/dns.js +0 -46
  518. package/node_modules/highlight.js/lib/languages/dockerfile.js +0 -34
  519. package/node_modules/highlight.js/lib/languages/dos.js +0 -70
  520. package/node_modules/highlight.js/lib/languages/dsconfig.js +0 -66
  521. package/node_modules/highlight.js/lib/languages/dts.js +0 -153
  522. package/node_modules/highlight.js/lib/languages/dust.js +0 -45
  523. package/node_modules/highlight.js/lib/languages/ebnf.js +0 -53
  524. package/node_modules/highlight.js/lib/languages/elixir.js +0 -259
  525. package/node_modules/highlight.js/lib/languages/elm.js +0 -129
  526. package/node_modules/highlight.js/lib/languages/erb.js +0 -29
  527. package/node_modules/highlight.js/lib/languages/erlang-repl.js +0 -86
  528. package/node_modules/highlight.js/lib/languages/erlang.js +0 -199
  529. package/node_modules/highlight.js/lib/languages/excel.js +0 -64
  530. package/node_modules/highlight.js/lib/languages/fix.js +0 -37
  531. package/node_modules/highlight.js/lib/languages/flix.js +0 -54
  532. package/node_modules/highlight.js/lib/languages/fortran.js +0 -159
  533. package/node_modules/highlight.js/lib/languages/fsharp.js +0 -86
  534. package/node_modules/highlight.js/lib/languages/gams.js +0 -208
  535. package/node_modules/highlight.js/lib/languages/gauss.js +0 -316
  536. package/node_modules/highlight.js/lib/languages/gcode.js +0 -88
  537. package/node_modules/highlight.js/lib/languages/gherkin.js +0 -49
  538. package/node_modules/highlight.js/lib/languages/glsl.js +0 -128
  539. package/node_modules/highlight.js/lib/languages/gml.js +0 -885
  540. package/node_modules/highlight.js/lib/languages/go.js +0 -74
  541. package/node_modules/highlight.js/lib/languages/golo.js +0 -33
  542. package/node_modules/highlight.js/lib/languages/gradle.js +0 -44
  543. package/node_modules/highlight.js/lib/languages/groovy.js +0 -174
  544. package/node_modules/highlight.js/lib/languages/haml.js +0 -117
  545. package/node_modules/highlight.js/lib/languages/handlebars.js +0 -324
  546. package/node_modules/highlight.js/lib/languages/haskell.js +0 -173
  547. package/node_modules/highlight.js/lib/languages/haxe.js +0 -157
  548. package/node_modules/highlight.js/lib/languages/hsp.js +0 -65
  549. package/node_modules/highlight.js/lib/languages/htmlbars.js +0 -352
  550. package/node_modules/highlight.js/lib/languages/http.js +0 -121
  551. package/node_modules/highlight.js/lib/languages/hy.js +0 -109
  552. package/node_modules/highlight.js/lib/languages/inform7.js +0 -70
  553. package/node_modules/highlight.js/lib/languages/ini.js +0 -173
  554. package/node_modules/highlight.js/lib/languages/irpf90.js +0 -141
  555. package/node_modules/highlight.js/lib/languages/isbl.js +0 -3207
  556. package/node_modules/highlight.js/lib/languages/java.js +0 -181
  557. package/node_modules/highlight.js/lib/languages/javascript.js +0 -604
  558. package/node_modules/highlight.js/lib/languages/jboss-cli.js +0 -63
  559. package/node_modules/highlight.js/lib/languages/json.js +0 -63
  560. package/node_modules/highlight.js/lib/languages/julia-repl.js +0 -50
  561. package/node_modules/highlight.js/lib/languages/julia.js +0 -416
  562. package/node_modules/highlight.js/lib/languages/kotlin.js +0 -284
  563. package/node_modules/highlight.js/lib/languages/lasso.js +0 -187
  564. package/node_modules/highlight.js/lib/languages/latex.js +0 -276
  565. package/node_modules/highlight.js/lib/languages/ldif.js +0 -42
  566. package/node_modules/highlight.js/lib/languages/leaf.js +0 -49
  567. package/node_modules/highlight.js/lib/languages/less.js +0 -666
  568. package/node_modules/highlight.js/lib/languages/lisp.js +0 -111
  569. package/node_modules/highlight.js/lib/languages/livecodeserver.js +0 -189
  570. package/node_modules/highlight.js/lib/languages/livescript.js +0 -374
  571. package/node_modules/highlight.js/lib/languages/llvm.js +0 -154
  572. package/node_modules/highlight.js/lib/languages/lsl.js +0 -95
  573. package/node_modules/highlight.js/lib/languages/lua.js +0 -82
  574. package/node_modules/highlight.js/lib/languages/makefile.js +0 -92
  575. package/node_modules/highlight.js/lib/languages/markdown.js +0 -258
  576. package/node_modules/highlight.js/lib/languages/mathematica.js +0 -6797
  577. package/node_modules/highlight.js/lib/languages/matlab.js +0 -106
  578. package/node_modules/highlight.js/lib/languages/maxima.js +0 -417
  579. package/node_modules/highlight.js/lib/languages/mel.js +0 -236
  580. package/node_modules/highlight.js/lib/languages/mercury.js +0 -121
  581. package/node_modules/highlight.js/lib/languages/mipsasm.js +0 -109
  582. package/node_modules/highlight.js/lib/languages/mizar.js +0 -29
  583. package/node_modules/highlight.js/lib/languages/mojolicious.js +0 -36
  584. package/node_modules/highlight.js/lib/languages/monkey.js +0 -89
  585. package/node_modules/highlight.js/lib/languages/moonscript.js +0 -147
  586. package/node_modules/highlight.js/lib/languages/n1ql.js +0 -77
  587. package/node_modules/highlight.js/lib/languages/nginx.js +0 -140
  588. package/node_modules/highlight.js/lib/languages/nim.js +0 -79
  589. package/node_modules/highlight.js/lib/languages/nix.js +0 -65
  590. package/node_modules/highlight.js/lib/languages/node-repl.js +0 -37
  591. package/node_modules/highlight.js/lib/languages/nsis.js +0 -119
  592. package/node_modules/highlight.js/lib/languages/objectivec.js +0 -121
  593. package/node_modules/highlight.js/lib/languages/ocaml.js +0 -82
  594. package/node_modules/highlight.js/lib/languages/openscad.js +0 -81
  595. package/node_modules/highlight.js/lib/languages/oxygene.js +0 -101
  596. package/node_modules/highlight.js/lib/languages/parser3.js +0 -57
  597. package/node_modules/highlight.js/lib/languages/perl.js +0 -515
  598. package/node_modules/highlight.js/lib/languages/pf.js +0 -59
  599. package/node_modules/highlight.js/lib/languages/pgsql.js +0 -630
  600. package/node_modules/highlight.js/lib/languages/php-template.js +0 -54
  601. package/node_modules/highlight.js/lib/languages/php.js +0 -204
  602. package/node_modules/highlight.js/lib/languages/plaintext.js +0 -19
  603. package/node_modules/highlight.js/lib/languages/pony.js +0 -89
  604. package/node_modules/highlight.js/lib/languages/powershell.js +0 -331
  605. package/node_modules/highlight.js/lib/languages/processing.js +0 -58
  606. package/node_modules/highlight.js/lib/languages/profile.js +0 -43
  607. package/node_modules/highlight.js/lib/languages/prolog.js +0 -102
  608. package/node_modules/highlight.js/lib/languages/properties.js +0 -85
  609. package/node_modules/highlight.js/lib/languages/protobuf.js +0 -47
  610. package/node_modules/highlight.js/lib/languages/puppet.js +0 -147
  611. package/node_modules/highlight.js/lib/languages/purebasic.js +0 -101
  612. package/node_modules/highlight.js/lib/languages/python-repl.js +0 -36
  613. package/node_modules/highlight.js/lib/languages/python.js +0 -446
  614. package/node_modules/highlight.js/lib/languages/q.js +0 -37
  615. package/node_modules/highlight.js/lib/languages/qml.js +0 -225
  616. package/node_modules/highlight.js/lib/languages/r.js +0 -231
  617. package/node_modules/highlight.js/lib/languages/reasonml.js +0 -321
  618. package/node_modules/highlight.js/lib/languages/rib.js +0 -37
  619. package/node_modules/highlight.js/lib/languages/roboconf.js +0 -82
  620. package/node_modules/highlight.js/lib/languages/routeros.js +0 -172
  621. package/node_modules/highlight.js/lib/languages/rsl.js +0 -49
  622. package/node_modules/highlight.js/lib/languages/ruby.js +0 -387
  623. package/node_modules/highlight.js/lib/languages/ruleslanguage.js +0 -78
  624. package/node_modules/highlight.js/lib/languages/rust.js +0 -146
  625. package/node_modules/highlight.js/lib/languages/sas.js +0 -133
  626. package/node_modules/highlight.js/lib/languages/scala.js +0 -140
  627. package/node_modules/highlight.js/lib/languages/scheme.js +0 -207
  628. package/node_modules/highlight.js/lib/languages/scilab.js +0 -73
  629. package/node_modules/highlight.js/lib/languages/scss.js +0 -545
  630. package/node_modules/highlight.js/lib/languages/shell.js +0 -30
  631. package/node_modules/highlight.js/lib/languages/smali.js +0 -135
  632. package/node_modules/highlight.js/lib/languages/smalltalk.js +0 -63
  633. package/node_modules/highlight.js/lib/languages/sml.js +0 -81
  634. package/node_modules/highlight.js/lib/languages/sqf.js +0 -448
  635. package/node_modules/highlight.js/lib/languages/sql.js +0 -699
  636. package/node_modules/highlight.js/lib/languages/sql_more.js +0 -183
  637. package/node_modules/highlight.js/lib/languages/stan.js +0 -548
  638. package/node_modules/highlight.js/lib/languages/stata.js +0 -60
  639. package/node_modules/highlight.js/lib/languages/step21.js +0 -66
  640. package/node_modules/highlight.js/lib/languages/stylus.js +0 -609
  641. package/node_modules/highlight.js/lib/languages/subunit.js +0 -51
  642. package/node_modules/highlight.js/lib/languages/swift.js +0 -873
  643. package/node_modules/highlight.js/lib/languages/taggerscript.js +0 -52
  644. package/node_modules/highlight.js/lib/languages/tap.js +0 -55
  645. package/node_modules/highlight.js/lib/languages/tcl.js +0 -115
  646. package/node_modules/highlight.js/lib/languages/thrift.js +0 -51
  647. package/node_modules/highlight.js/lib/languages/tp.js +0 -95
  648. package/node_modules/highlight.js/lib/languages/twig.js +0 -77
  649. package/node_modules/highlight.js/lib/languages/typescript.js +0 -697
  650. package/node_modules/highlight.js/lib/languages/vala.js +0 -61
  651. package/node_modules/highlight.js/lib/languages/vbnet.js +0 -214
  652. package/node_modules/highlight.js/lib/languages/vbscript-html.js +0 -24
  653. package/node_modules/highlight.js/lib/languages/vbscript.js +0 -109
  654. package/node_modules/highlight.js/lib/languages/verilog.js +0 -131
  655. package/node_modules/highlight.js/lib/languages/vhdl.js +0 -71
  656. package/node_modules/highlight.js/lib/languages/vim.js +0 -123
  657. package/node_modules/highlight.js/lib/languages/x86asm.js +0 -163
  658. package/node_modules/highlight.js/lib/languages/xl.js +0 -92
  659. package/node_modules/highlight.js/lib/languages/xml.js +0 -287
  660. package/node_modules/highlight.js/lib/languages/xquery.js +0 -197
  661. package/node_modules/highlight.js/lib/languages/yaml.js +0 -176
  662. package/node_modules/highlight.js/lib/languages/zephir.js +0 -140
  663. package/node_modules/highlight.js/package.json +0 -86
  664. package/node_modules/highlight.js/scss/a11y-dark.scss +0 -99
  665. package/node_modules/highlight.js/scss/a11y-light.scss +0 -99
  666. package/node_modules/highlight.js/scss/agate.scss +0 -108
  667. package/node_modules/highlight.js/scss/an-old-hope.scss +0 -89
  668. package/node_modules/highlight.js/scss/androidstudio.scss +0 -66
  669. package/node_modules/highlight.js/scss/arduino-light.scss +0 -87
  670. package/node_modules/highlight.js/scss/arta.scss +0 -73
  671. package/node_modules/highlight.js/scss/ascetic.scss +0 -45
  672. package/node_modules/highlight.js/scss/atelier-cave-dark.scss +0 -83
  673. package/node_modules/highlight.js/scss/atelier-cave-light.scss +0 -85
  674. package/node_modules/highlight.js/scss/atelier-dune-dark.scss +0 -69
  675. package/node_modules/highlight.js/scss/atelier-dune-light.scss +0 -69
  676. package/node_modules/highlight.js/scss/atelier-estuary-dark.scss +0 -84
  677. package/node_modules/highlight.js/scss/atelier-estuary-light.scss +0 -84
  678. package/node_modules/highlight.js/scss/atelier-forest-dark.scss +0 -69
  679. package/node_modules/highlight.js/scss/atelier-forest-light.scss +0 -69
  680. package/node_modules/highlight.js/scss/atelier-heath-dark.scss +0 -69
  681. package/node_modules/highlight.js/scss/atelier-heath-light.scss +0 -69
  682. package/node_modules/highlight.js/scss/atelier-lakeside-dark.scss +0 -69
  683. package/node_modules/highlight.js/scss/atelier-lakeside-light.scss +0 -69
  684. package/node_modules/highlight.js/scss/atelier-plateau-dark.scss +0 -84
  685. package/node_modules/highlight.js/scss/atelier-plateau-light.scss +0 -84
  686. package/node_modules/highlight.js/scss/atelier-savanna-dark.scss +0 -84
  687. package/node_modules/highlight.js/scss/atelier-savanna-light.scss +0 -84
  688. package/node_modules/highlight.js/scss/atelier-seaside-dark.scss +0 -69
  689. package/node_modules/highlight.js/scss/atelier-seaside-light.scss +0 -69
  690. package/node_modules/highlight.js/scss/atelier-sulphurpool-dark.scss +0 -69
  691. package/node_modules/highlight.js/scss/atelier-sulphurpool-light.scss +0 -69
  692. package/node_modules/highlight.js/scss/atom-one-dark-reasonable.scss +0 -75
  693. package/node_modules/highlight.js/scss/atom-one-dark.scss +0 -96
  694. package/node_modules/highlight.js/scss/atom-one-light.scss +0 -96
  695. package/node_modules/highlight.js/scss/brown-paper.scss +0 -64
  696. package/node_modules/highlight.js/scss/brown-papersq.png +0 -0
  697. package/node_modules/highlight.js/scss/codepen-embed.scss +0 -60
  698. package/node_modules/highlight.js/scss/color-brewer.scss +0 -71
  699. package/node_modules/highlight.js/scss/darcula.scss +0 -74
  700. package/node_modules/highlight.js/scss/dark.scss +0 -63
  701. package/node_modules/highlight.js/scss/default.scss +0 -99
  702. package/node_modules/highlight.js/scss/docco.scss +0 -97
  703. package/node_modules/highlight.js/scss/dracula.scss +0 -76
  704. package/node_modules/highlight.js/scss/far.scss +0 -71
  705. package/node_modules/highlight.js/scss/foundation.scss +0 -89
  706. package/node_modules/highlight.js/scss/github-gist.scss +0 -79
  707. package/node_modules/highlight.js/scss/github.scss +0 -99
  708. package/node_modules/highlight.js/scss/gml.scss +0 -78
  709. package/node_modules/highlight.js/scss/googlecode.scss +0 -89
  710. package/node_modules/highlight.js/scss/gradient-dark.scss +0 -122
  711. package/node_modules/highlight.js/scss/gradient-light.scss +0 -130
  712. package/node_modules/highlight.js/scss/grayscale.scss +0 -101
  713. package/node_modules/highlight.js/scss/gruvbox-dark.scss +0 -108
  714. package/node_modules/highlight.js/scss/gruvbox-light.scss +0 -108
  715. package/node_modules/highlight.js/scss/hopscotch.scss +0 -84
  716. package/node_modules/highlight.js/scss/hybrid.scss +0 -102
  717. package/node_modules/highlight.js/scss/idea.scss +0 -97
  718. package/node_modules/highlight.js/scss/ir-black.scss +0 -73
  719. package/node_modules/highlight.js/scss/isbl-editor-dark.scss +0 -112
  720. package/node_modules/highlight.js/scss/isbl-editor-light.scss +0 -111
  721. package/node_modules/highlight.js/scss/kimbie.dark.scss +0 -74
  722. package/node_modules/highlight.js/scss/kimbie.light.scss +0 -74
  723. package/node_modules/highlight.js/scss/lightfair.scss +0 -88
  724. package/node_modules/highlight.js/scss/lioshi.scss +0 -88
  725. package/node_modules/highlight.js/scss/magula.scss +0 -70
  726. package/node_modules/highlight.js/scss/mono-blue.scss +0 -56
  727. package/node_modules/highlight.js/scss/monokai-sublime.scss +0 -83
  728. package/node_modules/highlight.js/scss/monokai.scss +0 -71
  729. package/node_modules/highlight.js/scss/night-owl.scss +0 -182
  730. package/node_modules/highlight.js/scss/nnfx-dark.scss +0 -106
  731. package/node_modules/highlight.js/scss/nnfx.scss +0 -106
  732. package/node_modules/highlight.js/scss/nord.scss +0 -309
  733. package/node_modules/highlight.js/scss/obsidian.scss +0 -88
  734. package/node_modules/highlight.js/scss/ocean.scss +0 -74
  735. package/node_modules/highlight.js/scss/paraiso-dark.scss +0 -72
  736. package/node_modules/highlight.js/scss/paraiso-light.scss +0 -72
  737. package/node_modules/highlight.js/scss/pojoaque.jpg +0 -0
  738. package/node_modules/highlight.js/scss/pojoaque.scss +0 -83
  739. package/node_modules/highlight.js/scss/purebasic.scss +0 -96
  740. package/node_modules/highlight.js/scss/qtcreator_dark.scss +0 -83
  741. package/node_modules/highlight.js/scss/qtcreator_light.scss +0 -83
  742. package/node_modules/highlight.js/scss/railscasts.scss +0 -106
  743. package/node_modules/highlight.js/scss/rainbow.scss +0 -85
  744. package/node_modules/highlight.js/scss/routeros.scss +0 -108
  745. package/node_modules/highlight.js/scss/school-book.png +0 -0
  746. package/node_modules/highlight.js/scss/school-book.scss +0 -69
  747. package/node_modules/highlight.js/scss/shades-of-purple.scss +0 -96
  748. package/node_modules/highlight.js/scss/solarized-dark.scss +0 -84
  749. package/node_modules/highlight.js/scss/solarized-light.scss +0 -84
  750. package/node_modules/highlight.js/scss/srcery.scss +0 -78
  751. package/node_modules/highlight.js/scss/stackoverflow-dark.scss +0 -78
  752. package/node_modules/highlight.js/scss/stackoverflow-light.scss +0 -78
  753. package/node_modules/highlight.js/scss/sunburst.scss +0 -102
  754. package/node_modules/highlight.js/scss/tomorrow-night-blue.scss +0 -75
  755. package/node_modules/highlight.js/scss/tomorrow-night-bright.scss +0 -74
  756. package/node_modules/highlight.js/scss/tomorrow-night-eighties.scss +0 -74
  757. package/node_modules/highlight.js/scss/tomorrow-night.scss +0 -75
  758. package/node_modules/highlight.js/scss/tomorrow.scss +0 -72
  759. package/node_modules/highlight.js/scss/vs.scss +0 -68
  760. package/node_modules/highlight.js/scss/vs2015.scss +0 -115
  761. package/node_modules/highlight.js/scss/xcode.scss +0 -104
  762. package/node_modules/highlight.js/scss/xt256.scss +0 -92
  763. package/node_modules/highlight.js/scss/zenburn.scss +0 -80
  764. package/node_modules/highlight.js/styles/a11y-dark.css +0 -99
  765. package/node_modules/highlight.js/styles/a11y-light.css +0 -99
  766. package/node_modules/highlight.js/styles/agate.css +0 -108
  767. package/node_modules/highlight.js/styles/an-old-hope.css +0 -89
  768. package/node_modules/highlight.js/styles/androidstudio.css +0 -66
  769. package/node_modules/highlight.js/styles/arduino-light.css +0 -87
  770. package/node_modules/highlight.js/styles/arta.css +0 -73
  771. package/node_modules/highlight.js/styles/ascetic.css +0 -45
  772. package/node_modules/highlight.js/styles/atelier-cave-dark.css +0 -83
  773. package/node_modules/highlight.js/styles/atelier-cave-light.css +0 -85
  774. package/node_modules/highlight.js/styles/atelier-dune-dark.css +0 -69
  775. package/node_modules/highlight.js/styles/atelier-dune-light.css +0 -69
  776. package/node_modules/highlight.js/styles/atelier-estuary-dark.css +0 -84
  777. package/node_modules/highlight.js/styles/atelier-estuary-light.css +0 -84
  778. package/node_modules/highlight.js/styles/atelier-forest-dark.css +0 -69
  779. package/node_modules/highlight.js/styles/atelier-forest-light.css +0 -69
  780. package/node_modules/highlight.js/styles/atelier-heath-dark.css +0 -69
  781. package/node_modules/highlight.js/styles/atelier-heath-light.css +0 -69
  782. package/node_modules/highlight.js/styles/atelier-lakeside-dark.css +0 -69
  783. package/node_modules/highlight.js/styles/atelier-lakeside-light.css +0 -69
  784. package/node_modules/highlight.js/styles/atelier-plateau-dark.css +0 -84
  785. package/node_modules/highlight.js/styles/atelier-plateau-light.css +0 -84
  786. package/node_modules/highlight.js/styles/atelier-savanna-dark.css +0 -84
  787. package/node_modules/highlight.js/styles/atelier-savanna-light.css +0 -84
  788. package/node_modules/highlight.js/styles/atelier-seaside-dark.css +0 -69
  789. package/node_modules/highlight.js/styles/atelier-seaside-light.css +0 -69
  790. package/node_modules/highlight.js/styles/atelier-sulphurpool-dark.css +0 -69
  791. package/node_modules/highlight.js/styles/atelier-sulphurpool-light.css +0 -69
  792. package/node_modules/highlight.js/styles/atom-one-dark-reasonable.css +0 -75
  793. package/node_modules/highlight.js/styles/atom-one-dark.css +0 -96
  794. package/node_modules/highlight.js/styles/atom-one-light.css +0 -96
  795. package/node_modules/highlight.js/styles/brown-paper.css +0 -64
  796. package/node_modules/highlight.js/styles/brown-papersq.png +0 -0
  797. package/node_modules/highlight.js/styles/codepen-embed.css +0 -60
  798. package/node_modules/highlight.js/styles/color-brewer.css +0 -71
  799. package/node_modules/highlight.js/styles/darcula.css +0 -74
  800. package/node_modules/highlight.js/styles/dark.css +0 -63
  801. package/node_modules/highlight.js/styles/default.css +0 -99
  802. package/node_modules/highlight.js/styles/docco.css +0 -97
  803. package/node_modules/highlight.js/styles/dracula.css +0 -76
  804. package/node_modules/highlight.js/styles/far.css +0 -71
  805. package/node_modules/highlight.js/styles/foundation.css +0 -89
  806. package/node_modules/highlight.js/styles/github-gist.css +0 -79
  807. package/node_modules/highlight.js/styles/github.css +0 -99
  808. package/node_modules/highlight.js/styles/gml.css +0 -78
  809. package/node_modules/highlight.js/styles/googlecode.css +0 -89
  810. package/node_modules/highlight.js/styles/gradient-dark.css +0 -122
  811. package/node_modules/highlight.js/styles/gradient-light.css +0 -130
  812. package/node_modules/highlight.js/styles/grayscale.css +0 -101
  813. package/node_modules/highlight.js/styles/gruvbox-dark.css +0 -108
  814. package/node_modules/highlight.js/styles/gruvbox-light.css +0 -108
  815. package/node_modules/highlight.js/styles/hopscotch.css +0 -84
  816. package/node_modules/highlight.js/styles/hybrid.css +0 -102
  817. package/node_modules/highlight.js/styles/idea.css +0 -97
  818. package/node_modules/highlight.js/styles/ir-black.css +0 -73
  819. package/node_modules/highlight.js/styles/isbl-editor-dark.css +0 -112
  820. package/node_modules/highlight.js/styles/isbl-editor-light.css +0 -111
  821. package/node_modules/highlight.js/styles/kimbie.dark.css +0 -74
  822. package/node_modules/highlight.js/styles/kimbie.light.css +0 -74
  823. package/node_modules/highlight.js/styles/lightfair.css +0 -88
  824. package/node_modules/highlight.js/styles/lioshi.css +0 -88
  825. package/node_modules/highlight.js/styles/magula.css +0 -70
  826. package/node_modules/highlight.js/styles/mono-blue.css +0 -56
  827. package/node_modules/highlight.js/styles/monokai-sublime.css +0 -83
  828. package/node_modules/highlight.js/styles/monokai.css +0 -71
  829. package/node_modules/highlight.js/styles/night-owl.css +0 -182
  830. package/node_modules/highlight.js/styles/nnfx-dark.css +0 -106
  831. package/node_modules/highlight.js/styles/nnfx.css +0 -106
  832. package/node_modules/highlight.js/styles/nord.css +0 -309
  833. package/node_modules/highlight.js/styles/obsidian.css +0 -88
  834. package/node_modules/highlight.js/styles/ocean.css +0 -74
  835. package/node_modules/highlight.js/styles/paraiso-dark.css +0 -72
  836. package/node_modules/highlight.js/styles/paraiso-light.css +0 -72
  837. package/node_modules/highlight.js/styles/pojoaque.css +0 -83
  838. package/node_modules/highlight.js/styles/pojoaque.jpg +0 -0
  839. package/node_modules/highlight.js/styles/purebasic.css +0 -96
  840. package/node_modules/highlight.js/styles/qtcreator_dark.css +0 -83
  841. package/node_modules/highlight.js/styles/qtcreator_light.css +0 -83
  842. package/node_modules/highlight.js/styles/railscasts.css +0 -106
  843. package/node_modules/highlight.js/styles/rainbow.css +0 -85
  844. package/node_modules/highlight.js/styles/routeros.css +0 -108
  845. package/node_modules/highlight.js/styles/school-book.css +0 -69
  846. package/node_modules/highlight.js/styles/school-book.png +0 -0
  847. package/node_modules/highlight.js/styles/shades-of-purple.css +0 -96
  848. package/node_modules/highlight.js/styles/solarized-dark.css +0 -84
  849. package/node_modules/highlight.js/styles/solarized-light.css +0 -84
  850. package/node_modules/highlight.js/styles/srcery.css +0 -78
  851. package/node_modules/highlight.js/styles/stackoverflow-dark.css +0 -78
  852. package/node_modules/highlight.js/styles/stackoverflow-light.css +0 -78
  853. package/node_modules/highlight.js/styles/sunburst.css +0 -102
  854. package/node_modules/highlight.js/styles/tomorrow-night-blue.css +0 -75
  855. package/node_modules/highlight.js/styles/tomorrow-night-bright.css +0 -74
  856. package/node_modules/highlight.js/styles/tomorrow-night-eighties.css +0 -74
  857. package/node_modules/highlight.js/styles/tomorrow-night.css +0 -75
  858. package/node_modules/highlight.js/styles/tomorrow.css +0 -72
  859. package/node_modules/highlight.js/styles/vs.css +0 -68
  860. package/node_modules/highlight.js/styles/vs2015.css +0 -115
  861. package/node_modules/highlight.js/styles/xcode.css +0 -104
  862. package/node_modules/highlight.js/styles/xt256.css +0 -92
  863. package/node_modules/highlight.js/styles/zenburn.css +0 -80
  864. package/node_modules/highlight.js/types/index.d.ts +0 -261
  865. package/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
  866. package/node_modules/is-fullwidth-code-point/index.js +0 -50
  867. package/node_modules/is-fullwidth-code-point/license +0 -9
  868. package/node_modules/is-fullwidth-code-point/package.json +0 -42
  869. package/node_modules/is-fullwidth-code-point/readme.md +0 -39
  870. package/node_modules/mz/HISTORY.md +0 -66
  871. package/node_modules/mz/LICENSE +0 -22
  872. package/node_modules/mz/README.md +0 -106
  873. package/node_modules/mz/child_process.js +0 -8
  874. package/node_modules/mz/crypto.js +0 -9
  875. package/node_modules/mz/dns.js +0 -16
  876. package/node_modules/mz/fs.js +0 -62
  877. package/node_modules/mz/index.js +0 -8
  878. package/node_modules/mz/package.json +0 -44
  879. package/node_modules/mz/readline.js +0 -64
  880. package/node_modules/mz/zlib.js +0 -13
  881. package/node_modules/object-assign/index.js +0 -90
  882. package/node_modules/object-assign/license +0 -21
  883. package/node_modules/object-assign/package.json +0 -42
  884. package/node_modules/object-assign/readme.md +0 -61
  885. package/node_modules/parse5/LICENSE +0 -19
  886. package/node_modules/parse5/README.md +0 -38
  887. package/node_modules/parse5/lib/common/doctype.js +0 -162
  888. package/node_modules/parse5/lib/common/error-codes.js +0 -65
  889. package/node_modules/parse5/lib/common/foreign-content.js +0 -265
  890. package/node_modules/parse5/lib/common/html.js +0 -272
  891. package/node_modules/parse5/lib/common/unicode.js +0 -109
  892. package/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js +0 -43
  893. package/node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js +0 -52
  894. package/node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js +0 -24
  895. package/node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js +0 -17
  896. package/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js +0 -35
  897. package/node_modules/parse5/lib/extensions/location-info/parser-mixin.js +0 -222
  898. package/node_modules/parse5/lib/extensions/location-info/tokenizer-mixin.js +0 -146
  899. package/node_modules/parse5/lib/extensions/position-tracking/preprocessor-mixin.js +0 -64
  900. package/node_modules/parse5/lib/index.js +0 -29
  901. package/node_modules/parse5/lib/parser/formatting-element-list.js +0 -181
  902. package/node_modules/parse5/lib/parser/index.js +0 -2956
  903. package/node_modules/parse5/lib/parser/open-element-stack.js +0 -482
  904. package/node_modules/parse5/lib/serializer/index.js +0 -176
  905. package/node_modules/parse5/lib/tokenizer/index.js +0 -2196
  906. package/node_modules/parse5/lib/tokenizer/named-entity-data.js +0 -5
  907. package/node_modules/parse5/lib/tokenizer/preprocessor.js +0 -159
  908. package/node_modules/parse5/lib/tree-adapters/default.js +0 -217
  909. package/node_modules/parse5/lib/utils/merge-options.js +0 -13
  910. package/node_modules/parse5/lib/utils/mixin.js +0 -39
  911. package/node_modules/parse5/package.json +0 -35
  912. package/node_modules/parse5-htmlparser2-tree-adapter/LICENSE +0 -19
  913. package/node_modules/parse5-htmlparser2-tree-adapter/README.md +0 -34
  914. package/node_modules/parse5-htmlparser2-tree-adapter/lib/index.js +0 -348
  915. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/LICENSE +0 -19
  916. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/README.md +0 -38
  917. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/doctype.js +0 -162
  918. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/error-codes.js +0 -65
  919. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/foreign-content.js +0 -265
  920. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/html.js +0 -272
  921. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/unicode.js +0 -109
  922. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js +0 -43
  923. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js +0 -52
  924. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js +0 -24
  925. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js +0 -17
  926. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js +0 -35
  927. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/location-info/parser-mixin.js +0 -223
  928. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/location-info/tokenizer-mixin.js +0 -146
  929. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/position-tracking/preprocessor-mixin.js +0 -64
  930. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/index.js +0 -29
  931. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/parser/formatting-element-list.js +0 -181
  932. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/parser/index.js +0 -2956
  933. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/parser/open-element-stack.js +0 -482
  934. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/serializer/index.js +0 -176
  935. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/tokenizer/index.js +0 -2196
  936. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/tokenizer/named-entity-data.js +0 -5
  937. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/tokenizer/preprocessor.js +0 -159
  938. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/tree-adapters/default.js +0 -221
  939. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/utils/merge-options.js +0 -13
  940. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/utils/mixin.js +0 -39
  941. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/package.json +0 -35
  942. package/node_modules/parse5-htmlparser2-tree-adapter/package.json +0 -27
  943. package/node_modules/proper-lockfile/CHANGELOG.md +0 -108
  944. package/node_modules/require-directory/.jshintrc +0 -67
  945. package/node_modules/require-directory/.npmignore +0 -1
  946. package/node_modules/require-directory/.travis.yml +0 -3
  947. package/node_modules/require-directory/LICENSE +0 -22
  948. package/node_modules/require-directory/README.markdown +0 -184
  949. package/node_modules/require-directory/index.js +0 -86
  950. package/node_modules/require-directory/package.json +0 -40
  951. package/node_modules/source-map/CHANGELOG.md +0 -301
  952. package/node_modules/string-width/index.d.ts +0 -29
  953. package/node_modules/string-width/index.js +0 -47
  954. package/node_modules/string-width/license +0 -9
  955. package/node_modules/string-width/node_modules/ansi-regex/index.d.ts +0 -37
  956. package/node_modules/string-width/node_modules/ansi-regex/index.js +0 -10
  957. package/node_modules/string-width/node_modules/ansi-regex/license +0 -9
  958. package/node_modules/string-width/node_modules/ansi-regex/package.json +0 -55
  959. package/node_modules/string-width/node_modules/ansi-regex/readme.md +0 -78
  960. package/node_modules/string-width/node_modules/strip-ansi/index.d.ts +0 -17
  961. package/node_modules/string-width/node_modules/strip-ansi/index.js +0 -4
  962. package/node_modules/string-width/node_modules/strip-ansi/license +0 -9
  963. package/node_modules/string-width/node_modules/strip-ansi/package.json +0 -54
  964. package/node_modules/string-width/node_modules/strip-ansi/readme.md +0 -46
  965. package/node_modules/string-width/package.json +0 -56
  966. package/node_modules/string-width/readme.md +0 -50
  967. package/node_modules/supports-color/browser.js +0 -5
  968. package/node_modules/supports-color/index.js +0 -135
  969. package/node_modules/supports-color/license +0 -9
  970. package/node_modules/supports-color/package.json +0 -53
  971. package/node_modules/supports-color/readme.md +0 -76
  972. package/node_modules/thenify/History.md +0 -11
  973. package/node_modules/thenify/LICENSE +0 -22
  974. package/node_modules/thenify/README.md +0 -120
  975. package/node_modules/thenify/index.js +0 -77
  976. package/node_modules/thenify/package.json +0 -31
  977. package/node_modules/thenify-all/History.md +0 -11
  978. package/node_modules/thenify-all/LICENSE +0 -22
  979. package/node_modules/thenify-all/README.md +0 -66
  980. package/node_modules/thenify-all/index.js +0 -73
  981. package/node_modules/thenify-all/package.json +0 -34
  982. package/node_modules/wrap-ansi/index.js +0 -216
  983. package/node_modules/wrap-ansi/license +0 -9
  984. package/node_modules/wrap-ansi/node_modules/ansi-regex/index.d.ts +0 -37
  985. package/node_modules/wrap-ansi/node_modules/ansi-regex/index.js +0 -10
  986. package/node_modules/wrap-ansi/node_modules/ansi-regex/license +0 -9
  987. package/node_modules/wrap-ansi/node_modules/ansi-regex/package.json +0 -55
  988. package/node_modules/wrap-ansi/node_modules/ansi-regex/readme.md +0 -78
  989. package/node_modules/wrap-ansi/node_modules/strip-ansi/index.d.ts +0 -17
  990. package/node_modules/wrap-ansi/node_modules/strip-ansi/index.js +0 -4
  991. package/node_modules/wrap-ansi/node_modules/strip-ansi/license +0 -9
  992. package/node_modules/wrap-ansi/node_modules/strip-ansi/package.json +0 -54
  993. package/node_modules/wrap-ansi/node_modules/strip-ansi/readme.md +0 -46
  994. package/node_modules/wrap-ansi/package.json +0 -62
  995. package/node_modules/wrap-ansi/readme.md +0 -91
  996. package/node_modules/y18n/CHANGELOG.md +0 -100
  997. package/node_modules/y18n/LICENSE +0 -13
  998. package/node_modules/y18n/README.md +0 -127
  999. package/node_modules/y18n/build/index.cjs +0 -203
  1000. package/node_modules/y18n/build/lib/cjs.js +0 -6
  1001. package/node_modules/y18n/build/lib/index.js +0 -174
  1002. package/node_modules/y18n/build/lib/platform-shims/node.js +0 -19
  1003. package/node_modules/y18n/index.mjs +0 -8
  1004. package/node_modules/y18n/package.json +0 -70
  1005. package/node_modules/yargs/CHANGELOG.md +0 -88
  1006. package/node_modules/yargs/LICENSE +0 -21
  1007. package/node_modules/yargs/README.md +0 -202
  1008. package/node_modules/yargs/browser.mjs +0 -7
  1009. package/node_modules/yargs/build/index.cjs +0 -2920
  1010. package/node_modules/yargs/build/lib/argsert.js +0 -62
  1011. package/node_modules/yargs/build/lib/command.js +0 -382
  1012. package/node_modules/yargs/build/lib/completion-templates.js +0 -47
  1013. package/node_modules/yargs/build/lib/completion.js +0 -128
  1014. package/node_modules/yargs/build/lib/middleware.js +0 -53
  1015. package/node_modules/yargs/build/lib/parse-command.js +0 -32
  1016. package/node_modules/yargs/build/lib/typings/common-types.js +0 -9
  1017. package/node_modules/yargs/build/lib/usage.js +0 -548
  1018. package/node_modules/yargs/build/lib/utils/apply-extends.js +0 -59
  1019. package/node_modules/yargs/build/lib/utils/is-promise.js +0 -5
  1020. package/node_modules/yargs/build/lib/utils/levenshtein.js +0 -26
  1021. package/node_modules/yargs/build/lib/utils/obj-filter.js +0 -10
  1022. package/node_modules/yargs/build/lib/utils/process-argv.js +0 -17
  1023. package/node_modules/yargs/build/lib/utils/set-blocking.js +0 -12
  1024. package/node_modules/yargs/build/lib/utils/which-module.js +0 -10
  1025. package/node_modules/yargs/build/lib/validation.js +0 -308
  1026. package/node_modules/yargs/build/lib/yargs-factory.js +0 -1143
  1027. package/node_modules/yargs/build/lib/yerror.js +0 -7
  1028. package/node_modules/yargs/helpers/helpers.mjs +0 -10
  1029. package/node_modules/yargs/helpers/index.js +0 -14
  1030. package/node_modules/yargs/helpers/package.json +0 -3
  1031. package/node_modules/yargs/index.cjs +0 -39
  1032. package/node_modules/yargs/index.mjs +0 -8
  1033. package/node_modules/yargs/lib/platform-shims/browser.mjs +0 -92
  1034. package/node_modules/yargs/lib/platform-shims/esm.mjs +0 -67
  1035. package/node_modules/yargs/locales/be.json +0 -46
  1036. package/node_modules/yargs/locales/de.json +0 -46
  1037. package/node_modules/yargs/locales/en.json +0 -51
  1038. package/node_modules/yargs/locales/es.json +0 -46
  1039. package/node_modules/yargs/locales/fi.json +0 -49
  1040. package/node_modules/yargs/locales/fr.json +0 -53
  1041. package/node_modules/yargs/locales/hi.json +0 -49
  1042. package/node_modules/yargs/locales/hu.json +0 -46
  1043. package/node_modules/yargs/locales/id.json +0 -50
  1044. package/node_modules/yargs/locales/it.json +0 -46
  1045. package/node_modules/yargs/locales/ja.json +0 -51
  1046. package/node_modules/yargs/locales/ko.json +0 -49
  1047. package/node_modules/yargs/locales/nb.json +0 -44
  1048. package/node_modules/yargs/locales/nl.json +0 -49
  1049. package/node_modules/yargs/locales/nn.json +0 -44
  1050. package/node_modules/yargs/locales/pirate.json +0 -13
  1051. package/node_modules/yargs/locales/pl.json +0 -49
  1052. package/node_modules/yargs/locales/pt.json +0 -45
  1053. package/node_modules/yargs/locales/pt_BR.json +0 -48
  1054. package/node_modules/yargs/locales/ru.json +0 -46
  1055. package/node_modules/yargs/locales/th.json +0 -46
  1056. package/node_modules/yargs/locales/tr.json +0 -48
  1057. package/node_modules/yargs/locales/zh_CN.json +0 -48
  1058. package/node_modules/yargs/locales/zh_TW.json +0 -47
  1059. package/node_modules/yargs/package.json +0 -122
  1060. package/node_modules/yargs/yargs +0 -9
  1061. package/node_modules/yargs-parser/CHANGELOG.md +0 -263
  1062. package/node_modules/yargs-parser/LICENSE.txt +0 -14
  1063. package/node_modules/yargs-parser/README.md +0 -518
  1064. package/node_modules/yargs-parser/browser.js +0 -29
  1065. package/node_modules/yargs-parser/build/index.cjs +0 -1042
  1066. package/node_modules/yargs-parser/build/lib/index.js +0 -59
  1067. package/node_modules/yargs-parser/build/lib/string-utils.js +0 -65
  1068. package/node_modules/yargs-parser/build/lib/tokenize-arg-string.js +0 -40
  1069. package/node_modules/yargs-parser/build/lib/yargs-parser-types.js +0 -12
  1070. package/node_modules/yargs-parser/build/lib/yargs-parser.js +0 -1037
  1071. package/node_modules/yargs-parser/package.json +0 -87
  1072. /package/node_modules/{cli-highlight/dist/cli.d.ts → @gsd/native/dist/ast/types.js} +0 -0
  1073. /package/node_modules/{cli-highlight/dist/test/test.d.ts → @gsd/native/dist/clipboard/types.js} +0 -0
  1074. /package/node_modules/{yargs/build/lib/typings/yargs-parser-types.js → @gsd/native/dist/fd/types.js} +0 -0
@@ -1,9 +1,7 @@
1
+ import { glob as nativeGlob } from "@gsd/native/glob";
1
2
  import { Type } from "@sinclair/typebox";
2
- import { spawnSync } from "child_process";
3
3
  import { existsSync } from "fs";
4
- import { globSync } from "glob";
5
4
  import path from "path";
6
- import { ensureTool } from "../../utils/tools-manager.js";
7
5
  import { resolveToCwd } from "./path-utils.js";
8
6
  import { DEFAULT_MAX_BYTES, formatSize, truncateHead } from "./truncate.js";
9
7
  const findSchema = Type.Object({
@@ -17,7 +15,7 @@ const DEFAULT_LIMIT = 1000;
17
15
  const defaultFindOperations = {
18
16
  exists: existsSync,
19
17
  glob: (_pattern, _searchCwd, _options) => {
20
- // This is a placeholder - actual fd execution happens in execute
18
+ // Placeholder actual native glob execution happens in execute
21
19
  return [];
22
20
  },
23
21
  };
@@ -89,87 +87,24 @@ export function createFindTool(cwd, options) {
89
87
  });
90
88
  return;
91
89
  }
92
- // Default: use fd
93
- const fdPath = await ensureTool("fd", true);
94
- if (!fdPath) {
95
- reject(new Error("fd is not available and could not be downloaded"));
96
- return;
97
- }
98
- // Build fd arguments
99
- const args = [
100
- "--glob",
101
- "--color=never",
102
- "--hidden",
103
- "--max-results",
104
- String(effectiveLimit),
105
- ];
106
- // Include .gitignore files
107
- const gitignoreFiles = new Set();
108
- const rootGitignore = path.join(searchPath, ".gitignore");
109
- if (existsSync(rootGitignore)) {
110
- gitignoreFiles.add(rootGitignore);
111
- }
112
- try {
113
- const nestedGitignores = globSync("**/.gitignore", {
114
- cwd: searchPath,
115
- dot: true,
116
- absolute: true,
117
- ignore: ["**/node_modules/**", "**/.git/**"],
118
- });
119
- for (const file of nestedGitignores) {
120
- gitignoreFiles.add(file);
121
- }
122
- }
123
- catch {
124
- // Ignore glob errors
125
- }
126
- for (const gitignorePath of gitignoreFiles) {
127
- args.push("--ignore-file", gitignorePath);
128
- }
129
- args.push(pattern, searchPath);
130
- const result = spawnSync(fdPath, args, {
131
- encoding: "utf-8",
132
- maxBuffer: 10 * 1024 * 1024,
90
+ // Default: use native Rust glob
91
+ const globResult = await nativeGlob({
92
+ pattern,
93
+ path: searchPath,
94
+ hidden: true,
95
+ gitignore: true,
96
+ maxResults: effectiveLimit,
133
97
  });
134
98
  signal?.removeEventListener("abort", onAbort);
135
- if (result.error) {
136
- reject(new Error(`Failed to run fd: ${result.error.message}`));
137
- return;
138
- }
139
- const output = result.stdout?.trim() || "";
140
- if (result.status !== 0) {
141
- const errorMsg = result.stderr?.trim() || `fd exited with code ${result.status}`;
142
- if (!output) {
143
- reject(new Error(errorMsg));
144
- return;
145
- }
146
- }
147
- if (!output) {
99
+ if (globResult.matches.length === 0) {
148
100
  resolve({
149
101
  content: [{ type: "text", text: "No files found matching pattern" }],
150
102
  details: undefined,
151
103
  });
152
104
  return;
153
105
  }
154
- const lines = output.split("\n");
155
- const relativized = [];
156
- for (const rawLine of lines) {
157
- const line = rawLine.replace(/\r$/, "").trim();
158
- if (!line)
159
- continue;
160
- const hadTrailingSlash = line.endsWith("/") || line.endsWith("\\");
161
- let relativePath = line;
162
- if (line.startsWith(searchPath)) {
163
- relativePath = line.slice(searchPath.length + 1);
164
- }
165
- else {
166
- relativePath = path.relative(searchPath, line);
167
- }
168
- if (hadTrailingSlash && !relativePath.endsWith("/")) {
169
- relativePath += "/";
170
- }
171
- relativized.push(relativePath);
172
- }
106
+ // Native glob returns paths relative to the search root
107
+ const relativized = globResult.matches.map((m) => m.path);
173
108
  const resultLimitReached = relativized.length >= effectiveLimit;
174
109
  const rawOutput = relativized.join("\n");
175
110
  const truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INT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AAC,CAAC,EAAE,CAAC;YACN,CAAC,CAAC,CAAC;QACJ,CAAC;KACD,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["import type { AgentTool } from \"@gsd/pi-agent-core\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { spawnSync } from \"child_process\";\nimport { existsSync } from \"fs\";\nimport { globSync } from \"glob\";\nimport path from \"path\";\nimport { ensureTool } from \"../../utils/tools-manager.js\";\nimport { resolveToCwd } from \"./path-utils.js\";\nimport { DEFAULT_MAX_BYTES, formatSize, type TruncationResult, truncateHead } from \"./truncate.js\";\n\nconst findSchema = Type.Object({\n\tpattern: Type.String({\n\t\tdescription: \"Glob pattern to match files, e.g. '*.ts', '**/*.json', or 'src/**/*.spec.ts'\",\n\t}),\n\tpath: Type.Optional(Type.String({ description: \"Directory to search in (default: current directory)\" })),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of results (default: 1000)\" })),\n});\n\nexport type FindToolInput = Static<typeof findSchema>;\n\nconst DEFAULT_LIMIT = 1000;\n\nexport interface FindToolDetails {\n\ttruncation?: TruncationResult;\n\tresultLimitReached?: number;\n}\n\n/**\n * Pluggable operations for the find tool.\n * Override these to delegate file search to remote systems (e.g., SSH).\n */\nexport interface FindOperations {\n\t/** Check if path exists */\n\texists: (absolutePath: string) => Promise<boolean> | boolean;\n\t/** Find files matching glob pattern. Returns relative paths. */\n\tglob: (pattern: string, cwd: string, options: { ignore: string[]; limit: number }) => Promise<string[]> | string[];\n}\n\nconst defaultFindOperations: FindOperations = {\n\texists: existsSync,\n\tglob: (_pattern, _searchCwd, _options) => {\n\t\t// This is a placeholder - actual fd execution happens in execute\n\t\treturn [];\n\t},\n};\n\nexport interface FindToolOptions {\n\t/** Custom operations for find. Default: local filesystem + fd */\n\toperations?: FindOperations;\n}\n\nexport function createFindTool(cwd: string, options?: FindToolOptions): AgentTool<typeof findSchema> {\n\tconst customOps = options?.operations;\n\n\treturn {\n\t\tname: \"find\",\n\t\tlabel: \"find\",\n\t\tdescription: `Search for files by glob pattern. Returns matching file paths relative to the search directory. Respects .gitignore. Output is truncated to ${DEFAULT_LIMIT} results or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first).`,\n\t\tparameters: findSchema,\n\t\texecute: async (\n\t\t\t_toolCallId: string,\n\t\t\t{ pattern, path: searchDir, limit }: { pattern: string; path?: string; limit?: number },\n\t\t\tsignal?: AbortSignal,\n\t\t) => {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst onAbort = () => reject(new Error(\"Operation aborted\"));\n\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst searchPath = resolveToCwd(searchDir || \".\", cwd);\n\t\t\t\t\t\tconst effectiveLimit = limit ?? DEFAULT_LIMIT;\n\t\t\t\t\t\tconst ops = customOps ?? defaultFindOperations;\n\n\t\t\t\t\t\t// If custom operations provided with glob, use that\n\t\t\t\t\t\tif (customOps?.glob) {\n\t\t\t\t\t\t\tif (!(await ops.exists(searchPath))) {\n\t\t\t\t\t\t\t\treject(new Error(`Path not found: ${searchPath}`));\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst results = await ops.glob(pattern, searchPath, {\n\t\t\t\t\t\t\t\tignore: [\"**/node_modules/**\", \"**/.git/**\"],\n\t\t\t\t\t\t\t\tlimit: effectiveLimit,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\n\t\t\t\t\t\t\tif (results.length === 0) {\n\t\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: \"No files found matching pattern\" }],\n\t\t\t\t\t\t\t\t\tdetails: undefined,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Relativize paths\n\t\t\t\t\t\t\tconst relativized = results.map((p) => {\n\t\t\t\t\t\t\t\tif (p.startsWith(searchPath)) {\n\t\t\t\t\t\t\t\t\treturn p.slice(searchPath.length + 1);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn path.relative(searchPath, p);\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst resultLimitReached = relativized.length >= effectiveLimit;\n\t\t\t\t\t\t\tconst rawOutput = relativized.join(\"\\n\");\n\t\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\n\t\t\t\t\t\t\tlet resultOutput = truncation.content;\n\t\t\t\t\t\t\tconst details: FindToolDetails = {};\n\t\t\t\t\t\t\tconst notices: string[] = [];\n\n\t\t\t\t\t\t\tif (resultLimitReached) {\n\t\t\t\t\t\t\t\tnotices.push(`${effectiveLimit} results limit reached`);\n\t\t\t\t\t\t\t\tdetails.resultLimitReached = effectiveLimit;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\t\t\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t\t\t\t\t\t\tdetails.truncation = truncation;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (notices.length > 0) {\n\t\t\t\t\t\t\t\tresultOutput += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: resultOutput }],\n\t\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Default: use fd\n\t\t\t\t\t\tconst fdPath = await ensureTool(\"fd\", true);\n\t\t\t\t\t\tif (!fdPath) {\n\t\t\t\t\t\t\treject(new Error(\"fd is not available and could not be downloaded\"));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Build fd arguments\n\t\t\t\t\t\tconst args: string[] = [\n\t\t\t\t\t\t\t\"--glob\",\n\t\t\t\t\t\t\t\"--color=never\",\n\t\t\t\t\t\t\t\"--hidden\",\n\t\t\t\t\t\t\t\"--max-results\",\n\t\t\t\t\t\t\tString(effectiveLimit),\n\t\t\t\t\t\t];\n\n\t\t\t\t\t\t// Include .gitignore files\n\t\t\t\t\t\tconst gitignoreFiles = new Set<string>();\n\t\t\t\t\t\tconst rootGitignore = path.join(searchPath, \".gitignore\");\n\t\t\t\t\t\tif (existsSync(rootGitignore)) {\n\t\t\t\t\t\t\tgitignoreFiles.add(rootGitignore);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst nestedGitignores = globSync(\"**/.gitignore\", {\n\t\t\t\t\t\t\t\tcwd: searchPath,\n\t\t\t\t\t\t\t\tdot: true,\n\t\t\t\t\t\t\t\tabsolute: true,\n\t\t\t\t\t\t\t\tignore: [\"**/node_modules/**\", \"**/.git/**\"],\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tfor (const file of nestedGitignores) {\n\t\t\t\t\t\t\t\tgitignoreFiles.add(file);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// Ignore glob errors\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (const gitignorePath of gitignoreFiles) {\n\t\t\t\t\t\t\targs.push(\"--ignore-file\", gitignorePath);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\targs.push(pattern, searchPath);\n\n\t\t\t\t\t\tconst result = spawnSync(fdPath, args, {\n\t\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t\t\tmaxBuffer: 10 * 1024 * 1024,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\n\t\t\t\t\t\tif (result.error) {\n\t\t\t\t\t\t\treject(new Error(`Failed to run fd: ${result.error.message}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst output = result.stdout?.trim() || \"\";\n\n\t\t\t\t\t\tif (result.status !== 0) {\n\t\t\t\t\t\t\tconst errorMsg = result.stderr?.trim() || `fd exited with code ${result.status}`;\n\t\t\t\t\t\t\tif (!output) {\n\t\t\t\t\t\t\t\treject(new Error(errorMsg));\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!output) {\n\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: \"No files found matching pattern\" }],\n\t\t\t\t\t\t\t\tdetails: undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst lines = output.split(\"\\n\");\n\t\t\t\t\t\tconst relativized: string[] = [];\n\n\t\t\t\t\t\tfor (const rawLine of lines) {\n\t\t\t\t\t\t\tconst line = rawLine.replace(/\\r$/, \"\").trim();\n\t\t\t\t\t\t\tif (!line) continue;\n\n\t\t\t\t\t\t\tconst hadTrailingSlash = line.endsWith(\"/\") || line.endsWith(\"\\\\\");\n\t\t\t\t\t\t\tlet relativePath = line;\n\t\t\t\t\t\t\tif (line.startsWith(searchPath)) {\n\t\t\t\t\t\t\t\trelativePath = line.slice(searchPath.length + 1);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\trelativePath = path.relative(searchPath, line);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (hadTrailingSlash && !relativePath.endsWith(\"/\")) {\n\t\t\t\t\t\t\t\trelativePath += \"/\";\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\trelativized.push(relativePath);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst resultLimitReached = relativized.length >= effectiveLimit;\n\t\t\t\t\t\tconst rawOutput = relativized.join(\"\\n\");\n\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\n\t\t\t\t\t\tlet resultOutput = truncation.content;\n\t\t\t\t\t\tconst details: FindToolDetails = {};\n\t\t\t\t\t\tconst notices: string[] = [];\n\n\t\t\t\t\t\tif (resultLimitReached) {\n\t\t\t\t\t\t\tnotices.push(\n\t\t\t\t\t\t\t\t`${effectiveLimit} results limit reached. Use limit=${effectiveLimit * 2} for more, or refine pattern`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tdetails.resultLimitReached = effectiveLimit;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\t\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t\t\t\t\t\tdetails.truncation = truncation;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (notices.length > 0) {\n\t\t\t\t\t\t\tresultOutput += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: resultOutput }],\n\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\treject(e);\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t});\n\t\t},\n\t};\n}\n\n/** Default find tool using process.cwd() - for backwards compatibility */\nexport const findTool = createFindTool(process.cwd());\n"]}
1
+ {"version":3,"file":"find.js","sourceRoot":"","sources":["../../../src/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AAC,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["import type { AgentTool } from \"@gsd/pi-agent-core\";\nimport { glob as nativeGlob } from \"@gsd/native/glob\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { existsSync } from \"fs\";\nimport path from \"path\";\nimport { resolveToCwd } from \"./path-utils.js\";\nimport { DEFAULT_MAX_BYTES, formatSize, type TruncationResult, truncateHead } from \"./truncate.js\";\n\nconst findSchema = Type.Object({\n\tpattern: Type.String({\n\t\tdescription: \"Glob pattern to match files, e.g. '*.ts', '**/*.json', or 'src/**/*.spec.ts'\",\n\t}),\n\tpath: Type.Optional(Type.String({ description: \"Directory to search in (default: current directory)\" })),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of results (default: 1000)\" })),\n});\n\nexport type FindToolInput = Static<typeof findSchema>;\n\nconst DEFAULT_LIMIT = 1000;\n\nexport interface FindToolDetails {\n\ttruncation?: TruncationResult;\n\tresultLimitReached?: number;\n}\n\n/**\n * Pluggable operations for the find tool.\n * Override these to delegate file search to remote systems (e.g., SSH).\n */\nexport interface FindOperations {\n\t/** Check if path exists */\n\texists: (absolutePath: string) => Promise<boolean> | boolean;\n\t/** Find files matching glob pattern. Returns relative paths. */\n\tglob: (pattern: string, cwd: string, options: { ignore: string[]; limit: number }) => Promise<string[]> | string[];\n}\n\nconst defaultFindOperations: FindOperations = {\n\texists: existsSync,\n\tglob: (_pattern, _searchCwd, _options) => {\n\t\t// Placeholder — actual native glob execution happens in execute\n\t\treturn [];\n\t},\n};\n\nexport interface FindToolOptions {\n\t/** Custom operations for find. Default: local filesystem + native glob */\n\toperations?: FindOperations;\n}\n\nexport function createFindTool(cwd: string, options?: FindToolOptions): AgentTool<typeof findSchema> {\n\tconst customOps = options?.operations;\n\n\treturn {\n\t\tname: \"find\",\n\t\tlabel: \"find\",\n\t\tdescription: `Search for files by glob pattern. Returns matching file paths relative to the search directory. Respects .gitignore. Output is truncated to ${DEFAULT_LIMIT} results or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first).`,\n\t\tparameters: findSchema,\n\t\texecute: async (\n\t\t\t_toolCallId: string,\n\t\t\t{ pattern, path: searchDir, limit }: { pattern: string; path?: string; limit?: number },\n\t\t\tsignal?: AbortSignal,\n\t\t) => {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst onAbort = () => reject(new Error(\"Operation aborted\"));\n\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst searchPath = resolveToCwd(searchDir || \".\", cwd);\n\t\t\t\t\t\tconst effectiveLimit = limit ?? DEFAULT_LIMIT;\n\t\t\t\t\t\tconst ops = customOps ?? defaultFindOperations;\n\n\t\t\t\t\t\t// If custom operations provided with glob, use that\n\t\t\t\t\t\tif (customOps?.glob) {\n\t\t\t\t\t\t\tif (!(await ops.exists(searchPath))) {\n\t\t\t\t\t\t\t\treject(new Error(`Path not found: ${searchPath}`));\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst results = await ops.glob(pattern, searchPath, {\n\t\t\t\t\t\t\t\tignore: [\"**/node_modules/**\", \"**/.git/**\"],\n\t\t\t\t\t\t\t\tlimit: effectiveLimit,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\n\t\t\t\t\t\t\tif (results.length === 0) {\n\t\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: \"No files found matching pattern\" }],\n\t\t\t\t\t\t\t\t\tdetails: undefined,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Relativize paths\n\t\t\t\t\t\t\tconst relativized = results.map((p) => {\n\t\t\t\t\t\t\t\tif (p.startsWith(searchPath)) {\n\t\t\t\t\t\t\t\t\treturn p.slice(searchPath.length + 1);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn path.relative(searchPath, p);\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst resultLimitReached = relativized.length >= effectiveLimit;\n\t\t\t\t\t\t\tconst rawOutput = relativized.join(\"\\n\");\n\t\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\n\t\t\t\t\t\t\tlet resultOutput = truncation.content;\n\t\t\t\t\t\t\tconst details: FindToolDetails = {};\n\t\t\t\t\t\t\tconst notices: string[] = [];\n\n\t\t\t\t\t\t\tif (resultLimitReached) {\n\t\t\t\t\t\t\t\tnotices.push(`${effectiveLimit} results limit reached`);\n\t\t\t\t\t\t\t\tdetails.resultLimitReached = effectiveLimit;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\t\t\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t\t\t\t\t\t\tdetails.truncation = truncation;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (notices.length > 0) {\n\t\t\t\t\t\t\t\tresultOutput += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: resultOutput }],\n\t\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Default: use native Rust glob\n\t\t\t\t\t\tconst globResult = await nativeGlob({\n\t\t\t\t\t\t\tpattern,\n\t\t\t\t\t\t\tpath: searchPath,\n\t\t\t\t\t\t\thidden: true,\n\t\t\t\t\t\t\tgitignore: true,\n\t\t\t\t\t\t\tmaxResults: effectiveLimit,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\n\t\t\t\t\t\tif (globResult.matches.length === 0) {\n\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: \"No files found matching pattern\" }],\n\t\t\t\t\t\t\t\tdetails: undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Native glob returns paths relative to the search root\n\t\t\t\t\t\tconst relativized = globResult.matches.map((m: { path: string }) => m.path);\n\n\t\t\t\t\t\tconst resultLimitReached = relativized.length >= effectiveLimit;\n\t\t\t\t\t\tconst rawOutput = relativized.join(\"\\n\");\n\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\n\t\t\t\t\t\tlet resultOutput = truncation.content;\n\t\t\t\t\t\tconst details: FindToolDetails = {};\n\t\t\t\t\t\tconst notices: string[] = [];\n\n\t\t\t\t\t\tif (resultLimitReached) {\n\t\t\t\t\t\t\tnotices.push(\n\t\t\t\t\t\t\t\t`${effectiveLimit} results limit reached. Use limit=${effectiveLimit * 2} for more, or refine pattern`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tdetails.resultLimitReached = effectiveLimit;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\t\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t\t\t\t\t\tdetails.truncation = truncation;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (notices.length > 0) {\n\t\t\t\t\t\t\tresultOutput += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: resultOutput }],\n\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\treject(e);\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t});\n\t\t},\n\t};\n}\n\n/** Default find tool using process.cwd() - for backwards compatibility */\nexport const findTool = createFindTool(process.cwd());\n"]}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Hashline edit tool — applies file edits using line-hash anchors.
3
+ *
4
+ * The model references lines by `LINE#ID` tags from read output.
5
+ * Each tag uniquely identifies a line, so edits remain stable even when lines shift.
6
+ */
7
+ import type { AgentTool } from "@gsd/pi-agent-core";
8
+ import { type Static } from "@sinclair/typebox";
9
+ declare const hashlineEditItemSchema: import("@sinclair/typebox").TObject<{
10
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"replace">, import("@sinclair/typebox").TLiteral<"append">, import("@sinclair/typebox").TLiteral<"prepend">]>;
11
+ pos: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
12
+ end: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
13
+ lines: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
14
+ }>;
15
+ declare const hashlineEditSchema: import("@sinclair/typebox").TObject<{
16
+ path: import("@sinclair/typebox").TString;
17
+ edits: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
18
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"replace">, import("@sinclair/typebox").TLiteral<"append">, import("@sinclair/typebox").TLiteral<"prepend">]>;
19
+ pos: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
20
+ end: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
21
+ lines: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
22
+ }>>;
23
+ delete: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
24
+ move: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
25
+ }>;
26
+ export type HashlineEditInput = Static<typeof hashlineEditSchema>;
27
+ export type HashlineEditItem = Static<typeof hashlineEditItemSchema>;
28
+ export interface HashlineEditToolDetails {
29
+ /** Unified diff of the changes made */
30
+ diff: string;
31
+ /** Line number of the first change in the new file */
32
+ firstChangedLine?: number;
33
+ }
34
+ /**
35
+ * Pluggable operations for the hashline edit tool.
36
+ */
37
+ export interface HashlineEditOperations {
38
+ readFile: (absolutePath: string) => Promise<Buffer>;
39
+ writeFile: (absolutePath: string, content: string) => Promise<void>;
40
+ access: (absolutePath: string) => Promise<void>;
41
+ unlink: (absolutePath: string) => Promise<void>;
42
+ }
43
+ export interface HashlineEditToolOptions {
44
+ operations?: HashlineEditOperations;
45
+ }
46
+ export declare function createHashlineEditTool(cwd: string, options?: HashlineEditToolOptions): AgentTool<typeof hashlineEditSchema>;
47
+ /** Default hashline edit tool using process.cwd() */
48
+ export declare const hashlineEditTool: AgentTool<import("@sinclair/typebox").TObject<{
49
+ path: import("@sinclair/typebox").TString;
50
+ edits: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
51
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"replace">, import("@sinclair/typebox").TLiteral<"append">, import("@sinclair/typebox").TLiteral<"prepend">]>;
52
+ pos: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
53
+ end: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
54
+ lines: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
55
+ }>>;
56
+ delete: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
57
+ move: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
58
+ }>, any>;
59
+ export {};
60
+ //# sourceMappingURL=hashline-edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hashline-edit.d.ts","sourceRoot":"","sources":["../../../src/core/tools/hashline-edit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAwBtD,QAAA,MAAM,sBAAsB;;;;;EAY3B,CAAC;AAEF,QAAA,MAAM,kBAAkB;;;;;;;;;;EAQvB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAClE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAErE,MAAM,WAAW,uBAAuB;IACvC,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,SAAS,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,MAAM,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD;AASD,MAAM,WAAW,uBAAuB;IACvC,UAAU,CAAC,EAAE,sBAAsB,CAAC;CACpC;AAyDD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,SAAS,CAAC,OAAO,kBAAkB,CAAC,CA6K3H;AAED,qDAAqD;AACrD,eAAO,MAAM,gBAAgB;;;;;;;;;;QAAwC,CAAC"}
@@ -0,0 +1,247 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { constants } from "fs";
3
+ import { access as fsAccess, readFile as fsReadFile, unlink as fsUnlink, writeFile as fsWriteFile } from "fs/promises";
4
+ import { detectLineEnding, generateDiffString, normalizeToLF, restoreLineEndings, stripBom, } from "./edit-diff.js";
5
+ import { applyHashlineEdits, hashlineParseText, parseTag, } from "./hashline.js";
6
+ import { resolveToCwd } from "./path-utils.js";
7
+ // ═══════════════════════════════════════════════════════════════════════════
8
+ // Schema
9
+ // ═══════════════════════════════════════════════════════════════════════════
10
+ const hashlineEditItemSchema = Type.Object({
11
+ op: Type.Union([Type.Literal("replace"), Type.Literal("append"), Type.Literal("prepend")]),
12
+ pos: Type.Optional(Type.String({ description: "Anchor tag (e.g. \"5#QQ\")" })),
13
+ end: Type.Optional(Type.String({ description: "End anchor for range replace" })),
14
+ lines: Type.Union([
15
+ Type.Array(Type.String(), { description: "Replacement content lines" }),
16
+ Type.String(),
17
+ Type.Null(),
18
+ ]),
19
+ }, { additionalProperties: false });
20
+ const hashlineEditSchema = Type.Object({
21
+ path: Type.String({ description: "Path to the file to edit" }),
22
+ edits: Type.Array(hashlineEditItemSchema, { description: "Edits to apply (referenced by LINE#ID tags from read output)" }),
23
+ delete: Type.Optional(Type.Boolean({ description: "If true, delete the file" })),
24
+ move: Type.Optional(Type.String({ description: "If set, move/rename the file to this path" })),
25
+ }, { additionalProperties: false });
26
+ const defaultHashlineEditOperations = {
27
+ readFile: (path) => fsReadFile(path),
28
+ writeFile: (path, content) => fsWriteFile(path, content, "utf-8"),
29
+ access: (path) => fsAccess(path, constants.R_OK | constants.W_OK),
30
+ unlink: (path) => fsUnlink(path),
31
+ };
32
+ /** Parse a tag, returning undefined instead of throwing on garbage. */
33
+ function tryParseTag(raw) {
34
+ try {
35
+ return parseTag(raw);
36
+ }
37
+ catch {
38
+ return undefined;
39
+ }
40
+ }
41
+ /**
42
+ * Map flat tool-schema edits into typed HashlineEdit objects.
43
+ */
44
+ function resolveEditAnchors(edits) {
45
+ const result = [];
46
+ for (const edit of edits) {
47
+ const lines = hashlineParseText(edit.lines);
48
+ const tag = edit.pos ? tryParseTag(edit.pos) : undefined;
49
+ const end = edit.end ? tryParseTag(edit.end) : undefined;
50
+ const op = edit.op === "append" || edit.op === "prepend" ? edit.op : "replace";
51
+ switch (op) {
52
+ case "replace": {
53
+ if (tag && end) {
54
+ result.push({ op: "replace", pos: tag, end, lines });
55
+ }
56
+ else if (tag || end) {
57
+ result.push({ op: "replace", pos: tag || end, lines });
58
+ }
59
+ else {
60
+ throw new Error("Replace requires at least one anchor (pos or end).");
61
+ }
62
+ break;
63
+ }
64
+ case "append": {
65
+ result.push({ op: "append", pos: tag ?? end, lines });
66
+ break;
67
+ }
68
+ case "prepend": {
69
+ result.push({ op: "prepend", pos: end ?? tag, lines });
70
+ break;
71
+ }
72
+ }
73
+ }
74
+ return result;
75
+ }
76
+ const HASHLINE_EDIT_DESCRIPTION = `Edit a file by referencing LINE#ID tags from read output. Each tag uniquely identifies a line via content hash, so edits remain stable even when lines shift.
77
+
78
+ Read the file first to get fresh tags. Submit one edit call per file with all operations batched.
79
+
80
+ Operations:
81
+ - replace: Replace line(s) at pos (and optionally through end) with lines content
82
+ - append: Insert lines after pos (omit pos for end of file)
83
+ - prepend: Insert lines before pos (omit pos for beginning of file)
84
+
85
+ Set lines to null or [] to delete lines. Set delete:true to delete the file.`;
86
+ export function createHashlineEditTool(cwd, options) {
87
+ const ops = options?.operations ?? defaultHashlineEditOperations;
88
+ return {
89
+ name: "hashline_edit",
90
+ label: "hashline_edit",
91
+ description: HASHLINE_EDIT_DESCRIPTION,
92
+ parameters: hashlineEditSchema,
93
+ execute: async (_toolCallId, params, signal) => {
94
+ const { path, edits, delete: deleteFile, move } = params;
95
+ const absolutePath = resolveToCwd(path, cwd);
96
+ return new Promise((resolve, reject) => {
97
+ if (signal?.aborted) {
98
+ reject(new Error("Operation aborted"));
99
+ return;
100
+ }
101
+ let aborted = false;
102
+ const onAbort = () => {
103
+ aborted = true;
104
+ reject(new Error("Operation aborted"));
105
+ };
106
+ if (signal) {
107
+ signal.addEventListener("abort", onAbort, { once: true });
108
+ }
109
+ (async () => {
110
+ try {
111
+ // Handle delete
112
+ if (deleteFile) {
113
+ let fileExists = true;
114
+ try {
115
+ await ops.access(absolutePath);
116
+ }
117
+ catch {
118
+ fileExists = false;
119
+ }
120
+ if (fileExists) {
121
+ await ops.unlink(absolutePath);
122
+ }
123
+ if (signal)
124
+ signal.removeEventListener("abort", onAbort);
125
+ resolve({
126
+ content: [{ type: "text", text: fileExists ? `Deleted ${path}` : `File not found, nothing to delete: ${path}` }],
127
+ details: { diff: "" },
128
+ });
129
+ return;
130
+ }
131
+ // Handle file creation (no existing file, anchorless appends/prepends)
132
+ let fileExists = true;
133
+ try {
134
+ await ops.access(absolutePath);
135
+ }
136
+ catch {
137
+ fileExists = false;
138
+ }
139
+ if (!fileExists) {
140
+ const lines = [];
141
+ for (const edit of edits) {
142
+ if ((edit.op === "append" || edit.op === "prepend") && !edit.pos && !edit.end) {
143
+ if (edit.op === "prepend") {
144
+ lines.unshift(...hashlineParseText(edit.lines));
145
+ }
146
+ else {
147
+ lines.push(...hashlineParseText(edit.lines));
148
+ }
149
+ }
150
+ else {
151
+ throw new Error(`File not found: ${path}`);
152
+ }
153
+ }
154
+ await ops.writeFile(absolutePath, lines.join("\n"));
155
+ if (signal)
156
+ signal.removeEventListener("abort", onAbort);
157
+ resolve({
158
+ content: [{ type: "text", text: `Created ${path}` }],
159
+ details: { diff: "" },
160
+ });
161
+ return;
162
+ }
163
+ if (aborted)
164
+ return;
165
+ // Read file
166
+ const rawContent = (await ops.readFile(absolutePath)).toString("utf-8");
167
+ const { bom, text } = stripBom(rawContent);
168
+ const originalEnding = detectLineEnding(text);
169
+ const originalNormalized = normalizeToLF(text);
170
+ if (aborted)
171
+ return;
172
+ // Resolve and apply edits
173
+ const anchorEdits = resolveEditAnchors(edits);
174
+ const result = applyHashlineEdits(originalNormalized, anchorEdits);
175
+ if (originalNormalized === result.lines && !move) {
176
+ let diagnostic = `No changes made to ${path}. The edits produced identical content.`;
177
+ if (result.noopEdits && result.noopEdits.length > 0) {
178
+ const details = result.noopEdits
179
+ .map(e => `Edit ${e.editIndex}: replacement for ${e.loc} is identical to current content:\n ${e.loc}| ${e.current}`)
180
+ .join("\n");
181
+ diagnostic += `\n${details}`;
182
+ diagnostic +=
183
+ "\nYour content must differ from what the file already contains. Re-read the file to see the current state.";
184
+ }
185
+ throw new Error(diagnostic);
186
+ }
187
+ if (aborted)
188
+ return;
189
+ // Write result
190
+ const finalContent = bom + restoreLineEndings(result.lines, originalEnding);
191
+ const writePath = move ? resolveToCwd(move, cwd) : absolutePath;
192
+ // Prevent silent overwrite when moving to an existing file
193
+ if (move && writePath !== absolutePath) {
194
+ try {
195
+ await ops.access(writePath);
196
+ // If access succeeds, the file exists — refuse the move
197
+ throw new Error(`Destination file already exists: ${writePath}. Use a different path or delete the existing file first.`);
198
+ }
199
+ catch (err) {
200
+ // Re-throw our own error; swallow only "file not found"
201
+ if (err.message?.startsWith("Destination file already exists:"))
202
+ throw err;
203
+ // File doesn't exist — safe to proceed
204
+ }
205
+ }
206
+ await ops.writeFile(writePath, finalContent);
207
+ // If moved, delete original
208
+ if (move && writePath !== absolutePath) {
209
+ await ops.unlink(absolutePath);
210
+ }
211
+ if (aborted)
212
+ return;
213
+ if (signal)
214
+ signal.removeEventListener("abort", onAbort);
215
+ const diffResult = generateDiffString(originalNormalized, result.lines);
216
+ const resultText = move ? `Moved ${path} to ${move}` : `Updated ${path}`;
217
+ const warningsBlock = result.warnings?.length
218
+ ? `\nWarnings:\n${result.warnings.join("\n")}`
219
+ : "";
220
+ resolve({
221
+ content: [
222
+ {
223
+ type: "text",
224
+ text: `${resultText}${warningsBlock}`,
225
+ },
226
+ ],
227
+ details: {
228
+ diff: diffResult.diff,
229
+ firstChangedLine: result.firstChangedLine ?? diffResult.firstChangedLine,
230
+ },
231
+ });
232
+ }
233
+ catch (error) {
234
+ if (signal)
235
+ signal.removeEventListener("abort", onAbort);
236
+ if (!aborted) {
237
+ reject(error);
238
+ }
239
+ }
240
+ })();
241
+ });
242
+ },
243
+ };
244
+ }
245
+ /** Default hashline edit tool using process.cwd() */
246
+ export const hashlineEditTool = createHashlineEditTool(process.cwd());
247
+ //# sourceMappingURL=hashline-edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hashline-edit.js","sourceRoot":"","sources":["../../../src/core/tools/hashline-edit.ts"],"names":[],"mappings":"AAOA,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,IAAI,QAAQ,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AACvH,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,QAAQ,GACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEN,kBAAkB,EAGlB,iBAAiB,EACjB,QAAQ,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,8EAA8E;AAC9E,SAAS;AACT,8EAA8E;AAE9E,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CACzC;IACC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAA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QAAQ,EAAE,MAAM;4BAC5C,CAAC,CAAC,gBAAgB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;4BAC9C,CAAC,CAAC,EAAE,CAAC;wBAEN,OAAO,CAAC;4BACP,OAAO,EAAE;gCACR;oCACC,IAAI,EAAE,MAAM;oCACZ,IAAI,EAAE,GAAG,UAAU,GAAG,aAAa,EAAE;iCACrC;6BACD;4BACD,OAAO,EAAE;gCACR,IAAI,EAAE,UAAU,CAAC,IAAI;gCACrB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,UAAU,CAAC,gBAAgB;6BACxE;yBACD,CAAC,CAAC;oBACJ,CAAC;oBAAC,OAAO,KAAU,EAAE,CAAC;wBACrB,IAAI,MAAM;4BAAE,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;wBACzD,IAAI,CAAC,OAAO,EAAE,CAAC;4BACd,MAAM,CAAC,KAAK,CAAC,CAAC;wBACf,CAAC;oBACF,CAAC;gBACF,CAAC,CAAC,EAAE,CAAC;YACN,CAAC,CAAC,CAAC;QACJ,CAAC;KACD,CAAC;AACH,CAAC;AAED,qDAAqD;AACrD,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["/**\n * Hashline edit tool — applies file edits using line-hash anchors.\n *\n * The model references lines by `LINE#ID` tags from read output.\n * Each tag uniquely identifies a line, so edits remain stable even when lines shift.\n */\nimport type { AgentTool } from \"@gsd/pi-agent-core\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { constants } from \"fs\";\nimport { access as fsAccess, readFile as fsReadFile, unlink as fsUnlink, writeFile as fsWriteFile } from \"fs/promises\";\nimport {\n\tdetectLineEnding,\n\tgenerateDiffString,\n\tnormalizeToLF,\n\trestoreLineEndings,\n\tstripBom,\n} from \"./edit-diff.js\";\nimport {\n\ttype Anchor,\n\tapplyHashlineEdits,\n\tcomputeLineHash,\n\ttype HashlineEdit,\n\thashlineParseText,\n\tparseTag,\n} from \"./hashline.js\";\nimport { resolveToCwd } from \"./path-utils.js\";\n\n// ═══════════════════════════════════════════════════════════════════════════\n// Schema\n// ═══════════════════════════════════════════════════════════════════════════\n\nconst hashlineEditItemSchema = Type.Object(\n\t{\n\t\top: Type.Union([Type.Literal(\"replace\"), Type.Literal(\"append\"), Type.Literal(\"prepend\")]),\n\t\tpos: Type.Optional(Type.String({ description: \"Anchor tag (e.g. \\\"5#QQ\\\")\" })),\n\t\tend: Type.Optional(Type.String({ description: \"End anchor for range replace\" })),\n\t\tlines: Type.Union([\n\t\t\tType.Array(Type.String(), { description: \"Replacement content lines\" }),\n\t\t\tType.String(),\n\t\t\tType.Null(),\n\t\t]),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst hashlineEditSchema = Type.Object(\n\t{\n\t\tpath: Type.String({ description: \"Path to the file to edit\" }),\n\t\tedits: Type.Array(hashlineEditItemSchema, { description: \"Edits to apply (referenced by LINE#ID tags from read output)\" }),\n\t\tdelete: Type.Optional(Type.Boolean({ description: \"If true, delete the file\" })),\n\t\tmove: Type.Optional(Type.String({ description: \"If set, move/rename the file to this path\" })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type HashlineEditInput = Static<typeof hashlineEditSchema>;\nexport type HashlineEditItem = Static<typeof hashlineEditItemSchema>;\n\nexport interface HashlineEditToolDetails {\n\t/** Unified diff of the changes made */\n\tdiff: string;\n\t/** Line number of the first change in the new file */\n\tfirstChangedLine?: number;\n}\n\n/**\n * Pluggable operations for the hashline edit tool.\n */\nexport interface HashlineEditOperations {\n\treadFile: (absolutePath: string) => Promise<Buffer>;\n\twriteFile: (absolutePath: string, content: string) => Promise<void>;\n\taccess: (absolutePath: string) => Promise<void>;\n\tunlink: (absolutePath: string) => Promise<void>;\n}\n\nconst defaultHashlineEditOperations: HashlineEditOperations = {\n\treadFile: (path) => fsReadFile(path),\n\twriteFile: (path, content) => fsWriteFile(path, content, \"utf-8\"),\n\taccess: (path) => fsAccess(path, constants.R_OK | constants.W_OK),\n\tunlink: (path) => fsUnlink(path),\n};\n\nexport interface HashlineEditToolOptions {\n\toperations?: HashlineEditOperations;\n}\n\n/** Parse a tag, returning undefined instead of throwing on garbage. */\nfunction tryParseTag(raw: string): Anchor | undefined {\n\ttry {\n\t\treturn parseTag(raw);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Map flat tool-schema edits into typed HashlineEdit objects.\n */\nfunction resolveEditAnchors(edits: HashlineEditItem[]): HashlineEdit[] {\n\tconst result: HashlineEdit[] = [];\n\tfor (const edit of edits) {\n\t\tconst lines = hashlineParseText(edit.lines);\n\t\tconst tag = edit.pos ? tryParseTag(edit.pos) : undefined;\n\t\tconst end = edit.end ? tryParseTag(edit.end) : undefined;\n\n\t\tconst op = edit.op === \"append\" || edit.op === \"prepend\" ? edit.op : \"replace\";\n\t\tswitch (op) {\n\t\t\tcase \"replace\": {\n\t\t\t\tif (tag && end) {\n\t\t\t\t\tresult.push({ op: \"replace\", pos: tag, end, lines });\n\t\t\t\t} else if (tag || end) {\n\t\t\t\t\tresult.push({ op: \"replace\", pos: tag || end!, lines });\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"Replace requires at least one anchor (pos or end).\");\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"append\": {\n\t\t\t\tresult.push({ op: \"append\", pos: tag ?? end, lines });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"prepend\": {\n\t\t\t\tresult.push({ op: \"prepend\", pos: end ?? tag, lines });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn result;\n}\n\nconst HASHLINE_EDIT_DESCRIPTION = `Edit a file by referencing LINE#ID tags from read output. Each tag uniquely identifies a line via content hash, so edits remain stable even when lines shift.\n\nRead the file first to get fresh tags. Submit one edit call per file with all operations batched.\n\nOperations:\n- replace: Replace line(s) at pos (and optionally through end) with lines content\n- append: Insert lines after pos (omit pos for end of file)\n- prepend: Insert lines before pos (omit pos for beginning of file)\n\nSet lines to null or [] to delete lines. Set delete:true to delete the file.`;\n\nexport function createHashlineEditTool(cwd: string, options?: HashlineEditToolOptions): AgentTool<typeof hashlineEditSchema> {\n\tconst ops = options?.operations ?? defaultHashlineEditOperations;\n\n\treturn {\n\t\tname: \"hashline_edit\",\n\t\tlabel: \"hashline_edit\",\n\t\tdescription: HASHLINE_EDIT_DESCRIPTION,\n\t\tparameters: hashlineEditSchema,\n\t\texecute: async (\n\t\t\t_toolCallId: string,\n\t\t\tparams: HashlineEditInput,\n\t\t\tsignal?: AbortSignal,\n\t\t) => {\n\t\t\tconst { path, edits, delete: deleteFile, move } = params;\n\t\t\tconst absolutePath = resolveToCwd(path, cwd);\n\n\t\t\treturn new Promise<{\n\t\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\t\tdetails: HashlineEditToolDetails | undefined;\n\t\t\t}>((resolve, reject) => {\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet aborted = false;\n\t\t\t\tconst onAbort = () => {\n\t\t\t\t\taborted = true;\n\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t};\n\t\t\t\tif (signal) {\n\t\t\t\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t}\n\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Handle delete\n\t\t\t\t\t\tif (deleteFile) {\n\t\t\t\t\t\t\tlet fileExists = true;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tawait ops.access(absolutePath);\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\tfileExists = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (fileExists) {\n\t\t\t\t\t\t\t\tawait ops.unlink(absolutePath);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (signal) signal.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: fileExists ? `Deleted ${path}` : `File not found, nothing to delete: ${path}` }],\n\t\t\t\t\t\t\t\tdetails: { diff: \"\" },\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Handle file creation (no existing file, anchorless appends/prepends)\n\t\t\t\t\t\tlet fileExists = true;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait ops.access(absolutePath);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tfileExists = false;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!fileExists) {\n\t\t\t\t\t\t\tconst lines: string[] = [];\n\t\t\t\t\t\t\tfor (const edit of edits) {\n\t\t\t\t\t\t\t\tif ((edit.op === \"append\" || edit.op === \"prepend\") && !edit.pos && !edit.end) {\n\t\t\t\t\t\t\t\t\tif (edit.op === \"prepend\") {\n\t\t\t\t\t\t\t\t\t\tlines.unshift(...hashlineParseText(edit.lines));\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tlines.push(...hashlineParseText(edit.lines));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tthrow new Error(`File not found: ${path}`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait ops.writeFile(absolutePath, lines.join(\"\\n\"));\n\t\t\t\t\t\t\tif (signal) signal.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: `Created ${path}` }],\n\t\t\t\t\t\t\t\tdetails: { diff: \"\" },\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (aborted) return;\n\n\t\t\t\t\t\t// Read file\n\t\t\t\t\t\tconst rawContent = (await ops.readFile(absolutePath)).toString(\"utf-8\");\n\t\t\t\t\t\tconst { bom, text } = stripBom(rawContent);\n\t\t\t\t\t\tconst originalEnding = detectLineEnding(text);\n\t\t\t\t\t\tconst originalNormalized = normalizeToLF(text);\n\n\t\t\t\t\t\tif (aborted) return;\n\n\t\t\t\t\t\t// Resolve and apply edits\n\t\t\t\t\t\tconst anchorEdits = resolveEditAnchors(edits);\n\t\t\t\t\t\tconst result = applyHashlineEdits(originalNormalized, anchorEdits);\n\n\t\t\t\t\t\tif (originalNormalized === result.lines && !move) {\n\t\t\t\t\t\t\tlet diagnostic = `No changes made to ${path}. The edits produced identical content.`;\n\t\t\t\t\t\t\tif (result.noopEdits && result.noopEdits.length > 0) {\n\t\t\t\t\t\t\t\tconst details = result.noopEdits\n\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\te =>\n\t\t\t\t\t\t\t\t\t\t\t`Edit ${e.editIndex}: replacement for ${e.loc} is identical to current content:\\n ${e.loc}| ${e.current}`,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.join(\"\\n\");\n\t\t\t\t\t\t\t\tdiagnostic += `\\n${details}`;\n\t\t\t\t\t\t\t\tdiagnostic +=\n\t\t\t\t\t\t\t\t\t\"\\nYour content must differ from what the file already contains. Re-read the file to see the current state.\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthrow new Error(diagnostic);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (aborted) return;\n\n\t\t\t\t\t\t// Write result\n\t\t\t\t\t\tconst finalContent = bom + restoreLineEndings(result.lines, originalEnding);\n\t\t\t\t\t\tconst writePath = move ? resolveToCwd(move, cwd) : absolutePath;\n\n\t\t\t\t\t\t// Prevent silent overwrite when moving to an existing file\n\t\t\t\t\t\tif (move && writePath !== absolutePath) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tawait ops.access(writePath);\n\t\t\t\t\t\t\t\t// If access succeeds, the file exists — refuse the move\n\t\t\t\t\t\t\t\tthrow new Error(`Destination file already exists: ${writePath}. Use a different path or delete the existing file first.`);\n\t\t\t\t\t\t\t} catch (err: any) {\n\t\t\t\t\t\t\t\t// Re-throw our own error; swallow only \"file not found\"\n\t\t\t\t\t\t\t\tif (err.message?.startsWith(\"Destination file already exists:\")) throw err;\n\t\t\t\t\t\t\t\t// File doesn't exist — safe to proceed\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait ops.writeFile(writePath, finalContent);\n\n\t\t\t\t\t\t// If moved, delete original\n\t\t\t\t\t\tif (move && writePath !== absolutePath) {\n\t\t\t\t\t\t\tawait ops.unlink(absolutePath);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (aborted) return;\n\n\t\t\t\t\t\tif (signal) signal.removeEventListener(\"abort\", onAbort);\n\n\t\t\t\t\t\tconst diffResult = generateDiffString(originalNormalized, result.lines);\n\t\t\t\t\t\tconst resultText = move ? `Moved ${path} to ${move}` : `Updated ${path}`;\n\t\t\t\t\t\tconst warningsBlock = result.warnings?.length\n\t\t\t\t\t\t\t? `\\nWarnings:\\n${result.warnings.join(\"\\n\")}`\n\t\t\t\t\t\t\t: \"\";\n\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\ttext: `${resultText}${warningsBlock}`,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\t\tdiff: diffResult.diff,\n\t\t\t\t\t\t\t\tfirstChangedLine: result.firstChangedLine ?? diffResult.firstChangedLine,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error: any) {\n\t\t\t\t\t\tif (signal) signal.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\tif (!aborted) {\n\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t});\n\t\t},\n\t};\n}\n\n/** Default hashline edit tool using process.cwd() */\nexport const hashlineEditTool = createHashlineEditTool(process.cwd());\n"]}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Hashline read tool — reads files with LINE#ID prefix on each line.
3
+ *
4
+ * Produces output like:
5
+ * 1#QQ:function hello() {
6
+ * 2#KX: return 42;
7
+ * 3#NW:}
8
+ *
9
+ * These tags are used by the hashline_edit tool to address lines precisely.
10
+ */
11
+ import type { AgentTool } from "@gsd/pi-agent-core";
12
+ import { type Static } from "@sinclair/typebox";
13
+ import { type TruncationResult } from "./truncate.js";
14
+ declare const readSchema: import("@sinclair/typebox").TObject<{
15
+ path: import("@sinclair/typebox").TString;
16
+ offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
17
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
18
+ }>;
19
+ export type HashlineReadToolInput = Static<typeof readSchema>;
20
+ export interface HashlineReadToolDetails {
21
+ truncation?: TruncationResult;
22
+ }
23
+ /**
24
+ * Pluggable operations for the hashline read tool.
25
+ */
26
+ export interface HashlineReadOperations {
27
+ readFile: (absolutePath: string) => Promise<Buffer>;
28
+ access: (absolutePath: string) => Promise<void>;
29
+ detectImageMimeType?: (absolutePath: string) => Promise<string | null | undefined>;
30
+ }
31
+ export interface HashlineReadToolOptions {
32
+ autoResizeImages?: boolean;
33
+ operations?: HashlineReadOperations;
34
+ }
35
+ export declare function createHashlineReadTool(cwd: string, options?: HashlineReadToolOptions): AgentTool<typeof readSchema>;
36
+ /** Default hashline read tool using process.cwd() */
37
+ export declare const hashlineReadTool: AgentTool<import("@sinclair/typebox").TObject<{
38
+ path: import("@sinclair/typebox").TString;
39
+ offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
40
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
41
+ }>, any>;
42
+ export {};
43
+ //# sourceMappingURL=hashline-read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hashline-read.d.ts","sourceRoot":"","sources":["../../../src/core/tools/hashline-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAOtD,OAAO,EAAoD,KAAK,gBAAgB,EAAgB,MAAM,eAAe,CAAC;AAEtH,QAAA,MAAM,UAAU;;;;EAId,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9D,MAAM,WAAW,uBAAuB;IACvC,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACnF;AAQD,MAAM,WAAW,uBAAuB;IACvC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,sBAAsB,CAAC;CACpC;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,SAAS,CAAC,OAAO,UAAU,CAAC,CA2InH;AAED,qDAAqD;AACrD,eAAO,MAAM,gBAAgB;;;;QAAwC,CAAC"}