@xagent-ai/cli 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (537) hide show
  1. package/.eslintrc.js +25 -0
  2. package/.gitmodules +3 -0
  3. package/.prettierrc.json +8 -0
  4. package/CONTRIBUTING.md +167 -0
  5. package/LICENSE +21 -0
  6. package/README.md +280 -0
  7. package/README_CN.md +280 -0
  8. package/dist/agents.d.ts +21 -0
  9. package/dist/agents.d.ts.map +1 -0
  10. package/dist/agents.js +463 -0
  11. package/dist/agents.js.map +1 -0
  12. package/dist/ai-client.d.ts +83 -0
  13. package/dist/ai-client.d.ts.map +1 -0
  14. package/dist/ai-client.js +1280 -0
  15. package/dist/ai-client.js.map +1 -0
  16. package/dist/auth.d.ts +25 -0
  17. package/dist/auth.d.ts.map +1 -0
  18. package/dist/auth.js +573 -0
  19. package/dist/auth.js.map +1 -0
  20. package/dist/cancellation.d.ts +46 -0
  21. package/dist/cancellation.d.ts.map +1 -0
  22. package/dist/cancellation.js +154 -0
  23. package/dist/cancellation.js.map +1 -0
  24. package/dist/checkpoint.d.ts +28 -0
  25. package/dist/checkpoint.d.ts.map +1 -0
  26. package/dist/checkpoint.js +186 -0
  27. package/dist/checkpoint.js.map +1 -0
  28. package/dist/cli.d.ts +3 -0
  29. package/dist/cli.d.ts.map +1 -0
  30. package/dist/cli.js +364 -0
  31. package/dist/cli.js.map +1 -0
  32. package/dist/config.d.ts +49 -0
  33. package/dist/config.d.ts.map +1 -0
  34. package/dist/config.js +205 -0
  35. package/dist/config.js.map +1 -0
  36. package/dist/context-compressor.d.ts +51 -0
  37. package/dist/context-compressor.d.ts.map +1 -0
  38. package/dist/context-compressor.js +231 -0
  39. package/dist/context-compressor.js.map +1 -0
  40. package/dist/conversation.d.ts +34 -0
  41. package/dist/conversation.d.ts.map +1 -0
  42. package/dist/conversation.js +221 -0
  43. package/dist/conversation.js.map +1 -0
  44. package/dist/gui-subagent/action-parser/actionParser.d.ts +19 -0
  45. package/dist/gui-subagent/action-parser/actionParser.d.ts.map +1 -0
  46. package/dist/gui-subagent/action-parser/actionParser.js +203 -0
  47. package/dist/gui-subagent/action-parser/actionParser.js.map +1 -0
  48. package/dist/gui-subagent/action-parser/constants.d.ts +8 -0
  49. package/dist/gui-subagent/action-parser/constants.d.ts.map +1 -0
  50. package/dist/gui-subagent/action-parser/constants.js +12 -0
  51. package/dist/gui-subagent/action-parser/constants.js.map +1 -0
  52. package/dist/gui-subagent/action-parser/index.d.ts +3 -0
  53. package/dist/gui-subagent/action-parser/index.d.ts.map +1 -0
  54. package/dist/gui-subagent/action-parser/index.js +6 -0
  55. package/dist/gui-subagent/action-parser/index.js.map +1 -0
  56. package/dist/gui-subagent/action-parser/types.d.ts +24 -0
  57. package/dist/gui-subagent/action-parser/types.d.ts.map +1 -0
  58. package/dist/gui-subagent/action-parser/types.js +12 -0
  59. package/dist/gui-subagent/action-parser/types.js.map +1 -0
  60. package/dist/gui-subagent/agent/gui-agent.d.ts +126 -0
  61. package/dist/gui-subagent/agent/gui-agent.d.ts.map +1 -0
  62. package/dist/gui-subagent/agent/gui-agent.js +820 -0
  63. package/dist/gui-subagent/agent/gui-agent.js.map +1 -0
  64. package/dist/gui-subagent/agent/index.d.ts +5 -0
  65. package/dist/gui-subagent/agent/index.d.ts.map +1 -0
  66. package/dist/gui-subagent/agent/index.js +5 -0
  67. package/dist/gui-subagent/agent/index.js.map +1 -0
  68. package/dist/gui-subagent/index.d.ts +43 -0
  69. package/dist/gui-subagent/index.d.ts.map +1 -0
  70. package/dist/gui-subagent/index.js +96 -0
  71. package/dist/gui-subagent/index.js.map +1 -0
  72. package/dist/gui-subagent/operator/base-operator.d.ts +108 -0
  73. package/dist/gui-subagent/operator/base-operator.d.ts.map +1 -0
  74. package/dist/gui-subagent/operator/base-operator.js +172 -0
  75. package/dist/gui-subagent/operator/base-operator.js.map +1 -0
  76. package/dist/gui-subagent/operator/browser-operator.d.ts +36 -0
  77. package/dist/gui-subagent/operator/browser-operator.d.ts.map +1 -0
  78. package/dist/gui-subagent/operator/browser-operator.js +306 -0
  79. package/dist/gui-subagent/operator/browser-operator.js.map +1 -0
  80. package/dist/gui-subagent/operator/computer-operator.d.ts +31 -0
  81. package/dist/gui-subagent/operator/computer-operator.d.ts.map +1 -0
  82. package/dist/gui-subagent/operator/computer-operator.js +441 -0
  83. package/dist/gui-subagent/operator/computer-operator.js.map +1 -0
  84. package/dist/gui-subagent/operator/desktop-operator.d.ts +55 -0
  85. package/dist/gui-subagent/operator/desktop-operator.d.ts.map +1 -0
  86. package/dist/gui-subagent/operator/desktop-operator.js +527 -0
  87. package/dist/gui-subagent/operator/desktop-operator.js.map +1 -0
  88. package/dist/gui-subagent/operator/index.d.ts +7 -0
  89. package/dist/gui-subagent/operator/index.d.ts.map +1 -0
  90. package/dist/gui-subagent/operator/index.js +6 -0
  91. package/dist/gui-subagent/operator/index.js.map +1 -0
  92. package/dist/gui-subagent/types/actions.d.ts +108 -0
  93. package/dist/gui-subagent/types/actions.d.ts.map +1 -0
  94. package/dist/gui-subagent/types/actions.js +39 -0
  95. package/dist/gui-subagent/types/actions.js.map +1 -0
  96. package/dist/gui-subagent/types/index.d.ts +6 -0
  97. package/dist/gui-subagent/types/index.d.ts.map +1 -0
  98. package/dist/gui-subagent/types/index.js +6 -0
  99. package/dist/gui-subagent/types/index.js.map +1 -0
  100. package/dist/gui-subagent/types/operator.d.ts +95 -0
  101. package/dist/gui-subagent/types/operator.d.ts.map +1 -0
  102. package/dist/gui-subagent/types/operator.js +16 -0
  103. package/dist/gui-subagent/types/operator.js.map +1 -0
  104. package/dist/gui-subagent/utils.d.ts +19 -0
  105. package/dist/gui-subagent/utils.d.ts.map +1 -0
  106. package/dist/gui-subagent/utils.js +42 -0
  107. package/dist/gui-subagent/utils.js.map +1 -0
  108. package/dist/hook.d.ts +73 -0
  109. package/dist/hook.d.ts.map +1 -0
  110. package/dist/hook.js +156 -0
  111. package/dist/hook.js.map +1 -0
  112. package/dist/index.d.ts +19 -0
  113. package/dist/index.d.ts.map +1 -0
  114. package/dist/index.js +19 -0
  115. package/dist/index.js.map +1 -0
  116. package/dist/input-history.d.ts +24 -0
  117. package/dist/input-history.d.ts.map +1 -0
  118. package/dist/input-history.js +94 -0
  119. package/dist/input-history.js.map +1 -0
  120. package/dist/input-processor.d.ts +31 -0
  121. package/dist/input-processor.d.ts.map +1 -0
  122. package/dist/input-processor.js +233 -0
  123. package/dist/input-processor.js.map +1 -0
  124. package/dist/keyboard-manager.d.ts +151 -0
  125. package/dist/keyboard-manager.d.ts.map +1 -0
  126. package/dist/keyboard-manager.js +396 -0
  127. package/dist/keyboard-manager.js.map +1 -0
  128. package/dist/logger.d.ts +75 -0
  129. package/dist/logger.d.ts.map +1 -0
  130. package/dist/logger.js +339 -0
  131. package/dist/logger.js.map +1 -0
  132. package/dist/mcp.d.ts +57 -0
  133. package/dist/mcp.d.ts.map +1 -0
  134. package/dist/mcp.js +483 -0
  135. package/dist/mcp.js.map +1 -0
  136. package/dist/memory.d.ts +25 -0
  137. package/dist/memory.d.ts.map +1 -0
  138. package/dist/memory.js +250 -0
  139. package/dist/memory.js.map +1 -0
  140. package/dist/print-system-prompt.d.ts +2 -0
  141. package/dist/print-system-prompt.d.ts.map +1 -0
  142. package/dist/print-system-prompt.js +40 -0
  143. package/dist/print-system-prompt.js.map +1 -0
  144. package/dist/session-manager.d.ts +41 -0
  145. package/dist/session-manager.d.ts.map +1 -0
  146. package/dist/session-manager.js +234 -0
  147. package/dist/session-manager.js.map +1 -0
  148. package/dist/session.d.ts +77 -0
  149. package/dist/session.d.ts.map +1 -0
  150. package/dist/session.js +1081 -0
  151. package/dist/session.js.map +1 -0
  152. package/dist/skill-invoker.d.ts +177 -0
  153. package/dist/skill-invoker.d.ts.map +1 -0
  154. package/dist/skill-invoker.js +1643 -0
  155. package/dist/skill-invoker.js.map +1 -0
  156. package/dist/skill-loader.d.ts +76 -0
  157. package/dist/skill-loader.d.ts.map +1 -0
  158. package/dist/skill-loader.js +407 -0
  159. package/dist/skill-loader.js.map +1 -0
  160. package/dist/slash-commands.d.ts +60 -0
  161. package/dist/slash-commands.d.ts.map +1 -0
  162. package/dist/slash-commands.js +1021 -0
  163. package/dist/slash-commands.js.map +1 -0
  164. package/dist/smart-approval.d.ts +137 -0
  165. package/dist/smart-approval.d.ts.map +1 -0
  166. package/dist/smart-approval.js +512 -0
  167. package/dist/smart-approval.js.map +1 -0
  168. package/dist/system-prompt-generator.d.ts +35 -0
  169. package/dist/system-prompt-generator.d.ts.map +1 -0
  170. package/dist/system-prompt-generator.js +729 -0
  171. package/dist/system-prompt-generator.js.map +1 -0
  172. package/dist/test-boundary-conditions.d.ts.map +1 -0
  173. package/dist/test-boundary-conditions.js.map +1 -0
  174. package/dist/test-cancellation-fix.d.ts.map +1 -0
  175. package/dist/test-cancellation-fix.js.map +1 -0
  176. package/dist/test-input-history.d.ts.map +1 -0
  177. package/dist/test-input-history.js.map +1 -0
  178. package/dist/test-interaction-flow.d.ts.map +1 -0
  179. package/dist/test-interaction-flow.js.map +1 -0
  180. package/dist/test-quick.d.ts.map +1 -0
  181. package/dist/test-quick.js.map +1 -0
  182. package/dist/test-user-interaction.d.ts.map +1 -0
  183. package/dist/test-user-interaction.js.map +1 -0
  184. package/dist/theme.d.ts +353 -0
  185. package/dist/theme.d.ts.map +1 -0
  186. package/dist/theme.js +383 -0
  187. package/dist/theme.js.map +1 -0
  188. package/dist/tools.d.ts +373 -0
  189. package/dist/tools.d.ts.map +1 -0
  190. package/dist/tools.js +2906 -0
  191. package/dist/tools.js.map +1 -0
  192. package/dist/types.d.ts +180 -0
  193. package/dist/types.d.ts.map +1 -0
  194. package/dist/types.js +23 -0
  195. package/dist/types.js.map +1 -0
  196. package/dist/unified-session.d.ts +42 -0
  197. package/dist/unified-session.d.ts.map +1 -0
  198. package/dist/unified-session.js +271 -0
  199. package/dist/unified-session.js.map +1 -0
  200. package/dist/update.d.ts +30 -0
  201. package/dist/update.d.ts.map +1 -0
  202. package/dist/update.js +211 -0
  203. package/dist/update.js.map +1 -0
  204. package/dist/workflow.d.ts +53 -0
  205. package/dist/workflow.d.ts.map +1 -0
  206. package/dist/workflow.js +405 -0
  207. package/dist/workflow.js.map +1 -0
  208. package/docs/architecture/mcp-integration-guide.md +131 -0
  209. package/docs/architecture/overview.md +93 -0
  210. package/docs/architecture/tool-system-design.md +89 -0
  211. package/docs/cli/commands.md +189 -0
  212. package/docs/smart-mode.md +257 -0
  213. package/docs/third-party-models.md +449 -0
  214. package/package.json +85 -0
  215. package/scripts/init-skills-path.js +58 -0
  216. package/skills/.claude-plugin/marketplace.json +45 -0
  217. package/skills/README.md +94 -0
  218. package/skills/THIRD_PARTY_NOTICES.md +405 -0
  219. package/skills/skills/algorithmic-art/LICENSE.txt +202 -0
  220. package/skills/skills/algorithmic-art/SKILL.md +405 -0
  221. package/skills/skills/algorithmic-art/templates/generator_template.js +223 -0
  222. package/skills/skills/algorithmic-art/templates/viewer.html +599 -0
  223. package/skills/skills/brand-guidelines/LICENSE.txt +202 -0
  224. package/skills/skills/brand-guidelines/SKILL.md +73 -0
  225. package/skills/skills/canvas-design/LICENSE.txt +202 -0
  226. package/skills/skills/canvas-design/SKILL.md +130 -0
  227. package/skills/skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
  228. package/skills/skills/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
  229. package/skills/skills/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
  230. package/skills/skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
  231. package/skills/skills/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
  232. package/skills/skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
  233. package/skills/skills/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
  234. package/skills/skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
  235. package/skills/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
  236. package/skills/skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
  237. package/skills/skills/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
  238. package/skills/skills/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
  239. package/skills/skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
  240. package/skills/skills/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
  241. package/skills/skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
  242. package/skills/skills/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
  243. package/skills/skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
  244. package/skills/skills/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
  245. package/skills/skills/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
  246. package/skills/skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
  247. package/skills/skills/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
  248. package/skills/skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
  249. package/skills/skills/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
  250. package/skills/skills/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
  251. package/skills/skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
  252. package/skills/skills/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
  253. package/skills/skills/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
  254. package/skills/skills/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
  255. package/skills/skills/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
  256. package/skills/skills/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
  257. package/skills/skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
  258. package/skills/skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
  259. package/skills/skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
  260. package/skills/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
  261. package/skills/skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
  262. package/skills/skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
  263. package/skills/skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
  264. package/skills/skills/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
  265. package/skills/skills/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
  266. package/skills/skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
  267. package/skills/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
  268. package/skills/skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
  269. package/skills/skills/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
  270. package/skills/skills/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
  271. package/skills/skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
  272. package/skills/skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
  273. package/skills/skills/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
  274. package/skills/skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
  275. package/skills/skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
  276. package/skills/skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
  277. package/skills/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
  278. package/skills/skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
  279. package/skills/skills/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
  280. package/skills/skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
  281. package/skills/skills/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
  282. package/skills/skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
  283. package/skills/skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
  284. package/skills/skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
  285. package/skills/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
  286. package/skills/skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
  287. package/skills/skills/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
  288. package/skills/skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
  289. package/skills/skills/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
  290. package/skills/skills/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
  291. package/skills/skills/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
  292. package/skills/skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
  293. package/skills/skills/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
  294. package/skills/skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
  295. package/skills/skills/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
  296. package/skills/skills/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
  297. package/skills/skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
  298. package/skills/skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
  299. package/skills/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
  300. package/skills/skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
  301. package/skills/skills/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
  302. package/skills/skills/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
  303. package/skills/skills/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
  304. package/skills/skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
  305. package/skills/skills/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
  306. package/skills/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
  307. package/skills/skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
  308. package/skills/skills/doc-coauthoring/SKILL.md +375 -0
  309. package/skills/skills/docx/LICENSE.txt +30 -0
  310. package/skills/skills/docx/SKILL.md +197 -0
  311. package/skills/skills/docx/docx-js.md +350 -0
  312. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  313. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  314. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  315. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  316. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  317. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  318. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  319. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  320. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  321. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  322. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  323. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  324. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  325. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  326. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  327. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  328. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  329. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  330. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  331. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  332. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  333. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  334. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  335. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  336. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  337. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  338. package/skills/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  339. package/skills/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  340. package/skills/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  341. package/skills/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  342. package/skills/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  343. package/skills/skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
  344. package/skills/skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
  345. package/skills/skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
  346. package/skills/skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
  347. package/skills/skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
  348. package/skills/skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
  349. package/skills/skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  350. package/skills/skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
  351. package/skills/skills/docx/ooxml/scripts/pack.py +159 -0
  352. package/skills/skills/docx/ooxml/scripts/unpack.py +29 -0
  353. package/skills/skills/docx/ooxml/scripts/validate.py +69 -0
  354. package/skills/skills/docx/ooxml/scripts/validation/__init__.py +15 -0
  355. package/skills/skills/docx/ooxml/scripts/validation/base.py +951 -0
  356. package/skills/skills/docx/ooxml/scripts/validation/docx.py +274 -0
  357. package/skills/skills/docx/ooxml/scripts/validation/pptx.py +315 -0
  358. package/skills/skills/docx/ooxml/scripts/validation/redlining.py +279 -0
  359. package/skills/skills/docx/ooxml.md +610 -0
  360. package/skills/skills/docx/scripts/__init__.py +1 -0
  361. package/skills/skills/docx/scripts/document.py +1276 -0
  362. package/skills/skills/docx/scripts/templates/comments.xml +3 -0
  363. package/skills/skills/docx/scripts/templates/commentsExtended.xml +3 -0
  364. package/skills/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
  365. package/skills/skills/docx/scripts/templates/commentsIds.xml +3 -0
  366. package/skills/skills/docx/scripts/templates/people.xml +3 -0
  367. package/skills/skills/docx/scripts/utilities.py +374 -0
  368. package/skills/skills/frontend-design/LICENSE.txt +177 -0
  369. package/skills/skills/frontend-design/SKILL.md +42 -0
  370. package/skills/skills/internal-comms/LICENSE.txt +202 -0
  371. package/skills/skills/internal-comms/SKILL.md +32 -0
  372. package/skills/skills/internal-comms/examples/3p-updates.md +47 -0
  373. package/skills/skills/internal-comms/examples/company-newsletter.md +65 -0
  374. package/skills/skills/internal-comms/examples/faq-answers.md +30 -0
  375. package/skills/skills/internal-comms/examples/general-comms.md +16 -0
  376. package/skills/skills/mcp-builder/LICENSE.txt +202 -0
  377. package/skills/skills/mcp-builder/SKILL.md +236 -0
  378. package/skills/skills/mcp-builder/reference/evaluation.md +602 -0
  379. package/skills/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
  380. package/skills/skills/mcp-builder/reference/node_mcp_server.md +970 -0
  381. package/skills/skills/mcp-builder/reference/python_mcp_server.md +719 -0
  382. package/skills/skills/mcp-builder/scripts/connections.py +151 -0
  383. package/skills/skills/mcp-builder/scripts/evaluation.py +373 -0
  384. package/skills/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
  385. package/skills/skills/mcp-builder/scripts/requirements.txt +2 -0
  386. package/skills/skills/pdf/LICENSE.txt +30 -0
  387. package/skills/skills/pdf/SKILL.md +294 -0
  388. package/skills/skills/pdf/forms.md +205 -0
  389. package/skills/skills/pdf/reference.md +612 -0
  390. package/skills/skills/pdf/scripts/check_bounding_boxes.py +70 -0
  391. package/skills/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
  392. package/skills/skills/pdf/scripts/check_fillable_fields.py +12 -0
  393. package/skills/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
  394. package/skills/skills/pdf/scripts/create_validation_image.py +41 -0
  395. package/skills/skills/pdf/scripts/extract_form_field_info.py +152 -0
  396. package/skills/skills/pdf/scripts/fill_fillable_fields.py +114 -0
  397. package/skills/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
  398. package/skills/skills/pptx/LICENSE.txt +30 -0
  399. package/skills/skills/pptx/SKILL.md +484 -0
  400. package/skills/skills/pptx/html2pptx.md +625 -0
  401. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  402. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  403. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  404. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  405. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  406. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  407. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  408. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  409. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  410. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  411. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  412. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  413. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  414. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  415. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  416. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  417. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  418. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  419. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  420. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  421. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  422. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  423. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  424. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  425. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  426. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  427. package/skills/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  428. package/skills/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  429. package/skills/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  430. package/skills/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  431. package/skills/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  432. package/skills/skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
  433. package/skills/skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
  434. package/skills/skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
  435. package/skills/skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
  436. package/skills/skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
  437. package/skills/skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
  438. package/skills/skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  439. package/skills/skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
  440. package/skills/skills/pptx/ooxml/scripts/pack.py +159 -0
  441. package/skills/skills/pptx/ooxml/scripts/unpack.py +29 -0
  442. package/skills/skills/pptx/ooxml/scripts/validate.py +69 -0
  443. package/skills/skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
  444. package/skills/skills/pptx/ooxml/scripts/validation/base.py +951 -0
  445. package/skills/skills/pptx/ooxml/scripts/validation/docx.py +274 -0
  446. package/skills/skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
  447. package/skills/skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
  448. package/skills/skills/pptx/ooxml.md +427 -0
  449. package/skills/skills/pptx/scripts/html2pptx.js +979 -0
  450. package/skills/skills/pptx/scripts/inventory.py +1020 -0
  451. package/skills/skills/pptx/scripts/rearrange.py +231 -0
  452. package/skills/skills/pptx/scripts/replace.py +385 -0
  453. package/skills/skills/pptx/scripts/thumbnail.py +450 -0
  454. package/skills/skills/skill-creator/LICENSE.txt +202 -0
  455. package/skills/skills/skill-creator/SKILL.md +356 -0
  456. package/skills/skills/skill-creator/references/output-patterns.md +82 -0
  457. package/skills/skills/skill-creator/references/workflows.md +28 -0
  458. package/skills/skills/skill-creator/scripts/init_skill.py +303 -0
  459. package/skills/skills/skill-creator/scripts/package_skill.py +110 -0
  460. package/skills/skills/skill-creator/scripts/quick_validate.py +95 -0
  461. package/skills/skills/slack-gif-creator/LICENSE.txt +202 -0
  462. package/skills/skills/slack-gif-creator/SKILL.md +254 -0
  463. package/skills/skills/slack-gif-creator/core/easing.py +234 -0
  464. package/skills/skills/slack-gif-creator/core/frame_composer.py +176 -0
  465. package/skills/skills/slack-gif-creator/core/gif_builder.py +269 -0
  466. package/skills/skills/slack-gif-creator/core/validators.py +136 -0
  467. package/skills/skills/slack-gif-creator/requirements.txt +4 -0
  468. package/skills/skills/theme-factory/LICENSE.txt +202 -0
  469. package/skills/skills/theme-factory/SKILL.md +59 -0
  470. package/skills/skills/theme-factory/theme-showcase.pdf +0 -0
  471. package/skills/skills/theme-factory/themes/arctic-frost.md +19 -0
  472. package/skills/skills/theme-factory/themes/botanical-garden.md +19 -0
  473. package/skills/skills/theme-factory/themes/desert-rose.md +19 -0
  474. package/skills/skills/theme-factory/themes/forest-canopy.md +19 -0
  475. package/skills/skills/theme-factory/themes/golden-hour.md +19 -0
  476. package/skills/skills/theme-factory/themes/midnight-galaxy.md +19 -0
  477. package/skills/skills/theme-factory/themes/modern-minimalist.md +19 -0
  478. package/skills/skills/theme-factory/themes/ocean-depths.md +19 -0
  479. package/skills/skills/theme-factory/themes/sunset-boulevard.md +19 -0
  480. package/skills/skills/theme-factory/themes/tech-innovation.md +19 -0
  481. package/skills/skills/web-artifacts-builder/LICENSE.txt +202 -0
  482. package/skills/skills/web-artifacts-builder/SKILL.md +74 -0
  483. package/skills/skills/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
  484. package/skills/skills/web-artifacts-builder/scripts/init-artifact.sh +322 -0
  485. package/skills/skills/webapp-testing/LICENSE.txt +202 -0
  486. package/skills/skills/webapp-testing/SKILL.md +96 -0
  487. package/skills/skills/webapp-testing/examples/console_logging.py +35 -0
  488. package/skills/skills/webapp-testing/examples/element_discovery.py +40 -0
  489. package/skills/skills/webapp-testing/examples/static_html_automation.py +33 -0
  490. package/skills/skills/webapp-testing/scripts/with_server.py +106 -0
  491. package/skills/skills/xlsx/LICENSE.txt +30 -0
  492. package/skills/skills/xlsx/SKILL.md +289 -0
  493. package/skills/skills/xlsx/recalc.py +178 -0
  494. package/skills/spec/agent-skills-spec.md +3 -0
  495. package/skills/template/SKILL.md +6 -0
  496. package/src/agents.ts +504 -0
  497. package/src/ai-client.ts +1456 -0
  498. package/src/auth.ts +648 -0
  499. package/src/cancellation.ts +176 -0
  500. package/src/checkpoint.ts +219 -0
  501. package/src/cli.ts +384 -0
  502. package/src/config.ts +248 -0
  503. package/src/context-compressor.ts +290 -0
  504. package/src/conversation.ts +288 -0
  505. package/src/gui-subagent/action-parser/actionParser.ts +312 -0
  506. package/src/gui-subagent/action-parser/constants.ts +12 -0
  507. package/src/gui-subagent/action-parser/index.ts +6 -0
  508. package/src/gui-subagent/action-parser/types.ts +31 -0
  509. package/src/gui-subagent/agent/gui-agent.ts +982 -0
  510. package/src/gui-subagent/agent/index.ts +5 -0
  511. package/src/gui-subagent/index.ts +139 -0
  512. package/src/gui-subagent/operator/base-operator.ts +246 -0
  513. package/src/gui-subagent/operator/computer-operator.ts +520 -0
  514. package/src/gui-subagent/operator/index.ts +7 -0
  515. package/src/gui-subagent/types/actions.ts +263 -0
  516. package/src/gui-subagent/types/index.ts +6 -0
  517. package/src/gui-subagent/types/operator.ts +106 -0
  518. package/src/gui-subagent/utils.ts +51 -0
  519. package/src/index.ts +18 -0
  520. package/src/input-processor.ts +282 -0
  521. package/src/logger.ts +438 -0
  522. package/src/mcp.ts +563 -0
  523. package/src/memory.ts +303 -0
  524. package/src/session-manager.ts +308 -0
  525. package/src/session.ts +1280 -0
  526. package/src/skill-invoker.ts +1888 -0
  527. package/src/skill-loader.ts +476 -0
  528. package/src/slash-commands.ts +1150 -0
  529. package/src/smart-approval.ts +595 -0
  530. package/src/system-prompt-generator.ts +786 -0
  531. package/src/theme.ts +455 -0
  532. package/src/tools.ts +3398 -0
  533. package/src/types.ts +198 -0
  534. package/src/update.ts +270 -0
  535. package/src/workflow.ts +508 -0
  536. package/tsconfig.json +22 -0
  537. package/vitest.config.ts +19 -0
@@ -0,0 +1,729 @@
1
+ import { getAgentManager } from './agents.js';
2
+ import { getSkillInvoker } from './skill-invoker.js';
3
+ export class SystemPromptGenerator {
4
+ toolRegistry;
5
+ executionMode;
6
+ agentConfig;
7
+ constructor(toolRegistry, executionMode, agentConfig) {
8
+ this.toolRegistry = toolRegistry;
9
+ this.executionMode = executionMode;
10
+ this.agentConfig = agentConfig;
11
+ }
12
+ async generateEnhancedSystemPrompt(baseSystemPrompt) {
13
+ let availableTools = this.toolRegistry.getAll().filter(tool => tool.allowedModes.includes(this.executionMode));
14
+ if (this.agentConfig) {
15
+ const agentManager = getAgentManager();
16
+ const allowedToolNames = agentManager.getAvailableToolsForAgent(this.agentConfig, this.executionMode);
17
+ availableTools = availableTools.filter(tool => allowedToolNames.includes(tool.name));
18
+ }
19
+ let enhancedPrompt = baseSystemPrompt;
20
+ // Only add tool-related content if tools are available
21
+ if (availableTools.length > 0) {
22
+ const toolSchemas = this.getToolSchemas(availableTools);
23
+ const toolUsageGuide = this.generateToolUsageGuide(toolSchemas);
24
+ const hasInvokeSkillTool = availableTools.some(tool => tool.name === 'InvokeSkill');
25
+ const skillInstructions = hasInvokeSkillTool ? await this.generateSkillInstructions() : '';
26
+ const decisionMakingGuide = this.generateDecisionMakingGuide(availableTools);
27
+ const executionStrategy = this.generateExecutionStrategy();
28
+ enhancedPrompt += `
29
+
30
+ ${toolUsageGuide}
31
+
32
+ ${skillInstructions}
33
+
34
+ ${decisionMakingGuide}
35
+
36
+ ${executionStrategy}
37
+
38
+
39
+
40
+ ## Important Notes
41
+ - Always verify tool results before proceeding to next steps
42
+ - If a tool fails, analyze the error and try alternative approaches
43
+ - Use tools efficiently - avoid redundant calls
44
+ - When in doubt, ask the user for clarification
45
+ - Maintain context across tool calls to build a coherent solution`;
46
+ }
47
+ else {
48
+ // No tools available - explicitly tell the AI not to use tools
49
+ enhancedPrompt += `
50
+
51
+ ## IMPORTANT: READ-ONLY MODE
52
+
53
+ You are in DEFAULT mode (read-only mode). You CANNOT use any tools or functions.
54
+
55
+ STRICT PROHIBITIONS:
56
+ - DO NOT attempt to call any functions, tools, or commands
57
+ - DO NOT output any tool call syntax, such as:
58
+ - <function_calls>...</function_calls>
59
+ - ToolName(params)
60
+ - Function call format
61
+ - Any similar syntax
62
+ - DO NOT simulate tool calls or pretend to use tools
63
+ - DO NOT output code that would execute tools
64
+
65
+ REQUIRED BEHAVIOR:
66
+ - Respond ONLY with plain text
67
+ - Answer questions based on your knowledge
68
+ - If you need to read files or perform actions, ask the user to switch modes
69
+ - Tell the user they can use "/mode yolo" or "/mode accept_edits" to enable tools
70
+
71
+ Remember: You are in a conversational mode, not a tool-execution mode. Just talk to the user!`;
72
+ }
73
+ return enhancedPrompt;
74
+ }
75
+ getToolSchemas(tools) {
76
+ return tools.map(tool => this.createToolSchema(tool));
77
+ }
78
+ createToolSchema(tool) {
79
+ const schemas = {
80
+ Read: {
81
+ name: 'Read',
82
+ description: 'Read the contents of a file from the filesystem',
83
+ parameters: {
84
+ filePath: {
85
+ type: 'string',
86
+ description: 'Path to the file to read (relative or absolute)',
87
+ required: true
88
+ },
89
+ offset: {
90
+ type: 'number',
91
+ description: 'Starting line number (0-indexed)',
92
+ required: false,
93
+ default: 0
94
+ },
95
+ limit: {
96
+ type: 'number',
97
+ description: 'Maximum number of lines to read',
98
+ required: false
99
+ }
100
+ },
101
+ usage: 'Use this tool when you need to examine file contents, understand code structure, or read configuration files',
102
+ examples: [
103
+ 'Read a specific file: Read(filePath="package.json")',
104
+ 'Read with line range: Read(filePath="src/index.ts", offset=100, limit=50)'
105
+ ],
106
+ bestPractices: [
107
+ 'Always check if file exists before reading',
108
+ 'Use offset and limit for large files to avoid excessive output',
109
+ 'Read configuration files first to understand project structure'
110
+ ]
111
+ },
112
+ Write: {
113
+ name: 'Write',
114
+ description: 'Write content to a file, creating directories if needed',
115
+ parameters: {
116
+ filePath: {
117
+ type: 'string',
118
+ description: 'Path where the file should be written',
119
+ required: true
120
+ },
121
+ content: {
122
+ type: 'string',
123
+ description: 'Content to write to the file',
124
+ required: true
125
+ }
126
+ },
127
+ usage: 'Use this tool to create new files or completely overwrite existing files',
128
+ examples: [
129
+ 'Create a new file: Write(filePath="src/utils.ts", content="export function helper() {}")',
130
+ 'Write configuration: Write(filePath=".env", content="API_KEY=secret")'
131
+ ],
132
+ bestPractices: [
133
+ 'Always read existing file before overwriting',
134
+ 'Use proper file extensions',
135
+ 'Create necessary directory structures',
136
+ 'Include appropriate comments and documentation'
137
+ ]
138
+ },
139
+ Grep: {
140
+ name: 'Grep',
141
+ description: 'Search for text patterns across multiple files',
142
+ parameters: {
143
+ pattern: {
144
+ type: 'string',
145
+ description: 'Text pattern or regex to search for',
146
+ required: true
147
+ },
148
+ path: {
149
+ type: 'string',
150
+ description: 'Directory path to search in',
151
+ required: false,
152
+ default: '.'
153
+ },
154
+ include: {
155
+ type: 'string',
156
+ description: 'File pattern to include (glob)',
157
+ required: false
158
+ },
159
+ exclude: {
160
+ type: 'string',
161
+ description: 'File pattern to exclude (glob)',
162
+ required: false
163
+ },
164
+ case_sensitive: {
165
+ type: 'boolean',
166
+ description: 'Whether search is case-sensitive',
167
+ required: false,
168
+ default: false
169
+ },
170
+ fixed_strings: {
171
+ type: 'boolean',
172
+ description: 'Treat pattern as literal string, not regex',
173
+ required: false,
174
+ default: false
175
+ },
176
+ context: {
177
+ type: 'number',
178
+ description: 'Number of context lines before and after match',
179
+ required: false
180
+ },
181
+ before: {
182
+ type: 'number',
183
+ description: 'Number of context lines before match',
184
+ required: false
185
+ },
186
+ after: {
187
+ type: 'number',
188
+ description: 'Number of context lines after match',
189
+ required: false
190
+ },
191
+ no_ignore: {
192
+ type: 'boolean',
193
+ description: 'Ignore .gitignore patterns',
194
+ required: false,
195
+ default: false
196
+ }
197
+ },
198
+ usage: 'Search for code patterns, function definitions, or text across the codebase',
199
+ examples: [
200
+ 'Search for function: Grep(pattern="function.*\\(.*\\)")',
201
+ 'Find specific text: Grep(pattern="TODO", case_sensitive=true)',
202
+ 'Search in specific files: Grep(pattern="import", include="*.ts")'
203
+ ],
204
+ bestPractices: [
205
+ 'Use fixed_strings for simple text searches',
206
+ 'Use context to see surrounding code',
207
+ 'Narrow search with include/exclude patterns',
208
+ 'Use case_sensitive for exact matches'
209
+ ]
210
+ },
211
+ Bash: {
212
+ name: 'Bash',
213
+ description: 'Execute shell commands in the terminal',
214
+ parameters: {
215
+ command: {
216
+ type: 'string',
217
+ description: 'Shell command to execute',
218
+ required: true
219
+ },
220
+ cwd: {
221
+ type: 'string',
222
+ description: 'Working directory for command execution',
223
+ required: false
224
+ },
225
+ description: {
226
+ type: 'string',
227
+ description: 'Human-readable description of what the command does',
228
+ required: false
229
+ },
230
+ timeout: {
231
+ type: 'number',
232
+ description: 'Timeout in seconds (default: 120)',
233
+ required: false,
234
+ default: 120
235
+ },
236
+ run_in_bg: {
237
+ type: 'boolean',
238
+ description: 'Run command in background',
239
+ required: false,
240
+ default: false
241
+ }
242
+ },
243
+ usage: 'Execute terminal commands, run tests, install dependencies, or perform system operations',
244
+ examples: [
245
+ 'Install dependencies: Bash(command="npm install")',
246
+ 'Run tests: Bash(command="npm test", description="Run unit tests")',
247
+ 'Build project: Bash(command="npm run build")'
248
+ ],
249
+ bestPractices: [
250
+ 'Always provide clear descriptions',
251
+ 'Use appropriate timeout values',
252
+ 'Check command exit codes',
253
+ 'Handle errors gracefully',
254
+ 'Use run_in_bg for long-running processes'
255
+ ]
256
+ },
257
+ ListDirectory: {
258
+ name: 'ListDirectory',
259
+ description: 'List files and directories in a given path',
260
+ parameters: {
261
+ path: {
262
+ type: 'string',
263
+ description: 'Directory path to list',
264
+ required: true
265
+ },
266
+ recursive: {
267
+ type: 'boolean',
268
+ description: 'List recursively',
269
+ required: false,
270
+ default: false
271
+ }
272
+ },
273
+ usage: 'Explore directory structure, find files, or understand project layout',
274
+ examples: [
275
+ 'List current directory: ListDirectory(path=".")',
276
+ 'List recursively: ListDirectory(path="src", recursive=true)'
277
+ ],
278
+ bestPractices: [
279
+ 'Use recursive for deep exploration',
280
+ 'Combine with Read to examine files',
281
+ 'Check directory existence first'
282
+ ]
283
+ },
284
+ SearchCodebase: {
285
+ name: 'SearchCodebase',
286
+ description: 'Semantic search through the codebase using embeddings',
287
+ parameters: {
288
+ query: {
289
+ type: 'string',
290
+ description: 'Natural language query describing what to search for',
291
+ required: true
292
+ },
293
+ target_directories: {
294
+ type: 'array',
295
+ description: 'Specific directories to search in',
296
+ required: false
297
+ }
298
+ },
299
+ usage: 'Find code by meaning rather than exact text matches',
300
+ examples: [
301
+ 'Find authentication logic: SearchCodebase(query="how do we check authentication headers?")',
302
+ 'Find error handling: SearchCodebase(query="where do we do error handling in the file watcher?")'
303
+ ],
304
+ bestPractices: [
305
+ 'Use natural language queries',
306
+ 'Be specific about what you are looking for',
307
+ 'Combine with Read to examine found code'
308
+ ]
309
+ },
310
+ DeleteFile: {
311
+ name: 'DeleteFile',
312
+ description: 'Delete a file from the filesystem',
313
+ parameters: {
314
+ filePath: {
315
+ type: 'string',
316
+ description: 'Path to the file to delete',
317
+ required: true
318
+ }
319
+ },
320
+ usage: 'Remove files that are no longer needed',
321
+ examples: [
322
+ 'Delete file: DeleteFile(filePath="old-file.txt")'
323
+ ],
324
+ bestPractices: [
325
+ 'Verify file is not needed before deletion',
326
+ 'Use with caution - deletion is permanent',
327
+ 'Consider backing up important files'
328
+ ]
329
+ },
330
+ CreateDirectory: {
331
+ name: 'CreateDirectory',
332
+ description: 'Create a directory and any necessary parent directories',
333
+ parameters: {
334
+ path: {
335
+ type: 'string',
336
+ description: 'Directory path to create',
337
+ required: true
338
+ }
339
+ },
340
+ usage: 'Create directory structures for organizing files',
341
+ examples: [
342
+ 'Create directory: CreateDirectory(path="src/components")'
343
+ ],
344
+ bestPractices: [
345
+ 'Use descriptive directory names',
346
+ 'Follow project conventions',
347
+ 'Create necessary parent directories automatically'
348
+ ]
349
+ },
350
+ Replace: {
351
+ name: 'Replace',
352
+ description: 'Replace text in a file using search and replace',
353
+ parameters: {
354
+ filePath: {
355
+ type: 'string',
356
+ description: 'Path to the file to modify',
357
+ required: true
358
+ },
359
+ old_str: {
360
+ type: 'string',
361
+ description: 'Text to search for',
362
+ required: true
363
+ },
364
+ new_str: {
365
+ type: 'string',
366
+ description: 'Text to replace with',
367
+ required: true
368
+ }
369
+ },
370
+ usage: 'Make targeted edits to files without rewriting entire content',
371
+ examples: [
372
+ 'Replace text: Replace(filePath="config.json", old_str="old value", new_str="new value")'
373
+ ],
374
+ bestPractices: [
375
+ 'Use unique old_str to avoid multiple replacements',
376
+ 'Read file first to verify content',
377
+ 'Use Write for large changes'
378
+ ]
379
+ },
380
+ WebSearch: {
381
+ name: 'WebSearch',
382
+ description: 'Search the web for information',
383
+ parameters: {
384
+ query: {
385
+ type: 'string',
386
+ description: 'Search query',
387
+ required: true
388
+ },
389
+ num: {
390
+ type: 'number',
391
+ description: 'Number of results to return',
392
+ required: false,
393
+ default: 5
394
+ }
395
+ },
396
+ usage: 'Find information online, research topics, or get current data',
397
+ examples: [
398
+ 'Search web: WebSearch(query="latest Node.js version")',
399
+ 'Multiple results: WebSearch(query="React best practices", num=10)'
400
+ ],
401
+ bestPractices: [
402
+ 'Use specific search queries',
403
+ 'Limit results for focused answers',
404
+ 'Verify information from multiple sources'
405
+ ]
406
+ },
407
+ WebFetch: {
408
+ name: 'WebFetch',
409
+ description: 'Fetch and process URL content',
410
+ parameters: {
411
+ prompt: {
412
+ type: 'string',
413
+ description: 'Prompt containing URL to fetch',
414
+ required: true
415
+ }
416
+ },
417
+ usage: 'Retrieve content from web pages, APIs, or online resources',
418
+ examples: [
419
+ 'Fetch URL: WebFetch(prompt="https://api.example.com/data")'
420
+ ],
421
+ bestPractices: [
422
+ 'Handle network errors gracefully',
423
+ 'Validate URL format',
424
+ 'Consider rate limiting'
425
+ ]
426
+ },
427
+ TodoWrite: {
428
+ name: 'TodoWrite',
429
+ description: 'Create and manage structured task lists',
430
+ parameters: {
431
+ todos: {
432
+ type: 'array',
433
+ description: 'Array of todo items with id, task, status, and priority',
434
+ required: true
435
+ }
436
+ },
437
+ usage: 'Plan and track complex multi-step tasks',
438
+ examples: [
439
+ 'Create todos: TodoWrite(todos=[{"id":"1","task":"Install dependencies","status":"pending","priority":"high"}])'
440
+ ],
441
+ bestPractices: [
442
+ 'Use descriptive task names',
443
+ 'Set appropriate priorities',
444
+ 'Update status as tasks progress',
445
+ 'Break down complex tasks into smaller steps'
446
+ ]
447
+ },
448
+ Task: {
449
+ name: 'Task',
450
+ description: 'Launch a specialized agent to handle specific tasks',
451
+ parameters: {
452
+ description: {
453
+ type: 'string',
454
+ description: 'Brief description of the task',
455
+ required: true
456
+ },
457
+ query: {
458
+ type: 'string',
459
+ description: 'Detailed task instructions',
460
+ required: true
461
+ },
462
+ subagent_type: {
463
+ type: 'string',
464
+ description: 'Type of agent to use (plan-agent, explore-agent, frontend-tester, code-reviewer, frontend-developer, backend-developer)',
465
+ required: true
466
+ },
467
+ response_language: {
468
+ type: 'string',
469
+ description: 'Language for the response',
470
+ required: false
471
+ }
472
+ },
473
+ usage: 'Delegate specialized tasks to expert agents',
474
+ examples: [
475
+ 'Plan task: Task(description="Create implementation plan", query="Create a detailed plan for implementing user authentication system", subagent_type="plan-agent")',
476
+ 'Explore codebase: Task(description="Explore auth module", query="Find and analyze all authentication-related code in the codebase", subagent_type="explore-agent")',
477
+ 'Run tests: Task(description="Create component tests", query="Write unit tests for the Button component including edge cases", subagent_type="frontend-tester")'
478
+ ],
479
+ bestPractices: [
480
+ 'Choose appropriate agent type for the task',
481
+ 'Provide clear task descriptions',
482
+ 'Specify desired response language if needed',
483
+ 'Review agent results carefully'
484
+ ]
485
+ }
486
+ };
487
+ // Fallback for unknown tools (including MCP tools)
488
+ if (schemas[tool.name]) {
489
+ return schemas[tool.name];
490
+ }
491
+ // Convert MCP inputSchema to parameters format
492
+ const parameters = {};
493
+ if (tool.inputSchema?.properties) {
494
+ for (const [paramName, paramDef] of Object.entries(tool.inputSchema.properties)) {
495
+ parameters[paramName] = {
496
+ type: paramDef.type || 'any',
497
+ description: paramDef.description || '',
498
+ required: tool.inputSchema.required?.includes(paramName) || false,
499
+ enum: paramDef.enum
500
+ };
501
+ }
502
+ }
503
+ return {
504
+ name: tool.name,
505
+ description: tool.description,
506
+ parameters,
507
+ usage: `Use ${tool.name} for related tasks`,
508
+ examples: [],
509
+ bestPractices: []
510
+ };
511
+ }
512
+ generateToolUsageGuide(toolSchemas) {
513
+ let guide = '## Available Tools\n\n';
514
+ guide += 'You have access to the following tools. Use them to accomplish user requests:\n\n';
515
+ toolSchemas.forEach(schema => {
516
+ guide += `### ${schema.name}\n\n`;
517
+ guide += `**Description**: ${schema.description}\n\n`;
518
+ guide += `**Usage**: ${schema.usage}\n\n`;
519
+ guide += `**Parameters**:\n`;
520
+ Object.entries(schema.parameters).forEach(([paramName, param]) => {
521
+ const required = param.required ? ' (required)' : ' (optional)';
522
+ const defaultValue = param.default !== undefined ? ` (default: ${param.default})` : '';
523
+ guide += `- \`${paramName}\`${required}${defaultValue}: ${param.description}\n`;
524
+ });
525
+ if (schema.examples.length > 0) {
526
+ guide += `\n**Examples**:\n`;
527
+ schema.examples.forEach(example => {
528
+ guide += `- ${example}\n`;
529
+ });
530
+ }
531
+ if (schema.bestPractices.length > 0) {
532
+ guide += `\n**Best Practices**:\n`;
533
+ schema.bestPractices.forEach(practice => {
534
+ guide += `- ${practice}\n`;
535
+ });
536
+ }
537
+ guide += '\n---\n\n';
538
+ });
539
+ return guide;
540
+ }
541
+ generateDecisionMakingGuide(availableTools) {
542
+ // 工具名称到简短描述的映射
543
+ const toolDescriptions = {
544
+ 'Read': 'When you need to understand existing code, configuration, or documentation',
545
+ 'Write': 'When creating new files or completely replacing existing content',
546
+ 'Grep': 'When searching for specific patterns, function names, or text across files',
547
+ 'Bash': 'When running tests, installing dependencies, building projects, or executing terminal commands',
548
+ 'SearchCodebase': 'When finding code by meaning rather than exact text matches',
549
+ 'ListDirectory': 'When exploring project structure or finding files',
550
+ 'Replace': 'When making targeted edits without rewriting entire files',
551
+ 'web_search': 'When you need current information from the internet',
552
+ 'web_fetch': 'When retrieving content from specific URLs',
553
+ 'todo_write': 'When planning and tracking complex multi-step tasks',
554
+ 'task': 'When delegating specialized work to expert agents',
555
+ 'DeleteFile': 'When you need to remove a file from the filesystem',
556
+ 'CreateDirectory': 'When you need to create a new directory or folder structure',
557
+ 'ReadBashOutput': 'When you need to read the output of a background task',
558
+ 'ask_user_question': 'When you need to ask the user for clarification or decisions',
559
+ 'save_memory': 'When you need to remember important information for future sessions',
560
+ 'exit_plan_mode': 'When you have completed planning and are ready to execute',
561
+ 'xml_escape': 'When you need to escape special characters in XML/HTML files',
562
+ 'image_read': 'When you need to analyze or read image files',
563
+ 'InvokeSkill': 'When you need to use specialized skills for domain tasks (see Available Skills section for details)'
564
+ };
565
+ // 根据可用工具生成 "When to Use Tools" 部分
566
+ let toolsSection = '### When to Use Tools\n';
567
+ if (availableTools.length > 0) {
568
+ for (const tool of availableTools) {
569
+ const description = toolDescriptions[tool.name] || `When you need to use ${tool.name}`;
570
+ toolsSection += `- **${tool.name}**: ${description}\n`;
571
+ }
572
+ }
573
+ else {
574
+ toolsSection += '- (No tools available in current mode)\n';
575
+ }
576
+ return `## Decision Making Guide
577
+
578
+ ${toolsSection}
579
+
580
+ ### CRITICAL: IMMEDIATE TOOL EXECUTION
581
+ **YOU MUST CALL TOOLS IMMEDIATELY when needed - DO NOT say "let me..." or "I will..." first!**
582
+
583
+ When a user asks you to:
584
+ - Read files → IMMEDIATELY call Read tool with the file path
585
+ - List directory → IMMEDIATELY call ListDirectory tool
586
+ - Search code → IMMEDIATELY call Grep or SearchCodebase tool
587
+ - Run commands → IMMEDIATELY call Bash tool
588
+ - Introduce the codebase → IMMEDIATELY call ListDirectory and Read tools
589
+ - Analyze the project → IMMEDIATELY call ListDirectory and Read tools
590
+ - Explain the code → IMMEDIATELY call Read tools
591
+ - Any action requiring tools → IMMEDIATELY make the tool call
592
+
593
+ **ABSOLUTELY WRONG**:
594
+ - "Let me explore the codebase structure first" (then do nothing)
595
+ - "I will read the file for you" (then do nothing)
596
+ - "Let me help you explore this codebase" (then do nothing)
597
+ - "Let me understand this first" (then do nothing)
598
+
599
+ **ABSOLUTELY CORRECT**:
600
+ - Call ListDirectory(path=".") immediately to explore the structure
601
+ - Call Read(filePath="path/to/file") immediately to read the file
602
+ - Call ListDirectory(path=".") immediately when asked to introduce the codebase
603
+
604
+ **ZERO DELAY POLICY**:
605
+ - Do NOT add any conversational filler before tool calls
606
+ - Do NOT say "I'm going to" or "Let me" - just CALL THE TOOL
607
+ - Your response should START with the tool call, not with a statement about what you'll do
608
+
609
+ ### Tool Selection Strategy
610
+ 1. **Analyze the user's request** - Understand what they want to accomplish
611
+ 2. **Identify the core task** - Determine the primary action needed
612
+ 3. **Choose the most appropriate tool** - Select the tool that best matches the task
613
+ 4. **Consider dependencies** - Some tasks require multiple tools in sequence
614
+ 5. **Plan the execution order** - Determine the logical sequence of tool calls
615
+ 6. **EXECUTE IMMEDIATELY** - Make the tool call right away without delay
616
+
617
+ ### Common Patterns
618
+ - **Code exploration**: ListDirectory → Read → Grep/SearchCodebase
619
+ - **Feature implementation**: Read (existing code) → Write (new files) → Bash (test)
620
+ - **Bug fixing**: Grep/SearchCodebase (find issue) → Read (understand) → Replace/Write (fix) → Bash (verify)
621
+ - **Project setup**: WebSearch (research) → Write (create files) → Bash (install/build)
622
+ - **Documentation**: Read (code) → Write (docs)
623
+
624
+ ### Error Handling
625
+ - If a tool fails, analyze the error message
626
+ - Try alternative approaches or parameters
627
+ - Ask the user for clarification if needed
628
+ - Report errors clearly with context`;
629
+ }
630
+ generateExecutionStrategy() {
631
+ return `## Execution Strategy
632
+
633
+ ### Step-by-Step Approach
634
+ 1. **Understand the goal**: Clarify what the user wants to achieve
635
+ 2. **Plan the approach**: Break down complex tasks into smaller steps
636
+ 3. **Execute systematically**: Use tools in the right order
637
+ 4. **Verify results**: Check each step before proceeding
638
+ 5. **Report progress**: Keep the user informed of your actions
639
+
640
+ ### Efficiency Tips
641
+ - **Batch similar operations**: Group related tool calls together
642
+ - **Avoid redundant calls**: Don't read the same file multiple times
643
+ - **Use context wisely**: Leverage information from previous tool results
644
+ - **Be precise**: Use specific parameters to get exactly what you need
645
+
646
+ ### Quality Assurance
647
+ - Always verify tool outputs match expectations
648
+ - Test code changes before declaring success
649
+ - Check for edge cases and error conditions
650
+ - Ensure changes don't break existing functionality
651
+
652
+ ### Communication
653
+ - Explain your reasoning before taking action
654
+ - Provide clear summaries of what you've done
655
+ - Highlight any assumptions you've made
656
+ - Ask for confirmation on destructive operations`;
657
+ }
658
+ /**
659
+ * Dynamically generate skill instructions from loaded skills
660
+ */
661
+ async generateSkillInstructions() {
662
+ try {
663
+ const skillInvoker = getSkillInvoker();
664
+ await skillInvoker.initialize();
665
+ const skills = await skillInvoker.listAvailableSkills();
666
+ if (skills.length === 0) {
667
+ return '';
668
+ }
669
+ // Group skills by category
670
+ const skillsByCategory = new Map();
671
+ for (const skill of skills) {
672
+ const existing = skillsByCategory.get(skill.category) || [];
673
+ existing.push(skill);
674
+ skillsByCategory.set(skill.category, existing);
675
+ }
676
+ let guide = '## Available Skills\n\n';
677
+ guide += 'When users request tasks matching these domains, use the "InvokeSkill" tool to access specialized capabilities:\n\n';
678
+ for (const [category, categorySkills] of skillsByCategory) {
679
+ guide += `### ${category}\n`;
680
+ for (const skill of categorySkills) {
681
+ guide += `- **${skill.name}**: ${skill.description}\n`;
682
+ guide += ` → Invoke: InvokeSkill(skillId="${skill.id}", taskDescription="...")\n`;
683
+ }
684
+ guide += '\n';
685
+ }
686
+ return guide;
687
+ }
688
+ catch (error) {
689
+ // If skills can't be loaded, return empty string
690
+ return '';
691
+ }
692
+ }
693
+ getToolDefinitions() {
694
+ const tools = this.toolRegistry.getAll().filter(tool => tool.allowedModes.includes(this.executionMode));
695
+ return tools.map(tool => {
696
+ const schema = this.createToolSchema(tool);
697
+ const properties = {};
698
+ const required = [];
699
+ Object.entries(schema.parameters).forEach(([paramName, param]) => {
700
+ properties[paramName] = {
701
+ type: param.type,
702
+ description: param.description
703
+ };
704
+ if (param.enum) {
705
+ properties[paramName].enum = param.enum;
706
+ }
707
+ if (param.default !== undefined) {
708
+ properties[paramName].default = param.default;
709
+ }
710
+ if (param.required) {
711
+ required.push(paramName);
712
+ }
713
+ });
714
+ return {
715
+ type: 'function',
716
+ function: {
717
+ name: tool.name,
718
+ description: schema.description + '. ' + schema.usage,
719
+ parameters: {
720
+ type: 'object',
721
+ properties,
722
+ required
723
+ }
724
+ }
725
+ };
726
+ });
727
+ }
728
+ }
729
+ //# sourceMappingURL=system-prompt-generator.js.map