plugsuits 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (560) hide show
  1. package/cli.js +3 -0
  2. package/dist/agent-reasoning-default.test.d.ts +2 -0
  3. package/dist/agent-reasoning-default.test.d.ts.map +1 -0
  4. package/dist/agent-reasoning-default.test.js +38 -0
  5. package/dist/agent-reasoning-default.test.js.map +1 -0
  6. package/dist/agent.d.ts +61 -0
  7. package/dist/agent.d.ts.map +1 -0
  8. package/dist/agent.js +308 -0
  9. package/dist/agent.js.map +1 -0
  10. package/dist/agent.test.d.ts +2 -0
  11. package/dist/agent.test.d.ts.map +1 -0
  12. package/dist/agent.test.js +38 -0
  13. package/dist/agent.test.js.map +1 -0
  14. package/dist/cli-args.d.ts +15 -0
  15. package/dist/cli-args.d.ts.map +1 -0
  16. package/dist/cli-args.js +63 -0
  17. package/dist/cli-args.js.map +1 -0
  18. package/dist/cli-args.test.d.ts +2 -0
  19. package/dist/cli-args.test.d.ts.map +1 -0
  20. package/dist/cli-args.test.js +105 -0
  21. package/dist/cli-args.test.js.map +1 -0
  22. package/dist/commands/aliases-and-tool-fallback.test.d.ts +2 -0
  23. package/dist/commands/aliases-and-tool-fallback.test.d.ts.map +1 -0
  24. package/dist/commands/aliases-and-tool-fallback.test.js +132 -0
  25. package/dist/commands/aliases-and-tool-fallback.test.js.map +1 -0
  26. package/dist/commands/clear.d.ts +3 -0
  27. package/dist/commands/clear.d.ts.map +1 -0
  28. package/dist/commands/clear.js +12 -0
  29. package/dist/commands/clear.js.map +1 -0
  30. package/dist/commands/factories/create-toggle-command.d.ts +13 -0
  31. package/dist/commands/factories/create-toggle-command.d.ts.map +1 -0
  32. package/dist/commands/factories/create-toggle-command.js +38 -0
  33. package/dist/commands/factories/create-toggle-command.js.map +1 -0
  34. package/dist/commands/help.d.ts +3 -0
  35. package/dist/commands/help.d.ts.map +1 -0
  36. package/dist/commands/help.js +23 -0
  37. package/dist/commands/help.js.map +1 -0
  38. package/dist/commands/index.d.ts +18 -0
  39. package/dist/commands/index.d.ts.map +1 -0
  40. package/dist/commands/index.js +82 -0
  41. package/dist/commands/index.js.map +1 -0
  42. package/dist/commands/model.d.ts +15 -0
  43. package/dist/commands/model.d.ts.map +1 -0
  44. package/dist/commands/model.js +100 -0
  45. package/dist/commands/model.js.map +1 -0
  46. package/dist/commands/reasoning-mode.d.ts +3 -0
  47. package/dist/commands/reasoning-mode.d.ts.map +1 -0
  48. package/dist/commands/reasoning-mode.js +47 -0
  49. package/dist/commands/reasoning-mode.js.map +1 -0
  50. package/dist/commands/render.d.ts +19 -0
  51. package/dist/commands/render.d.ts.map +1 -0
  52. package/dist/commands/render.js +140 -0
  53. package/dist/commands/render.js.map +1 -0
  54. package/dist/commands/render.test.d.ts +2 -0
  55. package/dist/commands/render.test.d.ts.map +1 -0
  56. package/dist/commands/render.test.js +36 -0
  57. package/dist/commands/render.test.js.map +1 -0
  58. package/dist/commands/tool-fallback.d.ts +3 -0
  59. package/dist/commands/tool-fallback.d.ts.map +1 -0
  60. package/dist/commands/tool-fallback.js +38 -0
  61. package/dist/commands/tool-fallback.js.map +1 -0
  62. package/dist/commands/translate.d.ts +3 -0
  63. package/dist/commands/translate.d.ts.map +1 -0
  64. package/dist/commands/translate.js +12 -0
  65. package/dist/commands/translate.js.map +1 -0
  66. package/dist/commands/translate.test.d.ts +2 -0
  67. package/dist/commands/translate.test.d.ts.map +1 -0
  68. package/dist/commands/translate.test.js +49 -0
  69. package/dist/commands/translate.test.js.map +1 -0
  70. package/dist/commands/types.d.ts +17 -0
  71. package/dist/commands/types.d.ts.map +1 -0
  72. package/dist/commands/types.js +2 -0
  73. package/dist/commands/types.js.map +1 -0
  74. package/dist/context/environment-context.d.ts +2 -0
  75. package/dist/context/environment-context.d.ts.map +1 -0
  76. package/dist/context/environment-context.js +11 -0
  77. package/dist/context/environment-context.js.map +1 -0
  78. package/dist/context/paths.d.ts +3 -0
  79. package/dist/context/paths.d.ts.map +1 -0
  80. package/dist/context/paths.js +3 -0
  81. package/dist/context/paths.js.map +1 -0
  82. package/dist/context/session.d.ts +4 -0
  83. package/dist/context/session.d.ts.map +1 -0
  84. package/dist/context/session.js +16 -0
  85. package/dist/context/session.js.map +1 -0
  86. package/dist/context/skill-command-prefix.d.ts +4 -0
  87. package/dist/context/skill-command-prefix.d.ts.map +1 -0
  88. package/dist/context/skill-command-prefix.js +15 -0
  89. package/dist/context/skill-command-prefix.js.map +1 -0
  90. package/dist/context/skills-integration.test.d.ts +2 -0
  91. package/dist/context/skills-integration.test.d.ts.map +1 -0
  92. package/dist/context/skills-integration.test.js +87 -0
  93. package/dist/context/skills-integration.test.js.map +1 -0
  94. package/dist/context/skills.d.ts +18 -0
  95. package/dist/context/skills.d.ts.map +1 -0
  96. package/dist/context/skills.js +431 -0
  97. package/dist/context/skills.js.map +1 -0
  98. package/dist/context/skills.test.d.ts +2 -0
  99. package/dist/context/skills.test.d.ts.map +1 -0
  100. package/dist/context/skills.test.js +20 -0
  101. package/dist/context/skills.test.js.map +1 -0
  102. package/dist/context/system-prompt.d.ts +2 -0
  103. package/dist/context/system-prompt.d.ts.map +1 -0
  104. package/dist/context/system-prompt.js +100 -0
  105. package/dist/context/system-prompt.js.map +1 -0
  106. package/dist/context/translation-integration.test.d.ts +2 -0
  107. package/dist/context/translation-integration.test.d.ts.map +1 -0
  108. package/dist/context/translation-integration.test.js +138 -0
  109. package/dist/context/translation-integration.test.js.map +1 -0
  110. package/dist/context/translation.d.ts +21 -0
  111. package/dist/context/translation.d.ts.map +1 -0
  112. package/dist/context/translation.js +82 -0
  113. package/dist/context/translation.js.map +1 -0
  114. package/dist/context/translation.test.d.ts +2 -0
  115. package/dist/context/translation.test.d.ts.map +1 -0
  116. package/dist/context/translation.test.js +129 -0
  117. package/dist/context/translation.test.js.map +1 -0
  118. package/dist/entrypoints/cli-input-rendering.test.d.ts +2 -0
  119. package/dist/entrypoints/cli-input-rendering.test.d.ts.map +1 -0
  120. package/dist/entrypoints/cli-input-rendering.test.js +192 -0
  121. package/dist/entrypoints/cli-input-rendering.test.js.map +1 -0
  122. package/dist/entrypoints/cli.d.ts +3 -0
  123. package/dist/entrypoints/cli.d.ts.map +1 -0
  124. package/dist/entrypoints/cli.js +1268 -0
  125. package/dist/entrypoints/cli.js.map +1 -0
  126. package/dist/entrypoints/headless-agent-config.d.ts +21 -0
  127. package/dist/entrypoints/headless-agent-config.d.ts.map +1 -0
  128. package/dist/entrypoints/headless-agent-config.js +15 -0
  129. package/dist/entrypoints/headless-agent-config.js.map +1 -0
  130. package/dist/entrypoints/headless-agent-config.test.d.ts +2 -0
  131. package/dist/entrypoints/headless-agent-config.test.d.ts.map +1 -0
  132. package/dist/entrypoints/headless-agent-config.test.js +63 -0
  133. package/dist/entrypoints/headless-agent-config.test.js.map +1 -0
  134. package/dist/entrypoints/headless.d.ts +3 -0
  135. package/dist/entrypoints/headless.d.ts.map +1 -0
  136. package/dist/entrypoints/headless.js +396 -0
  137. package/dist/entrypoints/headless.js.map +1 -0
  138. package/dist/env.d.ts +8 -0
  139. package/dist/env.d.ts.map +1 -0
  140. package/dist/env.js +14 -0
  141. package/dist/env.js.map +1 -0
  142. package/dist/friendli-models.d.ts +21 -0
  143. package/dist/friendli-models.d.ts.map +1 -0
  144. package/dist/friendli-models.js +57 -0
  145. package/dist/friendli-models.js.map +1 -0
  146. package/dist/friendli-reasoning.d.ts +10 -0
  147. package/dist/friendli-reasoning.d.ts.map +1 -0
  148. package/dist/friendli-reasoning.js +181 -0
  149. package/dist/friendli-reasoning.js.map +1 -0
  150. package/dist/friendli-reasoning.test.d.ts +2 -0
  151. package/dist/friendli-reasoning.test.d.ts.map +1 -0
  152. package/dist/friendli-reasoning.test.js +77 -0
  153. package/dist/friendli-reasoning.test.js.map +1 -0
  154. package/dist/index.d.ts +3 -0
  155. package/dist/index.d.ts.map +1 -0
  156. package/dist/index.js +3 -0
  157. package/dist/index.js.map +1 -0
  158. package/dist/interaction/colors.d.ts +22 -0
  159. package/dist/interaction/colors.d.ts.map +1 -0
  160. package/dist/interaction/colors.js +24 -0
  161. package/dist/interaction/colors.js.map +1 -0
  162. package/dist/interaction/pi-tui-stream-renderer.d.ts +19 -0
  163. package/dist/interaction/pi-tui-stream-renderer.d.ts.map +1 -0
  164. package/dist/interaction/pi-tui-stream-renderer.js +1509 -0
  165. package/dist/interaction/pi-tui-stream-renderer.js.map +1 -0
  166. package/dist/interaction/pi-tui-stream-renderer.test.d.ts +2 -0
  167. package/dist/interaction/pi-tui-stream-renderer.test.d.ts.map +1 -0
  168. package/dist/interaction/pi-tui-stream-renderer.test.js +1314 -0
  169. package/dist/interaction/pi-tui-stream-renderer.test.js.map +1 -0
  170. package/dist/interaction/spinner.d.ts +13 -0
  171. package/dist/interaction/spinner.d.ts.map +1 -0
  172. package/dist/interaction/spinner.js +51 -0
  173. package/dist/interaction/spinner.js.map +1 -0
  174. package/dist/middleware/index.d.ts +7 -0
  175. package/dist/middleware/index.d.ts.map +1 -0
  176. package/dist/middleware/index.js +15 -0
  177. package/dist/middleware/index.js.map +1 -0
  178. package/dist/middleware/todo-continuation.d.ts +11 -0
  179. package/dist/middleware/todo-continuation.d.ts.map +1 -0
  180. package/dist/middleware/todo-continuation.js +103 -0
  181. package/dist/middleware/todo-continuation.js.map +1 -0
  182. package/dist/middleware/trim-leading-newlines.d.ts +3 -0
  183. package/dist/middleware/trim-leading-newlines.d.ts.map +1 -0
  184. package/dist/middleware/trim-leading-newlines.js +49 -0
  185. package/dist/middleware/trim-leading-newlines.js.map +1 -0
  186. package/dist/reasoning-mode.d.ts +5 -0
  187. package/dist/reasoning-mode.d.ts.map +1 -0
  188. package/dist/reasoning-mode.js +30 -0
  189. package/dist/reasoning-mode.js.map +1 -0
  190. package/dist/reasoning-mode.test.d.ts +2 -0
  191. package/dist/reasoning-mode.test.d.ts.map +1 -0
  192. package/dist/reasoning-mode.test.js +22 -0
  193. package/dist/reasoning-mode.test.js.map +1 -0
  194. package/dist/tool-fallback-mode.d.ts +6 -0
  195. package/dist/tool-fallback-mode.d.ts.map +1 -0
  196. package/dist/tool-fallback-mode.js +25 -0
  197. package/dist/tool-fallback-mode.js.map +1 -0
  198. package/dist/tools/execute/shell-execute.d.ts +17 -0
  199. package/dist/tools/execute/shell-execute.d.ts.map +1 -0
  200. package/dist/tools/execute/shell-execute.js +55 -0
  201. package/dist/tools/execute/shell-execute.js.map +1 -0
  202. package/dist/tools/execute/shell-execute.test.d.ts +2 -0
  203. package/dist/tools/execute/shell-execute.test.d.ts.map +1 -0
  204. package/dist/tools/execute/shell-execute.test.js +86 -0
  205. package/dist/tools/execute/shell-execute.test.js.map +1 -0
  206. package/dist/tools/execute/shell-interact.d.ts +10 -0
  207. package/dist/tools/execute/shell-interact.d.ts.map +1 -0
  208. package/dist/tools/execute/shell-interact.js +122 -0
  209. package/dist/tools/execute/shell-interact.js.map +1 -0
  210. package/dist/tools/execute/shell-interact.test.d.ts +2 -0
  211. package/dist/tools/execute/shell-interact.test.d.ts.map +1 -0
  212. package/dist/tools/execute/shell-interact.test.js +175 -0
  213. package/dist/tools/execute/shell-interact.test.js.map +1 -0
  214. package/dist/tools/explore/glob.d.ts +15 -0
  215. package/dist/tools/explore/glob.d.ts.map +1 -0
  216. package/dist/tools/explore/glob.js +107 -0
  217. package/dist/tools/explore/glob.js.map +1 -0
  218. package/dist/tools/explore/glob.test.d.ts +2 -0
  219. package/dist/tools/explore/glob.test.d.ts.map +1 -0
  220. package/dist/tools/explore/glob.test.js +183 -0
  221. package/dist/tools/explore/glob.test.js.map +1 -0
  222. package/dist/tools/explore/grep.d.ts +27 -0
  223. package/dist/tools/explore/grep.d.ts.map +1 -0
  224. package/dist/tools/explore/grep.js +203 -0
  225. package/dist/tools/explore/grep.js.map +1 -0
  226. package/dist/tools/explore/grep.test.d.ts +2 -0
  227. package/dist/tools/explore/grep.test.d.ts.map +1 -0
  228. package/dist/tools/explore/grep.test.js +132 -0
  229. package/dist/tools/explore/grep.test.js.map +1 -0
  230. package/dist/tools/explore/read-file.d.ts +23 -0
  231. package/dist/tools/explore/read-file.d.ts.map +1 -0
  232. package/dist/tools/explore/read-file.js +84 -0
  233. package/dist/tools/explore/read-file.js.map +1 -0
  234. package/dist/tools/explore/read-file.test.d.ts +2 -0
  235. package/dist/tools/explore/read-file.test.d.ts.map +1 -0
  236. package/dist/tools/explore/read-file.test.js +278 -0
  237. package/dist/tools/explore/read-file.test.js.map +1 -0
  238. package/dist/tools/index.d.ts +71 -0
  239. package/dist/tools/index.d.ts.map +1 -0
  240. package/dist/tools/index.js +26 -0
  241. package/dist/tools/index.js.map +1 -0
  242. package/dist/tools/modify/delete-file.d.ts +19 -0
  243. package/dist/tools/modify/delete-file.d.ts.map +1 -0
  244. package/dist/tools/modify/delete-file.js +71 -0
  245. package/dist/tools/modify/delete-file.js.map +1 -0
  246. package/dist/tools/modify/delete-file.test.d.ts +2 -0
  247. package/dist/tools/modify/delete-file.test.d.ts.map +1 -0
  248. package/dist/tools/modify/delete-file.test.js +136 -0
  249. package/dist/tools/modify/delete-file.test.js.map +1 -0
  250. package/dist/tools/modify/edit-file-diagnostics.d.ts +17 -0
  251. package/dist/tools/modify/edit-file-diagnostics.d.ts.map +1 -0
  252. package/dist/tools/modify/edit-file-diagnostics.js +157 -0
  253. package/dist/tools/modify/edit-file-diagnostics.js.map +1 -0
  254. package/dist/tools/modify/edit-file-repair.d.ts +13 -0
  255. package/dist/tools/modify/edit-file-repair.d.ts.map +1 -0
  256. package/dist/tools/modify/edit-file-repair.js +135 -0
  257. package/dist/tools/modify/edit-file-repair.js.map +1 -0
  258. package/dist/tools/modify/edit-file-stress.test.d.ts +2 -0
  259. package/dist/tools/modify/edit-file-stress.test.d.ts.map +1 -0
  260. package/dist/tools/modify/edit-file-stress.test.js +163 -0
  261. package/dist/tools/modify/edit-file-stress.test.js.map +1 -0
  262. package/dist/tools/modify/edit-file-validation.d.ts +9 -0
  263. package/dist/tools/modify/edit-file-validation.d.ts.map +1 -0
  264. package/dist/tools/modify/edit-file-validation.js +86 -0
  265. package/dist/tools/modify/edit-file-validation.js.map +1 -0
  266. package/dist/tools/modify/edit-file-whitespace.test.d.ts +2 -0
  267. package/dist/tools/modify/edit-file-whitespace.test.d.ts.map +1 -0
  268. package/dist/tools/modify/edit-file-whitespace.test.js +90 -0
  269. package/dist/tools/modify/edit-file-whitespace.test.js.map +1 -0
  270. package/dist/tools/modify/edit-file.d.ts +33 -0
  271. package/dist/tools/modify/edit-file.d.ts.map +1 -0
  272. package/dist/tools/modify/edit-file.js +177 -0
  273. package/dist/tools/modify/edit-file.js.map +1 -0
  274. package/dist/tools/modify/edit-file.test.d.ts +2 -0
  275. package/dist/tools/modify/edit-file.test.d.ts.map +1 -0
  276. package/dist/tools/modify/edit-file.test.js +948 -0
  277. package/dist/tools/modify/edit-file.test.js.map +1 -0
  278. package/dist/tools/modify/write-file.d.ts +17 -0
  279. package/dist/tools/modify/write-file.d.ts.map +1 -0
  280. package/dist/tools/modify/write-file.js +39 -0
  281. package/dist/tools/modify/write-file.js.map +1 -0
  282. package/dist/tools/modify/write-file.test.d.ts +2 -0
  283. package/dist/tools/modify/write-file.test.d.ts.map +1 -0
  284. package/dist/tools/modify/write-file.test.js +168 -0
  285. package/dist/tools/modify/write-file.test.js.map +1 -0
  286. package/dist/tools/planning/load-skill.d.ts +13 -0
  287. package/dist/tools/planning/load-skill.d.ts.map +1 -0
  288. package/dist/tools/planning/load-skill.js +101 -0
  289. package/dist/tools/planning/load-skill.js.map +1 -0
  290. package/dist/tools/planning/load-skill.test.d.ts +2 -0
  291. package/dist/tools/planning/load-skill.test.d.ts.map +1 -0
  292. package/dist/tools/planning/load-skill.test.js +37 -0
  293. package/dist/tools/planning/load-skill.test.js.map +1 -0
  294. package/dist/tools/planning/todo-write.d.ts +49 -0
  295. package/dist/tools/planning/todo-write.d.ts.map +1 -0
  296. package/dist/tools/planning/todo-write.js +118 -0
  297. package/dist/tools/planning/todo-write.js.map +1 -0
  298. package/dist/tools/planning/todo-write.test.d.ts +2 -0
  299. package/dist/tools/planning/todo-write.test.d.ts.map +1 -0
  300. package/dist/tools/planning/todo-write.test.js +82 -0
  301. package/dist/tools/planning/todo-write.test.js.map +1 -0
  302. package/dist/tools/utils/execute/format-utils.d.ts +4 -0
  303. package/dist/tools/utils/execute/format-utils.d.ts.map +1 -0
  304. package/dist/tools/utils/execute/format-utils.js +31 -0
  305. package/dist/tools/utils/execute/format-utils.js.map +1 -0
  306. package/dist/tools/utils/execute/format-utils.test.d.ts +2 -0
  307. package/dist/tools/utils/execute/format-utils.test.d.ts.map +1 -0
  308. package/dist/tools/utils/execute/format-utils.test.js +40 -0
  309. package/dist/tools/utils/execute/format-utils.test.js.map +1 -0
  310. package/dist/tools/utils/execute/noninteractive-wrapper.d.ts +12 -0
  311. package/dist/tools/utils/execute/noninteractive-wrapper.d.ts.map +1 -0
  312. package/dist/tools/utils/execute/noninteractive-wrapper.js +269 -0
  313. package/dist/tools/utils/execute/noninteractive-wrapper.js.map +1 -0
  314. package/dist/tools/utils/execute/noninteractive-wrapper.test.d.ts +2 -0
  315. package/dist/tools/utils/execute/noninteractive-wrapper.test.d.ts.map +1 -0
  316. package/dist/tools/utils/execute/noninteractive-wrapper.test.js +233 -0
  317. package/dist/tools/utils/execute/noninteractive-wrapper.test.js.map +1 -0
  318. package/dist/tools/utils/execute/output-handler.d.ts +14 -0
  319. package/dist/tools/utils/execute/output-handler.d.ts.map +1 -0
  320. package/dist/tools/utils/execute/output-handler.js +71 -0
  321. package/dist/tools/utils/execute/output-handler.js.map +1 -0
  322. package/dist/tools/utils/execute/output-handler.test.d.ts +2 -0
  323. package/dist/tools/utils/execute/output-handler.test.d.ts.map +1 -0
  324. package/dist/tools/utils/execute/output-handler.test.js +58 -0
  325. package/dist/tools/utils/execute/output-handler.test.js.map +1 -0
  326. package/dist/tools/utils/execute/process-manager.d.ts +17 -0
  327. package/dist/tools/utils/execute/process-manager.d.ts.map +1 -0
  328. package/dist/tools/utils/execute/process-manager.js +229 -0
  329. package/dist/tools/utils/execute/process-manager.js.map +1 -0
  330. package/dist/tools/utils/execute/process-manager.test.d.ts +2 -0
  331. package/dist/tools/utils/execute/process-manager.test.d.ts.map +1 -0
  332. package/dist/tools/utils/execute/process-manager.test.js +139 -0
  333. package/dist/tools/utils/execute/process-manager.test.js.map +1 -0
  334. package/dist/tools/utils/execute/shell-detection.d.ts +3 -0
  335. package/dist/tools/utils/execute/shell-detection.d.ts.map +1 -0
  336. package/dist/tools/utils/execute/shell-detection.js +56 -0
  337. package/dist/tools/utils/execute/shell-detection.js.map +1 -0
  338. package/dist/tools/utils/execute/shell-detection.test.d.ts +2 -0
  339. package/dist/tools/utils/execute/shell-detection.test.d.ts.map +1 -0
  340. package/dist/tools/utils/execute/shell-detection.test.js +86 -0
  341. package/dist/tools/utils/execute/shell-detection.test.js.map +1 -0
  342. package/dist/tools/utils/hashline/autocorrect-replacement-lines.d.ts +5 -0
  343. package/dist/tools/utils/hashline/autocorrect-replacement-lines.d.ts.map +1 -0
  344. package/dist/tools/utils/hashline/autocorrect-replacement-lines.js +113 -0
  345. package/dist/tools/utils/hashline/autocorrect-replacement-lines.js.map +1 -0
  346. package/dist/tools/utils/hashline/constants.d.ts +5 -0
  347. package/dist/tools/utils/hashline/constants.d.ts.map +1 -0
  348. package/dist/tools/utils/hashline/constants.js +11 -0
  349. package/dist/tools/utils/hashline/constants.js.map +1 -0
  350. package/dist/tools/utils/hashline/diff-utils.d.ts +7 -0
  351. package/dist/tools/utils/hashline/diff-utils.d.ts.map +1 -0
  352. package/dist/tools/utils/hashline/diff-utils.js +50 -0
  353. package/dist/tools/utils/hashline/diff-utils.js.map +1 -0
  354. package/dist/tools/utils/hashline/diff-utils.test.d.ts +2 -0
  355. package/dist/tools/utils/hashline/diff-utils.test.d.ts.map +1 -0
  356. package/dist/tools/utils/hashline/diff-utils.test.js +46 -0
  357. package/dist/tools/utils/hashline/diff-utils.test.js.map +1 -0
  358. package/dist/tools/utils/hashline/edit-deduplication.d.ts +6 -0
  359. package/dist/tools/utils/hashline/edit-deduplication.d.ts.map +1 -0
  360. package/dist/tools/utils/hashline/edit-deduplication.js +32 -0
  361. package/dist/tools/utils/hashline/edit-deduplication.js.map +1 -0
  362. package/dist/tools/utils/hashline/edit-operation-primitives.d.ts +11 -0
  363. package/dist/tools/utils/hashline/edit-operation-primitives.d.ts.map +1 -0
  364. package/dist/tools/utils/hashline/edit-operation-primitives.js +93 -0
  365. package/dist/tools/utils/hashline/edit-operation-primitives.js.map +1 -0
  366. package/dist/tools/utils/hashline/edit-operations.d.ts +9 -0
  367. package/dist/tools/utils/hashline/edit-operations.d.ts.map +1 -0
  368. package/dist/tools/utils/hashline/edit-operations.js +101 -0
  369. package/dist/tools/utils/hashline/edit-operations.js.map +1 -0
  370. package/dist/tools/utils/hashline/edit-operations.test.d.ts +2 -0
  371. package/dist/tools/utils/hashline/edit-operations.test.d.ts.map +1 -0
  372. package/dist/tools/utils/hashline/edit-operations.test.js +135 -0
  373. package/dist/tools/utils/hashline/edit-operations.test.js.map +1 -0
  374. package/dist/tools/utils/hashline/edit-ordering.d.ts +5 -0
  375. package/dist/tools/utils/hashline/edit-ordering.d.ts.map +1 -0
  376. package/dist/tools/utils/hashline/edit-ordering.js +54 -0
  377. package/dist/tools/utils/hashline/edit-ordering.js.map +1 -0
  378. package/dist/tools/utils/hashline/edit-text-normalization.d.ts +9 -0
  379. package/dist/tools/utils/hashline/edit-text-normalization.d.ts.map +1 -0
  380. package/dist/tools/utils/hashline/edit-text-normalization.js +135 -0
  381. package/dist/tools/utils/hashline/edit-text-normalization.js.map +1 -0
  382. package/dist/tools/utils/hashline/file-text-canonicalization.d.ts +8 -0
  383. package/dist/tools/utils/hashline/file-text-canonicalization.d.ts.map +1 -0
  384. package/dist/tools/utils/hashline/file-text-canonicalization.js +42 -0
  385. package/dist/tools/utils/hashline/file-text-canonicalization.js.map +1 -0
  386. package/dist/tools/utils/hashline/hash-computation.d.ts +14 -0
  387. package/dist/tools/utils/hashline/hash-computation.d.ts.map +1 -0
  388. package/dist/tools/utils/hashline/hash-computation.js +158 -0
  389. package/dist/tools/utils/hashline/hash-computation.js.map +1 -0
  390. package/dist/tools/utils/hashline/hash-computation.test.d.ts +2 -0
  391. package/dist/tools/utils/hashline/hash-computation.test.d.ts.map +1 -0
  392. package/dist/tools/utils/hashline/hash-computation.test.js +63 -0
  393. package/dist/tools/utils/hashline/hash-computation.test.js.map +1 -0
  394. package/dist/tools/utils/hashline/hashline-chunk-formatter.d.ts +11 -0
  395. package/dist/tools/utils/hashline/hashline-chunk-formatter.d.ts.map +1 -0
  396. package/dist/tools/utils/hashline/hashline-chunk-formatter.js +41 -0
  397. package/dist/tools/utils/hashline/hashline-chunk-formatter.js.map +1 -0
  398. package/dist/tools/utils/hashline/hashline-edit-diff.d.ts +2 -0
  399. package/dist/tools/utils/hashline/hashline-edit-diff.d.ts.map +1 -0
  400. package/dist/tools/utils/hashline/hashline-edit-diff.js +27 -0
  401. package/dist/tools/utils/hashline/hashline-edit-diff.js.map +1 -0
  402. package/dist/tools/utils/hashline/index.d.ts +14 -0
  403. package/dist/tools/utils/hashline/index.d.ts.map +1 -0
  404. package/dist/tools/utils/hashline/index.js +11 -0
  405. package/dist/tools/utils/hashline/index.js.map +1 -0
  406. package/dist/tools/utils/hashline/merge-expansion.d.ts +4 -0
  407. package/dist/tools/utils/hashline/merge-expansion.d.ts.map +1 -0
  408. package/dist/tools/utils/hashline/merge-expansion.js +105 -0
  409. package/dist/tools/utils/hashline/merge-expansion.js.map +1 -0
  410. package/dist/tools/utils/hashline/normalize-edits.d.ts +11 -0
  411. package/dist/tools/utils/hashline/normalize-edits.d.ts.map +1 -0
  412. package/dist/tools/utils/hashline/normalize-edits.js +81 -0
  413. package/dist/tools/utils/hashline/normalize-edits.js.map +1 -0
  414. package/dist/tools/utils/hashline/types.d.ts +18 -0
  415. package/dist/tools/utils/hashline/types.d.ts.map +1 -0
  416. package/dist/tools/utils/hashline/types.js +2 -0
  417. package/dist/tools/utils/hashline/types.js.map +1 -0
  418. package/dist/tools/utils/hashline/validation.d.ts +19 -0
  419. package/dist/tools/utils/hashline/validation.d.ts.map +1 -0
  420. package/dist/tools/utils/hashline/validation.js +161 -0
  421. package/dist/tools/utils/hashline/validation.js.map +1 -0
  422. package/dist/tools/utils/hashline/validation.test.d.ts +2 -0
  423. package/dist/tools/utils/hashline/validation.test.d.ts.map +1 -0
  424. package/dist/tools/utils/hashline/validation.test.js +86 -0
  425. package/dist/tools/utils/hashline/validation.test.js.map +1 -0
  426. package/dist/tools/utils/safety-utils.d.ts +66 -0
  427. package/dist/tools/utils/safety-utils.d.ts.map +1 -0
  428. package/dist/tools/utils/safety-utils.js +681 -0
  429. package/dist/tools/utils/safety-utils.js.map +1 -0
  430. package/dist/utils/tools-manager.d.ts +16 -0
  431. package/dist/utils/tools-manager.d.ts.map +1 -0
  432. package/dist/utils/tools-manager.js +257 -0
  433. package/dist/utils/tools-manager.js.map +1 -0
  434. package/package.json +49 -0
  435. package/src/AGENTS.md +52 -0
  436. package/src/agent-reasoning-default.test.ts +48 -0
  437. package/src/agent.test.ts +49 -0
  438. package/src/agent.ts +455 -0
  439. package/src/cli-args.test.ts +152 -0
  440. package/src/cli-args.ts +90 -0
  441. package/src/commands/aliases-and-tool-fallback.test.ts +172 -0
  442. package/src/commands/clear.ts +14 -0
  443. package/src/commands/factories/create-toggle-command.ts +68 -0
  444. package/src/commands/help.ts +30 -0
  445. package/src/commands/index.ts +125 -0
  446. package/src/commands/model.ts +146 -0
  447. package/src/commands/reasoning-mode.ts +55 -0
  448. package/src/commands/render.test.ts +47 -0
  449. package/src/commands/render.ts +205 -0
  450. package/src/commands/tool-fallback.ts +47 -0
  451. package/src/commands/translate.test.ts +62 -0
  452. package/src/commands/translate.ts +14 -0
  453. package/src/commands/types.ts +18 -0
  454. package/src/context/environment-context.ts +11 -0
  455. package/src/context/paths.ts +2 -0
  456. package/src/context/session.ts +18 -0
  457. package/src/context/skill-command-prefix.ts +18 -0
  458. package/src/context/skills-integration.test.ts +113 -0
  459. package/src/context/skills.test.ts +25 -0
  460. package/src/context/skills.ts +566 -0
  461. package/src/context/system-prompt.ts +100 -0
  462. package/src/context/translation-integration.test.ts +194 -0
  463. package/src/context/translation.test.ts +186 -0
  464. package/src/context/translation.ts +122 -0
  465. package/src/entrypoints/AGENTS.md +33 -0
  466. package/src/entrypoints/cli-input-rendering.test.ts +236 -0
  467. package/src/entrypoints/cli.ts +1845 -0
  468. package/src/entrypoints/headless-agent-config.test.ts +82 -0
  469. package/src/entrypoints/headless-agent-config.ts +42 -0
  470. package/src/entrypoints/headless.ts +622 -0
  471. package/src/env.ts +14 -0
  472. package/src/friendli-models.ts +81 -0
  473. package/src/friendli-reasoning.test.ts +147 -0
  474. package/src/friendli-reasoning.ts +280 -0
  475. package/src/index.ts +3 -0
  476. package/src/interaction/colors.ts +24 -0
  477. package/src/interaction/pi-tui-stream-renderer.test.ts +1471 -0
  478. package/src/interaction/pi-tui-stream-renderer.ts +2150 -0
  479. package/src/interaction/spinner.ts +61 -0
  480. package/src/middleware/index.ts +32 -0
  481. package/src/middleware/todo-continuation.ts +128 -0
  482. package/src/middleware/trim-leading-newlines.ts +66 -0
  483. package/src/reasoning-mode.test.ts +24 -0
  484. package/src/reasoning-mode.ts +40 -0
  485. package/src/skills/example/SKILL.md +44 -0
  486. package/src/skills/example/references/api.md +37 -0
  487. package/src/skills/example/scripts/setup.sh +13 -0
  488. package/src/skills/git-workflow.md +405 -0
  489. package/src/tool-fallback-mode.ts +34 -0
  490. package/src/tools/AGENTS.md +44 -0
  491. package/src/tools/execute/shell-execute.test.ts +114 -0
  492. package/src/tools/execute/shell-execute.ts +74 -0
  493. package/src/tools/execute/shell-execute.txt +27 -0
  494. package/src/tools/execute/shell-interact.test.ts +236 -0
  495. package/src/tools/execute/shell-interact.ts +151 -0
  496. package/src/tools/execute/shell-interact.txt +15 -0
  497. package/src/tools/explore/glob-files.txt +8 -0
  498. package/src/tools/explore/glob.test.ts +217 -0
  499. package/src/tools/explore/glob.ts +137 -0
  500. package/src/tools/explore/grep-files.txt +12 -0
  501. package/src/tools/explore/grep.test.ts +183 -0
  502. package/src/tools/explore/grep.ts +266 -0
  503. package/src/tools/explore/read-file.test.ts +355 -0
  504. package/src/tools/explore/read-file.ts +102 -0
  505. package/src/tools/explore/read-file.txt +24 -0
  506. package/src/tools/index.ts +29 -0
  507. package/src/tools/modify/AGENTS.md +38 -0
  508. package/src/tools/modify/delete-file.test.ts +200 -0
  509. package/src/tools/modify/delete-file.ts +95 -0
  510. package/src/tools/modify/delete-file.txt +9 -0
  511. package/src/tools/modify/edit-file-diagnostics.ts +210 -0
  512. package/src/tools/modify/edit-file-repair.ts +183 -0
  513. package/src/tools/modify/edit-file-stress.test.ts +200 -0
  514. package/src/tools/modify/edit-file-validation.ts +134 -0
  515. package/src/tools/modify/edit-file-whitespace.test.ts +117 -0
  516. package/src/tools/modify/edit-file.test.ts +1231 -0
  517. package/src/tools/modify/edit-file.ts +252 -0
  518. package/src/tools/modify/edit-file.txt +73 -0
  519. package/src/tools/modify/write-file.test.ts +240 -0
  520. package/src/tools/modify/write-file.ts +56 -0
  521. package/src/tools/modify/write-file.txt +9 -0
  522. package/src/tools/planning/load-skill.test.ts +48 -0
  523. package/src/tools/planning/load-skill.ts +136 -0
  524. package/src/tools/planning/load-skill.txt +6 -0
  525. package/src/tools/planning/todo-write.test.ts +91 -0
  526. package/src/tools/planning/todo-write.ts +141 -0
  527. package/src/tools/planning/todo-write.txt +7 -0
  528. package/src/tools/utils/execute/format-utils.test.ts +53 -0
  529. package/src/tools/utils/execute/format-utils.ts +37 -0
  530. package/src/tools/utils/execute/noninteractive-wrapper.test.ts +306 -0
  531. package/src/tools/utils/execute/noninteractive-wrapper.ts +314 -0
  532. package/src/tools/utils/execute/output-handler.test.ts +72 -0
  533. package/src/tools/utils/execute/output-handler.ts +101 -0
  534. package/src/tools/utils/execute/process-manager.test.ts +175 -0
  535. package/src/tools/utils/execute/process-manager.ts +310 -0
  536. package/src/tools/utils/execute/shell-detection.test.ts +112 -0
  537. package/src/tools/utils/execute/shell-detection.ts +72 -0
  538. package/src/tools/utils/hashline/autocorrect-replacement-lines.ts +159 -0
  539. package/src/tools/utils/hashline/constants.ts +13 -0
  540. package/src/tools/utils/hashline/diff-utils.test.ts +61 -0
  541. package/src/tools/utils/hashline/diff-utils.ts +64 -0
  542. package/src/tools/utils/hashline/edit-deduplication.ts +40 -0
  543. package/src/tools/utils/hashline/edit-operation-primitives.ts +149 -0
  544. package/src/tools/utils/hashline/edit-operations.test.ts +154 -0
  545. package/src/tools/utils/hashline/edit-operations.ts +132 -0
  546. package/src/tools/utils/hashline/edit-ordering.ts +60 -0
  547. package/src/tools/utils/hashline/edit-text-normalization.ts +180 -0
  548. package/src/tools/utils/hashline/file-text-canonicalization.ts +58 -0
  549. package/src/tools/utils/hashline/hash-computation.test.ts +82 -0
  550. package/src/tools/utils/hashline/hash-computation.ts +199 -0
  551. package/src/tools/utils/hashline/hashline-chunk-formatter.ts +61 -0
  552. package/src/tools/utils/hashline/hashline-edit-diff.ts +35 -0
  553. package/src/tools/utils/hashline/index.ts +55 -0
  554. package/src/tools/utils/hashline/merge-expansion.ts +120 -0
  555. package/src/tools/utils/hashline/normalize-edits.ts +127 -0
  556. package/src/tools/utils/hashline/types.ts +20 -0
  557. package/src/tools/utils/hashline/validation.test.ts +109 -0
  558. package/src/tools/utils/hashline/validation.ts +212 -0
  559. package/src/tools/utils/safety-utils.ts +938 -0
  560. package/src/utils/tools-manager.ts +353 -0
@@ -0,0 +1,86 @@
1
+ import { afterAll, beforeAll, describe, expect, it } from "bun:test";
2
+ import { existsSync, mkdtempSync, rmSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import { executeCommand } from "./shell-execute";
6
+ describe("executeCommand", () => {
7
+ let tempDir;
8
+ beforeAll(() => {
9
+ tempDir = mkdtempSync(join(tmpdir(), "shell-test-"));
10
+ });
11
+ afterAll(() => {
12
+ if (existsSync(tempDir)) {
13
+ rmSync(tempDir, { recursive: true });
14
+ }
15
+ });
16
+ describe("basic execution", () => {
17
+ it("executes simple echo command", async () => {
18
+ const result = await executeCommand('echo "hello world"');
19
+ expect(result.output).toContain("hello world");
20
+ expect(result.exitCode).toBe(0);
21
+ });
22
+ it("captures multiline output", async () => {
23
+ const result = await executeCommand("printf 'line1\\nline2\\nline3'");
24
+ expect(result.output).toContain("line1");
25
+ expect(result.output).toContain("line2");
26
+ expect(result.output).toContain("line3");
27
+ });
28
+ it("combines stdout and stderr", async () => {
29
+ const result = await executeCommand('echo "stdout" && echo "stderr" >&2');
30
+ expect(result.output).toContain("stdout");
31
+ expect(result.output).toContain("stderr");
32
+ });
33
+ it("handles empty output", async () => {
34
+ const result = await executeCommand("true");
35
+ expect(result.output).toBe("");
36
+ expect(result.exitCode).toBe(0);
37
+ });
38
+ it("executes command in specified workdir", async () => {
39
+ const result = await executeCommand("pwd", { workdir: tempDir });
40
+ expect(result.output).toContain("shell-test-");
41
+ expect(result.exitCode).toBe(0);
42
+ });
43
+ });
44
+ describe("exit code propagation", () => {
45
+ it("returns non-zero exit code for failed command", async () => {
46
+ const result = await executeCommand("exit 42");
47
+ expect(result.exitCode).toBe(42);
48
+ });
49
+ it("returns zero for successful command", async () => {
50
+ const result = await executeCommand("echo ok");
51
+ expect(result.exitCode).toBe(0);
52
+ });
53
+ it("returns exit code from last command in chain", async () => {
54
+ const result = await executeCommand("true && exit 5");
55
+ expect(result.exitCode).toBe(5);
56
+ });
57
+ });
58
+ describe("timeout formatting", () => {
59
+ it("includes [TIMEOUT] prefix when command exceeds timeout", async () => {
60
+ const result = await executeCommand("sleep 10", { timeoutMs: 200 });
61
+ expect(result.output).toContain("[TIMEOUT]");
62
+ expect(result.exitCode).toBe(124);
63
+ }, 5000);
64
+ it("includes timeout duration in timeout message", async () => {
65
+ const result = await executeCommand("sleep 10", { timeoutMs: 300 });
66
+ expect(result.output).toContain("300ms");
67
+ }, 5000);
68
+ });
69
+ describe("background process detection", () => {
70
+ it("wraps output with background message for commands ending with &", async () => {
71
+ const result = await executeCommand("sleep 0.1 &");
72
+ expect(result.exitCode).toBe(0);
73
+ expect(result.output).toContain("[Background process started]");
74
+ });
75
+ it("does not treat && as background operator", async () => {
76
+ const result = await executeCommand('echo "first" && echo "second"');
77
+ expect(result.output).toContain("first");
78
+ expect(result.output).not.toContain("[Background process started]");
79
+ });
80
+ it("does not treat mid-command & as background", async () => {
81
+ const result = await executeCommand("sleep 0.1 & wait");
82
+ expect(result.output).not.toContain("[Background process started]");
83
+ });
84
+ });
85
+ });
86
+ //# sourceMappingURL=shell-execute.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-execute.test.js","sourceRoot":"","sources":["../../../src/tools/execute/shell-execute.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,OAAe,CAAC;IAEpB,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,GAAG,EAAE;QACZ,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACxB,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvC,CAAC;IACH,C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CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;YAC1D,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,kBAAkB,CAAC,CAAC;YAExD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,8BAA8B,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare function parseKeys(input: string): string[];
2
+ export interface InteractResult {
3
+ output: string;
4
+ success: boolean;
5
+ }
6
+ export declare const shellInteractTool: import("ai").Tool<{
7
+ keystrokes: string;
8
+ timeout_ms?: number | undefined;
9
+ }, InteractResult>;
10
+ //# sourceMappingURL=shell-interact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-interact.d.ts","sourceRoot":"","sources":["../../../src/tools/execute/shell-interact.ts"],"names":[],"mappings":"AA0DA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA0CjD;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAoBD,eAAO,MAAM,iBAAiB;;;kBAyB5B,CAAC"}
@@ -0,0 +1,122 @@
1
+ import { tool } from "ai";
2
+ import { z } from "zod";
3
+ import SHELL_INTERACT_DESCRIPTION from "./shell-interact.txt";
4
+ const SPECIAL_KEYS = {
5
+ enter: "Enter",
6
+ tab: "Tab",
7
+ escape: "Escape",
8
+ esc: "Escape",
9
+ backspace: "BSpace",
10
+ delete: "DC",
11
+ del: "DC",
12
+ up: "Up",
13
+ down: "Down",
14
+ left: "Left",
15
+ right: "Right",
16
+ home: "Home",
17
+ end: "End",
18
+ pageup: "PPage",
19
+ pagedown: "NPage",
20
+ space: "Space",
21
+ "ctrl+c": "C-c",
22
+ "ctrl+d": "C-d",
23
+ "ctrl+z": "C-z",
24
+ "ctrl+l": "C-l",
25
+ "ctrl+a": "C-a",
26
+ "ctrl+e": "C-e",
27
+ "ctrl+k": "C-k",
28
+ "ctrl+u": "C-u",
29
+ "ctrl+w": "C-w",
30
+ "ctrl+r": "C-r",
31
+ };
32
+ const HTML_TOKEN_START = "&lt;";
33
+ const HTML_TOKEN_END = "&gt;";
34
+ const HTML_AMP_PATTERN = /&amp;/gi;
35
+ const CTRL_DASH_SHORTCUT_PATTERN = /^c-[a-z]$/;
36
+ const CTRL_DASH_PATTERN = /^ctrl-[a-z]$/;
37
+ function normalizeSpecialToken(token) {
38
+ const compact = token.toLowerCase().replace(/\s+/g, "");
39
+ if (CTRL_DASH_SHORTCUT_PATTERN.test(compact)) {
40
+ return `ctrl+${compact[2]}`;
41
+ }
42
+ if (CTRL_DASH_PATTERN.test(compact)) {
43
+ return `ctrl+${compact[5]}`;
44
+ }
45
+ return compact;
46
+ }
47
+ function mapSpecialToken(token) {
48
+ const normalizedToken = normalizeSpecialToken(token);
49
+ return SPECIAL_KEYS[normalizedToken];
50
+ }
51
+ export function parseKeys(input) {
52
+ const keys = [];
53
+ let i = 0;
54
+ while (i < input.length) {
55
+ const current = input[i];
56
+ if (current === "<") {
57
+ const closingIndex = input.indexOf(">", i + 1);
58
+ if (closingIndex !== -1) {
59
+ const token = input.slice(i + 1, closingIndex);
60
+ const mappedKey = mapSpecialToken(token);
61
+ if (mappedKey) {
62
+ keys.push(mappedKey);
63
+ i = closingIndex + 1;
64
+ continue;
65
+ }
66
+ }
67
+ }
68
+ if (input.startsWith(HTML_TOKEN_START, i)) {
69
+ const tokenStart = i + HTML_TOKEN_START.length;
70
+ const encodedClosingIndex = input.indexOf(HTML_TOKEN_END, tokenStart);
71
+ if (encodedClosingIndex !== -1) {
72
+ const encodedToken = input.slice(tokenStart, encodedClosingIndex);
73
+ const token = encodedToken.replace(HTML_AMP_PATTERN, "&");
74
+ const mappedKey = mapSpecialToken(token);
75
+ if (mappedKey) {
76
+ keys.push(mappedKey);
77
+ i = encodedClosingIndex + HTML_TOKEN_END.length;
78
+ continue;
79
+ }
80
+ }
81
+ }
82
+ keys.push(current);
83
+ i++;
84
+ }
85
+ return keys;
86
+ }
87
+ const DEFAULT_SHELL_EXECUTE_TIMEOUT_SEC = 120;
88
+ const CTRL_C_GUIDANCE = [
89
+ "No retained terminal context exists. Each shell_execute command runs independently.",
90
+ `To interrupt a long-running command, wait for its timeout (default: ${DEFAULT_SHELL_EXECUTE_TIMEOUT_SEC}s) or use shell_execute to kill the process by PID:`,
91
+ ' shell_execute({ command: "kill -SIGINT <PID>" })',
92
+ ].join("\n");
93
+ const GENERIC_GUIDANCE = [
94
+ "No retained terminal context exists. Each shell_execute command runs independently.",
95
+ "To run a command, use shell_execute directly:",
96
+ ' shell_execute({ command: "your command here" })',
97
+ ].join("\n");
98
+ function hasCtrlC(parsedKeys) {
99
+ return parsedKeys.includes("C-c");
100
+ }
101
+ export const shellInteractTool = tool({
102
+ description: SHELL_INTERACT_DESCRIPTION,
103
+ inputSchema: z.object({
104
+ keystrokes: z
105
+ .string()
106
+ .describe("Keystrokes to send. Use <SpecialKey> syntax. " +
107
+ "Examples: 'y<Enter>', '<Ctrl+C>', 'ls<Enter>'"),
108
+ timeout_ms: z
109
+ .number()
110
+ .optional()
111
+ .describe("Wait time after sending keys (default: 500)"),
112
+ }),
113
+ execute: ({ keystrokes }) => {
114
+ const parsedKeys = parseKeys(keystrokes);
115
+ const guidance = hasCtrlC(parsedKeys) ? CTRL_C_GUIDANCE : GENERIC_GUIDANCE;
116
+ return Promise.resolve({
117
+ success: true,
118
+ output: guidance,
119
+ });
120
+ },
121
+ });
122
+ //# sourceMappingURL=shell-interact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-interact.js","sourceRoot":"","sources":["../../../src/tools/execute/shell-interact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAA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AAC;IAEF,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,EAA2B,EAAE;QACnD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;QACzC,MAAM,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,CAAC;QAE3E,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=shell-interact.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-interact.test.d.ts","sourceRoot":"","sources":["../../../src/tools/execute/shell-interact.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,175 @@
1
+ import { describe, expect, it } from "bun:test";
2
+ import { parseKeys, shellInteractTool, } from "./shell-interact";
3
+ async function interact(keystrokes, timeout_ms = 200) {
4
+ const execute = shellInteractTool.execute;
5
+ if (!execute) {
6
+ throw new Error("shellInteractTool.execute is undefined");
7
+ }
8
+ const result = await execute({ keystrokes, timeout_ms }, {
9
+ toolCallId: `test-${Date.now()}`,
10
+ messages: [],
11
+ abortSignal: new AbortController().signal,
12
+ });
13
+ if (Symbol.asyncIterator in result) {
14
+ throw new Error("Unexpected async iterable result");
15
+ }
16
+ return result;
17
+ }
18
+ describe("shellInteractTool", () => {
19
+ describe("result shape", () => {
20
+ it("returns { success: true, output: string }", async () => {
21
+ const result = await interact("echo test");
22
+ expect(result.success).toBe(true);
23
+ expect(typeof result.output).toBe("string");
24
+ expect(result.output.length).toBeGreaterThan(0);
25
+ });
26
+ it("always succeeds regardless of keystrokes", async () => {
27
+ const result = await interact("anything at all");
28
+ expect(result.success).toBe(true);
29
+ });
30
+ });
31
+ describe("Ctrl+C guidance", () => {
32
+ it("returns Ctrl+C guidance for <Ctrl+C>", async () => {
33
+ const result = await interact("<Ctrl+C>");
34
+ expect(result.success).toBe(true);
35
+ expect(result.output).toContain("No retained terminal context exists");
36
+ expect(result.output).toContain("kill -SIGINT");
37
+ });
38
+ it("returns Ctrl+C guidance for <CTRL+C> (uppercase)", async () => {
39
+ const result = await interact("<CTRL+C>");
40
+ expect(result.success).toBe(true);
41
+ expect(result.output).toContain("kill -SIGINT");
42
+ });
43
+ it("returns Ctrl+C guidance for <C-c> (dash syntax)", async () => {
44
+ const result = await interact("<C-c>");
45
+ expect(result.success).toBe(true);
46
+ expect(result.output).toContain("kill -SIGINT");
47
+ });
48
+ it("returns Ctrl+C guidance for html-encoded &lt;Ctrl+C&gt;", async () => {
49
+ const result = await interact("&lt;Ctrl+C&gt;");
50
+ expect(result.success).toBe(true);
51
+ expect(result.output).toContain("kill -SIGINT");
52
+ });
53
+ it("Ctrl+C guidance mentions timeout", async () => {
54
+ const result = await interact("<Ctrl+C>");
55
+ expect(result.output).toContain("120s");
56
+ });
57
+ });
58
+ describe("generic guidance for other keystrokes", () => {
59
+ it("returns generic guidance for plain text", async () => {
60
+ const result = await interact("ls -la");
61
+ expect(result.success).toBe(true);
62
+ expect(result.output).toContain("No retained terminal context exists");
63
+ expect(result.output).toContain("shell_execute");
64
+ expect(result.output).not.toContain("kill -SIGINT");
65
+ });
66
+ it("returns generic guidance for Enter key", async () => {
67
+ const result = await interact("echo hello<Enter>");
68
+ expect(result.success).toBe(true);
69
+ expect(result.output).toContain("shell_execute");
70
+ expect(result.output).not.toContain("kill -SIGINT");
71
+ });
72
+ it("returns generic guidance for Ctrl+D", async () => {
73
+ const result = await interact("<Ctrl+D>");
74
+ expect(result.success).toBe(true);
75
+ expect(result.output).not.toContain("kill -SIGINT");
76
+ });
77
+ it("returns generic guidance for empty keystrokes", async () => {
78
+ const result = await interact("");
79
+ expect(result.success).toBe(true);
80
+ expect(result.output).toContain("shell_execute");
81
+ });
82
+ it("explains no retained terminal context exists", async () => {
83
+ const result = await interact("any command");
84
+ expect(result.output).toContain("No retained terminal context exists. Each shell_execute command runs independently.");
85
+ });
86
+ });
87
+ describe("tool metadata", () => {
88
+ it("has description mentioning shell_execute", () => {
89
+ expect(shellInteractTool.description).toContain("shell_execute");
90
+ });
91
+ it("accepts keystrokes in inputSchema", () => {
92
+ expect(shellInteractTool.inputSchema).toBeDefined();
93
+ });
94
+ });
95
+ describe("parseKeys utility", () => {
96
+ it("parses plain text as individual characters", () => {
97
+ const result = parseKeys("abc");
98
+ expect(result).toEqual(["a", "b", "c"]);
99
+ });
100
+ it("parses <Enter> to Enter", () => {
101
+ const result = parseKeys("<Enter>");
102
+ expect(result).toEqual(["Enter"]);
103
+ });
104
+ it("parses <Ctrl+C> to C-c", () => {
105
+ const result = parseKeys("<Ctrl+C>");
106
+ expect(result).toEqual(["C-c"]);
107
+ });
108
+ it("parses <Tab> to Tab", () => {
109
+ const result = parseKeys("<Tab>");
110
+ expect(result).toEqual(["Tab"]);
111
+ });
112
+ it("parses <Escape> and <ESC>", () => {
113
+ expect(parseKeys("<Escape>")).toEqual(["Escape"]);
114
+ expect(parseKeys("<ESC>")).toEqual(["Escape"]);
115
+ });
116
+ it("parses <Up> <Down> <Left> <Right>", () => {
117
+ expect(parseKeys("<Up>")).toEqual(["Up"]);
118
+ expect(parseKeys("<Down>")).toEqual(["Down"]);
119
+ expect(parseKeys("<Left>")).toEqual(["Left"]);
120
+ expect(parseKeys("<Right>")).toEqual(["Right"]);
121
+ });
122
+ it("parses <Home> and <End>", () => {
123
+ expect(parseKeys("<Home>")).toEqual(["Home"]);
124
+ expect(parseKeys("<End>")).toEqual(["End"]);
125
+ });
126
+ it("parses <Backspace> and <Delete>", () => {
127
+ expect(parseKeys("<Backspace>")).toEqual(["BSpace"]);
128
+ expect(parseKeys("<Delete>")).toEqual(["DC"]);
129
+ });
130
+ it("parses <Space>", () => {
131
+ expect(parseKeys("<Space>")).toEqual(["Space"]);
132
+ });
133
+ it("parses mixed text and special keys", () => {
134
+ const result = parseKeys("echo<Space>hello<Enter>");
135
+ expect(result).toEqual([
136
+ "e",
137
+ "c",
138
+ "h",
139
+ "o",
140
+ "Space",
141
+ "h",
142
+ "e",
143
+ "l",
144
+ "l",
145
+ "o",
146
+ "Enter",
147
+ ]);
148
+ });
149
+ it("parses <C-c> dash syntax to C-c", () => {
150
+ const result = parseKeys("<C-c>");
151
+ expect(result).toEqual(["C-c"]);
152
+ });
153
+ it("parses <ctrl-c> dash syntax to C-c", () => {
154
+ const result = parseKeys("<ctrl-c>");
155
+ expect(result).toEqual(["C-c"]);
156
+ });
157
+ it("handles html-encoded &lt;Ctrl+C&gt;", () => {
158
+ const result = parseKeys("&lt;Ctrl+C&gt;");
159
+ expect(result).toEqual(["C-c"]);
160
+ });
161
+ it("preserves HTML entities in plain text (non-special)", () => {
162
+ const parsed = parseKeys("echo '&lt;entity-preserve-tag&gt; &amp; preserve-amp'");
163
+ expect(parsed.join("")).toBe("echo '&lt;entity-preserve-tag&gt; &amp; preserve-amp'");
164
+ });
165
+ it("treats unknown <token> as literal characters", () => {
166
+ const result = parseKeys("<unknown>");
167
+ expect(result.join("")).toBe("<unknown>");
168
+ });
169
+ it("parses <PageUp> and <PageDown>", () => {
170
+ expect(parseKeys("<PageUp>")).toEqual(["PPage"]);
171
+ expect(parseKeys("<PageDown>")).toEqual(["NPage"]);
172
+ });
173
+ });
174
+ });
175
+ //# sourceMappingURL=shell-interact.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-interact.test.js","sourceRoot":"","sources":["../../../src/tools/execute/shell-interact.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAEL,SAAS,EACT,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,KAAK,UAAU,QAAQ,CACrB,UAAkB,EAClB,UAAU,GAAG,GAAG;IAEhB,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC;IAC1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AO,CAAC,CAAC,CAAC;YACjD,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ declare const inputSchema: z.ZodObject<{
3
+ pattern: z.ZodString;
4
+ path: z.ZodOptional<z.ZodString>;
5
+ respect_git_ignore: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
6
+ }, z.core.$strip>;
7
+ export type GlobInput = z.input<typeof inputSchema>;
8
+ export declare function executeGlob({ pattern, path, respect_git_ignore, }: GlobInput): Promise<string>;
9
+ export declare const globTool: import("ai").Tool<{
10
+ pattern: string;
11
+ respect_git_ignore: boolean;
12
+ path?: string | undefined;
13
+ }, string>;
14
+ export {};
15
+ //# sourceMappingURL=glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../src/tools/explore/glob.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2BxB,QAAA,MAAM,WAAW;;;;iBAaf,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD,wBAAsB,WAAW,CAAC,EAChC,OAAO,EACP,IAAI,EACJ,kBAAyB,GAC1B,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CA+E7B;AAED,eAAO,MAAM,QAAQ;;;;UAInB,CAAC"}
@@ -0,0 +1,107 @@
1
+ import { stat } from "node:fs/promises";
2
+ import { join, resolve } from "node:path";
3
+ import { tool } from "ai";
4
+ import { z } from "zod";
5
+ import { formatBlock, getIgnoreFilter } from "../utils/safety-utils";
6
+ import GLOB_FILES_DESCRIPTION from "./glob-files.txt";
7
+ const MAX_RESULTS = 500;
8
+ const STAT_CONCURRENCY = 32;
9
+ function insertTopByMtime(list, item) {
10
+ let insertAt = list.length;
11
+ for (let i = 0; i < list.length; i++) {
12
+ if (item.mtime.getTime() > list[i].mtime.getTime()) {
13
+ insertAt = i;
14
+ break;
15
+ }
16
+ }
17
+ list.splice(insertAt, 0, item);
18
+ if (list.length > MAX_RESULTS) {
19
+ list.pop();
20
+ }
21
+ }
22
+ const inputSchema = z.object({
23
+ pattern: z.string().describe("Glob pattern (e.g., '**/*.py', 'docs/*.md')"),
24
+ path: z
25
+ .string()
26
+ .optional()
27
+ .describe("Directory to search (default: current directory)"),
28
+ respect_git_ignore: z
29
+ .boolean()
30
+ .optional()
31
+ .default(true)
32
+ .describe("Respect ignore rules from .gitignore/.ignore/.fdignore (default: true)"),
33
+ });
34
+ export async function executeGlob({ pattern, path, respect_git_ignore = true, }) {
35
+ const searchDir = path ? resolve(path) : process.cwd();
36
+ const glob = new Bun.Glob(pattern);
37
+ const topFilesByMtime = [];
38
+ let totalMatches = 0;
39
+ let skippedUnreadable = 0;
40
+ const ignoreFilter = respect_git_ignore
41
+ ? await getIgnoreFilter(searchDir)
42
+ : null;
43
+ const pending = new Set();
44
+ const enqueueStat = (absolutePath) => {
45
+ const task = stat(absolutePath)
46
+ .then((stats) => {
47
+ totalMatches += 1;
48
+ insertTopByMtime(topFilesByMtime, {
49
+ path: absolutePath,
50
+ mtime: stats.mtime,
51
+ });
52
+ })
53
+ .catch(() => {
54
+ skippedUnreadable += 1;
55
+ })
56
+ .finally(() => {
57
+ pending.delete(task);
58
+ });
59
+ pending.add(task);
60
+ };
61
+ for await (const file of glob.scan({
62
+ cwd: searchDir,
63
+ absolute: false,
64
+ onlyFiles: true,
65
+ })) {
66
+ if (ignoreFilter?.ignores(file)) {
67
+ continue;
68
+ }
69
+ const absolutePath = join(searchDir, file);
70
+ enqueueStat(absolutePath);
71
+ if (pending.size >= STAT_CONCURRENCY) {
72
+ await Promise.race(pending);
73
+ }
74
+ }
75
+ await Promise.all(pending);
76
+ const truncated = totalMatches > MAX_RESULTS;
77
+ const displayFiles = topFilesByMtime;
78
+ const output = [
79
+ totalMatches > 0 ? "OK - glob" : "OK - glob (no matches)",
80
+ `pattern: "${pattern}"`,
81
+ `path: ${path ?? "."}`,
82
+ `respect_git_ignore: ${respect_git_ignore}`,
83
+ `file_count: ${totalMatches}`,
84
+ `truncated: ${truncated}`,
85
+ `skipped_unreadable: ${skippedUnreadable}`,
86
+ "sorted_by: mtime desc",
87
+ "",
88
+ ];
89
+ if (displayFiles.length > 0) {
90
+ const body = displayFiles
91
+ .map((f) => {
92
+ return f.path;
93
+ })
94
+ .join("\n");
95
+ output.push(formatBlock("glob results", body));
96
+ }
97
+ else {
98
+ output.push(formatBlock("glob results", "(no matches)"));
99
+ }
100
+ return output.join("\n");
101
+ }
102
+ export const globTool = tool({
103
+ description: GLOB_FILES_DESCRIPTION,
104
+ inputSchema,
105
+ execute: executeGlob,
106
+ });
107
+ //# sourceMappingURL=glob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../src/tools/explore/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,sBAAsB,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAO5B,SAAS,gBAAgB,CAAC,IAAqB,EAAE,IAAmB;IAClE,IAAI,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE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Y,GAAG,WAAW,CAAC;IAC7C,MAAM,YAAY,GAAG,eAAe,CAAC;IAErC,MAAM,MAAM,GAAG;QACb,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,wBAAwB;QACzD,aAAa,OAAO,GAAG;QACvB,SAAS,IAAI,IAAI,GAAG,EAAE;QACtB,uBAAuB,kBAAkB,EAAE;QAC3C,eAAe,YAAY,EAAE;QAC7B,cAAc,SAAS,EAAE;QACzB,uBAAuB,iBAAiB,EAAE;QAC1C,uBAAuB;QACvB,EAAE;KACH,CAAC;IAEF,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,YAAY;aACtB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACT,OAAO,CAAC,CAAC,IAAI,CAAC;QAChB,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC;IACjD,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,sBAAsB;IACnC,WAAW;IACX,OAAO,EAAE,WAAW;CACrB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=glob.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.test.d.ts","sourceRoot":"","sources":["../../../src/tools/explore/glob.test.ts"],"names":[],"mappings":""}