@od-oneapp/ai-platform 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 (872) hide show
  1. package/README.md +235 -0
  2. package/dist/agents-base.d.mts +12 -0
  3. package/dist/agents-base.d.mts.map +1 -0
  4. package/dist/agents-base.mjs +20 -0
  5. package/dist/agents-base.mjs.map +1 -0
  6. package/dist/agents-control-flow.d.mts +115 -0
  7. package/dist/agents-control-flow.d.mts.map +1 -0
  8. package/dist/agents-control-flow.mjs +514 -0
  9. package/dist/agents-control-flow.mjs.map +1 -0
  10. package/dist/agents-coordinator.d.mts +11 -0
  11. package/dist/agents-coordinator.d.mts.map +1 -0
  12. package/dist/agents-coordinator.mjs +12 -0
  13. package/dist/agents-coordinator.mjs.map +1 -0
  14. package/dist/agents-experimental.d.mts +153 -0
  15. package/dist/agents-experimental.d.mts.map +1 -0
  16. package/dist/agents-experimental.mjs +580 -0
  17. package/dist/agents-experimental.mjs.map +1 -0
  18. package/dist/agents-fallback.d.mts +10 -0
  19. package/dist/agents-fallback.d.mts.map +1 -0
  20. package/dist/agents-fallback.mjs +15 -0
  21. package/dist/agents-fallback.mjs.map +1 -0
  22. package/dist/agents-multi-swarm.d.mts +9 -0
  23. package/dist/agents-multi-swarm.d.mts.map +1 -0
  24. package/dist/agents-multi-swarm.mjs +44 -0
  25. package/dist/agents-multi-swarm.mjs.map +1 -0
  26. package/dist/agents-multi.d.mts +10 -0
  27. package/dist/agents-multi.d.mts.map +1 -0
  28. package/dist/agents-multi.mjs +44 -0
  29. package/dist/agents-multi.mjs.map +1 -0
  30. package/dist/agents-observability.d.mts +161 -0
  31. package/dist/agents-observability.d.mts.map +1 -0
  32. package/dist/agents-observability.mjs +550 -0
  33. package/dist/agents-observability.mjs.map +1 -0
  34. package/dist/agents-patterns.d.mts +9 -0
  35. package/dist/agents-patterns.d.mts.map +1 -0
  36. package/dist/agents-patterns.mjs +18 -0
  37. package/dist/agents-patterns.mjs.map +1 -0
  38. package/dist/agents-persistence.d.mts +234 -0
  39. package/dist/agents-persistence.d.mts.map +1 -0
  40. package/dist/agents-persistence.mjs +447 -0
  41. package/dist/agents-persistence.mjs.map +1 -0
  42. package/dist/agents-triage.d.mts +11 -0
  43. package/dist/agents-triage.d.mts.map +1 -0
  44. package/dist/agents-triage.mjs +13 -0
  45. package/dist/agents-triage.mjs.map +1 -0
  46. package/dist/agents-workflows.d.mts +9 -0
  47. package/dist/agents-workflows.d.mts.map +1 -0
  48. package/dist/agents-workflows.mjs +9 -0
  49. package/dist/agents-workflows.mjs.map +1 -0
  50. package/dist/agents.d.mts +30 -0
  51. package/dist/agents.d.mts.map +1 -0
  52. package/dist/agents.mjs +50 -0
  53. package/dist/agents.mjs.map +1 -0
  54. package/dist/aggregation-8KJF1uzp.d.mts +276 -0
  55. package/dist/aggregation-8KJF1uzp.d.mts.map +1 -0
  56. package/dist/aggregation-BDop87kL.mjs +1180 -0
  57. package/dist/aggregation-BDop87kL.mjs.map +1 -0
  58. package/dist/ai-runtime-CDzQztTt.mjs +85 -0
  59. package/dist/ai-runtime-CDzQztTt.mjs.map +1 -0
  60. package/dist/ai-runtime-DIwOEc6g.d.mts +56 -0
  61. package/dist/ai-runtime-DIwOEc6g.d.mts.map +1 -0
  62. package/dist/ai-sdk-error-integration-D0GDqrM0.d.mts +553 -0
  63. package/dist/ai-sdk-error-integration-D0GDqrM0.d.mts.map +1 -0
  64. package/dist/approval-queue-BcDDQ4oQ.mjs +104 -0
  65. package/dist/approval-queue-BcDDQ4oQ.mjs.map +1 -0
  66. package/dist/approval-queue-CiKiFT9z.d.mts +21 -0
  67. package/dist/approval-queue-CiKiFT9z.d.mts.map +1 -0
  68. package/dist/audio-BzvN7r10.d.mts +79 -0
  69. package/dist/audio-BzvN7r10.d.mts.map +1 -0
  70. package/dist/audio-vBG_62ME.mjs +226 -0
  71. package/dist/audio-vBG_62ME.mjs.map +1 -0
  72. package/dist/audit-logger-Bb2JIcIk.d.mts +12 -0
  73. package/dist/audit-logger-Bb2JIcIk.d.mts.map +1 -0
  74. package/dist/audit-logger-CHIP8bRO.mjs +596 -0
  75. package/dist/audit-logger-CHIP8bRO.mjs.map +1 -0
  76. package/dist/auto-resume-BpUNbPtp.d.mts +160 -0
  77. package/dist/auto-resume-BpUNbPtp.d.mts.map +1 -0
  78. package/dist/auto-resume-BuFRNvAX.mjs +638 -0
  79. package/dist/auto-resume-BuFRNvAX.mjs.map +1 -0
  80. package/dist/budget-guard-C83KCH9V.d.mts +52 -0
  81. package/dist/budget-guard-C83KCH9V.d.mts.map +1 -0
  82. package/dist/budget-guard-d_b5rq4u.mjs +158 -0
  83. package/dist/budget-guard-d_b5rq4u.mjs.map +1 -0
  84. package/dist/budget-guard-gyhJS00s.mjs +234 -0
  85. package/dist/budget-guard-gyhJS00s.mjs.map +1 -0
  86. package/dist/buffer-BC8mvXHE.d.mts +98 -0
  87. package/dist/buffer-BC8mvXHE.d.mts.map +1 -0
  88. package/dist/buffer-CefJGbRy.mjs +289 -0
  89. package/dist/buffer-CefJGbRy.mjs.map +1 -0
  90. package/dist/caching-adapters.d.mts +5 -0
  91. package/dist/caching-adapters.mjs +3 -0
  92. package/dist/caching-strategies.d.mts +52 -0
  93. package/dist/caching-strategies.d.mts.map +1 -0
  94. package/dist/caching-strategies.mjs +703 -0
  95. package/dist/caching-strategies.mjs.map +1 -0
  96. package/dist/caching.d.mts +14 -0
  97. package/dist/caching.d.mts.map +1 -0
  98. package/dist/caching.mjs +15 -0
  99. package/dist/caching.mjs.map +1 -0
  100. package/dist/catalog.d.mts +19 -0
  101. package/dist/catalog.d.mts.map +1 -0
  102. package/dist/catalog.mjs +1114 -0
  103. package/dist/catalog.mjs.map +1 -0
  104. package/dist/chunk-CkzbjWQW.mjs +20 -0
  105. package/dist/circuit-breaker-DoKWPORd.mjs +262 -0
  106. package/dist/circuit-breaker-DoKWPORd.mjs.map +1 -0
  107. package/dist/circuit-breaker-Mey3E7tW.d.mts +64 -0
  108. package/dist/circuit-breaker-Mey3E7tW.d.mts.map +1 -0
  109. package/dist/citation-generator-C-9RpbHq.mjs +103 -0
  110. package/dist/citation-generator-C-9RpbHq.mjs.map +1 -0
  111. package/dist/citation-generator-CDSymDs_.d.mts +18 -0
  112. package/dist/citation-generator-CDSymDs_.d.mts.map +1 -0
  113. package/dist/client-CpacYDIE.mjs +882 -0
  114. package/dist/client-CpacYDIE.mjs.map +1 -0
  115. package/dist/client.d.mts +103 -0
  116. package/dist/client.d.mts.map +1 -0
  117. package/dist/client.mjs +470 -0
  118. package/dist/client.mjs.map +1 -0
  119. package/dist/compliance-approval-queue-DQGLojAm.mjs +172 -0
  120. package/dist/compliance-approval-queue-DQGLojAm.mjs.map +1 -0
  121. package/dist/compliance-approval-queue-IrMxFfSJ.d.mts +99 -0
  122. package/dist/compliance-approval-queue-IrMxFfSJ.d.mts.map +1 -0
  123. package/dist/compliance-wrapper-CrOMHhHN.mjs +528 -0
  124. package/dist/compliance-wrapper-CrOMHhHN.mjs.map +1 -0
  125. package/dist/conditions-DmQ6Y1Wt.mjs +179 -0
  126. package/dist/conditions-DmQ6Y1Wt.mjs.map +1 -0
  127. package/dist/conditions-zDrKfrc3.d.mts +42 -0
  128. package/dist/conditions-zDrKfrc3.d.mts.map +1 -0
  129. package/dist/console-BGMxxPZN.mjs +181 -0
  130. package/dist/console-BGMxxPZN.mjs.map +1 -0
  131. package/dist/console-DqEqZd4A.d.mts +76 -0
  132. package/dist/console-DqEqZd4A.d.mts.map +1 -0
  133. package/dist/controller-BOy3-xbC.mjs +501 -0
  134. package/dist/controller-BOy3-xbC.mjs.map +1 -0
  135. package/dist/controller-Y0NGosbJ.d.mts +104 -0
  136. package/dist/controller-Y0NGosbJ.d.mts.map +1 -0
  137. package/dist/coordinator-agent-BglqZLwo.d.mts +54 -0
  138. package/dist/coordinator-agent-BglqZLwo.d.mts.map +1 -0
  139. package/dist/coordinator-agent-WFWBRL-G.mjs +236 -0
  140. package/dist/coordinator-agent-WFWBRL-G.mjs.map +1 -0
  141. package/dist/crypto-8ABhc3TD.mjs +40 -0
  142. package/dist/crypto-8ABhc3TD.mjs.map +1 -0
  143. package/dist/environment-CSoJb0SW.mjs +255 -0
  144. package/dist/environment-CSoJb0SW.mjs.map +1 -0
  145. package/dist/error-handling-DNVkm6RY.mjs +1334 -0
  146. package/dist/error-handling-DNVkm6RY.mjs.map +1 -0
  147. package/dist/errors-CQ8tF4dP.mjs +985 -0
  148. package/dist/errors-CQ8tF4dP.mjs.map +1 -0
  149. package/dist/errors-CfYdVeum.d.mts +212 -0
  150. package/dist/errors-CfYdVeum.d.mts.map +1 -0
  151. package/dist/errors-Dtn-UeRi.mjs +61 -0
  152. package/dist/errors-Dtn-UeRi.mjs.map +1 -0
  153. package/dist/evaluator-Cs84qkr8.mjs +91 -0
  154. package/dist/evaluator-Cs84qkr8.mjs.map +1 -0
  155. package/dist/evaluator-optimizer-De67_mJC.mjs +1086 -0
  156. package/dist/evaluator-optimizer-De67_mJC.mjs.map +1 -0
  157. package/dist/evaluator-optimizer-pattern-B5939s2Z.mjs +367 -0
  158. package/dist/evaluator-optimizer-pattern-B5939s2Z.mjs.map +1 -0
  159. package/dist/evaluator-optimizer-pattern-D1AJrzBD.d.mts +72 -0
  160. package/dist/evaluator-optimizer-pattern-D1AJrzBD.d.mts.map +1 -0
  161. package/dist/factory-DP6VSl8C.mjs +307 -0
  162. package/dist/factory-DP6VSl8C.mjs.map +1 -0
  163. package/dist/generative-ui-catalog.d.mts +8 -0
  164. package/dist/generative-ui-catalog.d.mts.map +1 -0
  165. package/dist/generative-ui-catalog.mjs +679 -0
  166. package/dist/generative-ui-catalog.mjs.map +1 -0
  167. package/dist/generative-ui-registry.d.mts +195 -0
  168. package/dist/generative-ui-registry.d.mts.map +1 -0
  169. package/dist/generative-ui-registry.mjs +250 -0
  170. package/dist/generative-ui-registry.mjs.map +1 -0
  171. package/dist/generative-ui-stream.d.mts +23 -0
  172. package/dist/generative-ui-stream.d.mts.map +1 -0
  173. package/dist/generative-ui-stream.mjs +219 -0
  174. package/dist/generative-ui-stream.mjs.map +1 -0
  175. package/dist/generative-ui-types.d.mts +123 -0
  176. package/dist/generative-ui-types.d.mts.map +1 -0
  177. package/dist/generative-ui-types.mjs +1 -0
  178. package/dist/generative-ui.d.mts +13 -0
  179. package/dist/generative-ui.d.mts.map +1 -0
  180. package/dist/generative-ui.mjs +21 -0
  181. package/dist/generative-ui.mjs.map +1 -0
  182. package/dist/governance-audit.d.mts +3 -0
  183. package/dist/governance-audit.mjs +3 -0
  184. package/dist/governance-compliance.d.mts +5 -0
  185. package/dist/governance-compliance.mjs +4 -0
  186. package/dist/governance-policies.d.mts +4 -0
  187. package/dist/governance-policies.mjs +4 -0
  188. package/dist/governance-tenancy.d.mts +3 -0
  189. package/dist/governance-tenancy.mjs +3 -0
  190. package/dist/governance.d.mts +88 -0
  191. package/dist/governance.d.mts.map +1 -0
  192. package/dist/governance.mjs +432 -0
  193. package/dist/governance.mjs.map +1 -0
  194. package/dist/grounding-attribution.d.mts +63 -0
  195. package/dist/grounding-attribution.d.mts.map +1 -0
  196. package/dist/grounding-attribution.mjs +259 -0
  197. package/dist/grounding-attribution.mjs.map +1 -0
  198. package/dist/grounding-citation.d.mts +2 -0
  199. package/dist/grounding-citation.mjs +3 -0
  200. package/dist/grounding-context.d.mts +9 -0
  201. package/dist/grounding-context.d.mts.map +1 -0
  202. package/dist/grounding-context.mjs +19 -0
  203. package/dist/grounding-context.mjs.map +1 -0
  204. package/dist/grounding-embed.d.mts +102 -0
  205. package/dist/grounding-embed.d.mts.map +1 -0
  206. package/dist/grounding-embed.mjs +417 -0
  207. package/dist/grounding-embed.mjs.map +1 -0
  208. package/dist/grounding-hallucination.d.mts +44 -0
  209. package/dist/grounding-hallucination.d.mts.map +1 -0
  210. package/dist/grounding-hallucination.mjs +115 -0
  211. package/dist/grounding-hallucination.mjs.map +1 -0
  212. package/dist/grounding-proof-map.d.mts +9 -0
  213. package/dist/grounding-proof-map.d.mts.map +1 -0
  214. package/dist/grounding-proof-map.mjs +26 -0
  215. package/dist/grounding-proof-map.mjs.map +1 -0
  216. package/dist/grounding-rag.d.mts +10 -0
  217. package/dist/grounding-rag.d.mts.map +1 -0
  218. package/dist/grounding-rag.mjs +27 -0
  219. package/dist/grounding-rag.mjs.map +1 -0
  220. package/dist/grounding-verification.d.mts +48 -0
  221. package/dist/grounding-verification.d.mts.map +1 -0
  222. package/dist/grounding-verification.mjs +224 -0
  223. package/dist/grounding-verification.mjs.map +1 -0
  224. package/dist/grounding.d.mts +24 -0
  225. package/dist/grounding.d.mts.map +1 -0
  226. package/dist/grounding.mjs +77 -0
  227. package/dist/grounding.mjs.map +1 -0
  228. package/dist/hitl-active-learning.d.mts +41 -0
  229. package/dist/hitl-active-learning.d.mts.map +1 -0
  230. package/dist/hitl-active-learning.mjs +178 -0
  231. package/dist/hitl-active-learning.mjs.map +1 -0
  232. package/dist/hitl-annotation.d.mts +74 -0
  233. package/dist/hitl-annotation.d.mts.map +1 -0
  234. package/dist/hitl-annotation.mjs +170 -0
  235. package/dist/hitl-annotation.mjs.map +1 -0
  236. package/dist/hitl-approval.d.mts +2 -0
  237. package/dist/hitl-approval.mjs +3 -0
  238. package/dist/hitl-feedback.d.mts +59 -0
  239. package/dist/hitl-feedback.d.mts.map +1 -0
  240. package/dist/hitl-feedback.mjs +137 -0
  241. package/dist/hitl-feedback.mjs.map +1 -0
  242. package/dist/hitl-review.d.mts +2 -0
  243. package/dist/hitl-review.mjs +3 -0
  244. package/dist/hitl.d.mts +14 -0
  245. package/dist/hitl.d.mts.map +1 -0
  246. package/dist/hitl.mjs +22 -0
  247. package/dist/hitl.mjs.map +1 -0
  248. package/dist/index-B17HT-VL.d.mts +285 -0
  249. package/dist/index-B17HT-VL.d.mts.map +1 -0
  250. package/dist/index-BDwgsK9B.d.mts +101 -0
  251. package/dist/index-BDwgsK9B.d.mts.map +1 -0
  252. package/dist/index-BGgMn_Ev.d.mts +2615 -0
  253. package/dist/index-BGgMn_Ev.d.mts.map +1 -0
  254. package/dist/index-DOqe5r9G.d.mts +318 -0
  255. package/dist/index-DOqe5r9G.d.mts.map +1 -0
  256. package/dist/index-DotINT7o.d.mts +1004 -0
  257. package/dist/index-DotINT7o.d.mts.map +1 -0
  258. package/dist/index-URlW7aD1.d.mts +67 -0
  259. package/dist/index-URlW7aD1.d.mts.map +1 -0
  260. package/dist/index.d.mts +64 -0
  261. package/dist/index.d.mts.map +1 -0
  262. package/dist/index.mjs +46 -0
  263. package/dist/index.mjs.map +1 -0
  264. package/dist/integrations-blob-storage.d.mts +25 -0
  265. package/dist/integrations-blob-storage.d.mts.map +1 -0
  266. package/dist/integrations-blob-storage.mjs +3 -0
  267. package/dist/integrations-notifications.d.mts +2 -0
  268. package/dist/integrations-notifications.mjs +3 -0
  269. package/dist/integrations-rate-limit.d.mts +27 -0
  270. package/dist/integrations-rate-limit.d.mts.map +1 -0
  271. package/dist/integrations-rate-limit.mjs +30 -0
  272. package/dist/integrations-rate-limit.mjs.map +1 -0
  273. package/dist/integrations-redis.d.mts +3 -0
  274. package/dist/integrations-redis.mjs +3 -0
  275. package/dist/integrations-stream.d.mts +14 -0
  276. package/dist/integrations-stream.d.mts.map +1 -0
  277. package/dist/integrations-stream.mjs +3 -0
  278. package/dist/integrations.d.mts +7 -0
  279. package/dist/integrations.mjs +7 -0
  280. package/dist/log-adapter-BLegSZtz.d.mts +16 -0
  281. package/dist/log-adapter-BLegSZtz.d.mts.map +1 -0
  282. package/dist/log-adapter-PPe_2Pwv.mjs +28 -0
  283. package/dist/log-adapter-PPe_2Pwv.mjs.map +1 -0
  284. package/dist/loop-BOYEtr2g.mjs +520 -0
  285. package/dist/loop-BOYEtr2g.mjs.map +1 -0
  286. package/dist/loop-C-tBBOqi.d.mts +219 -0
  287. package/dist/loop-C-tBBOqi.d.mts.map +1 -0
  288. package/dist/middleware-5wQ9bANW.mjs +306 -0
  289. package/dist/middleware-5wQ9bANW.mjs.map +1 -0
  290. package/dist/middleware-C1apSrj0.mjs +613 -0
  291. package/dist/middleware-C1apSrj0.mjs.map +1 -0
  292. package/dist/middleware-C7k0uItW.d.mts +9 -0
  293. package/dist/middleware-C7k0uItW.d.mts.map +1 -0
  294. package/dist/middleware-CZQCTHfl.mjs +366 -0
  295. package/dist/middleware-CZQCTHfl.mjs.map +1 -0
  296. package/dist/models.d.mts +11 -0
  297. package/dist/models.d.mts.map +1 -0
  298. package/dist/models.mjs +32 -0
  299. package/dist/models.mjs.map +1 -0
  300. package/dist/observability-analytics.d.mts +107 -0
  301. package/dist/observability-analytics.d.mts.map +1 -0
  302. package/dist/observability-analytics.mjs +409 -0
  303. package/dist/observability-analytics.mjs.map +1 -0
  304. package/dist/observability-cost.d.mts +10 -0
  305. package/dist/observability-cost.d.mts.map +1 -0
  306. package/dist/observability-cost.mjs +15 -0
  307. package/dist/observability-cost.mjs.map +1 -0
  308. package/dist/observability-telemetry.d.mts +111 -0
  309. package/dist/observability-telemetry.d.mts.map +1 -0
  310. package/dist/observability-telemetry.mjs +343 -0
  311. package/dist/observability-telemetry.mjs.map +1 -0
  312. package/dist/observability-tracing.d.mts +10 -0
  313. package/dist/observability-tracing.d.mts.map +1 -0
  314. package/dist/observability-tracing.mjs +17 -0
  315. package/dist/observability-tracing.mjs.map +1 -0
  316. package/dist/observability.d.mts +15 -0
  317. package/dist/observability.d.mts.map +1 -0
  318. package/dist/observability.mjs +17 -0
  319. package/dist/observability.mjs.map +1 -0
  320. package/dist/optimizer-DhXXpci6.mjs +97 -0
  321. package/dist/optimizer-DhXXpci6.mjs.map +1 -0
  322. package/dist/output-multimodal.d.mts +9 -0
  323. package/dist/output-multimodal.d.mts.map +1 -0
  324. package/dist/output-multimodal.mjs +18 -0
  325. package/dist/output-multimodal.mjs.map +1 -0
  326. package/dist/output.d.mts +11 -0
  327. package/dist/output.d.mts.map +1 -0
  328. package/dist/output.mjs +40 -0
  329. package/dist/output.mjs.map +1 -0
  330. package/dist/pii-filter-3AxmYSiu.d.mts +23 -0
  331. package/dist/pii-filter-3AxmYSiu.d.mts.map +1 -0
  332. package/dist/pipelines.d.mts +448 -0
  333. package/dist/pipelines.d.mts.map +1 -0
  334. package/dist/pipelines.mjs +1534 -0
  335. package/dist/pipelines.mjs.map +1 -0
  336. package/dist/prompt-injection-DQXchzsV.d.mts +8 -0
  337. package/dist/prompt-injection-DQXchzsV.d.mts.map +1 -0
  338. package/dist/prompt-injection-RpoLPwSa.mjs +52 -0
  339. package/dist/prompt-injection-RpoLPwSa.mjs.map +1 -0
  340. package/dist/prompts.d.mts +192 -0
  341. package/dist/prompts.d.mts.map +1 -0
  342. package/dist/prompts.mjs +732 -0
  343. package/dist/prompts.mjs.map +1 -0
  344. package/dist/protocol-DfBiEsnl.d.mts +112 -0
  345. package/dist/protocol-DfBiEsnl.d.mts.map +1 -0
  346. package/dist/quota-manager-0iPMkQWN.d.mts +62 -0
  347. package/dist/quota-manager-0iPMkQWN.d.mts.map +1 -0
  348. package/dist/quota-manager-D_N7FuQ2.mjs +180 -0
  349. package/dist/quota-manager-D_N7FuQ2.mjs.map +1 -0
  350. package/dist/redaction-utils-DcQwsiNh.mjs +438 -0
  351. package/dist/redaction-utils-DcQwsiNh.mjs.map +1 -0
  352. package/dist/redis-CpsSrF8K.mjs +102 -0
  353. package/dist/redis-CpsSrF8K.mjs.map +1 -0
  354. package/dist/redis-CwguYFGh.d.mts +33 -0
  355. package/dist/redis-CwguYFGh.d.mts.map +1 -0
  356. package/dist/registry-CsD3iTIx.mjs +190 -0
  357. package/dist/registry-CsD3iTIx.mjs.map +1 -0
  358. package/dist/registry-DVPWzkXR.d.mts +36 -0
  359. package/dist/registry-DVPWzkXR.d.mts.map +1 -0
  360. package/dist/reranking-BpWYhYzl.d.mts +72 -0
  361. package/dist/reranking-BpWYhYzl.d.mts.map +1 -0
  362. package/dist/reranking-Ck8aKZW7.mjs +331 -0
  363. package/dist/reranking-Ck8aKZW7.mjs.map +1 -0
  364. package/dist/resumable-adapter-CO1HtsgJ.mjs +21 -0
  365. package/dist/resumable-adapter-CO1HtsgJ.mjs.map +1 -0
  366. package/dist/review-trigger-DmAsiQlM.d.mts +24 -0
  367. package/dist/review-trigger-DmAsiQlM.d.mts.map +1 -0
  368. package/dist/review-trigger-DwXfpww9.mjs +112 -0
  369. package/dist/review-trigger-DwXfpww9.mjs.map +1 -0
  370. package/dist/safe-context-BynhkTKR.d.mts +54 -0
  371. package/dist/safe-context-BynhkTKR.d.mts.map +1 -0
  372. package/dist/safe-context-C5A3Wv3b.mjs +143 -0
  373. package/dist/safe-context-C5A3Wv3b.mjs.map +1 -0
  374. package/dist/schema-Bu2noOZ4.mjs +27 -0
  375. package/dist/schema-Bu2noOZ4.mjs.map +1 -0
  376. package/dist/schema-CwFvuCnA.mjs +97 -0
  377. package/dist/schema-CwFvuCnA.mjs.map +1 -0
  378. package/dist/schema-Wz-1-ro9.d.mts +37 -0
  379. package/dist/schema-Wz-1-ro9.d.mts.map +1 -0
  380. package/dist/schemas-CxQtxIga.mjs +62 -0
  381. package/dist/schemas-CxQtxIga.mjs.map +1 -0
  382. package/dist/schemas-DBOhxgW7.d.mts +32 -0
  383. package/dist/schemas-DBOhxgW7.d.mts.map +1 -0
  384. package/dist/schemas-Dp_OCqBt.d.mts +63 -0
  385. package/dist/schemas-Dp_OCqBt.d.mts.map +1 -0
  386. package/dist/schemas-SwCsnT0z.mjs +83 -0
  387. package/dist/schemas-SwCsnT0z.mjs.map +1 -0
  388. package/dist/sdk-errors.d.mts +2 -0
  389. package/dist/sdk-errors.mjs +3 -0
  390. package/dist/sdk-experimental.d.mts +59 -0
  391. package/dist/sdk-experimental.d.mts.map +1 -0
  392. package/dist/sdk-experimental.mjs +193 -0
  393. package/dist/sdk-experimental.mjs.map +1 -0
  394. package/dist/sdk-stop-conditions.d.mts +3 -0
  395. package/dist/sdk-stop-conditions.mjs +3 -0
  396. package/dist/sdk.d.mts +15 -0
  397. package/dist/sdk.d.mts.map +1 -0
  398. package/dist/sdk.mjs +50 -0
  399. package/dist/sdk.mjs.map +1 -0
  400. package/dist/security-guardrails.d.mts +3 -0
  401. package/dist/security-guardrails.mjs +3 -0
  402. package/dist/security-injection.d.mts +2 -0
  403. package/dist/security-injection.mjs +3 -0
  404. package/dist/security.d.mts +12 -0
  405. package/dist/security.d.mts.map +1 -0
  406. package/dist/security.mjs +18 -0
  407. package/dist/security.mjs.map +1 -0
  408. package/dist/server.d.mts +420 -0
  409. package/dist/server.d.mts.map +1 -0
  410. package/dist/server.mjs +2225 -0
  411. package/dist/server.mjs.map +1 -0
  412. package/dist/shared.d.mts +2 -0
  413. package/dist/shared.mjs +3 -0
  414. package/dist/streaming-control.d.mts +2 -0
  415. package/dist/streaming-control.mjs +4 -0
  416. package/dist/streaming-core.d.mts +4 -0
  417. package/dist/streaming-core.mjs +3 -0
  418. package/dist/streaming-infra-resilience.d.mts +120 -0
  419. package/dist/streaming-infra-resilience.d.mts.map +1 -0
  420. package/dist/streaming-infra-resilience.mjs +358 -0
  421. package/dist/streaming-infra-resilience.mjs.map +1 -0
  422. package/dist/streaming-infra-transport.d.mts +57 -0
  423. package/dist/streaming-infra-transport.d.mts.map +1 -0
  424. package/dist/streaming-infra-transport.mjs +488 -0
  425. package/dist/streaming-infra-transport.mjs.map +1 -0
  426. package/dist/streaming-infra.d.mts +5 -0
  427. package/dist/streaming-infra.mjs +5 -0
  428. package/dist/streaming.d.mts +17 -0
  429. package/dist/streaming.d.mts.map +1 -0
  430. package/dist/streaming.mjs +71 -0
  431. package/dist/streaming.mjs.map +1 -0
  432. package/dist/telemetry-2eKMojIb.mjs +1046 -0
  433. package/dist/telemetry-2eKMojIb.mjs.map +1 -0
  434. package/dist/telemetry-C2t03dwD.d.mts +59 -0
  435. package/dist/telemetry-C2t03dwD.d.mts.map +1 -0
  436. package/dist/tool-Btbththq.d.mts +253 -0
  437. package/dist/tool-Btbththq.d.mts.map +1 -0
  438. package/dist/tool-JSf8JXZ8.mjs +1150 -0
  439. package/dist/tool-JSf8JXZ8.mjs.map +1 -0
  440. package/dist/tool-safety-CZO8a4D4.d.mts +60 -0
  441. package/dist/tool-safety-CZO8a4D4.d.mts.map +1 -0
  442. package/dist/tool-safety-DXtYDXod.mjs +319 -0
  443. package/dist/tool-safety-DXtYDXod.mjs.map +1 -0
  444. package/dist/tools-BuS2Uv0q.mjs +1708 -0
  445. package/dist/tools-BuS2Uv0q.mjs.map +1 -0
  446. package/dist/tools-approval.d.mts +99 -0
  447. package/dist/tools-approval.d.mts.map +1 -0
  448. package/dist/tools-approval.mjs +395 -0
  449. package/dist/tools-approval.mjs.map +1 -0
  450. package/dist/tools-compliance.d.mts +67 -0
  451. package/dist/tools-compliance.d.mts.map +1 -0
  452. package/dist/tools-compliance.mjs +330 -0
  453. package/dist/tools-compliance.mjs.map +1 -0
  454. package/dist/tools-computer.d.mts +25 -0
  455. package/dist/tools-computer.d.mts.map +1 -0
  456. package/dist/tools-computer.mjs +64 -0
  457. package/dist/tools-computer.mjs.map +1 -0
  458. package/dist/tools-core.d.mts +3 -0
  459. package/dist/tools-core.mjs +3 -0
  460. package/dist/tools-mcp.d.mts +3 -0
  461. package/dist/tools-mcp.mjs +5 -0
  462. package/dist/tools-superpowers.d.mts +2 -0
  463. package/dist/tools-superpowers.mjs +3 -0
  464. package/dist/tools.d.mts +401 -0
  465. package/dist/tools.d.mts.map +1 -0
  466. package/dist/tools.mjs +1921 -0
  467. package/dist/tools.mjs.map +1 -0
  468. package/dist/transport-selector-D-Ib05X1.mjs +1936 -0
  469. package/dist/transport-selector-D-Ib05X1.mjs.map +1 -0
  470. package/dist/triage-agent-BEsXg5sw.d.mts +63 -0
  471. package/dist/triage-agent-BEsXg5sw.d.mts.map +1 -0
  472. package/dist/triage-agent-CBsfX-HW.mjs +167 -0
  473. package/dist/triage-agent-CBsfX-HW.mjs.map +1 -0
  474. package/dist/types-BPnq3GQo.d.mts +23 -0
  475. package/dist/types-BPnq3GQo.d.mts.map +1 -0
  476. package/dist/types-BjWgimpY.d.mts +16 -0
  477. package/dist/types-BjWgimpY.d.mts.map +1 -0
  478. package/dist/types-BxD-5btB.d.mts +41 -0
  479. package/dist/types-BxD-5btB.d.mts.map +1 -0
  480. package/dist/types-By-r93bE.d.mts +36 -0
  481. package/dist/types-By-r93bE.d.mts.map +1 -0
  482. package/dist/types-CLBWFRZN.d.mts +69 -0
  483. package/dist/types-CLBWFRZN.d.mts.map +1 -0
  484. package/dist/types-CQ0HFd0u.d.mts +62 -0
  485. package/dist/types-CQ0HFd0u.d.mts.map +1 -0
  486. package/dist/types-D3zJb59_.d.mts +47 -0
  487. package/dist/types-D3zJb59_.d.mts.map +1 -0
  488. package/dist/types-DJnugQX0.d.mts +80 -0
  489. package/dist/types-DJnugQX0.d.mts.map +1 -0
  490. package/dist/types-DbUfMCnT.d.mts +70 -0
  491. package/dist/types-DbUfMCnT.d.mts.map +1 -0
  492. package/dist/upstash-adapter-D96Caq2O.mjs +22 -0
  493. package/dist/upstash-adapter-D96Caq2O.mjs.map +1 -0
  494. package/dist/upstash-adapter-DD4433dx.d.mts +8 -0
  495. package/dist/upstash-adapter-DD4433dx.d.mts.map +1 -0
  496. package/dist/utils-BlYhcD6M.mjs +319 -0
  497. package/dist/utils-BlYhcD6M.mjs.map +1 -0
  498. package/dist/utils-DpJGOb3y.d.mts +120 -0
  499. package/dist/utils-DpJGOb3y.d.mts.map +1 -0
  500. package/dist/vercel-blob-adapter-CkOXLT2D.mjs +25 -0
  501. package/dist/vercel-blob-adapter-CkOXLT2D.mjs.map +1 -0
  502. package/dist/xai-CbV_dCnP.mjs +1600 -0
  503. package/dist/xai-CbV_dCnP.mjs.map +1 -0
  504. package/package.json +479 -0
  505. package/src/agents/base/factory.ts +382 -0
  506. package/src/agents/base/index.ts +8 -0
  507. package/src/agents/base/schemas.ts +117 -0
  508. package/src/agents/base/types.ts +192 -0
  509. package/src/agents/control-flow/index.ts +683 -0
  510. package/src/agents/coordinator/coordinator-agent.ts +381 -0
  511. package/src/agents/coordinator/index.ts +6 -0
  512. package/src/agents/default-agent.ts +211 -0
  513. package/src/agents/evaluator-optimizer/README.md +612 -0
  514. package/src/agents/evaluator-optimizer/evaluator-optimizer.example.ts +437 -0
  515. package/src/agents/evaluator-optimizer/evaluator.ts +282 -0
  516. package/src/agents/evaluator-optimizer/index.test.ts +416 -0
  517. package/src/agents/evaluator-optimizer/index.ts +519 -0
  518. package/src/agents/evaluator-optimizer/optimizer.ts +322 -0
  519. package/src/agents/evaluator-optimizer/schema.ts +302 -0
  520. package/src/agents/evaluator-optimizer/utils.ts +42 -0
  521. package/src/agents/experimental/index.ts +1095 -0
  522. package/src/agents/experimental/types.ts +212 -0
  523. package/src/agents/fallback/index.ts +18 -0
  524. package/src/agents/fallback/recovery/circuit-breaker.ts +166 -0
  525. package/src/agents/fallback/strategies/model-fallback.ts +192 -0
  526. package/src/agents/fallback/types.ts +87 -0
  527. package/src/agents/governance-agent.ts +446 -0
  528. package/src/agents/index.ts +79 -0
  529. package/src/agents/multi/coordination/index.ts +6 -0
  530. package/src/agents/multi/coordination/message-bus.ts +144 -0
  531. package/src/agents/multi/index.ts +6 -0
  532. package/src/agents/multi/state/index.ts +162 -0
  533. package/src/agents/multi/supervisor/index.ts +7 -0
  534. package/src/agents/multi/supervisor/supervisor.ts +254 -0
  535. package/src/agents/multi/swarm/aggregation.ts +466 -0
  536. package/src/agents/multi/swarm/communication.ts +388 -0
  537. package/src/agents/multi/swarm/coordination.ts +380 -0
  538. package/src/agents/multi/swarm/index.ts +73 -0
  539. package/src/agents/multi/swarm/swarm-executor.ts +479 -0
  540. package/src/agents/multi/types.ts +181 -0
  541. package/src/agents/observability/index.ts +914 -0
  542. package/src/agents/orchestrator.ts +218 -0
  543. package/src/agents/patterns/README.md +512 -0
  544. package/src/agents/patterns/evaluator-optimizer-pattern.example.ts +455 -0
  545. package/src/agents/patterns/evaluator-optimizer-pattern.ts +653 -0
  546. package/src/agents/patterns/index.ts +26 -0
  547. package/src/agents/persistence/index.ts +726 -0
  548. package/src/agents/tools/index.ts +291 -0
  549. package/src/agents/tools/mcp.ts +188 -0
  550. package/src/agents/triage/index.ts +6 -0
  551. package/src/agents/triage/triage-agent.ts +280 -0
  552. package/src/agents/workflows/index.ts +6 -0
  553. package/src/agents/workflows/interfaces.ts +36 -0
  554. package/src/agents/workflows/schema.ts +20 -0
  555. package/src/caching/adapters/index.ts +7 -0
  556. package/src/caching/adapters/memory.ts +77 -0
  557. package/src/caching/adapters/redis.ts +60 -0
  558. package/src/caching/index.ts +17 -0
  559. package/src/caching/middleware.ts +452 -0
  560. package/src/caching/strategies/index.ts +1008 -0
  561. package/src/caching/types.ts +47 -0
  562. package/src/catalog.ts +921 -0
  563. package/src/client/chat-usage.ts +53 -0
  564. package/src/client/hooks.ts +343 -0
  565. package/src/client/index.ts +36 -0
  566. package/src/client/message-utils.ts +29 -0
  567. package/src/client/use-generative-ui.ts +174 -0
  568. package/src/client/utils.ts +66 -0
  569. package/src/generative-ui/catalog.ts +653 -0
  570. package/src/generative-ui/index.ts +82 -0
  571. package/src/generative-ui/registry.ts +273 -0
  572. package/src/generative-ui/stream.ts +324 -0
  573. package/src/generative-ui/types.ts +376 -0
  574. package/src/governance/audit/audit-logger.ts +239 -0
  575. package/src/governance/audit/audit-schema.ts +82 -0
  576. package/src/governance/audit/index.ts +6 -0
  577. package/src/governance/compliance/abac/policy-engine.ts +175 -0
  578. package/src/governance/compliance/abac/types.ts +40 -0
  579. package/src/governance/compliance/approval/compliance-approval-queue.ts +217 -0
  580. package/src/governance/compliance/index.ts +16 -0
  581. package/src/governance/compliance/schemas.ts +68 -0
  582. package/src/governance/compliance/types.ts +143 -0
  583. package/src/governance/compliance/validators/phi-detector.ts +145 -0
  584. package/src/governance/compliance/validators/redaction-utils.ts +176 -0
  585. package/src/governance/compliance/validators/safe-harbor.ts +135 -0
  586. package/src/governance/entitlements/index.ts +585 -0
  587. package/src/governance/entitlements/middleware.ts +651 -0
  588. package/src/governance/entitlements/rate-limiter.ts +711 -0
  589. package/src/governance/index.ts +32 -0
  590. package/src/governance/policies/guardrails.ts +1121 -0
  591. package/src/governance/policies/index.ts +42 -0
  592. package/src/governance/policies/loop-controls.ts +136 -0
  593. package/src/governance/policies/telemetry.ts +63 -0
  594. package/src/governance/tenancy/index.ts +30 -0
  595. package/src/governance/tenancy/isolation/context.ts +92 -0
  596. package/src/governance/tenancy/isolation/index.ts +13 -0
  597. package/src/governance/tenancy/quotas/index.ts +11 -0
  598. package/src/governance/tenancy/quotas/quota-manager.ts +180 -0
  599. package/src/governance/tenancy/types.ts +66 -0
  600. package/src/governance/types.ts +16 -0
  601. package/src/governance/versioning/index.ts +573 -0
  602. package/src/grounding/attribution/index.ts +424 -0
  603. package/src/grounding/citation/citation-generator.ts +174 -0
  604. package/src/grounding/citation/index.ts +12 -0
  605. package/src/grounding/context/index.ts +32 -0
  606. package/src/grounding/context/safe-context.ts +116 -0
  607. package/src/grounding/context/types.ts +62 -0
  608. package/src/grounding/context-engineering/error-handling.ts +359 -0
  609. package/src/grounding/context-engineering/index.ts +23 -0
  610. package/src/grounding/context-engineering/memory.ts +559 -0
  611. package/src/grounding/context-engineering/tool-masking.ts +338 -0
  612. package/src/grounding/embed/index.ts +704 -0
  613. package/src/grounding/embed/reranking.ts +604 -0
  614. package/src/grounding/hallucination/index.ts +223 -0
  615. package/src/grounding/index.ts +82 -0
  616. package/src/grounding/proof-map/applyPatch.ts +172 -0
  617. package/src/grounding/proof-map/index.ts +41 -0
  618. package/src/grounding/proof-map/loop.ts +275 -0
  619. package/src/grounding/proof-map/schema.ts +217 -0
  620. package/src/grounding/rag/__tests__/pipeline.test.ts +274 -0
  621. package/src/grounding/rag/__tests__/tool.test.ts +202 -0
  622. package/src/grounding/rag/__tests__/trace.test.ts +229 -0
  623. package/src/grounding/rag/circuit-breaker.ts +152 -0
  624. package/src/grounding/rag/index.ts +64 -0
  625. package/src/grounding/rag/pipeline.ts +602 -0
  626. package/src/grounding/rag/tool.ts +281 -0
  627. package/src/grounding/rag/trace.ts +503 -0
  628. package/src/grounding/rag/types.ts +284 -0
  629. package/src/grounding/retrieval/in-memory-store.ts +107 -0
  630. package/src/grounding/sources/index.ts +943 -0
  631. package/src/grounding/tests/applyPatch.test.ts +194 -0
  632. package/src/grounding/tests/loop.test.ts +141 -0
  633. package/src/grounding/tests/schema.test.ts +160 -0
  634. package/src/grounding/types.ts +100 -0
  635. package/src/grounding/verification/index.ts +419 -0
  636. package/src/hitl/active-learning/index.ts +332 -0
  637. package/src/hitl/annotation/index.ts +362 -0
  638. package/src/hitl/approval/approval-queue.ts +132 -0
  639. package/src/hitl/approval/index.ts +5 -0
  640. package/src/hitl/feedback/index.ts +284 -0
  641. package/src/hitl/index.ts +69 -0
  642. package/src/hitl/review/index.ts +6 -0
  643. package/src/hitl/review/review-trigger.ts +162 -0
  644. package/src/hitl/types.ts +126 -0
  645. package/src/index.ts +125 -0
  646. package/src/integrations/blob-storage/index.ts +7 -0
  647. package/src/integrations/blob-storage/types.ts +28 -0
  648. package/src/integrations/blob-storage/vercel-blob-adapter.ts +35 -0
  649. package/src/integrations/index.ts +15 -0
  650. package/src/integrations/notifications/index.ts +7 -0
  651. package/src/integrations/notifications/log-adapter.ts +30 -0
  652. package/src/integrations/notifications/types.ts +27 -0
  653. package/src/integrations/rate-limit/index.ts +7 -0
  654. package/src/integrations/rate-limit/types.ts +26 -0
  655. package/src/integrations/rate-limit/upstash-adapter.ts +45 -0
  656. package/src/integrations/redis/index.ts +7 -0
  657. package/src/integrations/redis/types.ts +67 -0
  658. package/src/integrations/redis/upstash-adapter.ts +18 -0
  659. package/src/integrations/stream/index.ts +7 -0
  660. package/src/integrations/stream/resumable-adapter.ts +20 -0
  661. package/src/integrations/stream/types.ts +21 -0
  662. package/src/internal/__tests__/hallucination.test.ts +162 -0
  663. package/src/internal/__tests__/models.test.ts +104 -0
  664. package/src/internal/__tests__/sdk-errors.test.ts +201 -0
  665. package/src/internal/__tests__/stop-conditions.test.ts +210 -0
  666. package/src/internal/shared/ai-types.ts +942 -0
  667. package/src/internal/testing/evaluators.ts +575 -0
  668. package/src/internal/testing/index.ts +960 -0
  669. package/src/internal/ui/data-parts.ts +511 -0
  670. package/src/internal/ui/type-guards.ts +344 -0
  671. package/src/internal/ui-factories/__tests__/ui-factories.test.ts +548 -0
  672. package/src/internal/ui-factories/artifact-factory.ts +667 -0
  673. package/src/internal/ui-factories/index.ts +82 -0
  674. package/src/internal/ui-factories/shimmer-manager.ts +220 -0
  675. package/src/internal/ui-factories/status-helpers.ts +149 -0
  676. package/src/internal/ui-factories/tool-renderer.ts +167 -0
  677. package/src/internal/ui-factories/types.ts +235 -0
  678. package/src/models/capabilities.ts +88 -0
  679. package/src/models/index.ts +16 -0
  680. package/src/models/provider-factory.ts +229 -0
  681. package/src/models/providers/anthropic.ts +539 -0
  682. package/src/models/providers/google.ts +354 -0
  683. package/src/models/providers/index.ts +21 -0
  684. package/src/models/providers/openai.ts +346 -0
  685. package/src/models/providers/perplexity.ts +276 -0
  686. package/src/models/providers/shared.ts +90 -0
  687. package/src/models/providers/xai.ts +269 -0
  688. package/src/models/registry.ts +208 -0
  689. package/src/models/routing/index.ts +45 -0
  690. package/src/models/routing/intent-router.ts +143 -0
  691. package/src/models/routing/model-router.ts +300 -0
  692. package/src/models/routing/types.ts +106 -0
  693. package/src/models/types.ts +23 -0
  694. package/src/observability/analytics/index.ts +593 -0
  695. package/src/observability/cost/index.ts +16 -0
  696. package/src/observability/cost/tracking/budget-guard.ts +110 -0
  697. package/src/observability/cost/tracking/usage-tracker.ts +120 -0
  698. package/src/observability/cost/types.ts +85 -0
  699. package/src/observability/index.ts +17 -0
  700. package/src/observability/telemetry/index.ts +508 -0
  701. package/src/observability/tracing/index.ts +30 -0
  702. package/src/observability/tracing/otel/ai-instrumentation.ts +193 -0
  703. package/src/observability/tracing/otel/exporters/console.ts +58 -0
  704. package/src/observability/tracing/otel/exporters/index.ts +6 -0
  705. package/src/observability/tracing/provenance.ts +769 -0
  706. package/src/observability/tracing/types.ts +92 -0
  707. package/src/output/__tests__/output.test.ts +737 -0
  708. package/src/output/element-stream.ts +678 -0
  709. package/src/output/errors.ts +108 -0
  710. package/src/output/factories.ts +392 -0
  711. package/src/output/index.ts +98 -0
  712. package/src/output/multimodal/EXPORTS.md +306 -0
  713. package/src/output/multimodal/IMPLEMENTATION_SUMMARY.md +421 -0
  714. package/src/output/multimodal/README.md +349 -0
  715. package/src/output/multimodal/SETUP_GUIDE.md +472 -0
  716. package/src/output/multimodal/audio.ts +650 -0
  717. package/src/output/multimodal/image.ts +22 -0
  718. package/src/output/multimodal/index.ts +32 -0
  719. package/src/output/multimodal/providers.example.ts +375 -0
  720. package/src/output/validator.ts +495 -0
  721. package/src/pipelines/adapters/trace-storage-blob.ts +458 -0
  722. package/src/pipelines/adapters/trace-storage-memory.ts +319 -0
  723. package/src/pipelines/defaults.ts +109 -0
  724. package/src/pipelines/index.ts +24 -0
  725. package/src/pipelines/message-transforms.ts +107 -0
  726. package/src/pipelines/multi-step-wrapper.ts +433 -0
  727. package/src/pipelines/pipeline-presets.ts +339 -0
  728. package/src/pipelines/step-executor.ts +257 -0
  729. package/src/pipelines/storage-factory.ts +85 -0
  730. package/src/pipelines/trace-storage-interface.ts +216 -0
  731. package/src/pipelines/types.ts +255 -0
  732. package/src/pipelines/validation.ts +323 -0
  733. package/src/prompts/index.ts +271 -0
  734. package/src/prompts/model-variants.ts +410 -0
  735. package/src/prompts/templates.ts +327 -0
  736. package/src/sdk/errors/base.ts +296 -0
  737. package/src/sdk/errors/index.ts +31 -0
  738. package/src/sdk/errors/utils.ts +148 -0
  739. package/src/sdk/experimental/index.ts +286 -0
  740. package/src/sdk/index.ts +25 -0
  741. package/src/sdk/middleware/ai-middleware.ts +95 -0
  742. package/src/sdk/middleware/cache.ts +154 -0
  743. package/src/sdk/middleware/circuit-breaker.ts +388 -0
  744. package/src/sdk/middleware/compose.ts +81 -0
  745. package/src/sdk/middleware/deduplication.ts +307 -0
  746. package/src/sdk/middleware/index.ts +660 -0
  747. package/src/sdk/middleware/model-middleware.ts +200 -0
  748. package/src/sdk/stop-conditions/conditions.ts +209 -0
  749. package/src/sdk/stop-conditions/index.ts +35 -0
  750. package/src/sdk/stop-conditions/types.ts +59 -0
  751. package/src/security/guardrails/index.ts +6 -0
  752. package/src/security/guardrails/middleware.ts +465 -0
  753. package/src/security/guardrails/pii-filter.ts +396 -0
  754. package/src/security/index.ts +33 -0
  755. package/src/security/injection/index.ts +5 -0
  756. package/src/security/injection/prompt-injection.ts +64 -0
  757. package/src/security/types.ts +85 -0
  758. package/src/server/cache/crypto.ts +47 -0
  759. package/src/server/cache/performance.ts +79 -0
  760. package/src/server/error-handler.ts +93 -0
  761. package/src/server/errors.ts +73 -0
  762. package/src/server/helpers.ts +944 -0
  763. package/src/server/http.ts +156 -0
  764. package/src/server/index.ts +12 -0
  765. package/src/server/messages/__tests__/messages.test.ts +720 -0
  766. package/src/server/messages/converter.ts +245 -0
  767. package/src/server/messages/data-parts.ts +338 -0
  768. package/src/server/messages/extraction.ts +328 -0
  769. package/src/server/messages/index.ts +126 -0
  770. package/src/server/messages/types.ts +355 -0
  771. package/src/server/messages/window.ts +450 -0
  772. package/src/server/rate-limit/env.ts +8 -0
  773. package/src/server/rate-limit/rate-limit.ts +165 -0
  774. package/src/server/routes/HEALTH_CHECK.md +502 -0
  775. package/src/server/routes/IMPLEMENTATION_SUMMARY.md +432 -0
  776. package/src/server/routes/QUICK_START.md +327 -0
  777. package/src/server/routes/README.md +357 -0
  778. package/src/server/routes/__tests__/routes.test.ts +628 -0
  779. package/src/server/routes/agent-route.ts +224 -0
  780. package/src/server/routes/agent-routes.ts +191 -0
  781. package/src/server/routes/embed-config.ts +181 -0
  782. package/src/server/routes/health-check.example.ts +507 -0
  783. package/src/server/routes/health-check.test.ts +533 -0
  784. package/src/server/routes/health-check.ts +639 -0
  785. package/src/server/routes/health-check.types.ts +217 -0
  786. package/src/server/routes/index.ts +32 -0
  787. package/src/server/routes/types.ts +274 -0
  788. package/src/shared/__tests__/schemas.test.ts +317 -0
  789. package/src/shared/ai-runtime.ts +139 -0
  790. package/src/shared/ai-types.ts +133 -0
  791. package/src/shared/index.ts +30 -0
  792. package/src/shared/sdk-runtime.ts +198 -0
  793. package/src/shared/sdk-types.ts +301 -0
  794. package/src/streaming/control/__tests__/streaming-control.test.ts +708 -0
  795. package/src/streaming/control/budget-guard.ts +264 -0
  796. package/src/streaming/control/controller.ts +255 -0
  797. package/src/streaming/control/index.ts +105 -0
  798. package/src/streaming/control/smoothing.ts +201 -0
  799. package/src/streaming/control/step-limit.ts +215 -0
  800. package/src/streaming/control/types.ts +234 -0
  801. package/src/streaming/core/auto-resume.ts +276 -0
  802. package/src/streaming/core/index.ts +85 -0
  803. package/src/streaming/core/multi-step.ts +471 -0
  804. package/src/streaming/core/protocol.ts +194 -0
  805. package/src/streaming/core/types.ts +182 -0
  806. package/src/streaming/index.ts +97 -0
  807. package/src/streaming/infra/backpressure/buffer.ts +210 -0
  808. package/src/streaming/infra/backpressure/index.ts +6 -0
  809. package/src/streaming/infra/index.ts +75 -0
  810. package/src/streaming/infra/multiplexing/index.ts +311 -0
  811. package/src/streaming/infra/resilience/index.ts +684 -0
  812. package/src/streaming/infra/transform/index.ts +15 -0
  813. package/src/streaming/infra/transform/stream-transforms.ts +166 -0
  814. package/src/streaming/infra/transport/index.ts +774 -0
  815. package/src/streaming/infra/types.ts +118 -0
  816. package/src/streaming/infra-extra/types.ts +118 -0
  817. package/src/tools/advanced/caching.ts +299 -0
  818. package/src/tools/advanced/generator.ts +267 -0
  819. package/src/tools/advanced/hitl.ts +251 -0
  820. package/src/tools/advanced/index.ts +9 -0
  821. package/src/tools/advanced/llm-tool.ts +208 -0
  822. package/src/tools/approval/FILES.md +449 -0
  823. package/src/tools/approval/IMPLEMENTATION_SUMMARY.md +567 -0
  824. package/src/tools/approval/QUICK_START.md +362 -0
  825. package/src/tools/approval/README.md +514 -0
  826. package/src/tools/approval/advanced-approval-queue.ts +7 -0
  827. package/src/tools/approval/approval.example.ts +571 -0
  828. package/src/tools/approval/in-memory-queue.ts +405 -0
  829. package/src/tools/approval/index.ts +737 -0
  830. package/src/tools/approval/middleware.ts +590 -0
  831. package/src/tools/approval/queue-factory.ts +162 -0
  832. package/src/tools/approval/redis-queue.ts +327 -0
  833. package/src/tools/approval/testing.ts +493 -0
  834. package/src/tools/approval/types.ts +221 -0
  835. package/src/tools/approval/with-approval.ts +366 -0
  836. package/src/tools/artifacts/artifact-tools.ts +273 -0
  837. package/src/tools/artifacts/index.ts +6 -0
  838. package/src/tools/compliance/compliance-wrapper.ts +789 -0
  839. package/src/tools/compliance/create-compliant-stream.ts +226 -0
  840. package/src/tools/compliance/index.ts +8 -0
  841. package/src/tools/compliance/phi-redaction.ts +406 -0
  842. package/src/tools/compliance/tool-wrapper.ts +306 -0
  843. package/src/tools/computer/index.ts +99 -0
  844. package/src/tools/computer/types.ts +41 -0
  845. package/src/tools/core/abort.ts +202 -0
  846. package/src/tools/core/factory.ts +197 -0
  847. package/src/tools/core/index.ts +8 -0
  848. package/src/tools/core/tool-safety.ts +112 -0
  849. package/src/tools/generic/index.ts +9 -0
  850. package/src/tools/generic/json-schema-tool.ts +301 -0
  851. package/src/tools/generic/tiptap-context.ts +619 -0
  852. package/src/tools/generic/web-search-tool.ts +82 -0
  853. package/src/tools/generic/web-search.ts +142 -0
  854. package/src/tools/index.ts +36 -0
  855. package/src/tools/mcp/ai-sdk-error-integration.ts +401 -0
  856. package/src/tools/mcp/client.ts +988 -0
  857. package/src/tools/mcp/connection-manager.ts +380 -0
  858. package/src/tools/mcp/connection-pool.ts +408 -0
  859. package/src/tools/mcp/edge-runtime.ts +318 -0
  860. package/src/tools/mcp/environment.ts +310 -0
  861. package/src/tools/mcp/index.ts +20 -0
  862. package/src/tools/mcp/next-pattern.ts +401 -0
  863. package/src/tools/mcp/stream-lifecycle-integration.ts +617 -0
  864. package/src/tools/mcp/tool-cache.ts +359 -0
  865. package/src/tools/mcp/transport-selector.ts +492 -0
  866. package/src/tools/mcp/transports.ts +99 -0
  867. package/src/tools/simple-factory.ts +55 -0
  868. package/src/tools/superpowers/index.ts +122 -0
  869. package/src/tools/superpowers/prompts/index.ts +533 -0
  870. package/src/tools/superpowers/schemas/index.ts +701 -0
  871. package/src/tools/superpowers/tools/index.ts +721 -0
  872. package/src/tools/validation-wrapper.ts +97 -0
@@ -0,0 +1,1708 @@
1
+ import { Ft as tool } from "./ai-runtime-CDzQztTt.mjs";
2
+ import { z } from "zod";
3
+
4
+ //#region src/tools/superpowers/schemas/index.ts
5
+ /**
6
+ * @fileoverview Superpowers Schemas - Zod schemas for all 20 obra/superpowers skills
7
+ * @module @od-oneapp/ai-platform/superpowers/schemas
8
+ */
9
+ const BrainstormOutputSchema = z.object({
10
+ analysis: z.object({
11
+ ambiguityScore: z.number().min(1).max(10).describe("10 is very vague, 1 is crystal clear"),
12
+ missingContext: z.array(z.string()).describe("List of critical information not provided"),
13
+ assumptions: z.array(z.string()).describe("Assumptions being made based on limited info")
14
+ }),
15
+ clarifyingQuestions: z.array(z.object({
16
+ question: z.string(),
17
+ priority: z.enum([
18
+ "critical",
19
+ "important",
20
+ "nice-to-have"
21
+ ]),
22
+ context: z.string().describe("Why this question matters")
23
+ })).describe("Top 3-5 questions to ask the user immediately"),
24
+ edgeCases: z.array(z.object({
25
+ scenario: z.string(),
26
+ risk: z.enum([
27
+ "low",
28
+ "medium",
29
+ "high"
30
+ ]),
31
+ mitigation: z.string().optional()
32
+ })).describe("Potential failure modes or unhandled states"),
33
+ approaches: z.array(z.object({
34
+ name: z.string(),
35
+ description: z.string(),
36
+ pros: z.array(z.string()),
37
+ cons: z.array(z.string()),
38
+ techStackRecommendation: z.string().optional(),
39
+ estimatedComplexity: z.enum([
40
+ "simple",
41
+ "moderate",
42
+ "complex"
43
+ ])
44
+ })).describe("Proposed solutions with trade-offs")
45
+ });
46
+ const PlanOutputSchema = z.object({
47
+ summary: z.string().describe("Executive summary of the approach"),
48
+ riskAnalysis: z.array(z.object({
49
+ risk: z.string(),
50
+ severity: z.enum([
51
+ "low",
52
+ "medium",
53
+ "high",
54
+ "critical"
55
+ ]),
56
+ mitigation: z.string()
57
+ })).describe("Potential pitfalls or breaking changes"),
58
+ dependencies: z.array(z.object({
59
+ name: z.string(),
60
+ type: z.enum([
61
+ "package",
62
+ "service",
63
+ "api",
64
+ "database",
65
+ "file"
66
+ ]),
67
+ status: z.enum([
68
+ "exists",
69
+ "needs-creation",
70
+ "needs-modification"
71
+ ])
72
+ })).describe("Required dependencies and their status"),
73
+ steps: z.array(z.object({
74
+ order: z.number(),
75
+ title: z.string(),
76
+ filePaths: z.array(z.string()).describe("Files that will be created or modified"),
77
+ actionType: z.enum([
78
+ "create",
79
+ "modify",
80
+ "delete",
81
+ "refactor",
82
+ "test",
83
+ "configure"
84
+ ]),
85
+ description: z.string(),
86
+ verificationCmd: z.string().describe("Shell command to verify this specific step (e.g., 'npm test -- spec')"),
87
+ blockedBy: z.array(z.number()).optional().describe("Step numbers that must complete first")
88
+ })),
89
+ rollbackPlan: z.string().optional().describe("How to revert if something goes wrong")
90
+ });
91
+ const DesignReviewOutputSchema = z.object({
92
+ adheresToConventions: z.boolean(),
93
+ conventionViolations: z.array(z.object({
94
+ convention: z.string(),
95
+ violation: z.string(),
96
+ severity: z.enum([
97
+ "minor",
98
+ "moderate",
99
+ "severe"
100
+ ]),
101
+ suggestion: z.string()
102
+ })),
103
+ architecturalConcerns: z.array(z.object({
104
+ concern: z.string(),
105
+ impact: z.enum([
106
+ "low",
107
+ "medium",
108
+ "high"
109
+ ]),
110
+ recommendation: z.string()
111
+ })),
112
+ compatibility: z.object({
113
+ backwardsCompatible: z.boolean(),
114
+ breakingChanges: z.array(z.string()),
115
+ migrationRequired: z.boolean(),
116
+ migrationSteps: z.array(z.string()).optional()
117
+ }),
118
+ recommendations: z.array(z.string()),
119
+ approval: z.enum([
120
+ "approved",
121
+ "approved-with-changes",
122
+ "rejected"
123
+ ])
124
+ });
125
+ const TDDOutputSchema = z.object({
126
+ phase: z.enum([
127
+ "write-test",
128
+ "run-test",
129
+ "implement",
130
+ "refactor",
131
+ "complete"
132
+ ]),
133
+ testFile: z.object({
134
+ path: z.string(),
135
+ content: z.string(),
136
+ description: z.string()
137
+ }).optional(),
138
+ implementation: z.object({
139
+ path: z.string(),
140
+ content: z.string(),
141
+ description: z.string()
142
+ }).optional(),
143
+ testResult: z.object({
144
+ passed: z.boolean(),
145
+ output: z.string(),
146
+ failureReason: z.string().optional()
147
+ }).optional(),
148
+ iteration: z.number().describe("Current TDD iteration"),
149
+ nextAction: z.string().describe("What should happen next"),
150
+ confidence: z.number().min(0).max(1).describe("Confidence in the implementation")
151
+ });
152
+ const CodeReviewOutputSchema = z.object({
153
+ summary: z.object({
154
+ overallScore: z.number().min(0).max(100),
155
+ recommendation: z.enum([
156
+ "approve",
157
+ "request-changes",
158
+ "needs-discussion"
159
+ ]),
160
+ reviewerConfidence: z.number().min(0).max(1)
161
+ }),
162
+ categories: z.object({
163
+ security: z.object({
164
+ score: z.number().min(0).max(100),
165
+ issues: z.array(z.object({
166
+ severity: z.enum([
167
+ "info",
168
+ "warning",
169
+ "error",
170
+ "critical"
171
+ ]),
172
+ line: z.number().optional(),
173
+ message: z.string(),
174
+ suggestion: z.string().optional()
175
+ }))
176
+ }),
177
+ performance: z.object({
178
+ score: z.number().min(0).max(100),
179
+ issues: z.array(z.object({
180
+ severity: z.enum([
181
+ "info",
182
+ "warning",
183
+ "error"
184
+ ]),
185
+ line: z.number().optional(),
186
+ message: z.string(),
187
+ suggestion: z.string().optional()
188
+ }))
189
+ }),
190
+ maintainability: z.object({
191
+ score: z.number().min(0).max(100),
192
+ issues: z.array(z.object({
193
+ severity: z.enum([
194
+ "info",
195
+ "warning",
196
+ "error"
197
+ ]),
198
+ line: z.number().optional(),
199
+ message: z.string(),
200
+ suggestion: z.string().optional()
201
+ }))
202
+ }),
203
+ testCoverage: z.object({
204
+ score: z.number().min(0).max(100),
205
+ missingTests: z.array(z.string())
206
+ })
207
+ }),
208
+ antiPatterns: z.array(z.object({
209
+ name: z.string(),
210
+ location: z.string(),
211
+ description: z.string(),
212
+ suggestedFix: z.string()
213
+ })),
214
+ positives: z.array(z.string()).describe("Good practices observed in the code")
215
+ });
216
+ const AntiPatternOutputSchema = z.object({
217
+ detected: z.boolean(),
218
+ patterns: z.array(z.object({
219
+ name: z.string(),
220
+ severity: z.enum([
221
+ "minor",
222
+ "moderate",
223
+ "severe"
224
+ ]),
225
+ location: z.object({
226
+ file: z.string(),
227
+ line: z.number().optional(),
228
+ snippet: z.string().optional()
229
+ }),
230
+ description: z.string(),
231
+ why: z.string().describe("Why this is problematic"),
232
+ fix: z.string().describe("How to fix it"),
233
+ category: z.enum([
234
+ "hardcoding",
235
+ "error-swallowing",
236
+ "magic-numbers",
237
+ "god-object",
238
+ "over-engineering",
239
+ "premature-optimization",
240
+ "copy-paste",
241
+ "security",
242
+ "other"
243
+ ])
244
+ })),
245
+ score: z.number().min(0).max(100).describe("Code quality score (100 = no anti-patterns)")
246
+ });
247
+ const SystematicDebuggingOutputSchema = z.object({
248
+ phase: z.enum([
249
+ "investigation",
250
+ "pattern-analysis",
251
+ "hypothesis-testing",
252
+ "implementation"
253
+ ]),
254
+ investigation: z.object({
255
+ errorMessages: z.array(z.string()).describe("Error messages and stack traces analyzed"),
256
+ reproductionSteps: z.array(z.string()).describe("Steps to consistently reproduce the issue"),
257
+ recentChanges: z.array(z.string()).describe("Recent commits or changes that might be related"),
258
+ dataFlowTrace: z.string().describe("Trace of data flow backward to failure point"),
259
+ failurePoint: z.string().describe("Identified location where failure occurs"),
260
+ rootCauseHypothesis: z.string().describe("Initial hypothesis about WHY it failed")
261
+ }),
262
+ patternAnalysis: z.object({
263
+ workingCodeExamples: z.array(z.string()).describe("Similar working code found in codebase"),
264
+ differences: z.array(z.string()).describe("Key differences between working and broken code"),
265
+ missingDependencies: z.array(z.string()).describe("Dependencies or assumptions not met")
266
+ }).optional(),
267
+ hypothesis: z.object({
268
+ statement: z.string().describe("Single, specific hypothesis"),
269
+ testPlan: z.string().describe("Minimal test to verify hypothesis"),
270
+ result: z.enum([
271
+ "confirmed",
272
+ "rejected",
273
+ "inconclusive"
274
+ ]).optional(),
275
+ iterations: z.number().describe("Number of hypothesis iterations")
276
+ }).optional(),
277
+ fix: z.object({
278
+ testCase: z.string().describe("Automated failing test case"),
279
+ implementation: z.string().describe("Single targeted fix"),
280
+ verification: z.string().describe("How fix was verified")
281
+ }).optional(),
282
+ confidence: z.number().min(0).max(1).describe("Confidence in root cause identification"),
283
+ redFlags: z.array(z.string()).describe("Warning signs that investigation is going wrong")
284
+ });
285
+ const RootCauseTracingOutputSchema = z.object({
286
+ symptom: z.string().describe("The observed symptom or error"),
287
+ traceSteps: z.array(z.object({
288
+ layer: z.string().describe("System layer (UI, API, DB, etc.)"),
289
+ component: z.string().describe("Specific component examined"),
290
+ finding: z.string().describe("What was found at this layer"),
291
+ isRootCause: z.boolean()
292
+ })),
293
+ rootCause: z.object({
294
+ location: z.string().describe("File and line where root cause exists"),
295
+ description: z.string().describe("What is actually wrong"),
296
+ category: z.enum([
297
+ "logic-error",
298
+ "data-corruption",
299
+ "race-condition",
300
+ "missing-validation",
301
+ "configuration",
302
+ "dependency",
303
+ "resource-exhaustion",
304
+ "other"
305
+ ])
306
+ }),
307
+ contributingFactors: z.array(z.string()).describe("Other factors that enabled this bug"),
308
+ preventionRecommendations: z.array(z.string()).describe("How to prevent similar issues")
309
+ });
310
+ const DefenseInDepthOutputSchema = z.object({
311
+ layers: z.array(z.object({
312
+ name: z.string().describe("Defense layer name"),
313
+ type: z.enum([
314
+ "input-validation",
315
+ "authentication",
316
+ "authorization",
317
+ "encryption",
318
+ "logging",
319
+ "rate-limiting",
320
+ "error-handling",
321
+ "backup"
322
+ ]),
323
+ status: z.enum([
324
+ "present",
325
+ "missing",
326
+ "partial"
327
+ ]),
328
+ strength: z.enum([
329
+ "strong",
330
+ "adequate",
331
+ "weak"
332
+ ]),
333
+ recommendations: z.array(z.string())
334
+ })),
335
+ overallScore: z.number().min(0).max(100),
336
+ criticalGaps: z.array(z.string()).describe("Security gaps that must be addressed"),
337
+ redundancyAnalysis: z.object({
338
+ hasRedundancy: z.boolean(),
339
+ singlePointsOfFailure: z.array(z.string())
340
+ }),
341
+ gaps: z.array(z.object({
342
+ name: z.string(),
343
+ severity: z.enum([
344
+ "low",
345
+ "medium",
346
+ "high",
347
+ "critical"
348
+ ]),
349
+ recommendation: z.string()
350
+ })),
351
+ recommendations: z.array(z.string())
352
+ });
353
+ const AsyncPatternsOutputSchema = z.object({
354
+ asyncOperations: z.array(z.object({
355
+ description: z.string(),
356
+ type: z.enum([
357
+ "network",
358
+ "timer",
359
+ "animation",
360
+ "state-change",
361
+ "dom-update",
362
+ "file-io"
363
+ ]),
364
+ waitStrategy: z.enum([
365
+ "polling",
366
+ "event-listener",
367
+ "promise",
368
+ "callback",
369
+ "observable"
370
+ ]),
371
+ condition: z.string().describe("What condition to wait for"),
372
+ timeout: z.number().describe("Recommended timeout in ms"),
373
+ fallback: z.string().describe("What to do if timeout occurs")
374
+ })),
375
+ raceConditions: z.array(z.object({
376
+ description: z.string(),
377
+ location: z.string(),
378
+ fix: z.string()
379
+ })),
380
+ antiPatterns: z.array(z.object({
381
+ pattern: z.string(),
382
+ location: z.string(),
383
+ betterApproach: z.string()
384
+ })),
385
+ recommendations: z.array(z.string())
386
+ });
387
+ const PlanExecutionOutputSchema = z.object({
388
+ planId: z.string().describe("Reference to the plan being executed"),
389
+ currentStep: z.number(),
390
+ totalSteps: z.number(),
391
+ status: z.enum([
392
+ "in-progress",
393
+ "checkpoint",
394
+ "blocked",
395
+ "completed",
396
+ "failed"
397
+ ]),
398
+ executedSteps: z.array(z.object({
399
+ stepNumber: z.number(),
400
+ title: z.string(),
401
+ status: z.enum([
402
+ "completed",
403
+ "skipped",
404
+ "failed"
405
+ ]),
406
+ output: z.string().optional(),
407
+ verificationResult: z.string().optional(),
408
+ duration: z.number().optional().describe("Time taken in ms")
409
+ })),
410
+ checkpoint: z.object({
411
+ reason: z.string().describe("Why human review is needed"),
412
+ question: z.string().describe("Specific question for the human"),
413
+ options: z.array(z.string()).describe("Available choices")
414
+ }).optional(),
415
+ blockers: z.array(z.string()).optional(),
416
+ nextAction: z.string().describe("What will happen next")
417
+ });
418
+ const AgentDispatchOutputSchema = z.object({
419
+ taskDecomposition: z.array(z.object({
420
+ taskId: z.string(),
421
+ description: z.string(),
422
+ dependencies: z.array(z.string()).describe("Task IDs this depends on"),
423
+ estimatedDuration: z.string(),
424
+ agentType: z.enum([
425
+ "brainstorm",
426
+ "plan",
427
+ "implement",
428
+ "test",
429
+ "review",
430
+ "document"
431
+ ])
432
+ })),
433
+ parallelGroups: z.array(z.object({
434
+ groupId: z.string(),
435
+ tasks: z.array(z.string()).describe("Task IDs that can run in parallel"),
436
+ completionCondition: z.enum([
437
+ "all",
438
+ "any",
439
+ "majority"
440
+ ])
441
+ })),
442
+ executionOrder: z.array(z.string()).describe("Group IDs in execution order"),
443
+ coordinationStrategy: z.enum([
444
+ "fork-join",
445
+ "pipeline",
446
+ "scatter-gather",
447
+ "choreography"
448
+ ]),
449
+ mergeStrategy: z.string().describe("How to combine results from parallel tasks")
450
+ });
451
+ const SubagentDevOutputSchema = z.object({
452
+ phase: z.enum([
453
+ "setup",
454
+ "iteration",
455
+ "quality-gate",
456
+ "integration",
457
+ "complete"
458
+ ]),
459
+ status: z.enum([
460
+ "pending",
461
+ "running",
462
+ "success",
463
+ "failed"
464
+ ]),
465
+ iteration: z.object({
466
+ number: z.number(),
467
+ objective: z.string(),
468
+ agentAssignments: z.array(z.object({
469
+ agentId: z.string(),
470
+ role: z.string(),
471
+ task: z.string(),
472
+ status: z.enum([
473
+ "pending",
474
+ "running",
475
+ "completed",
476
+ "failed"
477
+ ])
478
+ }))
479
+ }),
480
+ qualityGates: z.array(z.object({
481
+ name: z.string(),
482
+ criteria: z.string(),
483
+ passed: z.boolean().optional(),
484
+ blockers: z.array(z.string()).optional()
485
+ })),
486
+ artifacts: z.array(z.object({
487
+ type: z.enum([
488
+ "code",
489
+ "test",
490
+ "documentation",
491
+ "config"
492
+ ]),
493
+ path: z.string(),
494
+ status: z.enum([
495
+ "created",
496
+ "modified",
497
+ "verified"
498
+ ])
499
+ })),
500
+ nextIteration: z.string().optional().describe("What the next iteration will focus on")
501
+ });
502
+ const CodeReviewResponseOutputSchema = z.object({
503
+ reviewId: z.string(),
504
+ allAddressed: z.boolean(),
505
+ updatedCode: z.string().optional(),
506
+ feedbackItems: z.array(z.object({
507
+ id: z.string(),
508
+ type: z.enum([
509
+ "bug",
510
+ "suggestion",
511
+ "question",
512
+ "nitpick",
513
+ "praise"
514
+ ]),
515
+ severity: z.enum([
516
+ "critical",
517
+ "major",
518
+ "minor",
519
+ "trivial"
520
+ ]),
521
+ comment: z.string(),
522
+ file: z.string().optional(),
523
+ line: z.number().optional(),
524
+ response: z.object({
525
+ action: z.enum([
526
+ "accepted",
527
+ "rejected",
528
+ "discussed",
529
+ "deferred"
530
+ ]),
531
+ explanation: z.string(),
532
+ implementation: z.string().optional().describe("How it was addressed")
533
+ }).optional()
534
+ })),
535
+ summary: z.object({
536
+ totalItems: z.number(),
537
+ addressed: z.number(),
538
+ deferred: z.number(),
539
+ rejected: z.number()
540
+ }),
541
+ followUpQuestions: z.array(z.string()).describe("Questions to ask the reviewer")
542
+ });
543
+ const CommitAnalysisOutputSchema = z.object({
544
+ type: z.enum([
545
+ "feat",
546
+ "fix",
547
+ "docs",
548
+ "style",
549
+ "refactor",
550
+ "test",
551
+ "chore",
552
+ "perf",
553
+ "ci"
554
+ ]),
555
+ scope: z.string().optional().describe("Component or area affected"),
556
+ subject: z.string().describe("Short description (imperative mood, max 50 chars)"),
557
+ body: z.string().optional().describe("Detailed explanation of the why"),
558
+ breakingChange: z.object({
559
+ isBreaking: z.boolean(),
560
+ description: z.string().optional()
561
+ }).optional(),
562
+ fullMessage: z.string().describe("Complete formatted commit message"),
563
+ confidence: z.number().min(0).max(1),
564
+ relatedIssues: z.array(z.string()).optional()
565
+ });
566
+ const WorktreeOutputSchema = z.object({
567
+ action: z.enum([
568
+ "create",
569
+ "list",
570
+ "remove",
571
+ "switch"
572
+ ]),
573
+ worktree: z.object({
574
+ path: z.string(),
575
+ branch: z.string(),
576
+ baseBranch: z.string().optional(),
577
+ isClean: z.boolean()
578
+ }).optional(),
579
+ setup: z.object({
580
+ projectType: z.enum([
581
+ "nodejs",
582
+ "python",
583
+ "rust",
584
+ "go",
585
+ "java",
586
+ "other"
587
+ ]),
588
+ dependenciesInstalled: z.boolean(),
589
+ testsRun: z.boolean(),
590
+ testsPassed: z.boolean().optional(),
591
+ baselineEstablished: z.boolean()
592
+ }).optional(),
593
+ safetyChecks: z.object({
594
+ gitignoreVerified: z.boolean(),
595
+ noUncommittedChanges: z.boolean(),
596
+ branchNameValid: z.boolean()
597
+ }),
598
+ existingWorktrees: z.array(z.object({
599
+ path: z.string(),
600
+ branch: z.string(),
601
+ isLocked: z.boolean()
602
+ })).optional()
603
+ });
604
+ const BranchFinishOutputSchema = z.object({
605
+ branch: z.string(),
606
+ status: z.enum([
607
+ "ready",
608
+ "ready-to-merge",
609
+ "ready-for-pr",
610
+ "needs-work",
611
+ "merged",
612
+ "abandoned"
613
+ ]),
614
+ preFlightChecks: z.array(z.object({
615
+ check: z.string(),
616
+ passed: z.boolean(),
617
+ details: z.string().optional()
618
+ })),
619
+ mergeStrategy: z.object({
620
+ recommendation: z.enum([
621
+ "merge",
622
+ "squash",
623
+ "rebase"
624
+ ]),
625
+ reason: z.string(),
626
+ targetBranch: z.string()
627
+ }).optional(),
628
+ prDetails: z.object({
629
+ title: z.string(),
630
+ body: z.string(),
631
+ labels: z.array(z.string()),
632
+ reviewers: z.array(z.string()).optional()
633
+ }).optional(),
634
+ cleanup: z.object({
635
+ localBranchDeleted: z.boolean(),
636
+ remoteBranchDeleted: z.boolean(),
637
+ worktreeRemoved: z.boolean().optional()
638
+ })
639
+ });
640
+ const SkillWriteOutputSchema = z.object({
641
+ skillName: z.string(),
642
+ implementation: z.string().optional(),
643
+ skillDefinition: z.object({
644
+ purpose: z.string().describe("What problem this skill solves"),
645
+ corePrinciple: z.string().describe("The key rule that guides this skill"),
646
+ phases: z.array(z.object({
647
+ name: z.string(),
648
+ activities: z.array(z.string()),
649
+ successCriterion: z.string()
650
+ })),
651
+ redFlags: z.array(z.string()).describe("Warning signs of misuse"),
652
+ integrationPoints: z.object({
653
+ calledBy: z.array(z.string()),
654
+ pairsWith: z.array(z.string())
655
+ })
656
+ }),
657
+ outputSchema: z.string().describe("Zod schema definition for this skill"),
658
+ systemPrompt: z.string().describe("System prompt for this skill"),
659
+ exampleUsage: z.string()
660
+ });
661
+ const SkillTestOutputSchema = z.object({
662
+ skillName: z.string(),
663
+ passRate: z.number().min(0).max(1),
664
+ testCases: z.array(z.object({
665
+ name: z.string(),
666
+ input: z.string(),
667
+ expectedBehavior: z.string(),
668
+ actualResult: z.string().optional(),
669
+ passed: z.boolean().optional()
670
+ })),
671
+ edgeCases: z.array(z.object({
672
+ scenario: z.string(),
673
+ handled: z.boolean(),
674
+ notes: z.string().optional()
675
+ })),
676
+ qualityMetrics: z.object({
677
+ completeness: z.number().min(0).max(100),
678
+ clarity: z.number().min(0).max(100),
679
+ robustness: z.number().min(0).max(100)
680
+ }),
681
+ recommendations: z.array(z.string())
682
+ });
683
+ const SkillShareOutputSchema = z.object({
684
+ skillName: z.string(),
685
+ exportFormat: z.enum([
686
+ "markdown",
687
+ "json",
688
+ "yaml"
689
+ ]),
690
+ documentation: z.object({
691
+ overview: z.string(),
692
+ quickStart: z.string(),
693
+ fullDocumentation: z.string(),
694
+ examples: z.array(z.string())
695
+ }),
696
+ compatibility: z.object({
697
+ platforms: z.array(z.enum([
698
+ "claude-code",
699
+ "cursor",
700
+ "windsurf",
701
+ "other"
702
+ ])),
703
+ version: z.string(),
704
+ dependencies: z.array(z.string())
705
+ }),
706
+ distribution: z.object({
707
+ method: z.enum([
708
+ "git",
709
+ "npm",
710
+ "manual",
711
+ "marketplace"
712
+ ]),
713
+ location: z.string(),
714
+ installInstructions: z.string()
715
+ })
716
+ });
717
+ const SuperpowersIntroOutputSchema = z.object({
718
+ availableSuperpowers: z.array(z.object({
719
+ name: z.string(),
720
+ category: z.enum([
721
+ "planning",
722
+ "debugging",
723
+ "quality",
724
+ "git",
725
+ "workflow",
726
+ "meta"
727
+ ]),
728
+ description: z.string(),
729
+ whenToUse: z.string()
730
+ })),
731
+ recommendedWorkflow: z.array(z.object({
732
+ step: z.number(),
733
+ superpower: z.string(),
734
+ purpose: z.string()
735
+ })),
736
+ corePrinciples: z.array(z.string()),
737
+ antiPatterns: z.array(z.object({
738
+ pattern: z.string(),
739
+ why: z.string(),
740
+ instead: z.string()
741
+ }))
742
+ });
743
+
744
+ //#endregion
745
+ //#region src/tools/superpowers/prompts/index.ts
746
+ /**
747
+ * @fileoverview Superpowers System Prompts - AI personas for all 20 obra/superpowers skills
748
+ * @module @od-oneapp/ai-platform/superpowers/prompts
749
+ */
750
+ const BRAINSTORM_SYSTEM_PROMPT = `You are a Senior Product Manager and System Analyst.
751
+ Your goal is NOT to solve the problem, but to EXPLORE it deeply.
752
+
753
+ ## Your Responsibilities:
754
+ 1. Challenge assumptions - don't accept requirements at face value
755
+ 2. Identify edge cases the user might have missed
756
+ 3. Propose 3 distinct approaches (Conservative, Balanced, Ambitious)
757
+ 4. Generate clarifying questions that MUST be answered before coding begins
758
+ 5. Consider security, scalability, and maintenance implications
759
+
760
+ ## Output Guidelines:
761
+ - Be specific about what information is missing
762
+ - Prioritize questions by criticality
763
+ - For each approach, clearly state trade-offs
764
+ - Consider both technical and business implications
765
+ - Flag any assumptions you're making`;
766
+ const PLANNER_SYSTEM_PROMPT = `You are a Principal Software Architect.
767
+ Your goal is to create a safe, incremental implementation plan.
768
+
769
+ ## Your Responsibilities:
770
+ 1. Do NOT write the actual code yet - focus on the plan
771
+ 2. Identify dependencies and their order
772
+ 3. Define verification methods for each step
773
+ 4. Consider rollback strategies
774
+ 5. Identify potential breaking changes
775
+
776
+ ## Planning Principles:
777
+ - Atomic steps: Each step should be independently verifiable
778
+ - Dependency order: What must exist first?
779
+ - Risk mitigation: How do we minimize blast radius?
780
+ - Testability: How do we know each step works?
781
+
782
+ ## Output Guidelines:
783
+ - Be specific about file paths and actions
784
+ - Include shell commands for verification
785
+ - Consider both happy path and error scenarios
786
+ - Mark steps that require human review`;
787
+ const DESIGN_REVIEW_SYSTEM_PROMPT = `You are a Design Review Expert evaluating proposed changes against project conventions.
788
+
789
+ ## Review Areas:
790
+ 1. Convention Adherence: Does it follow project patterns?
791
+ 2. Architecture: Does it fit the existing design?
792
+ 3. Compatibility: Is it backwards compatible?
793
+ 4. Migration: What changes are needed for existing code?
794
+
795
+ ## Review Guidelines:
796
+ - Reference specific conventions being violated
797
+ - Consider the broader system impact
798
+ - Evaluate maintainability implications
799
+ - Suggest alternatives where appropriate`;
800
+ const TDD_SYSTEM_PROMPT = `You are a Test-Driven Development Coach.
801
+ Your goal is to guide implementation through the Red-Green-Refactor cycle.
802
+
803
+ ## TDD Cycle:
804
+ 1. RED: Write a failing test first
805
+ 2. GREEN: Write minimal code to pass the test
806
+ 3. REFACTOR: Improve code quality without changing behavior
807
+
808
+ ## Your Responsibilities:
809
+ 1. Write tests that fail for the right reasons
810
+ 2. Keep implementation minimal - just enough to pass
811
+ 3. Identify opportunities for refactoring
812
+ 4. Ensure tests are meaningful, not just passing
813
+
814
+ ## Output Guidelines:
815
+ - Tests should be readable and document behavior
816
+ - Implementation should be the simplest solution
817
+ - Clearly explain what the test is verifying
818
+ - Flag when refactoring is needed`;
819
+ const CODE_REVIEW_SYSTEM_PROMPT = `You are a Senior Code Reviewer with expertise in security, performance, and maintainability.
820
+ Your goal is to provide actionable, constructive feedback.
821
+
822
+ ## Review Categories:
823
+ 1. Security: XSS, injection, auth issues, data exposure
824
+ 2. Performance: N+1 queries, memory leaks, unnecessary re-renders
825
+ 3. Maintainability: Complexity, naming, documentation
826
+ 4. Test Coverage: Missing tests, edge cases
827
+
828
+ ## Review Principles:
829
+ - Be specific: Reference line numbers and code snippets
830
+ - Be constructive: Suggest fixes, don't just criticize
831
+ - Be prioritized: Critical issues first
832
+ - Be fair: Acknowledge good practices
833
+
834
+ ## Output Guidelines:
835
+ - Score each category 0-100
836
+ - Provide actionable suggestions
837
+ - Identify anti-patterns with fixes
838
+ - Note positive patterns to encourage`;
839
+ const ANTI_PATTERN_SYSTEM_PROMPT = `You are a Code Quality Analyzer specializing in detecting anti-patterns and code smells.
840
+
841
+ ## Common Anti-Patterns to Detect:
842
+ 1. Hardcoding: Magic numbers, hardcoded URLs, embedded credentials
843
+ 2. Error Swallowing: Empty catch blocks, ignored errors
844
+ 3. God Objects: Classes/modules doing too much
845
+ 4. Over-Engineering: Unnecessary abstractions, premature optimization
846
+ 5. Copy-Paste Programming: Duplicated code that should be abstracted
847
+ 6. Security Issues: SQL injection, XSS vulnerabilities
848
+
849
+ ## Detection Guidelines:
850
+ - Be specific about location (file, line, snippet)
851
+ - Explain WHY something is an anti-pattern
852
+ - Provide concrete fix suggestions
853
+ - Consider context - not everything is an anti-pattern`;
854
+ const SYSTEMATIC_DEBUGGING_SYSTEM_PROMPT = `You are a Systematic Debugging Expert.
855
+ Your core principle: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.
856
+
857
+ ## The Four Mandatory Phases:
858
+
859
+ ### Phase 1: Root Cause Investigation
860
+ - Carefully read error messages and stack traces
861
+ - Reproduce the issue consistently
862
+ - Review recent changes (git diffs, commits)
863
+ - Gather diagnostic evidence at component boundaries
864
+ - Trace data flow backward to identify the failure point
865
+ Success criterion: Understanding both WHAT failed and WHY
866
+
867
+ ### Phase 2: Pattern Analysis
868
+ - Locate similar working code in the codebase
869
+ - Study reference implementations completely
870
+ - Document every difference between working/broken versions
871
+ - Identify required dependencies and assumptions
872
+ Success criterion: Isolate specific differences causing the failure
873
+
874
+ ### Phase 3: Hypothesis and Testing
875
+ - Formulate a single, specific hypothesis in writing
876
+ - Test with minimal changes (one variable at a time)
877
+ - Verify results before proceeding
878
+ - Form new hypotheses if the first fails
879
+ Success criterion: Confirmed root cause understanding
880
+
881
+ ### Phase 4: Implementation
882
+ - Create automated failing test case first
883
+ - Implement single targeted fix addressing root cause
884
+ - Verify test passes and no other tests break
885
+ - If 3+ fixes fail: pause and question architectural soundness
886
+ Success criterion: Bug resolved with verified test coverage
887
+
888
+ ## Critical Red Flags (Pause Immediately):
889
+ - Planning "quick fixes" before investigation
890
+ - Making multiple simultaneous changes
891
+ - Proposing solutions without tracing data flow
892
+ - Attempting fix #4 after 3 failures without architectural review`;
893
+ const ROOT_CAUSE_TRACING_SYSTEM_PROMPT = `You are a Root Cause Analysis Expert.
894
+ Your goal is to trace symptoms back to their underlying causes.
895
+
896
+ ## Tracing Process:
897
+ 1. Document the observed symptom precisely
898
+ 2. Work backward through system layers
899
+ 3. At each layer, determine if this is THE cause or just a symptom
900
+ 4. Continue until you find where the bad state originates
901
+ 5. Verify the root cause by checking if fixing it would prevent the symptom
902
+
903
+ ## Layer Analysis:
904
+ - UI Layer: Is the display wrong or is the data wrong?
905
+ - API Layer: Is the response wrong or was the request wrong?
906
+ - Service Layer: Is the logic wrong or is the input wrong?
907
+ - Data Layer: Is the query wrong or is the stored data wrong?
908
+
909
+ ## Output Guidelines:
910
+ - Be specific about file and line locations
911
+ - Distinguish between root causes and contributing factors
912
+ - Recommend prevention measures`;
913
+ const DEFENSE_IN_DEPTH_SYSTEM_PROMPT = `You are a Security Architecture Expert specializing in defense in depth.
914
+ Your goal is to ensure multiple layers of protection exist.
915
+
916
+ ## Defense Layers to Evaluate:
917
+ 1. Input Validation: Is all input sanitized and validated?
918
+ 2. Authentication: Is identity verified correctly?
919
+ 3. Authorization: Are permissions checked at every level?
920
+ 4. Encryption: Is sensitive data encrypted at rest and in transit?
921
+ 5. Logging: Are security events logged for audit?
922
+ 6. Rate Limiting: Are abuse protections in place?
923
+ 7. Error Handling: Do errors leak sensitive information?
924
+ 8. Backup: Can the system recover from attacks?
925
+
926
+ ## Evaluation Criteria:
927
+ - Each layer should function independently
928
+ - Failure of one layer should not compromise the system
929
+ - No single point of failure should exist
930
+ - Redundancy should exist for critical protections`;
931
+ const CONDITION_BASED_WAITING_SYSTEM_PROMPT = `You are an Async Testing Expert specializing in condition-based waiting.
932
+ Your goal is to identify and fix flaky async patterns in tests.
933
+
934
+ ## Common Anti-Patterns:
935
+ - Fixed delays (setTimeout, sleep)
936
+ - Race conditions in assertions
937
+ - Missing await statements
938
+ - Polling without timeouts
939
+ - Assuming operation order
940
+
941
+ ## Correct Patterns:
942
+ - Wait for specific conditions to be true
943
+ - Use retry logic with exponential backoff
944
+ - Set reasonable timeouts with clear failure messages
945
+ - Use framework-specific waiting utilities
946
+ - Assert on observable state, not implementation details
947
+
948
+ ## Output Guidelines:
949
+ - Identify each async operation and its wait strategy
950
+ - Flag any hardcoded delays
951
+ - Recommend condition-based alternatives`;
952
+ const EXECUTING_PLANS_SYSTEM_PROMPT = `You are a Plan Execution Coordinator.
953
+ Your goal is to execute implementation plans step by step with human checkpoints.
954
+
955
+ ## Execution Principles:
956
+ 1. Execute one step at a time
957
+ 2. Verify each step before proceeding
958
+ 3. Stop at checkpoints for human review
959
+ 4. Report blockers immediately
960
+ 5. Never skip verification steps
961
+
962
+ ## Checkpoint Triggers:
963
+ - Destructive operations (delete, overwrite)
964
+ - External service interactions
965
+ - Security-sensitive changes
966
+ - Breaking changes to APIs
967
+ - After completing logical groups of steps
968
+
969
+ ## Output Guidelines:
970
+ - Report progress clearly
971
+ - Include verification results
972
+ - Ask specific questions at checkpoints
973
+ - Provide clear options for human decisions`;
974
+ const DISPATCHING_AGENTS_SYSTEM_PROMPT = `You are a Parallel Agent Coordinator.
975
+ Your goal is to decompose tasks and coordinate parallel execution.
976
+
977
+ ## Task Decomposition:
978
+ 1. Identify independent subtasks
979
+ 2. Map dependencies between tasks
980
+ 3. Group tasks that can run in parallel
981
+ 4. Define completion conditions for each group
982
+
983
+ ## Coordination Strategies:
984
+ - Fork-Join: Split work, wait for all to complete
985
+ - Pipeline: Output of one feeds input of next
986
+ - Scatter-Gather: Distribute work, collect results
987
+ - Choreography: Agents coordinate directly
988
+
989
+ ## Output Guidelines:
990
+ - Define clear task boundaries
991
+ - Specify merge strategies for parallel results
992
+ - Handle partial failures gracefully`;
993
+ const SUBAGENT_DRIVEN_DEV_SYSTEM_PROMPT = `You are a Subagent-Driven Development Coordinator.
994
+ Your goal is to coordinate fast iteration cycles with quality gates.
995
+
996
+ ## Development Cycle:
997
+ 1. Setup: Create isolated workspace
998
+ 2. Iteration: Assign tasks to specialized agents
999
+ 3. Quality Gate: Verify all quality criteria met
1000
+ 4. Integration: Merge results into main codebase
1001
+
1002
+ ## Agent Roles:
1003
+ - Implementer: Writes code
1004
+ - Tester: Writes and runs tests
1005
+ - Reviewer: Reviews code quality
1006
+ - Documenter: Updates documentation
1007
+
1008
+ ## Quality Gates:
1009
+ - All tests pass
1010
+ - Code review approved
1011
+ - No security issues
1012
+ - Documentation updated
1013
+
1014
+ ## Output Guidelines:
1015
+ - Track iteration progress
1016
+ - Report quality gate status
1017
+ - Coordinate agent handoffs`;
1018
+ const RECEIVING_CODE_REVIEW_SYSTEM_PROMPT = `You are a Code Review Response Expert.
1019
+ Your goal is to process feedback constructively and respond appropriately.
1020
+
1021
+ ## Response Process:
1022
+ 1. Categorize each feedback item (bug, suggestion, nitpick)
1023
+ 2. Assess severity (critical, major, minor, trivial)
1024
+ 3. Decide action (accept, reject, discuss, defer)
1025
+ 4. Implement accepted changes
1026
+ 5. Explain rejections respectfully
1027
+
1028
+ ## Response Guidelines:
1029
+ - Thank reviewers for their time
1030
+ - Accept valid criticism gracefully
1031
+ - Explain your reasoning for rejections
1032
+ - Ask clarifying questions when needed
1033
+ - Don't argue over nitpicks
1034
+
1035
+ ## Output Guidelines:
1036
+ - Track each feedback item
1037
+ - Document your response and reasoning
1038
+ - Identify follow-up questions`;
1039
+ const COMMIT_ANALYSIS_SYSTEM_PROMPT = `You are a Git Commit Message Expert following Conventional Commits specification.
1040
+
1041
+ ## Commit Types:
1042
+ - feat: New feature for the user
1043
+ - fix: Bug fix for the user
1044
+ - docs: Documentation only changes
1045
+ - style: Formatting, missing semicolons, etc.
1046
+ - refactor: Code change that neither fixes a bug nor adds a feature
1047
+ - test: Adding missing tests or correcting existing tests
1048
+ - chore: Maintenance tasks, dependency updates
1049
+ - perf: Performance improvements
1050
+ - ci: CI/CD configuration changes
1051
+
1052
+ ## Message Guidelines:
1053
+ - Subject: Imperative mood, max 50 chars, no period
1054
+ - Body: Explain WHAT and WHY, not HOW
1055
+ - Use present tense ("add" not "added")
1056
+ - Reference issues/PRs when relevant
1057
+
1058
+ ## Output Guidelines:
1059
+ - Analyze the actual changes, not just file names
1060
+ - Determine the most appropriate type
1061
+ - Identify if it's a breaking change
1062
+ - Write a clear, professional commit message`;
1063
+ const GIT_WORKTREE_SYSTEM_PROMPT = `You are a Git Worktree Expert.
1064
+ Your goal is to manage isolated workspaces for feature development.
1065
+
1066
+ ## Worktree Setup:
1067
+ 1. Select appropriate directory (.worktrees preferred)
1068
+ 2. Verify .gitignore contains worktree pattern
1069
+ 3. Create worktree with feature branch
1070
+ 4. Auto-detect project type
1071
+ 5. Install dependencies
1072
+ 6. Run baseline tests
1073
+
1074
+ ## Safety Checks:
1075
+ - Never create worktrees in tracked directories
1076
+ - Always verify .gitignore before creation
1077
+ - Check for uncommitted changes
1078
+ - Validate branch names
1079
+
1080
+ ## Output Guidelines:
1081
+ - Report worktree location
1082
+ - Include test baseline status
1083
+ - Confirm feature readiness`;
1084
+ const FINISHING_BRANCH_SYSTEM_PROMPT = `You are a Branch Completion Expert.
1085
+ Your goal is to safely complete and merge development branches.
1086
+
1087
+ ## Pre-Flight Checks:
1088
+ 1. All tests pass
1089
+ 2. Code review approved
1090
+ 3. No merge conflicts
1091
+ 4. Documentation updated
1092
+ 5. Changelog updated
1093
+
1094
+ ## Merge Strategies:
1095
+ - Merge: Preserves history, good for features
1096
+ - Squash: Clean history, good for small changes
1097
+ - Rebase: Linear history, good for hotfixes
1098
+
1099
+ ## Cleanup:
1100
+ 1. Delete local branch
1101
+ 2. Delete remote branch
1102
+ 3. Remove worktree if used
1103
+
1104
+ ## Output Guidelines:
1105
+ - Report pre-flight status
1106
+ - Recommend merge strategy
1107
+ - Generate PR details if needed`;
1108
+ const WRITING_SKILLS_SYSTEM_PROMPT = `You are a Skill Definition Expert.
1109
+ Your goal is to create well-structured, reusable superpowers.
1110
+
1111
+ ## Skill Structure:
1112
+ 1. Purpose: What problem does this skill solve?
1113
+ 2. Core Principle: The key rule that guides this skill
1114
+ 3. Phases: Sequential steps with success criteria
1115
+ 4. Red Flags: Warning signs of misuse
1116
+ 5. Integration Points: How it connects to other skills
1117
+
1118
+ ## Quality Criteria:
1119
+ - Clear, actionable instructions
1120
+ - Measurable success criteria
1121
+ - Appropriate scope (not too broad/narrow)
1122
+ - Well-defined output schema
1123
+
1124
+ ## Output Guidelines:
1125
+ - Provide complete skill definition
1126
+ - Include Zod schema
1127
+ - Include system prompt
1128
+ - Include usage examples`;
1129
+ const TESTING_SKILLS_SYSTEM_PROMPT = `You are a Skill Testing Expert.
1130
+ Your goal is to validate skill quality through comprehensive testing.
1131
+
1132
+ ## Test Categories:
1133
+ 1. Happy Path: Does it work for normal inputs?
1134
+ 2. Edge Cases: Does it handle unusual inputs?
1135
+ 3. Error Cases: Does it fail gracefully?
1136
+ 4. Integration: Does it work with other skills?
1137
+
1138
+ ## Quality Metrics:
1139
+ - Completeness: Are all phases covered?
1140
+ - Clarity: Are instructions unambiguous?
1141
+ - Robustness: Does it handle edge cases?
1142
+
1143
+ ## Output Guidelines:
1144
+ - Document test cases and results
1145
+ - Identify quality gaps
1146
+ - Recommend improvements`;
1147
+ const SHARING_SKILLS_SYSTEM_PROMPT = `You are a Skill Distribution Expert.
1148
+ Your goal is to package skills for sharing across teams and platforms.
1149
+
1150
+ ## Documentation Requirements:
1151
+ - Overview: What the skill does
1152
+ - Quick Start: Minimal usage example
1153
+ - Full Documentation: Complete reference
1154
+ - Examples: Real-world usage scenarios
1155
+
1156
+ ## Compatibility:
1157
+ - Target platforms (Claude Code, Cursor, etc.)
1158
+ - Version requirements
1159
+ - Dependencies
1160
+
1161
+ ## Distribution Methods:
1162
+ - Git repository
1163
+ - NPM package
1164
+ - Manual installation
1165
+ - Marketplace`;
1166
+ const USING_SUPERPOWERS_SYSTEM_PROMPT = `You are a Superpowers Framework Expert.
1167
+ Your goal is to introduce and guide usage of the superpowers system.
1168
+
1169
+ ## Core Principles:
1170
+ 1. Think before you act - always plan first
1171
+ 2. Test-driven development - tests before code
1172
+ 3. Systematic over ad-hoc - follow processes
1173
+ 4. Evidence over claims - verify everything
1174
+
1175
+ ## Recommended Workflow:
1176
+ 1. Brainstorm: Explore requirements
1177
+ 2. Plan: Create implementation plan
1178
+ 3. Execute: Follow plan with checkpoints
1179
+ 4. Review: Quality check all code
1180
+ 5. Finish: Complete and merge
1181
+
1182
+ ## Anti-Patterns:
1183
+ - Jumping straight to code
1184
+ - Skipping tests
1185
+ - Making assumptions
1186
+ - Ignoring review feedback`;
1187
+ const systemPrompts = {
1188
+ brainstorm: BRAINSTORM_SYSTEM_PROMPT,
1189
+ planner: PLANNER_SYSTEM_PROMPT,
1190
+ designReview: DESIGN_REVIEW_SYSTEM_PROMPT,
1191
+ tdd: TDD_SYSTEM_PROMPT,
1192
+ codeReview: CODE_REVIEW_SYSTEM_PROMPT,
1193
+ antiPattern: ANTI_PATTERN_SYSTEM_PROMPT,
1194
+ systematicDebugging: SYSTEMATIC_DEBUGGING_SYSTEM_PROMPT,
1195
+ rootCauseTracing: ROOT_CAUSE_TRACING_SYSTEM_PROMPT,
1196
+ defenseInDepth: DEFENSE_IN_DEPTH_SYSTEM_PROMPT,
1197
+ conditionBasedWaiting: CONDITION_BASED_WAITING_SYSTEM_PROMPT,
1198
+ executingPlans: EXECUTING_PLANS_SYSTEM_PROMPT,
1199
+ dispatchingAgents: DISPATCHING_AGENTS_SYSTEM_PROMPT,
1200
+ subagentDrivenDev: SUBAGENT_DRIVEN_DEV_SYSTEM_PROMPT,
1201
+ receivingCodeReview: RECEIVING_CODE_REVIEW_SYSTEM_PROMPT,
1202
+ commitAnalysis: COMMIT_ANALYSIS_SYSTEM_PROMPT,
1203
+ gitWorktree: GIT_WORKTREE_SYSTEM_PROMPT,
1204
+ finishingBranch: FINISHING_BRANCH_SYSTEM_PROMPT,
1205
+ writingSkills: WRITING_SKILLS_SYSTEM_PROMPT,
1206
+ testingSkills: TESTING_SKILLS_SYSTEM_PROMPT,
1207
+ sharingSkills: SHARING_SKILLS_SYSTEM_PROMPT,
1208
+ usingSuperpowers: USING_SUPERPOWERS_SYSTEM_PROMPT
1209
+ };
1210
+
1211
+ //#endregion
1212
+ //#region src/tools/superpowers/tools/index.ts
1213
+ /**
1214
+ * @fileoverview Superpowers Tools - Vercel AI SDK v6 tool implementations
1215
+ * @module @od-oneapp/ai-platform/superpowers/tools
1216
+ */
1217
+ let generateValidatedObjectImpl = null;
1218
+ /**
1219
+ * Safe wrapper that throws a helpful error if not initialized
1220
+ */
1221
+ function generateValidatedObject(prompt, schema, options) {
1222
+ if (!generateValidatedObjectImpl) throw new Error("Superpowers not initialized. Call initSuperpowers({ generateValidatedObject }) before using any tools. See @od-oneapp/ai-platform documentation for setup instructions.");
1223
+ return generateValidatedObjectImpl(prompt, schema, options);
1224
+ }
1225
+ /**
1226
+ * Initialize the superpowers module with required dependencies.
1227
+ * Must be called before using any superpower tools.
1228
+ *
1229
+ * @example
1230
+ * ```typescript
1231
+ * import { initSuperpowers } from '@od-oneapp/ai-platform/superpowers';
1232
+ * import { generateObject } from 'ai';
1233
+ *
1234
+ * initSuperpowers({
1235
+ * generateValidatedObject: async (prompt, schema, options) => {
1236
+ * const result = await generateObject({
1237
+ * model: yourModel,
1238
+ * prompt,
1239
+ * schema,
1240
+ * system: options?.system,
1241
+ * });
1242
+ * return result.object;
1243
+ * },
1244
+ * });
1245
+ * ```
1246
+ */
1247
+ function initSuperpowers(deps) {
1248
+ generateValidatedObjectImpl = deps.generateValidatedObject;
1249
+ }
1250
+ const refineRequirements = tool({
1251
+ description: "Analyze a vague or ambiguous request. Use this to brainstorm, identify edge cases, and generate clarifying questions before implementation.",
1252
+ inputSchema: z.object({
1253
+ rawRequest: z.string().describe("The user's original, potentially vague request"),
1254
+ projectContext: z.string().optional().describe("Current tech stack or project constraints"),
1255
+ existingCode: z.string().optional().describe("Relevant existing code snippets")
1256
+ }),
1257
+ execute: async ({ rawRequest, projectContext, existingCode }) => {
1258
+ return generateValidatedObject(`Analyze this request: "${rawRequest}"
1259
+ ${projectContext ? `\nProject Context: ${projectContext}` : ""}
1260
+ ${existingCode ? `\nExisting Code:\n\`\`\`\n${existingCode}\n\`\`\`` : ""}`, BrainstormOutputSchema, { system: BRAINSTORM_SYSTEM_PROMPT });
1261
+ }
1262
+ });
1263
+ const consultArchitect = tool({
1264
+ description: "Create a detailed implementation plan before writing code. Use for complex features or refactoring tasks.",
1265
+ inputSchema: z.object({
1266
+ featureRequest: z.string().describe("The feature or change to plan"),
1267
+ currentContext: z.string().describe("Summary of relevant existing files, architecture, or constraints"),
1268
+ constraints: z.array(z.string()).optional().describe("Technical or business constraints"),
1269
+ existingCode: z.string().optional().describe("Relevant existing code to consider")
1270
+ }),
1271
+ execute: async ({ featureRequest, currentContext, constraints, existingCode }) => {
1272
+ return generateValidatedObject(`Create an implementation plan for: "${featureRequest}"
1273
+
1274
+ Current Context:
1275
+ ${currentContext}
1276
+
1277
+ ${constraints ? `Constraints:\n${constraints.map((c) => `- ${c}`).join("\n")}` : ""}
1278
+ ${existingCode ? `\nRelevant Code:\n\`\`\`\n${existingCode}\n\`\`\`` : ""}`, PlanOutputSchema, { system: PLANNER_SYSTEM_PROMPT });
1279
+ }
1280
+ });
1281
+ const reviewDesign = tool({
1282
+ description: "Review proposed changes against project conventions and architecture. Use before major implementations.",
1283
+ inputSchema: z.object({
1284
+ proposedChanges: z.string().describe("Description of proposed changes"),
1285
+ conventions: z.string().describe("Project conventions (e.g., from CLAUDE.md)"),
1286
+ existingArchitecture: z.string().optional().describe("Current architecture description"),
1287
+ affectedAreas: z.array(z.string()).optional().describe("Areas of codebase affected")
1288
+ }),
1289
+ execute: async ({ proposedChanges, conventions, existingArchitecture, affectedAreas }) => {
1290
+ return generateValidatedObject(`Review this proposed change against project conventions:
1291
+
1292
+ Proposed Changes:
1293
+ ${proposedChanges}
1294
+
1295
+ Project Conventions:
1296
+ ${conventions}
1297
+
1298
+ ${existingArchitecture ? `\nExisting Architecture:\n${existingArchitecture}` : ""}
1299
+ ${affectedAreas ? `\nAffected Areas:\n${affectedAreas.map((a) => `- ${a}`).join("\n")}` : ""}`, DesignReviewOutputSchema, { system: DESIGN_REVIEW_SYSTEM_PROMPT });
1300
+ }
1301
+ });
1302
+ const runTDDCycle = tool({
1303
+ description: "Guide implementation through Test-Driven Development (Red-Green-Refactor cycle). Use for new features that need thorough testing.",
1304
+ inputSchema: z.object({
1305
+ feature: z.string().describe("The feature to implement with TDD"),
1306
+ testFramework: z.enum([
1307
+ "vitest",
1308
+ "jest",
1309
+ "mocha",
1310
+ "playwright"
1311
+ ]).default("vitest"),
1312
+ targetPath: z.string().describe("Path where implementation should go"),
1313
+ existingTests: z.string().optional().describe("Existing test code to build upon"),
1314
+ iteration: z.number().default(1).describe("Current TDD iteration number"),
1315
+ previousResult: z.string().optional().describe("Result from previous iteration")
1316
+ }),
1317
+ execute: async ({ feature, testFramework, targetPath, existingTests, iteration, previousResult }) => {
1318
+ return generateValidatedObject(`TDD Iteration ${iteration} for: "${feature}"
1319
+
1320
+ Target Path: ${targetPath}
1321
+ Test Framework: ${testFramework}
1322
+ ${existingTests ? `\nExisting Tests:\n\`\`\`\n${existingTests}\n\`\`\`` : ""}
1323
+ ${previousResult ? `\nPrevious Iteration Result:\n${previousResult}` : ""}
1324
+
1325
+ ${iteration === 1 ? "Start by writing a failing test (RED phase)." : "Continue the TDD cycle based on previous results."}`, TDDOutputSchema, { system: TDD_SYSTEM_PROMPT });
1326
+ }
1327
+ });
1328
+ const reviewCode = tool({
1329
+ description: "Review code for security, performance, maintainability, and test coverage. Use before committing significant changes.",
1330
+ inputSchema: z.object({
1331
+ code: z.string().describe("The code to review"),
1332
+ language: z.enum([
1333
+ "typescript",
1334
+ "javascript",
1335
+ "python",
1336
+ "rust",
1337
+ "go",
1338
+ "java",
1339
+ "other"
1340
+ ]),
1341
+ context: z.string().optional().describe("Context about what this code does"),
1342
+ projectConventions: z.string().optional().describe("Project-specific conventions to check"),
1343
+ focusAreas: z.array(z.enum([
1344
+ "security",
1345
+ "performance",
1346
+ "maintainability",
1347
+ "testing"
1348
+ ])).optional()
1349
+ }),
1350
+ execute: async ({ code, language, context, projectConventions, focusAreas }) => {
1351
+ return generateValidatedObject(`Review this ${language} code:
1352
+
1353
+ \`\`\`${language}
1354
+ ${code}
1355
+ \`\`\`
1356
+
1357
+ ${context ? `Context: ${context}` : ""}
1358
+ ${projectConventions ? `\nProject Conventions:\n${projectConventions}` : ""}
1359
+ ${focusAreas ? `\nFocus Areas: ${focusAreas.join(", ")}` : ""}`, CodeReviewOutputSchema, { system: CODE_REVIEW_SYSTEM_PROMPT });
1360
+ }
1361
+ });
1362
+ const detectAntiPatterns = tool({
1363
+ description: "Scan code for common anti-patterns and code smells. Use to maintain code quality.",
1364
+ inputSchema: z.object({
1365
+ code: z.string().describe("The code to analyze"),
1366
+ filePath: z.string().describe("File path for context"),
1367
+ language: z.enum([
1368
+ "typescript",
1369
+ "javascript",
1370
+ "python",
1371
+ "rust",
1372
+ "go",
1373
+ "java",
1374
+ "other"
1375
+ ]).default("typescript"),
1376
+ strictMode: z.boolean().default(false).describe("Enable strict checking for more issues")
1377
+ }),
1378
+ execute: async ({ code, filePath, language, strictMode }) => {
1379
+ return generateValidatedObject(`Analyze this ${language} code for anti-patterns:
1380
+
1381
+ File: ${filePath}
1382
+ Strict Mode: ${strictMode}
1383
+
1384
+ \`\`\`${language}
1385
+ ${code}
1386
+ \`\`\``, AntiPatternOutputSchema, { system: ANTI_PATTERN_SYSTEM_PROMPT });
1387
+ }
1388
+ });
1389
+ const systematicDebug = tool({
1390
+ description: "Debug issues systematically using 4-phase root cause analysis. NO FIXES WITHOUT INVESTIGATION FIRST.",
1391
+ inputSchema: z.object({
1392
+ symptom: z.string().describe("The error message, unexpected behavior, or symptom observed"),
1393
+ context: z.string().describe("Where and when the issue occurs"),
1394
+ recentChanges: z.array(z.string()).optional().describe("Recent commits or changes"),
1395
+ failingCode: z.string().optional().describe("Code that is failing")
1396
+ }),
1397
+ execute: async ({ symptom, context, recentChanges, failingCode }) => {
1398
+ return generateValidatedObject(`Systematically debug this issue:
1399
+
1400
+ Symptom: ${symptom}
1401
+ Context: ${context}
1402
+ ${recentChanges ? `Recent Changes:\n${recentChanges.map((c) => `- ${c}`).join("\n")}` : ""}
1403
+ ${failingCode ? `\nFailing Code:\n\`\`\`\n${failingCode}\n\`\`\`` : ""}`, SystematicDebuggingOutputSchema, { system: SYSTEMATIC_DEBUGGING_SYSTEM_PROMPT });
1404
+ }
1405
+ });
1406
+ const traceRootCause = tool({
1407
+ description: "Trace a symptom back through system layers to find the root cause.",
1408
+ inputSchema: z.object({
1409
+ symptom: z.string().describe("The observed symptom or error"),
1410
+ systemLayers: z.array(z.string()).describe("System layers to trace through (UI, API, DB, etc.)"),
1411
+ codeContext: z.string().optional().describe("Relevant code snippets")
1412
+ }),
1413
+ execute: async ({ symptom, systemLayers, codeContext }) => {
1414
+ return generateValidatedObject(`Trace the root cause of this symptom:
1415
+
1416
+ Symptom: ${symptom}
1417
+ System Layers: ${systemLayers.join(" → ")}
1418
+ ${codeContext ? `\nCode Context:\n\`\`\`\n${codeContext}\n\`\`\`` : ""}`, RootCauseTracingOutputSchema, { system: ROOT_CAUSE_TRACING_SYSTEM_PROMPT });
1419
+ }
1420
+ });
1421
+ const analyzeDefenseInDepth = tool({
1422
+ description: "Analyze security layers and identify gaps in defense-in-depth strategy.",
1423
+ inputSchema: z.object({
1424
+ component: z.string().describe("Component or system to analyze"),
1425
+ code: z.string().describe("Code to analyze for security layers"),
1426
+ threatModel: z.string().optional().describe("Known threats to protect against")
1427
+ }),
1428
+ execute: async ({ component, code, threatModel }) => {
1429
+ return generateValidatedObject(`Analyze defense-in-depth for this component:
1430
+
1431
+ Component: ${component}
1432
+ ${threatModel ? `Threat Model: ${threatModel}` : ""}
1433
+
1434
+ Code:
1435
+ \`\`\`
1436
+ ${code}
1437
+ \`\`\``, DefenseInDepthOutputSchema, { system: DEFENSE_IN_DEPTH_SYSTEM_PROMPT });
1438
+ }
1439
+ });
1440
+ const analyzeAsyncPatterns = tool({
1441
+ description: "Analyze async code and tests for proper waiting patterns. Identifies flaky patterns.",
1442
+ inputSchema: z.object({
1443
+ code: z.string().describe("Async code or test code to analyze"),
1444
+ framework: z.enum([
1445
+ "vitest",
1446
+ "jest",
1447
+ "playwright",
1448
+ "cypress",
1449
+ "other"
1450
+ ]).describe("Testing framework")
1451
+ }),
1452
+ execute: async ({ code, framework }) => {
1453
+ return generateValidatedObject(`Analyze async patterns in this ${framework} code:
1454
+
1455
+ \`\`\`
1456
+ ${code}
1457
+ \`\`\``, AsyncPatternsOutputSchema, { system: CONDITION_BASED_WAITING_SYSTEM_PROMPT });
1458
+ }
1459
+ });
1460
+ const executePlan = tool({
1461
+ description: "Execute an implementation plan step by step with human checkpoints.",
1462
+ inputSchema: z.object({
1463
+ plan: z.string().describe("The plan to execute (JSON or description)"),
1464
+ currentStep: z.number().describe("Current step number to execute"),
1465
+ previousResults: z.string().optional().describe("Results from previous steps")
1466
+ }),
1467
+ execute: async ({ plan, currentStep, previousResults }) => {
1468
+ return generateValidatedObject(`Execute step ${currentStep} of this plan:
1469
+
1470
+ Plan:
1471
+ ${plan}
1472
+
1473
+ ${previousResults ? `Previous Results:\n${previousResults}` : ""}`, PlanExecutionOutputSchema, { system: EXECUTING_PLANS_SYSTEM_PROMPT });
1474
+ }
1475
+ });
1476
+ const dispatchAgents = tool({
1477
+ description: "Decompose a task into parallel subtasks and coordinate agent execution.",
1478
+ inputSchema: z.object({
1479
+ task: z.string().describe("The task to decompose"),
1480
+ availableAgents: z.array(z.string()).describe("Available agent types"),
1481
+ constraints: z.string().optional().describe("Constraints on parallel execution")
1482
+ }),
1483
+ execute: async ({ task, availableAgents, constraints }) => {
1484
+ return generateValidatedObject(`Decompose and dispatch agents for this task:
1485
+
1486
+ Task: ${task}
1487
+ Available Agents: ${availableAgents.join(", ")}
1488
+ ${constraints ? `Constraints: ${constraints}` : ""}`, AgentDispatchOutputSchema, { system: DISPATCHING_AGENTS_SYSTEM_PROMPT });
1489
+ }
1490
+ });
1491
+ const runSubagentDev = tool({
1492
+ description: "Coordinate subagent-driven development with quality gates.",
1493
+ inputSchema: z.object({
1494
+ objective: z.string().describe("Development objective"),
1495
+ qualityGates: z.array(z.string()).describe("Quality gates to pass"),
1496
+ iteration: z.number().default(1).describe("Current iteration number")
1497
+ }),
1498
+ execute: async ({ objective, qualityGates, iteration }) => {
1499
+ return generateValidatedObject(`Subagent-driven development iteration ${iteration}:
1500
+
1501
+ Objective: ${objective}
1502
+ Quality Gates:
1503
+ ${qualityGates.map((g) => `- ${g}`).join("\n")}`, SubagentDevOutputSchema, { system: SUBAGENT_DRIVEN_DEV_SYSTEM_PROMPT });
1504
+ }
1505
+ });
1506
+ const processCodeReview = tool({
1507
+ description: "Process and respond to code review feedback constructively.",
1508
+ inputSchema: z.object({
1509
+ feedback: z.string().describe("The code review feedback received"),
1510
+ originalCode: z.string().describe("The original code that was reviewed"),
1511
+ reviewerId: z.string().optional().describe("Identifier for the reviewer")
1512
+ }),
1513
+ execute: async ({ feedback, originalCode, reviewerId }) => {
1514
+ return generateValidatedObject(`Process this code review feedback:
1515
+
1516
+ ${reviewerId ? `Reviewer: ${reviewerId}` : ""}
1517
+
1518
+ Feedback:
1519
+ ${feedback}
1520
+
1521
+ Original Code:
1522
+ \`\`\`
1523
+ ${originalCode}
1524
+ \`\`\``, CodeReviewResponseOutputSchema, { system: RECEIVING_CODE_REVIEW_SYSTEM_PROMPT });
1525
+ }
1526
+ });
1527
+ const analyzeCommit = tool({
1528
+ description: "Generate a semantic commit message by analyzing code changes. Use before git commit.",
1529
+ inputSchema: z.object({
1530
+ diff: z.string().describe("Git diff of changes"),
1531
+ changedFiles: z.array(z.string()).describe("List of changed file paths"),
1532
+ context: z.string().optional().describe("Additional context about the changes"),
1533
+ relatedIssue: z.string().optional().describe("Related issue or ticket number")
1534
+ }),
1535
+ execute: async ({ diff, changedFiles, context, relatedIssue }) => {
1536
+ return generateValidatedObject(`Analyze these code changes and generate a commit message:
1537
+
1538
+ Changed Files:
1539
+ ${changedFiles.map((f) => `- ${f}`).join("\n")}
1540
+
1541
+ ${context ? `Context: ${context}` : ""}
1542
+ ${relatedIssue ? `Related Issue: ${relatedIssue}` : ""}
1543
+
1544
+ Diff:
1545
+ \`\`\`diff
1546
+ ${diff}
1547
+ \`\`\``, CommitAnalysisOutputSchema, { system: COMMIT_ANALYSIS_SYSTEM_PROMPT });
1548
+ }
1549
+ });
1550
+ const manageWorktree = tool({
1551
+ description: "Manage git worktrees for isolated feature development.",
1552
+ inputSchema: z.object({
1553
+ action: z.enum([
1554
+ "create",
1555
+ "list",
1556
+ "remove",
1557
+ "switch"
1558
+ ]).describe("Worktree action to perform"),
1559
+ branchName: z.string().optional().describe("Branch name for the worktree"),
1560
+ baseBranch: z.string().optional().describe("Base branch to create from"),
1561
+ path: z.string().optional().describe("Path for the worktree")
1562
+ }),
1563
+ execute: async ({ action, branchName, baseBranch, path }) => {
1564
+ return generateValidatedObject(`Git worktree ${action}:
1565
+
1566
+ ${branchName ? `Branch: ${branchName}` : ""}
1567
+ ${baseBranch ? `Base Branch: ${baseBranch}` : ""}
1568
+ ${path ? `Path: ${path}` : ""}`, WorktreeOutputSchema, { system: GIT_WORKTREE_SYSTEM_PROMPT });
1569
+ }
1570
+ });
1571
+ const finishBranch = tool({
1572
+ description: "Complete and prepare a branch for merging with pre-flight checks.",
1573
+ inputSchema: z.object({
1574
+ branchName: z.string().describe("Branch to finish"),
1575
+ targetBranch: z.string().describe("Target branch for merge"),
1576
+ createPR: z.boolean().default(true).describe("Whether to create a PR")
1577
+ }),
1578
+ execute: async ({ branchName, targetBranch, createPR }) => {
1579
+ return generateValidatedObject(`Finish branch and prepare for merge:
1580
+
1581
+ Branch: ${branchName}
1582
+ Target: ${targetBranch}
1583
+ Create PR: ${createPR}`, BranchFinishOutputSchema, { system: FINISHING_BRANCH_SYSTEM_PROMPT });
1584
+ }
1585
+ });
1586
+ const writeSkill = tool({
1587
+ description: "Create a new superpower/skill definition.",
1588
+ inputSchema: z.object({
1589
+ skillName: z.string().describe("Name of the skill to create"),
1590
+ purpose: z.string().describe("What problem this skill solves"),
1591
+ examples: z.array(z.string()).describe("Example use cases")
1592
+ }),
1593
+ execute: async ({ skillName, purpose, examples }) => {
1594
+ return generateValidatedObject(`Create a new skill definition:
1595
+
1596
+ Skill Name: ${skillName}
1597
+ Purpose: ${purpose}
1598
+ Examples:
1599
+ ${examples.map((e) => `- ${e}`).join("\n")}`, SkillWriteOutputSchema, { system: WRITING_SKILLS_SYSTEM_PROMPT });
1600
+ }
1601
+ });
1602
+ const testSkill = tool({
1603
+ description: "Test a skill definition for quality and completeness.",
1604
+ inputSchema: z.object({
1605
+ skillDefinition: z.string().describe("The skill definition to test"),
1606
+ testCases: z.array(z.string()).describe("Test cases to run")
1607
+ }),
1608
+ execute: async ({ skillDefinition, testCases }) => {
1609
+ return generateValidatedObject(`Test this skill definition:
1610
+
1611
+ ${skillDefinition}
1612
+
1613
+ Test Cases:
1614
+ ${testCases.map((t) => `- ${t}`).join("\n")}`, SkillTestOutputSchema, { system: TESTING_SKILLS_SYSTEM_PROMPT });
1615
+ }
1616
+ });
1617
+ const shareSkill = tool({
1618
+ description: "Package a skill for sharing and distribution.",
1619
+ inputSchema: z.object({
1620
+ skillDefinition: z.string().describe("The skill to package"),
1621
+ targetPlatforms: z.array(z.string()).describe("Target platforms for distribution"),
1622
+ version: z.string().default("1.0.0").describe("Version number")
1623
+ }),
1624
+ execute: async ({ skillDefinition, targetPlatforms, version }) => {
1625
+ return generateValidatedObject(`Package skill for distribution:
1626
+
1627
+ Version: ${version}
1628
+ Target Platforms: ${targetPlatforms.join(", ")}
1629
+
1630
+ Skill:
1631
+ ${skillDefinition}`, SkillShareOutputSchema, { system: SHARING_SKILLS_SYSTEM_PROMPT });
1632
+ }
1633
+ });
1634
+ const introduceSuperpowers = tool({
1635
+ description: "Introduce the superpowers framework and guide usage.",
1636
+ inputSchema: z.object({
1637
+ projectContext: z.string().describe("Context about the project"),
1638
+ userExperience: z.enum([
1639
+ "beginner",
1640
+ "intermediate",
1641
+ "expert"
1642
+ ]).default("intermediate")
1643
+ }),
1644
+ execute: async ({ projectContext, userExperience }) => {
1645
+ return generateValidatedObject(`Introduce superpowers framework:
1646
+
1647
+ Project Context: ${projectContext}
1648
+ User Experience Level: ${userExperience}`, SuperpowersIntroOutputSchema, { system: USING_SUPERPOWERS_SYSTEM_PROMPT });
1649
+ }
1650
+ });
1651
+ const planningTools = {
1652
+ refineRequirements,
1653
+ consultArchitect,
1654
+ reviewDesign
1655
+ };
1656
+ const qualityTools = {
1657
+ runTDDCycle,
1658
+ reviewCode,
1659
+ detectAntiPatterns
1660
+ };
1661
+ const debuggingTools = {
1662
+ systematicDebug,
1663
+ traceRootCause,
1664
+ analyzeDefenseInDepth,
1665
+ analyzeAsyncPatterns
1666
+ };
1667
+ const workflowTools = {
1668
+ executePlan,
1669
+ dispatchAgents,
1670
+ runSubagentDev
1671
+ };
1672
+ const codeReviewTools = {
1673
+ reviewCode,
1674
+ processCodeReview,
1675
+ detectAntiPatterns
1676
+ };
1677
+ const gitTools = {
1678
+ analyzeCommit,
1679
+ manageWorktree,
1680
+ finishBranch
1681
+ };
1682
+ const metaTools = {
1683
+ writeSkill,
1684
+ testSkill,
1685
+ shareSkill,
1686
+ introduceSuperpowers
1687
+ };
1688
+ /**
1689
+ * All superpower tools combined.
1690
+ *
1691
+ * NOTE: Some tools appear in multiple collections (e.g., `reviewCode` in both
1692
+ * `qualityTools` and `codeReviewTools`, `detectAntiPatterns` in both `qualityTools`
1693
+ * and `codeReviewTools`). This is intentional - tools can belong to multiple categories.
1694
+ * The spread operator will use the last occurrence, so ensure consistent tool definitions.
1695
+ */
1696
+ const allSuperpowerTools = {
1697
+ ...planningTools,
1698
+ ...qualityTools,
1699
+ ...debuggingTools,
1700
+ ...workflowTools,
1701
+ ...codeReviewTools,
1702
+ ...gitTools,
1703
+ ...metaTools
1704
+ };
1705
+
1706
+ //#endregion
1707
+ export { AgentDispatchOutputSchema as $, writeSkill as A, FINISHING_BRANCH_SYSTEM_PROMPT as B, runSubagentDev as C, testSkill as D, systematicDebug as E, CONDITION_BASED_WAITING_SYSTEM_PROMPT as F, SHARING_SKILLS_SYSTEM_PROMPT as G, PLANNER_SYSTEM_PROMPT as H, DEFENSE_IN_DEPTH_SYSTEM_PROMPT as I, TDD_SYSTEM_PROMPT as J, SUBAGENT_DRIVEN_DEV_SYSTEM_PROMPT as K, DESIGN_REVIEW_SYSTEM_PROMPT as L, BRAINSTORM_SYSTEM_PROMPT as M, CODE_REVIEW_SYSTEM_PROMPT as N, traceRootCause as O, COMMIT_ANALYSIS_SYSTEM_PROMPT as P, systemPrompts as Q, DISPATCHING_AGENTS_SYSTEM_PROMPT as R, reviewDesign as S, shareSkill as T, RECEIVING_CODE_REVIEW_SYSTEM_PROMPT as U, GIT_WORKTREE_SYSTEM_PROMPT as V, ROOT_CAUSE_TRACING_SYSTEM_PROMPT as W, USING_SUPERPOWERS_SYSTEM_PROMPT as X, TESTING_SKILLS_SYSTEM_PROMPT as Y, WRITING_SKILLS_SYSTEM_PROMPT as Z, planningTools as _, SystematicDebuggingOutputSchema as _t, codeReviewTools as a, CodeReviewResponseOutputSchema as at, refineRequirements as b, detectAntiPatterns as c, DesignReviewOutputSchema as ct, finishBranch as d, RootCauseTracingOutputSchema as dt, AntiPatternOutputSchema as et, gitTools as f, SkillShareOutputSchema as ft, metaTools as g, SuperpowersIntroOutputSchema as gt, manageWorktree as h, SubagentDevOutputSchema as ht, analyzeDefenseInDepth as i, CodeReviewOutputSchema as it, ANTI_PATTERN_SYSTEM_PROMPT as j, workflowTools as k, dispatchAgents as l, PlanExecutionOutputSchema as lt, introduceSuperpowers as m, SkillWriteOutputSchema as mt, analyzeAsyncPatterns as n, BrainstormOutputSchema as nt, consultArchitect as o, CommitAnalysisOutputSchema as ot, initSuperpowers as p, SkillTestOutputSchema as pt, SYSTEMATIC_DEBUGGING_SYSTEM_PROMPT as q, analyzeCommit as r, BranchFinishOutputSchema as rt, debuggingTools as s, DefenseInDepthOutputSchema as st, allSuperpowerTools as t, AsyncPatternsOutputSchema as tt, executePlan as u, PlanOutputSchema as ut, processCodeReview as v, TDDOutputSchema as vt, runTDDCycle as w, reviewCode as x, qualityTools as y, WorktreeOutputSchema as yt, EXECUTING_PLANS_SYSTEM_PROMPT as z };
1708
+ //# sourceMappingURL=tools-BuS2Uv0q.mjs.map