qlogicagent 0.1.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 (450) hide show
  1. package/README.md +45 -0
  2. package/dist/agent/agent.d.ts +44 -0
  3. package/dist/agent/agent.d.ts.map +1 -0
  4. package/dist/agent/agent.js +114 -0
  5. package/dist/agent/agent.js.map +1 -0
  6. package/dist/agent/tool-loop.d.ts +65 -0
  7. package/dist/agent/tool-loop.d.ts.map +1 -0
  8. package/dist/agent/tool-loop.js +576 -0
  9. package/dist/agent/tool-loop.js.map +1 -0
  10. package/dist/agent/types.d.ts +176 -0
  11. package/dist/agent/types.d.ts.map +1 -0
  12. package/dist/agent/types.js +15 -0
  13. package/dist/agent/types.js.map +1 -0
  14. package/dist/cli/main.d.ts +12 -0
  15. package/dist/cli/main.d.ts.map +1 -0
  16. package/dist/cli/main.js +24 -0
  17. package/dist/cli/main.js.map +1 -0
  18. package/dist/cli/stdio-server.d.ts +46 -0
  19. package/dist/cli/stdio-server.d.ts.map +1 -0
  20. package/dist/cli/stdio-server.js +464 -0
  21. package/dist/cli/stdio-server.js.map +1 -0
  22. package/dist/config/config.d.ts +18 -0
  23. package/dist/config/config.d.ts.map +1 -0
  24. package/dist/config/config.js +22 -0
  25. package/dist/config/config.js.map +1 -0
  26. package/dist/contracts/hooks.d.ts +121 -0
  27. package/dist/contracts/hooks.d.ts.map +1 -0
  28. package/dist/contracts/hooks.js +8 -0
  29. package/dist/contracts/hooks.js.map +1 -0
  30. package/dist/contracts/index.d.ts +11 -0
  31. package/dist/contracts/index.d.ts.map +1 -0
  32. package/dist/contracts/index.js +11 -0
  33. package/dist/contracts/index.js.map +1 -0
  34. package/dist/contracts/planner.d.ts +36 -0
  35. package/dist/contracts/planner.d.ts.map +1 -0
  36. package/dist/contracts/planner.js +3 -0
  37. package/dist/contracts/planner.js.map +1 -0
  38. package/dist/contracts/skill-candidate.d.ts +64 -0
  39. package/dist/contracts/skill-candidate.d.ts.map +1 -0
  40. package/dist/contracts/skill-candidate.js +196 -0
  41. package/dist/contracts/skill-candidate.js.map +1 -0
  42. package/dist/contracts/todo.d.ts +15 -0
  43. package/dist/contracts/todo.d.ts.map +1 -0
  44. package/dist/contracts/todo.js +10 -0
  45. package/dist/contracts/todo.js.map +1 -0
  46. package/dist/index.d.ts +14 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +16 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/llm/builtin-providers.d.ts +11 -0
  51. package/dist/llm/builtin-providers.d.ts.map +1 -0
  52. package/dist/llm/builtin-providers.js +532 -0
  53. package/dist/llm/builtin-providers.js.map +1 -0
  54. package/dist/llm/index.d.ts +16 -0
  55. package/dist/llm/index.d.ts.map +1 -0
  56. package/dist/llm/index.js +15 -0
  57. package/dist/llm/index.js.map +1 -0
  58. package/dist/llm/llm-client.d.ts +44 -0
  59. package/dist/llm/llm-client.d.ts.map +1 -0
  60. package/dist/llm/llm-client.js +68 -0
  61. package/dist/llm/llm-client.js.map +1 -0
  62. package/dist/llm/model-catalog.d.ts +54 -0
  63. package/dist/llm/model-catalog.d.ts.map +1 -0
  64. package/dist/llm/model-catalog.js +192 -0
  65. package/dist/llm/model-catalog.js.map +1 -0
  66. package/dist/llm/provider-def.d.ts +60 -0
  67. package/dist/llm/provider-def.d.ts.map +1 -0
  68. package/dist/llm/provider-def.js +13 -0
  69. package/dist/llm/provider-def.js.map +1 -0
  70. package/dist/llm/provider-registry.d.ts +55 -0
  71. package/dist/llm/provider-registry.d.ts.map +1 -0
  72. package/dist/llm/provider-registry.js +148 -0
  73. package/dist/llm/provider-registry.js.map +1 -0
  74. package/dist/llm/transport.d.ts +63 -0
  75. package/dist/llm/transport.d.ts.map +1 -0
  76. package/dist/llm/transport.js +28 -0
  77. package/dist/llm/transport.js.map +1 -0
  78. package/dist/llm/transports/anthropic-messages.d.ts +32 -0
  79. package/dist/llm/transports/anthropic-messages.d.ts.map +1 -0
  80. package/dist/llm/transports/anthropic-messages.js +294 -0
  81. package/dist/llm/transports/anthropic-messages.js.map +1 -0
  82. package/dist/llm/transports/openai-chat.d.ts +37 -0
  83. package/dist/llm/transports/openai-chat.d.ts.map +1 -0
  84. package/dist/llm/transports/openai-chat.js +166 -0
  85. package/dist/llm/transports/openai-chat.js.map +1 -0
  86. package/dist/orchestration/agent-registry.d.ts +42 -0
  87. package/dist/orchestration/agent-registry.d.ts.map +1 -0
  88. package/dist/orchestration/agent-registry.js +117 -0
  89. package/dist/orchestration/agent-registry.js.map +1 -0
  90. package/dist/orchestration/approval-aware-tool-plan.d.ts +33 -0
  91. package/dist/orchestration/approval-aware-tool-plan.d.ts.map +1 -0
  92. package/dist/orchestration/approval-aware-tool-plan.js +88 -0
  93. package/dist/orchestration/approval-aware-tool-plan.js.map +1 -0
  94. package/dist/orchestration/context-compression.d.ts +221 -0
  95. package/dist/orchestration/context-compression.d.ts.map +1 -0
  96. package/dist/orchestration/context-compression.js +584 -0
  97. package/dist/orchestration/context-compression.js.map +1 -0
  98. package/dist/orchestration/conversation-repair.d.ts +62 -0
  99. package/dist/orchestration/conversation-repair.d.ts.map +1 -0
  100. package/dist/orchestration/conversation-repair.js +430 -0
  101. package/dist/orchestration/conversation-repair.js.map +1 -0
  102. package/dist/orchestration/curator-scheduler.d.ts +120 -0
  103. package/dist/orchestration/curator-scheduler.d.ts.map +1 -0
  104. package/dist/orchestration/curator-scheduler.js +136 -0
  105. package/dist/orchestration/curator-scheduler.js.map +1 -0
  106. package/dist/orchestration/embedded-failover-policy.d.ts +111 -0
  107. package/dist/orchestration/embedded-failover-policy.d.ts.map +1 -0
  108. package/dist/orchestration/embedded-failover-policy.js +169 -0
  109. package/dist/orchestration/embedded-failover-policy.js.map +1 -0
  110. package/dist/orchestration/error-classification.d.ts +13 -0
  111. package/dist/orchestration/error-classification.d.ts.map +1 -0
  112. package/dist/orchestration/error-classification.js +78 -0
  113. package/dist/orchestration/error-classification.js.map +1 -0
  114. package/dist/orchestration/failover-classification.d.ts +9 -0
  115. package/dist/orchestration/failover-classification.d.ts.map +1 -0
  116. package/dist/orchestration/failover-classification.js +382 -0
  117. package/dist/orchestration/failover-classification.js.map +1 -0
  118. package/dist/orchestration/failover-error.d.ts +34 -0
  119. package/dist/orchestration/failover-error.d.ts.map +1 -0
  120. package/dist/orchestration/failover-error.js +199 -0
  121. package/dist/orchestration/failover-error.js.map +1 -0
  122. package/dist/orchestration/fork-subagent.d.ts +101 -0
  123. package/dist/orchestration/fork-subagent.d.ts.map +1 -0
  124. package/dist/orchestration/fork-subagent.js +99 -0
  125. package/dist/orchestration/fork-subagent.js.map +1 -0
  126. package/dist/orchestration/index.d.ts +121 -0
  127. package/dist/orchestration/index.d.ts.map +1 -0
  128. package/dist/orchestration/index.js +268 -0
  129. package/dist/orchestration/index.js.map +1 -0
  130. package/dist/orchestration/memory-flush-policy.d.ts +58 -0
  131. package/dist/orchestration/memory-flush-policy.d.ts.map +1 -0
  132. package/dist/orchestration/memory-flush-policy.js +86 -0
  133. package/dist/orchestration/memory-flush-policy.js.map +1 -0
  134. package/dist/orchestration/memory-provider.d.ts +15 -0
  135. package/dist/orchestration/memory-provider.d.ts.map +1 -0
  136. package/dist/orchestration/memory-provider.js +3 -0
  137. package/dist/orchestration/memory-provider.js.map +1 -0
  138. package/dist/orchestration/parallel-tool-calls.d.ts +42 -0
  139. package/dist/orchestration/parallel-tool-calls.d.ts.map +1 -0
  140. package/dist/orchestration/parallel-tool-calls.js +60 -0
  141. package/dist/orchestration/parallel-tool-calls.js.map +1 -0
  142. package/dist/orchestration/prompt-cache-strategy.d.ts +127 -0
  143. package/dist/orchestration/prompt-cache-strategy.d.ts.map +1 -0
  144. package/dist/orchestration/prompt-cache-strategy.js +229 -0
  145. package/dist/orchestration/prompt-cache-strategy.js.map +1 -0
  146. package/dist/orchestration/reactive-compact.d.ts +74 -0
  147. package/dist/orchestration/reactive-compact.d.ts.map +1 -0
  148. package/dist/orchestration/reactive-compact.js +79 -0
  149. package/dist/orchestration/reactive-compact.js.map +1 -0
  150. package/dist/orchestration/retry-loop.d.ts +23 -0
  151. package/dist/orchestration/retry-loop.d.ts.map +1 -0
  152. package/dist/orchestration/retry-loop.js +25 -0
  153. package/dist/orchestration/retry-loop.js.map +1 -0
  154. package/dist/orchestration/skill-candidate.d.ts +53 -0
  155. package/dist/orchestration/skill-candidate.d.ts.map +1 -0
  156. package/dist/orchestration/skill-candidate.js +142 -0
  157. package/dist/orchestration/skill-candidate.js.map +1 -0
  158. package/dist/orchestration/skill-consolidation.d.ts +124 -0
  159. package/dist/orchestration/skill-consolidation.d.ts.map +1 -0
  160. package/dist/orchestration/skill-consolidation.js +221 -0
  161. package/dist/orchestration/skill-consolidation.js.map +1 -0
  162. package/dist/orchestration/skill-improvement.d.ts +60 -0
  163. package/dist/orchestration/skill-improvement.d.ts.map +1 -0
  164. package/dist/orchestration/skill-improvement.js +67 -0
  165. package/dist/orchestration/skill-improvement.js.map +1 -0
  166. package/dist/orchestration/skill-similarity.d.ts +99 -0
  167. package/dist/orchestration/skill-similarity.d.ts.map +1 -0
  168. package/dist/orchestration/skill-similarity.js +132 -0
  169. package/dist/orchestration/skill-similarity.js.map +1 -0
  170. package/dist/orchestration/streaming-tool-executor.d.ts +74 -0
  171. package/dist/orchestration/streaming-tool-executor.d.ts.map +1 -0
  172. package/dist/orchestration/streaming-tool-executor.js +97 -0
  173. package/dist/orchestration/streaming-tool-executor.js.map +1 -0
  174. package/dist/orchestration/team-orchestration.d.ts +196 -0
  175. package/dist/orchestration/team-orchestration.d.ts.map +1 -0
  176. package/dist/orchestration/team-orchestration.js +370 -0
  177. package/dist/orchestration/team-orchestration.js.map +1 -0
  178. package/dist/orchestration/team-tool-loop-wiring.d.ts +93 -0
  179. package/dist/orchestration/team-tool-loop-wiring.d.ts.map +1 -0
  180. package/dist/orchestration/team-tool-loop-wiring.js +148 -0
  181. package/dist/orchestration/team-tool-loop-wiring.js.map +1 -0
  182. package/dist/orchestration/tool-choice-policy.d.ts +55 -0
  183. package/dist/orchestration/tool-choice-policy.d.ts.map +1 -0
  184. package/dist/orchestration/tool-choice-policy.js +165 -0
  185. package/dist/orchestration/tool-choice-policy.js.map +1 -0
  186. package/dist/orchestration/tool-loop-state.d.ts +51 -0
  187. package/dist/orchestration/tool-loop-state.d.ts.map +1 -0
  188. package/dist/orchestration/tool-loop-state.js +134 -0
  189. package/dist/orchestration/tool-loop-state.js.map +1 -0
  190. package/dist/orchestration/tool-schema.d.ts +40 -0
  191. package/dist/orchestration/tool-schema.d.ts.map +1 -0
  192. package/dist/orchestration/tool-schema.js +298 -0
  193. package/dist/orchestration/tool-schema.js.map +1 -0
  194. package/dist/orchestration/transcript-repair.d.ts +43 -0
  195. package/dist/orchestration/transcript-repair.d.ts.map +1 -0
  196. package/dist/orchestration/transcript-repair.js +427 -0
  197. package/dist/orchestration/transcript-repair.js.map +1 -0
  198. package/dist/orchestration/turn-loop-guard.d.ts +87 -0
  199. package/dist/orchestration/turn-loop-guard.d.ts.map +1 -0
  200. package/dist/orchestration/turn-loop-guard.js +93 -0
  201. package/dist/orchestration/turn-loop-guard.js.map +1 -0
  202. package/dist/orchestration/web-browser-policy.d.ts +18 -0
  203. package/dist/orchestration/web-browser-policy.d.ts.map +1 -0
  204. package/dist/orchestration/web-browser-policy.js +40 -0
  205. package/dist/orchestration/web-browser-policy.js.map +1 -0
  206. package/dist/runtime/context-compression.d.ts +62 -0
  207. package/dist/runtime/context-compression.d.ts.map +1 -0
  208. package/dist/runtime/context-compression.js +275 -0
  209. package/dist/runtime/context-compression.js.map +1 -0
  210. package/dist/runtime/hook-registry.d.ts +13 -0
  211. package/dist/runtime/hook-registry.d.ts.map +1 -0
  212. package/dist/runtime/hook-registry.js +54 -0
  213. package/dist/runtime/hook-registry.js.map +1 -0
  214. package/dist/runtime/memory-hooks.d.ts +24 -0
  215. package/dist/runtime/memory-hooks.d.ts.map +1 -0
  216. package/dist/runtime/memory-hooks.js +66 -0
  217. package/dist/runtime/memory-hooks.js.map +1 -0
  218. package/dist/runtime/tool-eligibility.d.ts +60 -0
  219. package/dist/runtime/tool-eligibility.d.ts.map +1 -0
  220. package/dist/runtime/tool-eligibility.js +112 -0
  221. package/dist/runtime/tool-eligibility.js.map +1 -0
  222. package/dist/skills/index.d.ts +109 -0
  223. package/dist/skills/index.d.ts.map +1 -0
  224. package/dist/skills/index.js +83 -0
  225. package/dist/skills/index.js.map +1 -0
  226. package/dist/skills/memory-extractor.d.ts +65 -0
  227. package/dist/skills/memory-extractor.d.ts.map +1 -0
  228. package/dist/skills/memory-extractor.js +174 -0
  229. package/dist/skills/memory-extractor.js.map +1 -0
  230. package/dist/skills/memory-query-tool.d.ts +44 -0
  231. package/dist/skills/memory-query-tool.d.ts.map +1 -0
  232. package/dist/skills/memory-query-tool.js +128 -0
  233. package/dist/skills/memory-query-tool.js.map +1 -0
  234. package/dist/skills/memory-store.d.ts +67 -0
  235. package/dist/skills/memory-store.d.ts.map +1 -0
  236. package/dist/skills/memory-store.js +229 -0
  237. package/dist/skills/memory-store.js.map +1 -0
  238. package/dist/skills/memory-tool.d.ts +68 -0
  239. package/dist/skills/memory-tool.d.ts.map +1 -0
  240. package/dist/skills/memory-tool.js +193 -0
  241. package/dist/skills/memory-tool.js.map +1 -0
  242. package/dist/skills/portable-tool.d.ts +72 -0
  243. package/dist/skills/portable-tool.d.ts.map +1 -0
  244. package/dist/skills/portable-tool.js +15 -0
  245. package/dist/skills/portable-tool.js.map +1 -0
  246. package/dist/skills/qmemory-adapter.d.ts +53 -0
  247. package/dist/skills/qmemory-adapter.d.ts.map +1 -0
  248. package/dist/skills/qmemory-adapter.js +166 -0
  249. package/dist/skills/qmemory-adapter.js.map +1 -0
  250. package/dist/skills/skill-frontmatter.d.ts +20 -0
  251. package/dist/skills/skill-frontmatter.d.ts.map +1 -0
  252. package/dist/skills/skill-frontmatter.js +345 -0
  253. package/dist/skills/skill-frontmatter.js.map +1 -0
  254. package/dist/skills/skill-guard.d.ts +24 -0
  255. package/dist/skills/skill-guard.d.ts.map +1 -0
  256. package/dist/skills/skill-guard.js +230 -0
  257. package/dist/skills/skill-guard.js.map +1 -0
  258. package/dist/skills/skill-loader.d.ts +17 -0
  259. package/dist/skills/skill-loader.d.ts.map +1 -0
  260. package/dist/skills/skill-loader.js +304 -0
  261. package/dist/skills/skill-loader.js.map +1 -0
  262. package/dist/skills/skill-source.d.ts +120 -0
  263. package/dist/skills/skill-source.d.ts.map +1 -0
  264. package/dist/skills/skill-source.js +127 -0
  265. package/dist/skills/skill-source.js.map +1 -0
  266. package/dist/skills/skill-types.d.ts +200 -0
  267. package/dist/skills/skill-types.d.ts.map +1 -0
  268. package/dist/skills/skill-types.js +7 -0
  269. package/dist/skills/skill-types.js.map +1 -0
  270. package/dist/skills/think-tool.d.ts +17 -0
  271. package/dist/skills/think-tool.d.ts.map +1 -0
  272. package/dist/skills/think-tool.js +60 -0
  273. package/dist/skills/think-tool.js.map +1 -0
  274. package/dist/skills/todo-tool.d.ts +64 -0
  275. package/dist/skills/todo-tool.d.ts.map +1 -0
  276. package/dist/skills/todo-tool.js +115 -0
  277. package/dist/skills/todo-tool.js.map +1 -0
  278. package/dist/skills/tools/agent-tool.d.ts +92 -0
  279. package/dist/skills/tools/agent-tool.d.ts.map +1 -0
  280. package/dist/skills/tools/agent-tool.js +143 -0
  281. package/dist/skills/tools/agent-tool.js.map +1 -0
  282. package/dist/skills/tools/apply-patch-tool.d.ts +30 -0
  283. package/dist/skills/tools/apply-patch-tool.d.ts.map +1 -0
  284. package/dist/skills/tools/apply-patch-tool.js +185 -0
  285. package/dist/skills/tools/apply-patch-tool.js.map +1 -0
  286. package/dist/skills/tools/ask-user-tool.d.ts +81 -0
  287. package/dist/skills/tools/ask-user-tool.d.ts.map +1 -0
  288. package/dist/skills/tools/ask-user-tool.js +122 -0
  289. package/dist/skills/tools/ask-user-tool.js.map +1 -0
  290. package/dist/skills/tools/brief-tool.d.ts +75 -0
  291. package/dist/skills/tools/brief-tool.d.ts.map +1 -0
  292. package/dist/skills/tools/brief-tool.js +96 -0
  293. package/dist/skills/tools/brief-tool.js.map +1 -0
  294. package/dist/skills/tools/browser-tool.d.ts +115 -0
  295. package/dist/skills/tools/browser-tool.d.ts.map +1 -0
  296. package/dist/skills/tools/browser-tool.js +156 -0
  297. package/dist/skills/tools/browser-tool.js.map +1 -0
  298. package/dist/skills/tools/checkpoint-tool.d.ts +67 -0
  299. package/dist/skills/tools/checkpoint-tool.d.ts.map +1 -0
  300. package/dist/skills/tools/checkpoint-tool.js +103 -0
  301. package/dist/skills/tools/checkpoint-tool.js.map +1 -0
  302. package/dist/skills/tools/config-tool.d.ts +64 -0
  303. package/dist/skills/tools/config-tool.d.ts.map +1 -0
  304. package/dist/skills/tools/config-tool.js +144 -0
  305. package/dist/skills/tools/config-tool.js.map +1 -0
  306. package/dist/skills/tools/cron-tool.d.ts +117 -0
  307. package/dist/skills/tools/cron-tool.d.ts.map +1 -0
  308. package/dist/skills/tools/cron-tool.js +176 -0
  309. package/dist/skills/tools/cron-tool.js.map +1 -0
  310. package/dist/skills/tools/edit-tool.d.ts +44 -0
  311. package/dist/skills/tools/edit-tool.d.ts.map +1 -0
  312. package/dist/skills/tools/edit-tool.js +71 -0
  313. package/dist/skills/tools/edit-tool.js.map +1 -0
  314. package/dist/skills/tools/exec-tool.d.ts +103 -0
  315. package/dist/skills/tools/exec-tool.d.ts.map +1 -0
  316. package/dist/skills/tools/exec-tool.js +134 -0
  317. package/dist/skills/tools/exec-tool.js.map +1 -0
  318. package/dist/skills/tools/image-generate-tool.d.ts +63 -0
  319. package/dist/skills/tools/image-generate-tool.d.ts.map +1 -0
  320. package/dist/skills/tools/image-generate-tool.js +68 -0
  321. package/dist/skills/tools/image-generate-tool.js.map +1 -0
  322. package/dist/skills/tools/instructions-tool.d.ts +104 -0
  323. package/dist/skills/tools/instructions-tool.d.ts.map +1 -0
  324. package/dist/skills/tools/instructions-tool.js +188 -0
  325. package/dist/skills/tools/instructions-tool.js.map +1 -0
  326. package/dist/skills/tools/lsp-tool.d.ts +154 -0
  327. package/dist/skills/tools/lsp-tool.d.ts.map +1 -0
  328. package/dist/skills/tools/lsp-tool.js +228 -0
  329. package/dist/skills/tools/lsp-tool.js.map +1 -0
  330. package/dist/skills/tools/mcp-client-types.d.ts +270 -0
  331. package/dist/skills/tools/mcp-client-types.d.ts.map +1 -0
  332. package/dist/skills/tools/mcp-client-types.js +54 -0
  333. package/dist/skills/tools/mcp-client-types.js.map +1 -0
  334. package/dist/skills/tools/mcp-tool.d.ts +250 -0
  335. package/dist/skills/tools/mcp-tool.d.ts.map +1 -0
  336. package/dist/skills/tools/mcp-tool.js +504 -0
  337. package/dist/skills/tools/mcp-tool.js.map +1 -0
  338. package/dist/skills/tools/memory-tool.d.ts +75 -0
  339. package/dist/skills/tools/memory-tool.d.ts.map +1 -0
  340. package/dist/skills/tools/memory-tool.js +89 -0
  341. package/dist/skills/tools/memory-tool.js.map +1 -0
  342. package/dist/skills/tools/monitor-tool.d.ts +114 -0
  343. package/dist/skills/tools/monitor-tool.d.ts.map +1 -0
  344. package/dist/skills/tools/monitor-tool.js +132 -0
  345. package/dist/skills/tools/monitor-tool.js.map +1 -0
  346. package/dist/skills/tools/music-generate-tool.d.ts +56 -0
  347. package/dist/skills/tools/music-generate-tool.d.ts.map +1 -0
  348. package/dist/skills/tools/music-generate-tool.js +63 -0
  349. package/dist/skills/tools/music-generate-tool.js.map +1 -0
  350. package/dist/skills/tools/notify-tool.d.ts +54 -0
  351. package/dist/skills/tools/notify-tool.d.ts.map +1 -0
  352. package/dist/skills/tools/notify-tool.js +63 -0
  353. package/dist/skills/tools/notify-tool.js.map +1 -0
  354. package/dist/skills/tools/patch-tool.d.ts +46 -0
  355. package/dist/skills/tools/patch-tool.d.ts.map +1 -0
  356. package/dist/skills/tools/patch-tool.js +506 -0
  357. package/dist/skills/tools/patch-tool.js.map +1 -0
  358. package/dist/skills/tools/pdf-tool.d.ts +67 -0
  359. package/dist/skills/tools/pdf-tool.d.ts.map +1 -0
  360. package/dist/skills/tools/pdf-tool.js +89 -0
  361. package/dist/skills/tools/pdf-tool.js.map +1 -0
  362. package/dist/skills/tools/plan-mode-tool.d.ts +60 -0
  363. package/dist/skills/tools/plan-mode-tool.d.ts.map +1 -0
  364. package/dist/skills/tools/plan-mode-tool.js +123 -0
  365. package/dist/skills/tools/plan-mode-tool.js.map +1 -0
  366. package/dist/skills/tools/read-tool.d.ts +52 -0
  367. package/dist/skills/tools/read-tool.d.ts.map +1 -0
  368. package/dist/skills/tools/read-tool.js +85 -0
  369. package/dist/skills/tools/read-tool.js.map +1 -0
  370. package/dist/skills/tools/repl-tool.d.ts +71 -0
  371. package/dist/skills/tools/repl-tool.d.ts.map +1 -0
  372. package/dist/skills/tools/repl-tool.js +70 -0
  373. package/dist/skills/tools/repl-tool.js.map +1 -0
  374. package/dist/skills/tools/search-tool.d.ts +113 -0
  375. package/dist/skills/tools/search-tool.d.ts.map +1 -0
  376. package/dist/skills/tools/search-tool.js +226 -0
  377. package/dist/skills/tools/search-tool.js.map +1 -0
  378. package/dist/skills/tools/send-message-tool.d.ts +52 -0
  379. package/dist/skills/tools/send-message-tool.d.ts.map +1 -0
  380. package/dist/skills/tools/send-message-tool.js +77 -0
  381. package/dist/skills/tools/send-message-tool.js.map +1 -0
  382. package/dist/skills/tools/skill-list-tool.d.ts +34 -0
  383. package/dist/skills/tools/skill-list-tool.d.ts.map +1 -0
  384. package/dist/skills/tools/skill-list-tool.js +55 -0
  385. package/dist/skills/tools/skill-list-tool.js.map +1 -0
  386. package/dist/skills/tools/skill-manage-tool.d.ts +74 -0
  387. package/dist/skills/tools/skill-manage-tool.d.ts.map +1 -0
  388. package/dist/skills/tools/skill-manage-tool.js +154 -0
  389. package/dist/skills/tools/skill-manage-tool.js.map +1 -0
  390. package/dist/skills/tools/skill-view-tool.d.ts +38 -0
  391. package/dist/skills/tools/skill-view-tool.d.ts.map +1 -0
  392. package/dist/skills/tools/skill-view-tool.js +73 -0
  393. package/dist/skills/tools/skill-view-tool.js.map +1 -0
  394. package/dist/skills/tools/sleep-tool.d.ts +50 -0
  395. package/dist/skills/tools/sleep-tool.d.ts.map +1 -0
  396. package/dist/skills/tools/sleep-tool.js +82 -0
  397. package/dist/skills/tools/sleep-tool.js.map +1 -0
  398. package/dist/skills/tools/structured-output-tool.d.ts +117 -0
  399. package/dist/skills/tools/structured-output-tool.d.ts.map +1 -0
  400. package/dist/skills/tools/structured-output-tool.js +177 -0
  401. package/dist/skills/tools/structured-output-tool.js.map +1 -0
  402. package/dist/skills/tools/task-tool.d.ts +105 -0
  403. package/dist/skills/tools/task-tool.d.ts.map +1 -0
  404. package/dist/skills/tools/task-tool.js +162 -0
  405. package/dist/skills/tools/task-tool.js.map +1 -0
  406. package/dist/skills/tools/team-tool.d.ts +90 -0
  407. package/dist/skills/tools/team-tool.d.ts.map +1 -0
  408. package/dist/skills/tools/team-tool.js +106 -0
  409. package/dist/skills/tools/team-tool.js.map +1 -0
  410. package/dist/skills/tools/tool-search-tool.d.ts +52 -0
  411. package/dist/skills/tools/tool-search-tool.d.ts.map +1 -0
  412. package/dist/skills/tools/tool-search-tool.js +111 -0
  413. package/dist/skills/tools/tool-search-tool.js.map +1 -0
  414. package/dist/skills/tools/tts-tool.d.ts +39 -0
  415. package/dist/skills/tools/tts-tool.d.ts.map +1 -0
  416. package/dist/skills/tools/tts-tool.js +46 -0
  417. package/dist/skills/tools/tts-tool.js.map +1 -0
  418. package/dist/skills/tools/video-edit-tool.d.ts +70 -0
  419. package/dist/skills/tools/video-edit-tool.d.ts.map +1 -0
  420. package/dist/skills/tools/video-edit-tool.js +75 -0
  421. package/dist/skills/tools/video-edit-tool.js.map +1 -0
  422. package/dist/skills/tools/video-generate-tool.d.ts +63 -0
  423. package/dist/skills/tools/video-generate-tool.d.ts.map +1 -0
  424. package/dist/skills/tools/video-generate-tool.js +67 -0
  425. package/dist/skills/tools/video-generate-tool.js.map +1 -0
  426. package/dist/skills/tools/video-merge-tool.d.ts +106 -0
  427. package/dist/skills/tools/video-merge-tool.d.ts.map +1 -0
  428. package/dist/skills/tools/video-merge-tool.js +93 -0
  429. package/dist/skills/tools/video-merge-tool.js.map +1 -0
  430. package/dist/skills/tools/video-upscale-tool.d.ts +46 -0
  431. package/dist/skills/tools/video-upscale-tool.d.ts.map +1 -0
  432. package/dist/skills/tools/video-upscale-tool.js +53 -0
  433. package/dist/skills/tools/video-upscale-tool.js.map +1 -0
  434. package/dist/skills/tools/web-fetch-tool.d.ts +79 -0
  435. package/dist/skills/tools/web-fetch-tool.d.ts.map +1 -0
  436. package/dist/skills/tools/web-fetch-tool.js +93 -0
  437. package/dist/skills/tools/web-fetch-tool.js.map +1 -0
  438. package/dist/skills/tools/web-search-tool.d.ts +58 -0
  439. package/dist/skills/tools/web-search-tool.d.ts.map +1 -0
  440. package/dist/skills/tools/web-search-tool.js +87 -0
  441. package/dist/skills/tools/web-search-tool.js.map +1 -0
  442. package/dist/skills/tools/worktree-tool.d.ts +70 -0
  443. package/dist/skills/tools/worktree-tool.d.ts.map +1 -0
  444. package/dist/skills/tools/worktree-tool.js +148 -0
  445. package/dist/skills/tools/worktree-tool.js.map +1 -0
  446. package/dist/skills/tools/write-tool.d.ts +46 -0
  447. package/dist/skills/tools/write-tool.d.ts.map +1 -0
  448. package/dist/skills/tools/write-tool.js +82 -0
  449. package/dist/skills/tools/write-tool.js.map +1 -0
  450. package/package.json +41 -0
@@ -0,0 +1,142 @@
1
+ import { coerceSkillCandidateJsonObject, normalizeSkillCandidateAction, normalizeSkillCandidateArtifact, normalizeSkillCandidateEffectiveness, normalizeSkillCandidateEffectivenessPhase, normalizeSkillCandidateSourceExecution, } from "../contracts/skill-candidate.js";
2
+ const DEFAULT_SKILL_IMPROVEMENT_POLICY = {
3
+ reviewRequired: true,
4
+ canaryRequired: true,
5
+ autoPromote: false,
6
+ minCanarySampleCount: 10,
7
+ minSuccessRate: 0.7,
8
+ maxRegressionRate: 0.1,
9
+ maxCostIncreaseRate: 0.25,
10
+ staleAfterHours: 168,
11
+ };
12
+ function normalizeOptionalBoolean(value, fallback) {
13
+ if (typeof value === "boolean") {
14
+ return value;
15
+ }
16
+ if (typeof value === "string") {
17
+ const normalized = value.trim().toLowerCase();
18
+ if (normalized === "true") {
19
+ return true;
20
+ }
21
+ if (normalized === "false") {
22
+ return false;
23
+ }
24
+ }
25
+ return fallback;
26
+ }
27
+ function normalizeOptionalFiniteNumber(value, fallback) {
28
+ if (typeof value === "number" && Number.isFinite(value)) {
29
+ return value;
30
+ }
31
+ if (typeof value === "string") {
32
+ const trimmed = value.trim();
33
+ if (trimmed) {
34
+ const parsed = Number(trimmed);
35
+ if (Number.isFinite(parsed)) {
36
+ return parsed;
37
+ }
38
+ }
39
+ }
40
+ return fallback;
41
+ }
42
+ function normalizeOptionalStringArray(value) {
43
+ return Array.isArray(value)
44
+ ? value
45
+ .filter((entry) => typeof entry === "string")
46
+ .map((entry) => entry.trim())
47
+ .filter(Boolean)
48
+ : [];
49
+ }
50
+ export function createDefaultSkillImprovementPolicy(overrides = {}) {
51
+ return normalizeSkillImprovementPolicy(overrides, DEFAULT_SKILL_IMPROVEMENT_POLICY);
52
+ }
53
+ export function normalizeSkillImprovementPolicy(value, fallback = DEFAULT_SKILL_IMPROVEMENT_POLICY) {
54
+ const record = coerceSkillCandidateJsonObject(value);
55
+ return {
56
+ reviewRequired: normalizeOptionalBoolean(record.reviewRequired, fallback.reviewRequired),
57
+ canaryRequired: normalizeOptionalBoolean(record.canaryRequired, fallback.canaryRequired),
58
+ autoPromote: normalizeOptionalBoolean(record.autoPromote, fallback.autoPromote),
59
+ minCanarySampleCount: Math.max(1, Math.floor(normalizeOptionalFiniteNumber(record.minCanarySampleCount, fallback.minCanarySampleCount))),
60
+ minSuccessRate: Math.max(0, Math.min(1, normalizeOptionalFiniteNumber(record.minSuccessRate, fallback.minSuccessRate))),
61
+ maxRegressionRate: Math.max(0, Math.min(1, normalizeOptionalFiniteNumber(record.maxRegressionRate, fallback.maxRegressionRate))),
62
+ maxCostIncreaseRate: Math.max(0, normalizeOptionalFiniteNumber(record.maxCostIncreaseRate, fallback.maxCostIncreaseRate)),
63
+ staleAfterHours: Math.max(1, Math.floor(normalizeOptionalFiniteNumber(record.staleAfterHours, fallback.staleAfterHours))),
64
+ };
65
+ }
66
+ export function buildSkillCandidateEvidencePayload(params) {
67
+ const evidence = coerceSkillCandidateJsonObject(params.evidence);
68
+ const artifact = params.artifact ? normalizeSkillCandidateArtifact(params.artifact) : null;
69
+ const sourceExecution = params.sourceExecution
70
+ ? normalizeSkillCandidateSourceExecution(params.sourceExecution)
71
+ : null;
72
+ const sourceSessionKey = typeof params.sourceSessionKey === "string"
73
+ ? params.sourceSessionKey.trim()
74
+ : "";
75
+ return {
76
+ ...evidence,
77
+ ...(artifact ? { artifact } : {}),
78
+ ...(sourceExecution ? { sourceExecution } : {}),
79
+ ...(sourceSessionKey ? { sourceSessionKey } : {}),
80
+ };
81
+ }
82
+ export function buildSkillCandidateImprovementEvidenceBundle(params) {
83
+ const evidence = buildSkillCandidateEvidencePayload(params);
84
+ const diffSummary = typeof params.diffSummary === "string" && params.diffSummary.trim()
85
+ ? params.diffSummary.trim()
86
+ : "";
87
+ const baselineCandidateId = typeof params.baselineCandidateId === "string"
88
+ && params.baselineCandidateId.trim()
89
+ ? params.baselineCandidateId.trim()
90
+ : "";
91
+ const rolloutNotes = typeof params.rolloutNotes === "string" && params.rolloutNotes.trim()
92
+ ? params.rolloutNotes.trim()
93
+ : "";
94
+ const validationRefs = normalizeOptionalStringArray(params.validationRefs);
95
+ return {
96
+ ...evidence,
97
+ ...(diffSummary ? { diffSummary } : {}),
98
+ ...(baselineCandidateId ? { baselineCandidateId } : {}),
99
+ ...(rolloutNotes ? { rolloutNotes } : {}),
100
+ ...(validationRefs.length > 0 ? { validationRefs } : {}),
101
+ };
102
+ }
103
+ export function buildSkillCandidateLatestReview(params) {
104
+ return {
105
+ action: normalizeSkillCandidateAction(params.action) ?? params.action,
106
+ actor: typeof params.actor === "string" && params.actor.trim() ? params.actor.trim() : null,
107
+ notes: typeof params.notes === "string" && params.notes.trim() ? params.notes.trim() : null,
108
+ payload: coerceSkillCandidateJsonObject(params.payload),
109
+ createdAt: typeof params.createdAt === "string" && params.createdAt.trim()
110
+ ? params.createdAt.trim()
111
+ : new Date().toISOString(),
112
+ };
113
+ }
114
+ export function buildSkillCandidateEffectivenessSummary(params) {
115
+ const sampleCount = Math.max(0, Math.floor(params.sampleCount ?? 0));
116
+ const successCount = Math.max(0, Math.floor(params.successCount ?? 0));
117
+ const failureCount = Math.max(0, Math.floor(params.failureCount ?? Math.max(sampleCount - successCount, 0)));
118
+ const regressionCount = Math.max(0, Math.floor(params.regressionCount ?? 0));
119
+ const successRate = sampleCount > 0 ? successCount / sampleCount : 0;
120
+ const regressionRate = sampleCount > 0 ? regressionCount / sampleCount : 0;
121
+ const score = typeof params.score === "number" && Number.isFinite(params.score)
122
+ ? params.score
123
+ : Number((successRate - regressionRate).toFixed(4));
124
+ return normalizeSkillCandidateEffectiveness({
125
+ phase: normalizeSkillCandidateEffectivenessPhase(params.phase) ?? params.phase,
126
+ sampleCount,
127
+ successCount,
128
+ failureCount,
129
+ regressionCount,
130
+ successRate,
131
+ regressionRate,
132
+ avgLatencyMs: params.avgLatencyMs,
133
+ avgCostUsd: params.avgCostUsd,
134
+ score,
135
+ staleReason: params.staleReason,
136
+ notes: params.notes,
137
+ summary: coerceSkillCandidateJsonObject(params.summary),
138
+ lastObservedAt: params.lastObservedAt ?? new Date().toISOString(),
139
+ updatedAt: params.updatedAt ?? new Date().toISOString(),
140
+ });
141
+ }
142
+ //# sourceMappingURL=skill-candidate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-candidate.js","sourceRoot":"","sources":["../../src/orchestration/skill-candidate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,+BAA+B,EAC/B,oCAAoC,EACpC,yCAAyC,EACzC,sCAAsC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 /**
2
+ * Skill consolidation strategy — pure decision logic for
3
+ * the Autonomous Curator's LLM-driven skill merging phase.
4
+ *
5
+ * This module:
6
+ * 1. Detects prefix clusters among skill names.
7
+ * 2. Builds the consolidation prompt for the LLM review agent.
8
+ * 3. Parses structured LLM output into actionable merge/prune plans.
9
+ * 4. Reconciles LLM intent against ground truth (existing skills).
10
+ *
11
+ * No I/O — the caller invokes the LLM and applies the results.
12
+ */
13
+ /** A skill summary fed to the LLM reviewer. */
14
+ export interface ConsolidationSkillSummary {
15
+ name: string;
16
+ description: string;
17
+ /** Comma-separated tool names the skill uses. */
18
+ tools: string;
19
+ useCount: number;
20
+ lastActivityAt: string | null;
21
+ state: "active" | "stale";
22
+ }
23
+ /** A single consolidation action proposed by the LLM. */
24
+ export interface ConsolidationAction {
25
+ /** Source skill to be absorbed. */
26
+ sourceSkill: string;
27
+ /** Target umbrella skill (existing or to-be-created). */
28
+ targetUmbrella: string;
29
+ /** Whether the target umbrella already exists. */
30
+ targetExists: boolean;
31
+ /** LLM's reason for the merge. */
32
+ reason: string;
33
+ }
34
+ /** A single pruning action proposed by the LLM. */
35
+ export interface PruningAction {
36
+ /** Skill to be archived (not deleted). */
37
+ skillName: string;
38
+ /** Reason for pruning. */
39
+ reason: string;
40
+ }
41
+ /** Full consolidation plan produced by parsing LLM output. */
42
+ export interface ConsolidationPlan {
43
+ consolidations: ConsolidationAction[];
44
+ prunings: PruningAction[];
45
+ /** Skills mentioned by LLM but not found in ground truth. */
46
+ hallucinations: string[];
47
+ }
48
+ /** Result of reconciling the LLM plan against ground truth. */
49
+ export interface ReconciledConsolidationPlan {
50
+ /** Validated consolidation actions (targets exist or are marked for creation). */
51
+ validConsolidations: ConsolidationAction[];
52
+ /** Validated pruning actions (skills exist). */
53
+ validPrunings: PruningAction[];
54
+ /** Rejected actions due to ground-truth mismatch. */
55
+ rejected: Array<{
56
+ action: string;
57
+ reason: string;
58
+ }>;
59
+ }
60
+ /** A detected cluster of skills sharing a naming prefix. */
61
+ export interface SkillPrefixCluster {
62
+ prefix: string;
63
+ skills: string[];
64
+ }
65
+ /**
66
+ * Detect prefix clusters among skill names.
67
+ *
68
+ * A cluster is ≥2 skills sharing a common hyphenated prefix of ≥2 chars.
69
+ * E.g. `["pr-review", "pr-merge", "pr-label"]` → cluster `"pr"`.
70
+ */
71
+ export declare function detectPrefixClusters(skillNames: readonly string[], minClusterSize?: number): SkillPrefixCluster[];
72
+ /**
73
+ * Build the consolidation review prompt for the LLM curator agent.
74
+ *
75
+ * The prompt instructs the model to:
76
+ * 1. Identify prefix clusters and overlapping skills.
77
+ * 2. Propose umbrella consolidations.
78
+ * 3. Mark redundant/trivial skills for pruning (archive, not delete).
79
+ * 4. Output a structured YAML block.
80
+ */
81
+ export declare function buildConsolidationPrompt(candidates: readonly ConsolidationSkillSummary[], existingUmbrellas: readonly string[], clusters: readonly SkillPrefixCluster[]): string;
82
+ /**
83
+ * Parse the LLM's structured YAML response into a ConsolidationPlan.
84
+ *
85
+ * Tolerant: handles minor formatting variations, ignores unknown fields.
86
+ */
87
+ export declare function parseConsolidationOutput(llmOutput: string, knownSkills: ReadonlySet<string>): ConsolidationPlan;
88
+ /**
89
+ * Reconcile the LLM's consolidation plan against ground truth.
90
+ *
91
+ * Validates that:
92
+ * - Source skills exist and aren't already consolidated in this plan.
93
+ * - Target umbrellas either exist or are new (will be created).
94
+ * - Pruning targets aren't also being consolidated.
95
+ */
96
+ export declare function reconcileConsolidationPlan(plan: ConsolidationPlan, knownSkills: ReadonlySet<string>): ReconciledConsolidationPlan;
97
+ /** Summary of a curator review run. */
98
+ export interface CuratorRunReport {
99
+ /** ISO-8601 timestamp of the run. */
100
+ runAt: string;
101
+ /** Duration in seconds. */
102
+ durationSeconds: number;
103
+ /** Number of skills checked for lifecycle transitions. */
104
+ autoTransitionsChecked: number;
105
+ /** Number of skills marked stale. */
106
+ autoMarkedStale: number;
107
+ /** Number of skills archived. */
108
+ autoArchived: number;
109
+ /** Number of skills reactivated. */
110
+ autoReactivated: number;
111
+ /** Number of LLM-proposed consolidations accepted. */
112
+ consolidationsAccepted: number;
113
+ /** Number of LLM-proposed prunings accepted. */
114
+ pruningsAccepted: number;
115
+ /** Number of LLM-proposed actions rejected. */
116
+ actionsRejected: number;
117
+ /** Number of hallucinated skill names. */
118
+ hallucinations: number;
119
+ }
120
+ /**
121
+ * Build a human-readable summary from a curator run report.
122
+ */
123
+ export declare function buildCuratorRunSummary(report: CuratorRunReport): string;
124
+ //# sourceMappingURL=skill-consolidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-consolidation.d.ts","sourceRoot":"","sources":["../../src/orchestration/skill-consolidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,+CAA+C;AAC/C,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC3B;AAED,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,YAAY,EAAE,OAAO,CAAC;IACtB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,mDAAmD;AACnD,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,8DAA8D;AAC9D,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,mBAAmB,EAAE,CAAC;IACtC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,6DAA6D;IAC7D,cAAc,EAA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,MAAM,CAAC;IACrB,oCAAoC;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,sDAAsD;IACtD,sBAAsB,EAAE,MAAM,CAAC;IAC/B,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,CAAC;IACzB,+CAA+C;IAC/C,eAAe,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAMvE"}
@@ -0,0 +1,221 @@
1
+ /**
2
+ * Skill consolidation strategy — pure decision logic for
3
+ * the Autonomous Curator's LLM-driven skill merging phase.
4
+ *
5
+ * This module:
6
+ * 1. Detects prefix clusters among skill names.
7
+ * 2. Builds the consolidation prompt for the LLM review agent.
8
+ * 3. Parses structured LLM output into actionable merge/prune plans.
9
+ * 4. Reconciles LLM intent against ground truth (existing skills).
10
+ *
11
+ * No I/O — the caller invokes the LLM and applies the results.
12
+ */
13
+ /**
14
+ * Detect prefix clusters among skill names.
15
+ *
16
+ * A cluster is ≥2 skills sharing a common hyphenated prefix of ≥2 chars.
17
+ * E.g. `["pr-review", "pr-merge", "pr-label"]` → cluster `"pr"`.
18
+ */
19
+ export function detectPrefixClusters(skillNames, minClusterSize = 2) {
20
+ const prefixMap = new Map();
21
+ for (const name of skillNames) {
22
+ const dashIdx = name.indexOf("-");
23
+ if (dashIdx < 2)
24
+ continue;
25
+ const prefix = name.slice(0, dashIdx);
26
+ const existing = prefixMap.get(prefix);
27
+ if (existing) {
28
+ existing.push(name);
29
+ }
30
+ else {
31
+ prefixMap.set(prefix, [name]);
32
+ }
33
+ }
34
+ const clusters = [];
35
+ for (const [prefix, skills] of prefixMap) {
36
+ if (skills.length >= minClusterSize) {
37
+ clusters.push({ prefix, skills: skills.sort() });
38
+ }
39
+ }
40
+ return clusters.sort((a, b) => b.skills.length - a.skills.length);
41
+ }
42
+ // ── LLM prompt construction ────────────────────────────────────────
43
+ /**
44
+ * Build the consolidation review prompt for the LLM curator agent.
45
+ *
46
+ * The prompt instructs the model to:
47
+ * 1. Identify prefix clusters and overlapping skills.
48
+ * 2. Propose umbrella consolidations.
49
+ * 3. Mark redundant/trivial skills for pruning (archive, not delete).
50
+ * 4. Output a structured YAML block.
51
+ */
52
+ export function buildConsolidationPrompt(candidates, existingUmbrellas, clusters) {
53
+ const candidateList = candidates.map((c) => `- **${c.name}** (${c.state}, uses: ${c.useCount}, tools: ${c.tools})${c.lastActivityAt ? ` last active: ${c.lastActivityAt}` : ""}`).join("\n");
54
+ const umbrellaList = existingUmbrellas.length > 0
55
+ ? existingUmbrellas.map((u) => `- ${u}`).join("\n")
56
+ : "(none)";
57
+ const clusterList = clusters.length > 0
58
+ ? clusters.map((c) => `- **${c.prefix}-***: ${c.skills.join(", ")}`).join("\n")
59
+ : "(no clusters detected)";
60
+ return `You are the Autonomous Curator for a skill library.
61
+
62
+ ## Goal
63
+
64
+ Transform narrow, session-specific skills into a well-organized library of
65
+ class-level umbrella skills. A collection of hundreds of narrow skills is FAILURE.
66
+
67
+ ## Ground Rules
68
+
69
+ 1. **NEVER delete** — only archive (prune). Archived skills can be restored.
70
+ 2. **Do NOT touch pinned or bundled skills** — they are already filtered out.
71
+ 3. **Identify prefix clusters** and merge them into umbrella skills.
72
+ 4. **Move session-specific details** into the umbrella's references/ folder.
73
+ 5. **Preserve unique value** — only merge if the source is genuinely redundant
74
+ or a subset of the target.
75
+
76
+ ## Detected Prefix Clusters
77
+
78
+ ${clusterList}
79
+
80
+ ## Existing Umbrella Skills
81
+
82
+ ${umbrellaList}
83
+
84
+ ## Candidate Skills for Review
85
+
86
+ ${candidateList}
87
+
88
+ ## Required Output Format
89
+
90
+ Respond with EXACTLY this YAML block (no extra text outside the block):
91
+
92
+ \`\`\`yaml
93
+ consolidations:
94
+ - source: "skill-name-a"
95
+ target: "umbrella-skill"
96
+ reason: "subset of umbrella functionality"
97
+ - source: "skill-name-b"
98
+ target: "new-umbrella-name"
99
+ reason: "cluster merge"
100
+
101
+ prunings:
102
+ - skill: "skill-name-c"
103
+ reason: "trivial single-use, no ongoing value"
104
+ \`\`\`
105
+
106
+ If no consolidations or prunings are warranted, use empty lists.
107
+ Respond ONLY with the YAML block.`;
108
+ }
109
+ // ── LLM output parsing ─────────────────────────────────────────────
110
+ /**
111
+ * Parse the LLM's structured YAML response into a ConsolidationPlan.
112
+ *
113
+ * Tolerant: handles minor formatting variations, ignores unknown fields.
114
+ */
115
+ export function parseConsolidationOutput(llmOutput, knownSkills) {
116
+ const consolidations = [];
117
+ const prunings = [];
118
+ const hallucinations = [];
119
+ // Extract YAML block if wrapped in ```yaml ... ```
120
+ const yamlMatch = llmOutput.match(/```(?:yaml)?\s*\n([\s\S]*?)```/);
121
+ const yaml = yamlMatch ? yamlMatch[1] : llmOutput;
122
+ // Parse consolidations
123
+ const consolidationBlock = yaml.match(/consolidations:\s*\n((?:\s+-[\s\S]*?)?)(?=prunings:|$)/);
124
+ if (consolidationBlock?.[1]) {
125
+ const entries = consolidationBlock[1].matchAll(/- source:\s*"([^"]+)"\s*\n\s*target:\s*"([^"]+)"\s*\n\s*reason:\s*"([^"]+)"/g);
126
+ for (const [, source, target, reason] of entries) {
127
+ if (!knownSkills.has(source)) {
128
+ hallucinations.push(source);
129
+ continue;
130
+ }
131
+ consolidations.push({
132
+ sourceSkill: source,
133
+ targetUmbrella: target,
134
+ targetExists: knownSkills.has(target),
135
+ reason,
136
+ });
137
+ }
138
+ }
139
+ // Parse prunings
140
+ const pruningBlock = yaml.match(/prunings:\s*\n([\s\S]*?)$/);
141
+ if (pruningBlock?.[1]) {
142
+ const entries = pruningBlock[1].matchAll(/- skill:\s*"([^"]+)"\s*\n\s*reason:\s*"([^"]+)"/g);
143
+ for (const [, skill, reason] of entries) {
144
+ if (!knownSkills.has(skill)) {
145
+ hallucinations.push(skill);
146
+ continue;
147
+ }
148
+ prunings.push({ skillName: skill, reason });
149
+ }
150
+ }
151
+ return { consolidations, prunings, hallucinations };
152
+ }
153
+ // ── Reconciliation ─────────────────────────────────────────────────
154
+ /**
155
+ * Reconcile the LLM's consolidation plan against ground truth.
156
+ *
157
+ * Validates that:
158
+ * - Source skills exist and aren't already consolidated in this plan.
159
+ * - Target umbrellas either exist or are new (will be created).
160
+ * - Pruning targets aren't also being consolidated.
161
+ */
162
+ export function reconcileConsolidationPlan(plan, knownSkills) {
163
+ const validConsolidations = [];
164
+ const validPrunings = [];
165
+ const rejected = [];
166
+ const consolidatedSources = new Set();
167
+ for (const c of plan.consolidations) {
168
+ if (!knownSkills.has(c.sourceSkill)) {
169
+ rejected.push({
170
+ action: `consolidate ${c.sourceSkill} → ${c.targetUmbrella}`,
171
+ reason: `source skill "${c.sourceSkill}" not found`,
172
+ });
173
+ continue;
174
+ }
175
+ if (consolidatedSources.has(c.sourceSkill)) {
176
+ rejected.push({
177
+ action: `consolidate ${c.sourceSkill} → ${c.targetUmbrella}`,
178
+ reason: `source skill "${c.sourceSkill}" already consolidated in this plan`,
179
+ });
180
+ continue;
181
+ }
182
+ if (c.sourceSkill === c.targetUmbrella) {
183
+ rejected.push({
184
+ action: `consolidate ${c.sourceSkill} → ${c.targetUmbrella}`,
185
+ reason: "source and target are the same skill",
186
+ });
187
+ continue;
188
+ }
189
+ consolidatedSources.add(c.sourceSkill);
190
+ validConsolidations.push(c);
191
+ }
192
+ for (const p of plan.prunings) {
193
+ if (!knownSkills.has(p.skillName)) {
194
+ rejected.push({
195
+ action: `prune ${p.skillName}`,
196
+ reason: `skill "${p.skillName}" not found`,
197
+ });
198
+ continue;
199
+ }
200
+ if (consolidatedSources.has(p.skillName)) {
201
+ rejected.push({
202
+ action: `prune ${p.skillName}`,
203
+ reason: `skill "${p.skillName}" is being consolidated, not pruned`,
204
+ });
205
+ continue;
206
+ }
207
+ validPrunings.push(p);
208
+ }
209
+ return { validConsolidations, validPrunings, rejected };
210
+ }
211
+ /**
212
+ * Build a human-readable summary from a curator run report.
213
+ */
214
+ export function buildCuratorRunSummary(report) {
215
+ const parts = [];
216
+ parts.push(`Curator run at ${report.runAt} (${report.durationSeconds.toFixed(1)}s)`);
217
+ parts.push(`Auto: ${report.autoTransitionsChecked} checked, ${report.autoMarkedStale} stale, ${report.autoArchived} archived, ${report.autoReactivated} reactivated`);
218
+ parts.push(`LLM: ${report.consolidationsAccepted} consolidated, ${report.pruningsAccepted} pruned, ${report.actionsRejected} rejected, ${report.hallucinations} hallucinated`);
219
+ return parts.join("; ");
220
+ }
221
+ //# sourceMappingURL=skill-consolidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-consolidation.js","sourceRoot":"","sources":["../../src/orchestration/skill-consolidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA6DH;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAA6B,EAC7B,cAAc,GAAG,CAAC;IAElB,MAAM,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;IAE9C,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,OAAO,GAAG,CAAC;YAAE,SAAS;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAyB,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;QACzC,IAAI,MAAM,CAAC,MA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AE,QAAQ,EAAE,CAAC;AAC1D,CAAC;AA4BD;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAwB;IAC7D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,kBAAkB,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACrF,KAAK,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,sBAAsB,aAAa,MAAM,CAAC,eAAe,WAAW,MAAM,CAAC,YAAY,cAAc,MAAM,CAAC,eAAe,cAAc,CAAC,CAAC;IACtK,KAAK,CAAC,IAAI,CAAC,QAAQ,MAAM,CAAC,sBAAsB,kBAAkB,MAAM,CAAC,gBAAgB,YAAY,MAAM,CAAC,eAAe,cAAc,MAAM,CAAC,cAAc,eAAe,CAAC,CAAC;IAC/K,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Skill self-learning: decides whether a completed turn should
3
+ * trigger skill creation or improvement instructions.
4
+ */
5
+ export interface SkillTurnResult {
6
+ ok: boolean;
7
+ /** Number of tool invocations in this turn */
8
+ toolCallCount: number;
9
+ /** Number of distinct tool names used */
10
+ distinctToolCount: number;
11
+ /** Was a multi-step orchestration (≥2 rounds) used? */
12
+ multiStep: boolean;
13
+ /** Did the turn involve a sidechain? */
14
+ hasSidechain: boolean;
15
+ /** Optional user feedback signal (positive/negative/none) */
16
+ feedback?: "positive" | "negative" | null;
17
+ /** Skill name if an existing skill was used */
18
+ existingSkillName?: string | null;
19
+ }
20
+ export interface SkillCreateInstruction {
21
+ type: "skill.create";
22
+ /** Suggested skill name derived from tool usage pattern */
23
+ suggestedName: string;
24
+ /** Short description of what the skill does */
25
+ description: string;
26
+ /** Tool names involved */
27
+ tools: string[];
28
+ /** Number of orchestration steps */
29
+ stepCount: number;
30
+ }
31
+ export interface SkillImproveInstruction {
32
+ type: "skill.improve";
33
+ /** Existing skill to improve */
34
+ skillName: string;
35
+ /** Reason for improvement */
36
+ reason: string;
37
+ }
38
+ export type SkillInstruction = SkillCreateInstruction | SkillImproveInstruction;
39
+ /**
40
+ * Determine whether a completed turn should produce a skill instruction.
41
+ *
42
+ * A new skill is suggested when:
43
+ * - The turn succeeded
44
+ * - It involved multi-step orchestration
45
+ * - It used ≥3 tool calls across ≥2 distinct tools
46
+ * - No existing skill was already applied
47
+ *
48
+ * An improvement is suggested when:
49
+ * - The turn used an existing skill but got negative feedback
50
+ */
51
+ export declare function shouldCreateSkill(result: SkillTurnResult): boolean;
52
+ export declare function shouldImproveSkill(result: SkillTurnResult): boolean;
53
+ /**
54
+ * Build a skill instruction from a turn result, or null if none is warranted.
55
+ */
56
+ export declare function buildSkillInstruction(result: SkillTurnResult, context: {
57
+ tools: string[];
58
+ suggestedName?: string;
59
+ }): SkillInstruction | null;
60
+ //# sourceMappingURL=skill-improvement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-improvement.d.ts","sourceRoot":"","sources":["../../src/orchestration/skill-improvement.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAC;IACnB,wCAAwC;IACxC,YAAY,EAAE,OAAO,CAAC;IACtB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,CAAC;IAC1C,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAID,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,cAAc,CAAC;IACrB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,eAAe,CAAC;IACtB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,GAAG,uBAAuB,CAAC;AAehF;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAOlE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAGnE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD,gBAAgB,GAAG,IAAI,CAoBzB"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Skill self-learning: decides whether a completed turn should
3
+ * trigger skill creation or improvement instructions.
4
+ */
5
+ // ── Decision logic ─────────────────────────────────────────────────
6
+ /**
7
+ * Minimum tool call count to consider a turn "complex enough"
8
+ * to warrant creating a reusable skill.
9
+ */
10
+ const MIN_TOOL_CALLS_FOR_SKILL = 3;
11
+ /**
12
+ * Minimum distinct tools to suggest a new skill.
13
+ */
14
+ const MIN_DISTINCT_TOOLS_FOR_SKILL = 2;
15
+ /**
16
+ * Determine whether a completed turn should produce a skill instruction.
17
+ *
18
+ * A new skill is suggested when:
19
+ * - The turn succeeded
20
+ * - It involved multi-step orchestration
21
+ * - It used ≥3 tool calls across ≥2 distinct tools
22
+ * - No existing skill was already applied
23
+ *
24
+ * An improvement is suggested when:
25
+ * - The turn used an existing skill but got negative feedback
26
+ */
27
+ export function shouldCreateSkill(result) {
28
+ if (!result.ok)
29
+ return false;
30
+ if (result.existingSkillName)
31
+ return false;
32
+ if (!result.multiStep)
33
+ return false;
34
+ if (result.toolCallCount < MIN_TOOL_CALLS_FOR_SKILL)
35
+ return false;
36
+ if (result.distinctToolCount < MIN_DISTINCT_TOOLS_FOR_SKILL)
37
+ return false;
38
+ return true;
39
+ }
40
+ export function shouldImproveSkill(result) {
41
+ if (!result.existingSkillName)
42
+ return false;
43
+ return result.feedback === "negative";
44
+ }
45
+ /**
46
+ * Build a skill instruction from a turn result, or null if none is warranted.
47
+ */
48
+ export function buildSkillInstruction(result, context) {
49
+ if (shouldImproveSkill(result)) {
50
+ return {
51
+ type: "skill.improve",
52
+ skillName: result.existingSkillName,
53
+ reason: "negative user feedback on existing skill execution",
54
+ };
55
+ }
56
+ if (shouldCreateSkill(result)) {
57
+ return {
58
+ type: "skill.create",
59
+ suggestedName: context.suggestedName ?? `auto-skill-${context.tools.slice(0, 3).join("-")}`,
60
+ description: `Multi-step orchestration using ${context.tools.join(", ")}`,
61
+ tools: context.tools,
62
+ stepCount: result.toolCallCount,
63
+ };
64
+ }
65
+ return null;
66
+ }
67
+ //# sourceMappingURL=skill-improvement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-improvement.js","sourceRoot":"","sources":["../../src/orchestration/skill-improvement.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4CH,sEAAsE;AAEtE;;;GAGG;AACH,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAEnC;;GAEG;AACH,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAuB;IACvD,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,KAAK,CAAC;IAC7B,IAAI,MAAM,CAAC,iBAAiB;QAAE,OAAO,KAAK,CAAC;IAC3C,IAAI,CAAC,MAAM,CAAC,SAAS;QAAE,OAAO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