@powerhousedao/ph-clint-app 0.1.0-dev.73 → 0.1.0-dev.75

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 (229) hide show
  1. package/dist/browser/document-models/index.js +1 -1
  2. package/dist/browser/document-models/ph-clint-project/index.js +3 -3
  3. package/dist/browser/{editor-DL0W2XOS.js → editor-Z7QJIYOp.js} +988 -450
  4. package/dist/browser/{editor-DL0W2XOS.js.map → editor-Z7QJIYOp.js.map} +1 -1
  5. package/dist/browser/editors/ph-clint-project-editor/module.js +1 -1
  6. package/dist/browser/index.js +3 -3
  7. package/dist/browser/index.js.map +1 -1
  8. package/dist/browser/{module-DoAlHsjp.js → module-BZ6W31hV.js} +1943 -1012
  9. package/dist/browser/module-BZ6W31hV.js.map +1 -0
  10. package/dist/browser/{ph-clint-project-D634z5c5.js → ph-clint-project-3b5ZHznW.js} +4 -6
  11. package/dist/browser/ph-clint-project-3b5ZHznW.js.map +1 -0
  12. package/dist/connect/assets/editor-CEMUd4Ju.js +2 -0
  13. package/dist/connect/assets/editor-CEMUd4Ju.js.map +1 -0
  14. package/dist/connect/assets/{index-BXAErAWR.js → index-BxEnFQyj.js} +20 -20
  15. package/dist/connect/assets/index-BxEnFQyj.js.map +1 -0
  16. package/dist/connect/assets/index-cjUwUwMU.css +2 -0
  17. package/dist/connect/assets/ph-clint-project-C_SSQ38p.js +1112 -0
  18. package/dist/connect/assets/ph-clint-project-C_SSQ38p.js.map +1 -0
  19. package/dist/connect/index.html +3 -3
  20. package/dist/connect/ph-packages.json +1 -1
  21. package/dist/document-models/document-models.d.ts +1 -1
  22. package/dist/document-models/index.d.ts +1 -1
  23. package/dist/document-models/ph-clint-project/index.d.ts +2 -2
  24. package/dist/document-models/ph-clint-project/upgrades/index.d.ts +2 -2
  25. package/dist/document-models/ph-clint-project/upgrades/upgrade-manifest.d.ts +2 -2
  26. package/dist/document-models/ph-clint-project/upgrades/upgrade-manifest.d.ts.map +1 -1
  27. package/dist/document-models/ph-clint-project/v1/actions.d.ts +27 -16
  28. package/dist/document-models/ph-clint-project/v1/actions.d.ts.map +1 -1
  29. package/dist/document-models/ph-clint-project/v1/gen/actions.d.ts +29 -19
  30. package/dist/document-models/ph-clint-project/v1/gen/actions.d.ts.map +1 -1
  31. package/dist/document-models/ph-clint-project/v1/gen/controller.d.ts +2 -2
  32. package/dist/document-models/ph-clint-project/v1/gen/controller.d.ts.map +1 -1
  33. package/dist/document-models/ph-clint-project/v1/gen/creators.d.ts +28 -18
  34. package/dist/document-models/ph-clint-project/v1/gen/creators.d.ts.map +1 -1
  35. package/dist/document-models/ph-clint-project/v1/gen/deployment/actions.d.ts +6 -6
  36. package/dist/document-models/ph-clint-project/v1/gen/deployment/actions.d.ts.map +1 -1
  37. package/dist/document-models/ph-clint-project/v1/gen/deployment/creators.d.ts +2 -2
  38. package/dist/document-models/ph-clint-project/v1/gen/deployment/creators.d.ts.map +1 -1
  39. package/dist/document-models/ph-clint-project/v1/gen/deployment/error.d.ts +1 -1
  40. package/dist/document-models/ph-clint-project/v1/gen/deployment/operations.d.ts +3 -3
  41. package/dist/document-models/ph-clint-project/v1/gen/deployment/operations.d.ts.map +1 -1
  42. package/dist/document-models/ph-clint-project/v1/gen/document-model.d.ts +1 -1
  43. package/dist/document-models/ph-clint-project/v1/gen/document-model.d.ts.map +1 -1
  44. package/dist/document-models/ph-clint-project/v1/gen/document-schema.d.ts +2 -2
  45. package/dist/document-models/ph-clint-project/v1/gen/document-schema.d.ts.map +1 -1
  46. package/dist/document-models/ph-clint-project/v1/gen/external-skills/actions.d.ts +6 -6
  47. package/dist/document-models/ph-clint-project/v1/gen/external-skills/actions.d.ts.map +1 -1
  48. package/dist/document-models/ph-clint-project/v1/gen/external-skills/creators.d.ts +2 -2
  49. package/dist/document-models/ph-clint-project/v1/gen/external-skills/creators.d.ts.map +1 -1
  50. package/dist/document-models/ph-clint-project/v1/gen/external-skills/error.d.ts +1 -1
  51. package/dist/document-models/ph-clint-project/v1/gen/external-skills/error.d.ts.map +1 -1
  52. package/dist/document-models/ph-clint-project/v1/gen/external-skills/operations.d.ts +3 -3
  53. package/dist/document-models/ph-clint-project/v1/gen/external-skills/operations.d.ts.map +1 -1
  54. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/actions.d.ts +6 -54
  55. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/actions.d.ts.map +1 -1
  56. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/creators.d.ts +2 -14
  57. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/creators.d.ts.map +1 -1
  58. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/error.d.ts +1 -78
  59. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/error.d.ts.map +1 -1
  60. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/operations.d.ts +3 -15
  61. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/operations.d.ts.map +1 -1
  62. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/actions.d.ts +3 -3
  63. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/creators.d.ts +2 -2
  64. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/creators.d.ts.map +1 -1
  65. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/error.d.ts +1 -1
  66. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/operations.d.ts +3 -3
  67. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/operations.d.ts.map +1 -1
  68. package/dist/document-models/ph-clint-project/v1/gen/features-routine/actions.d.ts +4 -4
  69. package/dist/document-models/ph-clint-project/v1/gen/features-routine/actions.d.ts.map +1 -1
  70. package/dist/document-models/ph-clint-project/v1/gen/features-routine/creators.d.ts +2 -2
  71. package/dist/document-models/ph-clint-project/v1/gen/features-routine/creators.d.ts.map +1 -1
  72. package/dist/document-models/ph-clint-project/v1/gen/features-routine/operations.d.ts +3 -3
  73. package/dist/document-models/ph-clint-project/v1/gen/features-routine/operations.d.ts.map +1 -1
  74. package/dist/document-models/ph-clint-project/v1/gen/identity/actions.d.ts +5 -5
  75. package/dist/document-models/ph-clint-project/v1/gen/identity/actions.d.ts.map +1 -1
  76. package/dist/document-models/ph-clint-project/v1/gen/identity/creators.d.ts +2 -2
  77. package/dist/document-models/ph-clint-project/v1/gen/identity/creators.d.ts.map +1 -1
  78. package/dist/document-models/ph-clint-project/v1/gen/identity/error.d.ts +1 -1
  79. package/dist/document-models/ph-clint-project/v1/gen/identity/error.d.ts.map +1 -1
  80. package/dist/document-models/ph-clint-project/v1/gen/identity/operations.d.ts +3 -3
  81. package/dist/document-models/ph-clint-project/v1/gen/identity/operations.d.ts.map +1 -1
  82. package/dist/document-models/ph-clint-project/v1/gen/index.d.ts +25 -20
  83. package/dist/document-models/ph-clint-project/v1/gen/index.d.ts.map +1 -1
  84. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/actions.d.ts +3 -3
  85. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/creators.d.ts +2 -2
  86. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/creators.d.ts.map +1 -1
  87. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/error.d.ts +13 -1
  88. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/error.d.ts.map +1 -1
  89. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/operations.d.ts +3 -3
  90. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/operations.d.ts.map +1 -1
  91. package/dist/document-models/ph-clint-project/v1/gen/mastra-agent-bindings/actions.d.ts +40 -0
  92. package/dist/document-models/ph-clint-project/v1/gen/mastra-agent-bindings/actions.d.ts.map +1 -0
  93. package/dist/document-models/ph-clint-project/v1/gen/mastra-agent-bindings/creators.d.ts +11 -0
  94. package/dist/document-models/ph-clint-project/v1/gen/mastra-agent-bindings/creators.d.ts.map +1 -0
  95. package/dist/document-models/ph-clint-project/v1/gen/mastra-agent-bindings/error.d.ts +79 -0
  96. package/dist/document-models/ph-clint-project/v1/gen/mastra-agent-bindings/error.d.ts.map +1 -0
  97. package/dist/document-models/ph-clint-project/v1/gen/mastra-agent-bindings/operations.d.ts +18 -0
  98. package/dist/document-models/ph-clint-project/v1/gen/mastra-agent-bindings/operations.d.ts.map +1 -0
  99. package/dist/document-models/ph-clint-project/v1/gen/mastra-main-agent/actions.d.ts +28 -0
  100. package/dist/document-models/ph-clint-project/v1/gen/mastra-main-agent/actions.d.ts.map +1 -0
  101. package/dist/document-models/ph-clint-project/v1/gen/mastra-main-agent/creators.d.ts +8 -0
  102. package/dist/document-models/ph-clint-project/v1/gen/mastra-main-agent/creators.d.ts.map +1 -0
  103. package/dist/document-models/ph-clint-project/v1/gen/mastra-main-agent/error.d.ts +36 -0
  104. package/dist/document-models/ph-clint-project/v1/gen/mastra-main-agent/error.d.ts.map +1 -0
  105. package/dist/document-models/ph-clint-project/v1/gen/mastra-main-agent/operations.d.ts +15 -0
  106. package/dist/document-models/ph-clint-project/v1/gen/mastra-main-agent/operations.d.ts.map +1 -0
  107. package/dist/document-models/ph-clint-project/v1/gen/mastra-models/actions.d.ts +16 -0
  108. package/dist/document-models/ph-clint-project/v1/gen/mastra-models/actions.d.ts.map +1 -0
  109. package/dist/document-models/ph-clint-project/v1/gen/mastra-models/creators.d.ts +5 -0
  110. package/dist/document-models/ph-clint-project/v1/gen/mastra-models/creators.d.ts.map +1 -0
  111. package/dist/document-models/ph-clint-project/v1/gen/mastra-models/error.d.ts +37 -0
  112. package/dist/document-models/ph-clint-project/v1/gen/mastra-models/error.d.ts.map +1 -0
  113. package/dist/document-models/ph-clint-project/v1/gen/mastra-models/operations.d.ts +12 -0
  114. package/dist/document-models/ph-clint-project/v1/gen/mastra-models/operations.d.ts.map +1 -0
  115. package/dist/document-models/ph-clint-project/v1/gen/mastra-profiles/actions.d.ts +24 -0
  116. package/dist/document-models/ph-clint-project/v1/gen/mastra-profiles/actions.d.ts.map +1 -0
  117. package/dist/document-models/ph-clint-project/v1/gen/mastra-profiles/creators.d.ts +7 -0
  118. package/dist/document-models/ph-clint-project/v1/gen/mastra-profiles/creators.d.ts.map +1 -0
  119. package/dist/document-models/ph-clint-project/v1/gen/mastra-profiles/error.d.ts +46 -0
  120. package/dist/document-models/ph-clint-project/v1/gen/mastra-profiles/error.d.ts.map +1 -0
  121. package/dist/document-models/ph-clint-project/v1/gen/mastra-profiles/operations.d.ts +14 -0
  122. package/dist/document-models/ph-clint-project/v1/gen/mastra-profiles/operations.d.ts.map +1 -0
  123. package/dist/document-models/ph-clint-project/v1/gen/mastra-sub-agents/actions.d.ts +24 -0
  124. package/dist/document-models/ph-clint-project/v1/gen/mastra-sub-agents/actions.d.ts.map +1 -0
  125. package/dist/document-models/ph-clint-project/v1/gen/mastra-sub-agents/creators.d.ts +7 -0
  126. package/dist/document-models/ph-clint-project/v1/gen/mastra-sub-agents/creators.d.ts.map +1 -0
  127. package/dist/document-models/ph-clint-project/v1/gen/mastra-sub-agents/error.d.ts +51 -0
  128. package/dist/document-models/ph-clint-project/v1/gen/mastra-sub-agents/error.d.ts.map +1 -0
  129. package/dist/document-models/ph-clint-project/v1/gen/mastra-sub-agents/operations.d.ts +14 -0
  130. package/dist/document-models/ph-clint-project/v1/gen/mastra-sub-agents/operations.d.ts.map +1 -0
  131. package/dist/document-models/ph-clint-project/v1/gen/ph-factories.d.ts +2 -2
  132. package/dist/document-models/ph-clint-project/v1/gen/ph-factories.d.ts.map +1 -1
  133. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/actions.d.ts +7 -7
  134. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/actions.d.ts.map +1 -1
  135. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/creators.d.ts +2 -2
  136. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/creators.d.ts.map +1 -1
  137. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/error.d.ts +1 -1
  138. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/error.d.ts.map +1 -1
  139. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/operations.d.ts +3 -3
  140. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/operations.d.ts.map +1 -1
  141. package/dist/document-models/ph-clint-project/v1/gen/publishing/actions.d.ts +7 -7
  142. package/dist/document-models/ph-clint-project/v1/gen/publishing/actions.d.ts.map +1 -1
  143. package/dist/document-models/ph-clint-project/v1/gen/publishing/creators.d.ts +2 -2
  144. package/dist/document-models/ph-clint-project/v1/gen/publishing/creators.d.ts.map +1 -1
  145. package/dist/document-models/ph-clint-project/v1/gen/publishing/error.d.ts +1 -1
  146. package/dist/document-models/ph-clint-project/v1/gen/publishing/operations.d.ts +3 -3
  147. package/dist/document-models/ph-clint-project/v1/gen/publishing/operations.d.ts.map +1 -1
  148. package/dist/document-models/ph-clint-project/v1/gen/reducer.d.ts +2 -2
  149. package/dist/document-models/ph-clint-project/v1/gen/reducer.d.ts.map +1 -1
  150. package/dist/document-models/ph-clint-project/v1/gen/schema/index.d.ts +2 -2
  151. package/dist/document-models/ph-clint-project/v1/gen/schema/types.d.ts +210 -131
  152. package/dist/document-models/ph-clint-project/v1/gen/schema/types.d.ts.map +1 -1
  153. package/dist/document-models/ph-clint-project/v1/gen/schema/zod.d.ts +23 -8
  154. package/dist/document-models/ph-clint-project/v1/gen/schema/zod.d.ts.map +1 -1
  155. package/dist/document-models/ph-clint-project/v1/gen/types.d.ts +5 -5
  156. package/dist/document-models/ph-clint-project/v1/gen/types.d.ts.map +1 -1
  157. package/dist/document-models/ph-clint-project/v1/gen/utils.d.ts +2 -2
  158. package/dist/document-models/ph-clint-project/v1/gen/utils.d.ts.map +1 -1
  159. package/dist/document-models/ph-clint-project/v1/hooks.d.ts +6 -3
  160. package/dist/document-models/ph-clint-project/v1/hooks.d.ts.map +1 -1
  161. package/dist/document-models/ph-clint-project/v1/index.d.ts +6 -6
  162. package/dist/document-models/ph-clint-project/v1/module.d.ts +27 -16
  163. package/dist/document-models/ph-clint-project/v1/module.d.ts.map +1 -1
  164. package/dist/document-models/ph-clint-project/v1/src/index.d.ts +1 -1
  165. package/dist/document-models/ph-clint-project/v1/src/reducers/deployment.d.ts +1 -1
  166. package/dist/document-models/ph-clint-project/v1/src/reducers/deployment.d.ts.map +1 -1
  167. package/dist/document-models/ph-clint-project/v1/src/reducers/external-skills.d.ts +1 -1
  168. package/dist/document-models/ph-clint-project/v1/src/reducers/external-skills.d.ts.map +1 -1
  169. package/dist/document-models/ph-clint-project/v1/src/reducers/features-mastra.d.ts +1 -1
  170. package/dist/document-models/ph-clint-project/v1/src/reducers/features-mastra.d.ts.map +1 -1
  171. package/dist/document-models/ph-clint-project/v1/src/reducers/features-powerhouse.d.ts +1 -1
  172. package/dist/document-models/ph-clint-project/v1/src/reducers/features-powerhouse.d.ts.map +1 -1
  173. package/dist/document-models/ph-clint-project/v1/src/reducers/features-routine.d.ts +1 -1
  174. package/dist/document-models/ph-clint-project/v1/src/reducers/features-routine.d.ts.map +1 -1
  175. package/dist/document-models/ph-clint-project/v1/src/reducers/identity.d.ts +1 -1
  176. package/dist/document-models/ph-clint-project/v1/src/reducers/identity.d.ts.map +1 -1
  177. package/dist/document-models/ph-clint-project/v1/src/reducers/lifecycle.d.ts +1 -1
  178. package/dist/document-models/ph-clint-project/v1/src/reducers/lifecycle.d.ts.map +1 -1
  179. package/dist/document-models/ph-clint-project/v1/src/reducers/mastra-agent-bindings.d.ts +3 -0
  180. package/dist/document-models/ph-clint-project/v1/src/reducers/mastra-agent-bindings.d.ts.map +1 -0
  181. package/dist/document-models/ph-clint-project/v1/src/reducers/mastra-main-agent.d.ts +3 -0
  182. package/dist/document-models/ph-clint-project/v1/src/reducers/mastra-main-agent.d.ts.map +1 -0
  183. package/dist/document-models/ph-clint-project/v1/src/reducers/mastra-models.d.ts +3 -0
  184. package/dist/document-models/ph-clint-project/v1/src/reducers/mastra-models.d.ts.map +1 -0
  185. package/dist/document-models/ph-clint-project/v1/src/reducers/mastra-profiles.d.ts +3 -0
  186. package/dist/document-models/ph-clint-project/v1/src/reducers/mastra-profiles.d.ts.map +1 -0
  187. package/dist/document-models/ph-clint-project/v1/src/reducers/mastra-sub-agents.d.ts +3 -0
  188. package/dist/document-models/ph-clint-project/v1/src/reducers/mastra-sub-agents.d.ts.map +1 -0
  189. package/dist/document-models/ph-clint-project/v1/src/reducers/powerhouse-packages.d.ts +1 -1
  190. package/dist/document-models/ph-clint-project/v1/src/reducers/powerhouse-packages.d.ts.map +1 -1
  191. package/dist/document-models/ph-clint-project/v1/src/reducers/publishing.d.ts +1 -1
  192. package/dist/document-models/ph-clint-project/v1/src/reducers/publishing.d.ts.map +1 -1
  193. package/dist/document-models/ph-clint-project/v1/tests/mastra-agent-bindings.test.d.ts +2 -0
  194. package/dist/document-models/ph-clint-project/v1/tests/mastra-agent-bindings.test.d.ts.map +1 -0
  195. package/dist/document-models/ph-clint-project/v1/tests/mastra-main-agent.test.d.ts +2 -0
  196. package/dist/document-models/ph-clint-project/v1/tests/mastra-main-agent.test.d.ts.map +1 -0
  197. package/dist/document-models/ph-clint-project/v1/tests/mastra-models.test.d.ts +2 -0
  198. package/dist/document-models/ph-clint-project/v1/tests/mastra-models.test.d.ts.map +1 -0
  199. package/dist/document-models/ph-clint-project/v1/tests/mastra-profiles.test.d.ts +2 -0
  200. package/dist/document-models/ph-clint-project/v1/tests/mastra-profiles.test.d.ts.map +1 -0
  201. package/dist/document-models/ph-clint-project/v1/tests/mastra-sub-agents.test.d.ts +2 -0
  202. package/dist/document-models/ph-clint-project/v1/tests/mastra-sub-agents.test.d.ts.map +1 -0
  203. package/dist/document-models/ph-clint-project/v1/utils.d.ts +2 -2
  204. package/dist/document-models/upgrade-manifests.d.ts +1 -1
  205. package/dist/document-models/upgrade-manifests.d.ts.map +1 -1
  206. package/dist/editors/ph-clint-project-editor/editor.d.ts.map +1 -1
  207. package/dist/node/document-models/index.mjs +1 -1
  208. package/dist/node/document-models/ph-clint-project/index.mjs +3 -3
  209. package/dist/node/{editor-mM5FSNXc.mjs → editor-C82Trmk4.mjs} +988 -450
  210. package/dist/node/{editor-mM5FSNXc.mjs.map → editor-C82Trmk4.mjs.map} +1 -1
  211. package/dist/node/editors/ph-clint-project-editor/module.mjs +1 -1
  212. package/dist/node/index.mjs +3 -3
  213. package/dist/node/index.mjs.map +1 -1
  214. package/dist/node/{module-DayL4J7r.mjs → module-ZwrJ5kaI.mjs} +1943 -1012
  215. package/dist/node/module-ZwrJ5kaI.mjs.map +1 -0
  216. package/dist/node/{ph-clint-project-Btx_kiiQ.mjs → ph-clint-project-YqV6kGMs.mjs} +4 -6
  217. package/dist/node/ph-clint-project-YqV6kGMs.mjs.map +1 -0
  218. package/dist/style.css +33 -29
  219. package/package.json +1 -1
  220. package/dist/browser/module-DoAlHsjp.js.map +0 -1
  221. package/dist/browser/ph-clint-project-D634z5c5.js.map +0 -1
  222. package/dist/connect/assets/editor-DgkuaKuV.js +0 -2
  223. package/dist/connect/assets/editor-DgkuaKuV.js.map +0 -1
  224. package/dist/connect/assets/index-BSq-9kCR.css +0 -2
  225. package/dist/connect/assets/index-BXAErAWR.js.map +0 -1
  226. package/dist/connect/assets/ph-clint-project-BRYYVNTj.js +0 -758
  227. package/dist/connect/assets/ph-clint-project-BRYYVNTj.js.map +0 -1
  228. package/dist/node/module-DayL4J7r.mjs.map +0 -1
  229. package/dist/node/ph-clint-project-Btx_kiiQ.mjs.map +0 -1
@@ -8689,6 +8689,25 @@ const PublishTagSchema = _enum([
8689
8689
  "Production",
8690
8690
  "Staging"
8691
8691
  ]);
8692
+ function AddAgentProfileRefInputSchema() {
8693
+ return object({
8694
+ agentId: string(),
8695
+ insertBefore: string().nullish(),
8696
+ profileId: string()
8697
+ });
8698
+ }
8699
+ function AddAgentSkillInputSchema() {
8700
+ return object({
8701
+ agentId: string(),
8702
+ name: string()
8703
+ });
8704
+ }
8705
+ function AddAgentToolPatternInputSchema() {
8706
+ return object({
8707
+ agentId: string(),
8708
+ pattern: string()
8709
+ });
8710
+ }
8692
8711
  function AddExternalSkillInputSchema() {
8693
8712
  return object({
8694
8713
  githubUrl: url(),
@@ -8697,10 +8716,7 @@ function AddExternalSkillInputSchema() {
8697
8716
  });
8698
8717
  }
8699
8718
  function AddModelInputSchema() {
8700
- return object({
8701
- id: string(),
8702
- isDefault: boolean().nullish()
8703
- });
8719
+ return object({ id: string() });
8704
8720
  }
8705
8721
  function AddPackageDocumentTypeInputSchema() {
8706
8722
  return object({
@@ -8722,13 +8738,24 @@ function AddProfileInputSchema() {
8722
8738
  title: string()
8723
8739
  });
8724
8740
  }
8741
+ function AddSubAgentInputSchema() {
8742
+ return object({
8743
+ description: string(),
8744
+ id: string(),
8745
+ modelId: string(),
8746
+ name: string()
8747
+ });
8748
+ }
8725
8749
  function AddSupportedResourceInputSchema() {
8726
8750
  return object({ resource: string() });
8727
8751
  }
8728
8752
  function BumpVersionInputSchema() {
8729
8753
  return object({ version: string() });
8730
8754
  }
8731
- function ClearAgentImageInputSchema() {
8755
+ function ClearMainAgentDescriptionInputSchema() {
8756
+ return object({ _: boolean().nullish() });
8757
+ }
8758
+ function ClearMainAgentImageInputSchema() {
8732
8759
  return object({ _: boolean().nullish() });
8733
8760
  }
8734
8761
  function DisableMastraInputSchema() {
@@ -8754,12 +8781,21 @@ function ExternalSkillSchema() {
8754
8781
  name: string()
8755
8782
  });
8756
8783
  }
8757
- function ImportModelInputSchema() {
8784
+ function ImportMainAgentInputSchema() {
8758
8785
  return object({
8786
+ description: string().nullish(),
8759
8787
  id: string(),
8760
- isDefault: boolean()
8788
+ image: string().nullish(),
8789
+ modelId: string(),
8790
+ name: string(),
8791
+ profileIds: array(string()),
8792
+ skills: array(string()),
8793
+ toolPatterns: array(string())
8761
8794
  });
8762
8795
  }
8796
+ function ImportModelInputSchema() {
8797
+ return object({ id: string() });
8798
+ }
8763
8799
  function ImportPackageInputSchema() {
8764
8800
  return object({
8765
8801
  documentTypes: array(string()),
@@ -8784,32 +8820,40 @@ function ImportSkillInputSchema() {
8784
8820
  }
8785
8821
  function ImportSpecInputSchema() {
8786
8822
  return object({
8787
- agentDescription: string().nullish(),
8788
- agentId: string().nullish(),
8789
- agentImage: string().nullish(),
8790
- agentName: string().nullish(),
8791
8823
  description: string(),
8792
8824
  enableChat: boolean().nullish(),
8793
8825
  externalSkills: array(lazy(() => ImportSkillInputSchema())),
8826
+ mainAgent: lazy(() => ImportMainAgentInputSchema().nullish()),
8794
8827
  mastraEnabled: boolean(),
8795
- models: array(lazy(() => ImportModelInputSchema())).nullish(),
8828
+ models: array(lazy(() => ImportModelInputSchema())),
8796
8829
  name: string(),
8797
8830
  observabilityEnabled: boolean().nullish(),
8798
8831
  packages: array(lazy(() => ImportPackageInputSchema())),
8799
8832
  powerhouse: PowerhouseLevelSchema,
8800
- profiles: array(lazy(() => ImportProfileInputSchema())).nullish(),
8833
+ profiles: array(lazy(() => ImportProfileInputSchema())),
8801
8834
  proxyEnabled: boolean().nullish(),
8802
8835
  routineEnabled: boolean(),
8803
8836
  scope: string().nullish(),
8837
+ subAgents: array(lazy(() => ImportSubAgentInputSchema())),
8804
8838
  supportedResources: array(string()).nullish(),
8805
8839
  version: string()
8806
8840
  });
8807
8841
  }
8842
+ function ImportSubAgentInputSchema() {
8843
+ return object({
8844
+ description: string(),
8845
+ id: string(),
8846
+ modelId: string(),
8847
+ name: string(),
8848
+ profileIds: array(string()),
8849
+ skills: array(string()),
8850
+ toolPatterns: array(string())
8851
+ });
8852
+ }
8808
8853
  function PhClintAgentModelSchema() {
8809
8854
  return object({
8810
8855
  __typename: literal("PhClintAgentModel").optional(),
8811
- id: string(),
8812
- isDefault: boolean()
8856
+ id: string()
8813
8857
  });
8814
8858
  }
8815
8859
  function PhClintAgentProfileSchema() {
@@ -8836,6 +8880,19 @@ function PhClintFeaturesSchema() {
8836
8880
  routine: lazy(() => PhClintRoutineFeatureSchema())
8837
8881
  });
8838
8882
  }
8883
+ function PhClintMainAgentSchema() {
8884
+ return object({
8885
+ __typename: literal("PhClintMainAgent").optional(),
8886
+ description: string().nullish(),
8887
+ id: string(),
8888
+ image: string().nullish(),
8889
+ modelId: string(),
8890
+ name: string(),
8891
+ profileIds: array(string()),
8892
+ skills: array(string()),
8893
+ toolPatterns: array(string())
8894
+ });
8895
+ }
8839
8896
  function PhClintMastraCommonSchema() {
8840
8897
  return object({
8841
8898
  __typename: literal("PhClintMastraCommon").optional(),
@@ -8845,14 +8902,12 @@ function PhClintMastraCommonSchema() {
8845
8902
  function PhClintMastraFeatureSchema() {
8846
8903
  return object({
8847
8904
  __typename: literal("PhClintMastraFeature").optional(),
8848
- agentDescription: string().nullish(),
8849
- agentId: string().nullish(),
8850
- agentImage: string().nullish(),
8851
- agentName: string().nullish(),
8852
8905
  common: lazy(() => PhClintMastraCommonSchema()),
8853
8906
  enabled: boolean(),
8907
+ mainAgent: lazy(() => PhClintMainAgentSchema().nullish()),
8854
8908
  models: array(lazy(() => PhClintAgentModelSchema())),
8855
- profiles: array(lazy(() => PhClintAgentProfileSchema()))
8909
+ profiles: array(lazy(() => PhClintAgentProfileSchema())),
8910
+ subAgents: array(lazy(() => PhClintSubAgentSchema()))
8856
8911
  });
8857
8912
  }
8858
8913
  function PhClintProjectStateSchema() {
@@ -8875,6 +8930,18 @@ function PhClintRoutineFeatureSchema() {
8875
8930
  enabled: boolean()
8876
8931
  });
8877
8932
  }
8933
+ function PhClintSubAgentSchema() {
8934
+ return object({
8935
+ __typename: literal("PhClintSubAgent").optional(),
8936
+ description: string(),
8937
+ id: string(),
8938
+ modelId: string(),
8939
+ name: string(),
8940
+ profileIds: array(string()),
8941
+ skills: array(string()),
8942
+ toolPatterns: array(string())
8943
+ });
8944
+ }
8878
8945
  function PowerhousePackageSchema() {
8879
8946
  return object({
8880
8947
  __typename: literal("PowerhousePackage").optional(),
@@ -8913,6 +8980,24 @@ function PublishStagingInputSchema() {
8913
8980
  timestamp: datetime()
8914
8981
  });
8915
8982
  }
8983
+ function RemoveAgentProfileRefInputSchema() {
8984
+ return object({
8985
+ agentId: string(),
8986
+ profileId: string()
8987
+ });
8988
+ }
8989
+ function RemoveAgentSkillInputSchema() {
8990
+ return object({
8991
+ agentId: string(),
8992
+ name: string()
8993
+ });
8994
+ }
8995
+ function RemoveAgentToolPatternInputSchema() {
8996
+ return object({
8997
+ agentId: string(),
8998
+ pattern: string()
8999
+ });
9000
+ }
8916
9001
  function RemoveExternalSkillInputSchema() {
8917
9002
  return object({ id: string() });
8918
9003
  }
@@ -8931,29 +9016,30 @@ function RemovePowerhousePackageInputSchema() {
8931
9016
  function RemoveProfileInputSchema() {
8932
9017
  return object({ id: string() });
8933
9018
  }
9019
+ function RemoveSubAgentInputSchema() {
9020
+ return object({ id: string() });
9021
+ }
8934
9022
  function RemoveSupportedResourceInputSchema() {
8935
9023
  return object({ resource: string() });
8936
9024
  }
8937
- function ReorderProfilesInputSchema() {
9025
+ function ReorderAgentProfileRefsInputSchema() {
8938
9026
  return object({
9027
+ agentId: string(),
8939
9028
  ids: array(string()),
8940
9029
  insertBefore: string().nullish()
8941
9030
  });
8942
9031
  }
8943
- function SetAgentDescriptionInputSchema() {
8944
- return object({ description: string() });
8945
- }
8946
- function SetAgentIdInputSchema() {
8947
- return object({ agentId: string() });
8948
- }
8949
- function SetAgentImageInputSchema() {
8950
- return object({ image: string() });
8951
- }
8952
- function SetAgentNameInputSchema() {
8953
- return object({ agentName: string() });
9032
+ function ReorderProfilesInputSchema() {
9033
+ return object({
9034
+ ids: array(string()),
9035
+ insertBefore: string().nullish()
9036
+ });
8954
9037
  }
8955
- function SetDefaultModelInputSchema() {
8956
- return object({ id: string() });
9038
+ function SetAgentModelInputSchema() {
9039
+ return object({
9040
+ agentId: string(),
9041
+ modelId: string()
9042
+ });
8957
9043
  }
8958
9044
  function SetDescriptionInputSchema() {
8959
9045
  return object({ description: string() });
@@ -8973,6 +9059,15 @@ function SetExternalSkillNameInputSchema() {
8973
9059
  name: string()
8974
9060
  });
8975
9061
  }
9062
+ function SetMainAgentDescriptionInputSchema() {
9063
+ return object({ description: string() });
9064
+ }
9065
+ function SetMainAgentImageInputSchema() {
9066
+ return object({ image: string() });
9067
+ }
9068
+ function SetMainAgentNameInputSchema() {
9069
+ return object({ name: string() });
9070
+ }
8976
9071
  function SetObservabilityEnabledInputSchema() {
8977
9072
  return object({ enabled: boolean() });
8978
9073
  }
@@ -9000,6 +9095,18 @@ function SetPublishStatusInputSchema() {
9000
9095
  status: PublishStatusSchema
9001
9096
  });
9002
9097
  }
9098
+ function SetSubAgentDescriptionInputSchema() {
9099
+ return object({
9100
+ description: string(),
9101
+ id: string()
9102
+ });
9103
+ }
9104
+ function SetSubAgentNameInputSchema() {
9105
+ return object({
9106
+ id: string(),
9107
+ name: string()
9108
+ });
9109
+ }
9003
9110
  function SetVersionInputSchema() {
9004
9111
  return object({ version: string() });
9005
9112
  }
@@ -9016,7 +9123,7 @@ function UpdateProfileInputSchema() {
9016
9123
  * WARNING: DO NOT EDIT
9017
9124
  * This file is auto-generated and updated by codegen
9018
9125
  */
9019
- var creators_exports$8 = /* @__PURE__ */ __exportAll({
9126
+ var creators_exports$13 = /* @__PURE__ */ __exportAll({
9020
9127
  addSupportedResource: () => addSupportedResource,
9021
9128
  removeSupportedResource: () => removeSupportedResource,
9022
9129
  setObservabilityEnabled: () => setObservabilityEnabled,
@@ -9032,7 +9139,7 @@ const setObservabilityEnabled = (input) => createAction("SET_OBSERVABILITY_ENABL
9032
9139
  * WARNING: DO NOT EDIT
9033
9140
  * This file is auto-generated and updated by codegen
9034
9141
  */
9035
- var creators_exports$7 = /* @__PURE__ */ __exportAll({
9142
+ var creators_exports$12 = /* @__PURE__ */ __exportAll({
9036
9143
  addExternalSkill: () => addExternalSkill,
9037
9144
  removeExternalSkill: () => removeExternalSkill,
9038
9145
  setExternalSkillGithubUrl: () => setExternalSkillGithubUrl,
@@ -9048,37 +9155,13 @@ const setExternalSkillGithubUrl = (input) => createAction("SET_EXTERNAL_SKILL_GI
9048
9155
  * WARNING: DO NOT EDIT
9049
9156
  * This file is auto-generated and updated by codegen
9050
9157
  */
9051
- var creators_exports$6 = /* @__PURE__ */ __exportAll({
9052
- addModel: () => addModel,
9053
- addProfile: () => addProfile,
9054
- clearAgentImage: () => clearAgentImage,
9158
+ var creators_exports$11 = /* @__PURE__ */ __exportAll({
9055
9159
  disableMastra: () => disableMastra,
9056
9160
  enableMastra: () => enableMastra,
9057
- removeModel: () => removeModel,
9058
- removeProfile: () => removeProfile,
9059
- reorderProfiles: () => reorderProfiles,
9060
- setAgentDescription: () => setAgentDescription,
9061
- setAgentId: () => setAgentId,
9062
- setAgentImage: () => setAgentImage,
9063
- setAgentName: () => setAgentName,
9064
- setDefaultModel: () => setDefaultModel,
9065
- setEnableChat: () => setEnableChat,
9066
- updateProfile: () => updateProfile
9161
+ setEnableChat: () => setEnableChat
9067
9162
  });
9068
9163
  const enableMastra = (input) => createAction("ENABLE_MASTRA", { ...input }, void 0, EnableMastraInputSchema, "global");
9069
9164
  const disableMastra = (input) => createAction("DISABLE_MASTRA", { ...input }, void 0, DisableMastraInputSchema, "global");
9070
- const setAgentId = (input) => createAction("SET_AGENT_ID", { ...input }, void 0, SetAgentIdInputSchema, "global");
9071
- const setAgentName = (input) => createAction("SET_AGENT_NAME", { ...input }, void 0, SetAgentNameInputSchema, "global");
9072
- const addModel = (input) => createAction("ADD_MODEL", { ...input }, void 0, AddModelInputSchema, "global");
9073
- const removeModel = (input) => createAction("REMOVE_MODEL", { ...input }, void 0, RemoveModelInputSchema, "global");
9074
- const setDefaultModel = (input) => createAction("SET_DEFAULT_MODEL", { ...input }, void 0, SetDefaultModelInputSchema, "global");
9075
- const addProfile = (input) => createAction("ADD_PROFILE", { ...input }, void 0, AddProfileInputSchema, "global");
9076
- const updateProfile = (input) => createAction("UPDATE_PROFILE", { ...input }, void 0, UpdateProfileInputSchema, "global");
9077
- const removeProfile = (input) => createAction("REMOVE_PROFILE", { ...input }, void 0, RemoveProfileInputSchema, "global");
9078
- const reorderProfiles = (input) => createAction("REORDER_PROFILES", { ...input }, void 0, ReorderProfilesInputSchema, "global");
9079
- const setAgentDescription = (input) => createAction("SET_AGENT_DESCRIPTION", { ...input }, void 0, SetAgentDescriptionInputSchema, "global");
9080
- const setAgentImage = (input) => createAction("SET_AGENT_IMAGE", { ...input }, void 0, SetAgentImageInputSchema, "global");
9081
- const clearAgentImage = (input) => createAction("CLEAR_AGENT_IMAGE", { ...input }, void 0, ClearAgentImageInputSchema, "global");
9082
9165
  const setEnableChat = (input) => createAction("SET_ENABLE_CHAT", { ...input }, void 0, SetEnableChatInputSchema, "global");
9083
9166
  //#endregion
9084
9167
  //#region document-models/ph-clint-project/v1/gen/features-powerhouse/creators.ts
@@ -9086,7 +9169,7 @@ const setEnableChat = (input) => createAction("SET_ENABLE_CHAT", { ...input }, v
9086
9169
  * WARNING: DO NOT EDIT
9087
9170
  * This file is auto-generated and updated by codegen
9088
9171
  */
9089
- var creators_exports$5 = /* @__PURE__ */ __exportAll({ setPowerhouseLevel: () => setPowerhouseLevel });
9172
+ var creators_exports$10 = /* @__PURE__ */ __exportAll({ setPowerhouseLevel: () => setPowerhouseLevel });
9090
9173
  const setPowerhouseLevel = (input) => createAction("SET_POWERHOUSE_LEVEL", { ...input }, void 0, SetPowerhouseLevelInputSchema, "global");
9091
9174
  //#endregion
9092
9175
  //#region document-models/ph-clint-project/v1/gen/features-routine/creators.ts
@@ -9094,7 +9177,7 @@ const setPowerhouseLevel = (input) => createAction("SET_POWERHOUSE_LEVEL", { ...
9094
9177
  * WARNING: DO NOT EDIT
9095
9178
  * This file is auto-generated and updated by codegen
9096
9179
  */
9097
- var creators_exports$4 = /* @__PURE__ */ __exportAll({
9180
+ var creators_exports$9 = /* @__PURE__ */ __exportAll({
9098
9181
  disableRoutine: () => disableRoutine,
9099
9182
  enableRoutine: () => enableRoutine
9100
9183
  });
@@ -9106,7 +9189,7 @@ const disableRoutine = (input) => createAction("DISABLE_ROUTINE", { ...input },
9106
9189
  * WARNING: DO NOT EDIT
9107
9190
  * This file is auto-generated and updated by codegen
9108
9191
  */
9109
- var creators_exports$3 = /* @__PURE__ */ __exportAll({
9192
+ var creators_exports$8 = /* @__PURE__ */ __exportAll({
9110
9193
  setDescription: () => setDescription,
9111
9194
  setPackageIdentifier: () => setPackageIdentifier,
9112
9195
  setVersion: () => setVersion
@@ -9120,9 +9203,95 @@ const setPackageIdentifier = (input) => createAction("SET_PACKAGE_IDENTIFIER", {
9120
9203
  * WARNING: DO NOT EDIT
9121
9204
  * This file is auto-generated and updated by codegen
9122
9205
  */
9123
- var creators_exports$2 = /* @__PURE__ */ __exportAll({ importSpec: () => importSpec });
9206
+ var creators_exports$7 = /* @__PURE__ */ __exportAll({ importSpec: () => importSpec });
9124
9207
  const importSpec = (input) => createAction("IMPORT_SPEC", { ...input }, void 0, ImportSpecInputSchema, "global");
9125
9208
  //#endregion
9209
+ //#region document-models/ph-clint-project/v1/gen/mastra-agent-bindings/creators.ts
9210
+ /**
9211
+ * WARNING: DO NOT EDIT
9212
+ * This file is auto-generated and updated by codegen
9213
+ */
9214
+ var creators_exports$6 = /* @__PURE__ */ __exportAll({
9215
+ addAgentProfileRef: () => addAgentProfileRef,
9216
+ addAgentSkill: () => addAgentSkill,
9217
+ addAgentToolPattern: () => addAgentToolPattern,
9218
+ removeAgentProfileRef: () => removeAgentProfileRef,
9219
+ removeAgentSkill: () => removeAgentSkill,
9220
+ removeAgentToolPattern: () => removeAgentToolPattern,
9221
+ reorderAgentProfileRefs: () => reorderAgentProfileRefs,
9222
+ setAgentModel: () => setAgentModel
9223
+ });
9224
+ const setAgentModel = (input) => createAction("SET_AGENT_MODEL", { ...input }, void 0, SetAgentModelInputSchema, "global");
9225
+ const addAgentProfileRef = (input) => createAction("ADD_AGENT_PROFILE_REF", { ...input }, void 0, AddAgentProfileRefInputSchema, "global");
9226
+ const removeAgentProfileRef = (input) => createAction("REMOVE_AGENT_PROFILE_REF", { ...input }, void 0, RemoveAgentProfileRefInputSchema, "global");
9227
+ const reorderAgentProfileRefs = (input) => createAction("REORDER_AGENT_PROFILE_REFS", { ...input }, void 0, ReorderAgentProfileRefsInputSchema, "global");
9228
+ const addAgentSkill = (input) => createAction("ADD_AGENT_SKILL", { ...input }, void 0, AddAgentSkillInputSchema, "global");
9229
+ const removeAgentSkill = (input) => createAction("REMOVE_AGENT_SKILL", { ...input }, void 0, RemoveAgentSkillInputSchema, "global");
9230
+ const addAgentToolPattern = (input) => createAction("ADD_AGENT_TOOL_PATTERN", { ...input }, void 0, AddAgentToolPatternInputSchema, "global");
9231
+ const removeAgentToolPattern = (input) => createAction("REMOVE_AGENT_TOOL_PATTERN", { ...input }, void 0, RemoveAgentToolPatternInputSchema, "global");
9232
+ //#endregion
9233
+ //#region document-models/ph-clint-project/v1/gen/mastra-main-agent/creators.ts
9234
+ /**
9235
+ * WARNING: DO NOT EDIT
9236
+ * This file is auto-generated and updated by codegen
9237
+ */
9238
+ var creators_exports$5 = /* @__PURE__ */ __exportAll({
9239
+ clearMainAgentDescription: () => clearMainAgentDescription,
9240
+ clearMainAgentImage: () => clearMainAgentImage,
9241
+ setMainAgentDescription: () => setMainAgentDescription,
9242
+ setMainAgentImage: () => setMainAgentImage,
9243
+ setMainAgentName: () => setMainAgentName
9244
+ });
9245
+ const setMainAgentName = (input) => createAction("SET_MAIN_AGENT_NAME", { ...input }, void 0, SetMainAgentNameInputSchema, "global");
9246
+ const setMainAgentDescription = (input) => createAction("SET_MAIN_AGENT_DESCRIPTION", { ...input }, void 0, SetMainAgentDescriptionInputSchema, "global");
9247
+ const clearMainAgentDescription = (input) => createAction("CLEAR_MAIN_AGENT_DESCRIPTION", { ...input }, void 0, ClearMainAgentDescriptionInputSchema, "global");
9248
+ const setMainAgentImage = (input) => createAction("SET_MAIN_AGENT_IMAGE", { ...input }, void 0, SetMainAgentImageInputSchema, "global");
9249
+ const clearMainAgentImage = (input) => createAction("CLEAR_MAIN_AGENT_IMAGE", { ...input }, void 0, ClearMainAgentImageInputSchema, "global");
9250
+ //#endregion
9251
+ //#region document-models/ph-clint-project/v1/gen/mastra-models/creators.ts
9252
+ /**
9253
+ * WARNING: DO NOT EDIT
9254
+ * This file is auto-generated and updated by codegen
9255
+ */
9256
+ var creators_exports$4 = /* @__PURE__ */ __exportAll({
9257
+ addModel: () => addModel,
9258
+ removeModel: () => removeModel
9259
+ });
9260
+ const addModel = (input) => createAction("ADD_MODEL", { ...input }, void 0, AddModelInputSchema, "global");
9261
+ const removeModel = (input) => createAction("REMOVE_MODEL", { ...input }, void 0, RemoveModelInputSchema, "global");
9262
+ //#endregion
9263
+ //#region document-models/ph-clint-project/v1/gen/mastra-profiles/creators.ts
9264
+ /**
9265
+ * WARNING: DO NOT EDIT
9266
+ * This file is auto-generated and updated by codegen
9267
+ */
9268
+ var creators_exports$3 = /* @__PURE__ */ __exportAll({
9269
+ addProfile: () => addProfile,
9270
+ removeProfile: () => removeProfile,
9271
+ reorderProfiles: () => reorderProfiles,
9272
+ updateProfile: () => updateProfile
9273
+ });
9274
+ const addProfile = (input) => createAction("ADD_PROFILE", { ...input }, void 0, AddProfileInputSchema, "global");
9275
+ const updateProfile = (input) => createAction("UPDATE_PROFILE", { ...input }, void 0, UpdateProfileInputSchema, "global");
9276
+ const removeProfile = (input) => createAction("REMOVE_PROFILE", { ...input }, void 0, RemoveProfileInputSchema, "global");
9277
+ const reorderProfiles = (input) => createAction("REORDER_PROFILES", { ...input }, void 0, ReorderProfilesInputSchema, "global");
9278
+ //#endregion
9279
+ //#region document-models/ph-clint-project/v1/gen/mastra-sub-agents/creators.ts
9280
+ /**
9281
+ * WARNING: DO NOT EDIT
9282
+ * This file is auto-generated and updated by codegen
9283
+ */
9284
+ var creators_exports$2 = /* @__PURE__ */ __exportAll({
9285
+ addSubAgent: () => addSubAgent,
9286
+ removeSubAgent: () => removeSubAgent,
9287
+ setSubAgentDescription: () => setSubAgentDescription,
9288
+ setSubAgentName: () => setSubAgentName
9289
+ });
9290
+ const addSubAgent = (input) => createAction("ADD_SUB_AGENT", { ...input }, void 0, AddSubAgentInputSchema, "global");
9291
+ const removeSubAgent = (input) => createAction("REMOVE_SUB_AGENT", { ...input }, void 0, RemoveSubAgentInputSchema, "global");
9292
+ const setSubAgentName = (input) => createAction("SET_SUB_AGENT_NAME", { ...input }, void 0, SetSubAgentNameInputSchema, "global");
9293
+ const setSubAgentDescription = (input) => createAction("SET_SUB_AGENT_DESCRIPTION", { ...input }, void 0, SetSubAgentDescriptionInputSchema, "global");
9294
+ //#endregion
9126
9295
  //#region document-models/ph-clint-project/v1/gen/powerhouse-packages/creators.ts
9127
9296
  /**
9128
9297
  * WARNING: DO NOT EDIT
@@ -9167,15 +9336,20 @@ const setPublishStatus = (input) => createAction("SET_PUBLISH_STATUS", { ...inpu
9167
9336
  /** Actions for the PhClintProject document model */
9168
9337
  const actions = {
9169
9338
  ...baseActions,
9170
- ...creators_exports$3,
9171
- ...creators_exports$5,
9172
- ...creators_exports$6,
9173
- ...creators_exports$4,
9339
+ ...creators_exports$8,
9340
+ ...creators_exports$10,
9341
+ ...creators_exports$9,
9174
9342
  ...creators_exports$1,
9175
- ...creators_exports$7,
9343
+ ...creators_exports$12,
9176
9344
  ...creators_exports,
9345
+ ...creators_exports$7,
9346
+ ...creators_exports$13,
9347
+ ...creators_exports$11,
9348
+ ...creators_exports$4,
9349
+ ...creators_exports$3,
9350
+ ...creators_exports$5,
9177
9351
  ...creators_exports$2,
9178
- ...creators_exports$8
9352
+ ...creators_exports$6
9179
9353
  };
9180
9354
  //#endregion
9181
9355
  //#region document-models/ph-clint-project/v1/gen/document-model.ts
@@ -9196,9 +9370,9 @@ const documentModel = {
9196
9370
  initialValue: ""
9197
9371
  },
9198
9372
  global: {
9199
- schema: "type PhClintProjectState {\n name: String\n scope: String\n version: String!\n description: String!\n features: PhClintFeatures!\n packages: [PowerhousePackage!]!\n externalSkills: [ExternalSkill!]!\n publishHistory: [PublishRecord!]!\n deployment: PhClintDeployment!\n}\n\ntype PhClintFeatures {\n powerhouse: PowerhouseLevel!\n mastra: PhClintMastraFeature!\n routine: PhClintRoutineFeature!\n}\n\nenum PowerhouseLevel {\n Disabled\n Reactor\n Switchboard\n Connect\n}\n\ntype PhClintMastraFeature {\n enabled: Boolean!\n agentId: String\n agentName: String\n agentDescription: String\n agentImage: String\n models: [PhClintAgentModel!]!\n profiles: [PhClintAgentProfile!]!\n common: PhClintMastraCommon!\n}\n\ntype PhClintMastraCommon {\n enableChat: Boolean!\n}\n\ntype PhClintAgentModel {\n id: String!\n isDefault: Boolean!\n}\n\ntype PhClintAgentProfile {\n id: String!\n title: String!\n content: String!\n}\n\ntype PhClintRoutineFeature {\n enabled: Boolean!\n}\n\ntype PowerhousePackage {\n id: OID!\n packageName: String!\n documentTypes: [String!]!\n version: String\n managed: Boolean!\n}\n\ntype ExternalSkill {\n id: OID!\n name: String!\n githubUrl: URL!\n}\n\nenum PublishTag {\n Dev\n Staging\n Production\n}\n\nenum PublishStatus {\n Pending\n InProgress\n Succeeded\n Failed\n}\n\ntype PublishRecord {\n id: OID!\n tag: PublishTag!\n version: String!\n timestamp: DateTime!\n status: PublishStatus!\n}\n\ntype PhClintDeployment {\n proxyEnabled: Boolean!\n observabilityEnabled: Boolean!\n supportedResources: [String!]!\n}",
9373
+ schema: "type PhClintProjectState {\n name: String\n scope: String\n version: String!\n description: String!\n features: PhClintFeatures!\n packages: [PowerhousePackage!]!\n externalSkills: [ExternalSkill!]!\n publishHistory: [PublishRecord!]!\n deployment: PhClintDeployment!\n}\n\ntype PhClintFeatures {\n powerhouse: PowerhouseLevel!\n mastra: PhClintMastraFeature!\n routine: PhClintRoutineFeature!\n}\n\nenum PowerhouseLevel {\n Disabled\n Reactor\n Switchboard\n Connect\n}\n\ntype PhClintMastraFeature {\n enabled: Boolean!\n mainAgent: PhClintMainAgent\n subAgents: [PhClintSubAgent!]!\n models: [PhClintAgentModel!]!\n profiles: [PhClintAgentProfile!]!\n common: PhClintMastraCommon!\n}\n\ntype PhClintMainAgent {\n id: OID!\n name: String!\n description: String\n image: String\n modelId: OID!\n profileIds: [OID!]!\n skills: [String!]!\n toolPatterns: [String!]!\n}\n\ntype PhClintSubAgent {\n id: OID!\n name: String!\n description: String!\n modelId: OID!\n profileIds: [OID!]!\n skills: [String!]!\n toolPatterns: [String!]!\n}\n\ntype PhClintMastraCommon {\n enableChat: Boolean!\n}\n\ntype PhClintAgentModel {\n id: OID!\n}\n\ntype PhClintAgentProfile {\n id: OID!\n title: String!\n content: String!\n}\n\ntype PhClintRoutineFeature {\n enabled: Boolean!\n}\n\ntype PowerhousePackage {\n id: OID!\n packageName: String!\n documentTypes: [String!]!\n version: String\n managed: Boolean!\n}\n\ntype ExternalSkill {\n id: OID!\n name: String!\n githubUrl: URL!\n}\n\nenum PublishTag {\n Dev\n Staging\n Production\n}\n\nenum PublishStatus {\n Pending\n InProgress\n Succeeded\n Failed\n}\n\ntype PublishRecord {\n id: OID!\n tag: PublishTag!\n version: String!\n timestamp: DateTime!\n status: PublishStatus!\n}\n\ntype PhClintDeployment {\n proxyEnabled: Boolean!\n observabilityEnabled: Boolean!\n supportedResources: [String!]!\n}",
9200
9374
  examples: [],
9201
- initialValue: "{\n \"name\": null,\n \"scope\": null,\n \"version\": \"0.1.0\",\n \"description\": \"\",\n \"features\": {\n \"powerhouse\": \"Disabled\",\n \"mastra\": {\n \"enabled\": false,\n \"agentId\": null,\n \"agentName\": null,\n \"agentDescription\": null,\n \"agentImage\": null,\n \"models\": [],\n \"profiles\": [],\n \"common\": { \"enableChat\": false }\n },\n \"routine\": { \"enabled\": false }\n },\n \"packages\": [],\n \"externalSkills\": [],\n \"publishHistory\": [],\n \"deployment\": {\n \"proxyEnabled\": false,\n \"observabilityEnabled\": false,\n \"supportedResources\": [\n \"vetra-agent-s\",\n \"vetra-agent-m\",\n \"vetra-agent-l\",\n \"vetra-agent-xl\",\n \"vetra-agent-xxl\"\n ]\n }\n}"
9375
+ initialValue: "{\n \"name\": null,\n \"scope\": null,\n \"version\": \"0.1.0\",\n \"description\": \"\",\n \"features\": {\n \"powerhouse\": \"Disabled\",\n \"mastra\": {\n \"enabled\": false,\n \"mainAgent\": null,\n \"subAgents\": [],\n \"models\": [],\n \"profiles\": [],\n \"common\": { \"enableChat\": false }\n },\n \"routine\": { \"enabled\": false }\n },\n \"packages\": [],\n \"externalSkills\": [],\n \"publishHistory\": [],\n \"deployment\": {\n \"proxyEnabled\": false,\n \"observabilityEnabled\": false,\n \"supportedResources\": [\n \"vetra-agent-s\",\n \"vetra-agent-m\",\n \"vetra-agent-l\",\n \"vetra-agent-xl\",\n \"vetra-agent-xxl\"\n ]\n }\n}"
9202
9376
  }
9203
9377
  },
9204
9378
  modules: [
@@ -9277,117 +9451,113 @@ const documentModel = {
9277
9451
  }]
9278
9452
  },
9279
9453
  {
9280
- id: "m-features-mastra",
9281
- name: "features_mastra",
9282
- description: "Mastra agent feature toggle. Orthogonal to Routine.",
9454
+ id: "m-features-routine",
9455
+ name: "features_routine",
9456
+ description: "Routine loop feature toggle.",
9457
+ operations: [{
9458
+ id: "o-enable-routine",
9459
+ name: "ENABLE_ROUTINE",
9460
+ description: "Enable the routine loop. Idempotent.",
9461
+ schema: "input EnableRoutineInput {\n _: Boolean\n}",
9462
+ template: "Enable the routine loop. Idempotent.",
9463
+ reducer: "state.features.routine.enabled = true;",
9464
+ errors: [],
9465
+ examples: [],
9466
+ scope: "global"
9467
+ }, {
9468
+ id: "o-disable-routine",
9469
+ name: "DISABLE_ROUTINE",
9470
+ description: "Disable the routine loop. Always allowed.",
9471
+ schema: "input DisableRoutineInput {\n _: Boolean\n}",
9472
+ template: "Disable the routine loop.",
9473
+ reducer: "state.features.routine.enabled = false;",
9474
+ errors: [],
9475
+ examples: [],
9476
+ scope: "global"
9477
+ }]
9478
+ },
9479
+ {
9480
+ id: "m-powerhouse-packages",
9481
+ name: "powerhouse_packages",
9482
+ description: "Manage reactor packages and their document types. The app package is auto-created when Powerhouse level goes above Disabled.",
9283
9483
  operations: [
9284
9484
  {
9285
- id: "o-enable-mastra",
9286
- name: "ENABLE_MASTRA",
9287
- description: "Enable the Mastra agent feature. Mastra and Routine are orthogonal — enable Routine separately if needed. Idempotent.",
9288
- schema: "input EnableMastraInput {\n agentId: String!\n agentName: String!\n}",
9289
- template: "Enable the Mastra agent feature. Mastra and Routine are orthogonal — enable Routine separately if needed. Idempotent.",
9290
- reducer: "if (!/^[a-z][a-z0-9-]*$/.test(action.input.agentId)) {\n throw new InvalidAgentIdError(\n `Invalid agent ID: ${action.input.agentId}. Must be lowercase kebab-case.`,\n );\n}\nconst trimmedName = action.input.agentName.trim();\nif (!trimmedName) {\n throw new InvalidAgentNameError('Agent name must not be empty.');\n}\nstate.features.mastra.enabled = true;\nstate.features.mastra.agentId = action.input.agentId;\nstate.features.mastra.agentName = trimmedName;\n// Auto-add default model and profile\nif (state.features.mastra.models.length === 0) {\n state.features.mastra.models.push({ id: 'clint/demo-agent', isDefault: true });\n}\nif (state.features.mastra.profiles.length === 0) {\n state.features.mastra.profiles.push({ id: 'base', title: 'Base Profile', content: 'You are a helpful assistant.' });\n}",
9485
+ id: "o-add-powerhouse-package",
9486
+ name: "ADD_POWERHOUSE_PACKAGE",
9487
+ description: "Add an external reactor package. The app package is auto-managed by SET_POWERHOUSE_LEVEL.",
9488
+ schema: "input AddPowerhousePackageInput {\n id: OID!\n packageName: String!\n}",
9489
+ template: "Add an external reactor package. The app package is auto-managed by SET_POWERHOUSE_LEVEL.",
9490
+ reducer: "const exists = state.packages.find(\n (p) =>\n p.id === action.input.id ||\n p.packageName === action.input.packageName,\n);\nif (exists) {\n throw new DuplicatePackageError(\n `Package already exists: ${action.input.packageName}`,\n );\n}\nstate.packages.push({\n id: action.input.id,\n packageName: action.input.packageName,\n documentTypes: [],\n version: null,\n managed: false,\n});",
9291
9491
  errors: [{
9292
- id: "e-enable-mastra-invalid-id",
9293
- name: "InvalidAgentIdError",
9294
- code: "INVALID_AGENT_ID",
9295
- description: "The agent ID must match /^[a-z][a-z0-9-]*$/ — lowercase kebab-case.",
9296
- template: ""
9297
- }, {
9298
- id: "e-enable-mastra-invalid-name",
9299
- name: "InvalidAgentNameError",
9300
- code: "INVALID_AGENT_NAME",
9301
- description: "The agent name must not be empty after trimming.",
9492
+ id: "e-duplicate-package",
9493
+ name: "DuplicatePackageError",
9494
+ code: "DUPLICATE_PACKAGE",
9495
+ description: "A package with the same ID or name already exists.",
9302
9496
  template: ""
9303
9497
  }],
9304
9498
  examples: [],
9305
9499
  scope: "global"
9306
9500
  },
9307
9501
  {
9308
- id: "o-disable-mastra",
9309
- name: "DISABLE_MASTRA",
9310
- description: "Disable the Mastra agent feature. Does not affect Routine — disable that separately if desired.",
9311
- schema: "input DisableMastraInput {\n _: Boolean\n}",
9312
- template: "Disable the Mastra agent feature. Does not affect Routine — disable that separately if desired.",
9313
- reducer: "state.features.mastra.enabled = false;\nstate.features.mastra.agentId = null;\nstate.features.mastra.agentName = null;\nstate.features.mastra.agentDescription = null;\nstate.features.mastra.agentImage = null;\nstate.features.mastra.models = [];\nstate.features.mastra.profiles = [];\nstate.features.mastra.common.enableChat = false;\n// Remove auto-added clint-common package if managed\nconst ccIdx = state.packages.findIndex(\n (p) => p.packageName === '@powerhousedao/clint-common' && p.managed,\n);\nif (ccIdx !== -1) {\n state.packages.splice(ccIdx, 1);\n}",
9314
- errors: [],
9502
+ id: "o-remove-powerhouse-package",
9503
+ name: "REMOVE_POWERHOUSE_PACKAGE",
9504
+ description: "Remove a reactor package. Cannot remove the auto-managed app package.",
9505
+ schema: "input RemovePowerhousePackageInput {\n id: OID!\n}",
9506
+ template: "Remove a reactor package. Cannot remove the auto-managed app package.",
9507
+ reducer: "const idx = state.packages.findIndex((p) => p.id === action.input.id);\nif (idx === -1) {\n throw new PackageNotFoundError(`Package not found: ${action.input.id}`);\n}\nconst pkg = state.packages[idx];\nif (pkg.managed) {\n throw new CannotRemoveManagedPackageError(\n \"Cannot remove a managed package\",\n );\n}\nstate.packages.splice(idx, 1);",
9508
+ errors: [
9509
+ {
9510
+ id: "e-package-not-found-remove",
9511
+ name: "PackageNotFoundError",
9512
+ code: "PACKAGE_NOT_FOUND",
9513
+ description: "The specified package ID was not found.",
9514
+ template: ""
9515
+ },
9516
+ {
9517
+ id: "e-cannot-remove-app-package",
9518
+ name: "CannotRemoveAppPackageError",
9519
+ code: "CANNOT_REMOVE_APP_PACKAGE",
9520
+ description: "The auto-managed app package cannot be removed.",
9521
+ template: ""
9522
+ },
9523
+ {
9524
+ id: "e-cannot-remove-managed",
9525
+ name: "CannotRemoveManagedPackageError",
9526
+ code: "CANNOT_REMOVE_MANAGED_PACKAGE",
9527
+ description: "Cannot remove a managed (framework-controlled) package",
9528
+ template: ""
9529
+ }
9530
+ ],
9315
9531
  examples: [],
9316
9532
  scope: "global"
9317
9533
  },
9318
9534
  {
9319
- id: "o-set-agent-id",
9320
- name: "SET_AGENT_ID",
9321
- description: "Set the agent ID. Must be lowercase kebab-case. Only valid when mastra is enabled.",
9322
- schema: "input SetAgentIdInput {\n agentId: String!\n}",
9323
- template: "Set the agent ID. Must be lowercase kebab-case. Only valid when mastra is enabled.",
9324
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set agent ID when Mastra is disabled.');\n}\nif (!/^[a-z][a-z0-9-]*$/.test(action.input.agentId)) {\n throw new InvalidAgentIdError(`Invalid agent ID: ${action.input.agentId}. Must be lowercase kebab-case.`);\n}\nstate.features.mastra.agentId = action.input.agentId;",
9325
- errors: [{
9326
- id: "e-set-agent-id-not-enabled",
9327
- name: "MastraNotEnabledError",
9328
- code: "MASTRA_NOT_ENABLED",
9329
- description: "Mastra must be enabled before setting agent identity.",
9330
- template: ""
9331
- }, {
9332
- id: "e-set-agent-id-invalid",
9333
- name: "InvalidAgentIdError",
9334
- code: "INVALID_AGENT_ID",
9335
- description: "The agent ID must match /^[a-z][a-z0-9-]*$/ — lowercase kebab-case.",
9336
- template: ""
9337
- }],
9338
- examples: [],
9339
- scope: "global"
9340
- },
9341
- {
9342
- id: "o-set-agent-name",
9343
- name: "SET_AGENT_NAME",
9344
- description: "Set the agent display name. Must be non-empty after trim. Only valid when mastra is enabled.",
9345
- schema: "input SetAgentNameInput {\n agentName: String!\n}",
9346
- template: "Set the agent display name. Must be non-empty after trim. Only valid when mastra is enabled.",
9347
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set agent name when Mastra is disabled.');\n}\nconst trimmedName = action.input.agentName.trim();\nif (!trimmedName) {\n throw new InvalidAgentNameError('Agent name must not be empty.');\n}\nstate.features.mastra.agentName = trimmedName;",
9348
- errors: [{
9349
- id: "e-set-agent-name-not-enabled",
9350
- name: "MastraNotEnabledError",
9351
- code: "MASTRA_NOT_ENABLED",
9352
- description: "Mastra must be enabled before setting agent identity.",
9353
- template: ""
9354
- }, {
9355
- id: "e-set-agent-name-invalid",
9356
- name: "InvalidAgentNameError",
9357
- code: "INVALID_AGENT_NAME",
9358
- description: "The agent name must not be empty after trimming.",
9359
- template: ""
9360
- }],
9361
- examples: [],
9362
- scope: "global"
9363
- },
9364
- {
9365
- id: "o-add-model",
9366
- name: "ADD_MODEL",
9367
- description: "Add a model to the agent. ID must be provider/model-name format. First model is forced default. If isDefault is true, previous default is unset.",
9368
- schema: "input AddModelInput {\n id: String!\n isDefault: Boolean\n}",
9369
- template: "Add a model to the agent. ID must be provider/model-name format. First model is forced default. If isDefault is true, previous default is unset.",
9370
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add model when Mastra is disabled.');\n}\nif (!/^[a-z0-9-]+\\/[a-z0-9._-]+$/.test(action.input.id)) {\n throw new InvalidModelIdError(`Invalid model ID: ${action.input.id}. Must be provider/model-name format.`);\n}\nif (state.features.mastra.models.find(m => m.id === action.input.id)) {\n throw new DuplicateModelError(`Model already exists: ${action.input.id}`);\n}\nconst isFirst = state.features.mastra.models.length === 0;\nconst makeDefault = isFirst || action.input.isDefault === true;\nif (makeDefault) {\n for (const m of state.features.mastra.models) {\n m.isDefault = false;\n }\n}\nstate.features.mastra.models.push({\n id: action.input.id,\n isDefault: makeDefault,\n});",
9535
+ id: "o-add-package-document-type",
9536
+ name: "ADD_PACKAGE_DOCUMENT_TYPE",
9537
+ description: "Add a document type ID to a package (app or external).",
9538
+ schema: "input AddPackageDocumentTypeInput {\n packageId: OID!\n documentType: String!\n}",
9539
+ template: "Add a document type ID to a package (app or external).",
9540
+ reducer: "if (action.input.documentType !== '*/*' && !/^[a-z0-9-]+\\/[a-z0-9-]+$/.test(action.input.documentType)) {\n throw new InvalidDocumentTypeError(\n `Invalid document type format: ${action.input.documentType}. Expected org/name.`,\n );\n}\nconst pkg = state.packages.find((p) => p.id === action.input.packageId);\nif (!pkg) {\n throw new PackageNotFoundError(\n `Package not found: ${action.input.packageId}`,\n );\n}\nif (action.input.documentType === '*/*') {\n pkg.documentTypes.length = 0;\n pkg.documentTypes.push('*/*');\n return;\n}\nif (pkg.documentTypes.includes('*/*')) {\n return;\n}\nif (pkg.documentTypes.includes(action.input.documentType)) {\n throw new DuplicateDocumentTypeError(\n `Document type already registered: ${action.input.documentType}`,\n );\n}\npkg.documentTypes.push(action.input.documentType);",
9371
9541
  errors: [
9372
9542
  {
9373
- id: "e-add-model-not-enabled",
9374
- name: "MastraNotEnabledError",
9375
- code: "MASTRA_NOT_ENABLED",
9376
- description: "Mastra must be enabled before managing models.",
9543
+ id: "e-invalid-document-type",
9544
+ name: "InvalidDocumentTypeError",
9545
+ code: "INVALID_DOCUMENT_TYPE",
9546
+ description: "Document type must match org/name format (e.g. powerhouse/ph-clint-project).",
9377
9547
  template: ""
9378
9548
  },
9379
9549
  {
9380
- id: "e-add-model-invalid-id",
9381
- name: "InvalidModelIdError",
9382
- code: "INVALID_MODEL_ID",
9383
- description: "Model ID must match provider/model-name format.",
9550
+ id: "e-package-not-found-add-dt",
9551
+ name: "PackageNotFoundError",
9552
+ code: "PACKAGE_NOT_FOUND",
9553
+ description: "The specified package ID was not found.",
9384
9554
  template: ""
9385
9555
  },
9386
9556
  {
9387
- id: "e-add-model-duplicate",
9388
- name: "DuplicateModelError",
9389
- code: "DUPLICATE_MODEL",
9390
- description: "A model with this ID already exists.",
9557
+ id: "e-duplicate-document-type",
9558
+ name: "DuplicateDocumentTypeError",
9559
+ code: "DUPLICATE_DOCUMENT_TYPE",
9560
+ description: "This document type is already registered in the package.",
9391
9561
  template: ""
9392
9562
  }
9393
9563
  ],
@@ -9395,85 +9565,125 @@ const documentModel = {
9395
9565
  scope: "global"
9396
9566
  },
9397
9567
  {
9398
- id: "o-remove-model",
9399
- name: "REMOVE_MODEL",
9400
- description: "Remove a model. If removing the default and others remain, promotes first remaining to default.",
9401
- schema: "input RemoveModelInput {\n id: String!\n}",
9402
- template: "Remove a model. If removing the default and others remain, promotes first remaining to default.",
9403
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove model when Mastra is disabled.');\n}\nconst idx = state.features.mastra.models.findIndex(m => m.id === action.input.id);\nif (idx === -1) {\n throw new ModelNotFoundError(`Model not found: ${action.input.id}`);\n}\nconst wasDefault = state.features.mastra.models[idx].isDefault;\nstate.features.mastra.models.splice(idx, 1);\nif (wasDefault && state.features.mastra.models.length > 0) {\n state.features.mastra.models[0].isDefault = true;\n}",
9568
+ id: "o-remove-package-document-type",
9569
+ name: "REMOVE_PACKAGE_DOCUMENT_TYPE",
9570
+ description: "Remove a document type ID from a package.",
9571
+ schema: "input RemovePackageDocumentTypeInput {\n packageId: OID!\n documentType: String!\n}",
9572
+ template: "Remove a document type ID from a package.",
9573
+ reducer: "const pkg = state.packages.find(p => p.id === action.input.packageId);\nif (!pkg) {\n throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);\n}\nconst idx = pkg.documentTypes.indexOf(action.input.documentType);\nif (idx === -1) {\n throw new DocumentTypeNotFoundError(`Document type not found: ${action.input.documentType}`);\n}\npkg.documentTypes.splice(idx, 1);",
9404
9574
  errors: [{
9405
- id: "e-remove-model-not-enabled",
9406
- name: "MastraNotEnabledError",
9407
- code: "MASTRA_NOT_ENABLED",
9408
- description: "Mastra must be enabled before managing models.",
9575
+ id: "e-package-not-found-rm-dt",
9576
+ name: "PackageNotFoundError",
9577
+ code: "PACKAGE_NOT_FOUND",
9578
+ description: "The specified package ID was not found.",
9409
9579
  template: ""
9410
9580
  }, {
9411
- id: "e-remove-model-not-found",
9412
- name: "ModelNotFoundError",
9413
- code: "MODEL_NOT_FOUND",
9414
- description: "The specified model was not found.",
9581
+ id: "e-document-type-not-found",
9582
+ name: "DocumentTypeNotFoundError",
9583
+ code: "DOCUMENT_TYPE_NOT_FOUND",
9584
+ description: "The specified document type was not found in this package.",
9415
9585
  template: ""
9416
9586
  }],
9417
9587
  examples: [],
9418
9588
  scope: "global"
9419
9589
  },
9420
9590
  {
9421
- id: "o-set-default-model",
9422
- name: "SET_DEFAULT_MODEL",
9423
- description: "Set a model as the default. Unsets the previous default.",
9424
- schema: "input SetDefaultModelInput {\n id: String!\n}",
9425
- template: "Set a model as the default. Unsets the previous default.",
9426
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set default model when Mastra is disabled.');\n}\nconst model = state.features.mastra.models.find(m => m.id === action.input.id);\nif (!model) {\n throw new ModelNotFoundError(`Model not found: ${action.input.id}`);\n}\nfor (const m of state.features.mastra.models) {\n m.isDefault = false;\n}\nmodel.isDefault = true;",
9591
+ id: "o-set-package-version",
9592
+ name: "SET_PACKAGE_VERSION",
9593
+ description: "",
9594
+ schema: "input SetPackageVersionInput {\n packageId: OID!\n version: String\n}",
9595
+ template: "",
9596
+ reducer: "const pkg = state.packages.find((p) => p.id === action.input.packageId);\nif (!pkg) {\n throw new PackageNotFoundError(\n `Package not found: ${action.input.packageId}`,\n );\n}\nif (action.input.version != null) {\n const SEMVER = /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\n if (!SEMVER.test(action.input.version)) {\n throw new InvalidVersionError(\n `Invalid version: ${action.input.version}`,\n );\n }\n}\npkg.version = action.input.version || null;",
9427
9597
  errors: [{
9428
- id: "e-set-default-model-not-enabled",
9429
- name: "MastraNotEnabledError",
9430
- code: "MASTRA_NOT_ENABLED",
9431
- description: "Mastra must be enabled before managing models.",
9598
+ id: "e-pkg-not-found-set-ver",
9599
+ name: "PackageNotFoundError",
9600
+ code: "PACKAGE_NOT_FOUND",
9601
+ description: "Referenced package does not exist",
9432
9602
  template: ""
9433
9603
  }, {
9434
- id: "e-set-default-model-not-found",
9435
- name: "ModelNotFoundError",
9436
- code: "MODEL_NOT_FOUND",
9437
- description: "The specified model was not found.",
9604
+ id: "e-invalid-version",
9605
+ name: "InvalidVersionError",
9606
+ code: "INVALID_VERSION",
9607
+ description: "Version string is not valid semver",
9608
+ template: ""
9609
+ }],
9610
+ examples: [],
9611
+ scope: "global"
9612
+ }
9613
+ ]
9614
+ },
9615
+ {
9616
+ id: "m-external-skills",
9617
+ name: "external_skills",
9618
+ description: "External skills from the skills.sh ecosystem. Each skill has a name and GitHub URL for installation.",
9619
+ operations: [
9620
+ {
9621
+ id: "o-add-external-skill",
9622
+ name: "ADD_EXTERNAL_SKILL",
9623
+ description: "Add an external skill. Name must be lowercase kebab-case.",
9624
+ schema: "input AddExternalSkillInput {\n id: OID!\n name: String!\n githubUrl: URL!\n}",
9625
+ template: "Add an external skill. Name must be lowercase kebab-case.",
9626
+ reducer: "if (!/^[a-z][a-z0-9-]*$/.test(action.input.name)) {\n throw new InvalidSkillNameError(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);\n}\nconst exists = state.externalSkills.find(s => s.id === action.input.id || s.name === action.input.name);\nif (exists) {\n throw new DuplicateSkillError(`Skill already exists: ${action.input.name}`);\n}\nstate.externalSkills.push({\n id: action.input.id,\n name: action.input.name,\n githubUrl: action.input.githubUrl,\n});",
9627
+ errors: [{
9628
+ id: "e-invalid-skill-name",
9629
+ name: "InvalidSkillNameError",
9630
+ code: "INVALID_SKILL_NAME",
9631
+ description: "Skill name must be lowercase kebab-case (e.g. playwright-cli).",
9632
+ template: ""
9633
+ }, {
9634
+ id: "e-duplicate-skill",
9635
+ name: "DuplicateSkillError",
9636
+ code: "DUPLICATE_SKILL",
9637
+ description: "A skill with the same ID or name already exists.",
9438
9638
  template: ""
9439
9639
  }],
9440
9640
  examples: [],
9441
9641
  scope: "global"
9442
9642
  },
9443
9643
  {
9444
- id: "o-add-profile",
9445
- name: "ADD_PROFILE",
9446
- description: "Add an agent profile section. Inserted before insertBefore if provided, otherwise appended to end.",
9447
- schema: "input AddProfileInput {\n id: String!\n title: String!\n content: String!\n insertBefore: String\n}",
9448
- template: "Add an agent profile section. Inserted before insertBefore if provided, otherwise appended to end.",
9449
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add profile when Mastra is disabled.');\n}\nif (!/^[a-z][a-z0-9-]*$/.test(action.input.id)) {\n throw new InvalidProfileIdError(`Invalid profile ID: ${action.input.id}. Must be lowercase kebab-case.`);\n}\nif (state.features.mastra.profiles.find(p => p.id === action.input.id)) {\n throw new DuplicateProfileError(`Profile already exists: ${action.input.id}`);\n}\nconst profile = {\n id: action.input.id,\n title: action.input.title,\n content: action.input.content,\n};\nif (action.input.insertBefore) {\n const beforeIdx = state.features.mastra.profiles.findIndex(p => p.id === action.input.insertBefore);\n if (beforeIdx === -1) {\n throw new ProfileNotFoundError(`insertBefore profile not found: ${action.input.insertBefore}`);\n }\n state.features.mastra.profiles.splice(beforeIdx, 0, profile);\n} else {\n state.features.mastra.profiles.push(profile);\n}",
9644
+ id: "o-remove-external-skill",
9645
+ name: "REMOVE_EXTERNAL_SKILL",
9646
+ description: "Remove an external skill by ID.",
9647
+ schema: "input RemoveExternalSkillInput {\n id: OID!\n}",
9648
+ template: "Remove an external skill by ID.",
9649
+ reducer: "const idx = state.externalSkills.findIndex(s => s.id === action.input.id);\nif (idx === -1) {\n throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);\n}\nstate.externalSkills.splice(idx, 1);",
9650
+ errors: [{
9651
+ id: "e-skill-not-found-remove",
9652
+ name: "SkillNotFoundError",
9653
+ code: "SKILL_NOT_FOUND",
9654
+ description: "The specified skill ID was not found.",
9655
+ template: ""
9656
+ }],
9657
+ examples: [],
9658
+ scope: "global"
9659
+ },
9660
+ {
9661
+ id: "o-set-external-skill-name",
9662
+ name: "SET_EXTERNAL_SKILL_NAME",
9663
+ description: "Update the name of an external skill.",
9664
+ schema: "input SetExternalSkillNameInput {\n id: OID!\n name: String!\n}",
9665
+ template: "Update the name of an external skill.",
9666
+ reducer: "const skill = state.externalSkills.find(s => s.id === action.input.id);\nif (!skill) {\n throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);\n}\nif (!/^[a-z][a-z0-9-]*$/.test(action.input.name)) {\n throw new InvalidSkillNameError(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);\n}\nconst duplicate = state.externalSkills.find(s => s.name === action.input.name && s.id !== action.input.id);\nif (duplicate) {\n throw new DuplicateSkillError(`Skill name already in use: ${action.input.name}`);\n}\nskill.name = action.input.name;",
9450
9667
  errors: [
9451
9668
  {
9452
- id: "e-add-profile-not-enabled",
9453
- name: "MastraNotEnabledError",
9454
- code: "MASTRA_NOT_ENABLED",
9455
- description: "Mastra must be enabled before managing profiles.",
9456
- template: ""
9457
- },
9458
- {
9459
- id: "e-add-profile-invalid-id",
9460
- name: "InvalidProfileIdError",
9461
- code: "INVALID_PROFILE_ID",
9462
- description: "Profile ID must match /^[a-z][a-z0-9-]*$/ — lowercase kebab-case.",
9669
+ id: "e-skill-not-found-set-name",
9670
+ name: "SkillNotFoundError",
9671
+ code: "SKILL_NOT_FOUND",
9672
+ description: "The specified skill ID was not found.",
9463
9673
  template: ""
9464
9674
  },
9465
9675
  {
9466
- id: "e-add-profile-duplicate",
9467
- name: "DuplicateProfileError",
9468
- code: "DUPLICATE_PROFILE",
9469
- description: "A profile with this ID already exists.",
9676
+ id: "e-invalid-skill-name-set",
9677
+ name: "InvalidSkillNameError",
9678
+ code: "INVALID_SKILL_NAME",
9679
+ description: "Skill name must be lowercase kebab-case.",
9470
9680
  template: ""
9471
9681
  },
9472
9682
  {
9473
- id: "e-add-profile-not-found",
9474
- name: "ProfileNotFoundError",
9475
- code: "PROFILE_NOT_FOUND",
9476
- description: "The insertBefore profile was not found.",
9683
+ id: "e-duplicate-skill-set-name",
9684
+ name: "DuplicateSkillError",
9685
+ code: "DUPLICATE_SKILL",
9686
+ description: "Another skill already uses this name.",
9477
9687
  template: ""
9478
9688
  }
9479
9689
  ],
@@ -9481,131 +9691,222 @@ const documentModel = {
9481
9691
  scope: "global"
9482
9692
  },
9483
9693
  {
9484
- id: "o-update-profile",
9485
- name: "UPDATE_PROFILE",
9486
- description: "Update an existing profile's title and/or content. Only updates provided fields.",
9487
- schema: "input UpdateProfileInput {\n id: String!\n title: String\n content: String\n}",
9488
- template: "Update an existing profile's title and/or content. Only updates provided fields.",
9489
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot update profile when Mastra is disabled.');\n}\nconst profile = state.features.mastra.profiles.find(p => p.id === action.input.id);\nif (!profile) {\n throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);\n}\nif (action.input.title) profile.title = action.input.title;\nif (action.input.content) profile.content = action.input.content;",
9490
- errors: [{
9491
- id: "e-update-profile-not-enabled",
9492
- name: "MastraNotEnabledError",
9493
- code: "MASTRA_NOT_ENABLED",
9494
- description: "Mastra must be enabled before managing profiles.",
9495
- template: ""
9496
- }, {
9497
- id: "e-update-profile-not-found",
9498
- name: "ProfileNotFoundError",
9499
- code: "PROFILE_NOT_FOUND",
9500
- description: "The specified profile was not found.",
9501
- template: ""
9502
- }],
9503
- examples: [],
9504
- scope: "global"
9505
- },
9506
- {
9507
- id: "o-remove-profile",
9508
- name: "REMOVE_PROFILE",
9509
- description: "Remove an agent profile section.",
9510
- schema: "input RemoveProfileInput {\n id: String!\n}",
9511
- template: "Remove an agent profile section.",
9512
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove profile when Mastra is disabled.');\n}\nconst idx = state.features.mastra.profiles.findIndex(p => p.id === action.input.id);\nif (idx === -1) {\n throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);\n}\nstate.features.mastra.profiles.splice(idx, 1);",
9694
+ id: "o-set-external-skill-github-url",
9695
+ name: "SET_EXTERNAL_SKILL_GITHUB_URL",
9696
+ description: "Update the GitHub URL of an external skill.",
9697
+ schema: "input SetExternalSkillGithubUrlInput {\n id: OID!\n githubUrl: URL!\n}",
9698
+ template: "Update the GitHub URL of an external skill.",
9699
+ reducer: "const skill = state.externalSkills.find(s => s.id === action.input.id);\nif (!skill) {\n throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);\n}\nskill.githubUrl = action.input.githubUrl;",
9513
9700
  errors: [{
9514
- id: "e-remove-profile-not-enabled",
9515
- name: "MastraNotEnabledError",
9516
- code: "MASTRA_NOT_ENABLED",
9517
- description: "Mastra must be enabled before managing profiles.",
9518
- template: ""
9519
- }, {
9520
- id: "e-remove-profile-not-found",
9521
- name: "ProfileNotFoundError",
9522
- code: "PROFILE_NOT_FOUND",
9523
- description: "The specified profile was not found.",
9701
+ id: "e-skill-not-found-set-url",
9702
+ name: "SkillNotFoundError",
9703
+ code: "SKILL_NOT_FOUND",
9704
+ description: "The specified skill ID was not found.",
9524
9705
  template: ""
9525
9706
  }],
9526
9707
  examples: [],
9527
9708
  scope: "global"
9528
- },
9709
+ }
9710
+ ]
9711
+ },
9712
+ {
9713
+ id: "m-publishing",
9714
+ name: "publishing",
9715
+ description: "Version bumping and publish records. Tracks dev/staging/production publish intents and their status.",
9716
+ operations: [
9529
9717
  {
9530
- id: "o-reorder-profiles",
9531
- name: "REORDER_PROFILES",
9532
- description: "Move one or more profiles before another profile, or to the end if insertBefore is null.",
9533
- schema: "input ReorderProfilesInput {\n ids: [String!]!\n insertBefore: String\n}",
9534
- template: "Move one or more profiles before another profile, or to the end if insertBefore is null.",
9535
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot reorder profiles when Mastra is disabled.');\n}\nconst moving = [];\nfor (const id of action.input.ids) {\n const profile = state.features.mastra.profiles.find(p => p.id === id);\n if (!profile) {\n throw new ProfileNotFoundError(`Profile not found: ${id}`);\n }\n moving.push(profile);\n}\n// Remove moved profiles\nstate.features.mastra.profiles = state.features.mastra.profiles.filter(p => !action.input.ids.includes(p.id));\n// Insert at target position\nif (action.input.insertBefore) {\n const beforeIdx = state.features.mastra.profiles.findIndex(p => p.id === action.input.insertBefore);\n if (beforeIdx === -1) {\n throw new ProfileNotFoundError(`insertBefore profile not found: ${action.input.insertBefore}`);\n }\n state.features.mastra.profiles.splice(beforeIdx, 0, ...moving);\n} else {\n state.features.mastra.profiles.push(...moving);\n}",
9718
+ id: "o-bump-version",
9719
+ name: "BUMP_VERSION",
9720
+ description: "Bump the project version. Must be a valid semver string greater than the current version.",
9721
+ schema: "input BumpVersionInput {\n version: String!\n}",
9722
+ template: "Bump the project version. Must be a valid semver string greater than the current version.",
9723
+ reducer: "if (!/^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/.test(action.input.version)) {\n throw new InvalidVersionError(`Invalid version: ${action.input.version}`);\n}\nstate.version = action.input.version;",
9536
9724
  errors: [{
9537
- id: "e-reorder-profiles-not-enabled",
9538
- name: "MastraNotEnabledError",
9539
- code: "MASTRA_NOT_ENABLED",
9540
- description: "Mastra must be enabled before managing profiles.",
9541
- template: ""
9542
- }, {
9543
- id: "e-reorder-profiles-not-found",
9544
- name: "ProfileNotFoundError",
9545
- code: "PROFILE_NOT_FOUND",
9546
- description: "A referenced profile was not found.",
9725
+ id: "e-invalid-version-bump",
9726
+ name: "InvalidVersionError",
9727
+ code: "INVALID_VERSION",
9728
+ description: "The version must be a valid semver string.",
9547
9729
  template: ""
9548
9730
  }],
9549
9731
  examples: [],
9550
9732
  scope: "global"
9551
9733
  },
9552
9734
  {
9553
- id: "o-set-agent-description",
9554
- name: "SET_AGENT_DESCRIPTION",
9555
- description: "Set the agent description. Only valid when mastra is enabled.",
9556
- schema: "input SetAgentDescriptionInput {\n description: String!\n}",
9557
- template: "Set the agent description. Only valid when mastra is enabled.",
9558
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set agent description when Mastra is disabled.');\n}\nstate.features.mastra.agentDescription = action.input.description;",
9559
- errors: [{
9560
- id: "e-set-agent-desc-not-enabled",
9561
- name: "MastraNotEnabledError",
9562
- code: "MASTRA_NOT_ENABLED",
9563
- description: "Mastra must be enabled before setting agent description.",
9564
- template: ""
9565
- }],
9735
+ id: "o-publish-dev",
9736
+ name: "PUBLISH_DEV",
9737
+ description: "Record a dev publish intent. Creates a Pending publish record.",
9738
+ schema: "input PublishDevInput {\n id: OID!\n timestamp: DateTime!\n}",
9739
+ template: "Record a dev publish intent. Creates a Pending publish record.",
9740
+ reducer: "state.publishHistory.push({\n id: action.input.id,\n tag: 'Dev',\n version: state.version,\n timestamp: action.input.timestamp,\n status: 'Pending',\n});",
9741
+ errors: [],
9566
9742
  examples: [],
9567
9743
  scope: "global"
9568
9744
  },
9569
9745
  {
9570
- id: "o-set-agent-image",
9571
- name: "SET_AGENT_IMAGE",
9572
- description: "Set the agent image URL (avatar). Only valid when mastra is enabled.",
9573
- schema: "input SetAgentImageInput {\n image: String!\n}",
9574
- template: "Set the agent image URL (avatar). Only valid when mastra is enabled.",
9575
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError(\n 'Cannot set agent image when Mastra is disabled.',\n );\n}\nif (!/^data:[a-z]+\\/[a-z0-9.+-]+;base64,/.test(action.input.image)) {\n throw new InvalidAgentImageError(\n 'Agent image must be a data URL (data:image/...;base64,...)',\n );\n}\nstate.features.mastra.agentImage = action.input.image;",
9746
+ id: "o-publish-staging",
9747
+ name: "PUBLISH_STAGING",
9748
+ description: "Record a staging publish intent. Creates a Pending publish record.",
9749
+ schema: "input PublishStagingInput {\n id: OID!\n timestamp: DateTime!\n}",
9750
+ template: "Record a staging publish intent. Creates a Pending publish record.",
9751
+ reducer: "state.publishHistory.push({\n id: action.input.id,\n tag: 'Staging',\n version: state.version,\n timestamp: action.input.timestamp,\n status: 'Pending',\n});",
9752
+ errors: [],
9753
+ examples: [],
9754
+ scope: "global"
9755
+ },
9756
+ {
9757
+ id: "o-publish-production",
9758
+ name: "PUBLISH_PRODUCTION",
9759
+ description: "Record a production publish intent. Creates a Pending publish record.",
9760
+ schema: "input PublishProductionInput {\n id: OID!\n timestamp: DateTime!\n}",
9761
+ template: "Record a production publish intent. Creates a Pending publish record.",
9762
+ reducer: "state.publishHistory.push({\n id: action.input.id,\n tag: 'Production',\n version: state.version,\n timestamp: action.input.timestamp,\n status: 'Pending',\n});",
9763
+ errors: [],
9764
+ examples: [],
9765
+ scope: "global"
9766
+ },
9767
+ {
9768
+ id: "o-set-publish-status",
9769
+ name: "SET_PUBLISH_STATUS",
9770
+ description: "Update the status of a publish record. Used by the trigger after publish completes.",
9771
+ schema: "input SetPublishStatusInput {\n id: OID!\n status: PublishStatus!\n}",
9772
+ template: "Update the status of a publish record. Used by the trigger after publish completes.",
9773
+ reducer: "const record = state.publishHistory.find(r => r.id === action.input.id);\nif (!record) {\n throw new PublishRecordNotFoundError(`Publish record not found: ${action.input.id}`);\n}\nrecord.status = action.input.status;",
9576
9774
  errors: [{
9577
- id: "e-set-agent-image-not-enabled",
9578
- name: "MastraNotEnabledError",
9579
- code: "MASTRA_NOT_ENABLED",
9580
- description: "Mastra must be enabled before setting agent image.",
9775
+ id: "e-publish-record-not-found",
9776
+ name: "PublishRecordNotFoundError",
9777
+ code: "PUBLISH_RECORD_NOT_FOUND",
9778
+ description: "The specified publish record ID was not found.",
9581
9779
  template: ""
9582
- }, {
9583
- id: "e-invalid-agent-image",
9584
- name: "InvalidAgentImageError",
9585
- code: "INVALID_AGENT_IMAGE",
9586
- description: "Agent image must be a data URL",
9780
+ }],
9781
+ examples: [],
9782
+ scope: "global"
9783
+ }
9784
+ ]
9785
+ },
9786
+ {
9787
+ id: "m-lifecycle",
9788
+ name: "lifecycle",
9789
+ description: "Document lifecycle operations. IMPORT_SPEC bulk-imports a full project spec into the document.",
9790
+ operations: [{
9791
+ id: "o-import-spec",
9792
+ name: "IMPORT_SPEC",
9793
+ description: "Bulk-import a full project spec into the document. Sets all identity fields, features, packages, and skills. Used by the multi-project boot sync.",
9794
+ schema: "input ImportSpecInput {\n name: String!\n scope: String\n version: String!\n description: String!\n powerhouse: PowerhouseLevel!\n mastraEnabled: Boolean!\n routineEnabled: Boolean!\n packages: [ImportPackageInput!]!\n externalSkills: [ImportSkillInput!]!\n mainAgent: ImportMainAgentInput\n subAgents: [ImportSubAgentInput!]!\n models: [ImportModelInput!]!\n profiles: [ImportProfileInput!]!\n enableChat: Boolean\n proxyEnabled: Boolean\n observabilityEnabled: Boolean\n supportedResources: [String!]\n}\n\ninput ImportPackageInput {\n id: OID!\n packageName: String!\n documentTypes: [String!]!\n version: String\n}\n\ninput ImportSkillInput {\n id: OID!\n name: String!\n githubUrl: URL!\n}\n\ninput ImportModelInput {\n id: OID!\n}\n\ninput ImportProfileInput {\n id: OID!\n title: String!\n content: String!\n}\n\ninput ImportMainAgentInput {\n id: OID!\n name: String!\n description: String\n image: String\n modelId: OID!\n profileIds: [OID!]!\n skills: [String!]!\n toolPatterns: [String!]!\n}\n\ninput ImportSubAgentInput {\n id: OID!\n name: String!\n description: String!\n modelId: OID!\n profileIds: [OID!]!\n skills: [String!]!\n toolPatterns: [String!]!\n}",
9795
+ template: "Bulk-import a full project spec into the document. Sets all identity fields, features, packages, and skills. Used by the multi-project boot sync.",
9796
+ reducer: "state.name = action.input.name;\nstate.scope = action.input.scope || null;\nstate.version = action.input.version;\nstate.description = action.input.description;\nstate.features.powerhouse = action.input.powerhouse;\nstate.features.mastra.enabled = action.input.mastraEnabled;\nstate.features.routine.enabled = action.input.routineEnabled;\n\nconst appBase = action.input.name.replace(/-cli$/, '-app');\nconst appPkgName = action.input.scope\n ? `${action.input.scope}/${appBase}`\n : appBase;\nconst phEnabled = action.input.powerhouse !== 'Disabled';\n\nstate.packages = action.input.packages.map((p) => ({\n id: p.id,\n packageName: p.packageName,\n documentTypes: [...p.documentTypes],\n version: p.version || null,\n managed: phEnabled && p.packageName === appPkgName,\n}));\nstate.externalSkills = action.input.externalSkills.map((s) => ({\n id: s.id,\n name: s.name,\n githubUrl: s.githubUrl,\n}));\n\nstate.features.mastra.models = action.input.models.map((m) => ({\n id: m.id,\n}));\nstate.features.mastra.profiles = action.input.profiles.map((p) => ({\n id: p.id,\n title: p.title,\n content: p.content,\n}));\n\nif (action.input.mainAgent && state.features.mastra.enabled) {\n const m = action.input.mainAgent;\n let image = null;\n if (m.image) {\n if (!/^data:[a-z]+\\/[a-z0-9.+-]+;base64,/.test(m.image)) {\n throw new InvalidAgentImageError(\n 'Invalid image: must be a data URL (data:<mime>;base64,...)',\n );\n }\n image = m.image;\n }\n state.features.mastra.mainAgent = {\n id: m.id,\n name: m.name,\n description: m.description || null,\n image,\n modelId: m.modelId,\n profileIds: [...m.profileIds],\n skills: [...m.skills],\n toolPatterns: [...m.toolPatterns],\n };\n} else {\n state.features.mastra.mainAgent = null;\n}\n\nif (state.features.mastra.enabled) {\n state.features.mastra.subAgents = action.input.subAgents.map((s) => ({\n id: s.id,\n name: s.name,\n description: s.description,\n modelId: s.modelId,\n profileIds: [...s.profileIds],\n skills: [...s.skills],\n toolPatterns: [...s.toolPatterns],\n }));\n} else {\n state.features.mastra.subAgents = [];\n}\n\nif (\n action.input.enableChat &&\n state.features.mastra.enabled &&\n state.features.powerhouse !== 'Disabled'\n) {\n state.features.mastra.common.enableChat = true;\n const CLINT_COMMON_PKG = '@powerhousedao/clint-common';\n const CHAT_DOC_TYPE = 'powerhouse/chat-session';\n const existing = state.packages.find(\n (p) => p.packageName === CLINT_COMMON_PKG,\n );\n if (!existing) {\n state.packages.push({\n id: 'pkg-clint-common',\n packageName: CLINT_COMMON_PKG,\n documentTypes: [CHAT_DOC_TYPE],\n version: null,\n managed: true,\n });\n } else if (!existing.documentTypes.includes(CHAT_DOC_TYPE)) {\n existing.documentTypes.push(CHAT_DOC_TYPE);\n }\n} else {\n state.features.mastra.common.enableChat = false;\n}\n\nstate.deployment.proxyEnabled = action.input.proxyEnabled ?? false;\nstate.deployment.observabilityEnabled = action.input.observabilityEnabled ?? false;\nstate.deployment.supportedResources = action.input.supportedResources\n ? [...action.input.supportedResources]\n : [];",
9797
+ errors: [{
9798
+ id: "e-import-spec-invalid-image",
9799
+ name: "InvalidAgentImageError",
9800
+ code: "INVALID_AGENT_IMAGE",
9801
+ description: "Agent image must be a data URL",
9802
+ template: ""
9803
+ }],
9804
+ examples: [],
9805
+ scope: "global"
9806
+ }]
9807
+ },
9808
+ {
9809
+ id: "m-deployment",
9810
+ name: "deployment",
9811
+ description: "Deployment settings: service announcement toggle and supported resource tiers.",
9812
+ operations: [
9813
+ {
9814
+ id: "o-add-supported-resource",
9815
+ name: "ADD_SUPPORTED_RESOURCE",
9816
+ description: "Add a supported resource tier. Guards against duplicates.",
9817
+ schema: "input AddSupportedResourceInput {\n resource: String!\n}",
9818
+ template: "Add a supported resource tier. Guards against duplicates.",
9819
+ reducer: "if (state.deployment.supportedResources.includes(action.input.resource)) {\n throw new DuplicateResourceError(`Resource already exists: ${action.input.resource}`);\n}\nstate.deployment.supportedResources.push(action.input.resource);",
9820
+ errors: [{
9821
+ id: "e-duplicate-resource",
9822
+ name: "DuplicateResourceError",
9823
+ code: "DUPLICATE_RESOURCE",
9824
+ description: "This resource is already in the supported resources list.",
9587
9825
  template: ""
9588
9826
  }],
9589
9827
  examples: [],
9590
9828
  scope: "global"
9591
9829
  },
9592
9830
  {
9593
- id: "o-clear-agent-image",
9594
- name: "CLEAR_AGENT_IMAGE",
9595
- description: "",
9596
- schema: "input ClearAgentImageInput {\n _: Boolean\n}",
9597
- template: "",
9598
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError(\n 'Cannot clear agent image when Mastra is disabled.',\n );\n}\nstate.features.mastra.agentImage = null;",
9831
+ id: "o-remove-supported-resource",
9832
+ name: "REMOVE_SUPPORTED_RESOURCE",
9833
+ description: "Remove a supported resource tier.",
9834
+ schema: "input RemoveSupportedResourceInput {\n resource: String!\n}",
9835
+ template: "Remove a supported resource tier.",
9836
+ reducer: "const idx = state.deployment.supportedResources.indexOf(action.input.resource);\nif (idx === -1) {\n throw new ResourceNotFoundError(`Resource not found: ${action.input.resource}`);\n}\nstate.deployment.supportedResources.splice(idx, 1);",
9599
9837
  errors: [{
9600
- id: "e-mastra-not-enabled-clear-img",
9601
- name: "MastraNotEnabledError",
9602
- code: "MASTRA_NOT_ENABLED",
9603
- description: "Mastra must be enabled",
9838
+ id: "e-resource-not-found",
9839
+ name: "ResourceNotFoundError",
9840
+ code: "RESOURCE_NOT_FOUND",
9841
+ description: "The specified resource was not found in the supported resources list.",
9842
+ template: ""
9843
+ }],
9844
+ examples: [],
9845
+ scope: "global"
9846
+ },
9847
+ {
9848
+ id: "o-set-proxy-enabled",
9849
+ name: "SET_PROXY_ENABLED",
9850
+ description: "Toggle the embedded reverse proxy.",
9851
+ schema: "input SetProxyEnabledInput {\n enabled: Boolean!\n}",
9852
+ template: "Toggle the embedded reverse proxy.",
9853
+ reducer: "state.deployment.proxyEnabled = action.input.enabled;",
9854
+ errors: [],
9855
+ examples: [],
9856
+ scope: "global"
9857
+ },
9858
+ {
9859
+ id: "o-set-observability-enabled",
9860
+ name: "SET_OBSERVABILITY_ENABLED",
9861
+ description: "Toggle the observability plugin (Sentry + OpenTelemetry).",
9862
+ schema: "input SetObservabilityEnabledInput {\n enabled: Boolean!\n}",
9863
+ template: "Toggle the observability plugin (Sentry + OpenTelemetry).",
9864
+ reducer: "state.deployment.observabilityEnabled = action.input.enabled;",
9865
+ errors: [],
9866
+ examples: [],
9867
+ scope: "global"
9868
+ }
9869
+ ]
9870
+ },
9871
+ {
9872
+ id: "m-features-mastra",
9873
+ name: "features_mastra",
9874
+ description: "Top-level Mastra feature toggles: enable/disable and chat integration.",
9875
+ operations: [
9876
+ {
9877
+ id: "o-enable-mastra",
9878
+ name: "ENABLE_MASTRA",
9879
+ description: "Enable Mastra. Seeds mainAgent with a default model (clint/demo-agent) and a base profile. Idempotent.",
9880
+ schema: "input EnableMastraInput {\n agentId: OID!\n agentName: String!\n}",
9881
+ template: "Enable the Mastra agent feature. Seeds mainAgent with the seeded model + profile.",
9882
+ reducer: "if (!/^[a-z][a-z0-9-]*$/.test(action.input.agentId)) {\n throw new InvalidAgentIdError(\n `Invalid agent ID: ${action.input.agentId}. Must be lowercase kebab-case.`,\n );\n}\nconst trimmedName = action.input.agentName.trim();\nif (!trimmedName) {\n throw new InvalidAgentNameError('Agent name must not be empty.');\n}\nstate.features.mastra.enabled = true;\nif (state.features.mastra.models.length === 0) {\n state.features.mastra.models.push({ id: 'clint/demo-agent' });\n}\nif (state.features.mastra.profiles.length === 0) {\n state.features.mastra.profiles.push({ id: 'base', title: 'Base Profile', content: 'You are a helpful assistant.' });\n}\nconst existing = state.features.mastra.mainAgent;\nif (!existing) {\n state.features.mastra.mainAgent = {\n id: action.input.agentId,\n name: trimmedName,\n description: null,\n image: null,\n modelId: 'clint/demo-agent',\n profileIds: ['base'],\n skills: [],\n toolPatterns: [],\n };\n} else {\n existing.id = action.input.agentId;\n existing.name = trimmedName;\n}",
9883
+ errors: [{
9884
+ id: "e-enable-mastra-invalid-id",
9885
+ name: "InvalidAgentIdError",
9886
+ code: "INVALID_AGENT_ID",
9887
+ description: "The agent ID must match /^[a-z][a-z0-9-]*$/ — lowercase kebab-case.",
9888
+ template: ""
9889
+ }, {
9890
+ id: "e-enable-mastra-invalid-name",
9891
+ name: "InvalidAgentNameError",
9892
+ code: "INVALID_AGENT_NAME",
9893
+ description: "The agent name must not be empty after trimming.",
9604
9894
  template: ""
9605
9895
  }],
9606
9896
  examples: [],
9607
9897
  scope: "global"
9608
9898
  },
9899
+ {
9900
+ id: "o-disable-mastra",
9901
+ name: "DISABLE_MASTRA",
9902
+ description: "Disable Mastra. Clears mainAgent, subAgents, models, profiles and the chat integration. Removes the auto-managed clint-common package.",
9903
+ schema: "input DisableMastraInput {\n _: Boolean\n}",
9904
+ template: "Disable the Mastra agent feature.",
9905
+ reducer: "state.features.mastra.enabled = false;\nstate.features.mastra.mainAgent = null;\nstate.features.mastra.subAgents = [];\nstate.features.mastra.models = [];\nstate.features.mastra.profiles = [];\nstate.features.mastra.common.enableChat = false;\nconst ccIdx = state.packages.findIndex(\n (p) => p.packageName === '@powerhousedao/clint-common' && p.managed,\n);\nif (ccIdx !== -1) {\n state.packages.splice(ccIdx, 1);\n}",
9906
+ errors: [],
9907
+ examples: [],
9908
+ scope: "global"
9909
+ },
9609
9910
  {
9610
9911
  id: "o-set-enable-chat",
9611
9912
  name: "SET_ENABLE_CHAT",
@@ -9632,80 +9933,114 @@ const documentModel = {
9632
9933
  ]
9633
9934
  },
9634
9935
  {
9635
- id: "m-features-routine",
9636
- name: "features_routine",
9637
- description: "Routine loop feature toggle.",
9936
+ id: "m-mastra-models",
9937
+ name: "mastra_models",
9938
+ description: "Model library CRUD. Models are referenced by main and sub agents via modelId.",
9638
9939
  operations: [{
9639
- id: "o-enable-routine",
9640
- name: "ENABLE_ROUTINE",
9641
- description: "Enable the routine loop. Idempotent.",
9642
- schema: "input EnableRoutineInput {\n _: Boolean\n}",
9643
- template: "Enable the routine loop. Idempotent.",
9644
- reducer: "state.features.routine.enabled = true;",
9645
- errors: [],
9940
+ id: "o-add-model",
9941
+ name: "ADD_MODEL",
9942
+ description: "Add a model to the library. ID must be provider/model-name format. First model is forced default. If isDefault is true, previous default is unset.",
9943
+ schema: "input AddModelInput {\n id: OID!\n}",
9944
+ template: "Add a model to the library.",
9945
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add model when Mastra is disabled.');\n}\nif (!/^[a-z0-9-]+\\/[a-z0-9._-]+$/.test(action.input.id)) {\n throw new InvalidModelIdError(`Invalid model ID: ${action.input.id}. Must be provider/model-name format.`);\n}\nif (state.features.mastra.models.find((m) => m.id === action.input.id)) {\n throw new DuplicateModelError(`Model already exists: ${action.input.id}`);\n}\nstate.features.mastra.models.push({ id: action.input.id });",
9946
+ errors: [
9947
+ {
9948
+ id: "e-add-model-not-enabled",
9949
+ name: "MastraNotEnabledError",
9950
+ code: "MASTRA_NOT_ENABLED",
9951
+ description: "Mastra must be enabled before managing models.",
9952
+ template: ""
9953
+ },
9954
+ {
9955
+ id: "e-add-model-invalid-id",
9956
+ name: "InvalidModelIdError",
9957
+ code: "INVALID_MODEL_ID",
9958
+ description: "Model ID must match provider/model-name format.",
9959
+ template: ""
9960
+ },
9961
+ {
9962
+ id: "e-add-model-duplicate",
9963
+ name: "DuplicateModelError",
9964
+ code: "DUPLICATE_MODEL",
9965
+ description: "A model with this ID already exists.",
9966
+ template: ""
9967
+ }
9968
+ ],
9646
9969
  examples: [],
9647
9970
  scope: "global"
9648
9971
  }, {
9649
- id: "o-disable-routine",
9650
- name: "DISABLE_ROUTINE",
9651
- description: "Disable the routine loop. Always allowed.",
9652
- schema: "input DisableRoutineInput {\n _: Boolean\n}",
9653
- template: "Disable the routine loop.",
9654
- reducer: "state.features.routine.enabled = false;",
9655
- errors: [],
9972
+ id: "o-remove-model",
9973
+ name: "REMOVE_MODEL",
9974
+ description: "Remove a model from the library. Rejects when any agent (main or sub) references it. Promotes first remaining to default if removing the current default.",
9975
+ schema: "input RemoveModelInput {\n id: OID!\n}",
9976
+ template: "Remove a model from the library.",
9977
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove model when Mastra is disabled.');\n}\nconst idx = state.features.mastra.models.findIndex((m) => m.id === action.input.id);\nif (idx === -1) {\n throw new ModelNotFoundError(`Model not found: ${action.input.id}`);\n}\nconst main = state.features.mastra.mainAgent;\nconst usedByMain = !!main && main.modelId === action.input.id;\nconst usedBySub = state.features.mastra.subAgents.some(\n (s) => s.modelId === action.input.id,\n);\nif (usedByMain || usedBySub) {\n throw new ModelInUseError(\n `Model ${action.input.id} is in use by an agent.`,\n );\n}\nstate.features.mastra.models.splice(idx, 1);",
9978
+ errors: [
9979
+ {
9980
+ id: "e-remove-model-not-enabled",
9981
+ name: "MastraNotEnabledError",
9982
+ code: "MASTRA_NOT_ENABLED",
9983
+ description: "Mastra must be enabled before managing models.",
9984
+ template: ""
9985
+ },
9986
+ {
9987
+ id: "e-remove-model-not-found",
9988
+ name: "ModelNotFoundError",
9989
+ code: "MODEL_NOT_FOUND",
9990
+ description: "The specified model was not found.",
9991
+ template: ""
9992
+ },
9993
+ {
9994
+ id: "e-remove-model-in-use",
9995
+ name: "ModelInUseError",
9996
+ code: "MODEL_IN_USE",
9997
+ description: "Cannot remove a model that is still referenced by an agent.",
9998
+ template: ""
9999
+ }
10000
+ ],
9656
10001
  examples: [],
9657
10002
  scope: "global"
9658
10003
  }]
9659
10004
  },
9660
10005
  {
9661
- id: "m-powerhouse-packages",
9662
- name: "powerhouse_packages",
9663
- description: "Manage reactor packages and their document types. The app package is auto-created when Powerhouse level goes above Disabled.",
10006
+ id: "m-mastra-profiles",
10007
+ name: "mastra_profiles",
10008
+ description: "Profile library CRUD. Profiles are referenced by main and sub agents via profileIds.",
9664
10009
  operations: [
9665
10010
  {
9666
- id: "o-add-powerhouse-package",
9667
- name: "ADD_POWERHOUSE_PACKAGE",
9668
- description: "Add an external reactor package. The app package is auto-managed by SET_POWERHOUSE_LEVEL.",
9669
- schema: "input AddPowerhousePackageInput {\n id: OID!\n packageName: String!\n}",
9670
- template: "Add an external reactor package. The app package is auto-managed by SET_POWERHOUSE_LEVEL.",
9671
- reducer: "const exists = state.packages.find(\n (p) =>\n p.id === action.input.id ||\n p.packageName === action.input.packageName,\n);\nif (exists) {\n throw new DuplicatePackageError(\n `Package already exists: ${action.input.packageName}`,\n );\n}\nstate.packages.push({\n id: action.input.id,\n packageName: action.input.packageName,\n documentTypes: [],\n version: null,\n managed: false,\n});",
9672
- errors: [{
9673
- id: "e-duplicate-package",
9674
- name: "DuplicatePackageError",
9675
- code: "DUPLICATE_PACKAGE",
9676
- description: "A package with the same ID or name already exists.",
9677
- template: ""
9678
- }],
9679
- examples: [],
9680
- scope: "global"
9681
- },
9682
- {
9683
- id: "o-remove-powerhouse-package",
9684
- name: "REMOVE_POWERHOUSE_PACKAGE",
9685
- description: "Remove a reactor package. Cannot remove the auto-managed app package.",
9686
- schema: "input RemovePowerhousePackageInput {\n id: OID!\n}",
9687
- template: "Remove a reactor package. Cannot remove the auto-managed app package.",
9688
- reducer: "const idx = state.packages.findIndex((p) => p.id === action.input.id);\nif (idx === -1) {\n throw new PackageNotFoundError(`Package not found: ${action.input.id}`);\n}\nconst pkg = state.packages[idx];\nif (pkg.managed) {\n throw new CannotRemoveManagedPackageError(\n \"Cannot remove a managed package\",\n );\n}\nstate.packages.splice(idx, 1);",
10011
+ id: "o-add-profile",
10012
+ name: "ADD_PROFILE",
10013
+ description: "Add a profile to the library. Inserted before insertBefore if provided, otherwise appended.",
10014
+ schema: "input AddProfileInput {\n id: OID!\n title: String!\n content: String!\n insertBefore: OID\n}",
10015
+ template: "Add a profile to the library.",
10016
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add profile when Mastra is disabled.');\n}\nif (!/^[a-z][a-z0-9-]*$/.test(action.input.id)) {\n throw new InvalidProfileIdError(`Invalid profile ID: ${action.input.id}. Must be lowercase kebab-case.`);\n}\nif (state.features.mastra.profiles.find(p => p.id === action.input.id)) {\n throw new DuplicateProfileError(`Profile already exists: ${action.input.id}`);\n}\nconst profile = {\n id: action.input.id,\n title: action.input.title,\n content: action.input.content,\n};\nif (action.input.insertBefore) {\n const beforeIdx = state.features.mastra.profiles.findIndex(p => p.id === action.input.insertBefore);\n if (beforeIdx === -1) {\n throw new ProfileNotFoundError(`insertBefore profile not found: ${action.input.insertBefore}`);\n }\n state.features.mastra.profiles.splice(beforeIdx, 0, profile);\n} else {\n state.features.mastra.profiles.push(profile);\n}",
9689
10017
  errors: [
9690
10018
  {
9691
- id: "e-package-not-found-remove",
9692
- name: "PackageNotFoundError",
9693
- code: "PACKAGE_NOT_FOUND",
9694
- description: "The specified package ID was not found.",
10019
+ id: "e-add-profile-not-enabled",
10020
+ name: "MastraNotEnabledError",
10021
+ code: "MASTRA_NOT_ENABLED",
10022
+ description: "Mastra must be enabled before managing profiles.",
9695
10023
  template: ""
9696
10024
  },
9697
10025
  {
9698
- id: "e-cannot-remove-app-package",
9699
- name: "CannotRemoveAppPackageError",
9700
- code: "CANNOT_REMOVE_APP_PACKAGE",
9701
- description: "The auto-managed app package cannot be removed.",
10026
+ id: "e-add-profile-invalid-id",
10027
+ name: "InvalidProfileIdError",
10028
+ code: "INVALID_PROFILE_ID",
10029
+ description: "Profile ID must match /^[a-z][a-z0-9-]*$/ — lowercase kebab-case.",
9702
10030
  template: ""
9703
10031
  },
9704
10032
  {
9705
- id: "e-cannot-remove-managed",
9706
- name: "CannotRemoveManagedPackageError",
9707
- code: "CANNOT_REMOVE_MANAGED_PACKAGE",
9708
- description: "Cannot remove a managed (framework-controlled) package",
10033
+ id: "e-add-profile-duplicate",
10034
+ name: "DuplicateProfileError",
10035
+ code: "DUPLICATE_PROFILE",
10036
+ description: "A profile with this ID already exists.",
10037
+ template: ""
10038
+ },
10039
+ {
10040
+ id: "e-add-profile-not-found",
10041
+ name: "ProfileNotFoundError",
10042
+ code: "PROFILE_NOT_FOUND",
10043
+ description: "The insertBefore profile was not found.",
9709
10044
  template: ""
9710
10045
  }
9711
10046
  ],
@@ -9713,32 +10048,55 @@ const documentModel = {
9713
10048
  scope: "global"
9714
10049
  },
9715
10050
  {
9716
- id: "o-add-package-document-type",
9717
- name: "ADD_PACKAGE_DOCUMENT_TYPE",
9718
- description: "Add a document type ID to a package (app or external).",
9719
- schema: "input AddPackageDocumentTypeInput {\n packageId: OID!\n documentType: String!\n}",
9720
- template: "Add a document type ID to a package (app or external).",
9721
- reducer: "if (action.input.documentType !== '*/*' && !/^[a-z0-9-]+\\/[a-z0-9-]+$/.test(action.input.documentType)) {\n throw new InvalidDocumentTypeError(\n `Invalid document type format: ${action.input.documentType}. Expected org/name.`,\n );\n}\nconst pkg = state.packages.find((p) => p.id === action.input.packageId);\nif (!pkg) {\n throw new PackageNotFoundError(\n `Package not found: ${action.input.packageId}`,\n );\n}\nif (action.input.documentType === '*/*') {\n pkg.documentTypes.length = 0;\n pkg.documentTypes.push('*/*');\n return;\n}\nif (pkg.documentTypes.includes('*/*')) {\n return;\n}\nif (pkg.documentTypes.includes(action.input.documentType)) {\n throw new DuplicateDocumentTypeError(\n `Document type already registered: ${action.input.documentType}`,\n );\n}\npkg.documentTypes.push(action.input.documentType);",
9722
- errors: [
9723
- {
9724
- id: "e-invalid-document-type",
9725
- name: "InvalidDocumentTypeError",
9726
- code: "INVALID_DOCUMENT_TYPE",
9727
- description: "Document type must match org/name format (e.g. powerhouse/ph-clint-project).",
9728
- template: ""
9729
- },
9730
- {
9731
- id: "e-package-not-found-add-dt",
9732
- name: "PackageNotFoundError",
9733
- code: "PACKAGE_NOT_FOUND",
9734
- description: "The specified package ID was not found.",
10051
+ id: "o-update-profile",
10052
+ name: "UPDATE_PROFILE",
10053
+ description: "Update an existing profile's title and/or content. Only updates provided fields.",
10054
+ schema: "input UpdateProfileInput {\n id: OID!\n title: String\n content: String\n}",
10055
+ template: "Update an existing profile.",
10056
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot update profile when Mastra is disabled.');\n}\nconst profile = state.features.mastra.profiles.find(p => p.id === action.input.id);\nif (!profile) {\n throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);\n}\nif (action.input.title) profile.title = action.input.title;\nif (action.input.content) profile.content = action.input.content;",
10057
+ errors: [{
10058
+ id: "e-update-profile-not-enabled",
10059
+ name: "MastraNotEnabledError",
10060
+ code: "MASTRA_NOT_ENABLED",
10061
+ description: "Mastra must be enabled before managing profiles.",
10062
+ template: ""
10063
+ }, {
10064
+ id: "e-update-profile-not-found",
10065
+ name: "ProfileNotFoundError",
10066
+ code: "PROFILE_NOT_FOUND",
10067
+ description: "The specified profile was not found.",
10068
+ template: ""
10069
+ }],
10070
+ examples: [],
10071
+ scope: "global"
10072
+ },
10073
+ {
10074
+ id: "o-remove-profile",
10075
+ name: "REMOVE_PROFILE",
10076
+ description: "Remove a profile from the library. Rejects when any agent (main or sub) references it.",
10077
+ schema: "input RemoveProfileInput {\n id: OID!\n}",
10078
+ template: "Remove a profile from the library.",
10079
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove profile when Mastra is disabled.');\n}\nconst idx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.id);\nif (idx === -1) {\n throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);\n}\nconst main = state.features.mastra.mainAgent;\nconst usedByMain = !!main && main.profileIds.includes(action.input.id);\nconst usedBySub = state.features.mastra.subAgents.some(\n (s) => s.profileIds.includes(action.input.id),\n);\nif (usedByMain || usedBySub) {\n throw new ProfileInUseError(\n `Profile ${action.input.id} is in use by an agent.`,\n );\n}\nstate.features.mastra.profiles.splice(idx, 1);",
10080
+ errors: [
10081
+ {
10082
+ id: "e-remove-profile-not-enabled",
10083
+ name: "MastraNotEnabledError",
10084
+ code: "MASTRA_NOT_ENABLED",
10085
+ description: "Mastra must be enabled before managing profiles.",
9735
10086
  template: ""
9736
10087
  },
9737
10088
  {
9738
- id: "e-duplicate-document-type",
9739
- name: "DuplicateDocumentTypeError",
9740
- code: "DUPLICATE_DOCUMENT_TYPE",
9741
- description: "This document type is already registered in the package.",
10089
+ id: "e-remove-profile-not-found",
10090
+ name: "ProfileNotFoundError",
10091
+ code: "PROFILE_NOT_FOUND",
10092
+ description: "The specified profile was not found.",
10093
+ template: ""
10094
+ },
10095
+ {
10096
+ id: "e-remove-profile-in-use",
10097
+ name: "ProfileInUseError",
10098
+ code: "PROFILE_IN_USE",
10099
+ description: "Cannot remove a profile that is still referenced by an agent.",
9742
10100
  template: ""
9743
10101
  }
9744
10102
  ],
@@ -9746,46 +10104,127 @@ const documentModel = {
9746
10104
  scope: "global"
9747
10105
  },
9748
10106
  {
9749
- id: "o-remove-package-document-type",
9750
- name: "REMOVE_PACKAGE_DOCUMENT_TYPE",
9751
- description: "Remove a document type ID from a package.",
9752
- schema: "input RemovePackageDocumentTypeInput {\n packageId: OID!\n documentType: String!\n}",
9753
- template: "Remove a document type ID from a package.",
9754
- reducer: "const pkg = state.packages.find(p => p.id === action.input.packageId);\nif (!pkg) {\n throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);\n}\nconst idx = pkg.documentTypes.indexOf(action.input.documentType);\nif (idx === -1) {\n throw new DocumentTypeNotFoundError(`Document type not found: ${action.input.documentType}`);\n}\npkg.documentTypes.splice(idx, 1);",
10107
+ id: "o-reorder-profiles",
10108
+ name: "REORDER_PROFILES",
10109
+ description: "Move one or more profiles before another profile, or to the end if insertBefore is null.",
10110
+ schema: "input ReorderProfilesInput {\n ids: [OID!]!\n insertBefore: OID\n}",
10111
+ template: "Reorder profiles.",
10112
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot reorder profiles when Mastra is disabled.');\n}\nconst moving = [];\nfor (const id of action.input.ids) {\n const profile = state.features.mastra.profiles.find(p => p.id === id);\n if (!profile) {\n throw new ProfileNotFoundError(`Profile not found: ${id}`);\n }\n moving.push(profile);\n}\nstate.features.mastra.profiles = state.features.mastra.profiles.filter(p => !action.input.ids.includes(p.id));\nif (action.input.insertBefore) {\n const beforeIdx = state.features.mastra.profiles.findIndex(p => p.id === action.input.insertBefore);\n if (beforeIdx === -1) {\n throw new ProfileNotFoundError(`insertBefore profile not found: ${action.input.insertBefore}`);\n }\n state.features.mastra.profiles.splice(beforeIdx, 0, ...moving);\n} else {\n state.features.mastra.profiles.push(...moving);\n}",
9755
10113
  errors: [{
9756
- id: "e-package-not-found-rm-dt",
9757
- name: "PackageNotFoundError",
9758
- code: "PACKAGE_NOT_FOUND",
9759
- description: "The specified package ID was not found.",
10114
+ id: "e-reorder-profiles-not-enabled",
10115
+ name: "MastraNotEnabledError",
10116
+ code: "MASTRA_NOT_ENABLED",
10117
+ description: "Mastra must be enabled before managing profiles.",
9760
10118
  template: ""
9761
10119
  }, {
9762
- id: "e-document-type-not-found",
9763
- name: "DocumentTypeNotFoundError",
9764
- code: "DOCUMENT_TYPE_NOT_FOUND",
9765
- description: "The specified document type was not found in this package.",
10120
+ id: "e-reorder-profiles-not-found",
10121
+ name: "ProfileNotFoundError",
10122
+ code: "PROFILE_NOT_FOUND",
10123
+ description: "A referenced profile was not found.",
10124
+ template: ""
10125
+ }],
10126
+ examples: [],
10127
+ scope: "global"
10128
+ }
10129
+ ]
10130
+ },
10131
+ {
10132
+ id: "m-mastra-main-agent",
10133
+ name: "mastra_main_agent",
10134
+ description: "Main agent identity ops. Main agent ID is set at ENABLE_MASTRA and stable thereafter — to change it, disable then re-enable.",
10135
+ operations: [
10136
+ {
10137
+ id: "o-set-main-agent-name",
10138
+ name: "SET_MAIN_AGENT_NAME",
10139
+ description: "Set the main agent's display name. Must be non-empty after trim.",
10140
+ schema: "input SetMainAgentNameInput {\n name: String!\n}",
10141
+ template: "Set the main agent's display name.",
10142
+ reducer: "const main = state.features.mastra.mainAgent;\nif (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError(\n 'Cannot set main agent name when Mastra is disabled.',\n );\n}\nconst trimmed = action.input.name.trim();\nif (!trimmed) {\n throw new InvalidAgentNameError('Agent name must not be empty.');\n}\nmain.name = trimmed;",
10143
+ errors: [{
10144
+ id: "e-set-main-name-not-enabled",
10145
+ name: "MastraNotEnabledError",
10146
+ code: "MASTRA_NOT_ENABLED",
10147
+ description: "Mastra must be enabled before managing the main agent.",
10148
+ template: ""
10149
+ }, {
10150
+ id: "e-set-main-name-invalid",
10151
+ name: "InvalidAgentNameError",
10152
+ code: "INVALID_AGENT_NAME",
10153
+ description: "The agent name must not be empty after trimming.",
9766
10154
  template: ""
9767
10155
  }],
9768
10156
  examples: [],
9769
10157
  scope: "global"
9770
10158
  },
9771
10159
  {
9772
- id: "o-set-package-version",
9773
- name: "SET_PACKAGE_VERSION",
9774
- description: "",
9775
- schema: "input SetPackageVersionInput {\n packageId: OID!\n version: String\n}",
9776
- template: "",
9777
- reducer: "const pkg = state.packages.find((p) => p.id === action.input.packageId);\nif (!pkg) {\n throw new PackageNotFoundError(\n `Package not found: ${action.input.packageId}`,\n );\n}\nif (action.input.version != null) {\n const SEMVER = /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\n if (!SEMVER.test(action.input.version)) {\n throw new InvalidVersionError(\n `Invalid version: ${action.input.version}`,\n );\n }\n}\npkg.version = action.input.version || null;",
10160
+ id: "o-set-main-agent-description",
10161
+ name: "SET_MAIN_AGENT_DESCRIPTION",
10162
+ description: "Set the main agent's description.",
10163
+ schema: "input SetMainAgentDescriptionInput {\n description: String!\n}",
10164
+ template: "Set the main agent's description.",
10165
+ reducer: "const main = state.features.mastra.mainAgent;\nif (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError(\n 'Cannot set main agent description when Mastra is disabled.',\n );\n}\nmain.description = action.input.description;",
9778
10166
  errors: [{
9779
- id: "e-pkg-not-found-set-ver",
9780
- name: "PackageNotFoundError",
9781
- code: "PACKAGE_NOT_FOUND",
9782
- description: "Referenced package does not exist",
10167
+ id: "e-set-main-desc-not-enabled",
10168
+ name: "MastraNotEnabledError",
10169
+ code: "MASTRA_NOT_ENABLED",
10170
+ description: "Mastra must be enabled before managing the main agent.",
10171
+ template: ""
10172
+ }],
10173
+ examples: [],
10174
+ scope: "global"
10175
+ },
10176
+ {
10177
+ id: "o-clear-main-agent-description",
10178
+ name: "CLEAR_MAIN_AGENT_DESCRIPTION",
10179
+ description: "Clear the main agent's description.",
10180
+ schema: "input ClearMainAgentDescriptionInput {\n _: Boolean\n}",
10181
+ template: "Clear the main agent's description.",
10182
+ reducer: "const main = state.features.mastra.mainAgent;\nif (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError(\n 'Cannot clear main agent description when Mastra is disabled.',\n );\n}\nmain.description = null;",
10183
+ errors: [{
10184
+ id: "e-clear-main-desc-not-enabled",
10185
+ name: "MastraNotEnabledError",
10186
+ code: "MASTRA_NOT_ENABLED",
10187
+ description: "Mastra must be enabled before managing the main agent.",
10188
+ template: ""
10189
+ }],
10190
+ examples: [],
10191
+ scope: "global"
10192
+ },
10193
+ {
10194
+ id: "o-set-main-agent-image",
10195
+ name: "SET_MAIN_AGENT_IMAGE",
10196
+ description: "Set the main agent's avatar image. Must be a data URL.",
10197
+ schema: "input SetMainAgentImageInput {\n image: String!\n}",
10198
+ template: "Set the main agent's avatar.",
10199
+ reducer: "const main = state.features.mastra.mainAgent;\nif (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError(\n 'Cannot set main agent image when Mastra is disabled.',\n );\n}\nif (!/^data:[a-z]+\\/[a-z0-9.+-]+;base64,/.test(action.input.image)) {\n throw new InvalidAgentImageError(\n 'Agent image must be a data URL (data:image/...;base64,...)',\n );\n}\nmain.image = action.input.image;",
10200
+ errors: [{
10201
+ id: "e-set-main-image-not-enabled",
10202
+ name: "MastraNotEnabledError",
10203
+ code: "MASTRA_NOT_ENABLED",
10204
+ description: "Mastra must be enabled before managing the main agent.",
9783
10205
  template: ""
9784
10206
  }, {
9785
- id: "e-invalid-version",
9786
- name: "InvalidVersionError",
9787
- code: "INVALID_VERSION",
9788
- description: "Version string is not valid semver",
10207
+ id: "e-set-main-image-invalid",
10208
+ name: "InvalidAgentImageError",
10209
+ code: "INVALID_AGENT_IMAGE",
10210
+ description: "Agent image must be a data URL",
10211
+ template: ""
10212
+ }],
10213
+ examples: [],
10214
+ scope: "global"
10215
+ },
10216
+ {
10217
+ id: "o-clear-main-agent-image",
10218
+ name: "CLEAR_MAIN_AGENT_IMAGE",
10219
+ description: "Clear the main agent's avatar.",
10220
+ schema: "input ClearMainAgentImageInput {\n _: Boolean\n}",
10221
+ template: "Clear the main agent's avatar.",
10222
+ reducer: "const main = state.features.mastra.mainAgent;\nif (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError(\n 'Cannot clear main agent image when Mastra is disabled.',\n );\n}\nmain.image = null;",
10223
+ errors: [{
10224
+ id: "e-clear-main-image-not-enabled",
10225
+ name: "MastraNotEnabledError",
10226
+ code: "MASTRA_NOT_ENABLED",
10227
+ description: "Mastra must be enabled before managing the main agent.",
9789
10228
  template: ""
9790
10229
  }],
9791
10230
  examples: [],
@@ -9794,77 +10233,107 @@ const documentModel = {
9794
10233
  ]
9795
10234
  },
9796
10235
  {
9797
- id: "m-external-skills",
9798
- name: "external_skills",
9799
- description: "External skills from the skills.sh ecosystem. Each skill has a name and GitHub URL for installation.",
10236
+ id: "m-mastra-sub-agents",
10237
+ name: "mastra_sub_agents",
10238
+ description: "Sub-agent CRUD. Sub-agent ids are unique across the main agent and all other sub-agents.",
9800
10239
  operations: [
9801
10240
  {
9802
- id: "o-add-external-skill",
9803
- name: "ADD_EXTERNAL_SKILL",
9804
- description: "Add an external skill. Name must be lowercase kebab-case.",
9805
- schema: "input AddExternalSkillInput {\n id: OID!\n name: String!\n githubUrl: URL!\n}",
9806
- template: "Add an external skill. Name must be lowercase kebab-case.",
9807
- reducer: "if (!/^[a-z][a-z0-9-]*$/.test(action.input.name)) {\n throw new InvalidSkillNameError(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);\n}\nconst exists = state.externalSkills.find(s => s.id === action.input.id || s.name === action.input.name);\nif (exists) {\n throw new DuplicateSkillError(`Skill already exists: ${action.input.name}`);\n}\nstate.externalSkills.push({\n id: action.input.id,\n name: action.input.name,\n githubUrl: action.input.githubUrl,\n});",
9808
- errors: [{
9809
- id: "e-invalid-skill-name",
9810
- name: "InvalidSkillNameError",
9811
- code: "INVALID_SKILL_NAME",
9812
- description: "Skill name must be lowercase kebab-case (e.g. playwright-cli).",
9813
- template: ""
9814
- }, {
9815
- id: "e-duplicate-skill",
9816
- name: "DuplicateSkillError",
9817
- code: "DUPLICATE_SKILL",
9818
- description: "A skill with the same ID or name already exists.",
9819
- template: ""
9820
- }],
10241
+ id: "o-add-sub-agent",
10242
+ name: "ADD_SUB_AGENT",
10243
+ description: "Add a sub-agent. ID must be lowercase kebab-case and unique (across main + sub agents). modelId must exist in the model library. Seeds empty profileIds/skills/toolPatterns.",
10244
+ schema: "input AddSubAgentInput {\n id: OID!\n name: String!\n description: String!\n modelId: OID!\n}",
10245
+ template: "Add a sub-agent.",
10246
+ reducer: "const main = state.features.mastra.mainAgent;\nif (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError(\n 'Cannot add sub-agent when Mastra is disabled.',\n );\n}\nif (!/^[a-z][a-z0-9-]*$/.test(action.input.id)) {\n throw new InvalidAgentIdError(\n `Invalid sub-agent ID: ${action.input.id}. Must be lowercase kebab-case.`,\n );\n}\nconst trimmedName = action.input.name.trim();\nif (!trimmedName) {\n throw new InvalidAgentNameError('Sub-agent name must not be empty.');\n}\nif (main.id === action.input.id) {\n throw new DuplicateAgentIdError(\n `Agent ID already taken by main agent: ${action.input.id}`,\n );\n}\nif (state.features.mastra.subAgents.find((s) => s.id === action.input.id)) {\n throw new DuplicateAgentIdError(\n `Sub-agent already exists: ${action.input.id}`,\n );\n}\nif (!state.features.mastra.models.find((m) => m.id === action.input.modelId)) {\n throw new ModelReferenceNotFoundError(\n `Model not in library: ${action.input.modelId}`,\n );\n}\nstate.features.mastra.subAgents.push({\n id: action.input.id,\n name: trimmedName,\n description: action.input.description,\n modelId: action.input.modelId,\n profileIds: [],\n skills: [],\n toolPatterns: [],\n});",
10247
+ errors: [
10248
+ {
10249
+ id: "e-add-sub-not-enabled",
10250
+ name: "MastraNotEnabledError",
10251
+ code: "MASTRA_NOT_ENABLED",
10252
+ description: "Mastra must be enabled before managing sub-agents.",
10253
+ template: ""
10254
+ },
10255
+ {
10256
+ id: "e-add-sub-invalid-id",
10257
+ name: "InvalidAgentIdError",
10258
+ code: "INVALID_AGENT_ID",
10259
+ description: "Sub-agent ID must be lowercase kebab-case.",
10260
+ template: ""
10261
+ },
10262
+ {
10263
+ id: "e-add-sub-invalid-name",
10264
+ name: "InvalidAgentNameError",
10265
+ code: "INVALID_AGENT_NAME",
10266
+ description: "Sub-agent name must not be empty after trimming.",
10267
+ template: ""
10268
+ },
10269
+ {
10270
+ id: "e-add-sub-duplicate",
10271
+ name: "DuplicateAgentIdError",
10272
+ code: "DUPLICATE_AGENT_ID",
10273
+ description: "An agent with this ID already exists (main or sub).",
10274
+ template: ""
10275
+ },
10276
+ {
10277
+ id: "e-add-sub-model-not-found",
10278
+ name: "ModelReferenceNotFoundError",
10279
+ code: "MODEL_REFERENCE_NOT_FOUND",
10280
+ description: "The referenced modelId does not exist in the model library.",
10281
+ template: ""
10282
+ }
10283
+ ],
9821
10284
  examples: [],
9822
10285
  scope: "global"
9823
10286
  },
9824
10287
  {
9825
- id: "o-remove-external-skill",
9826
- name: "REMOVE_EXTERNAL_SKILL",
9827
- description: "Remove an external skill by ID.",
9828
- schema: "input RemoveExternalSkillInput {\n id: OID!\n}",
9829
- template: "Remove an external skill by ID.",
9830
- reducer: "const idx = state.externalSkills.findIndex(s => s.id === action.input.id);\nif (idx === -1) {\n throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);\n}\nstate.externalSkills.splice(idx, 1);",
10288
+ id: "o-remove-sub-agent",
10289
+ name: "REMOVE_SUB_AGENT",
10290
+ description: "Remove a sub-agent.",
10291
+ schema: "input RemoveSubAgentInput {\n id: OID!\n}",
10292
+ template: "Remove a sub-agent.",
10293
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove sub-agent when Mastra is disabled.');\n}\nconst idx = state.features.mastra.subAgents.findIndex(s => s.id === action.input.id);\nif (idx === -1) {\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\n}\nstate.features.mastra.subAgents.splice(idx, 1);",
9831
10294
  errors: [{
9832
- id: "e-skill-not-found-remove",
9833
- name: "SkillNotFoundError",
9834
- code: "SKILL_NOT_FOUND",
9835
- description: "The specified skill ID was not found.",
10295
+ id: "e-remove-sub-not-enabled",
10296
+ name: "MastraNotEnabledError",
10297
+ code: "MASTRA_NOT_ENABLED",
10298
+ description: "Mastra must be enabled before managing sub-agents.",
10299
+ template: ""
10300
+ }, {
10301
+ id: "e-remove-sub-not-found",
10302
+ name: "AgentNotFoundError",
10303
+ code: "AGENT_NOT_FOUND",
10304
+ description: "The specified sub-agent was not found.",
9836
10305
  template: ""
9837
10306
  }],
9838
10307
  examples: [],
9839
10308
  scope: "global"
9840
10309
  },
9841
10310
  {
9842
- id: "o-set-external-skill-name",
9843
- name: "SET_EXTERNAL_SKILL_NAME",
9844
- description: "Update the name of an external skill.",
9845
- schema: "input SetExternalSkillNameInput {\n id: OID!\n name: String!\n}",
9846
- template: "Update the name of an external skill.",
9847
- reducer: "const skill = state.externalSkills.find(s => s.id === action.input.id);\nif (!skill) {\n throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);\n}\nif (!/^[a-z][a-z0-9-]*$/.test(action.input.name)) {\n throw new InvalidSkillNameError(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);\n}\nconst duplicate = state.externalSkills.find(s => s.name === action.input.name && s.id !== action.input.id);\nif (duplicate) {\n throw new DuplicateSkillError(`Skill name already in use: ${action.input.name}`);\n}\nskill.name = action.input.name;",
10311
+ id: "o-set-sub-agent-name",
10312
+ name: "SET_SUB_AGENT_NAME",
10313
+ description: "Set a sub-agent's display name.",
10314
+ schema: "input SetSubAgentNameInput {\n id: OID!\n name: String!\n}",
10315
+ template: "Set a sub-agent's display name.",
10316
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set sub-agent name when Mastra is disabled.');\n}\nconst sub = state.features.mastra.subAgents.find(s => s.id === action.input.id);\nif (!sub) {\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\n}\nconst trimmed = action.input.name.trim();\nif (!trimmed) {\n throw new InvalidAgentNameError('Sub-agent name must not be empty.');\n}\nsub.name = trimmed;",
9848
10317
  errors: [
9849
10318
  {
9850
- id: "e-skill-not-found-set-name",
9851
- name: "SkillNotFoundError",
9852
- code: "SKILL_NOT_FOUND",
9853
- description: "The specified skill ID was not found.",
10319
+ id: "e-set-sub-name-not-enabled",
10320
+ name: "MastraNotEnabledError",
10321
+ code: "MASTRA_NOT_ENABLED",
10322
+ description: "Mastra must be enabled before managing sub-agents.",
9854
10323
  template: ""
9855
10324
  },
9856
10325
  {
9857
- id: "e-invalid-skill-name-set",
9858
- name: "InvalidSkillNameError",
9859
- code: "INVALID_SKILL_NAME",
9860
- description: "Skill name must be lowercase kebab-case.",
10326
+ id: "e-set-sub-name-not-found",
10327
+ name: "AgentNotFoundError",
10328
+ code: "AGENT_NOT_FOUND",
10329
+ description: "The specified sub-agent was not found.",
9861
10330
  template: ""
9862
10331
  },
9863
10332
  {
9864
- id: "e-duplicate-skill-set-name",
9865
- name: "DuplicateSkillError",
9866
- code: "DUPLICATE_SKILL",
9867
- description: "Another skill already uses this name.",
10333
+ id: "e-set-sub-name-invalid",
10334
+ name: "InvalidAgentNameError",
10335
+ code: "INVALID_AGENT_NAME",
10336
+ description: "Sub-agent name must not be empty after trimming.",
9868
10337
  template: ""
9869
10338
  }
9870
10339
  ],
@@ -9872,17 +10341,23 @@ const documentModel = {
9872
10341
  scope: "global"
9873
10342
  },
9874
10343
  {
9875
- id: "o-set-external-skill-github-url",
9876
- name: "SET_EXTERNAL_SKILL_GITHUB_URL",
9877
- description: "Update the GitHub URL of an external skill.",
9878
- schema: "input SetExternalSkillGithubUrlInput {\n id: OID!\n githubUrl: URL!\n}",
9879
- template: "Update the GitHub URL of an external skill.",
9880
- reducer: "const skill = state.externalSkills.find(s => s.id === action.input.id);\nif (!skill) {\n throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);\n}\nskill.githubUrl = action.input.githubUrl;",
10344
+ id: "o-set-sub-agent-description",
10345
+ name: "SET_SUB_AGENT_DESCRIPTION",
10346
+ description: "Set a sub-agent's description.",
10347
+ schema: "input SetSubAgentDescriptionInput {\n id: OID!\n description: String!\n}",
10348
+ template: "Set a sub-agent's description.",
10349
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set sub-agent description when Mastra is disabled.');\n}\nconst sub = state.features.mastra.subAgents.find(s => s.id === action.input.id);\nif (!sub) {\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\n}\nsub.description = action.input.description;",
9881
10350
  errors: [{
9882
- id: "e-skill-not-found-set-url",
9883
- name: "SkillNotFoundError",
9884
- code: "SKILL_NOT_FOUND",
9885
- description: "The specified skill ID was not found.",
10351
+ id: "e-set-sub-desc-not-enabled",
10352
+ name: "MastraNotEnabledError",
10353
+ code: "MASTRA_NOT_ENABLED",
10354
+ description: "Mastra must be enabled before managing sub-agents.",
10355
+ template: ""
10356
+ }, {
10357
+ id: "e-set-sub-desc-not-found",
10358
+ name: "AgentNotFoundError",
10359
+ code: "AGENT_NOT_FOUND",
10360
+ description: "The specified sub-agent was not found.",
9886
10361
  template: ""
9887
10362
  }],
9888
10363
  examples: [],
@@ -9891,153 +10366,271 @@ const documentModel = {
9891
10366
  ]
9892
10367
  },
9893
10368
  {
9894
- id: "m-publishing",
9895
- name: "publishing",
9896
- description: "Version bumping and publish records. Tracks dev/staging/production publish intents and their status.",
10369
+ id: "m-mastra-agent-bindings",
10370
+ name: "mastra_agent_bindings",
10371
+ description: "Per-agent assignments of model, profile references, skills, and tool-name patterns. agentId resolves to main if it matches mainAgent.id, else looks up subAgents.",
9897
10372
  operations: [
9898
10373
  {
9899
- id: "o-bump-version",
9900
- name: "BUMP_VERSION",
9901
- description: "Bump the project version. Must be a valid semver string greater than the current version.",
9902
- schema: "input BumpVersionInput {\n version: String!\n}",
9903
- template: "Bump the project version. Must be a valid semver string greater than the current version.",
9904
- reducer: "if (!/^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/.test(action.input.version)) {\n throw new InvalidVersionError(`Invalid version: ${action.input.version}`);\n}\nstate.version = action.input.version;",
9905
- errors: [{
9906
- id: "e-invalid-version-bump",
9907
- name: "InvalidVersionError",
9908
- code: "INVALID_VERSION",
9909
- description: "The version must be a valid semver string.",
9910
- template: ""
9911
- }],
10374
+ id: "o-set-agent-model",
10375
+ name: "SET_AGENT_MODEL",
10376
+ description: "Set the agent's model. modelId must exist in the model library. agentId resolves to main or a sub.",
10377
+ schema: "input SetAgentModelInput {\n agentId: OID!\n modelId: OID!\n}",
10378
+ template: "Bind an agent to a model.",
10379
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set agent model when Mastra is disabled.');\n}\nconst main = state.features.mastra.mainAgent;\nlet agent;\nif (main && main.id === action.input.agentId) {\n agent = main;\n} else {\n agent = state.features.mastra.subAgents.find(\n (s) => s.id === action.input.agentId,\n );\n}\nif (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n}\nif (!state.features.mastra.models.find((m) => m.id === action.input.modelId)) {\n throw new ModelReferenceNotFoundError(\n `Model not in library: ${action.input.modelId}`,\n );\n}\nagent.modelId = action.input.modelId;",
10380
+ errors: [
10381
+ {
10382
+ id: "e-set-model-not-enabled",
10383
+ name: "MastraNotEnabledError",
10384
+ code: "MASTRA_NOT_ENABLED",
10385
+ description: "Mastra must be enabled before managing agent bindings.",
10386
+ template: ""
10387
+ },
10388
+ {
10389
+ id: "e-set-model-agent-not-found",
10390
+ name: "AgentNotFoundError",
10391
+ code: "AGENT_NOT_FOUND",
10392
+ description: "The specified agentId resolves to neither main nor any sub-agent.",
10393
+ template: ""
10394
+ },
10395
+ {
10396
+ id: "e-set-model-ref-not-found",
10397
+ name: "ModelReferenceNotFoundError",
10398
+ code: "MODEL_REFERENCE_NOT_FOUND",
10399
+ description: "The referenced modelId does not exist in the model library.",
10400
+ template: ""
10401
+ }
10402
+ ],
9912
10403
  examples: [],
9913
10404
  scope: "global"
9914
10405
  },
9915
10406
  {
9916
- id: "o-publish-dev",
9917
- name: "PUBLISH_DEV",
9918
- description: "Record a dev publish intent. Creates a Pending publish record.",
9919
- schema: "input PublishDevInput {\n id: OID!\n timestamp: DateTime!\n}",
9920
- template: "Record a dev publish intent. Creates a Pending publish record.",
9921
- reducer: "state.publishHistory.push({\n id: action.input.id,\n tag: 'Dev',\n version: state.version,\n timestamp: action.input.timestamp,\n status: 'Pending',\n});",
9922
- errors: [],
9923
- examples: [],
9924
- scope: "global"
9925
- },
9926
- {
9927
- id: "o-publish-staging",
9928
- name: "PUBLISH_STAGING",
9929
- description: "Record a staging publish intent. Creates a Pending publish record.",
9930
- schema: "input PublishStagingInput {\n id: OID!\n timestamp: DateTime!\n}",
9931
- template: "Record a staging publish intent. Creates a Pending publish record.",
9932
- reducer: "state.publishHistory.push({\n id: action.input.id,\n tag: 'Staging',\n version: state.version,\n timestamp: action.input.timestamp,\n status: 'Pending',\n});",
9933
- errors: [],
10407
+ id: "o-add-agent-profile-ref",
10408
+ name: "ADD_AGENT_PROFILE_REF",
10409
+ description: "Add a profile reference to an agent. profileId must exist in the profile library. Inserts before insertBefore if provided, otherwise appends. Dedup: silent if already present.",
10410
+ schema: "input AddAgentProfileRefInput {\n agentId: OID!\n profileId: OID!\n insertBefore: OID\n}",
10411
+ template: "Add a profile reference to an agent.",
10412
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add profile ref when Mastra is disabled.');\n}\nconst main = state.features.mastra.mainAgent;\nlet agent;\nif (main && main.id === action.input.agentId) {\n agent = main;\n} else {\n agent = state.features.mastra.subAgents.find(\n (s) => s.id === action.input.agentId,\n );\n}\nif (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n}\nif (!state.features.mastra.profiles.find((p) => p.id === action.input.profileId)) {\n throw new ProfileReferenceNotFoundError(\n `Profile not in library: ${action.input.profileId}`,\n );\n}\nif (agent.profileIds.includes(action.input.profileId)) {\n return;\n}\nif (action.input.insertBefore) {\n const beforeIdx = agent.profileIds.indexOf(action.input.insertBefore);\n if (beforeIdx === -1) {\n throw new ProfileReferenceNotFoundError(\n `insertBefore profile not in agent's profileIds: ${action.input.insertBefore}`,\n );\n }\n agent.profileIds.splice(beforeIdx, 0, action.input.profileId);\n} else {\n agent.profileIds.push(action.input.profileId);\n}",
10413
+ errors: [
10414
+ {
10415
+ id: "e-add-profile-ref-not-enabled",
10416
+ name: "MastraNotEnabledError",
10417
+ code: "MASTRA_NOT_ENABLED",
10418
+ description: "Mastra must be enabled.",
10419
+ template: ""
10420
+ },
10421
+ {
10422
+ id: "e-add-profile-ref-agent-not-found",
10423
+ name: "AgentNotFoundError",
10424
+ code: "AGENT_NOT_FOUND",
10425
+ description: "The specified agentId was not found.",
10426
+ template: ""
10427
+ },
10428
+ {
10429
+ id: "e-add-profile-ref-not-found",
10430
+ name: "ProfileReferenceNotFoundError",
10431
+ code: "PROFILE_REFERENCE_NOT_FOUND",
10432
+ description: "The referenced profileId does not exist in the profile library, or insertBefore is not present in the agent.",
10433
+ template: ""
10434
+ }
10435
+ ],
9934
10436
  examples: [],
9935
10437
  scope: "global"
9936
10438
  },
9937
10439
  {
9938
- id: "o-publish-production",
9939
- name: "PUBLISH_PRODUCTION",
9940
- description: "Record a production publish intent. Creates a Pending publish record.",
9941
- schema: "input PublishProductionInput {\n id: OID!\n timestamp: DateTime!\n}",
9942
- template: "Record a production publish intent. Creates a Pending publish record.",
9943
- reducer: "state.publishHistory.push({\n id: action.input.id,\n tag: 'Production',\n version: state.version,\n timestamp: action.input.timestamp,\n status: 'Pending',\n});",
9944
- errors: [],
10440
+ id: "o-remove-agent-profile-ref",
10441
+ name: "REMOVE_AGENT_PROFILE_REF",
10442
+ description: "Remove a profile reference from an agent.",
10443
+ schema: "input RemoveAgentProfileRefInput {\n agentId: OID!\n profileId: OID!\n}",
10444
+ template: "Remove a profile reference from an agent.",
10445
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove profile ref when Mastra is disabled.');\n}\nconst main = state.features.mastra.mainAgent;\nlet agent;\nif (main && main.id === action.input.agentId) {\n agent = main;\n} else {\n agent = state.features.mastra.subAgents.find(\n (s) => s.id === action.input.agentId,\n );\n}\nif (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n}\nconst idx = agent.profileIds.indexOf(action.input.profileId);\nif (idx === -1) {\n throw new ProfileReferenceNotFoundError(\n `Profile not in agent's profileIds: ${action.input.profileId}`,\n );\n}\nagent.profileIds.splice(idx, 1);",
10446
+ errors: [
10447
+ {
10448
+ id: "e-remove-profile-ref-not-enabled",
10449
+ name: "MastraNotEnabledError",
10450
+ code: "MASTRA_NOT_ENABLED",
10451
+ description: "Mastra must be enabled.",
10452
+ template: ""
10453
+ },
10454
+ {
10455
+ id: "e-remove-profile-ref-agent-not-found",
10456
+ name: "AgentNotFoundError",
10457
+ code: "AGENT_NOT_FOUND",
10458
+ description: "The specified agentId was not found.",
10459
+ template: ""
10460
+ },
10461
+ {
10462
+ id: "e-remove-profile-ref-not-found",
10463
+ name: "ProfileReferenceNotFoundError",
10464
+ code: "PROFILE_REFERENCE_NOT_FOUND",
10465
+ description: "The profileId is not present in this agent's profileIds.",
10466
+ template: ""
10467
+ }
10468
+ ],
9945
10469
  examples: [],
9946
10470
  scope: "global"
9947
10471
  },
9948
10472
  {
9949
- id: "o-set-publish-status",
9950
- name: "SET_PUBLISH_STATUS",
9951
- description: "Update the status of a publish record. Used by the trigger after publish completes.",
9952
- schema: "input SetPublishStatusInput {\n id: OID!\n status: PublishStatus!\n}",
9953
- template: "Update the status of a publish record. Used by the trigger after publish completes.",
9954
- reducer: "const record = state.publishHistory.find(r => r.id === action.input.id);\nif (!record) {\n throw new PublishRecordNotFoundError(`Publish record not found: ${action.input.id}`);\n}\nrecord.status = action.input.status;",
9955
- errors: [{
9956
- id: "e-publish-record-not-found",
9957
- name: "PublishRecordNotFoundError",
9958
- code: "PUBLISH_RECORD_NOT_FOUND",
9959
- description: "The specified publish record ID was not found.",
9960
- template: ""
9961
- }],
10473
+ id: "o-reorder-agent-profile-refs",
10474
+ name: "REORDER_AGENT_PROFILE_REFS",
10475
+ description: "Reorder an agent's profile references. Moves the given ids before insertBefore, or to the end if insertBefore is null.",
10476
+ schema: "input ReorderAgentProfileRefsInput {\n agentId: OID!\n ids: [OID!]!\n insertBefore: OID\n}",
10477
+ template: "Reorder an agent's profile references.",
10478
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot reorder profile refs when Mastra is disabled.');\n}\nconst main = state.features.mastra.mainAgent;\nlet agent;\nif (main && main.id === action.input.agentId) {\n agent = main;\n} else {\n agent = state.features.mastra.subAgents.find(\n (s) => s.id === action.input.agentId,\n );\n}\nif (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n}\nfor (const id of action.input.ids) {\n if (!agent.profileIds.includes(id)) {\n throw new ProfileReferenceNotFoundError(\n `Profile not in agent's profileIds: ${id}`,\n );\n }\n}\nconst remaining = agent.profileIds.filter(\n (id) => !action.input.ids.includes(id),\n);\nif (action.input.insertBefore) {\n const beforeIdx = remaining.indexOf(action.input.insertBefore);\n if (beforeIdx === -1) {\n throw new ProfileReferenceNotFoundError(\n `insertBefore profile not in agent's profileIds: ${action.input.insertBefore}`,\n );\n }\n remaining.splice(beforeIdx, 0, ...action.input.ids);\n} else {\n remaining.push(...action.input.ids);\n}\nagent.profileIds = remaining;",
10479
+ errors: [
10480
+ {
10481
+ id: "e-reorder-refs-not-enabled",
10482
+ name: "MastraNotEnabledError",
10483
+ code: "MASTRA_NOT_ENABLED",
10484
+ description: "Mastra must be enabled.",
10485
+ template: ""
10486
+ },
10487
+ {
10488
+ id: "e-reorder-refs-agent-not-found",
10489
+ name: "AgentNotFoundError",
10490
+ code: "AGENT_NOT_FOUND",
10491
+ description: "The specified agentId was not found.",
10492
+ template: ""
10493
+ },
10494
+ {
10495
+ id: "e-reorder-refs-not-found",
10496
+ name: "ProfileReferenceNotFoundError",
10497
+ code: "PROFILE_REFERENCE_NOT_FOUND",
10498
+ description: "A referenced profileId is not present in this agent.",
10499
+ template: ""
10500
+ }
10501
+ ],
9962
10502
  examples: [],
9963
10503
  scope: "global"
9964
- }
9965
- ]
9966
- },
9967
- {
9968
- id: "m-lifecycle",
9969
- name: "lifecycle",
9970
- description: "Document lifecycle operations. IMPORT_SPEC bulk-imports a full project spec into the document.",
9971
- operations: [{
9972
- id: "o-import-spec",
9973
- name: "IMPORT_SPEC",
9974
- description: "Bulk-import a full project spec into the document. Sets all identity fields, features, packages, and skills. Used by the multi-project boot sync.",
9975
- schema: "input ImportSpecInput {\n name: String!\n scope: String\n version: String!\n description: String!\n powerhouse: PowerhouseLevel!\n mastraEnabled: Boolean!\n routineEnabled: Boolean!\n packages: [ImportPackageInput!]!\n externalSkills: [ImportSkillInput!]!\n agentId: String\n agentName: String\n models: [ImportModelInput!]\n profiles: [ImportProfileInput!]\n agentDescription: String\n agentImage: String\n enableChat: Boolean\n proxyEnabled: Boolean\n observabilityEnabled: Boolean\n supportedResources: [String!]\n}\n\ninput ImportPackageInput {\n id: OID!\n packageName: String!\n documentTypes: [String!]!\n version: String\n}\n\ninput ImportSkillInput {\n id: OID!\n name: String!\n githubUrl: URL!\n}\n\ninput ImportModelInput {\n id: String!\n isDefault: Boolean!\n}\n\ninput ImportProfileInput {\n id: String!\n title: String!\n content: String!\n}",
9976
- template: "Bulk-import a full project spec into the document. Sets all identity fields, features, packages, and skills. Used by the multi-project boot sync.",
9977
- reducer: "state.name = action.input.name;\nstate.scope = action.input.scope || null;\nstate.version = action.input.version;\nstate.description = action.input.description;\nstate.features.powerhouse = action.input.powerhouse;\nstate.features.mastra.enabled = action.input.mastraEnabled;\nstate.features.routine.enabled = action.input.routineEnabled;\n\n// Derive the expected managed app package name\nconst appBase = action.input.name.replace(/-cli$/, '-app');\nconst appPkgName = action.input.scope\n ? `${action.input.scope}/${appBase}`\n : appBase;\nconst phEnabled = action.input.powerhouse !== 'Disabled';\n\nstate.packages = action.input.packages.map((p) => ({\n id: p.id,\n packageName: p.packageName,\n documentTypes: [...p.documentTypes],\n version: p.version || null,\n managed: phEnabled && p.packageName === appPkgName,\n}));\nstate.externalSkills = action.input.externalSkills.map((s) => ({\n id: s.id,\n name: s.name,\n githubUrl: s.githubUrl,\n}));\nstate.features.mastra.agentId = action.input.agentId || null;\nstate.features.mastra.agentName = action.input.agentName || null;\nstate.features.mastra.models = (action.input.models || []).map((m) => ({\n id: m.id,\n isDefault: m.isDefault,\n}));\nstate.features.mastra.profiles = (action.input.profiles || []).map((p) => ({\n id: p.id,\n title: p.title,\n content: p.content,\n}));\n\n// agentDescription — respects mastra-enabled guard\nif (action.input.agentDescription && state.features.mastra.enabled) {\n state.features.mastra.agentDescription = action.input.agentDescription;\n} else {\n state.features.mastra.agentDescription = null;\n}\n\n// agentImage — validates data URL format (same logic as setAgentImageOperation)\nif (action.input.agentImage && state.features.mastra.enabled) {\n if (!/^data:[a-z]+\\/[a-z0-9.+-]+;base64,/.test(action.input.agentImage)) {\n throw new InvalidAgentImageError(\n 'Invalid image: must be a data URL (data:<mime>;base64,...)',\n );\n }\n state.features.mastra.agentImage = action.input.agentImage;\n} else {\n state.features.mastra.agentImage = null;\n}\n\n// enableChat — respects mastra+powerhouse guards, manages clint-common package\nif (\n action.input.enableChat &&\n state.features.mastra.enabled &&\n state.features.powerhouse !== 'Disabled'\n) {\n state.features.mastra.common.enableChat = true;\n const CLINT_COMMON_PKG = '@powerhousedao/clint-common';\n const CHAT_DOC_TYPE = 'powerhouse/chat-session';\n const existing = state.packages.find(\n (p) => p.packageName === CLINT_COMMON_PKG,\n );\n if (!existing) {\n state.packages.push({\n id: 'pkg-clint-common',\n packageName: CLINT_COMMON_PKG,\n documentTypes: [CHAT_DOC_TYPE],\n version: null,\n managed: true,\n });\n } else if (!existing.documentTypes.includes(CHAT_DOC_TYPE)) {\n existing.documentTypes.push(CHAT_DOC_TYPE);\n }\n} else {\n state.features.mastra.common.enableChat = false;\n}\n\n// Deployment fields\nstate.deployment.proxyEnabled = action.input.proxyEnabled ?? false;\nstate.deployment.observabilityEnabled = action.input.observabilityEnabled ?? false;\nstate.deployment.supportedResources = action.input.supportedResources\n ? [...action.input.supportedResources]\n : [];",
9978
- errors: [],
9979
- examples: [],
9980
- scope: "global"
9981
- }]
9982
- },
9983
- {
9984
- id: "m-deployment",
9985
- name: "deployment",
9986
- description: "Deployment settings: service announcement toggle and supported resource tiers.",
9987
- operations: [
10504
+ },
9988
10505
  {
9989
- id: "o-add-supported-resource",
9990
- name: "ADD_SUPPORTED_RESOURCE",
9991
- description: "Add a supported resource tier. Guards against duplicates.",
9992
- schema: "input AddSupportedResourceInput {\n resource: String!\n}",
9993
- template: "Add a supported resource tier. Guards against duplicates.",
9994
- reducer: "if (state.deployment.supportedResources.includes(action.input.resource)) {\n throw new DuplicateResourceError(`Resource already exists: ${action.input.resource}`);\n}\nstate.deployment.supportedResources.push(action.input.resource);",
9995
- errors: [{
9996
- id: "e-duplicate-resource",
9997
- name: "DuplicateResourceError",
9998
- code: "DUPLICATE_RESOURCE",
9999
- description: "This resource is already in the supported resources list.",
10000
- template: ""
10001
- }],
10506
+ id: "o-add-agent-skill",
10507
+ name: "ADD_AGENT_SKILL",
10508
+ description: "Add a skill name to an agent. Dedup: silent if already present.",
10509
+ schema: "input AddAgentSkillInput {\n agentId: OID!\n name: String!\n}",
10510
+ template: "Add a skill to an agent.",
10511
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add skill when Mastra is disabled.');\n}\nconst main = state.features.mastra.mainAgent;\nlet agent;\nif (main && main.id === action.input.agentId) {\n agent = main;\n} else {\n agent = state.features.mastra.subAgents.find(\n (s) => s.id === action.input.agentId,\n );\n}\nif (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n}\nconst trimmed = action.input.name.trim();\nif (!/^[a-z][a-z0-9-]*$/.test(trimmed)) {\n throw new InvalidSkillNameError(\n `Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`,\n );\n}\nif (!agent.skills.includes(trimmed)) {\n agent.skills.push(trimmed);\n}",
10512
+ errors: [
10513
+ {
10514
+ id: "e-add-skill-not-enabled",
10515
+ name: "MastraNotEnabledError",
10516
+ code: "MASTRA_NOT_ENABLED",
10517
+ description: "Mastra must be enabled.",
10518
+ template: ""
10519
+ },
10520
+ {
10521
+ id: "e-add-skill-agent-not-found",
10522
+ name: "AgentNotFoundError",
10523
+ code: "AGENT_NOT_FOUND",
10524
+ description: "The specified agentId was not found.",
10525
+ template: ""
10526
+ },
10527
+ {
10528
+ id: "e-add-skill-invalid",
10529
+ name: "InvalidSkillNameError",
10530
+ code: "INVALID_SKILL_NAME",
10531
+ description: "Skill name must be lowercase kebab-case.",
10532
+ template: ""
10533
+ }
10534
+ ],
10002
10535
  examples: [],
10003
10536
  scope: "global"
10004
10537
  },
10005
10538
  {
10006
- id: "o-remove-supported-resource",
10007
- name: "REMOVE_SUPPORTED_RESOURCE",
10008
- description: "Remove a supported resource tier.",
10009
- schema: "input RemoveSupportedResourceInput {\n resource: String!\n}",
10010
- template: "Remove a supported resource tier.",
10011
- reducer: "const idx = state.deployment.supportedResources.indexOf(action.input.resource);\nif (idx === -1) {\n throw new ResourceNotFoundError(`Resource not found: ${action.input.resource}`);\n}\nstate.deployment.supportedResources.splice(idx, 1);",
10012
- errors: [{
10013
- id: "e-resource-not-found",
10014
- name: "ResourceNotFoundError",
10015
- code: "RESOURCE_NOT_FOUND",
10016
- description: "The specified resource was not found in the supported resources list.",
10017
- template: ""
10018
- }],
10539
+ id: "o-remove-agent-skill",
10540
+ name: "REMOVE_AGENT_SKILL",
10541
+ description: "Remove a skill name from an agent.",
10542
+ schema: "input RemoveAgentSkillInput {\n agentId: OID!\n name: String!\n}",
10543
+ template: "Remove a skill from an agent.",
10544
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove skill when Mastra is disabled.');\n}\nconst main = state.features.mastra.mainAgent;\nlet agent;\nif (main && main.id === action.input.agentId) {\n agent = main;\n} else {\n agent = state.features.mastra.subAgents.find(\n (s) => s.id === action.input.agentId,\n );\n}\nif (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n}\nconst idx = agent.skills.indexOf(action.input.name);\nif (idx === -1) {\n throw new SkillNotFoundError(`Skill not on agent: ${action.input.name}`);\n}\nagent.skills.splice(idx, 1);",
10545
+ errors: [
10546
+ {
10547
+ id: "e-remove-skill-not-enabled",
10548
+ name: "MastraNotEnabledError",
10549
+ code: "MASTRA_NOT_ENABLED",
10550
+ description: "Mastra must be enabled.",
10551
+ template: ""
10552
+ },
10553
+ {
10554
+ id: "e-remove-skill-agent-not-found",
10555
+ name: "AgentNotFoundError",
10556
+ code: "AGENT_NOT_FOUND",
10557
+ description: "The specified agentId was not found.",
10558
+ template: ""
10559
+ },
10560
+ {
10561
+ id: "e-remove-skill-not-found",
10562
+ name: "SkillNotFoundError",
10563
+ code: "SKILL_NOT_FOUND",
10564
+ description: "The skill name is not on this agent.",
10565
+ template: ""
10566
+ }
10567
+ ],
10019
10568
  examples: [],
10020
10569
  scope: "global"
10021
10570
  },
10022
10571
  {
10023
- id: "o-set-proxy-enabled",
10024
- name: "SET_PROXY_ENABLED",
10025
- description: "Toggle the embedded reverse proxy.",
10026
- schema: "input SetProxyEnabledInput {\n enabled: Boolean!\n}",
10027
- template: "Toggle the embedded reverse proxy.",
10028
- reducer: "state.deployment.proxyEnabled = action.input.enabled;",
10029
- errors: [],
10572
+ id: "o-add-agent-tool-pattern",
10573
+ name: "ADD_AGENT_TOOL_PATTERN",
10574
+ description: "Add a tool-name glob pattern to an agent. Dedup: silent if already present.",
10575
+ schema: "input AddAgentToolPatternInput {\n agentId: OID!\n pattern: String!\n}",
10576
+ template: "Add a tool-name pattern to an agent.",
10577
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add tool pattern when Mastra is disabled.');\n}\nconst main = state.features.mastra.mainAgent;\nlet agent;\nif (main && main.id === action.input.agentId) {\n agent = main;\n} else {\n agent = state.features.mastra.subAgents.find(\n (s) => s.id === action.input.agentId,\n );\n}\nif (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n}\nconst trimmed = action.input.pattern.trim();\nif (!trimmed) {\n throw new InvalidToolPatternError('Tool pattern must not be empty after trimming.');\n}\nif (!agent.toolPatterns.includes(trimmed)) {\n agent.toolPatterns.push(trimmed);\n}",
10578
+ errors: [
10579
+ {
10580
+ id: "e-add-pattern-not-enabled",
10581
+ name: "MastraNotEnabledError",
10582
+ code: "MASTRA_NOT_ENABLED",
10583
+ description: "Mastra must be enabled.",
10584
+ template: ""
10585
+ },
10586
+ {
10587
+ id: "e-add-pattern-agent-not-found",
10588
+ name: "AgentNotFoundError",
10589
+ code: "AGENT_NOT_FOUND",
10590
+ description: "The specified agentId was not found.",
10591
+ template: ""
10592
+ },
10593
+ {
10594
+ id: "e-add-pattern-invalid",
10595
+ name: "InvalidToolPatternError",
10596
+ code: "INVALID_TOOL_PATTERN",
10597
+ description: "Tool pattern must not be empty after trimming.",
10598
+ template: ""
10599
+ }
10600
+ ],
10030
10601
  examples: [],
10031
10602
  scope: "global"
10032
10603
  },
10033
10604
  {
10034
- id: "o-set-observability-enabled",
10035
- name: "SET_OBSERVABILITY_ENABLED",
10036
- description: "Toggle the observability plugin (Sentry + OpenTelemetry).",
10037
- schema: "input SetObservabilityEnabledInput {\n enabled: Boolean!\n}",
10038
- template: "Toggle the observability plugin (Sentry + OpenTelemetry).",
10039
- reducer: "state.deployment.observabilityEnabled = action.input.enabled;",
10040
- errors: [],
10605
+ id: "o-remove-agent-tool-pattern",
10606
+ name: "REMOVE_AGENT_TOOL_PATTERN",
10607
+ description: "Remove a tool-name glob pattern from an agent.",
10608
+ schema: "input RemoveAgentToolPatternInput {\n agentId: OID!\n pattern: String!\n}",
10609
+ template: "Remove a tool-name pattern from an agent.",
10610
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove tool pattern when Mastra is disabled.');\n}\nconst main = state.features.mastra.mainAgent;\nlet agent;\nif (main && main.id === action.input.agentId) {\n agent = main;\n} else {\n agent = state.features.mastra.subAgents.find(\n (s) => s.id === action.input.agentId,\n );\n}\nif (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n}\nconst idx = agent.toolPatterns.indexOf(action.input.pattern);\nif (idx === -1) {\n throw new ToolPatternNotFoundError(\n `Tool pattern not on agent: ${action.input.pattern}`,\n );\n}\nagent.toolPatterns.splice(idx, 1);",
10611
+ errors: [
10612
+ {
10613
+ id: "e-remove-pattern-not-enabled",
10614
+ name: "MastraNotEnabledError",
10615
+ code: "MASTRA_NOT_ENABLED",
10616
+ description: "Mastra must be enabled.",
10617
+ template: ""
10618
+ },
10619
+ {
10620
+ id: "e-remove-pattern-agent-not-found",
10621
+ name: "AgentNotFoundError",
10622
+ code: "AGENT_NOT_FOUND",
10623
+ description: "The specified agentId was not found.",
10624
+ template: ""
10625
+ },
10626
+ {
10627
+ id: "e-remove-pattern-not-found",
10628
+ name: "ToolPatternNotFoundError",
10629
+ code: "TOOL_PATTERN_NOT_FOUND",
10630
+ description: "The tool pattern is not on this agent.",
10631
+ template: ""
10632
+ }
10633
+ ],
10041
10634
  examples: [],
10042
10635
  scope: "global"
10043
10636
  }
@@ -10049,49 +10642,395 @@ const documentModel = {
10049
10642
  }]
10050
10643
  };
10051
10644
  //#endregion
10052
- //#region document-models/ph-clint-project/v1/gen/deployment/error.ts
10053
- var DuplicateResourceError = class extends Error {
10054
- errorCode = "DuplicateResourceError";
10055
- constructor(message = "DuplicateResourceError") {
10645
+ //#region document-models/ph-clint-project/v1/gen/deployment/error.ts
10646
+ var DuplicateResourceError = class extends Error {
10647
+ errorCode = "DuplicateResourceError";
10648
+ constructor(message = "DuplicateResourceError") {
10649
+ super(message);
10650
+ }
10651
+ };
10652
+ var ResourceNotFoundError = class extends Error {
10653
+ errorCode = "ResourceNotFoundError";
10654
+ constructor(message = "ResourceNotFoundError") {
10655
+ super(message);
10656
+ }
10657
+ };
10658
+ //#endregion
10659
+ //#region document-models/ph-clint-project/v1/src/reducers/deployment.ts
10660
+ const phClintProjectDeploymentOperations = {
10661
+ addSupportedResourceOperation(state, action) {
10662
+ if (state.deployment.supportedResources.includes(action.input.resource)) throw new DuplicateResourceError(`Resource already exists: ${action.input.resource}`);
10663
+ state.deployment.supportedResources.push(action.input.resource);
10664
+ },
10665
+ removeSupportedResourceOperation(state, action) {
10666
+ const idx = state.deployment.supportedResources.indexOf(action.input.resource);
10667
+ if (idx === -1) throw new ResourceNotFoundError(`Resource not found: ${action.input.resource}`);
10668
+ state.deployment.supportedResources.splice(idx, 1);
10669
+ },
10670
+ setProxyEnabledOperation(state, action) {
10671
+ state.deployment.proxyEnabled = action.input.enabled;
10672
+ },
10673
+ setObservabilityEnabledOperation(state, action) {
10674
+ state.deployment.observabilityEnabled = action.input.enabled;
10675
+ }
10676
+ };
10677
+ //#endregion
10678
+ //#region document-models/ph-clint-project/v1/gen/external-skills/error.ts
10679
+ var InvalidSkillNameError$1 = class extends Error {
10680
+ errorCode = "InvalidSkillNameError";
10681
+ constructor(message = "InvalidSkillNameError") {
10682
+ super(message);
10683
+ }
10684
+ };
10685
+ var DuplicateSkillError = class extends Error {
10686
+ errorCode = "DuplicateSkillError";
10687
+ constructor(message = "DuplicateSkillError") {
10688
+ super(message);
10689
+ }
10690
+ };
10691
+ var SkillNotFoundError$1 = class extends Error {
10692
+ errorCode = "SkillNotFoundError";
10693
+ constructor(message = "SkillNotFoundError") {
10694
+ super(message);
10695
+ }
10696
+ };
10697
+ //#endregion
10698
+ //#region document-models/ph-clint-project/v1/src/reducers/external-skills.ts
10699
+ const phClintProjectExternalSkillsOperations = {
10700
+ addExternalSkillOperation(state, action) {
10701
+ if (!/^[a-z][a-z0-9-]*$/.test(action.input.name)) throw new InvalidSkillNameError$1(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);
10702
+ if (state.externalSkills.find((s) => s.id === action.input.id || s.name === action.input.name)) throw new DuplicateSkillError(`Skill already exists: ${action.input.name}`);
10703
+ state.externalSkills.push({
10704
+ id: action.input.id,
10705
+ name: action.input.name,
10706
+ githubUrl: action.input.githubUrl
10707
+ });
10708
+ },
10709
+ removeExternalSkillOperation(state, action) {
10710
+ const idx = state.externalSkills.findIndex((s) => s.id === action.input.id);
10711
+ if (idx === -1) throw new SkillNotFoundError$1(`Skill not found: ${action.input.id}`);
10712
+ state.externalSkills.splice(idx, 1);
10713
+ },
10714
+ setExternalSkillNameOperation(state, action) {
10715
+ const skill = state.externalSkills.find((s) => s.id === action.input.id);
10716
+ if (!skill) throw new SkillNotFoundError$1(`Skill not found: ${action.input.id}`);
10717
+ if (!/^[a-z][a-z0-9-]*$/.test(action.input.name)) throw new InvalidSkillNameError$1(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);
10718
+ if (state.externalSkills.find((s) => s.name === action.input.name && s.id !== action.input.id)) throw new DuplicateSkillError(`Skill name already in use: ${action.input.name}`);
10719
+ skill.name = action.input.name;
10720
+ },
10721
+ setExternalSkillGithubUrlOperation(state, action) {
10722
+ const skill = state.externalSkills.find((s) => s.id === action.input.id);
10723
+ if (!skill) throw new SkillNotFoundError$1(`Skill not found: ${action.input.id}`);
10724
+ skill.githubUrl = action.input.githubUrl;
10725
+ }
10726
+ };
10727
+ //#endregion
10728
+ //#region document-models/ph-clint-project/v1/gen/features-mastra/error.ts
10729
+ var InvalidAgentIdError$1 = class extends Error {
10730
+ errorCode = "InvalidAgentIdError";
10731
+ constructor(message = "InvalidAgentIdError") {
10732
+ super(message);
10733
+ }
10734
+ };
10735
+ var InvalidAgentNameError$2 = class extends Error {
10736
+ errorCode = "InvalidAgentNameError";
10737
+ constructor(message = "InvalidAgentNameError") {
10738
+ super(message);
10739
+ }
10740
+ };
10741
+ var MastraNotEnabledError$5 = class extends Error {
10742
+ errorCode = "MastraNotEnabledError";
10743
+ constructor(message = "MastraNotEnabledError") {
10744
+ super(message);
10745
+ }
10746
+ };
10747
+ var PowerhouseNotEnabledError = class extends Error {
10748
+ errorCode = "PowerhouseNotEnabledError";
10749
+ constructor(message = "PowerhouseNotEnabledError") {
10750
+ super(message);
10751
+ }
10752
+ };
10753
+ //#endregion
10754
+ //#region document-models/ph-clint-project/v1/src/reducers/features-mastra.ts
10755
+ const phClintProjectFeaturesMastraOperations = {
10756
+ enableMastraOperation(state, action) {
10757
+ if (!/^[a-z][a-z0-9-]*$/.test(action.input.agentId)) throw new InvalidAgentIdError$1(`Invalid agent ID: ${action.input.agentId}. Must be lowercase kebab-case.`);
10758
+ const trimmedName = action.input.agentName.trim();
10759
+ if (!trimmedName) throw new InvalidAgentNameError$2("Agent name must not be empty.");
10760
+ state.features.mastra.enabled = true;
10761
+ if (state.features.mastra.models.length === 0) state.features.mastra.models.push({ id: "clint/demo-agent" });
10762
+ if (state.features.mastra.profiles.length === 0) state.features.mastra.profiles.push({
10763
+ id: "base",
10764
+ title: "Base Profile",
10765
+ content: "You are a helpful assistant."
10766
+ });
10767
+ const existing = state.features.mastra.mainAgent;
10768
+ if (!existing) state.features.mastra.mainAgent = {
10769
+ id: action.input.agentId,
10770
+ name: trimmedName,
10771
+ description: null,
10772
+ image: null,
10773
+ modelId: "clint/demo-agent",
10774
+ profileIds: ["base"],
10775
+ skills: [],
10776
+ toolPatterns: []
10777
+ };
10778
+ else {
10779
+ existing.id = action.input.agentId;
10780
+ existing.name = trimmedName;
10781
+ }
10782
+ },
10783
+ disableMastraOperation(state) {
10784
+ state.features.mastra.enabled = false;
10785
+ state.features.mastra.mainAgent = null;
10786
+ state.features.mastra.subAgents = [];
10787
+ state.features.mastra.models = [];
10788
+ state.features.mastra.profiles = [];
10789
+ state.features.mastra.common.enableChat = false;
10790
+ const ccIdx = state.packages.findIndex((p) => p.packageName === "@powerhousedao/clint-common" && p.managed);
10791
+ if (ccIdx !== -1) state.packages.splice(ccIdx, 1);
10792
+ },
10793
+ setEnableChatOperation(state, action) {
10794
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$5("Cannot toggle chat when Mastra is disabled.");
10795
+ if (state.features.powerhouse === "Disabled") throw new PowerhouseNotEnabledError("Cannot toggle chat when Powerhouse is disabled.");
10796
+ state.features.mastra.common.enableChat = action.input.enabled;
10797
+ const CLINT_COMMON_PKG = "@powerhousedao/clint-common";
10798
+ const CHAT_DOC_TYPE = "powerhouse/chat-session";
10799
+ if (action.input.enabled) {
10800
+ const existing = state.packages.find((p) => p.packageName === CLINT_COMMON_PKG);
10801
+ if (!existing) state.packages.push({
10802
+ id: "pkg-clint-common",
10803
+ packageName: CLINT_COMMON_PKG,
10804
+ documentTypes: [CHAT_DOC_TYPE],
10805
+ version: null,
10806
+ managed: true
10807
+ });
10808
+ else if (!existing.documentTypes.includes(CHAT_DOC_TYPE)) existing.documentTypes.push(CHAT_DOC_TYPE);
10809
+ } else {
10810
+ const idx = state.packages.findIndex((p) => p.packageName === CLINT_COMMON_PKG && p.managed);
10811
+ if (idx !== -1) {
10812
+ const pkg = state.packages[idx];
10813
+ if (pkg.documentTypes.length === 1 && pkg.documentTypes[0] === CHAT_DOC_TYPE) state.packages.splice(idx, 1);
10814
+ else {
10815
+ const dtIdx = pkg.documentTypes.indexOf(CHAT_DOC_TYPE);
10816
+ if (dtIdx !== -1) pkg.documentTypes.splice(dtIdx, 1);
10817
+ }
10818
+ }
10819
+ }
10820
+ }
10821
+ };
10822
+ //#endregion
10823
+ //#region document-models/ph-clint-project/v1/gen/features-powerhouse/error.ts
10824
+ var CannotLowerPowerhouseError = class extends Error {
10825
+ errorCode = "CannotLowerPowerhouseError";
10826
+ constructor(message = "CannotLowerPowerhouseError") {
10827
+ super(message);
10828
+ }
10829
+ };
10830
+ //#endregion
10831
+ //#region document-models/ph-clint-project/v1/src/reducers/features-powerhouse.ts
10832
+ const LEVELS = [
10833
+ "Disabled",
10834
+ "Reactor",
10835
+ "Switchboard",
10836
+ "Connect"
10837
+ ];
10838
+ const phClintProjectFeaturesPowerhouseOperations = { setPowerhouseLevelOperation(state, action) {
10839
+ const current = LEVELS.indexOf(state.features.powerhouse);
10840
+ const next = LEVELS.indexOf(action.input.level);
10841
+ if (current >= 1 && next < 1) throw new CannotLowerPowerhouseError("Cannot lower Powerhouse level below Reactor once enabled");
10842
+ state.features.powerhouse = action.input.level;
10843
+ if (current === 0 && next >= 1) {
10844
+ if (!state.packages.some((p) => p.managed)) {
10845
+ const baseName = state.name ? state.name.replace(/-cli$/, "-app") : "app";
10846
+ const appName = state.scope && state.name ? `${state.scope}/${baseName}` : baseName;
10847
+ state.packages.push({
10848
+ id: `app-${state.name || "managed"}`,
10849
+ packageName: appName,
10850
+ documentTypes: ["*/*"],
10851
+ version: null,
10852
+ managed: true
10853
+ });
10854
+ }
10855
+ }
10856
+ if (next >= 2 && !action.input.skipAutoProxy) state.deployment.proxyEnabled = true;
10857
+ } };
10858
+ //#endregion
10859
+ //#region document-models/ph-clint-project/v1/src/reducers/features-routine.ts
10860
+ const phClintProjectFeaturesRoutineOperations = {
10861
+ enableRoutineOperation(state) {
10862
+ state.features.routine.enabled = true;
10863
+ },
10864
+ disableRoutineOperation(state) {
10865
+ state.features.routine.enabled = false;
10866
+ }
10867
+ };
10868
+ //#endregion
10869
+ //#region document-models/ph-clint-project/v1/gen/identity/error.ts
10870
+ var InvalidVersionError$2 = class extends Error {
10871
+ errorCode = "InvalidVersionError";
10872
+ constructor(message = "InvalidVersionError") {
10873
+ super(message);
10874
+ }
10875
+ };
10876
+ var InvalidPackageIdentifierError = class extends Error {
10877
+ errorCode = "InvalidPackageIdentifierError";
10878
+ constructor(message = "InvalidPackageIdentifierError") {
10879
+ super(message);
10880
+ }
10881
+ };
10882
+ //#endregion
10883
+ //#region document-models/ph-clint-project/v1/src/reducers/identity.ts
10884
+ const SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
10885
+ const NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
10886
+ const phClintProjectIdentityOperations = {
10887
+ setVersionOperation(state, action) {
10888
+ if (!SEMVER_PATTERN.test(action.input.version)) throw new InvalidVersionError$2(`Invalid version: ${action.input.version}`);
10889
+ state.version = action.input.version;
10890
+ },
10891
+ setDescriptionOperation(state, action) {
10892
+ state.description = action.input.description;
10893
+ },
10894
+ setPackageIdentifierOperation(state, action) {
10895
+ const trimmed = action.input.identifier.trim();
10896
+ if (!trimmed) throw new InvalidPackageIdentifierError("Package identifier must not be empty");
10897
+ let scopePart = null;
10898
+ let namePart = trimmed;
10899
+ if (trimmed.includes("/")) {
10900
+ const parts = trimmed.split("/");
10901
+ if (parts.length !== 2 || !parts[0] || !parts[1]) throw new InvalidPackageIdentifierError(`Invalid package identifier: ${trimmed}`);
10902
+ scopePart = parts[0].replace(/^@/, "");
10903
+ namePart = parts[1];
10904
+ }
10905
+ if (scopePart !== null) {
10906
+ if (!NAME_PATTERN.test(scopePart)) throw new InvalidPackageIdentifierError(`Invalid scope: ${scopePart}`);
10907
+ }
10908
+ if (!namePart.endsWith("-cli")) namePart = namePart + "-cli";
10909
+ if (!NAME_PATTERN.test(namePart)) throw new InvalidPackageIdentifierError(`Invalid package name: ${namePart}`);
10910
+ state.scope = scopePart ? `@${scopePart}` : null;
10911
+ state.name = namePart;
10912
+ const managed = state.packages.find((p) => p.managed);
10913
+ if (managed) {
10914
+ const appBase = namePart.replace(/-cli$/, "-app");
10915
+ managed.packageName = scopePart ? `@${scopePart}/${appBase}` : appBase;
10916
+ managed.id = `app-${namePart}`;
10917
+ }
10918
+ }
10919
+ };
10920
+ //#endregion
10921
+ //#region document-models/ph-clint-project/v1/gen/lifecycle/error.ts
10922
+ var InvalidAgentImageError$1 = class extends Error {
10923
+ errorCode = "InvalidAgentImageError";
10924
+ constructor(message = "InvalidAgentImageError") {
10925
+ super(message);
10926
+ }
10927
+ };
10928
+ //#endregion
10929
+ //#region document-models/ph-clint-project/v1/src/reducers/lifecycle.ts
10930
+ const phClintProjectLifecycleOperations = { importSpecOperation(state, action) {
10931
+ state.name = action.input.name;
10932
+ state.scope = action.input.scope || null;
10933
+ state.version = action.input.version;
10934
+ state.description = action.input.description;
10935
+ state.features.powerhouse = action.input.powerhouse;
10936
+ state.features.mastra.enabled = action.input.mastraEnabled;
10937
+ state.features.routine.enabled = action.input.routineEnabled;
10938
+ const appBase = action.input.name.replace(/-cli$/, "-app");
10939
+ const appPkgName = action.input.scope ? `${action.input.scope}/${appBase}` : appBase;
10940
+ const phEnabled = action.input.powerhouse !== "Disabled";
10941
+ state.packages = action.input.packages.map((p) => ({
10942
+ id: p.id,
10943
+ packageName: p.packageName,
10944
+ documentTypes: [...p.documentTypes],
10945
+ version: p.version || null,
10946
+ managed: phEnabled && p.packageName === appPkgName
10947
+ }));
10948
+ state.externalSkills = action.input.externalSkills.map((s) => ({
10949
+ id: s.id,
10950
+ name: s.name,
10951
+ githubUrl: s.githubUrl
10952
+ }));
10953
+ state.features.mastra.models = action.input.models.map((m) => ({ id: m.id }));
10954
+ state.features.mastra.profiles = action.input.profiles.map((p) => ({
10955
+ id: p.id,
10956
+ title: p.title,
10957
+ content: p.content
10958
+ }));
10959
+ if (action.input.mainAgent && state.features.mastra.enabled) {
10960
+ const m = action.input.mainAgent;
10961
+ let image = null;
10962
+ if (m.image) {
10963
+ if (!/^data:[a-z]+\/[a-z0-9.+-]+;base64,/.test(m.image)) throw new InvalidAgentImageError$1("Invalid image: must be a data URL (data:<mime>;base64,...)");
10964
+ image = m.image;
10965
+ }
10966
+ state.features.mastra.mainAgent = {
10967
+ id: m.id,
10968
+ name: m.name,
10969
+ description: m.description || null,
10970
+ image,
10971
+ modelId: m.modelId,
10972
+ profileIds: [...m.profileIds],
10973
+ skills: [...m.skills],
10974
+ toolPatterns: [...m.toolPatterns]
10975
+ };
10976
+ } else state.features.mastra.mainAgent = null;
10977
+ if (state.features.mastra.enabled) state.features.mastra.subAgents = action.input.subAgents.map((s) => ({
10978
+ id: s.id,
10979
+ name: s.name,
10980
+ description: s.description,
10981
+ modelId: s.modelId,
10982
+ profileIds: [...s.profileIds],
10983
+ skills: [...s.skills],
10984
+ toolPatterns: [...s.toolPatterns]
10985
+ }));
10986
+ else state.features.mastra.subAgents = [];
10987
+ if (action.input.enableChat && state.features.mastra.enabled && state.features.powerhouse !== "Disabled") {
10988
+ state.features.mastra.common.enableChat = true;
10989
+ const CLINT_COMMON_PKG = "@powerhousedao/clint-common";
10990
+ const CHAT_DOC_TYPE = "powerhouse/chat-session";
10991
+ const existing = state.packages.find((p) => p.packageName === CLINT_COMMON_PKG);
10992
+ if (!existing) state.packages.push({
10993
+ id: "pkg-clint-common",
10994
+ packageName: CLINT_COMMON_PKG,
10995
+ documentTypes: [CHAT_DOC_TYPE],
10996
+ version: null,
10997
+ managed: true
10998
+ });
10999
+ else if (!existing.documentTypes.includes(CHAT_DOC_TYPE)) existing.documentTypes.push(CHAT_DOC_TYPE);
11000
+ } else state.features.mastra.common.enableChat = false;
11001
+ state.deployment.proxyEnabled = action.input.proxyEnabled ?? false;
11002
+ state.deployment.observabilityEnabled = action.input.observabilityEnabled ?? false;
11003
+ state.deployment.supportedResources = action.input.supportedResources ? [...action.input.supportedResources] : [];
11004
+ } };
11005
+ //#endregion
11006
+ //#region document-models/ph-clint-project/v1/gen/mastra-agent-bindings/error.ts
11007
+ var MastraNotEnabledError$4 = class extends Error {
11008
+ errorCode = "MastraNotEnabledError";
11009
+ constructor(message = "MastraNotEnabledError") {
10056
11010
  super(message);
10057
11011
  }
10058
11012
  };
10059
- var ResourceNotFoundError = class extends Error {
10060
- errorCode = "ResourceNotFoundError";
10061
- constructor(message = "ResourceNotFoundError") {
11013
+ var AgentNotFoundError$1 = class extends Error {
11014
+ errorCode = "AgentNotFoundError";
11015
+ constructor(message = "AgentNotFoundError") {
10062
11016
  super(message);
10063
11017
  }
10064
11018
  };
10065
- //#endregion
10066
- //#region document-models/ph-clint-project/v1/src/reducers/deployment.ts
10067
- const phClintProjectDeploymentOperations = {
10068
- addSupportedResourceOperation(state, action) {
10069
- if (state.deployment.supportedResources.includes(action.input.resource)) throw new DuplicateResourceError(`Resource already exists: ${action.input.resource}`);
10070
- state.deployment.supportedResources.push(action.input.resource);
10071
- },
10072
- removeSupportedResourceOperation(state, action) {
10073
- const idx = state.deployment.supportedResources.indexOf(action.input.resource);
10074
- if (idx === -1) throw new ResourceNotFoundError(`Resource not found: ${action.input.resource}`);
10075
- state.deployment.supportedResources.splice(idx, 1);
10076
- },
10077
- setProxyEnabledOperation(state, action) {
10078
- state.deployment.proxyEnabled = action.input.enabled;
10079
- },
10080
- setObservabilityEnabledOperation(state, action) {
10081
- state.deployment.observabilityEnabled = action.input.enabled;
11019
+ var ModelReferenceNotFoundError$1 = class extends Error {
11020
+ errorCode = "ModelReferenceNotFoundError";
11021
+ constructor(message = "ModelReferenceNotFoundError") {
11022
+ super(message);
10082
11023
  }
10083
11024
  };
10084
- //#endregion
10085
- //#region document-models/ph-clint-project/v1/gen/external-skills/error.ts
10086
- var InvalidSkillNameError = class extends Error {
10087
- errorCode = "InvalidSkillNameError";
10088
- constructor(message = "InvalidSkillNameError") {
11025
+ var ProfileReferenceNotFoundError = class extends Error {
11026
+ errorCode = "ProfileReferenceNotFoundError";
11027
+ constructor(message = "ProfileReferenceNotFoundError") {
10089
11028
  super(message);
10090
11029
  }
10091
11030
  };
10092
- var DuplicateSkillError = class extends Error {
10093
- errorCode = "DuplicateSkillError";
10094
- constructor(message = "DuplicateSkillError") {
11031
+ var InvalidSkillNameError = class extends Error {
11032
+ errorCode = "InvalidSkillNameError";
11033
+ constructor(message = "InvalidSkillNameError") {
10095
11034
  super(message);
10096
11035
  }
10097
11036
  };
@@ -10101,51 +11040,153 @@ var SkillNotFoundError = class extends Error {
10101
11040
  super(message);
10102
11041
  }
10103
11042
  };
11043
+ var InvalidToolPatternError = class extends Error {
11044
+ errorCode = "InvalidToolPatternError";
11045
+ constructor(message = "InvalidToolPatternError") {
11046
+ super(message);
11047
+ }
11048
+ };
11049
+ var ToolPatternNotFoundError = class extends Error {
11050
+ errorCode = "ToolPatternNotFoundError";
11051
+ constructor(message = "ToolPatternNotFoundError") {
11052
+ super(message);
11053
+ }
11054
+ };
10104
11055
  //#endregion
10105
- //#region document-models/ph-clint-project/v1/src/reducers/external-skills.ts
10106
- const phClintProjectExternalSkillsOperations = {
10107
- addExternalSkillOperation(state, action) {
10108
- if (!/^[a-z][a-z0-9-]*$/.test(action.input.name)) throw new InvalidSkillNameError(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);
10109
- if (state.externalSkills.find((s) => s.id === action.input.id || s.name === action.input.name)) throw new DuplicateSkillError(`Skill already exists: ${action.input.name}`);
10110
- state.externalSkills.push({
10111
- id: action.input.id,
10112
- name: action.input.name,
10113
- githubUrl: action.input.githubUrl
10114
- });
11056
+ //#region document-models/ph-clint-project/v1/src/reducers/mastra-agent-bindings.ts
11057
+ function resolveAgent(main, subs, agentId) {
11058
+ if (main && main.id === agentId) return main;
11059
+ return subs.find((s) => s.id === agentId);
11060
+ }
11061
+ const phClintProjectMastraAgentBindingsOperations = {
11062
+ setAgentModelOperation(state, action) {
11063
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$4("Cannot set agent model when Mastra is disabled.");
11064
+ const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);
11065
+ if (!agent) throw new AgentNotFoundError$1(`Agent not found: ${action.input.agentId}`);
11066
+ if (!state.features.mastra.models.find((m) => m.id === action.input.modelId)) throw new ModelReferenceNotFoundError$1(`Model not in library: ${action.input.modelId}`);
11067
+ agent.modelId = action.input.modelId;
10115
11068
  },
10116
- removeExternalSkillOperation(state, action) {
10117
- const idx = state.externalSkills.findIndex((s) => s.id === action.input.id);
10118
- if (idx === -1) throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);
10119
- state.externalSkills.splice(idx, 1);
11069
+ addAgentProfileRefOperation(state, action) {
11070
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$4("Cannot add profile ref when Mastra is disabled.");
11071
+ const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);
11072
+ if (!agent) throw new AgentNotFoundError$1(`Agent not found: ${action.input.agentId}`);
11073
+ if (!state.features.mastra.profiles.find((p) => p.id === action.input.profileId)) throw new ProfileReferenceNotFoundError(`Profile not in library: ${action.input.profileId}`);
11074
+ if (agent.profileIds.includes(action.input.profileId)) return;
11075
+ if (action.input.insertBefore) {
11076
+ const beforeIdx = agent.profileIds.indexOf(action.input.insertBefore);
11077
+ if (beforeIdx === -1) throw new ProfileReferenceNotFoundError(`insertBefore profile not in agent's profileIds: ${action.input.insertBefore}`);
11078
+ agent.profileIds.splice(beforeIdx, 0, action.input.profileId);
11079
+ } else agent.profileIds.push(action.input.profileId);
10120
11080
  },
10121
- setExternalSkillNameOperation(state, action) {
10122
- const skill = state.externalSkills.find((s) => s.id === action.input.id);
10123
- if (!skill) throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);
10124
- if (!/^[a-z][a-z0-9-]*$/.test(action.input.name)) throw new InvalidSkillNameError(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);
10125
- if (state.externalSkills.find((s) => s.name === action.input.name && s.id !== action.input.id)) throw new DuplicateSkillError(`Skill name already in use: ${action.input.name}`);
10126
- skill.name = action.input.name;
11081
+ removeAgentProfileRefOperation(state, action) {
11082
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$4("Cannot remove profile ref when Mastra is disabled.");
11083
+ const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);
11084
+ if (!agent) throw new AgentNotFoundError$1(`Agent not found: ${action.input.agentId}`);
11085
+ const idx = agent.profileIds.indexOf(action.input.profileId);
11086
+ if (idx === -1) throw new ProfileReferenceNotFoundError(`Profile not in agent's profileIds: ${action.input.profileId}`);
11087
+ agent.profileIds.splice(idx, 1);
10127
11088
  },
10128
- setExternalSkillGithubUrlOperation(state, action) {
10129
- const skill = state.externalSkills.find((s) => s.id === action.input.id);
10130
- if (!skill) throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);
10131
- skill.githubUrl = action.input.githubUrl;
11089
+ reorderAgentProfileRefsOperation(state, action) {
11090
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$4("Cannot reorder profile refs when Mastra is disabled.");
11091
+ const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);
11092
+ if (!agent) throw new AgentNotFoundError$1(`Agent not found: ${action.input.agentId}`);
11093
+ for (const id of action.input.ids) if (!agent.profileIds.includes(id)) throw new ProfileReferenceNotFoundError(`Profile not in agent's profileIds: ${id}`);
11094
+ const remaining = agent.profileIds.filter((id) => !action.input.ids.includes(id));
11095
+ if (action.input.insertBefore) {
11096
+ const beforeIdx = remaining.indexOf(action.input.insertBefore);
11097
+ if (beforeIdx === -1) throw new ProfileReferenceNotFoundError(`insertBefore profile not in agent's profileIds: ${action.input.insertBefore}`);
11098
+ remaining.splice(beforeIdx, 0, ...action.input.ids);
11099
+ } else remaining.push(...action.input.ids);
11100
+ agent.profileIds = remaining;
11101
+ },
11102
+ addAgentSkillOperation(state, action) {
11103
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$4("Cannot add skill when Mastra is disabled.");
11104
+ const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);
11105
+ if (!agent) throw new AgentNotFoundError$1(`Agent not found: ${action.input.agentId}`);
11106
+ const trimmed = action.input.name.trim();
11107
+ if (!/^[a-z][a-z0-9-]*$/.test(trimmed)) throw new InvalidSkillNameError(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);
11108
+ if (!agent.skills.includes(trimmed)) agent.skills.push(trimmed);
11109
+ },
11110
+ removeAgentSkillOperation(state, action) {
11111
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$4("Cannot remove skill when Mastra is disabled.");
11112
+ const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);
11113
+ if (!agent) throw new AgentNotFoundError$1(`Agent not found: ${action.input.agentId}`);
11114
+ const idx = agent.skills.indexOf(action.input.name);
11115
+ if (idx === -1) throw new SkillNotFoundError(`Skill not on agent: ${action.input.name}`);
11116
+ agent.skills.splice(idx, 1);
11117
+ },
11118
+ addAgentToolPatternOperation(state, action) {
11119
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$4("Cannot add tool pattern when Mastra is disabled.");
11120
+ const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);
11121
+ if (!agent) throw new AgentNotFoundError$1(`Agent not found: ${action.input.agentId}`);
11122
+ const trimmed = action.input.pattern.trim();
11123
+ if (!trimmed) throw new InvalidToolPatternError("Tool pattern must not be empty after trimming.");
11124
+ if (!agent.toolPatterns.includes(trimmed)) agent.toolPatterns.push(trimmed);
11125
+ },
11126
+ removeAgentToolPatternOperation(state, action) {
11127
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$4("Cannot remove tool pattern when Mastra is disabled.");
11128
+ const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);
11129
+ if (!agent) throw new AgentNotFoundError$1(`Agent not found: ${action.input.agentId}`);
11130
+ const idx = agent.toolPatterns.indexOf(action.input.pattern);
11131
+ if (idx === -1) throw new ToolPatternNotFoundError(`Tool pattern not on agent: ${action.input.pattern}`);
11132
+ agent.toolPatterns.splice(idx, 1);
10132
11133
  }
10133
11134
  };
10134
11135
  //#endregion
10135
- //#region document-models/ph-clint-project/v1/gen/features-mastra/error.ts
10136
- var InvalidAgentIdError = class extends Error {
10137
- errorCode = "InvalidAgentIdError";
10138
- constructor(message = "InvalidAgentIdError") {
11136
+ //#region document-models/ph-clint-project/v1/gen/mastra-main-agent/error.ts
11137
+ var MastraNotEnabledError$3 = class extends Error {
11138
+ errorCode = "MastraNotEnabledError";
11139
+ constructor(message = "MastraNotEnabledError") {
10139
11140
  super(message);
10140
11141
  }
10141
11142
  };
10142
- var InvalidAgentNameError = class extends Error {
11143
+ var InvalidAgentNameError$1 = class extends Error {
10143
11144
  errorCode = "InvalidAgentNameError";
10144
11145
  constructor(message = "InvalidAgentNameError") {
10145
11146
  super(message);
10146
11147
  }
10147
11148
  };
10148
- var MastraNotEnabledError = class extends Error {
11149
+ var InvalidAgentImageError = class extends Error {
11150
+ errorCode = "InvalidAgentImageError";
11151
+ constructor(message = "InvalidAgentImageError") {
11152
+ super(message);
11153
+ }
11154
+ };
11155
+ //#endregion
11156
+ //#region document-models/ph-clint-project/v1/src/reducers/mastra-main-agent.ts
11157
+ const phClintProjectMastraMainAgentOperations = {
11158
+ setMainAgentNameOperation(state, action) {
11159
+ const main = state.features.mastra.mainAgent;
11160
+ if (!state.features.mastra.enabled || !main) throw new MastraNotEnabledError$3("Cannot set main agent name when Mastra is disabled.");
11161
+ const trimmed = action.input.name.trim();
11162
+ if (!trimmed) throw new InvalidAgentNameError$1("Agent name must not be empty.");
11163
+ main.name = trimmed;
11164
+ },
11165
+ setMainAgentDescriptionOperation(state, action) {
11166
+ const main = state.features.mastra.mainAgent;
11167
+ if (!state.features.mastra.enabled || !main) throw new MastraNotEnabledError$3("Cannot set main agent description when Mastra is disabled.");
11168
+ main.description = action.input.description;
11169
+ },
11170
+ clearMainAgentDescriptionOperation(state) {
11171
+ const main = state.features.mastra.mainAgent;
11172
+ if (!state.features.mastra.enabled || !main) throw new MastraNotEnabledError$3("Cannot clear main agent description when Mastra is disabled.");
11173
+ main.description = null;
11174
+ },
11175
+ setMainAgentImageOperation(state, action) {
11176
+ const main = state.features.mastra.mainAgent;
11177
+ if (!state.features.mastra.enabled || !main) throw new MastraNotEnabledError$3("Cannot set main agent image when Mastra is disabled.");
11178
+ if (!/^data:[a-z]+\/[a-z0-9.+-]+;base64,/.test(action.input.image)) throw new InvalidAgentImageError("Agent image must be a data URL (data:image/...;base64,...)");
11179
+ main.image = action.input.image;
11180
+ },
11181
+ clearMainAgentImageOperation(state) {
11182
+ const main = state.features.mastra.mainAgent;
11183
+ if (!state.features.mastra.enabled || !main) throw new MastraNotEnabledError$3("Cannot clear main agent image when Mastra is disabled.");
11184
+ main.image = null;
11185
+ }
11186
+ };
11187
+ //#endregion
11188
+ //#region document-models/ph-clint-project/v1/gen/mastra-models/error.ts
11189
+ var MastraNotEnabledError$2 = class extends Error {
10149
11190
  errorCode = "MastraNotEnabledError";
10150
11191
  constructor(message = "MastraNotEnabledError") {
10151
11192
  super(message);
@@ -10169,6 +11210,40 @@ var ModelNotFoundError = class extends Error {
10169
11210
  super(message);
10170
11211
  }
10171
11212
  };
11213
+ var ModelInUseError = class extends Error {
11214
+ errorCode = "ModelInUseError";
11215
+ constructor(message = "ModelInUseError") {
11216
+ super(message);
11217
+ }
11218
+ };
11219
+ //#endregion
11220
+ //#region document-models/ph-clint-project/v1/src/reducers/mastra-models.ts
11221
+ const phClintProjectMastraModelsOperations = {
11222
+ addModelOperation(state, action) {
11223
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$2("Cannot add model when Mastra is disabled.");
11224
+ if (!/^[a-z0-9-]+\/[a-z0-9._-]+$/.test(action.input.id)) throw new InvalidModelIdError(`Invalid model ID: ${action.input.id}. Must be provider/model-name format.`);
11225
+ if (state.features.mastra.models.find((m) => m.id === action.input.id)) throw new DuplicateModelError(`Model already exists: ${action.input.id}`);
11226
+ state.features.mastra.models.push({ id: action.input.id });
11227
+ },
11228
+ removeModelOperation(state, action) {
11229
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$2("Cannot remove model when Mastra is disabled.");
11230
+ const idx = state.features.mastra.models.findIndex((m) => m.id === action.input.id);
11231
+ if (idx === -1) throw new ModelNotFoundError(`Model not found: ${action.input.id}`);
11232
+ const main = state.features.mastra.mainAgent;
11233
+ const usedByMain = !!main && main.modelId === action.input.id;
11234
+ const usedBySub = state.features.mastra.subAgents.some((s) => s.modelId === action.input.id);
11235
+ if (usedByMain || usedBySub) throw new ModelInUseError(`Model ${action.input.id} is in use by an agent.`);
11236
+ state.features.mastra.models.splice(idx, 1);
11237
+ }
11238
+ };
11239
+ //#endregion
11240
+ //#region document-models/ph-clint-project/v1/gen/mastra-profiles/error.ts
11241
+ var MastraNotEnabledError$1 = class extends Error {
11242
+ errorCode = "MastraNotEnabledError";
11243
+ constructor(message = "MastraNotEnabledError") {
11244
+ super(message);
11245
+ }
11246
+ };
10172
11247
  var InvalidProfileIdError = class extends Error {
10173
11248
  errorCode = "InvalidProfileIdError";
10174
11249
  constructor(message = "InvalidProfileIdError") {
@@ -10187,89 +11262,17 @@ var ProfileNotFoundError = class extends Error {
10187
11262
  super(message);
10188
11263
  }
10189
11264
  };
10190
- var InvalidAgentImageError = class extends Error {
10191
- errorCode = "InvalidAgentImageError";
10192
- constructor(message = "InvalidAgentImageError") {
10193
- super(message);
10194
- }
10195
- };
10196
- var PowerhouseNotEnabledError = class extends Error {
10197
- errorCode = "PowerhouseNotEnabledError";
10198
- constructor(message = "PowerhouseNotEnabledError") {
11265
+ var ProfileInUseError = class extends Error {
11266
+ errorCode = "ProfileInUseError";
11267
+ constructor(message = "ProfileInUseError") {
10199
11268
  super(message);
10200
11269
  }
10201
11270
  };
10202
11271
  //#endregion
10203
- //#region document-models/ph-clint-project/v1/src/reducers/features-mastra.ts
10204
- const phClintProjectFeaturesMastraOperations = {
10205
- enableMastraOperation(state, action) {
10206
- if (!/^[a-z][a-z0-9-]*$/.test(action.input.agentId)) throw new InvalidAgentIdError(`Invalid agent ID: ${action.input.agentId}. Must be lowercase kebab-case.`);
10207
- const trimmedName = action.input.agentName.trim();
10208
- if (!trimmedName) throw new InvalidAgentNameError("Agent name must not be empty.");
10209
- state.features.mastra.enabled = true;
10210
- state.features.mastra.agentId = action.input.agentId;
10211
- state.features.mastra.agentName = trimmedName;
10212
- if (state.features.mastra.models.length === 0) state.features.mastra.models.push({
10213
- id: "clint/demo-agent",
10214
- isDefault: true
10215
- });
10216
- if (state.features.mastra.profiles.length === 0) state.features.mastra.profiles.push({
10217
- id: "base",
10218
- title: "Base Profile",
10219
- content: "You are a helpful assistant"
10220
- });
10221
- },
10222
- disableMastraOperation(state) {
10223
- state.features.mastra.enabled = false;
10224
- state.features.mastra.agentId = null;
10225
- state.features.mastra.agentName = null;
10226
- state.features.mastra.agentDescription = null;
10227
- state.features.mastra.agentImage = null;
10228
- state.features.mastra.models = [];
10229
- state.features.mastra.profiles = [];
10230
- state.features.mastra.common.enableChat = false;
10231
- const ccIdx = state.packages.findIndex((p) => p.packageName === "@powerhousedao/clint-common" && p.managed);
10232
- if (ccIdx !== -1) state.packages.splice(ccIdx, 1);
10233
- },
10234
- setAgentIdOperation(state, action) {
10235
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot set agent ID when Mastra is disabled.");
10236
- if (!/^[a-z][a-z0-9-]*$/.test(action.input.agentId)) throw new InvalidAgentIdError(`Invalid agent ID: ${action.input.agentId}. Must be lowercase kebab-case.`);
10237
- state.features.mastra.agentId = action.input.agentId;
10238
- },
10239
- setAgentNameOperation(state, action) {
10240
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot set agent name when Mastra is disabled.");
10241
- const trimmedName = action.input.agentName.trim();
10242
- if (!trimmedName) throw new InvalidAgentNameError("Agent name must not be empty.");
10243
- state.features.mastra.agentName = trimmedName;
10244
- },
10245
- addModelOperation(state, action) {
10246
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot add model when Mastra is disabled.");
10247
- if (!/^[a-z0-9-]+\/[a-z0-9._-]+$/.test(action.input.id)) throw new InvalidModelIdError(`Invalid model ID: ${action.input.id}. Must be provider/model-name format.`);
10248
- if (state.features.mastra.models.find((m) => m.id === action.input.id)) throw new DuplicateModelError(`Model already exists: ${action.input.id}`);
10249
- const makeDefault = state.features.mastra.models.length === 0 || action.input.isDefault === true;
10250
- if (makeDefault) for (const m of state.features.mastra.models) m.isDefault = false;
10251
- state.features.mastra.models.push({
10252
- id: action.input.id,
10253
- isDefault: makeDefault
10254
- });
10255
- },
10256
- removeModelOperation(state, action) {
10257
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot remove model when Mastra is disabled.");
10258
- const idx = state.features.mastra.models.findIndex((m) => m.id === action.input.id);
10259
- if (idx === -1) throw new ModelNotFoundError(`Model not found: ${action.input.id}`);
10260
- const wasDefault = state.features.mastra.models[idx].isDefault;
10261
- state.features.mastra.models.splice(idx, 1);
10262
- if (wasDefault && state.features.mastra.models.length > 0) state.features.mastra.models[0].isDefault = true;
10263
- },
10264
- setDefaultModelOperation(state, action) {
10265
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot set default model when Mastra is disabled.");
10266
- const model = state.features.mastra.models.find((m) => m.id === action.input.id);
10267
- if (!model) throw new ModelNotFoundError(`Model not found: ${action.input.id}`);
10268
- for (const m of state.features.mastra.models) m.isDefault = false;
10269
- model.isDefault = true;
10270
- },
11272
+ //#region document-models/ph-clint-project/v1/src/reducers/mastra-profiles.ts
11273
+ const phClintProjectMastraProfilesOperations = {
10271
11274
  addProfileOperation(state, action) {
10272
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot add profile when Mastra is disabled.");
11275
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$1("Cannot add profile when Mastra is disabled.");
10273
11276
  if (!/^[a-z][a-z0-9-]*$/.test(action.input.id)) throw new InvalidProfileIdError(`Invalid profile ID: ${action.input.id}. Must be lowercase kebab-case.`);
10274
11277
  if (state.features.mastra.profiles.find((p) => p.id === action.input.id)) throw new DuplicateProfileError(`Profile already exists: ${action.input.id}`);
10275
11278
  const profile = {
@@ -10279,239 +11282,125 @@ const phClintProjectFeaturesMastraOperations = {
10279
11282
  };
10280
11283
  if (action.input.insertBefore) {
10281
11284
  const beforeIdx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.insertBefore);
10282
- if (beforeIdx === -1) throw new ProfileNotFoundError(`insertBefore profile not found: ${action.input.insertBefore}`);
10283
- state.features.mastra.profiles.splice(beforeIdx, 0, profile);
10284
- } else state.features.mastra.profiles.push(profile);
10285
- },
10286
- updateProfileOperation(state, action) {
10287
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot update profile when Mastra is disabled.");
10288
- const profile = state.features.mastra.profiles.find((p) => p.id === action.input.id);
10289
- if (!profile) throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);
10290
- if (action.input.title) profile.title = action.input.title;
10291
- if (action.input.content) profile.content = action.input.content;
10292
- },
10293
- removeProfileOperation(state, action) {
10294
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot remove profile when Mastra is disabled.");
10295
- const idx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.id);
10296
- if (idx === -1) throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);
10297
- state.features.mastra.profiles.splice(idx, 1);
10298
- },
10299
- reorderProfilesOperation(state, action) {
10300
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot reorder profiles when Mastra is disabled.");
10301
- const moving = [];
10302
- for (const id of action.input.ids) {
10303
- const profile = state.features.mastra.profiles.find((p) => p.id === id);
10304
- if (!profile) throw new ProfileNotFoundError(`Profile not found: ${id}`);
10305
- moving.push(profile);
10306
- }
10307
- state.features.mastra.profiles = state.features.mastra.profiles.filter((p) => !action.input.ids.includes(p.id));
10308
- if (action.input.insertBefore) {
10309
- const beforeIdx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.insertBefore);
10310
- if (beforeIdx === -1) throw new ProfileNotFoundError(`insertBefore profile not found: ${action.input.insertBefore}`);
10311
- state.features.mastra.profiles.splice(beforeIdx, 0, ...moving);
10312
- } else state.features.mastra.profiles.push(...moving);
10313
- },
10314
- setAgentDescriptionOperation(state, action) {
10315
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot set agent description when Mastra is disabled.");
10316
- state.features.mastra.agentDescription = action.input.description;
10317
- },
10318
- setAgentImageOperation(state, action) {
10319
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot set agent image when Mastra is disabled.");
10320
- if (!/^data:[a-z]+\/[a-z0-9.+-]+;base64,/.test(action.input.image)) throw new InvalidAgentImageError("Invalid image: must be a data URL (data:<mime>;base64,...)");
10321
- state.features.mastra.agentImage = action.input.image;
10322
- },
10323
- clearAgentImageOperation(state, action) {
10324
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot clear agent image when Mastra is disabled.");
10325
- state.features.mastra.agentImage = null;
10326
- },
10327
- setEnableChatOperation(state, action) {
10328
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot toggle chat when Mastra is disabled.");
10329
- if (state.features.powerhouse === "Disabled") throw new PowerhouseNotEnabledError("Cannot toggle chat when Powerhouse is disabled.");
10330
- state.features.mastra.common.enableChat = action.input.enabled;
10331
- const CLINT_COMMON_PKG = "@powerhousedao/clint-common";
10332
- const CHAT_DOC_TYPE = "powerhouse/chat-session";
10333
- if (action.input.enabled) {
10334
- const existing = state.packages.find((p) => p.packageName === CLINT_COMMON_PKG);
10335
- if (!existing) state.packages.push({
10336
- id: "pkg-clint-common",
10337
- packageName: CLINT_COMMON_PKG,
10338
- documentTypes: [CHAT_DOC_TYPE],
10339
- version: null,
10340
- managed: true
10341
- });
10342
- else if (!existing.documentTypes.includes(CHAT_DOC_TYPE)) existing.documentTypes.push(CHAT_DOC_TYPE);
10343
- } else {
10344
- const idx = state.packages.findIndex((p) => p.packageName === CLINT_COMMON_PKG && p.managed);
10345
- if (idx !== -1) {
10346
- const pkg = state.packages[idx];
10347
- if (pkg.documentTypes.length === 1 && pkg.documentTypes[0] === CHAT_DOC_TYPE) state.packages.splice(idx, 1);
10348
- else {
10349
- const dtIdx = pkg.documentTypes.indexOf(CHAT_DOC_TYPE);
10350
- if (dtIdx !== -1) pkg.documentTypes.splice(dtIdx, 1);
10351
- }
10352
- }
11285
+ if (beforeIdx === -1) throw new ProfileNotFoundError(`insertBefore profile not found: ${action.input.insertBefore}`);
11286
+ state.features.mastra.profiles.splice(beforeIdx, 0, profile);
11287
+ } else state.features.mastra.profiles.push(profile);
11288
+ },
11289
+ updateProfileOperation(state, action) {
11290
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$1("Cannot update profile when Mastra is disabled.");
11291
+ const profile = state.features.mastra.profiles.find((p) => p.id === action.input.id);
11292
+ if (!profile) throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);
11293
+ if (action.input.title) profile.title = action.input.title;
11294
+ if (action.input.content) profile.content = action.input.content;
11295
+ },
11296
+ removeProfileOperation(state, action) {
11297
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$1("Cannot remove profile when Mastra is disabled.");
11298
+ const idx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.id);
11299
+ if (idx === -1) throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);
11300
+ const main = state.features.mastra.mainAgent;
11301
+ const usedByMain = !!main && main.profileIds.includes(action.input.id);
11302
+ const usedBySub = state.features.mastra.subAgents.some((s) => s.profileIds.includes(action.input.id));
11303
+ if (usedByMain || usedBySub) throw new ProfileInUseError(`Profile ${action.input.id} is in use by an agent.`);
11304
+ state.features.mastra.profiles.splice(idx, 1);
11305
+ },
11306
+ reorderProfilesOperation(state, action) {
11307
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError$1("Cannot reorder profiles when Mastra is disabled.");
11308
+ const moving = [];
11309
+ for (const id of action.input.ids) {
11310
+ const profile = state.features.mastra.profiles.find((p) => p.id === id);
11311
+ if (!profile) throw new ProfileNotFoundError(`Profile not found: ${id}`);
11312
+ moving.push(profile);
10353
11313
  }
11314
+ state.features.mastra.profiles = state.features.mastra.profiles.filter((p) => !action.input.ids.includes(p.id));
11315
+ if (action.input.insertBefore) {
11316
+ const beforeIdx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.insertBefore);
11317
+ if (beforeIdx === -1) throw new ProfileNotFoundError(`insertBefore profile not found: ${action.input.insertBefore}`);
11318
+ state.features.mastra.profiles.splice(beforeIdx, 0, ...moving);
11319
+ } else state.features.mastra.profiles.push(...moving);
10354
11320
  }
10355
11321
  };
10356
11322
  //#endregion
10357
- //#region document-models/ph-clint-project/v1/gen/features-powerhouse/error.ts
10358
- var CannotLowerPowerhouseError = class extends Error {
10359
- errorCode = "CannotLowerPowerhouseError";
10360
- constructor(message = "CannotLowerPowerhouseError") {
11323
+ //#region document-models/ph-clint-project/v1/gen/mastra-sub-agents/error.ts
11324
+ var MastraNotEnabledError = class extends Error {
11325
+ errorCode = "MastraNotEnabledError";
11326
+ constructor(message = "MastraNotEnabledError") {
10361
11327
  super(message);
10362
11328
  }
10363
11329
  };
10364
- //#endregion
10365
- //#region document-models/ph-clint-project/v1/src/reducers/features-powerhouse.ts
10366
- const LEVELS = [
10367
- "Disabled",
10368
- "Reactor",
10369
- "Switchboard",
10370
- "Connect"
10371
- ];
10372
- const phClintProjectFeaturesPowerhouseOperations = { setPowerhouseLevelOperation(state, action) {
10373
- const current = LEVELS.indexOf(state.features.powerhouse);
10374
- const next = LEVELS.indexOf(action.input.level);
10375
- if (current >= 1 && next < 1) throw new CannotLowerPowerhouseError("Cannot lower Powerhouse level below Reactor once enabled");
10376
- state.features.powerhouse = action.input.level;
10377
- if (current === 0 && next >= 1) {
10378
- if (!state.packages.some((p) => p.managed)) {
10379
- const baseName = state.name ? state.name.replace(/-cli$/, "-app") : "app";
10380
- const appName = state.scope && state.name ? `${state.scope}/${baseName}` : baseName;
10381
- state.packages.push({
10382
- id: `app-${state.name || "managed"}`,
10383
- packageName: appName,
10384
- documentTypes: ["*/*"],
10385
- version: null,
10386
- managed: true
10387
- });
10388
- }
11330
+ var InvalidAgentIdError = class extends Error {
11331
+ errorCode = "InvalidAgentIdError";
11332
+ constructor(message = "InvalidAgentIdError") {
11333
+ super(message);
10389
11334
  }
10390
- if (next >= 2 && !action.input.skipAutoProxy) state.deployment.proxyEnabled = true;
10391
- } };
10392
- //#endregion
10393
- //#region document-models/ph-clint-project/v1/src/reducers/features-routine.ts
10394
- const phClintProjectFeaturesRoutineOperations = {
10395
- enableRoutineOperation(state) {
10396
- state.features.routine.enabled = true;
10397
- },
10398
- disableRoutineOperation(state) {
10399
- state.features.routine.enabled = false;
11335
+ };
11336
+ var InvalidAgentNameError = class extends Error {
11337
+ errorCode = "InvalidAgentNameError";
11338
+ constructor(message = "InvalidAgentNameError") {
11339
+ super(message);
10400
11340
  }
10401
11341
  };
10402
- //#endregion
10403
- //#region document-models/ph-clint-project/v1/gen/identity/error.ts
10404
- var InvalidVersionError$2 = class extends Error {
10405
- errorCode = "InvalidVersionError";
10406
- constructor(message = "InvalidVersionError") {
11342
+ var DuplicateAgentIdError = class extends Error {
11343
+ errorCode = "DuplicateAgentIdError";
11344
+ constructor(message = "DuplicateAgentIdError") {
10407
11345
  super(message);
10408
11346
  }
10409
11347
  };
10410
- var InvalidPackageIdentifierError = class extends Error {
10411
- errorCode = "InvalidPackageIdentifierError";
10412
- constructor(message = "InvalidPackageIdentifierError") {
11348
+ var ModelReferenceNotFoundError = class extends Error {
11349
+ errorCode = "ModelReferenceNotFoundError";
11350
+ constructor(message = "ModelReferenceNotFoundError") {
11351
+ super(message);
11352
+ }
11353
+ };
11354
+ var AgentNotFoundError = class extends Error {
11355
+ errorCode = "AgentNotFoundError";
11356
+ constructor(message = "AgentNotFoundError") {
10413
11357
  super(message);
10414
11358
  }
10415
11359
  };
10416
11360
  //#endregion
10417
- //#region document-models/ph-clint-project/v1/src/reducers/identity.ts
10418
- const SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
10419
- const NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
10420
- const phClintProjectIdentityOperations = {
10421
- setVersionOperation(state, action) {
10422
- if (!SEMVER_PATTERN.test(action.input.version)) throw new InvalidVersionError$2(`Invalid version: ${action.input.version}`);
10423
- state.version = action.input.version;
11361
+ //#region document-models/ph-clint-project/v1/src/reducers/mastra-sub-agents.ts
11362
+ const phClintProjectMastraSubAgentsOperations = {
11363
+ addSubAgentOperation(state, action) {
11364
+ const main = state.features.mastra.mainAgent;
11365
+ if (!state.features.mastra.enabled || !main) throw new MastraNotEnabledError("Cannot add sub-agent when Mastra is disabled.");
11366
+ if (!/^[a-z][a-z0-9-]*$/.test(action.input.id)) throw new InvalidAgentIdError(`Invalid sub-agent ID: ${action.input.id}. Must be lowercase kebab-case.`);
11367
+ const trimmedName = action.input.name.trim();
11368
+ if (!trimmedName) throw new InvalidAgentNameError("Sub-agent name must not be empty.");
11369
+ if (main.id === action.input.id) throw new DuplicateAgentIdError(`Agent ID already taken by main agent: ${action.input.id}`);
11370
+ if (state.features.mastra.subAgents.find((s) => s.id === action.input.id)) throw new DuplicateAgentIdError(`Sub-agent already exists: ${action.input.id}`);
11371
+ if (!state.features.mastra.models.find((m) => m.id === action.input.modelId)) throw new ModelReferenceNotFoundError(`Model not in library: ${action.input.modelId}`);
11372
+ state.features.mastra.subAgents.push({
11373
+ id: action.input.id,
11374
+ name: trimmedName,
11375
+ description: action.input.description,
11376
+ modelId: action.input.modelId,
11377
+ profileIds: [],
11378
+ skills: [],
11379
+ toolPatterns: []
11380
+ });
10424
11381
  },
10425
- setDescriptionOperation(state, action) {
10426
- state.description = action.input.description;
11382
+ removeSubAgentOperation(state, action) {
11383
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot remove sub-agent when Mastra is disabled.");
11384
+ const idx = state.features.mastra.subAgents.findIndex((s) => s.id === action.input.id);
11385
+ if (idx === -1) throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);
11386
+ state.features.mastra.subAgents.splice(idx, 1);
10427
11387
  },
10428
- setPackageIdentifierOperation(state, action) {
10429
- const trimmed = action.input.identifier.trim();
10430
- if (!trimmed) throw new InvalidPackageIdentifierError("Package identifier must not be empty");
10431
- let scopePart = null;
10432
- let namePart = trimmed;
10433
- if (trimmed.includes("/")) {
10434
- const parts = trimmed.split("/");
10435
- if (parts.length !== 2 || !parts[0] || !parts[1]) throw new InvalidPackageIdentifierError(`Invalid package identifier: ${trimmed}`);
10436
- scopePart = parts[0].replace(/^@/, "");
10437
- namePart = parts[1];
10438
- }
10439
- if (scopePart !== null) {
10440
- if (!NAME_PATTERN.test(scopePart)) throw new InvalidPackageIdentifierError(`Invalid scope: ${scopePart}`);
10441
- }
10442
- if (!namePart.endsWith("-cli")) namePart = namePart + "-cli";
10443
- if (!NAME_PATTERN.test(namePart)) throw new InvalidPackageIdentifierError(`Invalid package name: ${namePart}`);
10444
- state.scope = scopePart ? `@${scopePart}` : null;
10445
- state.name = namePart;
10446
- const managed = state.packages.find((p) => p.managed);
10447
- if (managed) {
10448
- const appBase = namePart.replace(/-cli$/, "-app");
10449
- managed.packageName = scopePart ? `@${scopePart}/${appBase}` : appBase;
10450
- managed.id = `app-${namePart}`;
10451
- }
11388
+ setSubAgentNameOperation(state, action) {
11389
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot set sub-agent name when Mastra is disabled.");
11390
+ const sub = state.features.mastra.subAgents.find((s) => s.id === action.input.id);
11391
+ if (!sub) throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);
11392
+ const trimmed = action.input.name.trim();
11393
+ if (!trimmed) throw new InvalidAgentNameError("Sub-agent name must not be empty.");
11394
+ sub.name = trimmed;
11395
+ },
11396
+ setSubAgentDescriptionOperation(state, action) {
11397
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot set sub-agent description when Mastra is disabled.");
11398
+ const sub = state.features.mastra.subAgents.find((s) => s.id === action.input.id);
11399
+ if (!sub) throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);
11400
+ sub.description = action.input.description;
10452
11401
  }
10453
11402
  };
10454
11403
  //#endregion
10455
- //#region document-models/ph-clint-project/v1/src/reducers/lifecycle.ts
10456
- const phClintProjectLifecycleOperations = { importSpecOperation(state, action) {
10457
- state.name = action.input.name;
10458
- state.scope = action.input.scope || null;
10459
- state.version = action.input.version;
10460
- state.description = action.input.description;
10461
- state.features.powerhouse = action.input.powerhouse;
10462
- state.features.mastra.enabled = action.input.mastraEnabled;
10463
- state.features.routine.enabled = action.input.routineEnabled;
10464
- const appBase = action.input.name.replace(/-cli$/, "-app");
10465
- const appPkgName = action.input.scope ? `${action.input.scope}/${appBase}` : appBase;
10466
- const phEnabled = action.input.powerhouse !== "Disabled";
10467
- state.packages = action.input.packages.map((p) => ({
10468
- id: p.id,
10469
- packageName: p.packageName,
10470
- documentTypes: [...p.documentTypes],
10471
- version: p.version || null,
10472
- managed: phEnabled && p.packageName === appPkgName
10473
- }));
10474
- state.externalSkills = action.input.externalSkills.map((s) => ({
10475
- id: s.id,
10476
- name: s.name,
10477
- githubUrl: s.githubUrl
10478
- }));
10479
- state.features.mastra.agentId = action.input.agentId || null;
10480
- state.features.mastra.agentName = action.input.agentName || null;
10481
- state.features.mastra.models = (action.input.models || []).map((m) => ({
10482
- id: m.id,
10483
- isDefault: m.isDefault
10484
- }));
10485
- state.features.mastra.profiles = (action.input.profiles || []).map((p) => ({
10486
- id: p.id,
10487
- title: p.title,
10488
- content: p.content
10489
- }));
10490
- if (action.input.agentDescription && state.features.mastra.enabled) state.features.mastra.agentDescription = action.input.agentDescription;
10491
- else state.features.mastra.agentDescription = null;
10492
- if (action.input.agentImage && state.features.mastra.enabled) {
10493
- if (!/^data:[a-z]+\/[a-z0-9.+-]+;base64,/.test(action.input.agentImage)) throw new InvalidAgentImageError("Invalid image: must be a data URL (data:<mime>;base64,...)");
10494
- state.features.mastra.agentImage = action.input.agentImage;
10495
- } else state.features.mastra.agentImage = null;
10496
- if (action.input.enableChat && state.features.mastra.enabled && state.features.powerhouse !== "Disabled") {
10497
- state.features.mastra.common.enableChat = true;
10498
- const CLINT_COMMON_PKG = "@powerhousedao/clint-common";
10499
- const CHAT_DOC_TYPE = "powerhouse/chat-session";
10500
- const existing = state.packages.find((p) => p.packageName === CLINT_COMMON_PKG);
10501
- if (!existing) state.packages.push({
10502
- id: "pkg-clint-common",
10503
- packageName: CLINT_COMMON_PKG,
10504
- documentTypes: [CHAT_DOC_TYPE],
10505
- version: null,
10506
- managed: true
10507
- });
10508
- else if (!existing.documentTypes.includes(CHAT_DOC_TYPE)) existing.documentTypes.push(CHAT_DOC_TYPE);
10509
- } else state.features.mastra.common.enableChat = false;
10510
- state.deployment.proxyEnabled = action.input.proxyEnabled ?? false;
10511
- state.deployment.observabilityEnabled = action.input.observabilityEnabled ?? false;
10512
- state.deployment.supportedResources = action.input.supportedResources ? [...action.input.supportedResources] : [];
10513
- } };
10514
- //#endregion
10515
11404
  //#region document-models/ph-clint-project/v1/gen/powerhouse-packages/error.ts
10516
11405
  var DuplicatePackageError = class extends Error {
10517
11406
  errorCode = "DuplicatePackageError";
@@ -10679,66 +11568,6 @@ const stateReducer = (state, action, dispatch) => {
10679
11568
  SetPowerhouseLevelInputSchema().parse(action.input);
10680
11569
  phClintProjectFeaturesPowerhouseOperations.setPowerhouseLevelOperation(state[action.scope], action, dispatch);
10681
11570
  break;
10682
- case "ENABLE_MASTRA":
10683
- EnableMastraInputSchema().parse(action.input);
10684
- phClintProjectFeaturesMastraOperations.enableMastraOperation(state[action.scope], action, dispatch);
10685
- break;
10686
- case "DISABLE_MASTRA":
10687
- DisableMastraInputSchema().parse(action.input);
10688
- phClintProjectFeaturesMastraOperations.disableMastraOperation(state[action.scope], action, dispatch);
10689
- break;
10690
- case "SET_AGENT_ID":
10691
- SetAgentIdInputSchema().parse(action.input);
10692
- phClintProjectFeaturesMastraOperations.setAgentIdOperation(state[action.scope], action, dispatch);
10693
- break;
10694
- case "SET_AGENT_NAME":
10695
- SetAgentNameInputSchema().parse(action.input);
10696
- phClintProjectFeaturesMastraOperations.setAgentNameOperation(state[action.scope], action, dispatch);
10697
- break;
10698
- case "ADD_MODEL":
10699
- AddModelInputSchema().parse(action.input);
10700
- phClintProjectFeaturesMastraOperations.addModelOperation(state[action.scope], action, dispatch);
10701
- break;
10702
- case "REMOVE_MODEL":
10703
- RemoveModelInputSchema().parse(action.input);
10704
- phClintProjectFeaturesMastraOperations.removeModelOperation(state[action.scope], action, dispatch);
10705
- break;
10706
- case "SET_DEFAULT_MODEL":
10707
- SetDefaultModelInputSchema().parse(action.input);
10708
- phClintProjectFeaturesMastraOperations.setDefaultModelOperation(state[action.scope], action, dispatch);
10709
- break;
10710
- case "ADD_PROFILE":
10711
- AddProfileInputSchema().parse(action.input);
10712
- phClintProjectFeaturesMastraOperations.addProfileOperation(state[action.scope], action, dispatch);
10713
- break;
10714
- case "UPDATE_PROFILE":
10715
- UpdateProfileInputSchema().parse(action.input);
10716
- phClintProjectFeaturesMastraOperations.updateProfileOperation(state[action.scope], action, dispatch);
10717
- break;
10718
- case "REMOVE_PROFILE":
10719
- RemoveProfileInputSchema().parse(action.input);
10720
- phClintProjectFeaturesMastraOperations.removeProfileOperation(state[action.scope], action, dispatch);
10721
- break;
10722
- case "REORDER_PROFILES":
10723
- ReorderProfilesInputSchema().parse(action.input);
10724
- phClintProjectFeaturesMastraOperations.reorderProfilesOperation(state[action.scope], action, dispatch);
10725
- break;
10726
- case "SET_AGENT_DESCRIPTION":
10727
- SetAgentDescriptionInputSchema().parse(action.input);
10728
- phClintProjectFeaturesMastraOperations.setAgentDescriptionOperation(state[action.scope], action, dispatch);
10729
- break;
10730
- case "SET_AGENT_IMAGE":
10731
- SetAgentImageInputSchema().parse(action.input);
10732
- phClintProjectFeaturesMastraOperations.setAgentImageOperation(state[action.scope], action, dispatch);
10733
- break;
10734
- case "CLEAR_AGENT_IMAGE":
10735
- ClearAgentImageInputSchema().parse(action.input);
10736
- phClintProjectFeaturesMastraOperations.clearAgentImageOperation(state[action.scope], action, dispatch);
10737
- break;
10738
- case "SET_ENABLE_CHAT":
10739
- SetEnableChatInputSchema().parse(action.input);
10740
- phClintProjectFeaturesMastraOperations.setEnableChatOperation(state[action.scope], action, dispatch);
10741
- break;
10742
11571
  case "ENABLE_ROUTINE":
10743
11572
  EnableRoutineInputSchema().parse(action.input);
10744
11573
  phClintProjectFeaturesRoutineOperations.enableRoutineOperation(state[action.scope], action, dispatch);
@@ -10823,6 +11652,110 @@ const stateReducer = (state, action, dispatch) => {
10823
11652
  SetObservabilityEnabledInputSchema().parse(action.input);
10824
11653
  phClintProjectDeploymentOperations.setObservabilityEnabledOperation(state[action.scope], action, dispatch);
10825
11654
  break;
11655
+ case "ENABLE_MASTRA":
11656
+ EnableMastraInputSchema().parse(action.input);
11657
+ phClintProjectFeaturesMastraOperations.enableMastraOperation(state[action.scope], action, dispatch);
11658
+ break;
11659
+ case "DISABLE_MASTRA":
11660
+ DisableMastraInputSchema().parse(action.input);
11661
+ phClintProjectFeaturesMastraOperations.disableMastraOperation(state[action.scope], action, dispatch);
11662
+ break;
11663
+ case "SET_ENABLE_CHAT":
11664
+ SetEnableChatInputSchema().parse(action.input);
11665
+ phClintProjectFeaturesMastraOperations.setEnableChatOperation(state[action.scope], action, dispatch);
11666
+ break;
11667
+ case "ADD_MODEL":
11668
+ AddModelInputSchema().parse(action.input);
11669
+ phClintProjectMastraModelsOperations.addModelOperation(state[action.scope], action, dispatch);
11670
+ break;
11671
+ case "REMOVE_MODEL":
11672
+ RemoveModelInputSchema().parse(action.input);
11673
+ phClintProjectMastraModelsOperations.removeModelOperation(state[action.scope], action, dispatch);
11674
+ break;
11675
+ case "ADD_PROFILE":
11676
+ AddProfileInputSchema().parse(action.input);
11677
+ phClintProjectMastraProfilesOperations.addProfileOperation(state[action.scope], action, dispatch);
11678
+ break;
11679
+ case "UPDATE_PROFILE":
11680
+ UpdateProfileInputSchema().parse(action.input);
11681
+ phClintProjectMastraProfilesOperations.updateProfileOperation(state[action.scope], action, dispatch);
11682
+ break;
11683
+ case "REMOVE_PROFILE":
11684
+ RemoveProfileInputSchema().parse(action.input);
11685
+ phClintProjectMastraProfilesOperations.removeProfileOperation(state[action.scope], action, dispatch);
11686
+ break;
11687
+ case "REORDER_PROFILES":
11688
+ ReorderProfilesInputSchema().parse(action.input);
11689
+ phClintProjectMastraProfilesOperations.reorderProfilesOperation(state[action.scope], action, dispatch);
11690
+ break;
11691
+ case "SET_MAIN_AGENT_NAME":
11692
+ SetMainAgentNameInputSchema().parse(action.input);
11693
+ phClintProjectMastraMainAgentOperations.setMainAgentNameOperation(state[action.scope], action, dispatch);
11694
+ break;
11695
+ case "SET_MAIN_AGENT_DESCRIPTION":
11696
+ SetMainAgentDescriptionInputSchema().parse(action.input);
11697
+ phClintProjectMastraMainAgentOperations.setMainAgentDescriptionOperation(state[action.scope], action, dispatch);
11698
+ break;
11699
+ case "CLEAR_MAIN_AGENT_DESCRIPTION":
11700
+ ClearMainAgentDescriptionInputSchema().parse(action.input);
11701
+ phClintProjectMastraMainAgentOperations.clearMainAgentDescriptionOperation(state[action.scope], action, dispatch);
11702
+ break;
11703
+ case "SET_MAIN_AGENT_IMAGE":
11704
+ SetMainAgentImageInputSchema().parse(action.input);
11705
+ phClintProjectMastraMainAgentOperations.setMainAgentImageOperation(state[action.scope], action, dispatch);
11706
+ break;
11707
+ case "CLEAR_MAIN_AGENT_IMAGE":
11708
+ ClearMainAgentImageInputSchema().parse(action.input);
11709
+ phClintProjectMastraMainAgentOperations.clearMainAgentImageOperation(state[action.scope], action, dispatch);
11710
+ break;
11711
+ case "ADD_SUB_AGENT":
11712
+ AddSubAgentInputSchema().parse(action.input);
11713
+ phClintProjectMastraSubAgentsOperations.addSubAgentOperation(state[action.scope], action, dispatch);
11714
+ break;
11715
+ case "REMOVE_SUB_AGENT":
11716
+ RemoveSubAgentInputSchema().parse(action.input);
11717
+ phClintProjectMastraSubAgentsOperations.removeSubAgentOperation(state[action.scope], action, dispatch);
11718
+ break;
11719
+ case "SET_SUB_AGENT_NAME":
11720
+ SetSubAgentNameInputSchema().parse(action.input);
11721
+ phClintProjectMastraSubAgentsOperations.setSubAgentNameOperation(state[action.scope], action, dispatch);
11722
+ break;
11723
+ case "SET_SUB_AGENT_DESCRIPTION":
11724
+ SetSubAgentDescriptionInputSchema().parse(action.input);
11725
+ phClintProjectMastraSubAgentsOperations.setSubAgentDescriptionOperation(state[action.scope], action, dispatch);
11726
+ break;
11727
+ case "SET_AGENT_MODEL":
11728
+ SetAgentModelInputSchema().parse(action.input);
11729
+ phClintProjectMastraAgentBindingsOperations.setAgentModelOperation(state[action.scope], action, dispatch);
11730
+ break;
11731
+ case "ADD_AGENT_PROFILE_REF":
11732
+ AddAgentProfileRefInputSchema().parse(action.input);
11733
+ phClintProjectMastraAgentBindingsOperations.addAgentProfileRefOperation(state[action.scope], action, dispatch);
11734
+ break;
11735
+ case "REMOVE_AGENT_PROFILE_REF":
11736
+ RemoveAgentProfileRefInputSchema().parse(action.input);
11737
+ phClintProjectMastraAgentBindingsOperations.removeAgentProfileRefOperation(state[action.scope], action, dispatch);
11738
+ break;
11739
+ case "REORDER_AGENT_PROFILE_REFS":
11740
+ ReorderAgentProfileRefsInputSchema().parse(action.input);
11741
+ phClintProjectMastraAgentBindingsOperations.reorderAgentProfileRefsOperation(state[action.scope], action, dispatch);
11742
+ break;
11743
+ case "ADD_AGENT_SKILL":
11744
+ AddAgentSkillInputSchema().parse(action.input);
11745
+ phClintProjectMastraAgentBindingsOperations.addAgentSkillOperation(state[action.scope], action, dispatch);
11746
+ break;
11747
+ case "REMOVE_AGENT_SKILL":
11748
+ RemoveAgentSkillInputSchema().parse(action.input);
11749
+ phClintProjectMastraAgentBindingsOperations.removeAgentSkillOperation(state[action.scope], action, dispatch);
11750
+ break;
11751
+ case "ADD_AGENT_TOOL_PATTERN":
11752
+ AddAgentToolPatternInputSchema().parse(action.input);
11753
+ phClintProjectMastraAgentBindingsOperations.addAgentToolPatternOperation(state[action.scope], action, dispatch);
11754
+ break;
11755
+ case "REMOVE_AGENT_TOOL_PATTERN":
11756
+ RemoveAgentToolPatternInputSchema().parse(action.input);
11757
+ phClintProjectMastraAgentBindingsOperations.removeAgentToolPatternOperation(state[action.scope], action, dispatch);
11758
+ break;
10826
11759
  default: return state;
10827
11760
  }
10828
11761
  };
@@ -10876,10 +11809,8 @@ const initialGlobalState = {
10876
11809
  powerhouse: "Disabled",
10877
11810
  mastra: {
10878
11811
  enabled: false,
10879
- agentId: null,
10880
- agentName: null,
10881
- agentDescription: null,
10882
- agentImage: null,
11812
+ mainAgent: null,
11813
+ subAgents: [],
10883
11814
  models: [],
10884
11815
  profiles: [],
10885
11816
  common: { enableChat: false }
@@ -10963,6 +11894,6 @@ const PhClintProject = {
10963
11894
  documentModel: createState(defaultBaseState(), documentModel)
10964
11895
  };
10965
11896
  //#endregion
10966
- export { setDefaultModel as $, SetAgentDescriptionInputSchema as $t, importSpec as A, createReducer as An, PhClintAgentModelSchema as At, addModel as B, validateInitialState as Bn, PublishDevInputSchema as Bt, addPackageDocumentType as C, baseCreateDocument as Cn, EnableRoutineInputSchema as Ct, removePowerhousePackage as D, createAction as Dn, ImportProfileInputSchema as Dt, removePackageDocumentType as E, buildSignedAction as En, ImportPackageInputSchema as Et, creators_exports$4 as F, isDocumentAction as Fn, PhClintMastraFeatureSchema as Ft, enableMastra as G, any as Gn, PublishTagSchema as Gt, clearAgentImage as H, validateStateSchemaName as Hn, PublishRecordSchema as Ht, disableRoutine as I, redo as In, PhClintProjectStateSchema as It, reorderProfiles as J, literal as Jn, RemovePackageDocumentTypeInputSchema as Jt, removeModel as K, array as Kn, RemoveExternalSkillInputSchema as Kt, enableRoutine as L, replayDocument as Ln, PhClintRoutineFeatureSchema as Lt, setDescription as M, createZip as Mn, PhClintDeploymentSchema as Mt, setPackageIdentifier as N, defaultBaseState as Nn, PhClintFeaturesSchema as Nt, setPackageVersion as O, createBaseState as On, ImportSkillInputSchema as Ot, setVersion as P, documentModelDocumentType as Pn, PhClintMastraCommonSchema as Pt, setAgentName as Q, generateId as Qn, ReorderProfilesInputSchema as Qt, creators_exports$5 as R, setName as Rn, PowerhouseLevelSchema as Rt, setPublishStatus as S, BaseDocumentStateSchema as Sn, EnableMastraInputSchema as St, creators_exports$1 as T, baseSaveToFileHandle as Tn, ImportModelInputSchema as Tt, creators_exports$6 as U, capitalCase as Un, PublishStagingInputSchema as Ut, addProfile as V, validateModules as Vn, PublishProductionInputSchema as Vt, disableMastra as W, _enum as Wn, PublishStatusSchema as Wt, setAgentId as X, string as Xn, RemoveProfileInputSchema as Xt, setAgentDescription as Y, object as Yn, RemovePowerhousePackageInputSchema as Yt, setAgentImage as Z, union as Zn, RemoveSupportedResourceInputSchema as Zt, bumpVersion as _, isDefinedNonNullAny as _n, AddSupportedResourceInputSchema as _t, utils$1 as a, SetEnableChatInputSchema as an, setExternalSkillGithubUrl as at, publishProduction as b, logger as bn, DisableMastraInputSchema as bt, PhClintProjectPHStateSchema as c, SetObservabilityEnabledInputSchema as cn, creators_exports$8 as ct, isPhClintProjectDocument as d, SetPowerhouseLevelInputSchema as dn, setProxyEnabled as dt, SetAgentIdInputSchema as en, setEnableChat as et, isPhClintProjectState as f, SetProxyEnabledInputSchema as fn, AddExternalSkillInputSchema as ft, actions as g, definedNonNullAnySchema as gn, AddProfileInputSchema as gt, documentModel as h, UpdateProfileInputSchema as hn, AddPowerhousePackageInputSchema as ht, initialLocalState as i, SetDescriptionInputSchema as in, removeExternalSkill as it, creators_exports$3 as j, createState as jn, PhClintAgentProfileSchema as jt, creators_exports$2 as k, createPresignedHeader as kn, ImportSpecInputSchema as kt, assertIsPhClintProjectDocument as l, SetPackageIdentifierInputSchema as ln, removeSupportedResource as lt, reducer as m, SetVersionInputSchema as mn, AddPackageDocumentTypeInputSchema as mt, utils as n, SetAgentNameInputSchema as nn, addExternalSkill as nt, PhClintProjectDocumentHeaderSchema as o, SetExternalSkillGithubUrlInputSchema as on, setExternalSkillName as ot, phClintProjectDocumentType as p, SetPublishStatusInputSchema as pn, AddModelInputSchema as pt, removeProfile as q, boolean as qn, RemoveModelInputSchema as qt, initialGlobalState as r, SetDefaultModelInputSchema as rn, creators_exports$7 as rt, PhClintProjectDocumentSchema as s, SetExternalSkillNameInputSchema as sn, addSupportedResource as st, PhClintProject as t, SetAgentImageInputSchema as tn, updateProfile as tt, assertIsPhClintProjectState as u, SetPackageVersionInputSchema as un, setObservabilityEnabled as ut, creators_exports as v, PHDocumentController as vn, BumpVersionInputSchema as vt, addPowerhousePackage as w, baseLoadFromInput as wn, ExternalSkillSchema as wt, publishStaging as x, BaseDocumentHeaderSchema as xn, DisableRoutineInputSchema as xt, publishDev as y, documentModelDocumentModelModule as yn, ClearAgentImageInputSchema as yt, setPowerhouseLevel as z, undo as zn, PowerhousePackageSchema as zt };
11897
+ export { removeAgentSkill as $, BaseDocumentStateSchema as $n, PhClintAgentModelSchema as $t, creators_exports$2 as A, SetDescriptionInputSchema as An, AddAgentToolPatternInputSchema as At, creators_exports$4 as B, SetPowerhouseLevelInputSchema as Bn, ClearMainAgentImageInputSchema as Bt, addPackageDocumentType as C, RemovePowerhousePackageInputSchema as Cn, array as Cr, addSupportedResource as Ct, removePowerhousePackage as D, ReorderAgentProfileRefsInputSchema as Dn, string as Dr, setProxyEnabled as Dt, removePackageDocumentType as E, RemoveSupportedResourceInputSchema as En, object as Er, setObservabilityEnabled as Et, creators_exports$3 as F, SetMainAgentImageInputSchema as Fn, AddProfileInputSchema as Ft, setMainAgentDescription as G, SetVersionInputSchema as Gn, ExternalSkillSchema as Gt, clearMainAgentDescription as H, SetPublishStatusInputSchema as Hn, DisableRoutineInputSchema as Ht, removeProfile as I, SetMainAgentNameInputSchema as In, AddSubAgentInputSchema as It, addAgentProfileRef as J, isDefinedNonNullAny as Jn, ImportPackageInputSchema as Jt, setMainAgentImage as K, UpdateProfileInputSchema as Kn, ImportMainAgentInputSchema as Kt, reorderProfiles as L, SetObservabilityEnabledInputSchema as Ln, AddSupportedResourceInputSchema as Lt, setSubAgentDescription as M, SetExternalSkillGithubUrlInputSchema as Mn, AddModelInputSchema as Mt, setSubAgentName as N, SetExternalSkillNameInputSchema as Nn, AddPackageDocumentTypeInputSchema as Nt, setPackageVersion as O, ReorderProfilesInputSchema as On, union as Or, AddAgentProfileRefInputSchema as Ot, addProfile as P, SetMainAgentDescriptionInputSchema as Pn, AddPowerhousePackageInputSchema as Pt, removeAgentProfileRef as Q, BaseDocumentHeaderSchema as Qn, ImportSubAgentInputSchema as Qt, updateProfile as R, SetPackageIdentifierInputSchema as Rn, BumpVersionInputSchema as Rt, setPublishStatus as S, RemovePackageDocumentTypeInputSchema as Sn, any as Sr, setExternalSkillName as St, creators_exports$1 as T, RemoveSubAgentInputSchema as Tn, literal as Tr, removeSupportedResource as Tt, clearMainAgentImage as U, SetSubAgentDescriptionInputSchema as Un, EnableMastraInputSchema as Ut, removeModel as V, SetProxyEnabledInputSchema as Vn, DisableMastraInputSchema as Vt, creators_exports$5 as W, SetSubAgentNameInputSchema as Wn, EnableRoutineInputSchema as Wt, addAgentToolPattern as X, documentModelDocumentModelModule as Xn, ImportSkillInputSchema as Xt, addAgentSkill as Y, PHDocumentController as Yn, ImportProfileInputSchema as Yt, creators_exports$6 as Z, logger as Zn, ImportSpecInputSchema as Zt, bumpVersion as _, RemoveAgentProfileRefInputSchema as _n, validateInitialState as _r, setEnableChat as _t, utils$1 as a, PhClintMastraFeatureSchema as an, createBaseState as ar, creators_exports$8 as at, publishProduction as b, RemoveExternalSkillInputSchema as bn, capitalCase as br, removeExternalSkill as bt, PhClintProjectPHStateSchema as c, PhClintSubAgentSchema as cn, createState as cr, setVersion as ct, isPhClintProjectDocument as d, PublishDevInputSchema as dn, documentModelDocumentType as dr, enableRoutine as dt, PhClintAgentProfileSchema as en, baseCreateDocument as er, removeAgentToolPattern as et, isPhClintProjectState as f, PublishProductionInputSchema as fn, isDocumentAction as fr, creators_exports$10 as ft, actions as g, PublishTagSchema as gn, undo as gr, enableMastra as gt, documentModel as h, PublishStatusSchema as hn, setName as hr, disableMastra as ht, initialLocalState as i, PhClintMastraCommonSchema as in, createAction as ir, importSpec as it, removeSubAgent as j, SetEnableChatInputSchema as jn, AddExternalSkillInputSchema as jt, addSubAgent as k, SetAgentModelInputSchema as kn, generateId as kr, AddAgentSkillInputSchema as kt, assertIsPhClintProjectDocument as l, PowerhouseLevelSchema as ln, createZip as lr, creators_exports$9 as lt, reducer as m, PublishStagingInputSchema as mn, replayDocument as mr, creators_exports$11 as mt, utils as n, PhClintFeaturesSchema as nn, baseSaveToFileHandle as nr, setAgentModel as nt, PhClintProjectDocumentHeaderSchema as o, PhClintProjectStateSchema as on, createPresignedHeader as or, setDescription as ot, phClintProjectDocumentType as p, PublishRecordSchema as pn, redo as pr, setPowerhouseLevel as pt, setMainAgentName as q, definedNonNullAnySchema as qn, ImportModelInputSchema as qt, initialGlobalState as r, PhClintMainAgentSchema as rn, buildSignedAction as rr, creators_exports$7 as rt, PhClintProjectDocumentSchema as s, PhClintRoutineFeatureSchema as sn, createReducer as sr, setPackageIdentifier as st, PhClintProject as t, PhClintDeploymentSchema as tn, baseLoadFromInput as tr, reorderAgentProfileRefs as tt, assertIsPhClintProjectState as u, PowerhousePackageSchema as un, defaultBaseState as ur, disableRoutine as ut, creators_exports as v, RemoveAgentSkillInputSchema as vn, validateModules as vr, addExternalSkill as vt, addPowerhousePackage as w, RemoveProfileInputSchema as wn, boolean as wr, creators_exports$13 as wt, publishStaging as x, RemoveModelInputSchema as xn, _enum as xr, setExternalSkillGithubUrl as xt, publishDev as y, RemoveAgentToolPatternInputSchema as yn, validateStateSchemaName as yr, creators_exports$12 as yt, addModel as z, SetPackageVersionInputSchema as zn, ClearMainAgentDescriptionInputSchema as zt };
10967
11898
 
10968
- //# sourceMappingURL=module-DayL4J7r.mjs.map
11899
+ //# sourceMappingURL=module-ZwrJ5kaI.mjs.map