sema-core 1.0.2

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 (411) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +150 -0
  3. package/dist/constants/config.d.ts +20 -0
  4. package/dist/constants/config.d.ts.map +1 -0
  5. package/dist/constants/config.js +31 -0
  6. package/dist/constants/config.js.map +1 -0
  7. package/dist/constants/message.d.ts +10 -0
  8. package/dist/constants/message.d.ts.map +1 -0
  9. package/dist/constants/message.js +25 -0
  10. package/dist/constants/message.js.map +1 -0
  11. package/dist/constants/product.d.ts +5 -0
  12. package/dist/constants/product.d.ts.map +1 -0
  13. package/dist/constants/product.js +8 -0
  14. package/dist/constants/product.js.map +1 -0
  15. package/dist/core/Conversation.d.ts +16 -0
  16. package/dist/core/Conversation.d.ts.map +1 -0
  17. package/dist/core/Conversation.js +226 -0
  18. package/dist/core/Conversation.js.map +1 -0
  19. package/dist/core/RunTools.d.ts +11 -0
  20. package/dist/core/RunTools.d.ts.map +1 -0
  21. package/dist/core/RunTools.js +244 -0
  22. package/dist/core/RunTools.js.map +1 -0
  23. package/dist/core/SemaCore.d.ts +49 -0
  24. package/dist/core/SemaCore.d.ts.map +1 -0
  25. package/dist/core/SemaCore.js +94 -0
  26. package/dist/core/SemaCore.js.map +1 -0
  27. package/dist/core/SemaEngine.d.ts +54 -0
  28. package/dist/core/SemaEngine.d.ts.map +1 -0
  29. package/dist/core/SemaEngine.js +335 -0
  30. package/dist/core/SemaEngine.js.map +1 -0
  31. package/dist/events/EventSystem.d.ts +42 -0
  32. package/dist/events/EventSystem.d.ts.map +1 -0
  33. package/dist/events/EventSystem.js +134 -0
  34. package/dist/events/EventSystem.js.map +1 -0
  35. package/dist/events/types.d.ts +300 -0
  36. package/dist/events/types.d.ts.map +1 -0
  37. package/dist/events/types.js +4 -0
  38. package/dist/events/types.js.map +1 -0
  39. package/dist/index.d.ts +2 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +6 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/manager/ConfManager.d.ts +76 -0
  44. package/dist/manager/ConfManager.d.ts.map +1 -0
  45. package/dist/manager/ConfManager.js +329 -0
  46. package/dist/manager/ConfManager.js.map +1 -0
  47. package/dist/manager/ModelManager.d.ts +51 -0
  48. package/dist/manager/ModelManager.d.ts.map +1 -0
  49. package/dist/manager/ModelManager.js +291 -0
  50. package/dist/manager/ModelManager.js.map +1 -0
  51. package/dist/manager/PermissionManager.d.ts +16 -0
  52. package/dist/manager/PermissionManager.d.ts.map +1 -0
  53. package/dist/manager/PermissionManager.js +308 -0
  54. package/dist/manager/PermissionManager.js.map +1 -0
  55. package/dist/manager/StateManager.d.ts +164 -0
  56. package/dist/manager/StateManager.d.ts.map +1 -0
  57. package/dist/manager/StateManager.js +357 -0
  58. package/dist/manager/StateManager.js.map +1 -0
  59. package/dist/services/agents/agentsManager.d.ts +112 -0
  60. package/dist/services/agents/agentsManager.d.ts.map +1 -0
  61. package/dist/services/agents/agentsManager.js +394 -0
  62. package/dist/services/agents/agentsManager.js.map +1 -0
  63. package/dist/services/agents/defaultBuiltInAgentsConfs.d.ts +3 -0
  64. package/dist/services/agents/defaultBuiltInAgentsConfs.d.ts.map +1 -0
  65. package/dist/services/agents/defaultBuiltInAgentsConfs.js +102 -0
  66. package/dist/services/agents/defaultBuiltInAgentsConfs.js.map +1 -0
  67. package/dist/services/agents/genSystemPrompt.d.ts +23 -0
  68. package/dist/services/agents/genSystemPrompt.d.ts.map +1 -0
  69. package/dist/services/agents/genSystemPrompt.js +189 -0
  70. package/dist/services/agents/genSystemPrompt.js.map +1 -0
  71. package/dist/services/agents/prompt.d.ts +12 -0
  72. package/dist/services/agents/prompt.d.ts.map +1 -0
  73. package/dist/services/agents/prompt.js +162 -0
  74. package/dist/services/agents/prompt.js.map +1 -0
  75. package/dist/services/api/adapt/anthropic.d.ts +10 -0
  76. package/dist/services/api/adapt/anthropic.d.ts.map +1 -0
  77. package/dist/services/api/adapt/anthropic.js +233 -0
  78. package/dist/services/api/adapt/anthropic.js.map +1 -0
  79. package/dist/services/api/adapt/openai.d.ts +8 -0
  80. package/dist/services/api/adapt/openai.d.ts.map +1 -0
  81. package/dist/services/api/adapt/openai.js +412 -0
  82. package/dist/services/api/adapt/openai.js.map +1 -0
  83. package/dist/services/api/adapt/util.d.ts +7 -0
  84. package/dist/services/api/adapt/util.d.ts.map +1 -0
  85. package/dist/services/api/adapt/util.js +24 -0
  86. package/dist/services/api/adapt/util.js.map +1 -0
  87. package/dist/services/api/apiUtil.d.ts +10 -0
  88. package/dist/services/api/apiUtil.d.ts.map +1 -0
  89. package/dist/services/api/apiUtil.js +256 -0
  90. package/dist/services/api/apiUtil.js.map +1 -0
  91. package/dist/services/api/cache.d.ts +11 -0
  92. package/dist/services/api/cache.d.ts.map +1 -0
  93. package/dist/services/api/cache.js +128 -0
  94. package/dist/services/api/cache.js.map +1 -0
  95. package/dist/services/api/queryLLM.d.ts +18 -0
  96. package/dist/services/api/queryLLM.d.ts.map +1 -0
  97. package/dist/services/api/queryLLM.js +147 -0
  98. package/dist/services/api/queryLLM.js.map +1 -0
  99. package/dist/services/command/runCommand.d.ts +18 -0
  100. package/dist/services/command/runCommand.d.ts.map +1 -0
  101. package/dist/services/command/runCommand.js +149 -0
  102. package/dist/services/command/runCommand.js.map +1 -0
  103. package/dist/services/mcp/MCPClient.d.ts +35 -0
  104. package/dist/services/mcp/MCPClient.d.ts.map +1 -0
  105. package/dist/services/mcp/MCPClient.js +166 -0
  106. package/dist/services/mcp/MCPClient.js.map +1 -0
  107. package/dist/services/mcp/MCPManager.d.ts +140 -0
  108. package/dist/services/mcp/MCPManager.d.ts.map +1 -0
  109. package/dist/services/mcp/MCPManager.js +650 -0
  110. package/dist/services/mcp/MCPManager.js.map +1 -0
  111. package/dist/services/mcp/MCPToolAdapter.d.ts +22 -0
  112. package/dist/services/mcp/MCPToolAdapter.d.ts.map +1 -0
  113. package/dist/services/mcp/MCPToolAdapter.js +177 -0
  114. package/dist/services/mcp/MCPToolAdapter.js.map +1 -0
  115. package/dist/services/plugins/customCommands.d.ts +29 -0
  116. package/dist/services/plugins/customCommands.d.ts.map +1 -0
  117. package/dist/services/plugins/customCommands.js +227 -0
  118. package/dist/services/plugins/customCommands.js.map +1 -0
  119. package/dist/services/skill/skillLoader.d.ts +17 -0
  120. package/dist/services/skill/skillLoader.d.ts.map +1 -0
  121. package/dist/services/skill/skillLoader.js +122 -0
  122. package/dist/services/skill/skillLoader.js.map +1 -0
  123. package/dist/services/skill/skillParser.d.ts +15 -0
  124. package/dist/services/skill/skillParser.d.ts.map +1 -0
  125. package/dist/services/skill/skillParser.js +66 -0
  126. package/dist/services/skill/skillParser.js.map +1 -0
  127. package/dist/services/skill/skillRegistry.d.ts +34 -0
  128. package/dist/services/skill/skillRegistry.d.ts.map +1 -0
  129. package/dist/services/skill/skillRegistry.js +98 -0
  130. package/dist/services/skill/skillRegistry.js.map +1 -0
  131. package/dist/tools/AskUserQuestion/AskUserQuestion.d.ts +179 -0
  132. package/dist/tools/AskUserQuestion/AskUserQuestion.d.ts.map +1 -0
  133. package/dist/tools/AskUserQuestion/AskUserQuestion.js +165 -0
  134. package/dist/tools/AskUserQuestion/AskUserQuestion.js.map +1 -0
  135. package/dist/tools/AskUserQuestion/prompt.d.ts +3 -0
  136. package/dist/tools/AskUserQuestion/prompt.d.ts.map +1 -0
  137. package/dist/tools/AskUserQuestion/prompt.js +17 -0
  138. package/dist/tools/AskUserQuestion/prompt.js.map +1 -0
  139. package/dist/tools/Bash/Bash.d.ts +75 -0
  140. package/dist/tools/Bash/Bash.d.ts.map +1 -0
  141. package/dist/tools/Bash/Bash.js +200 -0
  142. package/dist/tools/Bash/Bash.js.map +1 -0
  143. package/dist/tools/Bash/prompt.d.ts +8 -0
  144. package/dist/tools/Bash/prompt.d.ts.map +1 -0
  145. package/dist/tools/Bash/prompt.js +167 -0
  146. package/dist/tools/Bash/prompt.js.map +1 -0
  147. package/dist/tools/Bash/utils.d.ts +5 -0
  148. package/dist/tools/Bash/utils.d.ts.map +1 -0
  149. package/dist/tools/Bash/utils.js +21 -0
  150. package/dist/tools/Bash/utils.js.map +1 -0
  151. package/dist/tools/Edit/Edit.d.ts +110 -0
  152. package/dist/tools/Edit/Edit.d.ts.map +1 -0
  153. package/dist/tools/Edit/Edit.js +213 -0
  154. package/dist/tools/Edit/Edit.js.map +1 -0
  155. package/dist/tools/Edit/prompt.d.ts +3 -0
  156. package/dist/tools/Edit/prompt.d.ts.map +1 -0
  157. package/dist/tools/Edit/prompt.js +15 -0
  158. package/dist/tools/Edit/prompt.js.map +1 -0
  159. package/dist/tools/Edit/utils.d.ts +10 -0
  160. package/dist/tools/Edit/utils.d.ts.map +1 -0
  161. package/dist/tools/Edit/utils.js +51 -0
  162. package/dist/tools/Edit/utils.js.map +1 -0
  163. package/dist/tools/ExitPlanMode/ExitPlanMode.d.ts +42 -0
  164. package/dist/tools/ExitPlanMode/ExitPlanMode.d.ts.map +1 -0
  165. package/dist/tools/ExitPlanMode/ExitPlanMode.js +157 -0
  166. package/dist/tools/ExitPlanMode/ExitPlanMode.js.map +1 -0
  167. package/dist/tools/ExitPlanMode/prompt.d.ts +3 -0
  168. package/dist/tools/ExitPlanMode/prompt.d.ts.map +1 -0
  169. package/dist/tools/ExitPlanMode/prompt.js +28 -0
  170. package/dist/tools/ExitPlanMode/prompt.js.map +1 -0
  171. package/dist/tools/Glob/Glob.d.ts +44 -0
  172. package/dist/tools/Glob/Glob.d.ts.map +1 -0
  173. package/dist/tools/Glob/Glob.js +113 -0
  174. package/dist/tools/Glob/Glob.js.map +1 -0
  175. package/dist/tools/Glob/prompt.d.ts +3 -0
  176. package/dist/tools/Glob/prompt.d.ts.map +1 -0
  177. package/dist/tools/Glob/prompt.js +11 -0
  178. package/dist/tools/Glob/prompt.js.map +1 -0
  179. package/dist/tools/Grep/Grep.d.ts +106 -0
  180. package/dist/tools/Grep/Grep.d.ts.map +1 -0
  181. package/dist/tools/Grep/Grep.js +301 -0
  182. package/dist/tools/Grep/Grep.js.map +1 -0
  183. package/dist/tools/Grep/prompt.d.ts +3 -0
  184. package/dist/tools/Grep/prompt.d.ts.map +1 -0
  185. package/dist/tools/Grep/prompt.js +17 -0
  186. package/dist/tools/Grep/prompt.js.map +1 -0
  187. package/dist/tools/NotebookEdit/NotebookEdit.d.ts +98 -0
  188. package/dist/tools/NotebookEdit/NotebookEdit.d.ts.map +1 -0
  189. package/dist/tools/NotebookEdit/NotebookEdit.js +228 -0
  190. package/dist/tools/NotebookEdit/NotebookEdit.js.map +1 -0
  191. package/dist/tools/NotebookEdit/prompt.d.ts +3 -0
  192. package/dist/tools/NotebookEdit/prompt.d.ts.map +1 -0
  193. package/dist/tools/NotebookEdit/prompt.js +6 -0
  194. package/dist/tools/NotebookEdit/prompt.js.map +1 -0
  195. package/dist/tools/Read/Read.d.ts +107 -0
  196. package/dist/tools/Read/Read.d.ts.map +1 -0
  197. package/dist/tools/Read/Read.js +175 -0
  198. package/dist/tools/Read/Read.js.map +1 -0
  199. package/dist/tools/Read/prompt.d.ts +4 -0
  200. package/dist/tools/Read/prompt.d.ts.map +1 -0
  201. package/dist/tools/Read/prompt.js +21 -0
  202. package/dist/tools/Read/prompt.js.map +1 -0
  203. package/dist/tools/Skill/Skill.d.ts +62 -0
  204. package/dist/tools/Skill/Skill.d.ts.map +1 -0
  205. package/dist/tools/Skill/Skill.js +142 -0
  206. package/dist/tools/Skill/Skill.js.map +1 -0
  207. package/dist/tools/Skill/prompt.d.ts +3 -0
  208. package/dist/tools/Skill/prompt.d.ts.map +1 -0
  209. package/dist/tools/Skill/prompt.js +58 -0
  210. package/dist/tools/Skill/prompt.js.map +1 -0
  211. package/dist/tools/Task/Task.d.ts +59 -0
  212. package/dist/tools/Task/Task.d.ts.map +1 -0
  213. package/dist/tools/Task/Task.js +213 -0
  214. package/dist/tools/Task/Task.js.map +1 -0
  215. package/dist/tools/Task/prompt.d.ts +6 -0
  216. package/dist/tools/Task/prompt.d.ts.map +1 -0
  217. package/dist/tools/Task/prompt.js +75 -0
  218. package/dist/tools/Task/prompt.js.map +1 -0
  219. package/dist/tools/TodoWrite/TodoWrite.d.ts +92 -0
  220. package/dist/tools/TodoWrite/TodoWrite.d.ts.map +1 -0
  221. package/dist/tools/TodoWrite/TodoWrite.js +101 -0
  222. package/dist/tools/TodoWrite/TodoWrite.js.map +1 -0
  223. package/dist/tools/TodoWrite/prompt.d.ts +3 -0
  224. package/dist/tools/TodoWrite/prompt.d.ts.map +1 -0
  225. package/dist/tools/TodoWrite/prompt.js +187 -0
  226. package/dist/tools/TodoWrite/prompt.js.map +1 -0
  227. package/dist/tools/Write/Write.d.ts +77 -0
  228. package/dist/tools/Write/Write.d.ts.map +1 -0
  229. package/dist/tools/Write/Write.js +189 -0
  230. package/dist/tools/Write/Write.js.map +1 -0
  231. package/dist/tools/Write/prompt.d.ts +3 -0
  232. package/dist/tools/Write/prompt.d.ts.map +1 -0
  233. package/dist/tools/Write/prompt.js +13 -0
  234. package/dist/tools/Write/prompt.js.map +1 -0
  235. package/dist/tools/base/Tool.d.ts +36 -0
  236. package/dist/tools/base/Tool.d.ts.map +1 -0
  237. package/dist/tools/base/Tool.js +3 -0
  238. package/dist/tools/base/Tool.js.map +1 -0
  239. package/dist/tools/base/tools.d.ts +9 -0
  240. package/dist/tools/base/tools.d.ts.map +1 -0
  241. package/dist/tools/base/tools.js +105 -0
  242. package/dist/tools/base/tools.js.map +1 -0
  243. package/dist/types/agent.d.ts +30 -0
  244. package/dist/types/agent.d.ts.map +1 -0
  245. package/dist/types/agent.js +3 -0
  246. package/dist/types/agent.js.map +1 -0
  247. package/dist/types/command.d.ts +44 -0
  248. package/dist/types/command.d.ts.map +1 -0
  249. package/dist/types/command.js +6 -0
  250. package/dist/types/command.js.map +1 -0
  251. package/dist/types/config.d.ts +14 -0
  252. package/dist/types/config.d.ts.map +1 -0
  253. package/dist/types/config.js +3 -0
  254. package/dist/types/config.js.map +1 -0
  255. package/dist/types/errors.d.ts +18 -0
  256. package/dist/types/errors.d.ts.map +1 -0
  257. package/dist/types/errors.js +33 -0
  258. package/dist/types/errors.js.map +1 -0
  259. package/dist/types/index.d.ts +91 -0
  260. package/dist/types/index.d.ts.map +1 -0
  261. package/dist/types/index.js +18 -0
  262. package/dist/types/index.js.map +1 -0
  263. package/dist/types/mcp.d.ts +127 -0
  264. package/dist/types/mcp.d.ts.map +1 -0
  265. package/dist/types/mcp.js +6 -0
  266. package/dist/types/mcp.js.map +1 -0
  267. package/dist/types/message.d.ts +31 -0
  268. package/dist/types/message.d.ts.map +1 -0
  269. package/dist/types/message.js +3 -0
  270. package/dist/types/message.js.map +1 -0
  271. package/dist/types/model.d.ts +21 -0
  272. package/dist/types/model.d.ts.map +1 -0
  273. package/dist/types/model.js +3 -0
  274. package/dist/types/model.js.map +1 -0
  275. package/dist/types/notebook.d.ts +57 -0
  276. package/dist/types/notebook.d.ts.map +1 -0
  277. package/dist/types/notebook.js +3 -0
  278. package/dist/types/notebook.js.map +1 -0
  279. package/dist/types/skill.d.ts +34 -0
  280. package/dist/types/skill.d.ts.map +1 -0
  281. package/dist/types/skill.js +8 -0
  282. package/dist/types/skill.js.map +1 -0
  283. package/dist/types/uuid.d.ts +2 -0
  284. package/dist/types/uuid.d.ts.map +1 -0
  285. package/dist/types/uuid.js +3 -0
  286. package/dist/types/uuid.js.map +1 -0
  287. package/dist/util/adapter.d.ts +11 -0
  288. package/dist/util/adapter.d.ts.map +1 -0
  289. package/dist/util/adapter.js +75 -0
  290. package/dist/util/adapter.js.map +1 -0
  291. package/dist/util/agentStats.d.ts +11 -0
  292. package/dist/util/agentStats.d.ts.map +1 -0
  293. package/dist/util/agentStats.js +60 -0
  294. package/dist/util/agentStats.js.map +1 -0
  295. package/dist/util/cacheLLM.d.ts +47 -0
  296. package/dist/util/cacheLLM.d.ts.map +1 -0
  297. package/dist/util/cacheLLM.js +154 -0
  298. package/dist/util/cacheLLM.js.map +1 -0
  299. package/dist/util/commands.d.ts +16 -0
  300. package/dist/util/commands.d.ts.map +1 -0
  301. package/dist/util/commands.js +216 -0
  302. package/dist/util/commands.js.map +1 -0
  303. package/dist/util/compact.d.ts +25 -0
  304. package/dist/util/compact.d.ts.map +1 -0
  305. package/dist/util/compact.js +451 -0
  306. package/dist/util/compact.js.map +1 -0
  307. package/dist/util/cwd.d.ts +44 -0
  308. package/dist/util/cwd.d.ts.map +1 -0
  309. package/dist/util/cwd.js +84 -0
  310. package/dist/util/cwd.js.map +1 -0
  311. package/dist/util/diff.d.ts +10 -0
  312. package/dist/util/diff.d.ts.map +1 -0
  313. package/dist/util/diff.js +127 -0
  314. package/dist/util/diff.js.map +1 -0
  315. package/dist/util/directory.d.ts +37 -0
  316. package/dist/util/directory.d.ts.map +1 -0
  317. package/dist/util/directory.js +137 -0
  318. package/dist/util/directory.js.map +1 -0
  319. package/dist/util/env.d.ts +5 -0
  320. package/dist/util/env.d.ts.map +1 -0
  321. package/dist/util/env.js +39 -0
  322. package/dist/util/env.js.map +1 -0
  323. package/dist/util/exec.d.ts +6 -0
  324. package/dist/util/exec.d.ts.map +1 -0
  325. package/dist/util/exec.js +43 -0
  326. package/dist/util/exec.js.map +1 -0
  327. package/dist/util/file.d.ts +61 -0
  328. package/dist/util/file.d.ts.map +1 -0
  329. package/dist/util/file.js +365 -0
  330. package/dist/util/file.js.map +1 -0
  331. package/dist/util/filePermission.d.ts +14 -0
  332. package/dist/util/filePermission.d.ts.map +1 -0
  333. package/dist/util/filePermission.js +45 -0
  334. package/dist/util/filePermission.js.map +1 -0
  335. package/dist/util/fileReference.d.ts +40 -0
  336. package/dist/util/fileReference.d.ts.map +1 -0
  337. package/dist/util/fileReference.js +343 -0
  338. package/dist/util/fileReference.js.map +1 -0
  339. package/dist/util/format.d.ts +9 -0
  340. package/dist/util/format.d.ts.map +1 -0
  341. package/dist/util/format.js +61 -0
  342. package/dist/util/format.js.map +1 -0
  343. package/dist/util/frontmatter.d.ts +35 -0
  344. package/dist/util/frontmatter.d.ts.map +1 -0
  345. package/dist/util/frontmatter.js +119 -0
  346. package/dist/util/frontmatter.js.map +1 -0
  347. package/dist/util/git.d.ts +4 -0
  348. package/dist/util/git.d.ts.map +1 -0
  349. package/dist/util/git.js +55 -0
  350. package/dist/util/git.js.map +1 -0
  351. package/dist/util/history.d.ts +27 -0
  352. package/dist/util/history.d.ts.map +1 -0
  353. package/dist/util/history.js +248 -0
  354. package/dist/util/history.js.map +1 -0
  355. package/dist/util/log.d.ts +23 -0
  356. package/dist/util/log.d.ts.map +1 -0
  357. package/dist/util/log.js +246 -0
  358. package/dist/util/log.js.map +1 -0
  359. package/dist/util/logLLM.d.ts +20 -0
  360. package/dist/util/logLLM.d.ts.map +1 -0
  361. package/dist/util/logLLM.js +414 -0
  362. package/dist/util/logLLM.js.map +1 -0
  363. package/dist/util/message.d.ts +12 -0
  364. package/dist/util/message.d.ts.map +1 -0
  365. package/dist/util/message.js +156 -0
  366. package/dist/util/message.js.map +1 -0
  367. package/dist/util/model.d.ts +22 -0
  368. package/dist/util/model.d.ts.map +1 -0
  369. package/dist/util/model.js +61 -0
  370. package/dist/util/model.js.map +1 -0
  371. package/dist/util/notebook.d.ts +14 -0
  372. package/dist/util/notebook.d.ts.map +1 -0
  373. package/dist/util/notebook.js +104 -0
  374. package/dist/util/notebook.js.map +1 -0
  375. package/dist/util/ripgrep.d.ts +3 -0
  376. package/dist/util/ripgrep.d.ts.map +1 -0
  377. package/dist/util/ripgrep.js +187 -0
  378. package/dist/util/ripgrep.js.map +1 -0
  379. package/dist/util/rules.d.ts +6 -0
  380. package/dist/util/rules.d.ts.map +1 -0
  381. package/dist/util/rules.js +111 -0
  382. package/dist/util/rules.js.map +1 -0
  383. package/dist/util/savePath.d.ts +73 -0
  384. package/dist/util/savePath.d.ts.map +1 -0
  385. package/dist/util/savePath.js +189 -0
  386. package/dist/util/savePath.js.map +1 -0
  387. package/dist/util/secureFile.d.ts +136 -0
  388. package/dist/util/secureFile.d.ts.map +1 -0
  389. package/dist/util/secureFile.js +496 -0
  390. package/dist/util/secureFile.js.map +1 -0
  391. package/dist/util/session.d.ts +37 -0
  392. package/dist/util/session.d.ts.map +1 -0
  393. package/dist/util/session.js +120 -0
  394. package/dist/util/session.js.map +1 -0
  395. package/dist/util/shell.d.ts +40 -0
  396. package/dist/util/shell.d.ts.map +1 -0
  397. package/dist/util/shell.js +876 -0
  398. package/dist/util/shell.js.map +1 -0
  399. package/dist/util/time.d.ts +24 -0
  400. package/dist/util/time.d.ts.map +1 -0
  401. package/dist/util/time.js +53 -0
  402. package/dist/util/time.js.map +1 -0
  403. package/dist/util/tokens.d.ts +9 -0
  404. package/dist/util/tokens.d.ts.map +1 -0
  405. package/dist/util/tokens.js +79 -0
  406. package/dist/util/tokens.js.map +1 -0
  407. package/dist/util/topic.d.ts +9 -0
  408. package/dist/util/topic.d.ts.map +1 -0
  409. package/dist/util/topic.js +52 -0
  410. package/dist/util/topic.js.map +1 -0
  411. package/package.json +83 -0
@@ -0,0 +1,75 @@
1
+ import { z } from 'zod';
2
+ import { ValidationResult } from '../base/Tool';
3
+ export declare const inputSchema: z.ZodObject<{
4
+ command: z.ZodString;
5
+ timeout: z.ZodOptional<z.ZodNumber>;
6
+ description: z.ZodString;
7
+ }, "strict", z.ZodTypeAny, {
8
+ command: string;
9
+ description: string;
10
+ timeout?: number | undefined;
11
+ }, {
12
+ command: string;
13
+ description: string;
14
+ timeout?: number | undefined;
15
+ }>;
16
+ export type Out = {
17
+ stdout: string;
18
+ stdoutLines: number;
19
+ stderr: string;
20
+ stderrLines: number;
21
+ interrupted: boolean;
22
+ command?: string;
23
+ };
24
+ export declare const BashTool: {
25
+ name: string;
26
+ description(): string;
27
+ isReadOnly(): false;
28
+ inputSchema: z.ZodObject<{
29
+ command: z.ZodString;
30
+ timeout: z.ZodOptional<z.ZodNumber>;
31
+ description: z.ZodString;
32
+ }, "strict", z.ZodTypeAny, {
33
+ command: string;
34
+ description: string;
35
+ timeout?: number | undefined;
36
+ }, {
37
+ command: string;
38
+ description: string;
39
+ timeout?: number | undefined;
40
+ }>;
41
+ validateInput({ command }: {
42
+ command: string;
43
+ description: string;
44
+ timeout?: number | undefined;
45
+ }, agentContext: any): Promise<ValidationResult>;
46
+ genToolPermission(input: {
47
+ command: string;
48
+ description: string;
49
+ timeout?: number | undefined;
50
+ }): {
51
+ title: string;
52
+ content: string;
53
+ };
54
+ genToolResultMessage({ stdout, stdoutLines, stderr, stderrLines, interrupted, command }: Out): {
55
+ title: string;
56
+ summary: string;
57
+ content: string;
58
+ };
59
+ getDisplayTitle(input: {
60
+ command: string;
61
+ description: string;
62
+ timeout?: number | undefined;
63
+ } | undefined): string;
64
+ genResultForAssistant({ interrupted, stdout, stderr }: Out): string;
65
+ call({ command, timeout }: {
66
+ command: string;
67
+ description: string;
68
+ timeout?: number | undefined;
69
+ }, agentContext: any): AsyncGenerator<{
70
+ type: "result";
71
+ data: Out;
72
+ resultForAssistant: string;
73
+ }, void, unknown>;
74
+ };
75
+ //# sourceMappingURL=Bash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Bash.d.ts","sourceRoot":"","sources":["../../../src/tools/Bash/Bash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAQ,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAoBrD,eAAO,MAAM,WAAW;;;;;;;;;;;;EAkBtB,CAAA;AAGF,MAAM,MAAM,GAAG,GAAG;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,OAAO,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;qBAS4B,GAAG,GAAG,OAAO,CAAC,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;iEAuFtB,MAAM;;;;;qBAW9C,GAAG;;;;;CAmFI,CAAA"}
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BashTool = exports.inputSchema = void 0;
4
+ const os_1 = require("os");
5
+ const path_1 = require("path");
6
+ const zod_1 = require("zod");
7
+ const commands_1 = require("../../util/commands");
8
+ const file_1 = require("../../util/file");
9
+ const shell_1 = require("../../util/shell");
10
+ const cwd_1 = require("../../util/cwd");
11
+ const format_1 = require("../../util/format");
12
+ const prompt_1 = require("./prompt");
13
+ const utils_1 = require("./utils");
14
+ const MAX_COMMAND_TITLE_LENGTH = 300;
15
+ // 辅助函数:生成显示标题
16
+ function getTitle(input) {
17
+ if (input?.command) {
18
+ const content = (0, format_1.processHeredocCommand)(input.command);
19
+ return `${content}`;
20
+ }
21
+ return prompt_1.TOOL_NAME_FOR_PROMPT;
22
+ }
23
+ exports.inputSchema = zod_1.z.strictObject({
24
+ command: zod_1.z.string().describe('The command to execute'),
25
+ timeout: zod_1.z
26
+ .number()
27
+ .optional()
28
+ .describe(`Optional timeout in milliseconds (max ${prompt_1.MAX_TIMEOUT_MS})`),
29
+ description: zod_1.z.string().describe(`Clear, concise description of what this command does in 5-10 words, in active voice. Examples:
30
+ Input: ls
31
+ Output: List files in current directory
32
+
33
+ Input: git status
34
+ Output: Show working tree status
35
+
36
+ Input: npm install
37
+ Output: Install package dependencies
38
+
39
+ Input: mkdir foo
40
+ Output: Create directory 'foo'`)
41
+ });
42
+ exports.BashTool = {
43
+ name: prompt_1.TOOL_NAME_FOR_PROMPT,
44
+ description() {
45
+ return prompt_1.DESCRIPTION;
46
+ },
47
+ isReadOnly() {
48
+ return false;
49
+ },
50
+ inputSchema: exports.inputSchema,
51
+ async validateInput({ command }, agentContext) {
52
+ const commands = (0, commands_1.splitCommand)(command);
53
+ for (const cmd of commands) {
54
+ const parts = cmd.split(' ');
55
+ const baseCmd = parts[0];
56
+ if (baseCmd && prompt_1.BANNED_COMMANDS.includes(baseCmd.toLowerCase())) {
57
+ return {
58
+ result: false,
59
+ message: `Command '${baseCmd}' is not allowed for security reasons`,
60
+ };
61
+ }
62
+ if (baseCmd === 'cd' && parts[1]) {
63
+ const targetDir = parts[1].replace(/^['"]|['"]$/g, '');
64
+ const fullTargetDir = (0, path_1.isAbsolute)(targetDir)
65
+ ? targetDir
66
+ : (0, path_1.resolve)((0, cwd_1.getCwd)(), targetDir);
67
+ if (!(0, file_1.isInDirectory)((0, path_1.relative)((0, cwd_1.getOriginalCwd)(), fullTargetDir), (0, path_1.relative)((0, cwd_1.getCwd)(), (0, cwd_1.getOriginalCwd)()))) {
68
+ return {
69
+ result: false,
70
+ message: `ERROR: cd to '${fullTargetDir}' was blocked. For security, agent may only change directories to child directories of the original working directory (${(0, cwd_1.getOriginalCwd)()}) for this session.`,
71
+ };
72
+ }
73
+ }
74
+ }
75
+ return { result: true };
76
+ },
77
+ genToolPermission(input) {
78
+ const title = getTitle(input);
79
+ return {
80
+ title,
81
+ content: input.description
82
+ };
83
+ },
84
+ genToolResultMessage({ stdout, stdoutLines, stderr, stderrLines, interrupted, command }) {
85
+ function genTruncatedContent(content, totalLines) {
86
+ const allLines = content.split('\n');
87
+ if (allLines.length <= prompt_1.MAX_RENDERED_LINES) {
88
+ return allLines.join('\n');
89
+ }
90
+ const lastLines = allLines.slice(-prompt_1.MAX_RENDERED_LINES);
91
+ return [
92
+ `Showing last ${prompt_1.MAX_RENDERED_LINES} lines of ${totalLines} total lines`,
93
+ ...lastLines,
94
+ ].join('\n');
95
+ }
96
+ let result = '';
97
+ if (stdout !== '') {
98
+ const formattedContent = genTruncatedContent(stdout.trim(), stdoutLines);
99
+ result += formattedContent + '\n';
100
+ }
101
+ if (stderr !== '') {
102
+ const formattedContent = genTruncatedContent(stderr.trim(), stderrLines);
103
+ result += formattedContent + '\n';
104
+ }
105
+ if (stdout === '' && stderr === '') {
106
+ result = '(No content)';
107
+ }
108
+ let commandDisplay = command || '';
109
+ if (commandDisplay.length > MAX_COMMAND_TITLE_LENGTH) {
110
+ commandDisplay = commandDisplay.substring(0, MAX_COMMAND_TITLE_LENGTH - 3) + '...';
111
+ }
112
+ const title = `${commandDisplay}`;
113
+ return {
114
+ title,
115
+ summary: '',
116
+ content: result.trim()
117
+ };
118
+ },
119
+ getDisplayTitle(input) {
120
+ return getTitle(input);
121
+ },
122
+ genResultForAssistant({ interrupted, stdout, stderr }) {
123
+ let errorMessage = stderr.trim();
124
+ if (interrupted) {
125
+ if (stderr)
126
+ errorMessage += os_1.EOL;
127
+ errorMessage += '<error>Command was aborted before completion</error>';
128
+ }
129
+ const hasBoth = stdout.trim() && errorMessage;
130
+ return `${stdout.trim()}${hasBoth ? '\n' : ''}${errorMessage.trim()}`;
131
+ },
132
+ async *call({ command, timeout = prompt_1.DEFAULT_TIMEOUT_MS }, agentContext) {
133
+ let stdout = '';
134
+ let stderr = '';
135
+ const abortController = agentContext.abortController;
136
+ if (abortController?.signal.aborted) {
137
+ const data = {
138
+ stdout: '',
139
+ stdoutLines: 0,
140
+ stderr: 'Command cancelled before execution',
141
+ stderrLines: 1,
142
+ interrupted: true,
143
+ command,
144
+ };
145
+ yield {
146
+ type: 'result',
147
+ data,
148
+ resultForAssistant: this.genResultForAssistant(data),
149
+ };
150
+ return;
151
+ }
152
+ try {
153
+ const result = await shell_1.PersistentShell.getInstance().exec(command, abortController?.signal, timeout);
154
+ stdout += (result.stdout || '').trim() + os_1.EOL;
155
+ stderr += (result.stderr || '').trim() + os_1.EOL;
156
+ if (result.code !== 0) {
157
+ stderr += `Exit code ${result.code}`;
158
+ }
159
+ if (!(0, file_1.isInDirectory)((0, cwd_1.getCwd)(), (0, cwd_1.getOriginalCwd)())) {
160
+ await shell_1.PersistentShell.getInstance().setCwd((0, cwd_1.getOriginalCwd)());
161
+ stderr = `${stderr.trim()}${os_1.EOL}Shell cwd was reset to ${(0, cwd_1.getOriginalCwd)()}`;
162
+ }
163
+ const { totalLines: stdoutLines, truncatedContent: stdoutContent } = (0, utils_1.formatOutput)(stdout.trim());
164
+ const { totalLines: stderrLines, truncatedContent: stderrContent } = (0, utils_1.formatOutput)(stderr.trim());
165
+ const data = {
166
+ stdout: stdoutContent,
167
+ stdoutLines,
168
+ stderr: stderrContent,
169
+ stderrLines,
170
+ interrupted: result.interrupted,
171
+ command,
172
+ };
173
+ yield {
174
+ type: 'result',
175
+ data,
176
+ resultForAssistant: this.genResultForAssistant(data),
177
+ };
178
+ }
179
+ catch (error) {
180
+ const isAborted = abortController?.signal.aborted ?? false;
181
+ const errorMessage = isAborted
182
+ ? 'Command was cancelled by user'
183
+ : `Command failed: ${error instanceof Error ? error.message : String(error)}`;
184
+ const data = {
185
+ stdout: stdout.trim(),
186
+ stdoutLines: stdout.split('\n').length,
187
+ stderr: errorMessage,
188
+ stderrLines: 1,
189
+ interrupted: isAborted,
190
+ command,
191
+ };
192
+ yield {
193
+ type: 'result',
194
+ data,
195
+ resultForAssistant: this.genResultForAssistant(data),
196
+ };
197
+ }
198
+ },
199
+ };
200
+ //# sourceMappingURL=Bash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Bash.js","sourceRoot":"","sources":["../../../src/tools/Bash/Bash.ts"],"names":[],"mappings":";;;AAAA,2BAAwB;AACxB,+BAAoD;AACpD,6BAAuB;AAEvB,kDAAkD;AAClD,0CAA+C;AAC/C,4CAAkD;AAClD,wCAAuD;AACvD,8CAAyD;AACzD,qCAAqI;AACrI,mCAAsC;AAEtC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AAEpC,cAAc;AACd,SAAS,QAAQ,CAAC,KAA4B;IAC5C,IAAI,KAAK,EAAE,OAAO,EAAE,CAAC;QACnB,MAAM,OAAO,GAAG,IAAA,8BAAqB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACpD,OAAO,GAAG,OAAO,EAAE,CAAA;IACrB,CAAC;IACD,OAAO,6BAAoB,CAAA;AAC7B,CAAC;AAE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,CAAC,CAAC,MAAM;gBACtC,MAAM,EAAE,YAAY;gBACpB,WAAW,EAAE,CAAC;gBACd,WAAW,EAAE,SAAS;gBACtB,OAAO;aACR,CAAA;YAED,MAAM;gBACJ,IAAI,EAAE,QAAQ;gBACd,IAAI;gBACJ,kBAAkB,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC;aACrD,CAAA;QACH,CAAC;IACH,CAAC;CACsB,CAAA"}
@@ -0,0 +1,8 @@
1
+ export declare const MAX_OUTPUT_LENGTH = 30000;
2
+ export declare const MAX_TIMEOUT_MS = 180000;
3
+ export declare const DEFAULT_TIMEOUT_MS = 60000;
4
+ export declare const MAX_RENDERED_LINES = 10;
5
+ export declare const BANNED_COMMANDS: string[];
6
+ export declare const TOOL_NAME_FOR_PROMPT = "Bash";
7
+ export declare const DESCRIPTION: string;
8
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/tools/Bash/prompt.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB,QAAQ,CAAA;AACtC,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AACxC,eAAO,MAAM,kBAAkB,KAAK,CAAA;AACpC,eAAO,MAAM,eAAe,UAkB3B,CAAA;AAED,eAAO,MAAM,oBAAoB,SAAS,CAAA;AAE1C,eAAO,MAAM,WAAW,EAAE,MAkI8C,CAAA"}
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DESCRIPTION = exports.TOOL_NAME_FOR_PROMPT = exports.BANNED_COMMANDS = exports.MAX_RENDERED_LINES = exports.DEFAULT_TIMEOUT_MS = exports.MAX_TIMEOUT_MS = exports.MAX_OUTPUT_LENGTH = void 0;
4
+ const product_1 = require("../../constants/product");
5
+ const prompt_1 = require("../Read/prompt");
6
+ const prompt_2 = require("../Edit/prompt");
7
+ const prompt_3 = require("../Write/prompt");
8
+ const prompt_4 = require("../Task/prompt");
9
+ const prompt_5 = require("../Glob/prompt");
10
+ const prompt_6 = require("../Grep/prompt");
11
+ const prompt_7 = require("../TodoWrite/prompt");
12
+ exports.MAX_OUTPUT_LENGTH = 30000;
13
+ exports.MAX_TIMEOUT_MS = 180000; // 最大超时毫秒数 3分钟
14
+ exports.DEFAULT_TIMEOUT_MS = 60000; // 默认超时毫秒数 1分钟
15
+ exports.MAX_RENDERED_LINES = 10;
16
+ exports.BANNED_COMMANDS = [
17
+ 'alias',
18
+ 'curl',
19
+ 'curlie',
20
+ 'wget',
21
+ 'axel',
22
+ 'aria2c',
23
+ 'nc',
24
+ 'telnet',
25
+ 'lynx',
26
+ 'w3m',
27
+ 'links',
28
+ 'httpie',
29
+ 'xh',
30
+ 'http-prompt',
31
+ 'chrome',
32
+ 'firefox',
33
+ 'safari',
34
+ ];
35
+ exports.TOOL_NAME_FOR_PROMPT = 'Bash';
36
+ exports.DESCRIPTION = `Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
37
+
38
+ IMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized tools for this instead.
39
+
40
+ Before executing the command, please follow these steps:
41
+
42
+ 1. Directory Verification:
43
+ - If the command will create new directories or files, first use \`ls\` to verify the parent directory exists and is the correct location
44
+ - For example, before running "mkdir foo/bar", first use \`ls foo\` to check that "foo" exists and is the intended parent directory
45
+
46
+ 2. Command Execution:
47
+ - Always quote file paths that contain spaces with double quotes (e.g., cd "path with spaces/file.txt")
48
+ - Examples of proper quoting:
49
+ - cd "/Users/name/My Documents" (correct)
50
+ - cd /Users/name/My Documents (incorrect - will fail)
51
+ - python "/path/with spaces/script.py" (correct)
52
+ - python /path/with spaces/script.py (incorrect - will fail)
53
+ - After ensuring proper quoting, execute the command.
54
+ - Capture the output of the command.
55
+
56
+ Usage notes:
57
+ - The command argument is required.
58
+ - You can specify an optional timeout in milliseconds (up to ${exports.MAX_TIMEOUT_MS}ms / ${exports.MAX_TIMEOUT_MS / 60000}minutes). If not specified, commands will timeout after ${exports.DEFAULT_TIMEOUT_MS}ms (${exports.DEFAULT_TIMEOUT_MS / 60000} minutes).
59
+ - It is very helpful if you write a clear, concise description of what this command does in 5-10 words.
60
+ - If the output exceeds ${exports.MAX_OUTPUT_LENGTH} characters, output will be truncated before being returned to you.
61
+
62
+ - Avoid using Bash with the \`find\`, \`grep\`, \`cat\`, \`head\`, \`tail\`, \`sed\`, \`awk\`, or \`echo\` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
63
+ - File search: Use ${prompt_5.TOOL_NAME_FOR_PROMPT} (NOT find or ls)
64
+ - Content search: Use ${prompt_6.TOOL_NAME_FOR_PROMPT} (NOT grep or rg)
65
+ - Read files: Use ${prompt_1.TOOL_NAME_FOR_PROMPT} (NOT cat/head/tail)
66
+ - Edit files: Use ${prompt_2.TOOL_NAME_FOR_PROMPT} (NOT sed/awk)
67
+ - Write files: Use ${prompt_3.TOOL_NAME_FOR_PROMPT} (NOT echo >/cat <<EOF)
68
+ - Communication: Output text directly (NOT echo/printf)
69
+ - When issuing multiple commands:
70
+ - If the commands are independent and can run in parallel, make multiple Bash tool calls in a single message. For example, if you need to run "git status" and "git diff", send a single message with two Bash tool calls in parallel.
71
+ - If the commands depend on each other and must run sequentially, use a single Bash call with '&&' to chain them together (e.g., \`git add . && git commit -m "message" && git push\`). For instance, if one operation must complete before another starts (like mkdir before cp, Write before Bash for git operations, or git add before git commit), run these operations sequentially instead.
72
+ - Use ';' only when you need to run commands sequentially but don't care if earlier commands fail
73
+ - DO NOT use newlines to separate commands (newlines are ok in quoted strings)
74
+ - Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of \`cd\`. You may use \`cd\` if the User explicitly requests it.
75
+ <good-example>
76
+ pytest /foo/bar/tests
77
+ </good-example>
78
+ <bad-example>
79
+ cd /foo/bar && pytest tests
80
+ </bad-example>
81
+
82
+ # Committing changes with git
83
+
84
+ Only create commits when requested by the user. If unclear, ask first. When the user asks you to create a new git commit, follow these steps carefully:
85
+
86
+ Git Safety Protocol:
87
+ - NEVER update the git config
88
+ - NEVER run destructive/irreversible git commands (like push --force, hard reset, etc) unless the user explicitly requests them
89
+ - NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
90
+ - NEVER run force push to main/master, warn the user if they request it
91
+ - Avoid git commit --amend. ONLY use --amend when either (1) user explicitly requested amend OR (2) adding edits from pre-commit hook (additional instructions below)
92
+ - Before amending: ALWAYS check authorship (git log -1 --format='%an %ae')
93
+ - NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.
94
+
95
+ 1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel, each using the Bash tool:
96
+ - Run a git status command to see all untracked files.
97
+ - Run a git diff command to see both staged and unstaged changes that will be committed.
98
+ - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.
99
+ 2. Analyze all staged changes (both previously staged and newly added) and draft a commit message:
100
+ - Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.). Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.).
101
+ - Do not commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request to commit those files
102
+ - Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
103
+ - Ensure it accurately reflects the changes and their purpose
104
+ 3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands:
105
+ - Add relevant untracked files to the staging area.
106
+ - Create the commit with a message ending with:
107
+ 🤖 Generated with [${product_1.PRODUCT_NAME}](${product_1.PRODUCT_URL})
108
+
109
+ - Run git status after the commit completes to verify success.
110
+ Note: git status depends on the commit completing, so run it sequentially after the commit.
111
+ 4. If the commit fails due to pre-commit hook changes, retry ONCE. If it succeeds but files were modified by the hook, verify it's safe to amend:
112
+ - Check authorship: git log -1 --format='%an %ae'
113
+ - Check not pushed: git status shows "Your branch is ahead"
114
+ - If both true: amend your commit. Otherwise: create NEW commit (never amend other developers' commits)
115
+
116
+ Important notes:
117
+ - NEVER run additional commands to read or explore code, besides git bash commands
118
+ - NEVER use the ${prompt_7.TOOL_NAME_FOR_PROMPT} or ${prompt_4.TOOL_NAME_FOR_PROMPT} tools
119
+ - DO NOT push to the remote repository unless the user explicitly asks you to do so
120
+ - IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
121
+ - If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
122
+ - In order to ensure good formatting, ALWAYS pass the commit message via a HEREDOC, a la this example:
123
+ <example>
124
+ git commit -m "$(cat <<'EOF'
125
+ Commit message here.
126
+
127
+ 🤖 Generated with [${product_1.PRODUCT_NAME}](${product_1.PRODUCT_URL})
128
+
129
+ EOF
130
+ )"
131
+ </example>
132
+
133
+ # Creating pull requests
134
+ Use the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.
135
+
136
+ IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:
137
+
138
+ 1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from the main branch:
139
+ - Run a git status command to see all untracked files
140
+ - Run a git diff command to see both staged and unstaged changes that will be committed
141
+ - Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
142
+ - Run a git log command and \`git diff [base-branch]...HEAD\` to understand the full commit history for the current branch (from the time it diverged from the base branch)
143
+ 2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary
144
+ 3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands in parallel:
145
+ - Create new branch if needed
146
+ - Push to remote with -u flag if needed
147
+ - Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.
148
+ <example>
149
+ gh pr create --title "the pr title" --body "$(cat <<'EOF'
150
+ ## Summary
151
+ <1-3 bullet points>
152
+
153
+ ## Test plan
154
+ [Bulleted markdown checklist of TODOs for testing the pull request...]
155
+
156
+ 🤖 Generated with [${product_1.PRODUCT_NAME}](${product_1.PRODUCT_URL})
157
+ EOF
158
+ )"
159
+ </example>
160
+
161
+ Important:
162
+ - DO NOT use the ${prompt_7.TOOL_NAME_FOR_PROMPT} or ${prompt_4.TOOL_NAME_FOR_PROMPT} tools
163
+ - Return the PR URL when you're done, so the user can see it
164
+
165
+ # Other common operations
166
+ - View comments on a Github PR: gh api repos/foo/bar/pulls/123/comments`;
167
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/tools/Bash/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAAmE;AAEnE,2CAAuE;AACvE,2CAAuE;AACvE,4CAAyE;AACzE,2CAAuE;AACvE,2CAAuE;AACvE,2CAAuE;AACvE,gDAA6E;AAEhE,QAAA,iBAAiB,GAAG,KAAK,CAAA;AACzB,QAAA,cAAc,GAAG,MAAM,CAAC,CAAC,cAAc;AACvC,QAAA,kBAAkB,GAAG,KAAK,CAAC,CAAC,cAAc;AAC1C,QAAA,kBAAkB,GAAG,EAAE,CAAA;AACvB,QAAA,eAAe,GAAG;IAC7B,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,QAAQ;IACR,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,KAAK;IACL,OAAO;IACP,QAAQ;IACR,IAAI;IACJ,aAAa;IACb,QAAQ;IACR,SAAS;IACT,QAAQ;CACT,CAAA;AAEY,QAAA,oBAAoB,GAAG,MAAM,CAAA;AAE7B,QAAA,WAAW,GAAW;;;;;;;;;;;;;;;;;;;;;;iEAsB8B,sBAAc,QAAQ,sBAAc,GAAG,KAAK,2DAA2D,0BAAkB,OAAO,0BAAkB,GAAG,KAAK;;4BAE/L,yBAAiB;;;yBAGpB,6BAAc;4BACX,6BAAc;wBAClB,6BAAc;wBACd,6BAAc;yBACb,6BAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwChB,sBAAY,KAAK,qBAAW;;;;;;;;;;;kBAWlC,6BAAe,OAAO,6BAAc;;;;;;;;;wBAS9B,sBAAY,KAAK,qBAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA6B/B,sBAAY,KAAK,qBAAW;;;;;;mBAM9B,6BAAe,OAAO,6BAAc;;;;wEAIiB,CAAA"}
@@ -0,0 +1,5 @@
1
+ export declare function formatOutput(content: string): {
2
+ totalLines: number;
3
+ truncatedContent: string;
4
+ };
5
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tools/Bash/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG;IAC7C,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAgBA"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatOutput = formatOutput;
4
+ const prompt_1 = require("./prompt");
5
+ function formatOutput(content) {
6
+ if (content.length <= prompt_1.MAX_OUTPUT_LENGTH) {
7
+ return {
8
+ totalLines: content.split('\n').length,
9
+ truncatedContent: content,
10
+ };
11
+ }
12
+ const halfLength = prompt_1.MAX_OUTPUT_LENGTH / 2;
13
+ const start = content.slice(0, halfLength);
14
+ const end = content.slice(-halfLength);
15
+ const truncated = `${start}\n\n... [${content.slice(halfLength, -halfLength).split('\n').length} lines truncated] ...\n\n${end}`;
16
+ return {
17
+ totalLines: content.split('\n').length,
18
+ truncatedContent: truncated,
19
+ };
20
+ }
21
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/tools/Bash/utils.ts"],"names":[],"mappings":";;AAEA,oCAmBC;AArBD,qCAA4C;AAE5C,SAAgB,YAAY,CAAC,OAAe;IAI1C,IAAI,OAAO,CAAC,MAAM,IAAI,0BAAiB,EAAE,CAAC;QACxC,OAAO;YACL,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM;YACtC,gBAAgB,EAAE,OAAO;SAC1B,CAAA;IACH,CAAC;IACD,MAAM,UAAU,GAAG,0BAAiB,GAAG,CAAC,CAAA;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAA;IAC1C,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAA;IACtC,MAAM,SAAS,GAAG,GAAG,KAAK,YAAY,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAA;IAEhI,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM;QACtC,gBAAgB,EAAE,SAAS;KAC5B,CAAA;AACH,CAAC"}
@@ -0,0 +1,110 @@
1
+ import { Hunk } from 'diff';
2
+ import { z } from 'zod';
3
+ import { ValidationResult } from '../base/Tool';
4
+ declare const inputSchema: z.ZodObject<{
5
+ file_path: z.ZodString;
6
+ old_string: z.ZodString;
7
+ new_string: z.ZodString;
8
+ replace_all: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
9
+ }, "strict", z.ZodTypeAny, {
10
+ file_path: string;
11
+ old_string: string;
12
+ new_string: string;
13
+ replace_all: boolean;
14
+ }, {
15
+ file_path: string;
16
+ old_string: string;
17
+ new_string: string;
18
+ replace_all?: boolean | undefined;
19
+ }>;
20
+ export type In = typeof inputSchema;
21
+ export declare const FileEditTool: {
22
+ name: string;
23
+ description(): string;
24
+ inputSchema: z.ZodObject<{
25
+ file_path: z.ZodString;
26
+ old_string: z.ZodString;
27
+ new_string: z.ZodString;
28
+ replace_all: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
29
+ }, "strict", z.ZodTypeAny, {
30
+ file_path: string;
31
+ old_string: string;
32
+ new_string: string;
33
+ replace_all: boolean;
34
+ }, {
35
+ file_path: string;
36
+ old_string: string;
37
+ new_string: string;
38
+ replace_all?: boolean | undefined;
39
+ }>;
40
+ isReadOnly(): false;
41
+ genToolPermission(input: {
42
+ file_path: string;
43
+ old_string: string;
44
+ new_string: string;
45
+ replace_all: boolean;
46
+ }): {
47
+ title: string;
48
+ content: {
49
+ type: string;
50
+ patch: Hunk[];
51
+ diffText: string;
52
+ };
53
+ };
54
+ genToolResultMessage({ filePath, structuredPatch }: {
55
+ filePath: string;
56
+ oldString: string;
57
+ newString: string;
58
+ originalFile: string;
59
+ structuredPatch: Hunk[];
60
+ }): {
61
+ title: string;
62
+ summary: string;
63
+ content: {
64
+ type: string;
65
+ patch: Hunk[];
66
+ diffText: string;
67
+ };
68
+ };
69
+ getDisplayTitle(input: {
70
+ file_path: string;
71
+ old_string: string;
72
+ new_string: string;
73
+ replace_all: boolean;
74
+ } | undefined): string;
75
+ validateInput({ file_path, old_string, new_string, replace_all }: {
76
+ file_path: string;
77
+ old_string: string;
78
+ new_string: string;
79
+ replace_all: boolean;
80
+ }, agentContext: any): Promise<ValidationResult>;
81
+ call({ file_path, old_string, new_string, replace_all }: {
82
+ file_path: string;
83
+ old_string: string;
84
+ new_string: string;
85
+ replace_all: boolean;
86
+ }, agentContext: any): AsyncGenerator<{
87
+ type: "result";
88
+ data: {
89
+ filePath: string;
90
+ oldString: string;
91
+ newString: string;
92
+ originalFile: string;
93
+ structuredPatch: Hunk[];
94
+ };
95
+ resultForAssistant: string;
96
+ }, void, unknown>;
97
+ genResultForAssistant({ filePath, originalFile, oldString, newString }: {
98
+ filePath: string;
99
+ oldString: string;
100
+ newString: string;
101
+ originalFile: string;
102
+ structuredPatch: Hunk[];
103
+ }): string;
104
+ };
105
+ export declare function getSnippet(initialText: string, oldStr: string, newStr: string): {
106
+ snippet: string;
107
+ startLine: number;
108
+ };
109
+ export {};
110
+ //# sourceMappingURL=Edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Edit.d.ts","sourceRoot":"","sources":["../../../src/tools/Edit/Edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAG3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAQ,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAiBrD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;EAKf,CAAA;AAEF,MAAM,MAAM,EAAE,GAAG,OAAO,WAAW,CAAA;AAcnC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA2MX,MAAM;mBACL,MAAM;mBACN,MAAM;sBACH,MAAM;yBACH,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;qBA7JT,GAAG;;;;;;qBAuG2D,GAAG;;;;;;;;;;;;kBAkDrE,MAAM;mBACL,MAAM;mBACN,MAAM;sBACH,MAAM;yBACH,IAAI,EAAE;;CAE1B,CAAA;AAED,wBAAgB,UAAU,CACxB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAYxC"}