orquesta-cli 0.1.12

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 (851) hide show
  1. package/.eslintrc.json +26 -0
  2. package/.prettierrc.json +10 -0
  3. package/CLAUDE.md +199 -0
  4. package/LICENSE +21 -0
  5. package/README.md +280 -0
  6. package/SECURITY.md +290 -0
  7. package/TEST_LOCAL.md +245 -0
  8. package/dist/agents/base/base-agent.d.ts +38 -0
  9. package/dist/agents/base/base-agent.d.ts.map +1 -0
  10. package/dist/agents/base/base-agent.js +69 -0
  11. package/dist/agents/base/base-agent.js.map +1 -0
  12. package/dist/agents/docs-search/index.d.ts +33 -0
  13. package/dist/agents/docs-search/index.d.ts.map +1 -0
  14. package/dist/agents/docs-search/index.js +244 -0
  15. package/dist/agents/docs-search/index.js.map +1 -0
  16. package/dist/agents/index.d.ts +4 -0
  17. package/dist/agents/index.d.ts.map +1 -0
  18. package/dist/agents/index.js +4 -0
  19. package/dist/agents/index.js.map +1 -0
  20. package/dist/agents/planner/index.d.ts +17 -0
  21. package/dist/agents/planner/index.d.ts.map +1 -0
  22. package/dist/agents/planner/index.js +250 -0
  23. package/dist/agents/planner/index.js.map +1 -0
  24. package/dist/cli.d.ts +3 -0
  25. package/dist/cli.d.ts.map +1 -0
  26. package/dist/cli.js +144 -0
  27. package/dist/cli.js.map +1 -0
  28. package/dist/constants.d.ts +8 -0
  29. package/dist/constants.d.ts.map +1 -0
  30. package/dist/constants.js +10 -0
  31. package/dist/constants.js.map +1 -0
  32. package/dist/core/compact/compact-manager.d.ts +22 -0
  33. package/dist/core/compact/compact-manager.d.ts.map +1 -0
  34. package/dist/core/compact/compact-manager.js +75 -0
  35. package/dist/core/compact/compact-manager.js.map +1 -0
  36. package/dist/core/compact/compact-prompts.d.ts +11 -0
  37. package/dist/core/compact/compact-prompts.d.ts.map +1 -0
  38. package/dist/core/compact/compact-prompts.js +90 -0
  39. package/dist/core/compact/compact-prompts.js.map +1 -0
  40. package/dist/core/compact/context-tracker.d.ts +28 -0
  41. package/dist/core/compact/context-tracker.d.ts.map +1 -0
  42. package/dist/core/compact/context-tracker.js +71 -0
  43. package/dist/core/compact/context-tracker.js.map +1 -0
  44. package/dist/core/compact/index.d.ts +4 -0
  45. package/dist/core/compact/index.d.ts.map +1 -0
  46. package/dist/core/compact/index.js +4 -0
  47. package/dist/core/compact/index.js.map +1 -0
  48. package/dist/core/config/config-manager.d.ts +44 -0
  49. package/dist/core/config/config-manager.d.ts.map +1 -0
  50. package/dist/core/config/config-manager.js +259 -0
  51. package/dist/core/config/config-manager.js.map +1 -0
  52. package/dist/core/config/index.d.ts +2 -0
  53. package/dist/core/config/index.d.ts.map +1 -0
  54. package/dist/core/config/index.js +2 -0
  55. package/dist/core/config/index.js.map +1 -0
  56. package/dist/core/docs-manager.d.ts +46 -0
  57. package/dist/core/docs-manager.d.ts.map +1 -0
  58. package/dist/core/docs-manager.js +475 -0
  59. package/dist/core/docs-manager.js.map +1 -0
  60. package/dist/core/git-auto-updater.d.ts +58 -0
  61. package/dist/core/git-auto-updater.d.ts.map +1 -0
  62. package/dist/core/git-auto-updater.js +374 -0
  63. package/dist/core/git-auto-updater.js.map +1 -0
  64. package/dist/core/llm/index.d.ts +2 -0
  65. package/dist/core/llm/index.d.ts.map +1 -0
  66. package/dist/core/llm/index.js +2 -0
  67. package/dist/core/llm/index.js.map +1 -0
  68. package/dist/core/llm/llm-client.d.ts +97 -0
  69. package/dist/core/llm/llm-client.d.ts.map +1 -0
  70. package/dist/core/llm/llm-client.js +1000 -0
  71. package/dist/core/llm/llm-client.js.map +1 -0
  72. package/dist/core/session/index.d.ts +2 -0
  73. package/dist/core/session/index.d.ts.map +1 -0
  74. package/dist/core/session/index.js +2 -0
  75. package/dist/core/session/index.js.map +1 -0
  76. package/dist/core/session/session-manager.d.ts +71 -0
  77. package/dist/core/session/session-manager.d.ts.map +1 -0
  78. package/dist/core/session/session-manager.js +250 -0
  79. package/dist/core/session/session-manager.js.map +1 -0
  80. package/dist/core/slash-command-handler.d.ts +31 -0
  81. package/dist/core/slash-command-handler.d.ts.map +1 -0
  82. package/dist/core/slash-command-handler.js +302 -0
  83. package/dist/core/slash-command-handler.js.map +1 -0
  84. package/dist/core/usage-tracker.d.ts +70 -0
  85. package/dist/core/usage-tracker.d.ts.map +1 -0
  86. package/dist/core/usage-tracker.js +251 -0
  87. package/dist/core/usage-tracker.js.map +1 -0
  88. package/dist/errors/base.d.ts +22 -0
  89. package/dist/errors/base.d.ts.map +1 -0
  90. package/dist/errors/base.js +43 -0
  91. package/dist/errors/base.js.map +1 -0
  92. package/dist/errors/file.d.ts +31 -0
  93. package/dist/errors/file.d.ts.map +1 -0
  94. package/dist/errors/file.js +110 -0
  95. package/dist/errors/file.js.map +1 -0
  96. package/dist/errors/index.d.ts +10 -0
  97. package/dist/errors/index.d.ts.map +1 -0
  98. package/dist/errors/index.js +41 -0
  99. package/dist/errors/index.js.map +1 -0
  100. package/dist/errors/llm.d.ts +26 -0
  101. package/dist/errors/llm.d.ts.map +1 -0
  102. package/dist/errors/llm.js +86 -0
  103. package/dist/errors/llm.js.map +1 -0
  104. package/dist/errors/network.d.ts +19 -0
  105. package/dist/errors/network.d.ts.map +1 -0
  106. package/dist/errors/network.js +82 -0
  107. package/dist/errors/network.js.map +1 -0
  108. package/dist/errors/validation.d.ts +19 -0
  109. package/dist/errors/validation.d.ts.map +1 -0
  110. package/dist/errors/validation.js +62 -0
  111. package/dist/errors/validation.js.map +1 -0
  112. package/dist/eval/eval-runner.d.ts +24 -0
  113. package/dist/eval/eval-runner.d.ts.map +1 -0
  114. package/dist/eval/eval-runner.js +309 -0
  115. package/dist/eval/eval-runner.js.map +1 -0
  116. package/dist/eval/index.d.ts +3 -0
  117. package/dist/eval/index.d.ts.map +1 -0
  118. package/dist/eval/index.js +3 -0
  119. package/dist/eval/index.js.map +1 -0
  120. package/dist/eval/types.d.ts +77 -0
  121. package/dist/eval/types.d.ts.map +1 -0
  122. package/dist/eval/types.js +2 -0
  123. package/dist/eval/types.js.map +1 -0
  124. package/dist/index.d.ts +4 -0
  125. package/dist/index.d.ts.map +1 -0
  126. package/dist/index.js +6 -0
  127. package/dist/index.js.map +1 -0
  128. package/dist/orchestration/index.d.ts +4 -0
  129. package/dist/orchestration/index.d.ts.map +1 -0
  130. package/dist/orchestration/index.js +3 -0
  131. package/dist/orchestration/index.js.map +1 -0
  132. package/dist/orchestration/plan-executor.d.ts +28 -0
  133. package/dist/orchestration/plan-executor.d.ts.map +1 -0
  134. package/dist/orchestration/plan-executor.js +382 -0
  135. package/dist/orchestration/plan-executor.js.map +1 -0
  136. package/dist/orchestration/types.d.ts +66 -0
  137. package/dist/orchestration/types.d.ts.map +1 -0
  138. package/dist/orchestration/types.js +2 -0
  139. package/dist/orchestration/types.js.map +1 -0
  140. package/dist/orchestration/utils.d.ts +13 -0
  141. package/dist/orchestration/utils.d.ts.map +1 -0
  142. package/dist/orchestration/utils.js +78 -0
  143. package/dist/orchestration/utils.js.map +1 -0
  144. package/dist/orquesta/connection.d.ts +35 -0
  145. package/dist/orquesta/connection.d.ts.map +1 -0
  146. package/dist/orquesta/connection.js +189 -0
  147. package/dist/orquesta/connection.js.map +1 -0
  148. package/dist/prompts/agents/docs-search-decision.d.ts +6 -0
  149. package/dist/prompts/agents/docs-search-decision.d.ts.map +1 -0
  150. package/dist/prompts/agents/docs-search-decision.js +46 -0
  151. package/dist/prompts/agents/docs-search-decision.js.map +1 -0
  152. package/dist/prompts/agents/docs-search.d.ts +4 -0
  153. package/dist/prompts/agents/docs-search.d.ts.map +1 -0
  154. package/dist/prompts/agents/docs-search.js +70 -0
  155. package/dist/prompts/agents/docs-search.js.map +1 -0
  156. package/dist/prompts/agents/planning.d.ts +4 -0
  157. package/dist/prompts/agents/planning.d.ts.map +1 -0
  158. package/dist/prompts/agents/planning.js +119 -0
  159. package/dist/prompts/agents/planning.js.map +1 -0
  160. package/dist/prompts/index.d.ts +10 -0
  161. package/dist/prompts/index.d.ts.map +1 -0
  162. package/dist/prompts/index.js +10 -0
  163. package/dist/prompts/index.js.map +1 -0
  164. package/dist/prompts/shared/codebase-rules.d.ts +4 -0
  165. package/dist/prompts/shared/codebase-rules.d.ts.map +1 -0
  166. package/dist/prompts/shared/codebase-rules.js +16 -0
  167. package/dist/prompts/shared/codebase-rules.js.map +1 -0
  168. package/dist/prompts/shared/git-rules.d.ts +2 -0
  169. package/dist/prompts/shared/git-rules.d.ts.map +1 -0
  170. package/dist/prompts/shared/git-rules.js +87 -0
  171. package/dist/prompts/shared/git-rules.js.map +1 -0
  172. package/dist/prompts/shared/language-rules.d.ts +4 -0
  173. package/dist/prompts/shared/language-rules.d.ts.map +1 -0
  174. package/dist/prompts/shared/language-rules.js +22 -0
  175. package/dist/prompts/shared/language-rules.js.map +1 -0
  176. package/dist/prompts/shared/tool-usage.d.ts +12 -0
  177. package/dist/prompts/shared/tool-usage.d.ts.map +1 -0
  178. package/dist/prompts/shared/tool-usage.js +51 -0
  179. package/dist/prompts/shared/tool-usage.js.map +1 -0
  180. package/dist/prompts/system/compact.d.ts +3 -0
  181. package/dist/prompts/system/compact.d.ts.map +1 -0
  182. package/dist/prompts/system/compact.js +73 -0
  183. package/dist/prompts/system/compact.js.map +1 -0
  184. package/dist/prompts/system/plan-execute.d.ts +3 -0
  185. package/dist/prompts/system/plan-execute.d.ts.map +1 -0
  186. package/dist/prompts/system/plan-execute.js +83 -0
  187. package/dist/prompts/system/plan-execute.js.map +1 -0
  188. package/dist/tools/browser/browser-client.d.ts +107 -0
  189. package/dist/tools/browser/browser-client.d.ts.map +1 -0
  190. package/dist/tools/browser/browser-client.js +958 -0
  191. package/dist/tools/browser/browser-client.js.map +1 -0
  192. package/dist/tools/browser/browser-tools.d.ts +17 -0
  193. package/dist/tools/browser/browser-tools.d.ts.map +1 -0
  194. package/dist/tools/browser/browser-tools.js +972 -0
  195. package/dist/tools/browser/browser-tools.js.map +1 -0
  196. package/dist/tools/browser/index.d.ts +7 -0
  197. package/dist/tools/browser/index.d.ts.map +1 -0
  198. package/dist/tools/browser/index.js +17 -0
  199. package/dist/tools/browser/index.js.map +1 -0
  200. package/dist/tools/index.d.ts +4 -0
  201. package/dist/tools/index.d.ts.map +1 -0
  202. package/dist/tools/index.js +4 -0
  203. package/dist/tools/index.js.map +1 -0
  204. package/dist/tools/llm/agents/docs-search-tools.d.ts +17 -0
  205. package/dist/tools/llm/agents/docs-search-tools.d.ts.map +1 -0
  206. package/dist/tools/llm/agents/docs-search-tools.js +265 -0
  207. package/dist/tools/llm/agents/docs-search-tools.js.map +1 -0
  208. package/dist/tools/llm/agents/index.d.ts +4 -0
  209. package/dist/tools/llm/agents/index.d.ts.map +1 -0
  210. package/dist/tools/llm/agents/index.js +3 -0
  211. package/dist/tools/llm/agents/index.js.map +1 -0
  212. package/dist/tools/llm/index.d.ts +3 -0
  213. package/dist/tools/llm/index.d.ts.map +1 -0
  214. package/dist/tools/llm/index.js +3 -0
  215. package/dist/tools/llm/index.js.map +1 -0
  216. package/dist/tools/llm/simple/ask-user-tool.d.ts +5 -0
  217. package/dist/tools/llm/simple/ask-user-tool.d.ts.map +1 -0
  218. package/dist/tools/llm/simple/ask-user-tool.js +7 -0
  219. package/dist/tools/llm/simple/ask-user-tool.js.map +1 -0
  220. package/dist/tools/llm/simple/background-bash-tool.d.ts +30 -0
  221. package/dist/tools/llm/simple/background-bash-tool.d.ts.map +1 -0
  222. package/dist/tools/llm/simple/background-bash-tool.js +323 -0
  223. package/dist/tools/llm/simple/background-bash-tool.js.map +1 -0
  224. package/dist/tools/llm/simple/background-powershell-tool.d.ts +30 -0
  225. package/dist/tools/llm/simple/background-powershell-tool.d.ts.map +1 -0
  226. package/dist/tools/llm/simple/background-powershell-tool.js +305 -0
  227. package/dist/tools/llm/simple/background-powershell-tool.js.map +1 -0
  228. package/dist/tools/llm/simple/bash-tool.d.ts +4 -0
  229. package/dist/tools/llm/simple/bash-tool.d.ts.map +1 -0
  230. package/dist/tools/llm/simple/bash-tool.js +178 -0
  231. package/dist/tools/llm/simple/bash-tool.js.map +1 -0
  232. package/dist/tools/llm/simple/docs-search-agent-tool.d.ts +6 -0
  233. package/dist/tools/llm/simple/docs-search-agent-tool.d.ts.map +1 -0
  234. package/dist/tools/llm/simple/docs-search-agent-tool.js +104 -0
  235. package/dist/tools/llm/simple/docs-search-agent-tool.js.map +1 -0
  236. package/dist/tools/llm/simple/file-tools.d.ts +13 -0
  237. package/dist/tools/llm/simple/file-tools.d.ts.map +1 -0
  238. package/dist/tools/llm/simple/file-tools.js +785 -0
  239. package/dist/tools/llm/simple/file-tools.js.map +1 -0
  240. package/dist/tools/llm/simple/final-response-tool.d.ts +12 -0
  241. package/dist/tools/llm/simple/final-response-tool.d.ts.map +1 -0
  242. package/dist/tools/llm/simple/final-response-tool.js +107 -0
  243. package/dist/tools/llm/simple/final-response-tool.js.map +1 -0
  244. package/dist/tools/llm/simple/index.d.ts +11 -0
  245. package/dist/tools/llm/simple/index.d.ts.map +1 -0
  246. package/dist/tools/llm/simple/index.js +20 -0
  247. package/dist/tools/llm/simple/index.js.map +1 -0
  248. package/dist/tools/llm/simple/planning-tools.d.ts +5 -0
  249. package/dist/tools/llm/simple/planning-tools.d.ts.map +1 -0
  250. package/dist/tools/llm/simple/planning-tools.js +117 -0
  251. package/dist/tools/llm/simple/planning-tools.js.map +1 -0
  252. package/dist/tools/llm/simple/powershell-tool.d.ts +4 -0
  253. package/dist/tools/llm/simple/powershell-tool.d.ts.map +1 -0
  254. package/dist/tools/llm/simple/powershell-tool.js +178 -0
  255. package/dist/tools/llm/simple/powershell-tool.js.map +1 -0
  256. package/dist/tools/llm/simple/simple-tool-executor.d.ts +38 -0
  257. package/dist/tools/llm/simple/simple-tool-executor.d.ts.map +1 -0
  258. package/dist/tools/llm/simple/simple-tool-executor.js +134 -0
  259. package/dist/tools/llm/simple/simple-tool-executor.js.map +1 -0
  260. package/dist/tools/llm/simple/todo-tools.d.ts +15 -0
  261. package/dist/tools/llm/simple/todo-tools.d.ts.map +1 -0
  262. package/dist/tools/llm/simple/todo-tools.js +145 -0
  263. package/dist/tools/llm/simple/todo-tools.js.map +1 -0
  264. package/dist/tools/llm/simple/user-interaction-tools.d.ts +22 -0
  265. package/dist/tools/llm/simple/user-interaction-tools.d.ts.map +1 -0
  266. package/dist/tools/llm/simple/user-interaction-tools.js +168 -0
  267. package/dist/tools/llm/simple/user-interaction-tools.js.map +1 -0
  268. package/dist/tools/office/common/constants.d.ts +194 -0
  269. package/dist/tools/office/common/constants.d.ts.map +1 -0
  270. package/dist/tools/office/common/constants.js +169 -0
  271. package/dist/tools/office/common/constants.js.map +1 -0
  272. package/dist/tools/office/common/index.d.ts +4 -0
  273. package/dist/tools/office/common/index.d.ts.map +1 -0
  274. package/dist/tools/office/common/index.js +3 -0
  275. package/dist/tools/office/common/index.js.map +1 -0
  276. package/dist/tools/office/common/types.d.ts +82 -0
  277. package/dist/tools/office/common/types.d.ts.map +1 -0
  278. package/dist/tools/office/common/types.js +2 -0
  279. package/dist/tools/office/common/types.js.map +1 -0
  280. package/dist/tools/office/common/utils.d.ts +14 -0
  281. package/dist/tools/office/common/utils.d.ts.map +1 -0
  282. package/dist/tools/office/common/utils.js +58 -0
  283. package/dist/tools/office/common/utils.js.map +1 -0
  284. package/dist/tools/office/excel-client.d.ts +123 -0
  285. package/dist/tools/office/excel-client.d.ts.map +1 -0
  286. package/dist/tools/office/excel-client.js +1037 -0
  287. package/dist/tools/office/excel-client.js.map +1 -0
  288. package/dist/tools/office/excel-tools/cells.d.ts +10 -0
  289. package/dist/tools/office/excel-tools/cells.d.ts.map +1 -0
  290. package/dist/tools/office/excel-tools/cells.js +279 -0
  291. package/dist/tools/office/excel-tools/cells.js.map +1 -0
  292. package/dist/tools/office/excel-tools/charts.d.ts +6 -0
  293. package/dist/tools/office/excel-tools/charts.d.ts.map +1 -0
  294. package/dist/tools/office/excel-tools/charts.js +124 -0
  295. package/dist/tools/office/excel-tools/charts.js.map +1 -0
  296. package/dist/tools/office/excel-tools/comments.d.ts +6 -0
  297. package/dist/tools/office/excel-tools/comments.d.ts.map +1 -0
  298. package/dist/tools/office/excel-tools/comments.js +114 -0
  299. package/dist/tools/office/excel-tools/comments.js.map +1 -0
  300. package/dist/tools/office/excel-tools/data-ops.d.ts +10 -0
  301. package/dist/tools/office/excel-tools/data-ops.d.ts.map +1 -0
  302. package/dist/tools/office/excel-tools/data-ops.js +266 -0
  303. package/dist/tools/office/excel-tools/data-ops.js.map +1 -0
  304. package/dist/tools/office/excel-tools/export.d.ts +5 -0
  305. package/dist/tools/office/excel-tools/export.d.ts.map +1 -0
  306. package/dist/tools/office/excel-tools/export.js +75 -0
  307. package/dist/tools/office/excel-tools/export.js.map +1 -0
  308. package/dist/tools/office/excel-tools/formatting.d.ts +10 -0
  309. package/dist/tools/office/excel-tools/formatting.d.ts.map +1 -0
  310. package/dist/tools/office/excel-tools/formatting.js +276 -0
  311. package/dist/tools/office/excel-tools/formatting.js.map +1 -0
  312. package/dist/tools/office/excel-tools/index.d.ts +16 -0
  313. package/dist/tools/office/excel-tools/index.d.ts.map +1 -0
  314. package/dist/tools/office/excel-tools/index.js +42 -0
  315. package/dist/tools/office/excel-tools/index.js.map +1 -0
  316. package/dist/tools/office/excel-tools/launch.d.ts +10 -0
  317. package/dist/tools/office/excel-tools/launch.d.ts.map +1 -0
  318. package/dist/tools/office/excel-tools/launch.js +248 -0
  319. package/dist/tools/office/excel-tools/launch.js.map +1 -0
  320. package/dist/tools/office/excel-tools/media.d.ts +5 -0
  321. package/dist/tools/office/excel-tools/media.d.ts.map +1 -0
  322. package/dist/tools/office/excel-tools/media.js +84 -0
  323. package/dist/tools/office/excel-tools/media.js.map +1 -0
  324. package/dist/tools/office/excel-tools/named-ranges.d.ts +6 -0
  325. package/dist/tools/office/excel-tools/named-ranges.d.ts.map +1 -0
  326. package/dist/tools/office/excel-tools/named-ranges.js +113 -0
  327. package/dist/tools/office/excel-tools/named-ranges.js.map +1 -0
  328. package/dist/tools/office/excel-tools/protection.d.ts +5 -0
  329. package/dist/tools/office/excel-tools/protection.d.ts.map +1 -0
  330. package/dist/tools/office/excel-tools/protection.js +75 -0
  331. package/dist/tools/office/excel-tools/protection.js.map +1 -0
  332. package/dist/tools/office/excel-tools/rows-columns.d.ts +11 -0
  333. package/dist/tools/office/excel-tools/rows-columns.d.ts.map +1 -0
  334. package/dist/tools/office/excel-tools/rows-columns.js +293 -0
  335. package/dist/tools/office/excel-tools/rows-columns.js.map +1 -0
  336. package/dist/tools/office/excel-tools/sheets.d.ts +8 -0
  337. package/dist/tools/office/excel-tools/sheets.d.ts.map +1 -0
  338. package/dist/tools/office/excel-tools/sheets.js +177 -0
  339. package/dist/tools/office/excel-tools/sheets.js.map +1 -0
  340. package/dist/tools/office/excel-tools/validation.d.ts +7 -0
  341. package/dist/tools/office/excel-tools/validation.d.ts.map +1 -0
  342. package/dist/tools/office/excel-tools/validation.js +175 -0
  343. package/dist/tools/office/excel-tools/validation.js.map +1 -0
  344. package/dist/tools/office/excel-tools.d.ts +3 -0
  345. package/dist/tools/office/excel-tools.d.ts.map +1 -0
  346. package/dist/tools/office/excel-tools.js +3 -0
  347. package/dist/tools/office/excel-tools.js.map +1 -0
  348. package/dist/tools/office/index.d.ts +6 -0
  349. package/dist/tools/office/index.d.ts.map +1 -0
  350. package/dist/tools/office/index.js +9 -0
  351. package/dist/tools/office/index.js.map +1 -0
  352. package/dist/tools/office/office-client-base.d.ts +31 -0
  353. package/dist/tools/office/office-client-base.d.ts.map +1 -0
  354. package/dist/tools/office/office-client-base.js +154 -0
  355. package/dist/tools/office/office-client-base.js.map +1 -0
  356. package/dist/tools/office/office-client.d.ts +196 -0
  357. package/dist/tools/office/office-client.d.ts.map +1 -0
  358. package/dist/tools/office/office-client.js +200 -0
  359. package/dist/tools/office/office-client.js.map +1 -0
  360. package/dist/tools/office/powerpoint-client.d.ts +135 -0
  361. package/dist/tools/office/powerpoint-client.d.ts.map +1 -0
  362. package/dist/tools/office/powerpoint-client.js +1136 -0
  363. package/dist/tools/office/powerpoint-client.js.map +1 -0
  364. package/dist/tools/office/powerpoint-tools/effects.d.ts +9 -0
  365. package/dist/tools/office/powerpoint-tools/effects.d.ts.map +1 -0
  366. package/dist/tools/office/powerpoint-tools/effects.js +246 -0
  367. package/dist/tools/office/powerpoint-tools/effects.js.map +1 -0
  368. package/dist/tools/office/powerpoint-tools/export.d.ts +6 -0
  369. package/dist/tools/office/powerpoint-tools/export.d.ts.map +1 -0
  370. package/dist/tools/office/powerpoint-tools/export.js +108 -0
  371. package/dist/tools/office/powerpoint-tools/export.js.map +1 -0
  372. package/dist/tools/office/powerpoint-tools/index.d.ts +13 -0
  373. package/dist/tools/office/powerpoint-tools/index.d.ts.map +1 -0
  374. package/dist/tools/office/powerpoint-tools/index.js +33 -0
  375. package/dist/tools/office/powerpoint-tools/index.js.map +1 -0
  376. package/dist/tools/office/powerpoint-tools/launch.d.ts +9 -0
  377. package/dist/tools/office/powerpoint-tools/launch.d.ts.map +1 -0
  378. package/dist/tools/office/powerpoint-tools/launch.js +214 -0
  379. package/dist/tools/office/powerpoint-tools/launch.js.map +1 -0
  380. package/dist/tools/office/powerpoint-tools/media.d.ts +8 -0
  381. package/dist/tools/office/powerpoint-tools/media.d.ts.map +1 -0
  382. package/dist/tools/office/powerpoint-tools/media.js +211 -0
  383. package/dist/tools/office/powerpoint-tools/media.js.map +1 -0
  384. package/dist/tools/office/powerpoint-tools/notes.d.ts +8 -0
  385. package/dist/tools/office/powerpoint-tools/notes.d.ts.map +1 -0
  386. package/dist/tools/office/powerpoint-tools/notes.js +171 -0
  387. package/dist/tools/office/powerpoint-tools/notes.js.map +1 -0
  388. package/dist/tools/office/powerpoint-tools/sections.d.ts +6 -0
  389. package/dist/tools/office/powerpoint-tools/sections.d.ts.map +1 -0
  390. package/dist/tools/office/powerpoint-tools/sections.js +104 -0
  391. package/dist/tools/office/powerpoint-tools/sections.js.map +1 -0
  392. package/dist/tools/office/powerpoint-tools/shapes.d.ts +22 -0
  393. package/dist/tools/office/powerpoint-tools/shapes.d.ts.map +1 -0
  394. package/dist/tools/office/powerpoint-tools/shapes.js +681 -0
  395. package/dist/tools/office/powerpoint-tools/shapes.js.map +1 -0
  396. package/dist/tools/office/powerpoint-tools/slides.d.ts +11 -0
  397. package/dist/tools/office/powerpoint-tools/slides.d.ts.map +1 -0
  398. package/dist/tools/office/powerpoint-tools/slides.js +283 -0
  399. package/dist/tools/office/powerpoint-tools/slides.js.map +1 -0
  400. package/dist/tools/office/powerpoint-tools/tables.d.ts +6 -0
  401. package/dist/tools/office/powerpoint-tools/tables.d.ts.map +1 -0
  402. package/dist/tools/office/powerpoint-tools/tables.js +132 -0
  403. package/dist/tools/office/powerpoint-tools/tables.js.map +1 -0
  404. package/dist/tools/office/powerpoint-tools/text.d.ts +12 -0
  405. package/dist/tools/office/powerpoint-tools/text.d.ts.map +1 -0
  406. package/dist/tools/office/powerpoint-tools/text.js +366 -0
  407. package/dist/tools/office/powerpoint-tools/text.js.map +1 -0
  408. package/dist/tools/office/powerpoint-tools.d.ts +3 -0
  409. package/dist/tools/office/powerpoint-tools.d.ts.map +1 -0
  410. package/dist/tools/office/powerpoint-tools.js +3 -0
  411. package/dist/tools/office/powerpoint-tools.js.map +1 -0
  412. package/dist/tools/office/word-client.d.ts +147 -0
  413. package/dist/tools/office/word-client.d.ts.map +1 -0
  414. package/dist/tools/office/word-client.js +1341 -0
  415. package/dist/tools/office/word-client.js.map +1 -0
  416. package/dist/tools/office/word-tools/bookmarks.d.ts +7 -0
  417. package/dist/tools/office/word-tools/bookmarks.d.ts.map +1 -0
  418. package/dist/tools/office/word-tools/bookmarks.js +146 -0
  419. package/dist/tools/office/word-tools/bookmarks.js.map +1 -0
  420. package/dist/tools/office/word-tools/comments.d.ts +7 -0
  421. package/dist/tools/office/word-tools/comments.d.ts.map +1 -0
  422. package/dist/tools/office/word-tools/comments.js +146 -0
  423. package/dist/tools/office/word-tools/comments.js.map +1 -0
  424. package/dist/tools/office/word-tools/content.d.ts +7 -0
  425. package/dist/tools/office/word-tools/content.d.ts.map +1 -0
  426. package/dist/tools/office/word-tools/content.js +168 -0
  427. package/dist/tools/office/word-tools/content.js.map +1 -0
  428. package/dist/tools/office/word-tools/export.d.ts +5 -0
  429. package/dist/tools/office/word-tools/export.d.ts.map +1 -0
  430. package/dist/tools/office/word-tools/export.js +73 -0
  431. package/dist/tools/office/word-tools/export.js.map +1 -0
  432. package/dist/tools/office/word-tools/formatting.d.ts +6 -0
  433. package/dist/tools/office/word-tools/formatting.d.ts.map +1 -0
  434. package/dist/tools/office/word-tools/formatting.js +129 -0
  435. package/dist/tools/office/word-tools/formatting.js.map +1 -0
  436. package/dist/tools/office/word-tools/headers-footers.d.ts +6 -0
  437. package/dist/tools/office/word-tools/headers-footers.d.ts.map +1 -0
  438. package/dist/tools/office/word-tools/headers-footers.js +117 -0
  439. package/dist/tools/office/word-tools/headers-footers.js.map +1 -0
  440. package/dist/tools/office/word-tools/index.d.ts +16 -0
  441. package/dist/tools/office/word-tools/index.d.ts.map +1 -0
  442. package/dist/tools/office/word-tools/index.js +45 -0
  443. package/dist/tools/office/word-tools/index.js.map +1 -0
  444. package/dist/tools/office/word-tools/launch.d.ts +10 -0
  445. package/dist/tools/office/word-tools/launch.d.ts.map +1 -0
  446. package/dist/tools/office/word-tools/launch.js +255 -0
  447. package/dist/tools/office/word-tools/launch.js.map +1 -0
  448. package/dist/tools/office/word-tools/lists.d.ts +5 -0
  449. package/dist/tools/office/word-tools/lists.d.ts.map +1 -0
  450. package/dist/tools/office/word-tools/lists.js +73 -0
  451. package/dist/tools/office/word-tools/lists.js.map +1 -0
  452. package/dist/tools/office/word-tools/navigation.d.ts +5 -0
  453. package/dist/tools/office/word-tools/navigation.d.ts.map +1 -0
  454. package/dist/tools/office/word-tools/navigation.js +85 -0
  455. package/dist/tools/office/word-tools/navigation.js.map +1 -0
  456. package/dist/tools/office/word-tools/page-setup.d.ts +7 -0
  457. package/dist/tools/office/word-tools/page-setup.d.ts.map +1 -0
  458. package/dist/tools/office/word-tools/page-setup.js +152 -0
  459. package/dist/tools/office/word-tools/page-setup.js.map +1 -0
  460. package/dist/tools/office/word-tools/tables.d.ts +8 -0
  461. package/dist/tools/office/word-tools/tables.d.ts.map +1 -0
  462. package/dist/tools/office/word-tools/tables.js +197 -0
  463. package/dist/tools/office/word-tools/tables.js.map +1 -0
  464. package/dist/tools/office/word-tools/text.d.ts +9 -0
  465. package/dist/tools/office/word-tools/text.d.ts.map +1 -0
  466. package/dist/tools/office/word-tools/text.js +235 -0
  467. package/dist/tools/office/word-tools/text.js.map +1 -0
  468. package/dist/tools/office/word-tools/undo-redo.d.ts +5 -0
  469. package/dist/tools/office/word-tools/undo-redo.d.ts.map +1 -0
  470. package/dist/tools/office/word-tools/undo-redo.js +73 -0
  471. package/dist/tools/office/word-tools/undo-redo.js.map +1 -0
  472. package/dist/tools/office/word-tools/watermarks.d.ts +5 -0
  473. package/dist/tools/office/word-tools/watermarks.d.ts.map +1 -0
  474. package/dist/tools/office/word-tools/watermarks.js +81 -0
  475. package/dist/tools/office/word-tools/watermarks.js.map +1 -0
  476. package/dist/tools/office/word-tools.d.ts +3 -0
  477. package/dist/tools/office/word-tools.d.ts.map +1 -0
  478. package/dist/tools/office/word-tools.js +3 -0
  479. package/dist/tools/office/word-tools.js.map +1 -0
  480. package/dist/tools/registry.d.ts +53 -0
  481. package/dist/tools/registry.d.ts.map +1 -0
  482. package/dist/tools/registry.js +278 -0
  483. package/dist/tools/registry.js.map +1 -0
  484. package/dist/tools/types.d.ts +88 -0
  485. package/dist/tools/types.d.ts.map +1 -0
  486. package/dist/tools/types.js +19 -0
  487. package/dist/tools/types.js.map +1 -0
  488. package/dist/types/index.d.ts +126 -0
  489. package/dist/types/index.d.ts.map +1 -0
  490. package/dist/types/index.js +2 -0
  491. package/dist/types/index.js.map +1 -0
  492. package/dist/ui/PlanExecuteView.d.ts +11 -0
  493. package/dist/ui/PlanExecuteView.d.ts.map +1 -0
  494. package/dist/ui/PlanExecuteView.js +29 -0
  495. package/dist/ui/PlanExecuteView.js.map +1 -0
  496. package/dist/ui/TodoPanel.d.ts +13 -0
  497. package/dist/ui/TodoPanel.d.ts.map +1 -0
  498. package/dist/ui/TodoPanel.js +135 -0
  499. package/dist/ui/TodoPanel.js.map +1 -0
  500. package/dist/ui/UpdateNotification.d.ts +13 -0
  501. package/dist/ui/UpdateNotification.d.ts.map +1 -0
  502. package/dist/ui/UpdateNotification.js +42 -0
  503. package/dist/ui/UpdateNotification.js.map +1 -0
  504. package/dist/ui/components/ActivityIndicator.d.ts +25 -0
  505. package/dist/ui/components/ActivityIndicator.d.ts.map +1 -0
  506. package/dist/ui/components/ActivityIndicator.js +115 -0
  507. package/dist/ui/components/ActivityIndicator.js.map +1 -0
  508. package/dist/ui/components/CommandBrowser.d.ts +10 -0
  509. package/dist/ui/components/CommandBrowser.d.ts.map +1 -0
  510. package/dist/ui/components/CommandBrowser.js +53 -0
  511. package/dist/ui/components/CommandBrowser.js.map +1 -0
  512. package/dist/ui/components/CustomTextInput.d.ts +13 -0
  513. package/dist/ui/components/CustomTextInput.d.ts.map +1 -0
  514. package/dist/ui/components/CustomTextInput.js +245 -0
  515. package/dist/ui/components/CustomTextInput.js.map +1 -0
  516. package/dist/ui/components/DocsSearchProgress.d.ts +13 -0
  517. package/dist/ui/components/DocsSearchProgress.d.ts.map +1 -0
  518. package/dist/ui/components/DocsSearchProgress.js +37 -0
  519. package/dist/ui/components/DocsSearchProgress.js.map +1 -0
  520. package/dist/ui/components/FileBrowser.d.ts +11 -0
  521. package/dist/ui/components/FileBrowser.d.ts.map +1 -0
  522. package/dist/ui/components/FileBrowser.js +45 -0
  523. package/dist/ui/components/FileBrowser.js.map +1 -0
  524. package/dist/ui/components/LLMSetupWizard.d.ts +8 -0
  525. package/dist/ui/components/LLMSetupWizard.d.ts.map +1 -0
  526. package/dist/ui/components/LLMSetupWizard.js +192 -0
  527. package/dist/ui/components/LLMSetupWizard.js.map +1 -0
  528. package/dist/ui/components/Logo.d.ts +19 -0
  529. package/dist/ui/components/Logo.d.ts.map +1 -0
  530. package/dist/ui/components/Logo.js +55 -0
  531. package/dist/ui/components/Logo.js.map +1 -0
  532. package/dist/ui/components/MarkdownRenderer.d.ts +9 -0
  533. package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -0
  534. package/dist/ui/components/MarkdownRenderer.js +198 -0
  535. package/dist/ui/components/MarkdownRenderer.js.map +1 -0
  536. package/dist/ui/components/ModelSelector.d.ts +8 -0
  537. package/dist/ui/components/ModelSelector.d.ts.map +1 -0
  538. package/dist/ui/components/ModelSelector.js +111 -0
  539. package/dist/ui/components/ModelSelector.js.map +1 -0
  540. package/dist/ui/components/PlanExecuteApp.d.ts +23 -0
  541. package/dist/ui/components/PlanExecuteApp.d.ts.map +1 -0
  542. package/dist/ui/components/PlanExecuteApp.js +1324 -0
  543. package/dist/ui/components/PlanExecuteApp.js.map +1 -0
  544. package/dist/ui/components/ProgressBar.d.ts +10 -0
  545. package/dist/ui/components/ProgressBar.d.ts.map +1 -0
  546. package/dist/ui/components/ProgressBar.js +26 -0
  547. package/dist/ui/components/ProgressBar.js.map +1 -0
  548. package/dist/ui/components/StatusBar.d.ts +23 -0
  549. package/dist/ui/components/StatusBar.d.ts.map +1 -0
  550. package/dist/ui/components/StatusBar.js +162 -0
  551. package/dist/ui/components/StatusBar.js.map +1 -0
  552. package/dist/ui/components/ThinkingIndicator.d.ts +14 -0
  553. package/dist/ui/components/ThinkingIndicator.d.ts.map +1 -0
  554. package/dist/ui/components/ThinkingIndicator.js +63 -0
  555. package/dist/ui/components/ThinkingIndicator.js.map +1 -0
  556. package/dist/ui/components/TodoListView.d.ts +11 -0
  557. package/dist/ui/components/TodoListView.d.ts.map +1 -0
  558. package/dist/ui/components/TodoListView.js +69 -0
  559. package/dist/ui/components/TodoListView.js.map +1 -0
  560. package/dist/ui/components/ToolSelector.d.ts +7 -0
  561. package/dist/ui/components/ToolSelector.d.ts.map +1 -0
  562. package/dist/ui/components/ToolSelector.js +111 -0
  563. package/dist/ui/components/ToolSelector.js.map +1 -0
  564. package/dist/ui/components/dialogs/ApprovalDialog.d.ts +13 -0
  565. package/dist/ui/components/dialogs/ApprovalDialog.d.ts.map +1 -0
  566. package/dist/ui/components/dialogs/ApprovalDialog.js +173 -0
  567. package/dist/ui/components/dialogs/ApprovalDialog.js.map +1 -0
  568. package/dist/ui/components/dialogs/AskUserDialog.d.ts +9 -0
  569. package/dist/ui/components/dialogs/AskUserDialog.d.ts.map +1 -0
  570. package/dist/ui/components/dialogs/AskUserDialog.js +111 -0
  571. package/dist/ui/components/dialogs/AskUserDialog.js.map +1 -0
  572. package/dist/ui/components/dialogs/DocsBrowser.d.ts +8 -0
  573. package/dist/ui/components/dialogs/DocsBrowser.d.ts.map +1 -0
  574. package/dist/ui/components/dialogs/DocsBrowser.js +127 -0
  575. package/dist/ui/components/dialogs/DocsBrowser.js.map +1 -0
  576. package/dist/ui/components/dialogs/SettingsDialog.d.ts +10 -0
  577. package/dist/ui/components/dialogs/SettingsDialog.d.ts.map +1 -0
  578. package/dist/ui/components/dialogs/SettingsDialog.js +563 -0
  579. package/dist/ui/components/dialogs/SettingsDialog.js.map +1 -0
  580. package/dist/ui/components/dialogs/index.d.ts +4 -0
  581. package/dist/ui/components/dialogs/index.d.ts.map +1 -0
  582. package/dist/ui/components/dialogs/index.js +4 -0
  583. package/dist/ui/components/dialogs/index.js.map +1 -0
  584. package/dist/ui/components/index.d.ts +12 -0
  585. package/dist/ui/components/index.d.ts.map +1 -0
  586. package/dist/ui/components/index.js +9 -0
  587. package/dist/ui/components/index.js.map +1 -0
  588. package/dist/ui/components/panels/LogPanel.d.ts +7 -0
  589. package/dist/ui/components/panels/LogPanel.d.ts.map +1 -0
  590. package/dist/ui/components/panels/LogPanel.js +280 -0
  591. package/dist/ui/components/panels/LogPanel.js.map +1 -0
  592. package/dist/ui/components/panels/SessionPanel.d.ts +8 -0
  593. package/dist/ui/components/panels/SessionPanel.d.ts.map +1 -0
  594. package/dist/ui/components/panels/SessionPanel.js +81 -0
  595. package/dist/ui/components/panels/SessionPanel.js.map +1 -0
  596. package/dist/ui/components/panels/index.d.ts +4 -0
  597. package/dist/ui/components/panels/index.d.ts.map +1 -0
  598. package/dist/ui/components/panels/index.js +4 -0
  599. package/dist/ui/components/panels/index.js.map +1 -0
  600. package/dist/ui/components/views/ChatView.d.ts +12 -0
  601. package/dist/ui/components/views/ChatView.d.ts.map +1 -0
  602. package/dist/ui/components/views/ChatView.js +289 -0
  603. package/dist/ui/components/views/ChatView.js.map +1 -0
  604. package/dist/ui/components/views/index.d.ts +2 -0
  605. package/dist/ui/components/views/index.d.ts.map +1 -0
  606. package/dist/ui/components/views/index.js +2 -0
  607. package/dist/ui/components/views/index.js.map +1 -0
  608. package/dist/ui/contexts/TokenContext.d.ts +29 -0
  609. package/dist/ui/contexts/TokenContext.d.ts.map +1 -0
  610. package/dist/ui/contexts/TokenContext.js +79 -0
  611. package/dist/ui/contexts/TokenContext.js.map +1 -0
  612. package/dist/ui/hooks/atFileProcessor.d.ts +15 -0
  613. package/dist/ui/hooks/atFileProcessor.d.ts.map +1 -0
  614. package/dist/ui/hooks/atFileProcessor.js +88 -0
  615. package/dist/ui/hooks/atFileProcessor.js.map +1 -0
  616. package/dist/ui/hooks/index.d.ts +8 -0
  617. package/dist/ui/hooks/index.d.ts.map +1 -0
  618. package/dist/ui/hooks/index.js +8 -0
  619. package/dist/ui/hooks/index.js.map +1 -0
  620. package/dist/ui/hooks/slashCommandProcessor.d.ts +21 -0
  621. package/dist/ui/hooks/slashCommandProcessor.d.ts.map +1 -0
  622. package/dist/ui/hooks/slashCommandProcessor.js +100 -0
  623. package/dist/ui/hooks/slashCommandProcessor.js.map +1 -0
  624. package/dist/ui/hooks/useCommandBrowserState.d.ts +12 -0
  625. package/dist/ui/hooks/useCommandBrowserState.d.ts.map +1 -0
  626. package/dist/ui/hooks/useCommandBrowserState.js +66 -0
  627. package/dist/ui/hooks/useCommandBrowserState.js.map +1 -0
  628. package/dist/ui/hooks/useFileBrowserState.d.ts +15 -0
  629. package/dist/ui/hooks/useFileBrowserState.d.ts.map +1 -0
  630. package/dist/ui/hooks/useFileBrowserState.js +80 -0
  631. package/dist/ui/hooks/useFileBrowserState.js.map +1 -0
  632. package/dist/ui/hooks/useFileList.d.ts +20 -0
  633. package/dist/ui/hooks/useFileList.d.ts.map +1 -0
  634. package/dist/ui/hooks/useFileList.js +57 -0
  635. package/dist/ui/hooks/useFileList.js.map +1 -0
  636. package/dist/ui/hooks/useInputHistory.d.ts +9 -0
  637. package/dist/ui/hooks/useInputHistory.d.ts.map +1 -0
  638. package/dist/ui/hooks/useInputHistory.js +68 -0
  639. package/dist/ui/hooks/useInputHistory.js.map +1 -0
  640. package/dist/ui/hooks/usePlanExecution.d.ts +8 -0
  641. package/dist/ui/hooks/usePlanExecution.d.ts.map +1 -0
  642. package/dist/ui/hooks/usePlanExecution.js +214 -0
  643. package/dist/ui/hooks/usePlanExecution.js.map +1 -0
  644. package/dist/ui/index.d.ts +7 -0
  645. package/dist/ui/index.d.ts.map +1 -0
  646. package/dist/ui/index.js +7 -0
  647. package/dist/ui/index.js.map +1 -0
  648. package/dist/ui/ink-entry.d.ts +3 -0
  649. package/dist/ui/ink-entry.d.ts.map +1 -0
  650. package/dist/ui/ink-entry.js +22 -0
  651. package/dist/ui/ink-entry.js.map +1 -0
  652. package/dist/utils/env-filter.d.ts +4 -0
  653. package/dist/utils/env-filter.d.ts.map +1 -0
  654. package/dist/utils/env-filter.js +101 -0
  655. package/dist/utils/env-filter.js.map +1 -0
  656. package/dist/utils/file-system.d.ts +9 -0
  657. package/dist/utils/file-system.d.ts.map +1 -0
  658. package/dist/utils/file-system.js +99 -0
  659. package/dist/utils/file-system.js.map +1 -0
  660. package/dist/utils/git-utils.d.ts +2 -0
  661. package/dist/utils/git-utils.d.ts.map +1 -0
  662. package/dist/utils/git-utils.js +16 -0
  663. package/dist/utils/git-utils.js.map +1 -0
  664. package/dist/utils/json-stream-logger.d.ts +74 -0
  665. package/dist/utils/json-stream-logger.d.ts.map +1 -0
  666. package/dist/utils/json-stream-logger.js +808 -0
  667. package/dist/utils/json-stream-logger.js.map +1 -0
  668. package/dist/utils/logger.d.ts +152 -0
  669. package/dist/utils/logger.d.ts.map +1 -0
  670. package/dist/utils/logger.js +1672 -0
  671. package/dist/utils/logger.js.map +1 -0
  672. package/dist/utils/platform-utils.d.ts +19 -0
  673. package/dist/utils/platform-utils.d.ts.map +1 -0
  674. package/dist/utils/platform-utils.js +134 -0
  675. package/dist/utils/platform-utils.js.map +1 -0
  676. package/dist/utils/wsl-utils.d.ts +4 -0
  677. package/dist/utils/wsl-utils.d.ts.map +1 -0
  678. package/dist/utils/wsl-utils.js +72 -0
  679. package/dist/utils/wsl-utils.js.map +1 -0
  680. package/electron.vite.config.ts +63 -0
  681. package/google374b9eba0c52b043.html +1 -0
  682. package/package.json +122 -0
  683. package/src/agents/base/base-agent.ts +159 -0
  684. package/src/agents/docs-search/index.ts +365 -0
  685. package/src/agents/index.ts +34 -0
  686. package/src/agents/planner/index.ts +544 -0
  687. package/src/cli.ts +201 -0
  688. package/src/constants.ts +47 -0
  689. package/src/core/compact/compact-manager.ts +160 -0
  690. package/src/core/compact/compact-prompts.ts +150 -0
  691. package/src/core/compact/context-tracker.ts +164 -0
  692. package/src/core/compact/index.ts +25 -0
  693. package/src/core/config/config-manager.ts +460 -0
  694. package/src/core/config/index.ts +5 -0
  695. package/src/core/docs-manager.ts +678 -0
  696. package/src/core/llm/index.ts +7 -0
  697. package/src/core/llm/llm-client.ts +1550 -0
  698. package/src/core/session/index.ts +5 -0
  699. package/src/core/session/session-manager.ts +464 -0
  700. package/src/core/slash-command-handler.ts +410 -0
  701. package/src/core/usage-tracker.ts +438 -0
  702. package/src/errors/base.ts +81 -0
  703. package/src/errors/file.ts +183 -0
  704. package/src/errors/index.ts +95 -0
  705. package/src/errors/llm.ts +151 -0
  706. package/src/errors/network.ts +124 -0
  707. package/src/errors/validation.ts +111 -0
  708. package/src/eval/eval-runner.ts +456 -0
  709. package/src/eval/index.ts +8 -0
  710. package/src/eval/types.ts +139 -0
  711. package/src/index.ts +22 -0
  712. package/src/orchestration/index.ts +30 -0
  713. package/src/orchestration/plan-executor.ts +652 -0
  714. package/src/orchestration/types.ts +127 -0
  715. package/src/orchestration/utils.ts +119 -0
  716. package/src/orquesta/connection.ts +291 -0
  717. package/src/prompts/agents/docs-search-decision.ts +74 -0
  718. package/src/prompts/agents/docs-search.ts +84 -0
  719. package/src/prompts/agents/planning.ts +143 -0
  720. package/src/prompts/index.ts +31 -0
  721. package/src/prompts/shared/codebase-rules.ts +29 -0
  722. package/src/prompts/shared/git-rules.ts +94 -0
  723. package/src/prompts/shared/language-rules.ts +36 -0
  724. package/src/prompts/shared/tool-usage.ts +72 -0
  725. package/src/prompts/system/compact.ts +80 -0
  726. package/src/prompts/system/plan-execute.ts +89 -0
  727. package/src/tools/browser/browser-client.ts +1363 -0
  728. package/src/tools/browser/browser-tools.ts +1139 -0
  729. package/src/tools/browser/index.ts +65 -0
  730. package/src/tools/index.ts +23 -0
  731. package/src/tools/llm/agents/docs-search-tools.ts +368 -0
  732. package/src/tools/llm/agents/index.ts +22 -0
  733. package/src/tools/llm/index.ts +11 -0
  734. package/src/tools/llm/simple/ask-user-tool.ts +25 -0
  735. package/src/tools/llm/simple/background-bash-tool.ts +443 -0
  736. package/src/tools/llm/simple/background-powershell-tool.ts +421 -0
  737. package/src/tools/llm/simple/bash-tool.ts +238 -0
  738. package/src/tools/llm/simple/docs-search-agent-tool.ts +146 -0
  739. package/src/tools/llm/simple/file-tools.ts +1051 -0
  740. package/src/tools/llm/simple/final-response-tool.ts +180 -0
  741. package/src/tools/llm/simple/index.ts +42 -0
  742. package/src/tools/llm/simple/planning-tools.ts +143 -0
  743. package/src/tools/llm/simple/powershell-tool.ts +241 -0
  744. package/src/tools/llm/simple/simple-tool-executor.ts +279 -0
  745. package/src/tools/llm/simple/todo-tools.ts +207 -0
  746. package/src/tools/llm/simple/user-interaction-tools.ts +277 -0
  747. package/src/tools/office/common/constants.ts +335 -0
  748. package/src/tools/office/common/index.ts +133 -0
  749. package/src/tools/office/common/types.ts +286 -0
  750. package/src/tools/office/common/utils.ts +116 -0
  751. package/src/tools/office/excel-client.ts +1336 -0
  752. package/src/tools/office/excel-tools/cells.ts +359 -0
  753. package/src/tools/office/excel-tools/charts.ts +166 -0
  754. package/src/tools/office/excel-tools/comments.ts +155 -0
  755. package/src/tools/office/excel-tools/data-ops.ts +349 -0
  756. package/src/tools/office/excel-tools/export.ts +105 -0
  757. package/src/tools/office/excel-tools/formatting.ts +357 -0
  758. package/src/tools/office/excel-tools/index.ts +55 -0
  759. package/src/tools/office/excel-tools/launch.ts +303 -0
  760. package/src/tools/office/excel-tools/media.ts +117 -0
  761. package/src/tools/office/excel-tools/named-ranges.ts +148 -0
  762. package/src/tools/office/excel-tools/protection.ts +105 -0
  763. package/src/tools/office/excel-tools/rows-columns.ts +386 -0
  764. package/src/tools/office/excel-tools/sheets.ts +228 -0
  765. package/src/tools/office/excel-tools/validation.ts +226 -0
  766. package/src/tools/office/excel-tools.ts +9 -0
  767. package/src/tools/office/index.ts +259 -0
  768. package/src/tools/office/office-client-base.ts +242 -0
  769. package/src/tools/office/office-client.ts +377 -0
  770. package/src/tools/office/powerpoint-client.ts +1498 -0
  771. package/src/tools/office/powerpoint-tools/effects.ts +315 -0
  772. package/src/tools/office/powerpoint-tools/export.ts +138 -0
  773. package/src/tools/office/powerpoint-tools/index.ts +45 -0
  774. package/src/tools/office/powerpoint-tools/launch.ts +263 -0
  775. package/src/tools/office/powerpoint-tools/media.ts +291 -0
  776. package/src/tools/office/powerpoint-tools/notes.ts +220 -0
  777. package/src/tools/office/powerpoint-tools/sections.ts +140 -0
  778. package/src/tools/office/powerpoint-tools/shapes.ts +870 -0
  779. package/src/tools/office/powerpoint-tools/slides.ts +350 -0
  780. package/src/tools/office/powerpoint-tools/tables.ts +182 -0
  781. package/src/tools/office/powerpoint-tools/text.ts +473 -0
  782. package/src/tools/office/powerpoint-tools.ts +9 -0
  783. package/src/tools/office/word-client.ts +1697 -0
  784. package/src/tools/office/word-tools/bookmarks.ts +186 -0
  785. package/src/tools/office/word-tools/comments.ts +185 -0
  786. package/src/tools/office/word-tools/content.ts +229 -0
  787. package/src/tools/office/word-tools/export.ts +97 -0
  788. package/src/tools/office/word-tools/formatting.ts +161 -0
  789. package/src/tools/office/word-tools/headers-footers.ts +155 -0
  790. package/src/tools/office/word-tools/index.ts +57 -0
  791. package/src/tools/office/word-tools/launch.ts +312 -0
  792. package/src/tools/office/word-tools/lists.ts +97 -0
  793. package/src/tools/office/word-tools/navigation.ts +114 -0
  794. package/src/tools/office/word-tools/page-setup.ts +195 -0
  795. package/src/tools/office/word-tools/tables.ts +262 -0
  796. package/src/tools/office/word-tools/text.ts +294 -0
  797. package/src/tools/office/word-tools/undo-redo.ts +97 -0
  798. package/src/tools/office/word-tools/watermarks.ts +105 -0
  799. package/src/tools/office/word-tools.ts +9 -0
  800. package/src/tools/registry.ts +527 -0
  801. package/src/tools/types.ts +231 -0
  802. package/src/types/index.ts +181 -0
  803. package/src/ui/PlanExecuteView.tsx +119 -0
  804. package/src/ui/TodoPanel.tsx +240 -0
  805. package/src/ui/UpdateNotification.tsx +105 -0
  806. package/src/ui/components/ActivityIndicator.tsx +234 -0
  807. package/src/ui/components/CommandBrowser.tsx +114 -0
  808. package/src/ui/components/CustomTextInput.tsx +389 -0
  809. package/src/ui/components/DocsSearchProgress.tsx +85 -0
  810. package/src/ui/components/FileBrowser.tsx +93 -0
  811. package/src/ui/components/LLMSetupWizard.tsx +333 -0
  812. package/src/ui/components/Logo.tsx +125 -0
  813. package/src/ui/components/MarkdownRenderer.tsx +358 -0
  814. package/src/ui/components/ModelSelector.tsx +203 -0
  815. package/src/ui/components/PlanExecuteApp.tsx +2007 -0
  816. package/src/ui/components/ProgressBar.tsx +51 -0
  817. package/src/ui/components/StatusBar.tsx +302 -0
  818. package/src/ui/components/ThinkingIndicator.tsx +120 -0
  819. package/src/ui/components/TodoListView.tsx +140 -0
  820. package/src/ui/components/ToolSelector.tsx +215 -0
  821. package/src/ui/components/dialogs/ApprovalDialog.tsx +259 -0
  822. package/src/ui/components/dialogs/AskUserDialog.tsx +159 -0
  823. package/src/ui/components/dialogs/DocsBrowser.tsx +222 -0
  824. package/src/ui/components/dialogs/SettingsDialog.tsx +939 -0
  825. package/src/ui/components/dialogs/index.ts +13 -0
  826. package/src/ui/components/index.ts +27 -0
  827. package/src/ui/components/panels/LogPanel.tsx +385 -0
  828. package/src/ui/components/panels/SessionPanel.tsx +146 -0
  829. package/src/ui/components/panels/index.ts +13 -0
  830. package/src/ui/components/views/ChatView.tsx +447 -0
  831. package/src/ui/components/views/index.ts +5 -0
  832. package/src/ui/contexts/TokenContext.tsx +139 -0
  833. package/src/ui/hooks/atFileProcessor.ts +167 -0
  834. package/src/ui/hooks/index.ts +11 -0
  835. package/src/ui/hooks/slashCommandProcessor.ts +174 -0
  836. package/src/ui/hooks/useCommandBrowserState.ts +97 -0
  837. package/src/ui/hooks/useFileBrowserState.ts +116 -0
  838. package/src/ui/hooks/useFileList.ts +132 -0
  839. package/src/ui/hooks/useInputHistory.ts +89 -0
  840. package/src/ui/hooks/usePlanExecution.ts +339 -0
  841. package/src/ui/index.ts +10 -0
  842. package/src/ui/ink-entry.tsx +36 -0
  843. package/src/utils/env-filter.ts +164 -0
  844. package/src/utils/file-system.ts +133 -0
  845. package/src/utils/git-utils.ts +30 -0
  846. package/src/utils/json-stream-logger.ts +1259 -0
  847. package/src/utils/logger.ts +2767 -0
  848. package/src/utils/platform-utils.ts +256 -0
  849. package/src/utils/wsl-utils.ts +113 -0
  850. package/tsconfig.electron.json +39 -0
  851. package/tsconfig.json +64 -0
@@ -0,0 +1,1051 @@
1
+ /**
2
+ * File System Tools (LLM Simple)
3
+ *
4
+ * Tools that allow LLM to interact with the file system
5
+ * Category: LLM Simple Tools - LLM calls via tool_call, no Sub-LLM
6
+ */
7
+
8
+ import * as fs from 'fs/promises';
9
+ import * as path from 'path';
10
+ import { ToolDefinition } from '../../../types/index.js';
11
+ import { LLMSimpleTool, ToolResult, ToolCategory } from '../../types.js';
12
+ import { logger } from '../../../utils/logger.js';
13
+
14
+ // Safety limits
15
+ const EXCLUDED_DIRS = new Set([
16
+ 'node_modules',
17
+ '.git',
18
+ 'dist',
19
+ '.next',
20
+ 'coverage',
21
+ '.cache',
22
+ 'build',
23
+ '__pycache__',
24
+ ]);
25
+ const MAX_DEPTH = 5;
26
+ const MAX_FILES = 100;
27
+
28
+ // Read file limits (Claude Code style)
29
+ const DEFAULT_LINE_LIMIT = 2000;
30
+ const MAX_LINE_LIMIT = 10000;
31
+
32
+ // File size limits (security - prevent memory exhaustion)
33
+ const MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB max file size
34
+ const MAX_WRITE_SIZE = 50 * 1024 * 1024; // 50MB max write size
35
+
36
+ /**
37
+ * read_file Tool Definition
38
+ */
39
+ const READ_FILE_DEFINITION: ToolDefinition = {
40
+ type: 'function',
41
+ function: {
42
+ name: 'read_file',
43
+ description: `Read the contents of a file. Only text files are supported.
44
+ By default, reads up to ${DEFAULT_LINE_LIMIT} lines. Use offset/limit for large files.`,
45
+ parameters: {
46
+ type: 'object',
47
+ properties: {
48
+ reason: {
49
+ type: 'string',
50
+ description: `A natural, conversational explanation for the user about what you're doing.
51
+ Write as if you're talking to the user directly. Use the same language as the user.
52
+ Examples:
53
+ - "Checking how the current authentication logic is implemented"
54
+ - "Opening the file where the error occurred to find the problem"
55
+ - "Checking package.json to understand the project setup"
56
+ - "Looking at the existing code before making changes"`,
57
+ },
58
+ file_path: {
59
+ type: 'string',
60
+ description: 'Absolute or relative path of the file to read',
61
+ },
62
+ offset: {
63
+ type: 'number',
64
+ description: 'Starting line number (1-based, default: 1)',
65
+ },
66
+ limit: {
67
+ type: 'number',
68
+ description: `Number of lines to read (default: ${DEFAULT_LINE_LIMIT}, max: ${MAX_LINE_LIMIT})`,
69
+ },
70
+ },
71
+ required: ['reason', 'file_path'],
72
+ },
73
+ },
74
+ };
75
+
76
+ /**
77
+ * Internal: Execute read_file
78
+ * Supports offset/limit for reading portions of large files (Claude Code style)
79
+ */
80
+ async function _executeReadFile(args: Record<string, unknown>): Promise<ToolResult> {
81
+ const filePath = args['file_path'] as string;
82
+ const offset = Math.max(1, (args['offset'] as number) || 1); // 1-based, default 1
83
+ const limit = Math.min(MAX_LINE_LIMIT, Math.max(1, (args['limit'] as number) || DEFAULT_LINE_LIMIT));
84
+
85
+ logger.toolStart('read_file', args);
86
+
87
+ try {
88
+ // Remove @ prefix if present
89
+ const cleanPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
90
+ const resolvedPath = path.resolve(cleanPath);
91
+ const displayPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
92
+
93
+ // Check file size before reading (security: prevent memory exhaustion)
94
+ const stats = await fs.stat(resolvedPath);
95
+ if (stats.size > MAX_FILE_SIZE) {
96
+ logger.warn('File too large to read', { path: displayPath, size: stats.size, max: MAX_FILE_SIZE });
97
+ return {
98
+ success: false,
99
+ error: `File too large to read (${(stats.size / 1024 / 1024).toFixed(2)}MB). Maximum: ${MAX_FILE_SIZE / 1024 / 1024}MB`,
100
+ };
101
+ }
102
+
103
+ const content = await fs.readFile(resolvedPath, 'utf-8');
104
+
105
+ // Split into lines and apply offset/limit
106
+ const allLines = content.split('\n');
107
+ const totalLines = allLines.length;
108
+ const startIdx = offset - 1; // Convert to 0-based
109
+ const endIdx = Math.min(startIdx + limit, totalLines);
110
+ const selectedLines = allLines.slice(startIdx, endIdx);
111
+
112
+ // Format with line numbers (Claude Code style: " 1→content")
113
+ const formattedLines = selectedLines.map((line, idx) => {
114
+ const lineNum = startIdx + idx + 1;
115
+ const padding = String(totalLines).length;
116
+ return `${String(lineNum).padStart(padding)}→${line}`;
117
+ });
118
+
119
+ let result = formattedLines.join('\n');
120
+
121
+ // Add info header if file is larger than what we're showing
122
+ if (totalLines > limit || offset > 1) {
123
+ const header = `[File: ${displayPath} | Lines ${offset}-${endIdx} of ${totalLines}]`;
124
+ const hasMore = endIdx < totalLines;
125
+ const footer = hasMore
126
+ ? `\n[... ${totalLines - endIdx} more lines. Use offset=${endIdx + 1} to continue reading]`
127
+ : '';
128
+ result = `${header}\n${result}${footer}`;
129
+ }
130
+
131
+ logger.toolSuccess('read_file', args, { linesRead: selectedLines.length, totalLines }, 0);
132
+ return {
133
+ success: true,
134
+ result,
135
+ };
136
+ } catch (error) {
137
+ const err = error as NodeJS.ErrnoException;
138
+ const displayPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
139
+
140
+ if (err.code === 'ENOENT') {
141
+ logger.toolError('read_file', args, err, 0);
142
+ return {
143
+ success: false,
144
+ error: `File not found: ${displayPath}`,
145
+ };
146
+ } else if (err.code === 'EACCES') {
147
+ logger.toolError('read_file', args, err, 0);
148
+ return {
149
+ success: false,
150
+ error: `Permission denied reading file: ${displayPath}`,
151
+ };
152
+ } else {
153
+ logger.toolError('read_file', args, err, 0);
154
+ return {
155
+ success: false,
156
+ error: `Failed to read file: ${err.message}`,
157
+ };
158
+ }
159
+ }
160
+ }
161
+
162
+ /**
163
+ * read_file LLM Simple Tool
164
+ */
165
+ export const readFileTool: LLMSimpleTool = {
166
+ definition: READ_FILE_DEFINITION,
167
+ execute: _executeReadFile,
168
+ categories: ['llm-simple'] as ToolCategory[],
169
+ description: 'Read file contents',
170
+ };
171
+
172
+ /**
173
+ * create_file Tool Definition
174
+ * Used for creating NEW files only. Use edit_file for existing files.
175
+ */
176
+ const CREATE_FILE_DEFINITION: ToolDefinition = {
177
+ type: 'function',
178
+ function: {
179
+ name: 'create_file',
180
+ description: `Create a NEW file with the given content.
181
+ IMPORTANT: Only use this for files that do NOT exist yet.
182
+ For modifying existing files, use edit_file instead.
183
+ If the file already exists, this tool will fail.`,
184
+ parameters: {
185
+ type: 'object',
186
+ properties: {
187
+ reason: {
188
+ type: 'string',
189
+ description: `A natural, conversational explanation for the user about what you're doing.
190
+ Write as if you're talking to the user directly. Use the same language as the user.
191
+ Examples:
192
+ - "Creating a new file for the authentication service"
193
+ - "Creating a new test config file since one doesn't exist"
194
+ - "Creating a new file to separate the API router"
195
+ - "Adding a new component file"`,
196
+ },
197
+ file_path: {
198
+ type: 'string',
199
+ description: 'Absolute or relative path of the new file to create',
200
+ },
201
+ content: {
202
+ type: 'string',
203
+ description: 'Content to write to the new file',
204
+ },
205
+ },
206
+ required: ['reason', 'file_path', 'content'],
207
+ },
208
+ },
209
+ };
210
+
211
+ /**
212
+ * Internal: Execute create_file
213
+ */
214
+ async function _executeCreateFile(args: Record<string, unknown>): Promise<ToolResult> {
215
+ const filePath = args['file_path'] as string;
216
+ const content = args['content'] as string;
217
+
218
+ logger.toolStart('create_file', { file_path: filePath, contentLength: content?.length || 0 });
219
+
220
+ try {
221
+ const cleanPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
222
+ const resolvedPath = path.resolve(cleanPath);
223
+ const displayPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
224
+
225
+ // Check content size (security: prevent excessive writes)
226
+ const contentSize = Buffer.byteLength(content, 'utf-8');
227
+ if (contentSize > MAX_WRITE_SIZE) {
228
+ logger.warn('Content too large to write', { path: displayPath, size: contentSize, max: MAX_WRITE_SIZE });
229
+ return {
230
+ success: false,
231
+ error: `Content too large to write (${(contentSize / 1024 / 1024).toFixed(2)}MB). Maximum: ${MAX_WRITE_SIZE / 1024 / 1024}MB`,
232
+ };
233
+ }
234
+
235
+ // Check if file already exists
236
+ try {
237
+ await fs.access(resolvedPath);
238
+ logger.toolError('create_file', args, new Error('File already exists'), 0);
239
+ return {
240
+ success: false,
241
+ error: `File already exists: ${displayPath}. Use edit_file to modify existing files.`,
242
+ };
243
+ } catch {
244
+ // File doesn't exist, which is what we want
245
+ }
246
+
247
+ // Create directory if it doesn't exist
248
+ const dir = path.dirname(resolvedPath);
249
+ await fs.mkdir(dir, { recursive: true });
250
+
251
+ await fs.writeFile(resolvedPath, content, 'utf-8');
252
+
253
+ const lines = content.split('\n').length;
254
+ logger.toolSuccess('create_file', args, { file: displayPath, lines }, 0);
255
+ return {
256
+ success: true,
257
+ result: JSON.stringify({
258
+ action: 'created',
259
+ file: displayPath,
260
+ lines: lines,
261
+ message: `Created ${displayPath} (${lines} lines)`,
262
+ }),
263
+ };
264
+ } catch (error) {
265
+ const err = error as NodeJS.ErrnoException;
266
+ const displayPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
267
+ logger.toolError('create_file', args, err, 0);
268
+ return {
269
+ success: false,
270
+ error: `Failed to create file (${displayPath}): ${err.message}`,
271
+ };
272
+ }
273
+ }
274
+
275
+ /**
276
+ * create_file LLM Simple Tool
277
+ */
278
+ export const createFileTool: LLMSimpleTool = {
279
+ definition: CREATE_FILE_DEFINITION,
280
+ execute: _executeCreateFile,
281
+ categories: ['llm-simple'] as ToolCategory[],
282
+ description: 'Create a new file',
283
+ };
284
+
285
+ /**
286
+ * edit_file Tool Definition
287
+ * Used for modifying EXISTING files only. Use create_file for new files.
288
+ * Claude Code style: old_string/new_string based replacement
289
+ */
290
+ const EDIT_FILE_DEFINITION: ToolDefinition = {
291
+ type: 'function',
292
+ function: {
293
+ name: 'edit_file',
294
+ description: `Edit an EXISTING file by replacing a specific text block.
295
+ IMPORTANT: Only use this for files that already exist. For new files, use create_file.
296
+
297
+ HOW TO USE:
298
+ 1. First use read_file to see the current content
299
+ 2. Copy the EXACT text block you want to change (can be multiple lines)
300
+ 3. Provide old_string (text to find) and new_string (replacement)
301
+
302
+ RULES:
303
+ - old_string must match EXACTLY (including whitespace and indentation)
304
+ - old_string must be UNIQUE in the file (if it appears multiple times, use replace_all: true)
305
+ - Both old_string and new_string can be multi-line
306
+ - To delete text, use empty string "" for new_string
307
+
308
+ EXAMPLES:
309
+ 1. Change a single line:
310
+ old_string: "const x = 1;"
311
+ new_string: "const x = 2;"
312
+
313
+ 2. Change multiple lines at once:
314
+ old_string: "function foo() {\\n return 1;\\n}"
315
+ new_string: "function foo() {\\n return 2;\\n}"
316
+
317
+ 3. Delete a line:
318
+ old_string: "// delete this line\\n"
319
+ new_string: ""
320
+
321
+ 4. Replace all occurrences:
322
+ old_string: "oldName"
323
+ new_string: "newName"
324
+ replace_all: true`,
325
+ parameters: {
326
+ type: 'object',
327
+ properties: {
328
+ reason: {
329
+ type: 'string',
330
+ description: `A natural, conversational explanation for the user about what you're doing.
331
+ Write as if you're talking to the user directly. Use the same language as the user.
332
+ Examples:
333
+ - "Fixing the buggy section"
334
+ - "Changing the function name as requested"
335
+ - "Adding the import statement"
336
+ - "Fixing the type error"`,
337
+ },
338
+ file_path: {
339
+ type: 'string',
340
+ description: 'Absolute or relative path of the existing file to edit',
341
+ },
342
+ old_string: {
343
+ type: 'string',
344
+ description: 'The exact text to find and replace (can be multi-line)',
345
+ },
346
+ new_string: {
347
+ type: 'string',
348
+ description: 'The new text to replace with (can be multi-line, use "" to delete)',
349
+ },
350
+ replace_all: {
351
+ type: 'boolean',
352
+ description: 'If true, replace ALL occurrences of old_string. Default is false (requires unique match).',
353
+ },
354
+ },
355
+ required: ['reason', 'file_path', 'old_string', 'new_string'],
356
+ },
357
+ },
358
+ };
359
+
360
+ /**
361
+ * Internal: Execute edit_file (Claude Code style - old_string/new_string)
362
+ */
363
+ async function _executeEditFile(args: Record<string, unknown>): Promise<ToolResult> {
364
+ const filePath = args['file_path'] as string;
365
+ const oldString = args['old_string'] as string;
366
+ const newString = args['new_string'] as string;
367
+ const replaceAll = args['replace_all'] as boolean | undefined;
368
+
369
+ logger.toolStart('edit_file', { file_path: filePath, oldStringLength: oldString?.length || 0, newStringLength: newString?.length || 0, replaceAll });
370
+
371
+ // Compute displayPath once at the top for use in both try and catch
372
+ const cleanPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
373
+ const displayPath = cleanPath;
374
+
375
+ try {
376
+ const resolvedPath = path.resolve(cleanPath);
377
+
378
+ // Validate old_string is not empty
379
+ if (!oldString) {
380
+ return {
381
+ success: false,
382
+ error: 'old_string cannot be empty.',
383
+ };
384
+ }
385
+
386
+ // Check if file exists
387
+ try {
388
+ await fs.access(resolvedPath);
389
+ } catch {
390
+ return {
391
+ success: false,
392
+ error: `File does not exist: ${displayPath}. Use create_file to create new files.`,
393
+ };
394
+ }
395
+
396
+ // Check file size before reading (security: prevent memory exhaustion)
397
+ const stats = await fs.stat(resolvedPath);
398
+ if (stats.size > MAX_FILE_SIZE) {
399
+ logger.warn('File too large to edit', { path: displayPath, size: stats.size, max: MAX_FILE_SIZE });
400
+ return {
401
+ success: false,
402
+ error: `File too large to edit (${(stats.size / 1024 / 1024).toFixed(2)}MB). Maximum: ${MAX_FILE_SIZE / 1024 / 1024}MB`,
403
+ };
404
+ }
405
+
406
+ // Read current content
407
+ const originalContent = await fs.readFile(resolvedPath, 'utf-8');
408
+
409
+ // Check if old_string exists in the file
410
+ if (!originalContent.includes(oldString)) {
411
+ // Try to provide helpful context
412
+ const lines = originalContent.split('\n');
413
+ const preview = lines.slice(0, 20).map((l, i) => `${i + 1}: ${l}`).join('\n');
414
+ return {
415
+ success: false,
416
+ error: `old_string not found in file.\n\nSearched for:\n"${oldString.slice(0, 200)}${oldString.length > 200 ? '...' : ''}"\n\nFile preview (first 20 lines):\n${preview}\n\n💡 Use read_file to check the exact content and try again.`,
417
+ };
418
+ }
419
+
420
+ // Count occurrences
421
+ const occurrences = originalContent.split(oldString).length - 1;
422
+
423
+ // If not replace_all, old_string must be unique
424
+ if (!replaceAll && occurrences > 1) {
425
+ return {
426
+ success: false,
427
+ error: `old_string appears ${occurrences} times in the file. Either:\n1. Make old_string more specific (include more context)\n2. Use replace_all: true to replace all occurrences\n\n💡 Include surrounding lines to make the match unique.`,
428
+ };
429
+ }
430
+
431
+ // Perform replacement
432
+ let newContent: string;
433
+ if (replaceAll) {
434
+ newContent = originalContent.split(oldString).join(newString);
435
+ } else {
436
+ // Replace only first occurrence (which should be unique)
437
+ newContent = originalContent.replace(oldString, newString);
438
+ }
439
+
440
+ // Check new content size (security: prevent excessive writes)
441
+ const newContentSize = Buffer.byteLength(newContent, 'utf-8');
442
+ if (newContentSize > MAX_WRITE_SIZE) {
443
+ logger.warn('Modified content too large', { path: displayPath, size: newContentSize, max: MAX_WRITE_SIZE });
444
+ return {
445
+ success: false,
446
+ error: `Modified content too large (${(newContentSize / 1024 / 1024).toFixed(2)}MB). Maximum: ${MAX_WRITE_SIZE / 1024 / 1024}MB`,
447
+ };
448
+ }
449
+
450
+ // Write the modified content
451
+ await fs.writeFile(resolvedPath, newContent, 'utf-8');
452
+
453
+ // Calculate diff stats (split once, reuse)
454
+ const oldLinesArr = oldString.split('\n');
455
+ const newLinesArr = newString.split('\n');
456
+ const replacements = replaceAll ? occurrences : 1;
457
+
458
+ // Build simple diff preview
459
+ const diffPreview: string[] = [];
460
+ const oldPreview = oldLinesArr.slice(0, 5);
461
+ const newPreview = newLinesArr.slice(0, 5);
462
+
463
+ oldPreview.forEach(line => diffPreview.push(`- ${line}`));
464
+ if (oldLinesArr.length > 5) diffPreview.push('- ...');
465
+ newPreview.forEach(line => diffPreview.push(`+ ${line}`));
466
+ if (newLinesArr.length > 5) diffPreview.push('+ ...');
467
+
468
+ logger.toolSuccess('edit_file', args, { file: displayPath, replacements, oldLines: oldLinesArr.length, newLines: newLinesArr.length }, 0);
469
+ return {
470
+ success: true,
471
+ result: JSON.stringify({
472
+ action: 'edited',
473
+ file: displayPath,
474
+ replacements: replacements,
475
+ oldLines: oldLinesArr.length,
476
+ newLines: newLinesArr.length,
477
+ message: replaceAll
478
+ ? `Replaced ${replacements} occurrence(s) in ${displayPath}`
479
+ : `Updated ${displayPath}`,
480
+ diff: diffPreview,
481
+ }),
482
+ };
483
+ } catch (error) {
484
+ const err = error as NodeJS.ErrnoException;
485
+ logger.toolError('edit_file', args, err, 0);
486
+ return {
487
+ success: false,
488
+ error: `File edit failed (${displayPath}): ${err.message}`,
489
+ };
490
+ }
491
+ }
492
+
493
+ /**
494
+ * edit_file LLM Simple Tool
495
+ */
496
+ export const editFileTool: LLMSimpleTool = {
497
+ definition: EDIT_FILE_DEFINITION,
498
+ execute: _executeEditFile,
499
+ categories: ['llm-simple'] as ToolCategory[],
500
+ description: 'Edit an existing file',
501
+ };
502
+
503
+ /**
504
+ * list_files Tool Definition
505
+ */
506
+ const LIST_FILES_DEFINITION: ToolDefinition = {
507
+ type: 'function',
508
+ function: {
509
+ name: 'list_files',
510
+ description: 'List files and folders in a directory.',
511
+ parameters: {
512
+ type: 'object',
513
+ properties: {
514
+ reason: {
515
+ type: 'string',
516
+ description: `A natural, conversational explanation for the user about what you're doing.
517
+ Write as if you're talking to the user directly. Use the same language as the user.
518
+ Examples:
519
+ - "Looking at the folder structure to understand the project"
520
+ - "Checking what files are available"
521
+ - "Seeing what's inside the src folder"
522
+ - "Checking the directory to find related files"`,
523
+ },
524
+ directory_path: {
525
+ type: 'string',
526
+ description: 'Directory path to list (default: current directory)',
527
+ },
528
+ recursive: {
529
+ type: 'boolean',
530
+ description: 'Whether to list subdirectories recursively (default: false)',
531
+ },
532
+ },
533
+ required: ['reason'],
534
+ },
535
+ },
536
+ };
537
+
538
+ /**
539
+ * Get files recursively with safety limits
540
+ */
541
+ async function getFilesRecursively(
542
+ dirPath: string,
543
+ baseDir: string = dirPath,
544
+ depth: number = 0,
545
+ fileCount: { count: number } = { count: 0 }
546
+ ): Promise<Array<{ name: string; type: string; path: string }>> {
547
+ // Safety: depth limit
548
+ if (depth > MAX_DEPTH) {
549
+ return [];
550
+ }
551
+
552
+ // Safety: file count limit
553
+ if (fileCount.count >= MAX_FILES) {
554
+ return [];
555
+ }
556
+
557
+ let entries;
558
+ try {
559
+ entries = await fs.readdir(dirPath, { withFileTypes: true });
560
+ } catch {
561
+ return [];
562
+ }
563
+
564
+ const files: Array<{ name: string; type: string; path: string }> = [];
565
+
566
+ for (const entry of entries) {
567
+ if (fileCount.count >= MAX_FILES) {
568
+ break;
569
+ }
570
+
571
+ // Skip hidden files/directories (starting with .)
572
+ if (entry.name.startsWith('.')) {
573
+ continue;
574
+ }
575
+
576
+ const fullPath = path.join(dirPath, entry.name);
577
+ const relativePath = path.relative(baseDir, fullPath);
578
+
579
+ if (entry.isDirectory()) {
580
+ // Safety: exclude heavy directories
581
+ if (EXCLUDED_DIRS.has(entry.name)) {
582
+ continue;
583
+ }
584
+
585
+ files.push({
586
+ name: entry.name,
587
+ type: 'directory',
588
+ path: relativePath,
589
+ });
590
+ fileCount.count++;
591
+
592
+ // Recursive call with increased depth
593
+ const subFiles = await getFilesRecursively(fullPath, baseDir, depth + 1, fileCount);
594
+ files.push(...subFiles);
595
+ } else {
596
+ files.push({
597
+ name: entry.name,
598
+ type: 'file',
599
+ path: relativePath,
600
+ });
601
+ fileCount.count++;
602
+ }
603
+ }
604
+
605
+ return files;
606
+ }
607
+
608
+ /**
609
+ * Internal: Execute list_files
610
+ */
611
+ async function _executeListFilesInternal(args: Record<string, unknown>): Promise<ToolResult> {
612
+ const directoryPath = (args['directory_path'] as string) || '.';
613
+ const recursive = (args['recursive'] as boolean) || false;
614
+
615
+ logger.toolStart('list_files', { directory_path: directoryPath, recursive });
616
+
617
+ try {
618
+ const resolvedPath = path.resolve(directoryPath);
619
+
620
+ if (recursive) {
621
+ const files = await getFilesRecursively(resolvedPath);
622
+ logger.toolSuccess('list_files', args, { fileCount: files.length }, 0);
623
+ return {
624
+ success: true,
625
+ result: JSON.stringify(files, null, 2),
626
+ };
627
+ } else {
628
+ const entries = await fs.readdir(resolvedPath, { withFileTypes: true });
629
+ const files = entries.map((entry) => ({
630
+ name: entry.name,
631
+ type: entry.isDirectory() ? 'directory' : 'file',
632
+ path: path.join(directoryPath, entry.name),
633
+ }));
634
+
635
+ logger.toolSuccess('list_files', args, { fileCount: files.length }, 0);
636
+ return {
637
+ success: true,
638
+ result: JSON.stringify(files, null, 2),
639
+ };
640
+ }
641
+ } catch (error) {
642
+ const err = error as NodeJS.ErrnoException;
643
+ logger.toolError('list_files', args, err, 0);
644
+ if (err.code === 'ENOENT') {
645
+ return {
646
+ success: false,
647
+ error: `Directory not found: ${directoryPath}`,
648
+ };
649
+ } else {
650
+ return {
651
+ success: false,
652
+ error: `Failed to read directory: ${err.message}`,
653
+ };
654
+ }
655
+ }
656
+ }
657
+
658
+ /**
659
+ * list_files LLM Simple Tool
660
+ */
661
+ export const listFilesTool: LLMSimpleTool = {
662
+ definition: LIST_FILES_DEFINITION,
663
+ execute: _executeListFilesInternal,
664
+ categories: ['llm-simple'] as ToolCategory[],
665
+ description: 'List directory contents',
666
+ };
667
+
668
+ /**
669
+ * find_files Tool Definition
670
+ */
671
+ const FIND_FILES_DEFINITION: ToolDefinition = {
672
+ type: 'function',
673
+ function: {
674
+ name: 'find_files',
675
+ description: 'Search for files by filename pattern.',
676
+ parameters: {
677
+ type: 'object',
678
+ properties: {
679
+ reason: {
680
+ type: 'string',
681
+ description: `A natural, conversational explanation for the user about what you're doing (in user's language).
682
+ Write as if you're talking to the user directly.
683
+ Examples:
684
+ - "Looking for where the config files are located"
685
+ - "Searching for test files"
686
+ - "Checking where TypeScript files are"
687
+ - "Finding related component files"`,
688
+ },
689
+ pattern: {
690
+ type: 'string',
691
+ description: 'Filename pattern to search for (e.g., *.ts, package.json)',
692
+ },
693
+ directory_path: {
694
+ type: 'string',
695
+ description: 'Directory path to start search from (default: current directory)',
696
+ },
697
+ },
698
+ required: ['reason', 'pattern'],
699
+ },
700
+ },
701
+ };
702
+
703
+ /**
704
+ * Find files recursively with safety limits
705
+ */
706
+ async function findFilesRecursively(
707
+ dirPath: string,
708
+ regex: RegExp,
709
+ baseDir: string,
710
+ depth: number = 0,
711
+ fileCount: { count: number } = { count: 0 }
712
+ ): Promise<Array<{ name: string; path: string }>> {
713
+ // Safety: depth limit
714
+ if (depth > MAX_DEPTH) {
715
+ return [];
716
+ }
717
+
718
+ // Safety: file count limit
719
+ if (fileCount.count >= MAX_FILES) {
720
+ return [];
721
+ }
722
+
723
+ let entries;
724
+ try {
725
+ entries = await fs.readdir(dirPath, { withFileTypes: true });
726
+ } catch {
727
+ return [];
728
+ }
729
+
730
+ const matchedFiles: Array<{ name: string; path: string }> = [];
731
+
732
+ for (const entry of entries) {
733
+ if (fileCount.count >= MAX_FILES) {
734
+ break;
735
+ }
736
+
737
+ // Skip hidden files/directories (starting with .)
738
+ if (entry.name.startsWith('.')) {
739
+ continue;
740
+ }
741
+
742
+ const fullPath = path.join(dirPath, entry.name);
743
+
744
+ if (entry.isDirectory()) {
745
+ // Safety: exclude heavy directories
746
+ if (EXCLUDED_DIRS.has(entry.name)) {
747
+ continue;
748
+ }
749
+ // Recursive call with increased depth
750
+ const subFiles = await findFilesRecursively(fullPath, regex, baseDir, depth + 1, fileCount);
751
+ matchedFiles.push(...subFiles);
752
+ } else if (regex.test(entry.name)) {
753
+ const relativePath = path.relative(baseDir, fullPath);
754
+ matchedFiles.push({
755
+ name: entry.name,
756
+ path: relativePath,
757
+ });
758
+ fileCount.count++;
759
+ }
760
+ }
761
+
762
+ return matchedFiles;
763
+ }
764
+
765
+ /**
766
+ * Internal: Execute find_files
767
+ */
768
+ async function _executeFindFilesInternal(args: Record<string, unknown>): Promise<ToolResult> {
769
+ const pattern = args['pattern'] as string;
770
+ const directoryPath = (args['directory_path'] as string) || '.';
771
+
772
+ logger.toolStart('find_files', { pattern, directory_path: directoryPath });
773
+
774
+ try {
775
+ const resolvedPath = path.resolve(directoryPath);
776
+
777
+ // Convert pattern to regex (simple glob support)
778
+ const regexPattern = pattern
779
+ .replace(/\./g, '\\.')
780
+ .replace(/\*/g, '.*')
781
+ .replace(/\?/g, '.');
782
+ const regex = new RegExp(`^${regexPattern}$`);
783
+
784
+ const matchedFiles = await findFilesRecursively(resolvedPath, regex, resolvedPath);
785
+
786
+ if (matchedFiles.length === 0) {
787
+ logger.toolSuccess('find_files', args, { matchCount: 0 }, 0);
788
+ return {
789
+ success: true,
790
+ result: `No files found matching pattern "${pattern}".`,
791
+ };
792
+ }
793
+
794
+ logger.toolSuccess('find_files', args, { matchCount: matchedFiles.length }, 0);
795
+ return {
796
+ success: true,
797
+ result: JSON.stringify(matchedFiles, null, 2),
798
+ };
799
+ } catch (error) {
800
+ const err = error as NodeJS.ErrnoException;
801
+ logger.toolError('find_files', args, err, 0);
802
+ return {
803
+ success: false,
804
+ error: `File search failed: ${err.message}`,
805
+ };
806
+ }
807
+ }
808
+
809
+ /**
810
+ * find_files LLM Simple Tool
811
+ */
812
+ export const findFilesTool: LLMSimpleTool = {
813
+ definition: FIND_FILES_DEFINITION,
814
+ execute: _executeFindFilesInternal,
815
+ categories: ['llm-simple'] as ToolCategory[],
816
+ description: 'Search files by pattern',
817
+ };
818
+
819
+ // =============================================================================
820
+ // search_content Tool
821
+ // =============================================================================
822
+
823
+ const SEARCH_CONTENT_DEFINITION: ToolDefinition = {
824
+ type: 'function',
825
+ function: {
826
+ name: 'search_content',
827
+ description: 'Search for text pattern inside files.',
828
+ parameters: {
829
+ type: 'object',
830
+ properties: {
831
+ reason: {
832
+ type: 'string',
833
+ description: `A natural, conversational explanation for the user about what you're doing.
834
+ Write as if you're talking to the user directly. Use the same language as the user.
835
+ Examples:
836
+ - "Searching for usages of the function"
837
+ - "Finding where the error message is defined"
838
+ - "Looking for references to the API endpoint"`,
839
+ },
840
+ pattern: {
841
+ type: 'string',
842
+ description: 'Text or regex pattern to search for',
843
+ },
844
+ directory_path: {
845
+ type: 'string',
846
+ description: 'Directory path to search in (default: current directory)',
847
+ },
848
+ file_pattern: {
849
+ type: 'string',
850
+ description: 'File pattern to filter (e.g., *.ts)',
851
+ },
852
+ max_results: {
853
+ type: 'number',
854
+ description: 'Maximum number of results (default: 50)',
855
+ },
856
+ },
857
+ required: ['reason', 'pattern'],
858
+ },
859
+ },
860
+ };
861
+
862
+ const TEXT_EXTENSIONS = [
863
+ '.ts', '.tsx', '.js', '.jsx', '.json', '.md', '.txt', '.css', '.scss',
864
+ '.html', '.xml', '.yaml', '.yml', '.toml', '.ini', '.cfg', '.conf',
865
+ '.sh', '.bash', '.ps1', '.py', '.rb', '.go', '.rs', '.java', '.c',
866
+ '.cpp', '.h', '.hpp', '.cs', '.php', '.vue', '.svelte',
867
+ ];
868
+
869
+ async function searchContentRecursively(
870
+ dirPath: string,
871
+ searchRegex: RegExp,
872
+ baseDir: string,
873
+ fileRegex: RegExp | null,
874
+ resultCount: { count: number },
875
+ maxResults: number,
876
+ depth: number = 0
877
+ ): Promise<Array<{ file: string; line: number; content: string }>> {
878
+ if (depth > MAX_DEPTH || resultCount.count >= maxResults) {
879
+ return [];
880
+ }
881
+
882
+ let entries;
883
+ try {
884
+ entries = await fs.readdir(dirPath, { withFileTypes: true });
885
+ } catch {
886
+ return [];
887
+ }
888
+
889
+ const results: Array<{ file: string; line: number; content: string }> = [];
890
+
891
+ for (const entry of entries) {
892
+ if (resultCount.count >= maxResults) break;
893
+
894
+ if (entry.name.startsWith('.')) continue;
895
+
896
+ const fullPath = path.join(dirPath, entry.name);
897
+
898
+ if (entry.isDirectory()) {
899
+ if (EXCLUDED_DIRS.has(entry.name)) continue;
900
+
901
+ const subResults = await searchContentRecursively(
902
+ fullPath, searchRegex, baseDir, fileRegex, resultCount, maxResults, depth + 1
903
+ );
904
+ results.push(...subResults);
905
+ } else {
906
+ if (fileRegex && !fileRegex.test(entry.name)) continue;
907
+
908
+ const ext = path.extname(entry.name).toLowerCase();
909
+ if (!TEXT_EXTENSIONS.includes(ext)) continue;
910
+
911
+ try {
912
+ const content = await fs.readFile(fullPath, 'utf-8');
913
+ const lines = content.split('\n');
914
+ const relativePath = path.relative(baseDir, fullPath);
915
+
916
+ for (let i = 0; i < lines.length && resultCount.count < maxResults; i++) {
917
+ const line = lines[i] ?? '';
918
+ if (searchRegex.test(line)) {
919
+ results.push({
920
+ file: relativePath,
921
+ line: i + 1,
922
+ content: line.trim().substring(0, 200),
923
+ });
924
+ resultCount.count++;
925
+ }
926
+ }
927
+ } catch {
928
+ // Skip files that can't be read
929
+ }
930
+ }
931
+ }
932
+
933
+ return results;
934
+ }
935
+
936
+ async function executeSearchContent(args: Record<string, unknown>): Promise<ToolResult> {
937
+ const pattern = args['pattern'] as string;
938
+ const directoryPath = (args['directory_path'] as string) || '.';
939
+ const filePattern = args['file_pattern'] as string | undefined;
940
+ const maxResults = (args['max_results'] as number) || 50;
941
+
942
+ logger.toolStart('search_content', { pattern, directory_path: directoryPath, file_pattern: filePattern, maxResults });
943
+
944
+ try {
945
+ const resolvedPath = path.isAbsolute(directoryPath) ? directoryPath : path.resolve(process.cwd(), directoryPath);
946
+ const searchRegex = new RegExp(pattern, 'gi');
947
+
948
+ let fileRegex: RegExp | null = null;
949
+ if (filePattern) {
950
+ const regexPattern = filePattern
951
+ .replace(/\./g, '\\.')
952
+ .replace(/\*/g, '.*')
953
+ .replace(/\?/g, '.');
954
+ fileRegex = new RegExp(`^${regexPattern}$`, 'i');
955
+ }
956
+
957
+ const results = await searchContentRecursively(
958
+ resolvedPath, searchRegex, resolvedPath, fileRegex, { count: 0 }, maxResults
959
+ );
960
+
961
+ logger.toolSuccess('search_content', args, { matchedCount: results.length }, 0);
962
+
963
+ if (results.length === 0) {
964
+ return { success: true, result: `No matches found for pattern "${pattern}".` };
965
+ }
966
+
967
+ return { success: true, result: JSON.stringify(results, null, 2) };
968
+ } catch (error) {
969
+ const err = error as NodeJS.ErrnoException;
970
+ logger.toolError('search_content', args, err, 0);
971
+ return { success: false, error: `Content search failed: ${err.message}` };
972
+ }
973
+ }
974
+
975
+ export const searchContentTool: LLMSimpleTool = {
976
+ definition: SEARCH_CONTENT_DEFINITION,
977
+ execute: executeSearchContent,
978
+ categories: ['llm-simple'] as ToolCategory[],
979
+ description: 'Search content in files',
980
+ };
981
+
982
+ /**
983
+ * File operation tools (read, create, edit, list, find, search_content)
984
+ */
985
+ export const FILE_TOOLS: LLMSimpleTool[] = [
986
+ readFileTool,
987
+ createFileTool,
988
+ editFileTool,
989
+ listFilesTool,
990
+ findFilesTool,
991
+ searchContentTool,
992
+ ];
993
+
994
+ /**
995
+ * System utility tools
996
+ *
997
+ * Note: Shell tools (bash/powershell) are now managed separately by platform.
998
+ * Use `getShellTools()` from index.ts for platform-specific shell tools.
999
+ * This array is kept for backward compatibility but is now empty.
1000
+ */
1001
+ export const SYSTEM_TOOLS: LLMSimpleTool[] = [];
1002
+
1003
+ // Re-export user interaction tools
1004
+ export {
1005
+ USER_INTERACTION_TOOLS,
1006
+ tellToUserTool,
1007
+ askToUserTool,
1008
+ setTellToUserCallback,
1009
+ setAskUserCallback,
1010
+ clearAskUserCallback,
1011
+ hasAskUserCallback,
1012
+ type AskUserRequest,
1013
+ type AskUserResponse,
1014
+ type AskUserCallback,
1015
+ } from './user-interaction-tools.js';
1016
+
1017
+ /**
1018
+ * @deprecated Use FILE_TOOLS, USER_INTERACTION_TOOLS, SYSTEM_TOOLS separately
1019
+ */
1020
+ export { FILE_TOOLS as FILE_SIMPLE_TOOLS };
1021
+
1022
+ // Re-export from simple-tool-executor for backward compatibility
1023
+ export {
1024
+ // Callback setters
1025
+ setToolExecutionCallback,
1026
+ setToolResponseCallback,
1027
+ setPlanCreatedCallback,
1028
+ setTodoStartCallback,
1029
+ setTodoCompleteCallback,
1030
+ setTodoFailCallback,
1031
+ setToolApprovalCallback,
1032
+ setCompactCallback,
1033
+ setAssistantResponseCallback,
1034
+ setReasoningCallback,
1035
+ // Callback getters & emitters
1036
+ getToolExecutionCallback,
1037
+ requestToolApproval,
1038
+ emitPlanCreated,
1039
+ emitTodoStart,
1040
+ emitTodoComplete,
1041
+ emitTodoFail,
1042
+ emitCompact,
1043
+ emitAssistantResponse,
1044
+ emitReasoning,
1045
+ // Tool executor
1046
+ executeSimpleTool,
1047
+ executeFileTool,
1048
+ // Types
1049
+ type ToolApprovalResult,
1050
+ } from './simple-tool-executor.js';
1051
+