micro-models-agent 0.2.92 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (393) hide show
  1. package/README.md +436 -436
  2. package/dist/agent/error-escalation.d.ts +18 -0
  3. package/dist/agent/error-escalation.d.ts.map +1 -0
  4. package/dist/agent/error-escalation.js +122 -0
  5. package/dist/agent/error-escalation.js.map +1 -0
  6. package/dist/agent/loop.d.ts +6 -5
  7. package/dist/agent/loop.d.ts.map +1 -1
  8. package/dist/agent/loop.js +433 -510
  9. package/dist/agent/loop.js.map +1 -1
  10. package/dist/agent/modes/applier.d.ts +2 -2
  11. package/dist/agent/modes/applier.d.ts.map +1 -1
  12. package/dist/agent/modes/registry.d.ts.map +1 -1
  13. package/dist/agent/modes/registry.js.map +1 -1
  14. package/dist/agent/modes/types.d.ts +12 -2
  15. package/dist/agent/modes/types.d.ts.map +1 -1
  16. package/dist/agent/react-loop.d.ts +4 -0
  17. package/dist/agent/react-loop.d.ts.map +1 -1
  18. package/dist/agent/react-loop.js +5 -23
  19. package/dist/agent/react-loop.js.map +1 -1
  20. package/dist/agent/system-prompt.d.ts +4 -3
  21. package/dist/agent/system-prompt.d.ts.map +1 -1
  22. package/dist/agent/system-prompt.js +392 -278
  23. package/dist/agent/system-prompt.js.map +1 -1
  24. package/dist/agent/tool-executor.d.ts +2 -0
  25. package/dist/agent/tool-executor.d.ts.map +1 -1
  26. package/dist/agent/tool-executor.js +1 -1
  27. package/dist/agent/tool-executor.js.map +1 -1
  28. package/dist/agent/write-enforcer.d.ts +11 -0
  29. package/dist/agent/write-enforcer.d.ts.map +1 -0
  30. package/dist/agent/write-enforcer.js +92 -0
  31. package/dist/agent/write-enforcer.js.map +1 -0
  32. package/dist/cli/config.d.ts +1 -1
  33. package/dist/cli/config.d.ts.map +1 -1
  34. package/dist/cli/config.js +53 -28
  35. package/dist/cli/config.js.map +1 -1
  36. package/dist/cli.d.ts.map +1 -1
  37. package/dist/cli.js +19 -16
  38. package/dist/cli.js.map +1 -1
  39. package/dist/config/config.d.ts +2 -1
  40. package/dist/config/config.d.ts.map +1 -1
  41. package/dist/config/config.js +78 -54
  42. package/dist/config/config.js.map +1 -1
  43. package/dist/config/types.d.ts +8 -1
  44. package/dist/config/types.d.ts.map +1 -1
  45. package/dist/logger.d.ts +1 -0
  46. package/dist/logger.d.ts.map +1 -1
  47. package/dist/logger.js +5 -0
  48. package/dist/logger.js.map +1 -1
  49. package/dist/plugins/builtin/lint-on-write/index.ts +96 -96
  50. package/dist/plugins/builtin/notify/index.js +6 -6
  51. package/dist/plugins/builtin/notify/index.ts +104 -104
  52. package/dist/repl/commands.js +0 -5
  53. package/dist/repl/commands.js.map +1 -1
  54. package/dist/repl/history.d.ts +2 -1
  55. package/dist/repl/history.d.ts.map +1 -1
  56. package/dist/repl/history.js.map +1 -1
  57. package/dist/repl/index.d.ts +2 -0
  58. package/dist/repl/index.d.ts.map +1 -1
  59. package/dist/repl/index.js +2 -2
  60. package/dist/repl/index.js.map +1 -1
  61. package/dist/setup-wizard.d.ts +1 -1
  62. package/dist/setup-wizard.d.ts.map +1 -1
  63. package/dist/setup-wizard.js +137 -105
  64. package/dist/setup-wizard.js.map +1 -1
  65. package/dist/skills/builtin/agent-test/SKILL.md +68 -68
  66. package/dist/skills/builtin/grill-me/SKILL.md +46 -46
  67. package/dist/skills/builtin/web-scraping/SKILL.md +422 -422
  68. package/dist/skills/loader.d.ts +16 -0
  69. package/dist/skills/loader.d.ts.map +1 -1
  70. package/dist/skills/loader.js +110 -9
  71. package/dist/skills/loader.js.map +1 -1
  72. package/dist/tools/id-gen.d.ts +4 -0
  73. package/dist/tools/id-gen.d.ts.map +1 -0
  74. package/dist/tools/id-gen.js +12 -0
  75. package/dist/tools/id-gen.js.map +1 -0
  76. package/dist/tools/native/project-map.d.ts +2 -2
  77. package/dist/tools/native/project-map.d.ts.map +1 -1
  78. package/dist/tools/native/project-map.js +85 -57
  79. package/dist/tools/native/project-map.js.map +1 -1
  80. package/dist/tools/native/scaffold.js +113 -113
  81. package/dist/tools/native/theme.d.ts.map +1 -1
  82. package/dist/tools/native/theme.js +0 -5
  83. package/dist/tools/native/theme.js.map +1 -1
  84. package/dist/tools/parse-tool-call.d.ts +11 -0
  85. package/dist/tools/parse-tool-call.d.ts.map +1 -0
  86. package/dist/tools/parse-tool-call.js +85 -0
  87. package/dist/tools/parse-tool-call.js.map +1 -0
  88. package/dist/tools/plan.d.ts +2 -0
  89. package/dist/tools/plan.d.ts.map +1 -1
  90. package/dist/tools/plan.js +8 -2
  91. package/dist/tools/plan.js.map +1 -1
  92. package/dist/tools/subagent.d.ts +0 -8
  93. package/dist/tools/subagent.d.ts.map +1 -1
  94. package/dist/tools/subagent.js +15 -94
  95. package/dist/tools/subagent.js.map +1 -1
  96. package/dist/tools/todo.d.ts +2 -0
  97. package/dist/tools/todo.d.ts.map +1 -1
  98. package/dist/tools/todo.js +8 -2
  99. package/dist/tools/todo.js.map +1 -1
  100. package/dist/tools/web-browse.js +7 -7
  101. package/dist/ui/index.d.ts +1 -15
  102. package/dist/ui/index.d.ts.map +1 -1
  103. package/dist/ui/index.js +1 -12
  104. package/dist/ui/index.js.map +1 -1
  105. package/dist/ui/ink/components/App.d.ts +0 -1
  106. package/dist/ui/ink/components/App.d.ts.map +1 -1
  107. package/dist/ui/ink/components/App.js +2 -8
  108. package/dist/ui/ink/components/App.js.map +1 -1
  109. package/dist/ui/ink/components/Conversation.d.ts +1 -2
  110. package/dist/ui/ink/components/Conversation.d.ts.map +1 -1
  111. package/dist/ui/ink/components/Conversation.js +8 -2
  112. package/dist/ui/ink/components/Conversation.js.map +1 -1
  113. package/dist/ui/ink/components/MessageBlock.d.ts +13 -1
  114. package/dist/ui/ink/components/MessageBlock.d.ts.map +1 -1
  115. package/dist/ui/ink/components/MessageBlock.js +15 -27
  116. package/dist/ui/ink/components/MessageBlock.js.map +1 -1
  117. package/dist/ui/ink/components/PromptInput.d.ts +11 -0
  118. package/dist/ui/ink/components/PromptInput.d.ts.map +1 -1
  119. package/dist/ui/ink/components/PromptInput.js +18 -141
  120. package/dist/ui/ink/components/PromptInput.js.map +1 -1
  121. package/dist/ui/ink/components/SelectInput.d.ts.map +1 -1
  122. package/dist/ui/ink/components/SelectInput.js +3 -2
  123. package/dist/ui/ink/components/SelectInput.js.map +1 -1
  124. package/dist/ui/ink/components/StatusBar.d.ts.map +1 -1
  125. package/dist/ui/ink/components/StatusBar.js +14 -6
  126. package/dist/ui/ink/components/StatusBar.js.map +1 -1
  127. package/dist/ui/ink/components/StreamBlock.d.ts.map +1 -1
  128. package/dist/ui/ink/components/StreamBlock.js +3 -3
  129. package/dist/ui/ink/components/StreamBlock.js.map +1 -1
  130. package/dist/ui/ink/components/Tags.d.ts +8 -11
  131. package/dist/ui/ink/components/Tags.d.ts.map +1 -1
  132. package/dist/ui/ink/components/Tags.js +4 -16
  133. package/dist/ui/ink/components/Tags.js.map +1 -1
  134. package/dist/ui/ink/components/ToolCallBlock.d.ts +12 -0
  135. package/dist/ui/ink/components/ToolCallBlock.d.ts.map +1 -1
  136. package/dist/ui/ink/components/ToolCallBlock.js +8 -24
  137. package/dist/ui/ink/components/ToolCallBlock.js.map +1 -1
  138. package/dist/ui/ink/renderer.d.ts +0 -1
  139. package/dist/ui/ink/renderer.d.ts.map +1 -1
  140. package/dist/ui/ink/renderer.js +1 -4
  141. package/dist/ui/ink/renderer.js.map +1 -1
  142. package/dist/ui/renderer.d.ts +2 -2
  143. package/dist/ui/renderer.d.ts.map +1 -1
  144. package/dist/ui/renderer.js +1 -1
  145. package/package.json +4 -8
  146. package/dist/async-map.d.ts +0 -6
  147. package/dist/async-map.d.ts.map +0 -1
  148. package/dist/async-map.js +0 -16
  149. package/dist/async-map.js.map +0 -1
  150. package/dist/blog-api/types/index.d.ts +0 -2
  151. package/dist/blog-api/types/index.d.ts.map +0 -1
  152. package/dist/blog-api/types/index.js +0 -2
  153. package/dist/blog-api/types/index.js.map +0 -1
  154. package/dist/examples.d.ts +0 -22
  155. package/dist/examples.d.ts.map +0 -1
  156. package/dist/examples.js +0 -45
  157. package/dist/examples.js.map +0 -1
  158. package/dist/fibonacci.d.ts +0 -19
  159. package/dist/fibonacci.d.ts.map +0 -1
  160. package/dist/fibonacci.js +0 -61
  161. package/dist/fibonacci.js.map +0 -1
  162. package/dist/parfymerie-landing/src/App.d.ts +0 -4
  163. package/dist/parfymerie-landing/src/App.d.ts.map +0 -1
  164. package/dist/parfymerie-landing/src/App.js +0 -12
  165. package/dist/parfymerie-landing/src/App.js.map +0 -1
  166. package/dist/parfymerie-landing/src/main.d.ts +0 -2
  167. package/dist/parfymerie-landing/src/main.d.ts.map +0 -1
  168. package/dist/parfymerie-landing/src/main.js +0 -7
  169. package/dist/parfymerie-landing/src/main.js.map +0 -1
  170. package/dist/parfymerie-landing/vite.config.d.ts +0 -3
  171. package/dist/parfymerie-landing/vite.config.d.ts.map +0 -1
  172. package/dist/parfymerie-landing/vite.config.js +0 -7
  173. package/dist/parfymerie-landing/vite.config.js.map +0 -1
  174. package/dist/repl.d.ts +0 -5
  175. package/dist/repl.d.ts.map +0 -1
  176. package/dist/repl.js +0 -472
  177. package/dist/repl.js.map +0 -1
  178. package/dist/sort.d.ts +0 -8
  179. package/dist/sort.d.ts.map +0 -1
  180. package/dist/sort.js +0 -36
  181. package/dist/sort.js.map +0 -1
  182. package/dist/stack.d.ts +0 -9
  183. package/dist/stack.d.ts.map +0 -1
  184. package/dist/stack.js +0 -22
  185. package/dist/stack.js.map +0 -1
  186. package/dist/test-run.d.ts +0 -2
  187. package/dist/test-run.d.ts.map +0 -1
  188. package/dist/test-run.js +0 -13
  189. package/dist/test-run.js.map +0 -1
  190. package/dist/ui/components/diff-view.d.ts +0 -8
  191. package/dist/ui/components/diff-view.d.ts.map +0 -1
  192. package/dist/ui/components/diff-view.js +0 -25
  193. package/dist/ui/components/diff-view.js.map +0 -1
  194. package/dist/ui/double-press.d.ts +0 -9
  195. package/dist/ui/double-press.d.ts.map +0 -1
  196. package/dist/ui/double-press.js +0 -18
  197. package/dist/ui/double-press.js.map +0 -1
  198. package/dist/ui/ink/components/ActivityLog.d.ts +0 -12
  199. package/dist/ui/ink/components/ActivityLog.d.ts.map +0 -1
  200. package/dist/ui/ink/components/ActivityLog.js +0 -11
  201. package/dist/ui/ink/components/ActivityLog.js.map +0 -1
  202. package/dist/ui/ink/components/AgentStatus.d.ts +0 -13
  203. package/dist/ui/ink/components/AgentStatus.d.ts.map +0 -1
  204. package/dist/ui/ink/components/AgentStatus.js +0 -20
  205. package/dist/ui/ink/components/AgentStatus.js.map +0 -1
  206. package/dist/ui/ink/components/BottomBar.d.ts +0 -12
  207. package/dist/ui/ink/components/BottomBar.d.ts.map +0 -1
  208. package/dist/ui/ink/components/BottomBar.js +0 -22
  209. package/dist/ui/ink/components/BottomBar.js.map +0 -1
  210. package/dist/ui/ink/components/CheckboxInput.d.ts +0 -21
  211. package/dist/ui/ink/components/CheckboxInput.d.ts.map +0 -1
  212. package/dist/ui/ink/components/CheckboxInput.js +0 -36
  213. package/dist/ui/ink/components/CheckboxInput.js.map +0 -1
  214. package/dist/ui/ink/components/InputBox.d.ts +0 -25
  215. package/dist/ui/ink/components/InputBox.d.ts.map +0 -1
  216. package/dist/ui/ink/components/InputBox.js +0 -91
  217. package/dist/ui/ink/components/InputBox.js.map +0 -1
  218. package/dist/ui/ink/components/ModeSelector.d.ts +0 -8
  219. package/dist/ui/ink/components/ModeSelector.d.ts.map +0 -1
  220. package/dist/ui/ink/components/ModeSelector.js +0 -13
  221. package/dist/ui/ink/components/ModeSelector.js.map +0 -1
  222. package/dist/ui/ink/components/QuestionBox.d.ts +0 -14
  223. package/dist/ui/ink/components/QuestionBox.d.ts.map +0 -1
  224. package/dist/ui/ink/components/QuestionBox.js +0 -35
  225. package/dist/ui/ink/components/QuestionBox.js.map +0 -1
  226. package/dist/ui/ink/components/RadioInput.d.ts +0 -17
  227. package/dist/ui/ink/components/RadioInput.d.ts.map +0 -1
  228. package/dist/ui/ink/components/RadioInput.js +0 -30
  229. package/dist/ui/ink/components/RadioInput.js.map +0 -1
  230. package/dist/ui/ink/components/SliderInput.d.ts +0 -20
  231. package/dist/ui/ink/components/SliderInput.d.ts.map +0 -1
  232. package/dist/ui/ink/components/SliderInput.js +0 -40
  233. package/dist/ui/ink/components/SliderInput.js.map +0 -1
  234. package/dist/ui/ink/components/StartupScreen.d.ts +0 -19
  235. package/dist/ui/ink/components/StartupScreen.d.ts.map +0 -1
  236. package/dist/ui/ink/components/StartupScreen.js +0 -9
  237. package/dist/ui/ink/components/StartupScreen.js.map +0 -1
  238. package/dist/ui/ink/components/WelcomeScreen.d.ts +0 -10
  239. package/dist/ui/ink/components/WelcomeScreen.d.ts.map +0 -1
  240. package/dist/ui/ink/components/WelcomeScreen.js +0 -8
  241. package/dist/ui/ink/components/WelcomeScreen.js.map +0 -1
  242. package/dist/ui/ink/components/Window.d.ts +0 -30
  243. package/dist/ui/ink/components/Window.d.ts.map +0 -1
  244. package/dist/ui/ink/components/Window.js +0 -9
  245. package/dist/ui/ink/components/Window.js.map +0 -1
  246. package/dist/ui/ink/components/ui/_core.d.ts +0 -113
  247. package/dist/ui/ink/components/ui/_core.d.ts.map +0 -1
  248. package/dist/ui/ink/components/ui/_core.js +0 -83
  249. package/dist/ui/ink/components/ui/_core.js.map +0 -1
  250. package/dist/ui/ink/components/ui/autocomplete/Autocomplete.d.ts +0 -23
  251. package/dist/ui/ink/components/ui/autocomplete/Autocomplete.d.ts.map +0 -1
  252. package/dist/ui/ink/components/ui/autocomplete/Autocomplete.js +0 -56
  253. package/dist/ui/ink/components/ui/autocomplete/Autocomplete.js.map +0 -1
  254. package/dist/ui/ink/components/ui/autocomplete/index.d.ts +0 -3
  255. package/dist/ui/ink/components/ui/autocomplete/index.d.ts.map +0 -1
  256. package/dist/ui/ink/components/ui/autocomplete/index.js +0 -2
  257. package/dist/ui/ink/components/ui/autocomplete/index.js.map +0 -1
  258. package/dist/ui/ink/components/ui/badge/Badge.d.ts +0 -13
  259. package/dist/ui/ink/components/ui/badge/Badge.d.ts.map +0 -1
  260. package/dist/ui/ink/components/ui/badge/Badge.js +0 -17
  261. package/dist/ui/ink/components/ui/badge/Badge.js.map +0 -1
  262. package/dist/ui/ink/components/ui/badge/index.d.ts +0 -3
  263. package/dist/ui/ink/components/ui/badge/index.d.ts.map +0 -1
  264. package/dist/ui/ink/components/ui/badge/index.js +0 -2
  265. package/dist/ui/ink/components/ui/badge/index.js.map +0 -1
  266. package/dist/ui/ink/components/ui/divider/Divider.d.ts +0 -12
  267. package/dist/ui/ink/components/ui/divider/Divider.d.ts.map +0 -1
  268. package/dist/ui/ink/components/ui/divider/Divider.js +0 -27
  269. package/dist/ui/ink/components/ui/divider/Divider.js.map +0 -1
  270. package/dist/ui/ink/components/ui/divider/index.d.ts +0 -3
  271. package/dist/ui/ink/components/ui/divider/index.d.ts.map +0 -1
  272. package/dist/ui/ink/components/ui/divider/index.js +0 -2
  273. package/dist/ui/ink/components/ui/divider/index.js.map +0 -1
  274. package/dist/ui/ink/components/ui/header/Header.d.ts +0 -13
  275. package/dist/ui/ink/components/ui/header/Header.d.ts.map +0 -1
  276. package/dist/ui/ink/components/ui/header/Header.js +0 -33
  277. package/dist/ui/ink/components/ui/header/Header.js.map +0 -1
  278. package/dist/ui/ink/components/ui/header/index.d.ts +0 -3
  279. package/dist/ui/ink/components/ui/header/index.d.ts.map +0 -1
  280. package/dist/ui/ink/components/ui/header/index.js +0 -2
  281. package/dist/ui/ink/components/ui/header/index.js.map +0 -1
  282. package/dist/ui/ink/components/ui/json-viewer/JSONViewer.d.ts +0 -14
  283. package/dist/ui/ink/components/ui/json-viewer/JSONViewer.d.ts.map +0 -1
  284. package/dist/ui/ink/components/ui/json-viewer/JSONViewer.js +0 -144
  285. package/dist/ui/ink/components/ui/json-viewer/JSONViewer.js.map +0 -1
  286. package/dist/ui/ink/components/ui/json-viewer/index.d.ts +0 -3
  287. package/dist/ui/ink/components/ui/json-viewer/index.d.ts.map +0 -1
  288. package/dist/ui/ink/components/ui/json-viewer/index.js +0 -2
  289. package/dist/ui/ink/components/ui/json-viewer/index.js.map +0 -1
  290. package/dist/ui/ink/components/ui/key-hint/KeyHint.d.ts +0 -14
  291. package/dist/ui/ink/components/ui/key-hint/KeyHint.d.ts.map +0 -1
  292. package/dist/ui/ink/components/ui/key-hint/KeyHint.js +0 -5
  293. package/dist/ui/ink/components/ui/key-hint/KeyHint.js.map +0 -1
  294. package/dist/ui/ink/components/ui/key-hint/index.d.ts +0 -3
  295. package/dist/ui/ink/components/ui/key-hint/index.d.ts.map +0 -1
  296. package/dist/ui/ink/components/ui/key-hint/index.js +0 -2
  297. package/dist/ui/ink/components/ui/key-hint/index.js.map +0 -1
  298. package/dist/ui/ink/components/ui/markdown/Markdown.d.ts +0 -11
  299. package/dist/ui/ink/components/ui/markdown/Markdown.d.ts.map +0 -1
  300. package/dist/ui/ink/components/ui/markdown/Markdown.js +0 -129
  301. package/dist/ui/ink/components/ui/markdown/Markdown.js.map +0 -1
  302. package/dist/ui/ink/components/ui/markdown/index.d.ts +0 -3
  303. package/dist/ui/ink/components/ui/markdown/index.d.ts.map +0 -1
  304. package/dist/ui/ink/components/ui/markdown/index.js +0 -2
  305. package/dist/ui/ink/components/ui/markdown/index.js.map +0 -1
  306. package/dist/ui/ink/components/ui/scroll-area/ScrollArea.d.ts +0 -21
  307. package/dist/ui/ink/components/ui/scroll-area/ScrollArea.d.ts.map +0 -1
  308. package/dist/ui/ink/components/ui/scroll-area/ScrollArea.js +0 -42
  309. package/dist/ui/ink/components/ui/scroll-area/ScrollArea.js.map +0 -1
  310. package/dist/ui/ink/components/ui/scroll-area/index.d.ts +0 -3
  311. package/dist/ui/ink/components/ui/scroll-area/index.d.ts.map +0 -1
  312. package/dist/ui/ink/components/ui/scroll-area/index.js +0 -2
  313. package/dist/ui/ink/components/ui/scroll-area/index.js.map +0 -1
  314. package/dist/ui/ink/components/ui/select/Select.d.ts +0 -19
  315. package/dist/ui/ink/components/ui/select/Select.d.ts.map +0 -1
  316. package/dist/ui/ink/components/ui/select/Select.js +0 -73
  317. package/dist/ui/ink/components/ui/select/Select.js.map +0 -1
  318. package/dist/ui/ink/components/ui/select/index.d.ts +0 -3
  319. package/dist/ui/ink/components/ui/select/index.d.ts.map +0 -1
  320. package/dist/ui/ink/components/ui/select/index.js +0 -2
  321. package/dist/ui/ink/components/ui/select/index.js.map +0 -1
  322. package/dist/ui/ink/components/ui/spinner/Spinner.d.ts +0 -14
  323. package/dist/ui/ink/components/ui/spinner/Spinner.d.ts.map +0 -1
  324. package/dist/ui/ink/components/ui/spinner/Spinner.js +0 -16
  325. package/dist/ui/ink/components/ui/spinner/Spinner.js.map +0 -1
  326. package/dist/ui/ink/components/ui/spinner/index.d.ts +0 -3
  327. package/dist/ui/ink/components/ui/spinner/index.d.ts.map +0 -1
  328. package/dist/ui/ink/components/ui/spinner/index.js +0 -2
  329. package/dist/ui/ink/components/ui/spinner/index.js.map +0 -1
  330. package/dist/ui/ink/components/ui/status-indicator/StatusIndicator.d.ts +0 -12
  331. package/dist/ui/ink/components/ui/status-indicator/StatusIndicator.d.ts.map +0 -1
  332. package/dist/ui/ink/components/ui/status-indicator/StatusIndicator.js +0 -39
  333. package/dist/ui/ink/components/ui/status-indicator/StatusIndicator.js.map +0 -1
  334. package/dist/ui/ink/components/ui/status-indicator/index.d.ts +0 -3
  335. package/dist/ui/ink/components/ui/status-indicator/index.d.ts.map +0 -1
  336. package/dist/ui/ink/components/ui/status-indicator/index.js +0 -2
  337. package/dist/ui/ink/components/ui/status-indicator/index.js.map +0 -1
  338. package/dist/ui/ink/components/ui/streaming-text/StreamingText.d.ts +0 -13
  339. package/dist/ui/ink/components/ui/streaming-text/StreamingText.d.ts.map +0 -1
  340. package/dist/ui/ink/components/ui/streaming-text/StreamingText.js +0 -22
  341. package/dist/ui/ink/components/ui/streaming-text/StreamingText.js.map +0 -1
  342. package/dist/ui/ink/components/ui/streaming-text/index.d.ts +0 -3
  343. package/dist/ui/ink/components/ui/streaming-text/index.d.ts.map +0 -1
  344. package/dist/ui/ink/components/ui/streaming-text/index.js +0 -2
  345. package/dist/ui/ink/components/ui/streaming-text/index.js.map +0 -1
  346. package/dist/ui/ink/components/ui/tabs/Tabs.d.ts +0 -20
  347. package/dist/ui/ink/components/ui/tabs/Tabs.d.ts.map +0 -1
  348. package/dist/ui/ink/components/ui/tabs/Tabs.js +0 -53
  349. package/dist/ui/ink/components/ui/tabs/Tabs.js.map +0 -1
  350. package/dist/ui/ink/components/ui/tabs/index.d.ts +0 -3
  351. package/dist/ui/ink/components/ui/tabs/index.d.ts.map +0 -1
  352. package/dist/ui/ink/components/ui/tabs/index.js +0 -2
  353. package/dist/ui/ink/components/ui/tabs/index.js.map +0 -1
  354. package/dist/ui/ink/components/ui/text-input/TextInput.d.ts +0 -22
  355. package/dist/ui/ink/components/ui/text-input/TextInput.d.ts.map +0 -1
  356. package/dist/ui/ink/components/ui/text-input/TextInput.js +0 -57
  357. package/dist/ui/ink/components/ui/text-input/TextInput.js.map +0 -1
  358. package/dist/ui/ink/components/ui/text-input/index.d.ts +0 -3
  359. package/dist/ui/ink/components/ui/text-input/index.d.ts.map +0 -1
  360. package/dist/ui/ink/components/ui/text-input/index.js +0 -2
  361. package/dist/ui/ink/components/ui/text-input/index.js.map +0 -1
  362. package/dist/ui/ink/components/ui/token-counter/TokenCounter.d.ts +0 -17
  363. package/dist/ui/ink/components/ui/token-counter/TokenCounter.d.ts.map +0 -1
  364. package/dist/ui/ink/components/ui/token-counter/TokenCounter.js +0 -38
  365. package/dist/ui/ink/components/ui/token-counter/TokenCounter.js.map +0 -1
  366. package/dist/ui/ink/components/ui/token-counter/index.d.ts +0 -3
  367. package/dist/ui/ink/components/ui/token-counter/index.d.ts.map +0 -1
  368. package/dist/ui/ink/components/ui/token-counter/index.js +0 -2
  369. package/dist/ui/ink/components/ui/token-counter/index.js.map +0 -1
  370. package/dist/ui/ink/components/ui/typewriter/Typewriter.d.ts +0 -14
  371. package/dist/ui/ink/components/ui/typewriter/Typewriter.d.ts.map +0 -1
  372. package/dist/ui/ink/components/ui/typewriter/Typewriter.js +0 -57
  373. package/dist/ui/ink/components/ui/typewriter/Typewriter.js.map +0 -1
  374. package/dist/ui/ink/components/ui/typewriter/index.d.ts +0 -3
  375. package/dist/ui/ink/components/ui/typewriter/index.d.ts.map +0 -1
  376. package/dist/ui/ink/components/ui/typewriter/index.js +0 -2
  377. package/dist/ui/ink/components/ui/typewriter/index.js.map +0 -1
  378. package/dist/ui/opentui-renderer.d.ts +0 -53
  379. package/dist/ui/opentui-renderer.d.ts.map +0 -1
  380. package/dist/ui/opentui-renderer.js +0 -463
  381. package/dist/ui/opentui-renderer.js.map +0 -1
  382. package/dist/utils/memoize.d.ts +0 -14
  383. package/dist/utils/memoize.d.ts.map +0 -1
  384. package/dist/utils/memoize.js +0 -51
  385. package/dist/utils/memoize.js.map +0 -1
  386. package/dist/utils/types.d.ts +0 -6
  387. package/dist/utils/types.d.ts.map +0 -1
  388. package/dist/utils/types.js +0 -2
  389. package/dist/utils/types.js.map +0 -1
  390. package/dist/utils.d.ts +0 -22
  391. package/dist/utils.d.ts.map +0 -1
  392. package/dist/utils.js +0 -81
  393. package/dist/utils.js.map +0 -1
@@ -1,11 +1,11 @@
1
- import { readFileSync, existsSync } from 'node:fs';
2
- import { resolve } from 'node:path';
3
- import * as os from 'node:os';
4
- import { loadAllMemoryDetailed } from './memory.js';
5
- import { loadProfileSummary } from './user-profile.js';
6
- import { getOrBuildProjectMap } from '../indexer/cache.js';
7
- import { loadAgentsMd, listInstalledSkills, formatSkillsBlock } from '../skills/loader.js';
8
- import { logInfo, logDebug } from '../logger.js';
1
+ import { readFileSync, existsSync } from "node:fs";
2
+ import { resolve } from "node:path";
3
+ import * as os from "node:os";
4
+ import { loadAllMemoryDetailed } from "./memory.js";
5
+ import { loadProfileSummary } from "./user-profile.js";
6
+ import { getOrBuildProjectMap } from "../indexer/cache.js";
7
+ import { loadAgentsMd, listSkillsWithDescriptions, formatSkillsBlock, invalidateSkillCaches, } from "../skills/loader.js";
8
+ import { logInfo, logWarn, logDebug } from "../logger.js";
9
9
  /**
10
10
  * Build system prompt for the LLM agent.
11
11
  *
@@ -25,173 +25,173 @@ import { logInfo, logDebug } from '../logger.js';
25
25
  */
26
26
  // ─── Tool format ──────────────────────────────────────
27
27
  // System prompt block describing the tool calling format
28
- const TOOL_FORMAT = `CRITICAL: Use filesystem tools for file operations — they are more reliable than bash.
29
-
30
- To call a tool, output EXACTLY this format (on its own line):
31
-
32
- <tool_call>{"name":"tool_name","arguments":{...}}</tool_call>
33
-
34
- ## Subagent — delegate file creation to isolated agent:
35
- Use for EACH separate file when creating multi-file projects (3+ files).
36
- One subagent call per file. Subagent has fresh context and works independently.
37
-
38
- {"name":"subagent","arguments":{"task":"Create src/db.ts: better-sqlite3 connection + users table"}}
39
- {"name":"subagent","arguments":{"task":"Create src/routes/users.ts: Express CRUD for users","existingFiles":"package.json, src/db.ts"}}
40
- {"name":"subagent","arguments":{"task":"Run tsc --noEmit to check types"}}
41
-
42
- Arguments:
43
- - task (required) — what the subagent should create/fix/check
44
- - existingFiles (optional) — comma-separated files for cross-file context
45
-
46
- ## Filesystem Tools (USE THESE for file ops):
47
-
48
- Read a file:
49
- {"name":"read_file","arguments":{"path":"src/index.ts"}}
50
- {"name":"read_file","arguments":{"path":"src/index.ts","offset":50,"limit":100}}
51
-
52
- Write/create a file:
53
- {"name":"write_file","arguments":{"path":"src/utils.ts","content":"export function foo() { return 1; }"}}
54
-
55
- Edit (find & replace):
56
- {"name":"edit_file","arguments":{"path":"src/index.ts","old_string":"old text","new_string":"new text"}}
57
-
58
- List directory (only when user explicitly asks):
59
- {"name":"list_dir","arguments":{}}
60
- {"name":"list_dir","arguments":{"path":"src"}}
61
-
62
- Create directory: {"name":"create_dir","arguments":{"path":"src/routes"}}
63
- Delete file: {"name":"delete_file","arguments":{"path":"old-file.ts"}}
64
- Copy file: {"name":"copy_file","arguments":{"source":"src/a.ts","destination":"src/b.ts"}}
65
- Move/rename: {"name":"move_file","arguments":{"source":"old.ts","destination":"new.ts"}}
66
- File info: {"name":"file_info","arguments":{"path":"src/index.ts"}}
67
- Search files: {"name":"glob_search","arguments":{"pattern":"**/*.ts"}}
68
- Search content: {"name":"grep_search","arguments":{"pattern":"function","include":"*.ts"}}
69
- Search with regex: {"name":"grep_search","arguments":{"pattern":"import.*from","include":"*.ts"}}
70
- Search literal dot: {"name":"grep_search","arguments":{"pattern":"config\\.json"}}
71
- Directory tree: {"name":"tree","arguments":{"depth":2}}
72
-
73
- ## Plan / Todo / Question / Approve (native tools):
74
- {"name":"plan","arguments":{"action":"create","name":"Todo App","steps":["Step 1","Step 2"]}}
75
- {"name":"plan","arguments":{"action":"done","step":1}}
76
- {"name":"plan","arguments":{"action":"show"}}
77
- {"name":"plan","arguments":{"action":"clear"}}
78
- {"name":"todo","arguments":{"action":"add","text":"Implement feature X"}}
79
- {"name":"todo","arguments":{"action":"list"}}
80
- {"name":"question","arguments":{"question":"What color?","choices":["Red","Blue"]}}
81
- {"name":"approve","arguments":{"action":"Delete file foo.ts"}}
82
- {"name":"user_profile","arguments":{"action":"show"}}
83
- {"name":"user_profile","arguments":{"action":"add_note","section":"Notes","note":"text"}}
84
-
85
- ## Subagent (isolate a single task in fresh context):
86
- {"name":"subagent","arguments":{"task":"Create file db.ts with better-sqlite3","existingFiles":"package.json"}}
87
-
88
- ## Web tools (search & fetch):
89
- {"name":"web_search","arguments":{"query":"weather in Minsk","maxResults":5}}
90
- {"name":"web_fetch","arguments":{"url":"https://example.com"}}
91
-
92
- ## Web Browse (headless browser):
93
- {"name":"web_browse","arguments":{"action":"navigate","url":"https://example.com"}}
94
- {"name":"web_browse","arguments":{"action":"scrape","url":"https://example.com/catalog"}}
95
- {"name":"web_browse","arguments":{"action":"scrape","url":"https://shop.com/bikes","pattern":"bike|velosiped","maxItems":15}}
96
- {"name":"web_browse","arguments":{"action":"click","selector":"button.submit"}}
97
- {"name":"web_browse","arguments":{"action":"type","selector":"#search","value":"hello"}}
98
- {"name":"web_browse","arguments":{"action":"wait","selector":"#result","timeout":5000}}
99
- {"name":"web_browse","arguments":{"action":"screenshot"}}
100
- {"name":"web_browse","arguments":{"action":"close"}}
101
-
102
- ## Theme tool (theme management):
103
- {"name":"theme","arguments":{"action":"list"}}
104
- {"name":"theme","arguments":{"action":"switch","name":"dark"}}
105
- {"name":"theme","arguments":{"action":"show"}}
106
- {"name":"theme","arguments":{"action":"install","name":"monokai","url":"https://example.com/monokai.json"}}
107
- {"name":"theme","arguments":{"action":"remove","name":"monokai"}}
108
-
109
- Themes are in ~/.mma/themes/. Built-in: light, dark. Can install from URL.
110
- If the user wants to switch themes — suggest a matching one from the list and switch.
111
-
112
- ## Project Map tool (project structure):
113
- {"name":"project_map","arguments":{"action":"list"}}
114
- {"name":"project_map","arguments":{"action":"find","pattern":"*.tsx"}}
115
- {"name":"project_map","arguments":{"action":"info","path":"src/App.tsx"}}
116
-
117
- CRITICAL: Use project_map FIRST before reading any files. It shows what files exist.
118
- - action="list" — show all files in the project
119
- - action="find" — search files by glob pattern
120
- - action="info" — get details about specific file (path, exports, lines)
121
-
122
- ## Scaffold (create complete project structure programmatically):
123
- {"name":"scaffold","arguments":{"template":"vite-react-ts","dir":"my-app"}}
124
- {"name":"scaffold","arguments":{"template":"vite-vanilla-ts","dir":"my-app"}}
125
- {"name":"scaffold","arguments":{"template":"node-express-ts","dir":"api-server"}}
126
-
127
- Templates: vite-react-ts (React+TypeScript), vite-vanilla-ts (vanilla TS), node-express-ts (Express+TS)
128
- Use scaffold INSTEAD of creating project files manually. It creates all config files correctly.
129
-
130
- ## Bash (for non-file operations — npm, git, etc):
131
- {"name":"bash","arguments":{"cmd":"npm test"}}
132
- {"name":"bash","arguments":{"cmd":"git status"}}
133
-
28
+ const TOOL_FORMAT = `CRITICAL: Use filesystem tools for file operations — they are more reliable than bash.
29
+
30
+ To call a tool, output EXACTLY this format (on its own line):
31
+
32
+ <tool_call>{"name":"tool_name","arguments":{...}}</tool_call>
33
+
34
+ ## Subagent — delegate file creation to isolated agent:
35
+ Use for EACH separate file when creating multi-file projects (3+ files).
36
+ One subagent call per file. Subagent has fresh context and works independently.
37
+
38
+ {"name":"subagent","arguments":{"task":"Create src/db.ts: better-sqlite3 connection + users table"}}
39
+ {"name":"subagent","arguments":{"task":"Create src/routes/users.ts: Express CRUD for users","existingFiles":"package.json, src/db.ts"}}
40
+ {"name":"subagent","arguments":{"task":"Run tsc --noEmit to check types"}}
41
+
42
+ Arguments:
43
+ - task (required) — what the subagent should create/fix/check
44
+ - existingFiles (optional) — comma-separated files for cross-file context
45
+
46
+ ## Filesystem Tools (USE THESE for file ops):
47
+
48
+ Read a file:
49
+ {"name":"read_file","arguments":{"path":"src/index.ts"}}
50
+ {"name":"read_file","arguments":{"path":"src/index.ts","offset":50,"limit":100}}
51
+
52
+ Write/create a file:
53
+ {"name":"write_file","arguments":{"path":"src/utils.ts","content":"export function foo() { return 1; }"}}
54
+
55
+ Edit (find & replace):
56
+ {"name":"edit_file","arguments":{"path":"src/index.ts","old_string":"old text","new_string":"new text"}}
57
+
58
+ List directory (only when user explicitly asks):
59
+ {"name":"list_dir","arguments":{}}
60
+ {"name":"list_dir","arguments":{"path":"src"}}
61
+
62
+ Create directory: {"name":"create_dir","arguments":{"path":"src/routes"}}
63
+ Delete file: {"name":"delete_file","arguments":{"path":"old-file.ts"}}
64
+ Copy file: {"name":"copy_file","arguments":{"source":"src/a.ts","destination":"src/b.ts"}}
65
+ Move/rename: {"name":"move_file","arguments":{"source":"old.ts","destination":"new.ts"}}
66
+ File info: {"name":"file_info","arguments":{"path":"src/index.ts"}}
67
+ Search files: {"name":"glob_search","arguments":{"pattern":"**/*.ts"}}
68
+ Search content: {"name":"grep_search","arguments":{"pattern":"function","include":"*.ts"}}
69
+ Search with regex: {"name":"grep_search","arguments":{"pattern":"import.*from","include":"*.ts"}}
70
+ Search literal dot: {"name":"grep_search","arguments":{"pattern":"config\\.json"}}
71
+ Directory tree: {"name":"tree","arguments":{"depth":2}}
72
+
73
+ ## Plan / Todo / Question / Approve (native tools):
74
+ {"name":"plan","arguments":{"action":"create","name":"Todo App","steps":["Step 1","Step 2"]}}
75
+ {"name":"plan","arguments":{"action":"done","step":1}}
76
+ {"name":"plan","arguments":{"action":"show"}}
77
+ {"name":"plan","arguments":{"action":"clear"}}
78
+ {"name":"todo","arguments":{"action":"add","text":"Implement feature X"}}
79
+ {"name":"todo","arguments":{"action":"list"}}
80
+ {"name":"question","arguments":{"question":"What color?","choices":["Red","Blue"]}}
81
+ {"name":"approve","arguments":{"action":"Delete file foo.ts"}}
82
+ {"name":"user_profile","arguments":{"action":"show"}}
83
+ {"name":"user_profile","arguments":{"action":"add_note","section":"Notes","note":"text"}}
84
+
85
+ ## Subagent (isolate a single task in fresh context):
86
+ {"name":"subagent","arguments":{"task":"Create file db.ts with better-sqlite3","existingFiles":"package.json"}}
87
+
88
+ ## Web tools (search & fetch):
89
+ {"name":"web_search","arguments":{"query":"weather in Minsk","maxResults":5}}
90
+ {"name":"web_fetch","arguments":{"url":"https://example.com"}}
91
+
92
+ ## Web Browse (headless browser):
93
+ {"name":"web_browse","arguments":{"action":"navigate","url":"https://example.com"}}
94
+ {"name":"web_browse","arguments":{"action":"scrape","url":"https://example.com/catalog"}}
95
+ {"name":"web_browse","arguments":{"action":"scrape","url":"https://shop.com/bikes","pattern":"bike|velosiped","maxItems":15}}
96
+ {"name":"web_browse","arguments":{"action":"click","selector":"button.submit"}}
97
+ {"name":"web_browse","arguments":{"action":"type","selector":"#search","value":"hello"}}
98
+ {"name":"web_browse","arguments":{"action":"wait","selector":"#result","timeout":5000}}
99
+ {"name":"web_browse","arguments":{"action":"screenshot"}}
100
+ {"name":"web_browse","arguments":{"action":"close"}}
101
+
102
+ ## Theme tool (theme management):
103
+ {"name":"theme","arguments":{"action":"list"}}
104
+ {"name":"theme","arguments":{"action":"switch","name":"dark"}}
105
+ {"name":"theme","arguments":{"action":"show"}}
106
+ {"name":"theme","arguments":{"action":"install","name":"monokai","url":"https://example.com/monokai.json"}}
107
+ {"name":"theme","arguments":{"action":"remove","name":"monokai"}}
108
+
109
+ Themes are in ~/.mma/themes/. Built-in: light, dark. Can install from URL.
110
+ If the user wants to switch themes — suggest a matching one from the list and switch.
111
+
112
+ ## Project Map tool (project structure):
113
+ {"name":"project_map","arguments":{"action":"list"}}
114
+ {"name":"project_map","arguments":{"action":"find","pattern":"*.tsx"}}
115
+ {"name":"project_map","arguments":{"action":"info","path":"src/App.tsx"}}
116
+
117
+ CRITICAL: Use project_map FIRST before reading any files. It shows what files exist.
118
+ - action="list" — show all files in the project
119
+ - action="find" — search files by glob pattern
120
+ - action="info" — get details about specific file (path, exports, lines)
121
+
122
+ ## Scaffold (create complete project structure programmatically):
123
+ {"name":"scaffold","arguments":{"template":"vite-react-ts","dir":"my-app"}}
124
+ {"name":"scaffold","arguments":{"template":"vite-vanilla-ts","dir":"my-app"}}
125
+ {"name":"scaffold","arguments":{"template":"node-express-ts","dir":"api-server"}}
126
+
127
+ Templates: vite-react-ts (React+TypeScript), vite-vanilla-ts (vanilla TS), node-express-ts (Express+TS)
128
+ Use scaffold INSTEAD of creating project files manually. It creates all config files correctly.
129
+
130
+ ## Bash (for non-file operations — npm, git, etc):
131
+ {"name":"bash","arguments":{"cmd":"npm test"}}
132
+ {"name":"bash","arguments":{"cmd":"git status"}}
133
+
134
134
  NEVER output tool calls in any other format. ALWAYS use <tool_call> tags.`;
135
135
  // ─── Conversation flow ──────────────────────────────────
136
136
  // System prompt block explaining how the dialog cycle works
137
- const CONVERSATION_FLOW = `## How This Works (IMPORTANT — read this carefully)
138
-
139
- You are in a loop. Each turn works like this:
140
-
141
- 1. User sends a message
142
- 2. You respond with TEXT and/or TOOL CALLS
143
- 3. Tool results appear — then it is YOUR TURN AGAIN
144
- 4. Repeat until the task is done
145
-
146
- ### What you see after a tool executes:
147
-
148
- You will see a message like:
149
- [tool result: "Written 42 bytes (3 lines) to src/index.ts"]
150
-
151
- This is NOT the end. You MUST continue:
152
- - If more files need work → call the next tool
153
- - If the task is done → write a summary to the user
154
- - If there was an error → explain it and fix it
155
-
156
- ### Example conversation:
157
-
158
- User: "Create a file src/utils.ts with a hello function"
159
-
160
- You:
161
- <tool_call>{"name":"write_file","arguments":{"path":"src/utils.ts","content":"export function hello() { return 'world'; }"}}</tool_call>
162
-
163
- [Tool result: "Written 52 bytes (1 lines) to src/utils.ts"]
164
-
165
- You:
166
- File src/utils.ts created successfully. It exports a hello() function that returns 'world'.
167
-
168
- ---
169
-
137
+ const CONVERSATION_FLOW = `## How This Works (IMPORTANT — read this carefully)
138
+
139
+ You are in a loop. Each turn works like this:
140
+
141
+ 1. User sends a message
142
+ 2. You respond with TEXT and/or TOOL CALLS
143
+ 3. Tool results appear — then it is YOUR TURN AGAIN
144
+ 4. Repeat until the task is done
145
+
146
+ ### What you see after a tool executes:
147
+
148
+ You will see a message like:
149
+ [tool result: "Written 42 bytes (3 lines) to src/index.ts"]
150
+
151
+ This is NOT the end. You MUST continue:
152
+ - If more files need work → call the next tool
153
+ - If the task is done → write a summary to the user
154
+ - If there was an error → explain it and fix it
155
+
156
+ ### Example conversation:
157
+
158
+ User: "Create a file src/utils.ts with a hello function"
159
+
160
+ You:
161
+ <tool_call>{"name":"write_file","arguments":{"path":"src/utils.ts","content":"export function hello() { return 'world'; }"}}</tool_call>
162
+
163
+ [Tool result: "Written 52 bytes (1 lines) to src/utils.ts"]
164
+
165
+ You:
166
+ File src/utils.ts created successfully. It exports a hello() function that returns 'world'.
167
+
168
+ ---
169
+
170
170
  NEVER stop after a tool call. ALWAYS continue with either another tool call or a text reply.`;
171
171
  const R = {
172
172
  fs_tools: `Use filesystem tools for file operations (read_file, write_file, edit_file, list_dir, glob_search, grep_search, tree). Use bash ONLY for non-file commands (npm, git, etc).`,
173
173
  user_language: `Always respond in the user's language (Russian or English). Do NOT mix languages in one response — pick ONE and stick with it.`,
174
- check_result: `CRITICAL: After every tool call, CHECK the result (exit code + output).
175
- If exit code != 0, DO NOT claim success — tell the user about the error.
174
+ check_result: `CRITICAL: After every tool call, CHECK the result (exit code + output).
175
+ If exit code != 0, DO NOT claim success — tell the user about the error.
176
176
  Verify files were created before saying "done".`,
177
- no_empty: `NEVER return an empty response. After receiving a tool result, you MUST either:
178
- a) Call another tool (if more work is needed), OR
179
- b) Write a text response to the user (summarize what was done, report errors, ask questions).
177
+ no_empty: `NEVER return an empty response. After receiving a tool result, you MUST either:
178
+ a) Call another tool (if more work is needed), OR
179
+ b) Write a text response to the user (summarize what was done, report errors, ask questions).
180
180
  Staying silent after a tool result is always wrong.`,
181
- valid_json: `The JSON inside <tool_call> must be VALID JSON. Escape " inside values as \\".
182
- For grep_search patterns: escape regex special chars with \\ (e.g. \\. for literal dot, \\( for literal paren).
181
+ valid_json: `The JSON inside <tool_call> must be VALID JSON. Escape " inside values as \\".
182
+ For grep_search patterns: escape regex special chars with \\ (e.g. \\. for literal dot, \\( for literal paren).
183
183
  Do NOT put quotes inside the pattern — it searches for literal quote characters.`,
184
- large_files: `For large files (>500 lines), prefer grep_search to find specific content:
185
- {"name":"grep_search","arguments":{"pattern":"function","include":"*.ts"}}
186
- Only use read_file with offset/limit when you need to SEE the full file context.
184
+ large_files: `For large files (>500 lines), prefer grep_search to find specific content:
185
+ {"name":"grep_search","arguments":{"pattern":"function","include":"*.ts"}}
186
+ Only use read_file with offset/limit when you need to SEE the full file context.
187
187
  Do NOT call read_file multiple times on the same file sequentially — use grep first.`,
188
188
  // ── Base/Pro only ──
189
- planning_skills: `SKILLS AND PLANNING: For complex tasks (3+ steps):
190
- a. AUTOMATICALLY load relevant skills by mentioning them: "@nodejs-expert @typescript-expert"
191
- b. Do NOT ask the user — just load and start working
192
- c. Create a plan with SPECIFIC STEP NAMES: plan({action:"create", name:"TodoApp", steps:["Create package.json and install deps", "Create src/App.tsx", "Create src/main.tsx", "Verify with tsc --noEmit"]})
193
- d. For each step: use subagent to create the file, then mark step done: plan({action:"done", step:1})
194
- e. Do NOT use write_file directly when a plan is active — delegate to subagents
189
+ planning_skills: `SKILLS AND PLANNING: For complex tasks (3+ steps):
190
+ a. AUTOMATICALLY load relevant skills by mentioning them: "@nodejs-expert @typescript-expert"
191
+ b. Do NOT ask the user — just load and start working
192
+ c. Create a plan with SPECIFIC STEP NAMES: plan({action:"create", name:"TodoApp", steps:["Create package.json and install deps", "Create src/App.tsx", "Create src/main.tsx", "Verify with tsc --noEmit"]})
193
+ d. For each step: use subagent to create the file, then mark step done: plan({action:"done", step:1})
194
+ e. Do NOT use write_file directly when a plan is active — delegate to subagents
195
195
  f. ONE FILE PER STEP — never combine multiple files in one step`,
196
196
  simple_tasks: `FOR SIMPLE TASKS (1-2 steps): Just do it, no plan needed. Use common sense.`,
197
197
  never_just_talk_common: `NEVER JUST TALK — ALWAYS ACT. Do NOT say "write skills in the next message" or similar waiting phrases. If skills are loaded, START WORKING IMMEDIATELY.`,
@@ -200,35 +200,35 @@ const R = {
200
200
  no_list_dir_common: `NEVER call list_dir or tree just to "see what's in the project". Use glob_search or grep_search instead — they give more useful results. Only use list_dir when a user explicitly asks to see a directory listing.`,
201
201
  off_topic_common: `OFF-TOPIC QUESTIONS: If the user asks something unrelated to coding (jokes, space, cooking, etc.), answer briefly and warmly — 1-2 sentences. Do NOT refuse or say "I'm a coding assistant". Just answer, then naturally offer to return to work.`,
202
202
  one_file_common: `ONE FILE AT A TIME: When creating multiple files: a) Write the FIRST file completely, b) Wait for syntax check result, c) If error → fix it before continuing, d) Only then write the NEXT file. NEVER write multiple files in one response — small models lose track.`,
203
- subagents_common: `SUBAGENTS — strict delegation for multi-file projects:
204
- ABSOLUTE RULE: 1 FILE = 1 SUBAGENT CALL. No exceptions.
205
- - Every file in the plan gets its OWN subagent call.
206
- - NEVER combine multiple files in one subagent task.
207
- - If plan has 5 files → 5 separate subagent calls.
208
- - Task description MUST include the FULL path: "Create ONLY src/db.ts" not just "db.ts".
209
- CRITICAL RULES FOR SUBAGENT:
210
- - Subagent MUST create ONLY what is in the task description. Do NOT create extra files.
211
- - If task says "Create src/db.ts" — create ONLY src/db.ts. Nothing else.
212
- - NEVER let subagent "help" by creating additional files beyond the task scope.
213
- - After subagent completes, parent checks what was created and verifies it matches the plan.
214
- Example: subagent({task:"Create ONLY src/db.ts with sqlite connection", existingFiles:"src/types.ts"})
215
- Do NOT use subagent for:
216
- - Editing existing files (use edit_file directly)
217
- - Bash commands like npm install, git, etc. (use bash tool)
203
+ subagents_common: `SUBAGENTS — strict delegation for multi-file projects:
204
+ ABSOLUTE RULE: 1 FILE = 1 SUBAGENT CALL. No exceptions.
205
+ - Every file in the plan gets its OWN subagent call.
206
+ - NEVER combine multiple files in one subagent task.
207
+ - If plan has 5 files → 5 separate subagent calls.
208
+ - Task description MUST include the FULL path: "Create ONLY src/db.ts" not just "db.ts".
209
+ CRITICAL RULES FOR SUBAGENT:
210
+ - Subagent MUST create ONLY what is in the task description. Do NOT create extra files.
211
+ - If task says "Create src/db.ts" — create ONLY src/db.ts. Nothing else.
212
+ - NEVER let subagent "help" by creating additional files beyond the task scope.
213
+ - After subagent completes, parent checks what was created and verifies it matches the plan.
214
+ Example: subagent({task:"Create ONLY src/db.ts with sqlite connection", existingFiles:"src/types.ts"})
215
+ Do NOT use subagent for:
216
+ - Editing existing files (use edit_file directly)
217
+ - Bash commands like npm install, git, etc. (use bash tool)
218
218
  Each subagent gets fresh context. Parent only tracks results (summary). After all subagents — verify with tsc --noEmit.`,
219
219
  check_before_install: `CHECK BEFORE INSTALLING: Read the project dependency file. If the package is already listed — do not install it.`,
220
220
  file_extensions: `FILE EXTENSIONS MATTER: .tsx for TypeScript, .jsx for plain JavaScript. Check existing files to determine which stack the project uses.`,
221
221
  user_answers: `USER ANSWERS: When you see "User answered: X" in the conversation, this is the user's response to your question. Use it and proceed. NEVER ask the same question again.`,
222
222
  project_map_common: `PROJECT MAP FIRST: ALWAYS check the ## Project Map section in your context BEFORE reading any files. The map shows ALL files in the project with their paths. If a file is not in the map — it doesn't exist. Do NOT guess file paths — use the map. If the map shows files inside a subdirectory (e.g. my-project/src/App.tsx), that's where the actual project lives — work inside that subdirectory.`,
223
- subagent_context_common: `SUBAGENT CONTEXT: When calling subagent, ALWAYS pass:
224
- - existingFiles: files already created in this session (prevents duplicates)
225
- - The task description should say "Create ONLY file X" — not "Create file X and related files"
226
- Example: subagent({task:"Create ONLY src/api.ts with Express CRUD", existingFiles:"src/db.ts,src/types.ts"})
223
+ subagent_context_common: `SUBAGENT CONTEXT: When calling subagent, ALWAYS pass:
224
+ - existingFiles: files already created in this session (prevents duplicates)
225
+ - The task description should say "Create ONLY file X" — not "Create file X and related files"
226
+ Example: subagent({task:"Create ONLY src/api.ts with Express CRUD", existingFiles:"src/db.ts,src/types.ts"})
227
227
  The subagent will see the project context and should NOT create files beyond what's in the task.`,
228
- web_tools: `WEB TOOLS STRATEGY:
229
- a. For data extraction (products, listings, cards): use web_browse(action:"scrape") — ONE call navigates, scrolls, discovers, and extracts.
230
- b. For simple pages (blogs, docs, API): use web_fetch — lightweight, no browser needed.
231
- c. For interactive pages (login, forms, search): navigate → click/type → wait → scrape.
228
+ web_tools: `WEB TOOLS STRATEGY:
229
+ a. For data extraction (products, listings, cards): use web_browse(action:"scrape") — ONE call navigates, scrolls, discovers, and extracts.
230
+ b. For simple pages (blogs, docs, API): use web_fetch — lightweight, no browser needed.
231
+ c. For interactive pages (login, forms, search): navigate → click/type → wait → scrape.
232
232
  d. Retry scrape with a custom pattern if the default misses content: {pattern:"product|card|item"}.`,
233
233
  // ── Fast mode only ──
234
234
  execute_directly: `Execute tasks directly. Simple tasks (1-2 steps): just do it without commentary. Complex tasks: break into steps and execute ONE FILE AT A TIME. Write first file → check syntax → fix if needed → then next file.`,
@@ -242,67 +242,103 @@ const R = {
242
242
  subagent_context_fast: `SUBAGENT CONTEXT: When calling subagent, pass existingFiles and use "Create ONLY" in task. Example: subagent({task:"Create ONLY X.ts with debounce function", existingFiles:"Y.ts"})`,
243
243
  };
244
244
  function composeRules(keys) {
245
- return 'Rules:\n' + keys.map((k, i) => `${i + 1}. ${R[k]}`).join('\n');
245
+ return "Rules:\n" + keys.map((k, i) => `${i + 1}. ${R[k]}`).join("\n");
246
246
  }
247
247
  const RULES_COMMON = composeRules([
248
- 'fs_tools', 'user_language', 'check_result', 'no_empty', 'valid_json', 'large_files',
249
- 'planning_skills', 'simple_tasks', 'never_just_talk_common', 'skills_loaded',
250
- 'user_profile_common', 'no_list_dir_common', 'off_topic_common', 'one_file_common',
251
- 'subagents_common', 'check_before_install', 'file_extensions', 'user_answers',
252
- 'project_map_common', 'subagent_context_common', 'web_tools',
248
+ "fs_tools",
249
+ "user_language",
250
+ "check_result",
251
+ "no_empty",
252
+ "valid_json",
253
+ "large_files",
254
+ "planning_skills",
255
+ "simple_tasks",
256
+ "never_just_talk_common",
257
+ "skills_loaded",
258
+ "user_profile_common",
259
+ "no_list_dir_common",
260
+ "off_topic_common",
261
+ "one_file_common",
262
+ "subagents_common",
263
+ "check_before_install",
264
+ "file_extensions",
265
+ "user_answers",
266
+ "project_map_common",
267
+ "subagent_context_common",
268
+ "web_tools",
253
269
  ]);
254
270
  const RULES_FAST = composeRules([
255
- 'fs_tools', 'user_language', 'check_result', 'no_empty', 'valid_json', 'large_files',
256
- 'execute_directly', 'never_just_talk_fast', 'user_profile_fast', 'no_list_dir_fast',
257
- 'off_topic_fast', 'one_file_fast', 'subagents_fast', 'check_before_install',
258
- 'file_extensions', 'user_answers', 'project_map_fast', 'subagent_context_fast', 'web_tools',
271
+ "fs_tools",
272
+ "user_language",
273
+ "check_result",
274
+ "no_empty",
275
+ "valid_json",
276
+ "large_files",
277
+ "execute_directly",
278
+ "never_just_talk_fast",
279
+ "user_profile_fast",
280
+ "no_list_dir_fast",
281
+ "off_topic_fast",
282
+ "one_file_fast",
283
+ "subagents_fast",
284
+ "check_before_install",
285
+ "file_extensions",
286
+ "user_answers",
287
+ "project_map_fast",
288
+ "subagent_context_fast",
289
+ "web_tools",
259
290
  ]);
260
- const GROUNDING_RULE = `## Grounding Rule (CRITICAL — prevents hallucinations)
261
- Before EVERY <tool_call> to a filesystem tool (read_file, write_file, edit_file, etc.),
262
- you MUST output a grounding marker on its own line:
263
- @grounding[файл: <target-path>]
264
- where <target-path> is the file path from the tool call arguments.
265
- This proves you know which file you are operating on and prevents path hallucinations.
266
-
267
- Examples:
268
- @grounding[файл: src/index.ts]
269
- <tool_call>{"name":"read_file","arguments":{"path":"src/index.ts"}}</tool_call>
270
-
271
- @grounding[файл: src/utils.ts]
272
- <tool_call>{"name":"write_file","arguments":{"path":"src/utils.ts","content":"..."}}</tool_call>
273
-
291
+ const GROUNDING_RULE = `## Grounding Rule (CRITICAL — prevents hallucinations)
292
+ Before EVERY <tool_call> to a filesystem tool (read_file, write_file, edit_file, etc.),
293
+ you MUST output a grounding marker on its own line:
294
+ @grounding[файл: <target-path>]
295
+ where <target-path> is the file path from the tool call arguments.
296
+ This proves you know which file you are operating on and prevents path hallucinations.
297
+
298
+ Examples:
299
+ @grounding[файл: src/index.ts]
300
+ <tool_call>{"name":"read_file","arguments":{"path":"src/index.ts"}}</tool_call>
301
+
302
+ @grounding[файл: src/utils.ts]
303
+ <tool_call>{"name":"write_file","arguments":{"path":"src/utils.ts","content":"..."}}</tool_call>
304
+
274
305
  If you cannot determine the exact file path — do NOT call the tool. Ask the user for clarification first.`;
275
- const POWERSHELL_EXAMPLES = `Examples (PowerShell):
276
- <tool_call>{"name":"bash","arguments":{"cmd":"dir"}}</tool_call>
277
- <tool_call>{"name":"bash","arguments":{"cmd":"Get-Content src\\\\index.ts"}}</tool_call>
278
- <tool_call>{"name":"bash","arguments":{"cmd":"npm test"}}</tool_call>
306
+ const POWERSHELL_EXAMPLES = `Examples (PowerShell):
307
+ <tool_call>{"name":"bash","arguments":{"cmd":"dir"}}</tool_call>
308
+ <tool_call>{"name":"bash","arguments":{"cmd":"Get-Content src\\\\index.ts"}}</tool_call>
309
+ <tool_call>{"name":"bash","arguments":{"cmd":"npm test"}}</tool_call>
279
310
  <tool_call>{"name":"bash","arguments":{"cmd":"Set-Content -Path file.md -Value 'Hello World'"}}</tool_call>`;
280
- const POWERSHELL_RULES = `PowerShell specifics:
281
- - NEVER use && in commands — PowerShell doesn't support it. Use ; instead, or make separate bash calls.
282
- WRONG: cd my-app && npm install
283
- RIGHT: npm install (run from my-app directory)
284
- RIGHT: Set-Location my-app; npm install
285
- - Create/write files: Set-Content -Path file.md -Value "content"
286
- - Append to file: Add-Content -Path file.md -Value "line"
287
- - Read files: Get-Content file.md
288
- - List directory: dir (or Get-ChildItem)
289
- - Create directories: New-Item -ItemType Directory -Force -Path "folder"
290
- - NEVER use: echo -e, cat (use Get-Content), bash syntax like mkdir -p or {src/routes,...}
291
- - NEVER use single quotes for strings with \\n, \\t — use DOUBLE quotes: "line1\\nline2"
292
- - Paths use backslashes: src\\index.ts
293
- - Check file exists: Test-Path file.md
294
- - Install deps: npm install (NOT npm i)
295
- - Run dev: npm run dev (NOT npx tsx watch)`;
296
- const UNIX_EXAMPLES = `Examples (Linux/macOS):
297
- <tool_call>{"name":"bash","arguments":{"cmd":"ls -la"}}</tool_call>
298
- <tool_call>{"name":"bash","arguments":{"cmd":"cat src/index.ts"}}</tool_call>
299
- <tool_call>{"name":"bash","arguments":{"cmd":"npm test"}}</tool_call>
311
+ const POWERSHELL_RULES = `PowerShell specifics:
312
+ - NEVER use && in commands — PowerShell doesn't support it. Use ; instead, or make separate bash calls.
313
+ WRONG: cd my-app && npm install
314
+ RIGHT: npm install (run from my-app directory)
315
+ RIGHT: Set-Location my-app; npm install
316
+ - Use Get-ChildItem (NOT dir /s) to list files recursively.
317
+ WRONG: dir /s src (PowerShell interprets /s as a path, not a flag)
318
+ RIGHT: Get-ChildItem -Recurse src
319
+ - Create/write files: Set-Content -Path file.md -Value "content"
320
+ - Append to file: Add-Content -Path file.md -Value "line"
321
+ - Read files: Get-Content file.md
322
+ - List directory: Get-ChildItem (or dir)
323
+ - List directory recursively: Get-ChildItem -Recurse
324
+ - Create directories: New-Item -ItemType Directory -Force -Path "folder"
325
+ - NEVER use: echo -e, cat (use Get-Content), mkdir -p, cp, mv, sed (PowerShell has different syntax)
326
+ - NEVER use single quotes for strings with \\n, \\t — use DOUBLE quotes: "line1\\nline2"
327
+ - Paths use backslashes: src\\index.ts
328
+ - Check file exists: Test-Path file.md
329
+ - Install deps: npm install (NOT npm i)
330
+ - Run dev: npm run dev (NOT npx tsx watch)
331
+ - Run status checks: git status (works fine, no special syntax needed)`;
332
+ const UNIX_EXAMPLES = `Examples (Linux/macOS):
333
+ <tool_call>{"name":"bash","arguments":{"cmd":"ls -la"}}</tool_call>
334
+ <tool_call>{"name":"bash","arguments":{"cmd":"cat src/index.ts"}}</tool_call>
335
+ <tool_call>{"name":"bash","arguments":{"cmd":"npm test"}}</tool_call>
300
336
  <tool_call>{"name":"bash","arguments":{"cmd":"echo 'Hello World' > file.md"}}</tool_call>`;
301
- const UNIX_RULES = `Unix specifics:
302
- - Create/write files: echo "content" > file.md
303
- - Read files: cat file.md
304
- - List directory: ls -la
305
- - Paths use forward slashes: src/index.ts
337
+ const UNIX_RULES = `Unix specifics:
338
+ - Create/write files: echo "content" > file.md
339
+ - Read files: cat file.md
340
+ - List directory: ls -la
341
+ - Paths use forward slashes: src/index.ts
306
342
  - Check file exists: test -f file.md`;
307
343
  // ─── System prompt cache ────────────────────────────────
308
344
  // Caches the assembled prompt by key (cwd + mode + skills)
@@ -310,6 +346,7 @@ const systemPromptCache = new Map();
310
346
  /** Invalidate system prompt cache (called when config changes) */
311
347
  export function invalidateSystemPromptCache() {
312
348
  systemPromptCache.clear();
349
+ invalidateSkillCaches();
313
350
  }
314
351
  /**
315
352
  * Assembles system prompt from all blocks.
@@ -330,86 +367,163 @@ export function invalidateSystemPromptCache() {
330
367
  * @param mode - working mode (fast/pro/base)
331
368
  * @returns Assembled system prompt string
332
369
  */
333
- export function buildSystemPrompt(extraSkills, mode, pluginSections) {
370
+ export function buildSystemPrompt(extraSkills, mode, pluginSections, flags) {
334
371
  const start = performance.now();
335
372
  // Cache key: current directory + mode + skill names (sorted)
336
- const key = `${process.cwd()}:${mode || 'base'}:${extraSkills?.map(s => s.name).sort().join(',') || ''}:${pluginSections?.length || 0}`;
373
+ const key = `${process.cwd()}:${mode || "base"}:${extraSkills
374
+ ?.map((s) => s.name)
375
+ .sort()
376
+ .join(",") || ""}:${pluginSections?.length || 0}`;
337
377
  const cached = systemPromptCache.get(key);
338
378
  if (cached) {
339
- logDebug('SYSTEM', 'buildSystemPrompt: cache hit');
379
+ logDebug("SYSTEM", "buildSystemPrompt: cache hit");
340
380
  return cached;
341
381
  }
342
- logDebug('SYSTEM', 'buildSystemPrompt: building from scratch');
343
- const isWin = os.platform() === 'win32';
344
- const platformName = isWin ? 'Windows' : os.platform();
382
+ logDebug("SYSTEM", "buildSystemPrompt: building from scratch");
383
+ const isWin = os.platform() === "win32";
384
+ const platformName = isWin ? "Windows" : os.platform();
345
385
  let osVersion = platformName;
346
386
  try {
347
387
  osVersion += ` (${os.version()})`;
348
388
  }
349
- catch { /* ignore */ }
389
+ catch {
390
+ /* ignore */
391
+ }
350
392
  const now = new Date();
351
- const dateStr = now.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' });
352
- const timeStr = now.toLocaleTimeString('en-US');
353
- let projectName = 'unknown';
354
- const pkgPath = resolve(process.cwd(), 'package.json');
393
+ const dateStr = now.toLocaleDateString("en-US", {
394
+ year: "numeric",
395
+ month: "long",
396
+ day: "numeric",
397
+ weekday: "long",
398
+ });
399
+ const timeStr = now.toLocaleTimeString("en-US");
400
+ let projectName = "unknown";
401
+ const pkgPath = resolve(process.cwd(), "package.json");
355
402
  if (existsSync(pkgPath)) {
356
403
  try {
357
- projectName = JSON.parse(readFileSync(pkgPath, 'utf-8')).name || 'unknown';
404
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
405
+ // Читаем ТОЛЬКО имя проекта — никакие другие поля package.json
406
+ // не должны попадать в system prompt (возможны токены, apiKey и т.д.)
407
+ if (typeof pkg.name === "string" && pkg.name) {
408
+ projectName = pkg.name;
409
+ }
410
+ }
411
+ catch {
412
+ /* ignore */
358
413
  }
359
- catch { /* ignore */ }
360
414
  }
361
- const rules = mode === 'fast' ? RULES_FAST : RULES_COMMON;
415
+ const rules = mode === "fast" ? RULES_FAST : RULES_COMMON;
362
416
  const platformBlock = isWin
363
- ? [TOOL_FORMAT, CONVERSATION_FLOW, GROUNDING_RULE, POWERSHELL_EXAMPLES, rules, POWERSHELL_RULES].join('\n\n')
364
- : [TOOL_FORMAT, CONVERSATION_FLOW, GROUNDING_RULE, UNIX_EXAMPLES, rules, UNIX_RULES].join('\n\n');
365
- const header = `You are Micro Models Agent (MMA), an AI coding assistant.
417
+ ? [
418
+ TOOL_FORMAT,
419
+ CONVERSATION_FLOW,
420
+ GROUNDING_RULE,
421
+ POWERSHELL_EXAMPLES,
422
+ rules,
423
+ POWERSHELL_RULES,
424
+ ].join("\n\n")
425
+ : [
426
+ TOOL_FORMAT,
427
+ CONVERSATION_FLOW,
428
+ GROUNDING_RULE,
429
+ UNIX_EXAMPLES,
430
+ rules,
431
+ UNIX_RULES,
432
+ ].join("\n\n");
433
+ const header = `You are Micro Models Agent (MMA), an AI coding assistant.
366
434
  You help with software engineering tasks in the project directory.`;
367
435
  const sysInfo = [
368
- '',
369
- '## System',
436
+ "",
437
+ "## System",
370
438
  `Date: ${dateStr}`,
371
439
  `Time: ${timeStr}`,
372
440
  `OS: ${osVersion}`,
373
441
  `Node.js: ${process.version}`,
374
442
  `CWD: ${process.cwd()}`,
375
443
  `Project: ${projectName}`,
376
- '',
377
- ].join('\n');
444
+ "",
445
+ ].join("\n");
378
446
  // ─── Memory and user profile ──────────────────────────
379
447
  const memory = loadAllMemoryDetailed();
380
448
  const userProfile = loadProfileSummary();
381
449
  // ─── Project map (from indexer) ───────────────────────
382
- let projectMap = '';
450
+ let projectMap = "";
383
451
  try {
384
452
  const { formatted, fromCache } = getOrBuildProjectMap(process.cwd());
385
453
  if (formatted) {
386
- projectMap = `\n## Project Map${fromCache ? ' (cached)' : ''}\n${formatted}`;
454
+ projectMap = `\n## Project Map${fromCache ? " (cached)" : ""}\n${formatted}`;
387
455
  }
388
456
  }
389
- catch { /* ignore */ }
457
+ catch {
458
+ /* ignore */
459
+ }
390
460
  // ─── Project instructions (AGENTS.md) ─────────────────
391
- const agentsMd = loadAgentsMd(process.cwd());
392
- const agentsBlock = agentsMd ? `\n## Project Instructions (AGENTS.md)\n${agentsMd}` : '';
461
+ const agentsMd = flags?.dev ? null : loadAgentsMd(process.cwd());
462
+ const agentsBlock = agentsMd
463
+ ? `\n## Project Instructions (AGENTS.md)\n${agentsMd}`
464
+ : "";
393
465
  // ─── Available skills hint ────────────────────────────
394
- const allSkills = listInstalledSkills();
466
+ const allSkills = listSkillsWithDescriptions();
467
+ const truncateDesc = (d, max = 100) => d.length <= max ? d : d.slice(0, max - 1) + "…";
395
468
  const skillsHint = allSkills.length > 0
396
- ? `\n## Available Skills (${allSkills.length})\nSkills contain ready-made workflows, best practices, and step-by-step guides.\nFor complex tasks (3+ steps): mention @skill-name in your response — skills will be auto-loaded into context.\nDo NOT put @skill-name inside tool_call. Just mention them naturally in your text.\nWorkflow:\n 1. User asks: "Create a REST API"\n 2. You: "I'll use @typescript-expert @nodejs-expert for this task." (skills auto-load on next turn)\n 3. You create plan BASED ON skill guidance: plan create REST API ...\n 4. You execute plan step by step\n\nInstalled skills: ${allSkills.map(s => '@' + s).join(' ')}`
397
- : '';
469
+ ? `\n## Available Skills (${allSkills.length})\nSkills contain ready-made workflows, best practices, and step-by-step guides.\nFor complex tasks (3+ steps): mention @skill-name in your response — skills will be auto-loaded into context.\nDo NOT put @skill-name inside tool_call. Just mention them naturally in your text.\nWorkflow:\n 1. User asks: "Create a REST API"\n 2. You: "I'll use @typescript-expert @nodejs-expert for this task." (skills auto-load on next turn)\n 3. You create plan BASED ON skill guidance: plan create REST API ...\n 4. You execute plan step by step\n\nAvailable skills:\n${allSkills
470
+ .map((s) => s.description
471
+ ? ` @${s.name} — ${truncateDesc(s.description)}`
472
+ : ` @${s.name}`)
473
+ .join("\n")}`
474
+ : "";
398
475
  // ─── Mode block ──────────────────────────────────────
399
- const modeBlock = mode === 'fast'
476
+ const modeBlock = mode === "fast"
400
477
  ? `\n## Mode: Fast\n\u26a1 Fast mode \u2014 execute tasks directly without planning or loading skills. Skills are not available in this mode. Proceed immediately.`
401
- : mode === 'pro'
478
+ : mode === "pro"
402
479
  ? `\n## Mode: Pro\n\ud83d\udd0d Pro mode — @grill-me skill is pre-loaded. Before starting any task, you MUST first read and run the grill-me skill instructions to clarify requirements. Use it to refine the task before execution. Minimum context window: 64000.`
403
- : '';
480
+ : "";
404
481
  // ─── Final prompt assembly ───────────────────────────
405
- const base = mode === 'fast'
406
- ? [header, platformBlock, sysInfo, memory, userProfile, projectMap, agentsBlock, modeBlock].filter(Boolean).join('\n')
407
- : [header, platformBlock, sysInfo, memory, userProfile, projectMap, agentsBlock, skillsHint, modeBlock].filter(Boolean).join('\n');
408
- const result = base
409
- + (extraSkills && extraSkills.length > 0 && mode !== 'fast' ? '\n\n' + formatSkillsBlock(extraSkills) : '')
410
- + (pluginSections?.length ? '\n\n' + pluginSections.join('\n\n') : '');
482
+ const base = mode === "fast"
483
+ ? [
484
+ header,
485
+ platformBlock,
486
+ sysInfo,
487
+ memory,
488
+ userProfile,
489
+ projectMap,
490
+ agentsBlock,
491
+ modeBlock,
492
+ ]
493
+ .filter(Boolean)
494
+ .join("\n")
495
+ : [
496
+ header,
497
+ platformBlock,
498
+ sysInfo,
499
+ memory,
500
+ userProfile,
501
+ projectMap,
502
+ agentsBlock,
503
+ skillsHint,
504
+ modeBlock,
505
+ ]
506
+ .filter(Boolean)
507
+ .join("\n");
508
+ const result = base +
509
+ (extraSkills && extraSkills.length > 0 && mode !== "fast"
510
+ ? "\n\n" + formatSkillsBlock(extraSkills)
511
+ : "") +
512
+ (pluginSections?.length
513
+ ? "\n\n## Plugin Context (facts only)\n\n" +
514
+ pluginSections
515
+ .map((s) => {
516
+ // Лимит: 200 токенов ≈ 800 символов на секцию плагина
517
+ if (s.length > 800) {
518
+ logWarn("SYSTEM", `plugin section too long (${s.length} chars), truncating to 800`);
519
+ return s.slice(0, 800) + "\n[truncated]";
520
+ }
521
+ return s;
522
+ })
523
+ .join("\n\n")
524
+ : "");
411
525
  const elapsed = (performance.now() - start).toFixed(0);
412
- logInfo('SYSTEM', `buildSystemPrompt: ${result.length} chars in ${elapsed}ms`);
526
+ logInfo("SYSTEM", `buildSystemPrompt: ${result.length} chars in ${elapsed}ms`);
413
527
  systemPromptCache.set(key, result);
414
528
  return result;
415
529
  }