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
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TOOL_NAME_FOR_PROMPT = void 0;
4
+ exports.getDescription = getDescription;
5
+ const agentsManager_1 = require("../../services/agents/agentsManager");
6
+ exports.TOOL_NAME_FOR_PROMPT = 'Task';
7
+ /**
8
+ * 获取 Task 工具的完整描述
9
+ */
10
+ function getDescription() {
11
+ const agentTypesDesc = (0, agentsManager_1.getAgentTypesDescription)();
12
+ return `Launch a new agent to handle complex, multi-step tasks autonomously.
13
+
14
+ The Task tool launches specialized agents (subprocesses) that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.
15
+
16
+ Available agent types and the tools they have access to:
17
+ ${agentTypesDesc}
18
+
19
+ When using the Task tool, you must specify a subagent_type parameter to select which agent type to use.
20
+
21
+ When NOT to use the Task tool:
22
+ - If you want to read a specific file path, use the Read or Glob tool instead of the Task tool, to find the match more quickly
23
+ - If you are searching for a specific class definition like "class Foo", use the Glob tool instead, to find the match more quickly
24
+ - If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Task tool, to find the match more quickly
25
+ - Other tasks that are not related to the agent descriptions above
26
+
27
+
28
+ Usage notes:
29
+ - Always include a short description (3-5 words) summarizing what the agent will do
30
+ - Call only one agent at a time to maintain clarity and control over task execution.
31
+ - When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.
32
+ - When the agent is done, it will return a single message back to you along with its agent ID.
33
+ - Provide clear, detailed prompts so the agent can work autonomously and return exactly the information you need.
34
+ - The agent's outputs should generally be trusted
35
+ - Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent
36
+ - If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
37
+ - If the user specifies that they want you to run agents "in parallel", you MUST send a single message with multiple Task tool use content blocks. For example, if you need to launch both a build-validator agent and a test-runner agent in parallel, send a single message with both tool calls.
38
+
39
+ Example usage:
40
+
41
+ <example_agent_descriptions>
42
+ "test-runner": use this agent after you are done writing code to run tests
43
+ "greeting-responder": use this agent when to respond to user greetings with a friendly joke
44
+ </example_agent_description>
45
+
46
+ <example>
47
+ user: "Please write a function that checks if a number is prime"
48
+ assistant: Sure let me write a function that checks if a number is prime
49
+ assistant: First let me use the Write tool to write a function that checks if a number is prime
50
+ assistant: I'm going to use the Write tool to write the following code:
51
+ <code>
52
+ function isPrime(n) {
53
+ if (n <= 1) return false
54
+ for (let i = 2; i * i <= n; i++) {
55
+ if (n % i === 0) return false
56
+ }
57
+ return true
58
+ }
59
+ </code>
60
+ <commentary>
61
+ Since a significant piece of code was written and the task was completed, now use the test-runner agent to run the tests
62
+ </commentary>
63
+ assistant: Now let me use the test-runner agent to run the tests
64
+ assistant: Uses the Task tool to launch the test-runner agent
65
+ </example>
66
+
67
+ <example>
68
+ user: "Hello"
69
+ <commentary>
70
+ Since the user is greeting, use the greeting-responder agent to respond with a friendly joke
71
+ </commentary>
72
+ assistant: "I'm going to use the Task tool to launch the greeting-responder agent"
73
+ </example>`;
74
+ }
75
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/tools/Task/prompt.ts"],"names":[],"mappings":";;;AAOA,wCAkEC;AAzED,uEAA8E;AAEjE,QAAA,oBAAoB,GAAG,MAAM,CAAA;AAE1C;;GAEG;AACH,SAAgB,cAAc;IAC5B,MAAM,cAAc,GAAG,IAAA,wCAAwB,GAAE,CAAA;IAEjD,OAAO;;;;;EAKP,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAwDL,CAAA;AAEX,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { z } from 'zod';
2
+ import { ValidationResult } from '../base/Tool';
3
+ declare const TodoItemSchema: z.ZodObject<{
4
+ content: z.ZodString;
5
+ status: z.ZodEnum<["pending", "in_progress", "completed"]>;
6
+ activeForm: z.ZodString;
7
+ }, "strict", z.ZodTypeAny, {
8
+ status: "pending" | "in_progress" | "completed";
9
+ content: string;
10
+ activeForm: string;
11
+ }, {
12
+ status: "pending" | "in_progress" | "completed";
13
+ content: string;
14
+ activeForm: string;
15
+ }>;
16
+ declare const inputSchema: z.ZodObject<{
17
+ todos: z.ZodArray<z.ZodObject<{
18
+ content: z.ZodString;
19
+ status: z.ZodEnum<["pending", "in_progress", "completed"]>;
20
+ activeForm: z.ZodString;
21
+ }, "strict", z.ZodTypeAny, {
22
+ status: "pending" | "in_progress" | "completed";
23
+ content: string;
24
+ activeForm: string;
25
+ }, {
26
+ status: "pending" | "in_progress" | "completed";
27
+ content: string;
28
+ activeForm: string;
29
+ }>, "many">;
30
+ }, "strict", z.ZodTypeAny, {
31
+ todos: {
32
+ status: "pending" | "in_progress" | "completed";
33
+ content: string;
34
+ activeForm: string;
35
+ }[];
36
+ }, {
37
+ todos: {
38
+ status: "pending" | "in_progress" | "completed";
39
+ content: string;
40
+ activeForm: string;
41
+ }[];
42
+ }>;
43
+ type TodoItem = z.infer<typeof TodoItemSchema>;
44
+ export declare const TodoWriteTool: {
45
+ name: string;
46
+ description(): string;
47
+ inputSchema: z.ZodObject<{
48
+ todos: z.ZodArray<z.ZodObject<{
49
+ content: z.ZodString;
50
+ status: z.ZodEnum<["pending", "in_progress", "completed"]>;
51
+ activeForm: z.ZodString;
52
+ }, "strict", z.ZodTypeAny, {
53
+ status: "pending" | "in_progress" | "completed";
54
+ content: string;
55
+ activeForm: string;
56
+ }, {
57
+ status: "pending" | "in_progress" | "completed";
58
+ content: string;
59
+ activeForm: string;
60
+ }>, "many">;
61
+ }, "strict", z.ZodTypeAny, {
62
+ todos: {
63
+ status: "pending" | "in_progress" | "completed";
64
+ content: string;
65
+ activeForm: string;
66
+ }[];
67
+ }, {
68
+ todos: {
69
+ status: "pending" | "in_progress" | "completed";
70
+ content: string;
71
+ activeForm: string;
72
+ }[];
73
+ }>;
74
+ isReadOnly(): false;
75
+ genResultForAssistant(result: string | TodoItem[]): string;
76
+ validateInput({ todos }: z.infer<typeof inputSchema>): Promise<ValidationResult>;
77
+ call({ todos }: z.infer<typeof inputSchema>, agentContext: any): AsyncGenerator<{
78
+ type: "result";
79
+ data: string;
80
+ resultForAssistant: string;
81
+ } | {
82
+ type: "result";
83
+ data: {
84
+ status: "pending" | "in_progress" | "completed";
85
+ content: string;
86
+ activeForm: string;
87
+ }[];
88
+ resultForAssistant: string;
89
+ }, void, unknown>;
90
+ };
91
+ export {};
92
+ //# sourceMappingURL=TodoWrite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TodoWrite.d.ts","sourceRoot":"","sources":["../../../src/tools/TodoWrite/TodoWrite.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAQ,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAIrD,QAAA,MAAM,cAAc;;;;;;;;;;;;EAKlB,CAAA;AAEF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;EAEf,CAAA;AAEF,KAAK,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAsC9C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCASM,MAAM,GAAG,QAAQ,EAAE;6BAIlB,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;oBAOnC,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,gBAAgB,GAAG;;;;;;;;;;;;;CAkCd,CAAA"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TodoWriteTool = void 0;
4
+ const zod_1 = require("zod");
5
+ const prompt_1 = require("./prompt");
6
+ const StateManager_1 = require("../../manager/StateManager");
7
+ const TodoItemSchema = zod_1.z.strictObject({
8
+ content: zod_1.z.string().min(1),
9
+ status: zod_1.z
10
+ .enum(['pending', 'in_progress', 'completed']),
11
+ activeForm: zod_1.z.string().min(1),
12
+ });
13
+ const inputSchema = zod_1.z.strictObject({
14
+ todos: zod_1.z.array(TodoItemSchema).describe('The updated todo list'),
15
+ });
16
+ function validateTodos(todos) {
17
+ // Check for multiple in_progress tasks
18
+ const inProgressTasks = todos.filter(todo => todo.status === 'in_progress');
19
+ if (inProgressTasks.length > 1) {
20
+ return {
21
+ result: false,
22
+ errorCode: 2,
23
+ message: 'Only one task can be in_progress at a time',
24
+ meta: { inProgressTaskCount: inProgressTasks.length },
25
+ };
26
+ }
27
+ // Validate each todo
28
+ for (let i = 0; i < todos.length; i++) {
29
+ const todo = todos[i];
30
+ if (!todo.content?.trim()) {
31
+ return {
32
+ result: false,
33
+ errorCode: 3,
34
+ message: `Todo at index ${i} has empty content`,
35
+ meta: { todoIndex: i },
36
+ };
37
+ }
38
+ if (!todo.activeForm?.trim()) {
39
+ return {
40
+ result: false,
41
+ errorCode: 5,
42
+ message: `Todo at index ${i} has empty activeForm`,
43
+ meta: { todoIndex: i },
44
+ };
45
+ }
46
+ }
47
+ return { result: true };
48
+ }
49
+ exports.TodoWriteTool = {
50
+ name: prompt_1.TOOL_NAME_FOR_PROMPT,
51
+ description() {
52
+ return prompt_1.DESCRIPTION;
53
+ },
54
+ inputSchema,
55
+ isReadOnly() {
56
+ return false;
57
+ },
58
+ genResultForAssistant(result) {
59
+ return 'Todos have been modified successfully. Ensure that you continue to use the todo list to track your progress. Please proceed with the current tasks if applicable';
60
+ },
61
+ async validateInput({ todos }) {
62
+ const validation = validateTodos(todos);
63
+ if (!validation.result) {
64
+ return validation;
65
+ }
66
+ return { result: true };
67
+ },
68
+ async *call({ todos }, agentContext) {
69
+ try {
70
+ // Simple validation
71
+ const validation = validateTodos(todos);
72
+ if (!validation.result) {
73
+ yield {
74
+ type: 'result',
75
+ data: `Error: ${validation.message}`,
76
+ resultForAssistant: `Error: ${validation.message}`,
77
+ };
78
+ return;
79
+ }
80
+ // 通过 agentContext 更新 todos(使用智能更新,包含事件发送)
81
+ const stateManager = (0, StateManager_1.getStateManager)();
82
+ const agentState = stateManager.forAgent(agentContext.agentId);
83
+ agentState.updateTodosIntelligently(todos);
84
+ yield {
85
+ type: 'result',
86
+ data: todos, // Return the todos array for rendering
87
+ resultForAssistant: 'Todos have been modified successfully. Ensure that you continue to use the todo list to track your progress. Please proceed with the current tasks if applicable',
88
+ };
89
+ }
90
+ catch (error) {
91
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
92
+ const errorResult = `Error updating todos: ${errorMessage}`;
93
+ yield {
94
+ type: 'result',
95
+ data: errorResult,
96
+ resultForAssistant: errorResult,
97
+ };
98
+ }
99
+ },
100
+ };
101
+ //# sourceMappingURL=TodoWrite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TodoWrite.js","sourceRoot":"","sources":["../../../src/tools/TodoWrite/TodoWrite.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ export declare const TOOL_NAME_FOR_PROMPT = "TodoWrite";
2
+ export declare const DESCRIPTION = "Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.\nIt also helps the user understand the progress of the task and overall progress of their requests.\n\n## When to Use This Tool\nUse this tool proactively in these scenarios:\n\n1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions\n2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations\n3. User explicitly requests todo list - When the user directly asks you to use the todo list\n4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)\n5. After receiving new instructions - Immediately capture user requirements as todos\n6. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time\n7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation\n\n## When NOT to Use This Tool\n\nSkip using this tool when:\n1. There is only a single, straightforward task\n2. The task is trivial and tracking it provides no organizational benefit\n3. The task can be completed in less than 3 trivial steps\n4. The task is purely conversational or informational\n\nNOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.\n\n## Examples of When to Use the Todo List\n\n<example>\nUser: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!\nAssistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.\n*Creates todo list with the following items:*\n1. Creating dark mode toggle component in Settings page\n2. Adding dark mode state management (context/store)\n3. Implementing CSS-in-JS styles for dark theme\n4. Updating existing components to support theme switching\n5. Running tests and build process, addressing any failures or errors that occur\n*Begins working on the first task*\n\n<reasoning>\nThe assistant used the todo list because:\n1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes\n2. The user explicitly requested tests and build be run afterward\n3. The assistant inferred that tests and build need to pass by adding \"Ensure tests and build succeed\" as the final task\n</reasoning>\n</example>\n\n<example>\nUser: Help me rename the function getCwd to getCurrentWorkingDirectory across my project\nAssistant: Let me first search through your codebase to find all occurrences of 'getCwd'.\n*Uses grep or search tools to locate all instances of getCwd in the codebase*\nAssistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.\n*Creates todo list with specific items for each file that needs updating*\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant searched to understand the scope of the task\n2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps\n3. The todo list helps ensure every instance is tracked and updated systematically\n4. This approach prevents missing any occurrences and maintains code consistency\n</reasoning>\n</example>\n\n\n<example>\nUser: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.\nAssistant: I'll help implement these features. First, let's add all the features to the todo list.\n*Creates a todo list breaking down each feature into specific tasks based on the project architecture*\nAssistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.\n\n<reasoning>\nThe assistant used the todo list because:\n1. The user provided multiple complex features to implement in a comma separated list\n2. The todo list helps organize these large features into manageable tasks\n3. This approach allows for tracking progress across the entire implementation\n</reasoning>\n</example>\n\n<example>\nUser: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>\nAssistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.\n*Reviews component structure, render patterns, state management, and data fetching*\nAssistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.\n*Creates todo list with items like: 1) Implementing memoization for expensive calculations in ProductList, 2) Adding virtualization for long lists in Dashboard, 3) Optimizing image loading in Gallery component, 4) Fixing state update loops in ShoppingCart, 5) Reviewing bundle size and implementing code splitting*\nLet's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant examined the codebase to identify specific performance issues\n2. Based on this analysis, it identified multiple optimization opportunities\n3. Performance optimization is a non-trivial task requiring multiple steps\n4. The todo list helps methodically track improvements across different components\n5. This systematic approach ensures all performance bottlenecks are addressed\n</reasoning>\n</example>\n\n## Examples of When NOT to Use the Todo List\n\n<example>\nUser: How do I print 'Hello World' in Python?\nAssistant: In Python, you can print \"Hello World\" with this simple code:\n\npython\nprint(\"Hello World\")\n\nThis will output the text \"Hello World\" to the console when executed.</assistant>\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.\n</reasoning>\n</example>\n\n<example>\nUser: What does the git status command do?\nAssistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.\n\n<reasoning>\nThe assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.\n</reasoning>\n</example>\n\n<example>\nUser: Can you add a comment to the calculateTotal function to explain what it does?\nAssistant: Sure, let me add a comment to the calculateTotal function to explain what it does.\n* Uses the Edit tool to add a comment to the calculateTotal function *\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.\n</reasoning>\n</example>\n\n<example>\nUser: Run npm install for me and tell me what happens.\nAssistant: I'll run the npm install command for you.\n\n*Executes: npm install*\n\nThe command completed successfully. Here's the output:\n[Output of npm install command]\n\nAll dependencies have been installed according to your package.json file.\n\n<reasoning>\nThe assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.\n</reasoning>\n</example>\n\n## Task States and Management\n\n1. **Task States**: Use these states to track progress:\n - pending: Task not yet started\n - in_progress: Currently working on (limit to ONE task at a time)\n - completed: Task finished successfully\n\n **IMPORTANT**: Task descriptions must have two forms:\n - content: The imperative form describing what needs to be done (e.g., \"Run tests\", \"Build the project\")\n - activeForm: The present continuous form shown during execution (e.g., \"Running tests\", \"Building the project\")\n\n2. **Task Management**:\n - Update task status in real-time as you work\n - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)\n - Exactly ONE task must be in_progress at any time (not less, not more)\n - Complete current tasks before starting new ones\n - Remove tasks that are no longer relevant from the list entirely\n\n3. **Task Completion Requirements**:\n - ONLY mark a task as completed when you have FULLY accomplished it\n - If you encounter errors, blockers, or cannot finish, keep the task as in_progress\n - When blocked, create a new task describing what needs to be resolved\n - Never mark a task as completed if:\n - Tests are failing\n - Implementation is partial\n - You encountered unresolved errors\n - You couldn't find necessary files or dependencies\n\n4. **Task Breakdown**:\n - Create specific, actionable items\n - Break complex tasks into smaller, manageable steps\n - Use clear, descriptive task names\n - Always provide both forms:\n - content: \"Fix authentication bug\"\n - activeForm: \"Fixing authentication bug\"\n\nWhen in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.";
3
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/tools/TodoWrite/prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,cAAc,CAAA;AAE/C,eAAO,MAAM,WAAW,krTAqL8H,CAAA"}
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DESCRIPTION = exports.TOOL_NAME_FOR_PROMPT = void 0;
4
+ exports.TOOL_NAME_FOR_PROMPT = 'TodoWrite';
5
+ exports.DESCRIPTION = `Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
6
+ It also helps the user understand the progress of the task and overall progress of their requests.
7
+
8
+ ## When to Use This Tool
9
+ Use this tool proactively in these scenarios:
10
+
11
+ 1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
12
+ 2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
13
+ 3. User explicitly requests todo list - When the user directly asks you to use the todo list
14
+ 4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
15
+ 5. After receiving new instructions - Immediately capture user requirements as todos
16
+ 6. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time
17
+ 7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation
18
+
19
+ ## When NOT to Use This Tool
20
+
21
+ Skip using this tool when:
22
+ 1. There is only a single, straightforward task
23
+ 2. The task is trivial and tracking it provides no organizational benefit
24
+ 3. The task can be completed in less than 3 trivial steps
25
+ 4. The task is purely conversational or informational
26
+
27
+ NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.
28
+
29
+ ## Examples of When to Use the Todo List
30
+
31
+ <example>
32
+ User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!
33
+ Assistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.
34
+ *Creates todo list with the following items:*
35
+ 1. Creating dark mode toggle component in Settings page
36
+ 2. Adding dark mode state management (context/store)
37
+ 3. Implementing CSS-in-JS styles for dark theme
38
+ 4. Updating existing components to support theme switching
39
+ 5. Running tests and build process, addressing any failures or errors that occur
40
+ *Begins working on the first task*
41
+
42
+ <reasoning>
43
+ The assistant used the todo list because:
44
+ 1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes
45
+ 2. The user explicitly requested tests and build be run afterward
46
+ 3. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task
47
+ </reasoning>
48
+ </example>
49
+
50
+ <example>
51
+ User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project
52
+ Assistant: Let me first search through your codebase to find all occurrences of 'getCwd'.
53
+ *Uses grep or search tools to locate all instances of getCwd in the codebase*
54
+ Assistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.
55
+ *Creates todo list with specific items for each file that needs updating*
56
+
57
+ <reasoning>
58
+ The assistant used the todo list because:
59
+ 1. First, the assistant searched to understand the scope of the task
60
+ 2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps
61
+ 3. The todo list helps ensure every instance is tracked and updated systematically
62
+ 4. This approach prevents missing any occurrences and maintains code consistency
63
+ </reasoning>
64
+ </example>
65
+
66
+
67
+ <example>
68
+ User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.
69
+ Assistant: I'll help implement these features. First, let's add all the features to the todo list.
70
+ *Creates a todo list breaking down each feature into specific tasks based on the project architecture*
71
+ Assistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.
72
+
73
+ <reasoning>
74
+ The assistant used the todo list because:
75
+ 1. The user provided multiple complex features to implement in a comma separated list
76
+ 2. The todo list helps organize these large features into manageable tasks
77
+ 3. This approach allows for tracking progress across the entire implementation
78
+ </reasoning>
79
+ </example>
80
+
81
+ <example>
82
+ User: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>
83
+ Assistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.
84
+ *Reviews component structure, render patterns, state management, and data fetching*
85
+ Assistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.
86
+ *Creates todo list with items like: 1) Implementing memoization for expensive calculations in ProductList, 2) Adding virtualization for long lists in Dashboard, 3) Optimizing image loading in Gallery component, 4) Fixing state update loops in ShoppingCart, 5) Reviewing bundle size and implementing code splitting*
87
+ Let's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>
88
+
89
+ <reasoning>
90
+ The assistant used the todo list because:
91
+ 1. First, the assistant examined the codebase to identify specific performance issues
92
+ 2. Based on this analysis, it identified multiple optimization opportunities
93
+ 3. Performance optimization is a non-trivial task requiring multiple steps
94
+ 4. The todo list helps methodically track improvements across different components
95
+ 5. This systematic approach ensures all performance bottlenecks are addressed
96
+ </reasoning>
97
+ </example>
98
+
99
+ ## Examples of When NOT to Use the Todo List
100
+
101
+ <example>
102
+ User: How do I print 'Hello World' in Python?
103
+ Assistant: In Python, you can print "Hello World" with this simple code:
104
+
105
+ python
106
+ print("Hello World")
107
+
108
+ This will output the text "Hello World" to the console when executed.</assistant>
109
+
110
+ <reasoning>
111
+ The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.
112
+ </reasoning>
113
+ </example>
114
+
115
+ <example>
116
+ User: What does the git status command do?
117
+ Assistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.
118
+
119
+ <reasoning>
120
+ The assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.
121
+ </reasoning>
122
+ </example>
123
+
124
+ <example>
125
+ User: Can you add a comment to the calculateTotal function to explain what it does?
126
+ Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does.
127
+ * Uses the Edit tool to add a comment to the calculateTotal function *
128
+
129
+ <reasoning>
130
+ The assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.
131
+ </reasoning>
132
+ </example>
133
+
134
+ <example>
135
+ User: Run npm install for me and tell me what happens.
136
+ Assistant: I'll run the npm install command for you.
137
+
138
+ *Executes: npm install*
139
+
140
+ The command completed successfully. Here's the output:
141
+ [Output of npm install command]
142
+
143
+ All dependencies have been installed according to your package.json file.
144
+
145
+ <reasoning>
146
+ The assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.
147
+ </reasoning>
148
+ </example>
149
+
150
+ ## Task States and Management
151
+
152
+ 1. **Task States**: Use these states to track progress:
153
+ - pending: Task not yet started
154
+ - in_progress: Currently working on (limit to ONE task at a time)
155
+ - completed: Task finished successfully
156
+
157
+ **IMPORTANT**: Task descriptions must have two forms:
158
+ - content: The imperative form describing what needs to be done (e.g., "Run tests", "Build the project")
159
+ - activeForm: The present continuous form shown during execution (e.g., "Running tests", "Building the project")
160
+
161
+ 2. **Task Management**:
162
+ - Update task status in real-time as you work
163
+ - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
164
+ - Exactly ONE task must be in_progress at any time (not less, not more)
165
+ - Complete current tasks before starting new ones
166
+ - Remove tasks that are no longer relevant from the list entirely
167
+
168
+ 3. **Task Completion Requirements**:
169
+ - ONLY mark a task as completed when you have FULLY accomplished it
170
+ - If you encounter errors, blockers, or cannot finish, keep the task as in_progress
171
+ - When blocked, create a new task describing what needs to be resolved
172
+ - Never mark a task as completed if:
173
+ - Tests are failing
174
+ - Implementation is partial
175
+ - You encountered unresolved errors
176
+ - You couldn't find necessary files or dependencies
177
+
178
+ 4. **Task Breakdown**:
179
+ - Create specific, actionable items
180
+ - Break complex tasks into smaller, manageable steps
181
+ - Use clear, descriptive task names
182
+ - Always provide both forms:
183
+ - content: "Fix authentication bug"
184
+ - activeForm: "Fixing authentication bug"
185
+
186
+ When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.`;
187
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/tools/TodoWrite/prompt.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,WAAW,CAAA;AAElC,QAAA,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sJAqL2H,CAAA"}
@@ -0,0 +1,77 @@
1
+ import { Hunk } from 'diff';
2
+ import { z } from 'zod';
3
+ export declare const FileWriteTool: {
4
+ name: string;
5
+ description(): string;
6
+ inputSchema: z.ZodObject<{
7
+ file_path: z.ZodString;
8
+ content: z.ZodString;
9
+ }, "strict", z.ZodTypeAny, {
10
+ content: string;
11
+ file_path: string;
12
+ }, {
13
+ content: string;
14
+ file_path: string;
15
+ }>;
16
+ isReadOnly(): false;
17
+ genToolPermission(input: {
18
+ content: string;
19
+ file_path: string;
20
+ }): {
21
+ title: string;
22
+ content: Record<string, any>;
23
+ };
24
+ genToolResultMessage({ filePath, content, structuredPatch, type }: {
25
+ type: "create" | "update";
26
+ filePath: string;
27
+ content: string;
28
+ structuredPatch: Hunk[];
29
+ }): {
30
+ title: string;
31
+ summary: string;
32
+ content: Record<string, any>;
33
+ };
34
+ getDisplayTitle(input: {
35
+ content: string;
36
+ file_path: string;
37
+ } | undefined): string;
38
+ validateInput({ file_path }: {
39
+ content: string;
40
+ file_path: string;
41
+ }, agentContext: any): Promise<{
42
+ result: true;
43
+ message?: undefined;
44
+ } | {
45
+ result: false;
46
+ message: string;
47
+ }>;
48
+ call({ file_path, content }: {
49
+ content: string;
50
+ file_path: string;
51
+ }, agentContext: any): AsyncGenerator<{
52
+ type: "result";
53
+ data: {
54
+ type: "update";
55
+ filePath: string;
56
+ content: string;
57
+ structuredPatch: Hunk[];
58
+ };
59
+ resultForAssistant: string;
60
+ } | {
61
+ type: "result";
62
+ data: {
63
+ type: "create";
64
+ filePath: string;
65
+ content: string;
66
+ structuredPatch: never[];
67
+ };
68
+ resultForAssistant: string;
69
+ }, void, unknown>;
70
+ genResultForAssistant({ filePath, content, type }: {
71
+ type: "create" | "update";
72
+ filePath: string;
73
+ content: string;
74
+ structuredPatch: Hunk[];
75
+ }): string;
76
+ };
77
+ //# sourceMappingURL=Write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Write.d.ts","sourceRoot":"","sources":["../../../src/tools/Write/Write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAI3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAwCvB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;cAsLhB,QAAQ,GAAG,QAAQ;kBACf,MAAM;iBACP,MAAM;yBACE,IAAI,EAAE;;;;;;;;;;;;;qBA5GwB,GAAG;;;;;;;;;;qBA+BF,GAAG;;;;;;;;;;;;;;;;;;;;cA0E7C,QAAQ,GAAG,QAAQ;kBACf,MAAM;iBACP,MAAM;yBACE,IAAI,EAAE;;CAE1B,CAAA"}