@powerhousedao/ph-clint-app 0.1.0-dev.70 → 0.1.0-dev.72

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 (182) hide show
  1. package/dist/browser/connect-DWTABaUr.js.map +1 -1
  2. package/dist/browser/document-models/index.js +1 -1
  3. package/dist/browser/document-models/ph-clint-project/index.js +3 -3
  4. package/dist/browser/{editor-DXdZh-Jg.js → editor-DL0W2XOS.js} +15 -7
  5. package/dist/browser/{editor-DXdZh-Jg.js.map → editor-DL0W2XOS.js.map} +1 -1
  6. package/dist/browser/editors/ph-clint-project-editor/module.js +1 -1
  7. package/dist/browser/factory-BorJujF7.js.map +1 -1
  8. package/dist/browser/index.js +6 -5
  9. package/dist/browser/index.js.map +1 -1
  10. package/dist/browser/{module-Os61MtkV.js → module-DoAlHsjp.js} +1668 -1593
  11. package/dist/browser/{module-Os61MtkV.js.map → module-DoAlHsjp.js.map} +1 -1
  12. package/dist/browser/{ph-clint-project-ii15OQEN.js → ph-clint-project-D634z5c5.js} +22 -17
  13. package/dist/browser/ph-clint-project-D634z5c5.js.map +1 -0
  14. package/dist/browser/switchboard-vSM1SpS5.js.map +1 -1
  15. package/dist/connect/assets/connect-q2RMY-je.js.map +1 -1
  16. package/dist/connect/assets/editor-DgkuaKuV.js +2 -0
  17. package/dist/connect/assets/editor-DgkuaKuV.js.map +1 -0
  18. package/dist/connect/assets/index-BSq-9kCR.css +2 -0
  19. package/dist/connect/assets/{index-CLaxnBSy.js → index-BXAErAWR.js} +20 -20
  20. package/dist/connect/assets/index-BXAErAWR.js.map +1 -0
  21. package/dist/connect/assets/{ph-clint-project-YyH0u8I2.js → ph-clint-project-BRYYVNTj.js} +9 -3
  22. package/dist/connect/assets/ph-clint-project-BRYYVNTj.js.map +1 -0
  23. package/dist/connect/assets/switchboard-BCPp_tNt.js.map +1 -1
  24. package/dist/connect/index.html +3 -3
  25. package/dist/connect/ph-packages.json +1 -1
  26. package/dist/document-models/document-models.d.ts +5 -1
  27. package/dist/document-models/document-models.d.ts.map +1 -1
  28. package/dist/document-models/index.d.ts +1 -1
  29. package/dist/document-models/ph-clint-project/index.d.ts +2 -2
  30. package/dist/document-models/ph-clint-project/index.d.ts.map +1 -1
  31. package/dist/document-models/ph-clint-project/upgrades/index.d.ts +2 -2
  32. package/dist/document-models/ph-clint-project/upgrades/index.d.ts.map +1 -1
  33. package/dist/document-models/ph-clint-project/upgrades/upgrade-manifest.d.ts +6 -2
  34. package/dist/document-models/ph-clint-project/upgrades/upgrade-manifest.d.ts.map +1 -1
  35. package/dist/document-models/ph-clint-project/v1/actions.d.ts +1 -0
  36. package/dist/document-models/ph-clint-project/v1/actions.d.ts.map +1 -1
  37. package/dist/document-models/ph-clint-project/v1/gen/actions.d.ts +22 -18
  38. package/dist/document-models/ph-clint-project/v1/gen/actions.d.ts.map +1 -1
  39. package/dist/document-models/ph-clint-project/v1/gen/controller.d.ts +6 -2
  40. package/dist/document-models/ph-clint-project/v1/gen/controller.d.ts.map +1 -1
  41. package/dist/document-models/ph-clint-project/v1/gen/creators.d.ts +22 -18
  42. package/dist/document-models/ph-clint-project/v1/gen/creators.d.ts.map +1 -1
  43. package/dist/document-models/ph-clint-project/v1/gen/deployment/actions.d.ts +10 -2
  44. package/dist/document-models/ph-clint-project/v1/gen/deployment/actions.d.ts.map +1 -1
  45. package/dist/document-models/ph-clint-project/v1/gen/deployment/creators.d.ts +3 -2
  46. package/dist/document-models/ph-clint-project/v1/gen/deployment/creators.d.ts.map +1 -1
  47. package/dist/document-models/ph-clint-project/v1/gen/deployment/operations.d.ts +10 -5
  48. package/dist/document-models/ph-clint-project/v1/gen/deployment/operations.d.ts.map +1 -1
  49. package/dist/document-models/ph-clint-project/v1/gen/document-model.d.ts.map +1 -1
  50. package/dist/document-models/ph-clint-project/v1/gen/document-schema.d.ts +2 -2
  51. package/dist/document-models/ph-clint-project/v1/gen/document-schema.d.ts.map +1 -1
  52. package/dist/document-models/ph-clint-project/v1/gen/document-type.d.ts +4 -0
  53. package/dist/document-models/ph-clint-project/v1/gen/document-type.d.ts.map +1 -1
  54. package/dist/document-models/ph-clint-project/v1/gen/external-skills/actions.d.ts +10 -6
  55. package/dist/document-models/ph-clint-project/v1/gen/external-skills/actions.d.ts.map +1 -1
  56. package/dist/document-models/ph-clint-project/v1/gen/external-skills/creators.d.ts +2 -2
  57. package/dist/document-models/ph-clint-project/v1/gen/external-skills/creators.d.ts.map +1 -1
  58. package/dist/document-models/ph-clint-project/v1/gen/external-skills/error.d.ts +1 -1
  59. package/dist/document-models/ph-clint-project/v1/gen/external-skills/error.d.ts.map +1 -1
  60. package/dist/document-models/ph-clint-project/v1/gen/external-skills/operations.d.ts +11 -7
  61. package/dist/document-models/ph-clint-project/v1/gen/external-skills/operations.d.ts.map +1 -1
  62. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/actions.d.ts +5 -1
  63. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/actions.d.ts.map +1 -1
  64. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/creators.d.ts +2 -2
  65. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/creators.d.ts.map +1 -1
  66. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/operations.d.ts +21 -17
  67. package/dist/document-models/ph-clint-project/v1/gen/features-mastra/operations.d.ts.map +1 -1
  68. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/actions.d.ts +7 -3
  69. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/actions.d.ts.map +1 -1
  70. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/creators.d.ts +2 -2
  71. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/creators.d.ts.map +1 -1
  72. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/error.d.ts +1 -1
  73. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/operations.d.ts +8 -4
  74. package/dist/document-models/ph-clint-project/v1/gen/features-powerhouse/operations.d.ts.map +1 -1
  75. package/dist/document-models/ph-clint-project/v1/gen/features-routine/actions.d.ts +8 -4
  76. package/dist/document-models/ph-clint-project/v1/gen/features-routine/actions.d.ts.map +1 -1
  77. package/dist/document-models/ph-clint-project/v1/gen/features-routine/creators.d.ts +2 -2
  78. package/dist/document-models/ph-clint-project/v1/gen/features-routine/creators.d.ts.map +1 -1
  79. package/dist/document-models/ph-clint-project/v1/gen/features-routine/operations.d.ts +9 -5
  80. package/dist/document-models/ph-clint-project/v1/gen/features-routine/operations.d.ts.map +1 -1
  81. package/dist/document-models/ph-clint-project/v1/gen/identity/actions.d.ts +9 -5
  82. package/dist/document-models/ph-clint-project/v1/gen/identity/actions.d.ts.map +1 -1
  83. package/dist/document-models/ph-clint-project/v1/gen/identity/creators.d.ts +2 -2
  84. package/dist/document-models/ph-clint-project/v1/gen/identity/creators.d.ts.map +1 -1
  85. package/dist/document-models/ph-clint-project/v1/gen/identity/error.d.ts +1 -1
  86. package/dist/document-models/ph-clint-project/v1/gen/identity/error.d.ts.map +1 -1
  87. package/dist/document-models/ph-clint-project/v1/gen/identity/operations.d.ts +10 -6
  88. package/dist/document-models/ph-clint-project/v1/gen/identity/operations.d.ts.map +1 -1
  89. package/dist/document-models/ph-clint-project/v1/gen/index.d.ts +24 -20
  90. package/dist/document-models/ph-clint-project/v1/gen/index.d.ts.map +1 -1
  91. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/actions.d.ts +7 -3
  92. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/actions.d.ts.map +1 -1
  93. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/creators.d.ts +2 -2
  94. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/creators.d.ts.map +1 -1
  95. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/operations.d.ts +8 -4
  96. package/dist/document-models/ph-clint-project/v1/gen/lifecycle/operations.d.ts.map +1 -1
  97. package/dist/document-models/ph-clint-project/v1/gen/ph-factories.d.ts +3 -1
  98. package/dist/document-models/ph-clint-project/v1/gen/ph-factories.d.ts.map +1 -1
  99. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/actions.d.ts +11 -7
  100. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/actions.d.ts.map +1 -1
  101. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/creators.d.ts +2 -2
  102. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/creators.d.ts.map +1 -1
  103. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/error.d.ts +1 -1
  104. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/error.d.ts.map +1 -1
  105. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/operations.d.ts +12 -8
  106. package/dist/document-models/ph-clint-project/v1/gen/powerhouse-packages/operations.d.ts.map +1 -1
  107. package/dist/document-models/ph-clint-project/v1/gen/publishing/actions.d.ts +11 -7
  108. package/dist/document-models/ph-clint-project/v1/gen/publishing/actions.d.ts.map +1 -1
  109. package/dist/document-models/ph-clint-project/v1/gen/publishing/creators.d.ts +2 -2
  110. package/dist/document-models/ph-clint-project/v1/gen/publishing/creators.d.ts.map +1 -1
  111. package/dist/document-models/ph-clint-project/v1/gen/publishing/error.d.ts +1 -1
  112. package/dist/document-models/ph-clint-project/v1/gen/publishing/operations.d.ts +12 -8
  113. package/dist/document-models/ph-clint-project/v1/gen/publishing/operations.d.ts.map +1 -1
  114. package/dist/document-models/ph-clint-project/v1/gen/reducer.d.ts.map +1 -1
  115. package/dist/document-models/ph-clint-project/v1/gen/schema/index.d.ts +6 -2
  116. package/dist/document-models/ph-clint-project/v1/gen/schema/index.d.ts.map +1 -1
  117. package/dist/document-models/ph-clint-project/v1/gen/schema/types.d.ts +5 -0
  118. package/dist/document-models/ph-clint-project/v1/gen/schema/types.d.ts.map +1 -1
  119. package/dist/document-models/ph-clint-project/v1/gen/schema/zod.d.ts +2 -1
  120. package/dist/document-models/ph-clint-project/v1/gen/schema/zod.d.ts.map +1 -1
  121. package/dist/document-models/ph-clint-project/v1/gen/types.d.ts +9 -5
  122. package/dist/document-models/ph-clint-project/v1/gen/types.d.ts.map +1 -1
  123. package/dist/document-models/ph-clint-project/v1/gen/utils.d.ts +4 -0
  124. package/dist/document-models/ph-clint-project/v1/gen/utils.d.ts.map +1 -1
  125. package/dist/document-models/ph-clint-project/v1/hooks.d.ts +7 -6
  126. package/dist/document-models/ph-clint-project/v1/hooks.d.ts.map +1 -1
  127. package/dist/document-models/ph-clint-project/v1/index.d.ts +10 -5
  128. package/dist/document-models/ph-clint-project/v1/index.d.ts.map +1 -1
  129. package/dist/document-models/ph-clint-project/v1/module.d.ts +59 -3
  130. package/dist/document-models/ph-clint-project/v1/module.d.ts.map +1 -1
  131. package/dist/document-models/ph-clint-project/v1/src/index.d.ts +5 -1
  132. package/dist/document-models/ph-clint-project/v1/src/index.d.ts.map +1 -1
  133. package/dist/document-models/ph-clint-project/v1/src/reducers/deployment.d.ts.map +1 -1
  134. package/dist/document-models/ph-clint-project/v1/src/reducers/external-skills.d.ts +1 -1
  135. package/dist/document-models/ph-clint-project/v1/src/reducers/external-skills.d.ts.map +1 -1
  136. package/dist/document-models/ph-clint-project/v1/src/reducers/features-mastra.d.ts.map +1 -1
  137. package/dist/document-models/ph-clint-project/v1/src/reducers/features-powerhouse.d.ts +1 -1
  138. package/dist/document-models/ph-clint-project/v1/src/reducers/features-powerhouse.d.ts.map +1 -1
  139. package/dist/document-models/ph-clint-project/v1/src/reducers/features-routine.d.ts +1 -1
  140. package/dist/document-models/ph-clint-project/v1/src/reducers/features-routine.d.ts.map +1 -1
  141. package/dist/document-models/ph-clint-project/v1/src/reducers/identity.d.ts +1 -1
  142. package/dist/document-models/ph-clint-project/v1/src/reducers/identity.d.ts.map +1 -1
  143. package/dist/document-models/ph-clint-project/v1/src/reducers/lifecycle.d.ts.map +1 -1
  144. package/dist/document-models/ph-clint-project/v1/src/reducers/powerhouse-packages.d.ts +1 -1
  145. package/dist/document-models/ph-clint-project/v1/src/reducers/powerhouse-packages.d.ts.map +1 -1
  146. package/dist/document-models/ph-clint-project/v1/src/reducers/publishing.d.ts +1 -1
  147. package/dist/document-models/ph-clint-project/v1/src/reducers/publishing.d.ts.map +1 -1
  148. package/dist/document-models/ph-clint-project/v1/utils.d.ts +6 -2
  149. package/dist/document-models/ph-clint-project/v1/utils.d.ts.map +1 -1
  150. package/dist/document-models/upgrade-manifests.d.ts +5 -1
  151. package/dist/document-models/upgrade-manifests.d.ts.map +1 -1
  152. package/dist/editors/index.d.ts +1 -1
  153. package/dist/editors/ph-clint-project-editor/editor.d.ts.map +1 -1
  154. package/dist/node/connect-D6zH68QP.mjs.map +1 -1
  155. package/dist/node/document-models/index.mjs +1 -1
  156. package/dist/node/document-models/ph-clint-project/index.mjs +3 -3
  157. package/dist/node/{editor-DBx3eRfn.mjs → editor-mM5FSNXc.mjs} +15 -7
  158. package/dist/node/{editor-DBx3eRfn.mjs.map → editor-mM5FSNXc.mjs.map} +1 -1
  159. package/dist/node/editors/ph-clint-project-editor/module.mjs +1 -1
  160. package/dist/node/factory-Dp2uZuax.mjs.map +1 -1
  161. package/dist/node/index.mjs +6 -5
  162. package/dist/node/index.mjs.map +1 -1
  163. package/dist/node/{module-B8cTCphJ.mjs → module-DayL4J7r.mjs} +1668 -1593
  164. package/dist/node/{module-B8cTCphJ.mjs.map → module-DayL4J7r.mjs.map} +1 -1
  165. package/dist/node/{ph-clint-project-B70Z4AOx.mjs → ph-clint-project-Btx_kiiQ.mjs} +22 -17
  166. package/dist/node/ph-clint-project-Btx_kiiQ.mjs.map +1 -0
  167. package/dist/node/switchboard-DwDjMPBV.mjs.map +1 -1
  168. package/dist/powerhouse.manifest.json +26 -25
  169. package/dist/processors/connect.d.ts +1 -1
  170. package/dist/processors/factory.d.ts +2 -2
  171. package/dist/processors/factory.d.ts.map +1 -1
  172. package/dist/processors/index.d.ts +1 -1
  173. package/dist/processors/switchboard.d.ts +1 -1
  174. package/dist/style.css +7 -0
  175. package/package.json +1 -1
  176. package/dist/browser/ph-clint-project-ii15OQEN.js.map +0 -1
  177. package/dist/connect/assets/editor-Cmx2y5dq.js +0 -2
  178. package/dist/connect/assets/editor-Cmx2y5dq.js.map +0 -1
  179. package/dist/connect/assets/index-C7FM_INJ.css +0 -2
  180. package/dist/connect/assets/index-CLaxnBSy.js.map +0 -1
  181. package/dist/connect/assets/ph-clint-project-YyH0u8I2.js.map +0 -1
  182. package/dist/node/ph-clint-project-B70Z4AOx.mjs.map +0 -1
@@ -8669,1472 +8669,6 @@ const logger = new class ConsoleLogger {
8669
8669
  }
8670
8670
  }();
8671
8671
  //#endregion
8672
- //#region document-models/ph-clint-project/v1/gen/document-model.ts
8673
- const documentModel = {
8674
- id: "powerhouse/ph-clint-project",
8675
- name: "PhClintProject",
8676
- author: {
8677
- name: "Powerhouse Inc.",
8678
- website: "https://powerhouse.inc"
8679
- },
8680
- extension: "pcp",
8681
- description: "A ph-clint implementation project specification. Drives code generation of a ph-clint CLI project: identity fields (name, scope, version, description, bin) plus three feature toggles (Powerhouse, Mastra, Routine). Enabling Powerhouse is irreversible; enabling Mastra auto-enables Routine; disabling Routine is blocked while Mastra is on.",
8682
- specifications: [{
8683
- state: {
8684
- local: {
8685
- schema: "",
8686
- examples: [],
8687
- initialValue: ""
8688
- },
8689
- global: {
8690
- 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 supportedResources: [String!]!\n}",
8691
- examples: [],
8692
- 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 \"supportedResources\": [\n \"vetra-agent-s\",\n \"vetra-agent-m\",\n \"vetra-agent-l\",\n \"vetra-agent-xl\",\n \"vetra-agent-xxl\"\n ]\n }\n}"
8693
- }
8694
- },
8695
- modules: [
8696
- {
8697
- id: "m-identity",
8698
- name: "identity",
8699
- description: "Package identity fields: name, scope, version, description, bin",
8700
- operations: [
8701
- {
8702
- id: "o-set-description",
8703
- name: "SET_DESCRIPTION",
8704
- description: "Set the package description.",
8705
- schema: "input SetDescriptionInput {\n description: String!\n}",
8706
- template: "Set the package description.",
8707
- reducer: "state.description = action.input.description;",
8708
- errors: [],
8709
- examples: [],
8710
- scope: "global"
8711
- },
8712
- {
8713
- id: "o-set-version",
8714
- name: "SET_VERSION",
8715
- description: "Set the package version. Must be a valid semver string.",
8716
- schema: "input SetVersionInput {\n version: String!\n}",
8717
- template: "Set the package version. Must be a valid semver string.",
8718
- 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;",
8719
- errors: [{
8720
- id: "e-set-version-invalid",
8721
- name: "InvalidVersionError",
8722
- code: "INVALID_VERSION",
8723
- description: "The version must be a valid semver string (major.minor.patch, optionally with prerelease/build metadata).",
8724
- template: "Invalid version: {{version}}"
8725
- }],
8726
- examples: [],
8727
- scope: "global"
8728
- },
8729
- {
8730
- id: "o-set-package-identifier",
8731
- name: "SET_PACKAGE_IDENTIFIER",
8732
- description: "Set the package identifier. Parses scope and name from a string like '@scope/name-cli' or just 'name-cli'. Auto-adds '-cli' suffix if missing, stores scope with '@' prefix.",
8733
- schema: "input SetPackageIdentifierInput {\n identifier: String!\n}",
8734
- template: "Set the package identifier. Parses scope and name from a string like '@scope/name-cli' or just 'name-cli'.",
8735
- reducer: "const trimmed = action.input.identifier.trim();\nif (!trimmed) {\n throw new InvalidPackageIdentifierError('Package identifier must not be empty');\n}\nlet scopePart = null;\nlet namePart = trimmed;\nif (trimmed.includes('/')) {\n const parts = trimmed.split('/');\n if (parts.length !== 2 || !parts[0] || !parts[1]) {\n throw new InvalidPackageIdentifierError(`Invalid package identifier: ${trimmed}`);\n }\n scopePart = parts[0].replace(/^@/, '');\n namePart = parts[1];\n}\nif (scopePart !== null) {\n if (!/^[a-z][a-z0-9-]*$/.test(scopePart)) {\n throw new InvalidPackageIdentifierError(`Invalid scope: ${scopePart}`);\n }\n}\nif (!namePart.endsWith('-cli')) {\n namePart = namePart + '-cli';\n}\nif (!/^[a-z][a-z0-9-]*$/.test(namePart)) {\n throw new InvalidPackageIdentifierError(`Invalid package name: ${namePart}`);\n}\nstate.scope = scopePart ? `@${scopePart}` : null;\nstate.name = namePart;\nconst managed = state.packages.find((p) => p.managed);\nif (managed) {\n const appBase = namePart.replace(/-cli$/, '-app');\n managed.packageName = scopePart ? `@${scopePart}/${appBase}` : appBase;\n managed.id = `app-${namePart}`;\n}",
8736
- errors: [{
8737
- id: "e-invalid-package-identifier",
8738
- name: "InvalidPackageIdentifierError",
8739
- code: "INVALID_PACKAGE_IDENTIFIER",
8740
- description: "The package identifier is invalid. Must be a valid npm package name with optional scope.",
8741
- template: ""
8742
- }],
8743
- examples: [],
8744
- scope: "global"
8745
- }
8746
- ]
8747
- },
8748
- {
8749
- id: "m-features-powerhouse",
8750
- name: "features_powerhouse",
8751
- description: "Powerhouse integration level. Ordered enum: Disabled < Reactor < Switchboard < Connect. Once above Disabled, cannot go back to Disabled (irreversible migration).",
8752
- operations: [{
8753
- id: "o-set-powerhouse-level",
8754
- name: "SET_POWERHOUSE_LEVEL",
8755
- description: "Set the Powerhouse integration level. Ordered: Disabled < Reactor < Switchboard < Connect. Lowering below Reactor once above Disabled is not allowed (irreversible migration).",
8756
- schema: "input SetPowerhouseLevelInput {\n level: PowerhouseLevel!\n skipAutoProxy: Boolean\n}",
8757
- template: "Set the Powerhouse integration level. Ordered: Disabled < Reactor < Switchboard < Connect. Lowering below Reactor once above Disabled is not allowed (irreversible migration).",
8758
- reducer: "const LEVELS = ['Disabled', 'Reactor', 'Switchboard', 'Connect'];\nconst current = LEVELS.indexOf(state.features.powerhouse);\nconst next = LEVELS.indexOf(action.input.level);\nif (current >= 1 && next < 1) {\n throw new CannotLowerPowerhouseError(\n 'Cannot lower Powerhouse level below Reactor once enabled',\n );\n}\nstate.features.powerhouse = action.input.level;\nif (current === 0 && next >= 1) {\n const hasManaged = state.packages.some((p) => p.managed);\n if (!hasManaged) {\n const baseName = state.name\n ? state.name.replace(/-cli$/, '-app')\n : 'app';\n const appName =\n state.scope && state.name\n ? `${state.scope}/${baseName}`\n : baseName;\n state.packages.push({\n id: `app-${state.name || 'managed'}`,\n packageName: appName,\n documentTypes: ['*/*'],\n version: null,\n managed: true,\n });\n }\n}\nif (next >= 2 && !action.input.skipAutoProxy) {\n state.deployment.proxyEnabled = true;\n}",
8759
- errors: [{
8760
- id: "e-cannot-lower-powerhouse",
8761
- name: "CannotLowerPowerhouseError",
8762
- code: "CANNOT_LOWER_POWERHOUSE",
8763
- description: "Cannot lower the Powerhouse level below Reactor once it has been set above Disabled.",
8764
- template: "Cannot lower Powerhouse level below Reactor once enabled"
8765
- }],
8766
- examples: [],
8767
- scope: "global"
8768
- }]
8769
- },
8770
- {
8771
- id: "m-features-mastra",
8772
- name: "features_mastra",
8773
- description: "Mastra agent feature toggle. Orthogonal to Routine.",
8774
- operations: [
8775
- {
8776
- id: "o-enable-mastra",
8777
- name: "ENABLE_MASTRA",
8778
- description: "Enable the Mastra agent feature. Mastra and Routine are orthogonal — enable Routine separately if needed. Idempotent.",
8779
- schema: "input EnableMastraInput {\n agentId: String!\n agentName: String!\n}",
8780
- template: "Enable the Mastra agent feature. Mastra and Routine are orthogonal — enable Routine separately if needed. Idempotent.",
8781
- 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}",
8782
- errors: [{
8783
- id: "e-enable-mastra-invalid-id",
8784
- name: "InvalidAgentIdError",
8785
- code: "INVALID_AGENT_ID",
8786
- description: "The agent ID must match /^[a-z][a-z0-9-]*$/ — lowercase kebab-case.",
8787
- template: ""
8788
- }, {
8789
- id: "e-enable-mastra-invalid-name",
8790
- name: "InvalidAgentNameError",
8791
- code: "INVALID_AGENT_NAME",
8792
- description: "The agent name must not be empty after trimming.",
8793
- template: ""
8794
- }],
8795
- examples: [],
8796
- scope: "global"
8797
- },
8798
- {
8799
- id: "o-disable-mastra",
8800
- name: "DISABLE_MASTRA",
8801
- description: "Disable the Mastra agent feature. Does not affect Routine — disable that separately if desired.",
8802
- schema: "input DisableMastraInput {\n _: Boolean\n}",
8803
- template: "Disable the Mastra agent feature. Does not affect Routine — disable that separately if desired.",
8804
- 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}",
8805
- errors: [],
8806
- examples: [],
8807
- scope: "global"
8808
- },
8809
- {
8810
- id: "o-set-agent-id",
8811
- name: "SET_AGENT_ID",
8812
- description: "Set the agent ID. Must be lowercase kebab-case. Only valid when mastra is enabled.",
8813
- schema: "input SetAgentIdInput {\n agentId: String!\n}",
8814
- template: "Set the agent ID. Must be lowercase kebab-case. Only valid when mastra is enabled.",
8815
- 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;",
8816
- errors: [{
8817
- id: "e-set-agent-id-not-enabled",
8818
- name: "MastraNotEnabledError",
8819
- code: "MASTRA_NOT_ENABLED",
8820
- description: "Mastra must be enabled before setting agent identity.",
8821
- template: ""
8822
- }, {
8823
- id: "e-set-agent-id-invalid",
8824
- name: "InvalidAgentIdError",
8825
- code: "INVALID_AGENT_ID",
8826
- description: "The agent ID must match /^[a-z][a-z0-9-]*$/ — lowercase kebab-case.",
8827
- template: ""
8828
- }],
8829
- examples: [],
8830
- scope: "global"
8831
- },
8832
- {
8833
- id: "o-set-agent-name",
8834
- name: "SET_AGENT_NAME",
8835
- description: "Set the agent display name. Must be non-empty after trim. Only valid when mastra is enabled.",
8836
- schema: "input SetAgentNameInput {\n agentName: String!\n}",
8837
- template: "Set the agent display name. Must be non-empty after trim. Only valid when mastra is enabled.",
8838
- 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;",
8839
- errors: [{
8840
- id: "e-set-agent-name-not-enabled",
8841
- name: "MastraNotEnabledError",
8842
- code: "MASTRA_NOT_ENABLED",
8843
- description: "Mastra must be enabled before setting agent identity.",
8844
- template: ""
8845
- }, {
8846
- id: "e-set-agent-name-invalid",
8847
- name: "InvalidAgentNameError",
8848
- code: "INVALID_AGENT_NAME",
8849
- description: "The agent name must not be empty after trimming.",
8850
- template: ""
8851
- }],
8852
- examples: [],
8853
- scope: "global"
8854
- },
8855
- {
8856
- id: "o-add-model",
8857
- name: "ADD_MODEL",
8858
- 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.",
8859
- schema: "input AddModelInput {\n id: String!\n isDefault: Boolean\n}",
8860
- 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.",
8861
- 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});",
8862
- errors: [
8863
- {
8864
- id: "e-add-model-not-enabled",
8865
- name: "MastraNotEnabledError",
8866
- code: "MASTRA_NOT_ENABLED",
8867
- description: "Mastra must be enabled before managing models.",
8868
- template: ""
8869
- },
8870
- {
8871
- id: "e-add-model-invalid-id",
8872
- name: "InvalidModelIdError",
8873
- code: "INVALID_MODEL_ID",
8874
- description: "Model ID must match provider/model-name format.",
8875
- template: ""
8876
- },
8877
- {
8878
- id: "e-add-model-duplicate",
8879
- name: "DuplicateModelError",
8880
- code: "DUPLICATE_MODEL",
8881
- description: "A model with this ID already exists.",
8882
- template: ""
8883
- }
8884
- ],
8885
- examples: [],
8886
- scope: "global"
8887
- },
8888
- {
8889
- id: "o-remove-model",
8890
- name: "REMOVE_MODEL",
8891
- description: "Remove a model. If removing the default and others remain, promotes first remaining to default.",
8892
- schema: "input RemoveModelInput {\n id: String!\n}",
8893
- template: "Remove a model. If removing the default and others remain, promotes first remaining to default.",
8894
- 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}",
8895
- errors: [{
8896
- id: "e-remove-model-not-enabled",
8897
- name: "MastraNotEnabledError",
8898
- code: "MASTRA_NOT_ENABLED",
8899
- description: "Mastra must be enabled before managing models.",
8900
- template: ""
8901
- }, {
8902
- id: "e-remove-model-not-found",
8903
- name: "ModelNotFoundError",
8904
- code: "MODEL_NOT_FOUND",
8905
- description: "The specified model was not found.",
8906
- template: ""
8907
- }],
8908
- examples: [],
8909
- scope: "global"
8910
- },
8911
- {
8912
- id: "o-set-default-model",
8913
- name: "SET_DEFAULT_MODEL",
8914
- description: "Set a model as the default. Unsets the previous default.",
8915
- schema: "input SetDefaultModelInput {\n id: String!\n}",
8916
- template: "Set a model as the default. Unsets the previous default.",
8917
- 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;",
8918
- errors: [{
8919
- id: "e-set-default-model-not-enabled",
8920
- name: "MastraNotEnabledError",
8921
- code: "MASTRA_NOT_ENABLED",
8922
- description: "Mastra must be enabled before managing models.",
8923
- template: ""
8924
- }, {
8925
- id: "e-set-default-model-not-found",
8926
- name: "ModelNotFoundError",
8927
- code: "MODEL_NOT_FOUND",
8928
- description: "The specified model was not found.",
8929
- template: ""
8930
- }],
8931
- examples: [],
8932
- scope: "global"
8933
- },
8934
- {
8935
- id: "o-add-profile",
8936
- name: "ADD_PROFILE",
8937
- description: "Add an agent profile section. Inserted before insertBefore if provided, otherwise appended to end.",
8938
- schema: "input AddProfileInput {\n id: String!\n title: String!\n content: String!\n insertBefore: String\n}",
8939
- template: "Add an agent profile section. Inserted before insertBefore if provided, otherwise appended to end.",
8940
- 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}",
8941
- errors: [
8942
- {
8943
- id: "e-add-profile-not-enabled",
8944
- name: "MastraNotEnabledError",
8945
- code: "MASTRA_NOT_ENABLED",
8946
- description: "Mastra must be enabled before managing profiles.",
8947
- template: ""
8948
- },
8949
- {
8950
- id: "e-add-profile-invalid-id",
8951
- name: "InvalidProfileIdError",
8952
- code: "INVALID_PROFILE_ID",
8953
- description: "Profile ID must match /^[a-z][a-z0-9-]*$/ — lowercase kebab-case.",
8954
- template: ""
8955
- },
8956
- {
8957
- id: "e-add-profile-duplicate",
8958
- name: "DuplicateProfileError",
8959
- code: "DUPLICATE_PROFILE",
8960
- description: "A profile with this ID already exists.",
8961
- template: ""
8962
- },
8963
- {
8964
- id: "e-add-profile-not-found",
8965
- name: "ProfileNotFoundError",
8966
- code: "PROFILE_NOT_FOUND",
8967
- description: "The insertBefore profile was not found.",
8968
- template: ""
8969
- }
8970
- ],
8971
- examples: [],
8972
- scope: "global"
8973
- },
8974
- {
8975
- id: "o-update-profile",
8976
- name: "UPDATE_PROFILE",
8977
- description: "Update an existing profile's title and/or content. Only updates provided fields.",
8978
- schema: "input UpdateProfileInput {\n id: String!\n title: String\n content: String\n}",
8979
- template: "Update an existing profile's title and/or content. Only updates provided fields.",
8980
- 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;",
8981
- errors: [{
8982
- id: "e-update-profile-not-enabled",
8983
- name: "MastraNotEnabledError",
8984
- code: "MASTRA_NOT_ENABLED",
8985
- description: "Mastra must be enabled before managing profiles.",
8986
- template: ""
8987
- }, {
8988
- id: "e-update-profile-not-found",
8989
- name: "ProfileNotFoundError",
8990
- code: "PROFILE_NOT_FOUND",
8991
- description: "The specified profile was not found.",
8992
- template: ""
8993
- }],
8994
- examples: [],
8995
- scope: "global"
8996
- },
8997
- {
8998
- id: "o-remove-profile",
8999
- name: "REMOVE_PROFILE",
9000
- description: "Remove an agent profile section.",
9001
- schema: "input RemoveProfileInput {\n id: String!\n}",
9002
- template: "Remove an agent profile section.",
9003
- 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);",
9004
- errors: [{
9005
- id: "e-remove-profile-not-enabled",
9006
- name: "MastraNotEnabledError",
9007
- code: "MASTRA_NOT_ENABLED",
9008
- description: "Mastra must be enabled before managing profiles.",
9009
- template: ""
9010
- }, {
9011
- id: "e-remove-profile-not-found",
9012
- name: "ProfileNotFoundError",
9013
- code: "PROFILE_NOT_FOUND",
9014
- description: "The specified profile was not found.",
9015
- template: ""
9016
- }],
9017
- examples: [],
9018
- scope: "global"
9019
- },
9020
- {
9021
- id: "o-reorder-profiles",
9022
- name: "REORDER_PROFILES",
9023
- description: "Move one or more profiles before another profile, or to the end if insertBefore is null.",
9024
- schema: "input ReorderProfilesInput {\n ids: [String!]!\n insertBefore: String\n}",
9025
- template: "Move one or more profiles before another profile, or to the end if insertBefore is null.",
9026
- 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}",
9027
- errors: [{
9028
- id: "e-reorder-profiles-not-enabled",
9029
- name: "MastraNotEnabledError",
9030
- code: "MASTRA_NOT_ENABLED",
9031
- description: "Mastra must be enabled before managing profiles.",
9032
- template: ""
9033
- }, {
9034
- id: "e-reorder-profiles-not-found",
9035
- name: "ProfileNotFoundError",
9036
- code: "PROFILE_NOT_FOUND",
9037
- description: "A referenced profile was not found.",
9038
- template: ""
9039
- }],
9040
- examples: [],
9041
- scope: "global"
9042
- },
9043
- {
9044
- id: "o-set-agent-description",
9045
- name: "SET_AGENT_DESCRIPTION",
9046
- description: "Set the agent description. Only valid when mastra is enabled.",
9047
- schema: "input SetAgentDescriptionInput {\n description: String!\n}",
9048
- template: "Set the agent description. Only valid when mastra is enabled.",
9049
- 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;",
9050
- errors: [{
9051
- id: "e-set-agent-desc-not-enabled",
9052
- name: "MastraNotEnabledError",
9053
- code: "MASTRA_NOT_ENABLED",
9054
- description: "Mastra must be enabled before setting agent description.",
9055
- template: ""
9056
- }],
9057
- examples: [],
9058
- scope: "global"
9059
- },
9060
- {
9061
- id: "o-set-agent-image",
9062
- name: "SET_AGENT_IMAGE",
9063
- description: "Set the agent image URL (avatar). Only valid when mastra is enabled.",
9064
- schema: "input SetAgentImageInput {\n image: String!\n}",
9065
- template: "Set the agent image URL (avatar). Only valid when mastra is enabled.",
9066
- 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;",
9067
- errors: [{
9068
- id: "e-set-agent-image-not-enabled",
9069
- name: "MastraNotEnabledError",
9070
- code: "MASTRA_NOT_ENABLED",
9071
- description: "Mastra must be enabled before setting agent image.",
9072
- template: ""
9073
- }, {
9074
- id: "e-invalid-agent-image",
9075
- name: "InvalidAgentImageError",
9076
- code: "INVALID_AGENT_IMAGE",
9077
- description: "Agent image must be a data URL",
9078
- template: ""
9079
- }],
9080
- examples: [],
9081
- scope: "global"
9082
- },
9083
- {
9084
- id: "o-clear-agent-image",
9085
- name: "CLEAR_AGENT_IMAGE",
9086
- description: "",
9087
- schema: "input ClearAgentImageInput {\n _: Boolean\n}",
9088
- template: "",
9089
- 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;",
9090
- errors: [{
9091
- id: "e-mastra-not-enabled-clear-img",
9092
- name: "MastraNotEnabledError",
9093
- code: "MASTRA_NOT_ENABLED",
9094
- description: "Mastra must be enabled",
9095
- template: ""
9096
- }],
9097
- examples: [],
9098
- scope: "global"
9099
- },
9100
- {
9101
- id: "o-set-enable-chat",
9102
- name: "SET_ENABLE_CHAT",
9103
- description: "Enable or disable the chat integration. When enabled, auto-adds @powerhousedao/clint-common as a managed package with powerhouse/chat-session doc type. When disabled, removes it if it only has that doc type.",
9104
- schema: "input SetEnableChatInput {\n enabled: Boolean!\n}",
9105
- template: "Toggle the chat integration feature. Requires both Mastra and Powerhouse to be enabled.",
9106
- reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot toggle chat when Mastra is disabled.');\n}\nif (state.features.powerhouse === 'Disabled') {\n throw new PowerhouseNotEnabledError('Cannot toggle chat when Powerhouse is disabled.');\n}\nstate.features.mastra.common.enableChat = action.input.enabled;\nconst CLINT_COMMON_PKG = '@powerhousedao/clint-common';\nconst CHAT_DOC_TYPE = 'powerhouse/chat-session';\nif (action.input.enabled) {\n const existing = state.packages.find((p) => p.packageName === CLINT_COMMON_PKG);\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 const idx = state.packages.findIndex(\n (p) => p.packageName === CLINT_COMMON_PKG && p.managed,\n );\n if (idx !== -1) {\n const pkg = state.packages[idx];\n if (pkg.documentTypes.length === 1 && pkg.documentTypes[0] === CHAT_DOC_TYPE) {\n state.packages.splice(idx, 1);\n } else {\n const dtIdx = pkg.documentTypes.indexOf(CHAT_DOC_TYPE);\n if (dtIdx !== -1) pkg.documentTypes.splice(dtIdx, 1);\n }\n }\n}",
9107
- errors: [{
9108
- id: "e-chat-mastra-not-enabled",
9109
- name: "MastraNotEnabledError",
9110
- code: "MASTRA_NOT_ENABLED",
9111
- description: "Mastra must be enabled before toggling chat.",
9112
- template: ""
9113
- }, {
9114
- id: "e-chat-powerhouse-not-enabled",
9115
- name: "PowerhouseNotEnabledError",
9116
- code: "POWERHOUSE_NOT_ENABLED",
9117
- description: "Powerhouse must be enabled (Reactor or above) before toggling chat.",
9118
- template: ""
9119
- }],
9120
- examples: [],
9121
- scope: "global"
9122
- }
9123
- ]
9124
- },
9125
- {
9126
- id: "m-features-routine",
9127
- name: "features_routine",
9128
- description: "Routine loop feature toggle.",
9129
- operations: [{
9130
- id: "o-enable-routine",
9131
- name: "ENABLE_ROUTINE",
9132
- description: "Enable the routine loop. Idempotent.",
9133
- schema: "input EnableRoutineInput {\n _: Boolean\n}",
9134
- template: "Enable the routine loop. Idempotent.",
9135
- reducer: "state.features.routine.enabled = true;",
9136
- errors: [],
9137
- examples: [],
9138
- scope: "global"
9139
- }, {
9140
- id: "o-disable-routine",
9141
- name: "DISABLE_ROUTINE",
9142
- description: "Disable the routine loop. Always allowed.",
9143
- schema: "input DisableRoutineInput {\n _: Boolean\n}",
9144
- template: "Disable the routine loop.",
9145
- reducer: "state.features.routine.enabled = false;",
9146
- errors: [],
9147
- examples: [],
9148
- scope: "global"
9149
- }]
9150
- },
9151
- {
9152
- id: "m-powerhouse-packages",
9153
- name: "powerhouse_packages",
9154
- description: "Manage reactor packages and their document types. The app package is auto-created when Powerhouse level goes above Disabled.",
9155
- operations: [
9156
- {
9157
- id: "o-add-powerhouse-package",
9158
- name: "ADD_POWERHOUSE_PACKAGE",
9159
- description: "Add an external reactor package. The app package is auto-managed by SET_POWERHOUSE_LEVEL.",
9160
- schema: "input AddPowerhousePackageInput {\n id: OID!\n packageName: String!\n}",
9161
- template: "Add an external reactor package. The app package is auto-managed by SET_POWERHOUSE_LEVEL.",
9162
- 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});",
9163
- errors: [{
9164
- id: "e-duplicate-package",
9165
- name: "DuplicatePackageError",
9166
- code: "DUPLICATE_PACKAGE",
9167
- description: "A package with the same ID or name already exists.",
9168
- template: ""
9169
- }],
9170
- examples: [],
9171
- scope: "global"
9172
- },
9173
- {
9174
- id: "o-remove-powerhouse-package",
9175
- name: "REMOVE_POWERHOUSE_PACKAGE",
9176
- description: "Remove a reactor package. Cannot remove the auto-managed app package.",
9177
- schema: "input RemovePowerhousePackageInput {\n id: OID!\n}",
9178
- template: "Remove a reactor package. Cannot remove the auto-managed app package.",
9179
- 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);",
9180
- errors: [
9181
- {
9182
- id: "e-package-not-found-remove",
9183
- name: "PackageNotFoundError",
9184
- code: "PACKAGE_NOT_FOUND",
9185
- description: "The specified package ID was not found.",
9186
- template: ""
9187
- },
9188
- {
9189
- id: "e-cannot-remove-app-package",
9190
- name: "CannotRemoveAppPackageError",
9191
- code: "CANNOT_REMOVE_APP_PACKAGE",
9192
- description: "The auto-managed app package cannot be removed.",
9193
- template: ""
9194
- },
9195
- {
9196
- id: "e-cannot-remove-managed",
9197
- name: "CannotRemoveManagedPackageError",
9198
- code: "CANNOT_REMOVE_MANAGED_PACKAGE",
9199
- description: "Cannot remove a managed (framework-controlled) package",
9200
- template: ""
9201
- }
9202
- ],
9203
- examples: [],
9204
- scope: "global"
9205
- },
9206
- {
9207
- id: "o-add-package-document-type",
9208
- name: "ADD_PACKAGE_DOCUMENT_TYPE",
9209
- description: "Add a document type ID to a package (app or external).",
9210
- schema: "input AddPackageDocumentTypeInput {\n packageId: OID!\n documentType: String!\n}",
9211
- template: "Add a document type ID to a package (app or external).",
9212
- 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);",
9213
- errors: [
9214
- {
9215
- id: "e-invalid-document-type",
9216
- name: "InvalidDocumentTypeError",
9217
- code: "INVALID_DOCUMENT_TYPE",
9218
- description: "Document type must match org/name format (e.g. powerhouse/ph-clint-project).",
9219
- template: ""
9220
- },
9221
- {
9222
- id: "e-package-not-found-add-dt",
9223
- name: "PackageNotFoundError",
9224
- code: "PACKAGE_NOT_FOUND",
9225
- description: "The specified package ID was not found.",
9226
- template: ""
9227
- },
9228
- {
9229
- id: "e-duplicate-document-type",
9230
- name: "DuplicateDocumentTypeError",
9231
- code: "DUPLICATE_DOCUMENT_TYPE",
9232
- description: "This document type is already registered in the package.",
9233
- template: ""
9234
- }
9235
- ],
9236
- examples: [],
9237
- scope: "global"
9238
- },
9239
- {
9240
- id: "o-remove-package-document-type",
9241
- name: "REMOVE_PACKAGE_DOCUMENT_TYPE",
9242
- description: "Remove a document type ID from a package.",
9243
- schema: "input RemovePackageDocumentTypeInput {\n packageId: OID!\n documentType: String!\n}",
9244
- template: "Remove a document type ID from a package.",
9245
- 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);",
9246
- errors: [{
9247
- id: "e-package-not-found-rm-dt",
9248
- name: "PackageNotFoundError",
9249
- code: "PACKAGE_NOT_FOUND",
9250
- description: "The specified package ID was not found.",
9251
- template: ""
9252
- }, {
9253
- id: "e-document-type-not-found",
9254
- name: "DocumentTypeNotFoundError",
9255
- code: "DOCUMENT_TYPE_NOT_FOUND",
9256
- description: "The specified document type was not found in this package.",
9257
- template: ""
9258
- }],
9259
- examples: [],
9260
- scope: "global"
9261
- },
9262
- {
9263
- id: "o-set-package-version",
9264
- name: "SET_PACKAGE_VERSION",
9265
- description: "",
9266
- schema: "input SetPackageVersionInput {\n packageId: OID!\n version: String\n}",
9267
- template: "",
9268
- 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;",
9269
- errors: [{
9270
- id: "e-pkg-not-found-set-ver",
9271
- name: "PackageNotFoundError",
9272
- code: "PACKAGE_NOT_FOUND",
9273
- description: "Referenced package does not exist",
9274
- template: ""
9275
- }, {
9276
- id: "e-invalid-version",
9277
- name: "InvalidVersionError",
9278
- code: "INVALID_VERSION",
9279
- description: "Version string is not valid semver",
9280
- template: ""
9281
- }],
9282
- examples: [],
9283
- scope: "global"
9284
- }
9285
- ]
9286
- },
9287
- {
9288
- id: "m-external-skills",
9289
- name: "external_skills",
9290
- description: "External skills from the skills.sh ecosystem. Each skill has a name and GitHub URL for installation.",
9291
- operations: [
9292
- {
9293
- id: "o-add-external-skill",
9294
- name: "ADD_EXTERNAL_SKILL",
9295
- description: "Add an external skill. Name must be lowercase kebab-case.",
9296
- schema: "input AddExternalSkillInput {\n id: OID!\n name: String!\n githubUrl: URL!\n}",
9297
- template: "Add an external skill. Name must be lowercase kebab-case.",
9298
- 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});",
9299
- errors: [{
9300
- id: "e-invalid-skill-name",
9301
- name: "InvalidSkillNameError",
9302
- code: "INVALID_SKILL_NAME",
9303
- description: "Skill name must be lowercase kebab-case (e.g. playwright-cli).",
9304
- template: ""
9305
- }, {
9306
- id: "e-duplicate-skill",
9307
- name: "DuplicateSkillError",
9308
- code: "DUPLICATE_SKILL",
9309
- description: "A skill with the same ID or name already exists.",
9310
- template: ""
9311
- }],
9312
- examples: [],
9313
- scope: "global"
9314
- },
9315
- {
9316
- id: "o-remove-external-skill",
9317
- name: "REMOVE_EXTERNAL_SKILL",
9318
- description: "Remove an external skill by ID.",
9319
- schema: "input RemoveExternalSkillInput {\n id: OID!\n}",
9320
- template: "Remove an external skill by ID.",
9321
- 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);",
9322
- errors: [{
9323
- id: "e-skill-not-found-remove",
9324
- name: "SkillNotFoundError",
9325
- code: "SKILL_NOT_FOUND",
9326
- description: "The specified skill ID was not found.",
9327
- template: ""
9328
- }],
9329
- examples: [],
9330
- scope: "global"
9331
- },
9332
- {
9333
- id: "o-set-external-skill-name",
9334
- name: "SET_EXTERNAL_SKILL_NAME",
9335
- description: "Update the name of an external skill.",
9336
- schema: "input SetExternalSkillNameInput {\n id: OID!\n name: String!\n}",
9337
- template: "Update the name of an external skill.",
9338
- 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;",
9339
- errors: [
9340
- {
9341
- id: "e-skill-not-found-set-name",
9342
- name: "SkillNotFoundError",
9343
- code: "SKILL_NOT_FOUND",
9344
- description: "The specified skill ID was not found.",
9345
- template: ""
9346
- },
9347
- {
9348
- id: "e-invalid-skill-name-set",
9349
- name: "InvalidSkillNameError",
9350
- code: "INVALID_SKILL_NAME",
9351
- description: "Skill name must be lowercase kebab-case.",
9352
- template: ""
9353
- },
9354
- {
9355
- id: "e-duplicate-skill-set-name",
9356
- name: "DuplicateSkillError",
9357
- code: "DUPLICATE_SKILL",
9358
- description: "Another skill already uses this name.",
9359
- template: ""
9360
- }
9361
- ],
9362
- examples: [],
9363
- scope: "global"
9364
- },
9365
- {
9366
- id: "o-set-external-skill-github-url",
9367
- name: "SET_EXTERNAL_SKILL_GITHUB_URL",
9368
- description: "Update the GitHub URL of an external skill.",
9369
- schema: "input SetExternalSkillGithubUrlInput {\n id: OID!\n githubUrl: URL!\n}",
9370
- template: "Update the GitHub URL of an external skill.",
9371
- 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;",
9372
- errors: [{
9373
- id: "e-skill-not-found-set-url",
9374
- name: "SkillNotFoundError",
9375
- code: "SKILL_NOT_FOUND",
9376
- description: "The specified skill ID was not found.",
9377
- template: ""
9378
- }],
9379
- examples: [],
9380
- scope: "global"
9381
- }
9382
- ]
9383
- },
9384
- {
9385
- id: "m-publishing",
9386
- name: "publishing",
9387
- description: "Version bumping and publish records. Tracks dev/staging/production publish intents and their status.",
9388
- operations: [
9389
- {
9390
- id: "o-bump-version",
9391
- name: "BUMP_VERSION",
9392
- description: "Bump the project version. Must be a valid semver string greater than the current version.",
9393
- schema: "input BumpVersionInput {\n version: String!\n}",
9394
- template: "Bump the project version. Must be a valid semver string greater than the current version.",
9395
- 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;",
9396
- errors: [{
9397
- id: "e-invalid-version-bump",
9398
- name: "InvalidVersionError",
9399
- code: "INVALID_VERSION",
9400
- description: "The version must be a valid semver string.",
9401
- template: ""
9402
- }],
9403
- examples: [],
9404
- scope: "global"
9405
- },
9406
- {
9407
- id: "o-publish-dev",
9408
- name: "PUBLISH_DEV",
9409
- description: "Record a dev publish intent. Creates a Pending publish record.",
9410
- schema: "input PublishDevInput {\n id: OID!\n timestamp: DateTime!\n}",
9411
- template: "Record a dev publish intent. Creates a Pending publish record.",
9412
- 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});",
9413
- errors: [],
9414
- examples: [],
9415
- scope: "global"
9416
- },
9417
- {
9418
- id: "o-publish-staging",
9419
- name: "PUBLISH_STAGING",
9420
- description: "Record a staging publish intent. Creates a Pending publish record.",
9421
- schema: "input PublishStagingInput {\n id: OID!\n timestamp: DateTime!\n}",
9422
- template: "Record a staging publish intent. Creates a Pending publish record.",
9423
- 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});",
9424
- errors: [],
9425
- examples: [],
9426
- scope: "global"
9427
- },
9428
- {
9429
- id: "o-publish-production",
9430
- name: "PUBLISH_PRODUCTION",
9431
- description: "Record a production publish intent. Creates a Pending publish record.",
9432
- schema: "input PublishProductionInput {\n id: OID!\n timestamp: DateTime!\n}",
9433
- template: "Record a production publish intent. Creates a Pending publish record.",
9434
- 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});",
9435
- errors: [],
9436
- examples: [],
9437
- scope: "global"
9438
- },
9439
- {
9440
- id: "o-set-publish-status",
9441
- name: "SET_PUBLISH_STATUS",
9442
- description: "Update the status of a publish record. Used by the trigger after publish completes.",
9443
- schema: "input SetPublishStatusInput {\n id: OID!\n status: PublishStatus!\n}",
9444
- template: "Update the status of a publish record. Used by the trigger after publish completes.",
9445
- 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;",
9446
- errors: [{
9447
- id: "e-publish-record-not-found",
9448
- name: "PublishRecordNotFoundError",
9449
- code: "PUBLISH_RECORD_NOT_FOUND",
9450
- description: "The specified publish record ID was not found.",
9451
- template: ""
9452
- }],
9453
- examples: [],
9454
- scope: "global"
9455
- }
9456
- ]
9457
- },
9458
- {
9459
- id: "m-lifecycle",
9460
- name: "lifecycle",
9461
- description: "Document lifecycle operations. IMPORT_SPEC bulk-imports a full project spec into the document.",
9462
- operations: [{
9463
- id: "o-import-spec",
9464
- name: "IMPORT_SPEC",
9465
- 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.",
9466
- 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 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}",
9467
- 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.",
9468
- 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.supportedResources = action.input.supportedResources\n ? [...action.input.supportedResources]\n : [];",
9469
- errors: [],
9470
- examples: [],
9471
- scope: "global"
9472
- }]
9473
- },
9474
- {
9475
- id: "m-deployment",
9476
- name: "deployment",
9477
- description: "Deployment settings: service announcement toggle and supported resource tiers.",
9478
- operations: [
9479
- {
9480
- id: "o-add-supported-resource",
9481
- name: "ADD_SUPPORTED_RESOURCE",
9482
- description: "Add a supported resource tier. Guards against duplicates.",
9483
- schema: "input AddSupportedResourceInput {\n resource: String!\n}",
9484
- template: "Add a supported resource tier. Guards against duplicates.",
9485
- 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);",
9486
- errors: [{
9487
- id: "e-duplicate-resource",
9488
- name: "DuplicateResourceError",
9489
- code: "DUPLICATE_RESOURCE",
9490
- description: "This resource is already in the supported resources list.",
9491
- template: ""
9492
- }],
9493
- examples: [],
9494
- scope: "global"
9495
- },
9496
- {
9497
- id: "o-remove-supported-resource",
9498
- name: "REMOVE_SUPPORTED_RESOURCE",
9499
- description: "Remove a supported resource tier.",
9500
- schema: "input RemoveSupportedResourceInput {\n resource: String!\n}",
9501
- template: "Remove a supported resource tier.",
9502
- 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);",
9503
- errors: [{
9504
- id: "e-resource-not-found",
9505
- name: "ResourceNotFoundError",
9506
- code: "RESOURCE_NOT_FOUND",
9507
- description: "The specified resource was not found in the supported resources list.",
9508
- template: ""
9509
- }],
9510
- examples: [],
9511
- scope: "global"
9512
- },
9513
- {
9514
- id: "o-set-proxy-enabled",
9515
- name: "SET_PROXY_ENABLED",
9516
- description: "Toggle the embedded reverse proxy.",
9517
- schema: "input SetProxyEnabledInput {\n enabled: Boolean!\n}",
9518
- template: "Toggle the embedded reverse proxy.",
9519
- reducer: "state.deployment.proxyEnabled = action.input.enabled;",
9520
- errors: [],
9521
- examples: [],
9522
- scope: "global"
9523
- }
9524
- ]
9525
- }
9526
- ],
9527
- version: 1,
9528
- changeLog: []
9529
- }]
9530
- };
9531
- //#endregion
9532
- //#region document-models/ph-clint-project/v1/gen/identity/error.ts
9533
- var InvalidVersionError$2 = class extends Error {
9534
- errorCode = "InvalidVersionError";
9535
- constructor(message = "InvalidVersionError") {
9536
- super(message);
9537
- }
9538
- };
9539
- var InvalidPackageIdentifierError = class extends Error {
9540
- errorCode = "InvalidPackageIdentifierError";
9541
- constructor(message = "InvalidPackageIdentifierError") {
9542
- super(message);
9543
- }
9544
- };
9545
- //#endregion
9546
- //#region document-models/ph-clint-project/v1/src/reducers/identity.ts
9547
- const SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
9548
- const NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
9549
- const phClintProjectIdentityOperations = {
9550
- setVersionOperation(state, action) {
9551
- if (!SEMVER_PATTERN.test(action.input.version)) throw new InvalidVersionError$2(`Invalid version: ${action.input.version}`);
9552
- state.version = action.input.version;
9553
- },
9554
- setDescriptionOperation(state, action) {
9555
- state.description = action.input.description;
9556
- },
9557
- setPackageIdentifierOperation(state, action) {
9558
- const trimmed = action.input.identifier.trim();
9559
- if (!trimmed) throw new InvalidPackageIdentifierError("Package identifier must not be empty");
9560
- let scopePart = null;
9561
- let namePart = trimmed;
9562
- if (trimmed.includes("/")) {
9563
- const parts = trimmed.split("/");
9564
- if (parts.length !== 2 || !parts[0] || !parts[1]) throw new InvalidPackageIdentifierError(`Invalid package identifier: ${trimmed}`);
9565
- scopePart = parts[0].replace(/^@/, "");
9566
- namePart = parts[1];
9567
- }
9568
- if (scopePart !== null) {
9569
- if (!NAME_PATTERN.test(scopePart)) throw new InvalidPackageIdentifierError(`Invalid scope: ${scopePart}`);
9570
- }
9571
- if (!namePart.endsWith("-cli")) namePart = namePart + "-cli";
9572
- if (!NAME_PATTERN.test(namePart)) throw new InvalidPackageIdentifierError(`Invalid package name: ${namePart}`);
9573
- state.scope = scopePart ? `@${scopePart}` : null;
9574
- state.name = namePart;
9575
- const managed = state.packages.find((p) => p.managed);
9576
- if (managed) {
9577
- const appBase = namePart.replace(/-cli$/, "-app");
9578
- managed.packageName = scopePart ? `@${scopePart}/${appBase}` : appBase;
9579
- managed.id = `app-${namePart}`;
9580
- }
9581
- }
9582
- };
9583
- //#endregion
9584
- //#region document-models/ph-clint-project/v1/gen/features-powerhouse/error.ts
9585
- var CannotLowerPowerhouseError = class extends Error {
9586
- errorCode = "CannotLowerPowerhouseError";
9587
- constructor(message = "CannotLowerPowerhouseError") {
9588
- super(message);
9589
- }
9590
- };
9591
- //#endregion
9592
- //#region document-models/ph-clint-project/v1/src/reducers/features-powerhouse.ts
9593
- const LEVELS = [
9594
- "Disabled",
9595
- "Reactor",
9596
- "Switchboard",
9597
- "Connect"
9598
- ];
9599
- const phClintProjectFeaturesPowerhouseOperations = { setPowerhouseLevelOperation(state, action) {
9600
- const current = LEVELS.indexOf(state.features.powerhouse);
9601
- const next = LEVELS.indexOf(action.input.level);
9602
- if (current >= 1 && next < 1) throw new CannotLowerPowerhouseError("Cannot lower Powerhouse level below Reactor once enabled");
9603
- state.features.powerhouse = action.input.level;
9604
- if (current === 0 && next >= 1) {
9605
- if (!state.packages.some((p) => p.managed)) {
9606
- const baseName = state.name ? state.name.replace(/-cli$/, "-app") : "app";
9607
- const appName = state.scope && state.name ? `${state.scope}/${baseName}` : baseName;
9608
- state.packages.push({
9609
- id: `app-${state.name || "managed"}`,
9610
- packageName: appName,
9611
- documentTypes: ["*/*"],
9612
- version: null,
9613
- managed: true
9614
- });
9615
- }
9616
- }
9617
- if (next >= 2 && !action.input.skipAutoProxy) state.deployment.proxyEnabled = true;
9618
- } };
9619
- //#endregion
9620
- //#region document-models/ph-clint-project/v1/gen/features-mastra/error.ts
9621
- var InvalidAgentIdError = class extends Error {
9622
- errorCode = "InvalidAgentIdError";
9623
- constructor(message = "InvalidAgentIdError") {
9624
- super(message);
9625
- }
9626
- };
9627
- var InvalidAgentNameError = class extends Error {
9628
- errorCode = "InvalidAgentNameError";
9629
- constructor(message = "InvalidAgentNameError") {
9630
- super(message);
9631
- }
9632
- };
9633
- var MastraNotEnabledError = class extends Error {
9634
- errorCode = "MastraNotEnabledError";
9635
- constructor(message = "MastraNotEnabledError") {
9636
- super(message);
9637
- }
9638
- };
9639
- var InvalidModelIdError = class extends Error {
9640
- errorCode = "InvalidModelIdError";
9641
- constructor(message = "InvalidModelIdError") {
9642
- super(message);
9643
- }
9644
- };
9645
- var DuplicateModelError = class extends Error {
9646
- errorCode = "DuplicateModelError";
9647
- constructor(message = "DuplicateModelError") {
9648
- super(message);
9649
- }
9650
- };
9651
- var ModelNotFoundError = class extends Error {
9652
- errorCode = "ModelNotFoundError";
9653
- constructor(message = "ModelNotFoundError") {
9654
- super(message);
9655
- }
9656
- };
9657
- var InvalidProfileIdError = class extends Error {
9658
- errorCode = "InvalidProfileIdError";
9659
- constructor(message = "InvalidProfileIdError") {
9660
- super(message);
9661
- }
9662
- };
9663
- var DuplicateProfileError = class extends Error {
9664
- errorCode = "DuplicateProfileError";
9665
- constructor(message = "DuplicateProfileError") {
9666
- super(message);
9667
- }
9668
- };
9669
- var ProfileNotFoundError = class extends Error {
9670
- errorCode = "ProfileNotFoundError";
9671
- constructor(message = "ProfileNotFoundError") {
9672
- super(message);
9673
- }
9674
- };
9675
- var InvalidAgentImageError = class extends Error {
9676
- errorCode = "InvalidAgentImageError";
9677
- constructor(message = "InvalidAgentImageError") {
9678
- super(message);
9679
- }
9680
- };
9681
- var PowerhouseNotEnabledError = class extends Error {
9682
- errorCode = "PowerhouseNotEnabledError";
9683
- constructor(message = "PowerhouseNotEnabledError") {
9684
- super(message);
9685
- }
9686
- };
9687
- //#endregion
9688
- //#region document-models/ph-clint-project/v1/src/reducers/features-mastra.ts
9689
- const phClintProjectFeaturesMastraOperations = {
9690
- enableMastraOperation(state, action) {
9691
- if (!/^[a-z][a-z0-9-]*$/.test(action.input.agentId)) throw new InvalidAgentIdError(`Invalid agent ID: ${action.input.agentId}. Must be lowercase kebab-case.`);
9692
- const trimmedName = action.input.agentName.trim();
9693
- if (!trimmedName) throw new InvalidAgentNameError("Agent name must not be empty.");
9694
- state.features.mastra.enabled = true;
9695
- state.features.mastra.agentId = action.input.agentId;
9696
- state.features.mastra.agentName = trimmedName;
9697
- if (state.features.mastra.models.length === 0) state.features.mastra.models.push({
9698
- id: "clint/demo-agent",
9699
- isDefault: true
9700
- });
9701
- if (state.features.mastra.profiles.length === 0) state.features.mastra.profiles.push({
9702
- id: "base",
9703
- title: "Base Profile",
9704
- content: "You are a helpful assistant"
9705
- });
9706
- },
9707
- disableMastraOperation(state) {
9708
- state.features.mastra.enabled = false;
9709
- state.features.mastra.agentId = null;
9710
- state.features.mastra.agentName = null;
9711
- state.features.mastra.agentDescription = null;
9712
- state.features.mastra.agentImage = null;
9713
- state.features.mastra.models = [];
9714
- state.features.mastra.profiles = [];
9715
- state.features.mastra.common.enableChat = false;
9716
- const ccIdx = state.packages.findIndex((p) => p.packageName === "@powerhousedao/clint-common" && p.managed);
9717
- if (ccIdx !== -1) state.packages.splice(ccIdx, 1);
9718
- },
9719
- setAgentIdOperation(state, action) {
9720
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot set agent ID when Mastra is disabled.");
9721
- if (!/^[a-z][a-z0-9-]*$/.test(action.input.agentId)) throw new InvalidAgentIdError(`Invalid agent ID: ${action.input.agentId}. Must be lowercase kebab-case.`);
9722
- state.features.mastra.agentId = action.input.agentId;
9723
- },
9724
- setAgentNameOperation(state, action) {
9725
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot set agent name when Mastra is disabled.");
9726
- const trimmedName = action.input.agentName.trim();
9727
- if (!trimmedName) throw new InvalidAgentNameError("Agent name must not be empty.");
9728
- state.features.mastra.agentName = trimmedName;
9729
- },
9730
- addModelOperation(state, action) {
9731
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot add model when Mastra is disabled.");
9732
- 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.`);
9733
- if (state.features.mastra.models.find((m) => m.id === action.input.id)) throw new DuplicateModelError(`Model already exists: ${action.input.id}`);
9734
- const makeDefault = state.features.mastra.models.length === 0 || action.input.isDefault === true;
9735
- if (makeDefault) for (const m of state.features.mastra.models) m.isDefault = false;
9736
- state.features.mastra.models.push({
9737
- id: action.input.id,
9738
- isDefault: makeDefault
9739
- });
9740
- },
9741
- removeModelOperation(state, action) {
9742
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot remove model when Mastra is disabled.");
9743
- const idx = state.features.mastra.models.findIndex((m) => m.id === action.input.id);
9744
- if (idx === -1) throw new ModelNotFoundError(`Model not found: ${action.input.id}`);
9745
- const wasDefault = state.features.mastra.models[idx].isDefault;
9746
- state.features.mastra.models.splice(idx, 1);
9747
- if (wasDefault && state.features.mastra.models.length > 0) state.features.mastra.models[0].isDefault = true;
9748
- },
9749
- setDefaultModelOperation(state, action) {
9750
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot set default model when Mastra is disabled.");
9751
- const model = state.features.mastra.models.find((m) => m.id === action.input.id);
9752
- if (!model) throw new ModelNotFoundError(`Model not found: ${action.input.id}`);
9753
- for (const m of state.features.mastra.models) m.isDefault = false;
9754
- model.isDefault = true;
9755
- },
9756
- addProfileOperation(state, action) {
9757
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot add profile when Mastra is disabled.");
9758
- if (!/^[a-z][a-z0-9-]*$/.test(action.input.id)) throw new InvalidProfileIdError(`Invalid profile ID: ${action.input.id}. Must be lowercase kebab-case.`);
9759
- if (state.features.mastra.profiles.find((p) => p.id === action.input.id)) throw new DuplicateProfileError(`Profile already exists: ${action.input.id}`);
9760
- const profile = {
9761
- id: action.input.id,
9762
- title: action.input.title,
9763
- content: action.input.content
9764
- };
9765
- if (action.input.insertBefore) {
9766
- const beforeIdx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.insertBefore);
9767
- if (beforeIdx === -1) throw new ProfileNotFoundError(`insertBefore profile not found: ${action.input.insertBefore}`);
9768
- state.features.mastra.profiles.splice(beforeIdx, 0, profile);
9769
- } else state.features.mastra.profiles.push(profile);
9770
- },
9771
- updateProfileOperation(state, action) {
9772
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot update profile when Mastra is disabled.");
9773
- const profile = state.features.mastra.profiles.find((p) => p.id === action.input.id);
9774
- if (!profile) throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);
9775
- if (action.input.title) profile.title = action.input.title;
9776
- if (action.input.content) profile.content = action.input.content;
9777
- },
9778
- removeProfileOperation(state, action) {
9779
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot remove profile when Mastra is disabled.");
9780
- const idx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.id);
9781
- if (idx === -1) throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);
9782
- state.features.mastra.profiles.splice(idx, 1);
9783
- },
9784
- reorderProfilesOperation(state, action) {
9785
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot reorder profiles when Mastra is disabled.");
9786
- const moving = [];
9787
- for (const id of action.input.ids) {
9788
- const profile = state.features.mastra.profiles.find((p) => p.id === id);
9789
- if (!profile) throw new ProfileNotFoundError(`Profile not found: ${id}`);
9790
- moving.push(profile);
9791
- }
9792
- state.features.mastra.profiles = state.features.mastra.profiles.filter((p) => !action.input.ids.includes(p.id));
9793
- if (action.input.insertBefore) {
9794
- const beforeIdx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.insertBefore);
9795
- if (beforeIdx === -1) throw new ProfileNotFoundError(`insertBefore profile not found: ${action.input.insertBefore}`);
9796
- state.features.mastra.profiles.splice(beforeIdx, 0, ...moving);
9797
- } else state.features.mastra.profiles.push(...moving);
9798
- },
9799
- setAgentDescriptionOperation(state, action) {
9800
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot set agent description when Mastra is disabled.");
9801
- state.features.mastra.agentDescription = action.input.description;
9802
- },
9803
- setAgentImageOperation(state, action) {
9804
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot set agent image when Mastra is disabled.");
9805
- 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,...)");
9806
- state.features.mastra.agentImage = action.input.image;
9807
- },
9808
- clearAgentImageOperation(state, action) {
9809
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot clear agent image when Mastra is disabled.");
9810
- state.features.mastra.agentImage = null;
9811
- },
9812
- setEnableChatOperation(state, action) {
9813
- if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot toggle chat when Mastra is disabled.");
9814
- if (state.features.powerhouse === "Disabled") throw new PowerhouseNotEnabledError("Cannot toggle chat when Powerhouse is disabled.");
9815
- state.features.mastra.common.enableChat = action.input.enabled;
9816
- const CLINT_COMMON_PKG = "@powerhousedao/clint-common";
9817
- const CHAT_DOC_TYPE = "powerhouse/chat-session";
9818
- if (action.input.enabled) {
9819
- const existing = state.packages.find((p) => p.packageName === CLINT_COMMON_PKG);
9820
- if (!existing) state.packages.push({
9821
- id: "pkg-clint-common",
9822
- packageName: CLINT_COMMON_PKG,
9823
- documentTypes: [CHAT_DOC_TYPE],
9824
- version: null,
9825
- managed: true
9826
- });
9827
- else if (!existing.documentTypes.includes(CHAT_DOC_TYPE)) existing.documentTypes.push(CHAT_DOC_TYPE);
9828
- } else {
9829
- const idx = state.packages.findIndex((p) => p.packageName === CLINT_COMMON_PKG && p.managed);
9830
- if (idx !== -1) {
9831
- const pkg = state.packages[idx];
9832
- if (pkg.documentTypes.length === 1 && pkg.documentTypes[0] === CHAT_DOC_TYPE) state.packages.splice(idx, 1);
9833
- else {
9834
- const dtIdx = pkg.documentTypes.indexOf(CHAT_DOC_TYPE);
9835
- if (dtIdx !== -1) pkg.documentTypes.splice(dtIdx, 1);
9836
- }
9837
- }
9838
- }
9839
- }
9840
- };
9841
- //#endregion
9842
- //#region document-models/ph-clint-project/v1/src/reducers/features-routine.ts
9843
- const phClintProjectFeaturesRoutineOperations = {
9844
- enableRoutineOperation(state) {
9845
- state.features.routine.enabled = true;
9846
- },
9847
- disableRoutineOperation(state) {
9848
- state.features.routine.enabled = false;
9849
- }
9850
- };
9851
- //#endregion
9852
- //#region document-models/ph-clint-project/v1/gen/powerhouse-packages/error.ts
9853
- var DuplicatePackageError = class extends Error {
9854
- errorCode = "DuplicatePackageError";
9855
- constructor(message = "DuplicatePackageError") {
9856
- super(message);
9857
- }
9858
- };
9859
- var PackageNotFoundError = class extends Error {
9860
- errorCode = "PackageNotFoundError";
9861
- constructor(message = "PackageNotFoundError") {
9862
- super(message);
9863
- }
9864
- };
9865
- var CannotRemoveManagedPackageError = class extends Error {
9866
- errorCode = "CannotRemoveManagedPackageError";
9867
- constructor(message = "CannotRemoveManagedPackageError") {
9868
- super(message);
9869
- }
9870
- };
9871
- var InvalidDocumentTypeError = class extends Error {
9872
- errorCode = "InvalidDocumentTypeError";
9873
- constructor(message = "InvalidDocumentTypeError") {
9874
- super(message);
9875
- }
9876
- };
9877
- var DuplicateDocumentTypeError = class extends Error {
9878
- errorCode = "DuplicateDocumentTypeError";
9879
- constructor(message = "DuplicateDocumentTypeError") {
9880
- super(message);
9881
- }
9882
- };
9883
- var DocumentTypeNotFoundError = class extends Error {
9884
- errorCode = "DocumentTypeNotFoundError";
9885
- constructor(message = "DocumentTypeNotFoundError") {
9886
- super(message);
9887
- }
9888
- };
9889
- var InvalidVersionError$1 = class extends Error {
9890
- errorCode = "InvalidVersionError";
9891
- constructor(message = "InvalidVersionError") {
9892
- super(message);
9893
- }
9894
- };
9895
- //#endregion
9896
- //#region document-models/ph-clint-project/v1/src/reducers/powerhouse-packages.ts
9897
- const SEMVER = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
9898
- const phClintProjectPowerhousePackagesOperations = {
9899
- addPowerhousePackageOperation(state, action) {
9900
- if (state.packages.find((p) => p.id === action.input.id || p.packageName === action.input.packageName)) throw new DuplicatePackageError(`Package already exists: ${action.input.packageName}`);
9901
- state.packages.push({
9902
- id: action.input.id,
9903
- packageName: action.input.packageName,
9904
- documentTypes: [],
9905
- version: null,
9906
- managed: false
9907
- });
9908
- },
9909
- removePowerhousePackageOperation(state, action) {
9910
- const idx = state.packages.findIndex((p) => p.id === action.input.id);
9911
- if (idx === -1) throw new PackageNotFoundError(`Package not found: ${action.input.id}`);
9912
- if (state.packages[idx].managed) throw new CannotRemoveManagedPackageError("Cannot remove a managed package");
9913
- state.packages.splice(idx, 1);
9914
- },
9915
- addPackageDocumentTypeOperation(state, action) {
9916
- if (action.input.documentType !== "*/*" && !/^[a-z0-9-]+\/[a-z0-9-]+$/.test(action.input.documentType)) throw new InvalidDocumentTypeError(`Invalid document type format: ${action.input.documentType}. Expected org/name.`);
9917
- const pkg = state.packages.find((p) => p.id === action.input.packageId);
9918
- if (!pkg) throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);
9919
- if (action.input.documentType === "*/*") {
9920
- pkg.documentTypes.length = 0;
9921
- pkg.documentTypes.push("*/*");
9922
- return;
9923
- }
9924
- if (pkg.documentTypes.includes("*/*")) return;
9925
- if (pkg.documentTypes.includes(action.input.documentType)) throw new DuplicateDocumentTypeError(`Document type already registered: ${action.input.documentType}`);
9926
- pkg.documentTypes.push(action.input.documentType);
9927
- },
9928
- removePackageDocumentTypeOperation(state, action) {
9929
- const pkg = state.packages.find((p) => p.id === action.input.packageId);
9930
- if (!pkg) throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);
9931
- const idx = pkg.documentTypes.indexOf(action.input.documentType);
9932
- if (idx === -1) throw new DocumentTypeNotFoundError(`Document type not found: ${action.input.documentType}`);
9933
- pkg.documentTypes.splice(idx, 1);
9934
- },
9935
- setPackageVersionOperation(state, action) {
9936
- const pkg = state.packages.find((p) => p.id === action.input.packageId);
9937
- if (!pkg) throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);
9938
- if (action.input.version != null) {
9939
- if (!SEMVER.test(action.input.version)) throw new InvalidVersionError$1(`Invalid version: ${action.input.version}`);
9940
- }
9941
- pkg.version = action.input.version || null;
9942
- }
9943
- };
9944
- //#endregion
9945
- //#region document-models/ph-clint-project/v1/gen/external-skills/error.ts
9946
- var InvalidSkillNameError = class extends Error {
9947
- errorCode = "InvalidSkillNameError";
9948
- constructor(message = "InvalidSkillNameError") {
9949
- super(message);
9950
- }
9951
- };
9952
- var DuplicateSkillError = class extends Error {
9953
- errorCode = "DuplicateSkillError";
9954
- constructor(message = "DuplicateSkillError") {
9955
- super(message);
9956
- }
9957
- };
9958
- var SkillNotFoundError = class extends Error {
9959
- errorCode = "SkillNotFoundError";
9960
- constructor(message = "SkillNotFoundError") {
9961
- super(message);
9962
- }
9963
- };
9964
- //#endregion
9965
- //#region document-models/ph-clint-project/v1/src/reducers/external-skills.ts
9966
- const phClintProjectExternalSkillsOperations = {
9967
- addExternalSkillOperation(state, action) {
9968
- if (!/^[a-z][a-z0-9-]*$/.test(action.input.name)) throw new InvalidSkillNameError(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);
9969
- if (state.externalSkills.find((s) => s.id === action.input.id || s.name === action.input.name)) throw new DuplicateSkillError(`Skill already exists: ${action.input.name}`);
9970
- state.externalSkills.push({
9971
- id: action.input.id,
9972
- name: action.input.name,
9973
- githubUrl: action.input.githubUrl
9974
- });
9975
- },
9976
- removeExternalSkillOperation(state, action) {
9977
- const idx = state.externalSkills.findIndex((s) => s.id === action.input.id);
9978
- if (idx === -1) throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);
9979
- state.externalSkills.splice(idx, 1);
9980
- },
9981
- setExternalSkillNameOperation(state, action) {
9982
- const skill = state.externalSkills.find((s) => s.id === action.input.id);
9983
- if (!skill) throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);
9984
- if (!/^[a-z][a-z0-9-]*$/.test(action.input.name)) throw new InvalidSkillNameError(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);
9985
- 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}`);
9986
- skill.name = action.input.name;
9987
- },
9988
- setExternalSkillGithubUrlOperation(state, action) {
9989
- const skill = state.externalSkills.find((s) => s.id === action.input.id);
9990
- if (!skill) throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);
9991
- skill.githubUrl = action.input.githubUrl;
9992
- }
9993
- };
9994
- //#endregion
9995
- //#region document-models/ph-clint-project/v1/gen/publishing/error.ts
9996
- var InvalidVersionError = class extends Error {
9997
- errorCode = "InvalidVersionError";
9998
- constructor(message = "InvalidVersionError") {
9999
- super(message);
10000
- }
10001
- };
10002
- var PublishRecordNotFoundError = class extends Error {
10003
- errorCode = "PublishRecordNotFoundError";
10004
- constructor(message = "PublishRecordNotFoundError") {
10005
- super(message);
10006
- }
10007
- };
10008
- //#endregion
10009
- //#region document-models/ph-clint-project/v1/src/reducers/publishing.ts
10010
- const phClintProjectPublishingOperations = {
10011
- bumpVersionOperation(state, action) {
10012
- if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(action.input.version)) throw new InvalidVersionError(`Invalid version: ${action.input.version}`);
10013
- state.version = action.input.version;
10014
- },
10015
- publishDevOperation(state, action) {
10016
- state.publishHistory.push({
10017
- id: action.input.id,
10018
- tag: "Dev",
10019
- version: state.version,
10020
- timestamp: action.input.timestamp,
10021
- status: "Pending"
10022
- });
10023
- },
10024
- publishStagingOperation(state, action) {
10025
- state.publishHistory.push({
10026
- id: action.input.id,
10027
- tag: "Staging",
10028
- version: state.version,
10029
- timestamp: action.input.timestamp,
10030
- status: "Pending"
10031
- });
10032
- },
10033
- publishProductionOperation(state, action) {
10034
- state.publishHistory.push({
10035
- id: action.input.id,
10036
- tag: "Production",
10037
- version: state.version,
10038
- timestamp: action.input.timestamp,
10039
- status: "Pending"
10040
- });
10041
- },
10042
- setPublishStatusOperation(state, action) {
10043
- const record = state.publishHistory.find((r) => r.id === action.input.id);
10044
- if (!record) throw new PublishRecordNotFoundError(`Publish record not found: ${action.input.id}`);
10045
- record.status = action.input.status;
10046
- }
10047
- };
10048
- //#endregion
10049
- //#region document-models/ph-clint-project/v1/src/reducers/lifecycle.ts
10050
- const phClintProjectLifecycleOperations = { importSpecOperation(state, action) {
10051
- state.name = action.input.name;
10052
- state.scope = action.input.scope || null;
10053
- state.version = action.input.version;
10054
- state.description = action.input.description;
10055
- state.features.powerhouse = action.input.powerhouse;
10056
- state.features.mastra.enabled = action.input.mastraEnabled;
10057
- state.features.routine.enabled = action.input.routineEnabled;
10058
- const appBase = action.input.name.replace(/-cli$/, "-app");
10059
- const appPkgName = action.input.scope ? `${action.input.scope}/${appBase}` : appBase;
10060
- const phEnabled = action.input.powerhouse !== "Disabled";
10061
- state.packages = action.input.packages.map((p) => ({
10062
- id: p.id,
10063
- packageName: p.packageName,
10064
- documentTypes: [...p.documentTypes],
10065
- version: p.version || null,
10066
- managed: phEnabled && p.packageName === appPkgName
10067
- }));
10068
- state.externalSkills = action.input.externalSkills.map((s) => ({
10069
- id: s.id,
10070
- name: s.name,
10071
- githubUrl: s.githubUrl
10072
- }));
10073
- state.features.mastra.agentId = action.input.agentId || null;
10074
- state.features.mastra.agentName = action.input.agentName || null;
10075
- state.features.mastra.models = (action.input.models || []).map((m) => ({
10076
- id: m.id,
10077
- isDefault: m.isDefault
10078
- }));
10079
- state.features.mastra.profiles = (action.input.profiles || []).map((p) => ({
10080
- id: p.id,
10081
- title: p.title,
10082
- content: p.content
10083
- }));
10084
- if (action.input.agentDescription && state.features.mastra.enabled) state.features.mastra.agentDescription = action.input.agentDescription;
10085
- else state.features.mastra.agentDescription = null;
10086
- if (action.input.agentImage && state.features.mastra.enabled) {
10087
- 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,...)");
10088
- state.features.mastra.agentImage = action.input.agentImage;
10089
- } else state.features.mastra.agentImage = null;
10090
- if (action.input.enableChat && state.features.mastra.enabled && state.features.powerhouse !== "Disabled") {
10091
- state.features.mastra.common.enableChat = true;
10092
- const CLINT_COMMON_PKG = "@powerhousedao/clint-common";
10093
- const CHAT_DOC_TYPE = "powerhouse/chat-session";
10094
- const existing = state.packages.find((p) => p.packageName === CLINT_COMMON_PKG);
10095
- if (!existing) state.packages.push({
10096
- id: "pkg-clint-common",
10097
- packageName: CLINT_COMMON_PKG,
10098
- documentTypes: [CHAT_DOC_TYPE],
10099
- version: null,
10100
- managed: true
10101
- });
10102
- else if (!existing.documentTypes.includes(CHAT_DOC_TYPE)) existing.documentTypes.push(CHAT_DOC_TYPE);
10103
- } else state.features.mastra.common.enableChat = false;
10104
- state.deployment.proxyEnabled = action.input.proxyEnabled ?? false;
10105
- state.deployment.supportedResources = action.input.supportedResources ? [...action.input.supportedResources] : [];
10106
- } };
10107
- //#endregion
10108
- //#region document-models/ph-clint-project/v1/gen/deployment/error.ts
10109
- var DuplicateResourceError = class extends Error {
10110
- errorCode = "DuplicateResourceError";
10111
- constructor(message = "DuplicateResourceError") {
10112
- super(message);
10113
- }
10114
- };
10115
- var ResourceNotFoundError = class extends Error {
10116
- errorCode = "ResourceNotFoundError";
10117
- constructor(message = "ResourceNotFoundError") {
10118
- super(message);
10119
- }
10120
- };
10121
- //#endregion
10122
- //#region document-models/ph-clint-project/v1/src/reducers/deployment.ts
10123
- const phClintProjectDeploymentOperations = {
10124
- addSupportedResourceOperation(state, action) {
10125
- if (state.deployment.supportedResources.includes(action.input.resource)) throw new DuplicateResourceError(`Resource already exists: ${action.input.resource}`);
10126
- state.deployment.supportedResources.push(action.input.resource);
10127
- },
10128
- removeSupportedResourceOperation(state, action) {
10129
- const idx = state.deployment.supportedResources.indexOf(action.input.resource);
10130
- if (idx === -1) throw new ResourceNotFoundError(`Resource not found: ${action.input.resource}`);
10131
- state.deployment.supportedResources.splice(idx, 1);
10132
- },
10133
- setProxyEnabledOperation(state, action) {
10134
- state.deployment.proxyEnabled = action.input.enabled;
10135
- }
10136
- };
10137
- //#endregion
10138
8672
  //#region document-models/ph-clint-project/v1/gen/schema/zod.ts
10139
8673
  const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
10140
8674
  const definedNonNullAnySchema = any().refine((v) => isDefinedNonNullAny(v));
@@ -10260,6 +8794,7 @@ function ImportSpecInputSchema() {
10260
8794
  mastraEnabled: boolean(),
10261
8795
  models: array(lazy(() => ImportModelInputSchema())).nullish(),
10262
8796
  name: string(),
8797
+ observabilityEnabled: boolean().nullish(),
10263
8798
  packages: array(lazy(() => ImportPackageInputSchema())),
10264
8799
  powerhouse: PowerhouseLevelSchema,
10265
8800
  profiles: array(lazy(() => ImportProfileInputSchema())).nullish(),
@@ -10288,6 +8823,7 @@ function PhClintAgentProfileSchema() {
10288
8823
  function PhClintDeploymentSchema() {
10289
8824
  return object({
10290
8825
  __typename: literal("PhClintDeployment").optional(),
8826
+ observabilityEnabled: boolean(),
10291
8827
  proxyEnabled: boolean(),
10292
8828
  supportedResources: array(string())
10293
8829
  });
@@ -10437,6 +8973,9 @@ function SetExternalSkillNameInputSchema() {
10437
8973
  name: string()
10438
8974
  });
10439
8975
  }
8976
+ function SetObservabilityEnabledInputSchema() {
8977
+ return object({ enabled: boolean() });
8978
+ }
10440
8979
  function SetPackageIdentifierInputSchema() {
10441
8980
  return object({ identifier: string() });
10442
8981
  }
@@ -10472,6 +9011,1654 @@ function UpdateProfileInputSchema() {
10472
9011
  });
10473
9012
  }
10474
9013
  //#endregion
9014
+ //#region document-models/ph-clint-project/v1/gen/deployment/creators.ts
9015
+ /**
9016
+ * WARNING: DO NOT EDIT
9017
+ * This file is auto-generated and updated by codegen
9018
+ */
9019
+ var creators_exports$8 = /* @__PURE__ */ __exportAll({
9020
+ addSupportedResource: () => addSupportedResource,
9021
+ removeSupportedResource: () => removeSupportedResource,
9022
+ setObservabilityEnabled: () => setObservabilityEnabled,
9023
+ setProxyEnabled: () => setProxyEnabled
9024
+ });
9025
+ const addSupportedResource = (input) => createAction("ADD_SUPPORTED_RESOURCE", { ...input }, void 0, AddSupportedResourceInputSchema, "global");
9026
+ const removeSupportedResource = (input) => createAction("REMOVE_SUPPORTED_RESOURCE", { ...input }, void 0, RemoveSupportedResourceInputSchema, "global");
9027
+ const setProxyEnabled = (input) => createAction("SET_PROXY_ENABLED", { ...input }, void 0, SetProxyEnabledInputSchema, "global");
9028
+ const setObservabilityEnabled = (input) => createAction("SET_OBSERVABILITY_ENABLED", { ...input }, void 0, SetObservabilityEnabledInputSchema, "global");
9029
+ //#endregion
9030
+ //#region document-models/ph-clint-project/v1/gen/external-skills/creators.ts
9031
+ /**
9032
+ * WARNING: DO NOT EDIT
9033
+ * This file is auto-generated and updated by codegen
9034
+ */
9035
+ var creators_exports$7 = /* @__PURE__ */ __exportAll({
9036
+ addExternalSkill: () => addExternalSkill,
9037
+ removeExternalSkill: () => removeExternalSkill,
9038
+ setExternalSkillGithubUrl: () => setExternalSkillGithubUrl,
9039
+ setExternalSkillName: () => setExternalSkillName
9040
+ });
9041
+ const addExternalSkill = (input) => createAction("ADD_EXTERNAL_SKILL", { ...input }, void 0, AddExternalSkillInputSchema, "global");
9042
+ const removeExternalSkill = (input) => createAction("REMOVE_EXTERNAL_SKILL", { ...input }, void 0, RemoveExternalSkillInputSchema, "global");
9043
+ const setExternalSkillName = (input) => createAction("SET_EXTERNAL_SKILL_NAME", { ...input }, void 0, SetExternalSkillNameInputSchema, "global");
9044
+ const setExternalSkillGithubUrl = (input) => createAction("SET_EXTERNAL_SKILL_GITHUB_URL", { ...input }, void 0, SetExternalSkillGithubUrlInputSchema, "global");
9045
+ //#endregion
9046
+ //#region document-models/ph-clint-project/v1/gen/features-mastra/creators.ts
9047
+ /**
9048
+ * WARNING: DO NOT EDIT
9049
+ * This file is auto-generated and updated by codegen
9050
+ */
9051
+ var creators_exports$6 = /* @__PURE__ */ __exportAll({
9052
+ addModel: () => addModel,
9053
+ addProfile: () => addProfile,
9054
+ clearAgentImage: () => clearAgentImage,
9055
+ disableMastra: () => disableMastra,
9056
+ 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
9067
+ });
9068
+ const enableMastra = (input) => createAction("ENABLE_MASTRA", { ...input }, void 0, EnableMastraInputSchema, "global");
9069
+ 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
+ const setEnableChat = (input) => createAction("SET_ENABLE_CHAT", { ...input }, void 0, SetEnableChatInputSchema, "global");
9083
+ //#endregion
9084
+ //#region document-models/ph-clint-project/v1/gen/features-powerhouse/creators.ts
9085
+ /**
9086
+ * WARNING: DO NOT EDIT
9087
+ * This file is auto-generated and updated by codegen
9088
+ */
9089
+ var creators_exports$5 = /* @__PURE__ */ __exportAll({ setPowerhouseLevel: () => setPowerhouseLevel });
9090
+ const setPowerhouseLevel = (input) => createAction("SET_POWERHOUSE_LEVEL", { ...input }, void 0, SetPowerhouseLevelInputSchema, "global");
9091
+ //#endregion
9092
+ //#region document-models/ph-clint-project/v1/gen/features-routine/creators.ts
9093
+ /**
9094
+ * WARNING: DO NOT EDIT
9095
+ * This file is auto-generated and updated by codegen
9096
+ */
9097
+ var creators_exports$4 = /* @__PURE__ */ __exportAll({
9098
+ disableRoutine: () => disableRoutine,
9099
+ enableRoutine: () => enableRoutine
9100
+ });
9101
+ const enableRoutine = (input) => createAction("ENABLE_ROUTINE", { ...input }, void 0, EnableRoutineInputSchema, "global");
9102
+ const disableRoutine = (input) => createAction("DISABLE_ROUTINE", { ...input }, void 0, DisableRoutineInputSchema, "global");
9103
+ //#endregion
9104
+ //#region document-models/ph-clint-project/v1/gen/identity/creators.ts
9105
+ /**
9106
+ * WARNING: DO NOT EDIT
9107
+ * This file is auto-generated and updated by codegen
9108
+ */
9109
+ var creators_exports$3 = /* @__PURE__ */ __exportAll({
9110
+ setDescription: () => setDescription,
9111
+ setPackageIdentifier: () => setPackageIdentifier,
9112
+ setVersion: () => setVersion
9113
+ });
9114
+ const setDescription = (input) => createAction("SET_DESCRIPTION", { ...input }, void 0, SetDescriptionInputSchema, "global");
9115
+ const setVersion = (input) => createAction("SET_VERSION", { ...input }, void 0, SetVersionInputSchema, "global");
9116
+ const setPackageIdentifier = (input) => createAction("SET_PACKAGE_IDENTIFIER", { ...input }, void 0, SetPackageIdentifierInputSchema, "global");
9117
+ //#endregion
9118
+ //#region document-models/ph-clint-project/v1/gen/lifecycle/creators.ts
9119
+ /**
9120
+ * WARNING: DO NOT EDIT
9121
+ * This file is auto-generated and updated by codegen
9122
+ */
9123
+ var creators_exports$2 = /* @__PURE__ */ __exportAll({ importSpec: () => importSpec });
9124
+ const importSpec = (input) => createAction("IMPORT_SPEC", { ...input }, void 0, ImportSpecInputSchema, "global");
9125
+ //#endregion
9126
+ //#region document-models/ph-clint-project/v1/gen/powerhouse-packages/creators.ts
9127
+ /**
9128
+ * WARNING: DO NOT EDIT
9129
+ * This file is auto-generated and updated by codegen
9130
+ */
9131
+ var creators_exports$1 = /* @__PURE__ */ __exportAll({
9132
+ addPackageDocumentType: () => addPackageDocumentType,
9133
+ addPowerhousePackage: () => addPowerhousePackage,
9134
+ removePackageDocumentType: () => removePackageDocumentType,
9135
+ removePowerhousePackage: () => removePowerhousePackage,
9136
+ setPackageVersion: () => setPackageVersion
9137
+ });
9138
+ const addPowerhousePackage = (input) => createAction("ADD_POWERHOUSE_PACKAGE", { ...input }, void 0, AddPowerhousePackageInputSchema, "global");
9139
+ const removePowerhousePackage = (input) => createAction("REMOVE_POWERHOUSE_PACKAGE", { ...input }, void 0, RemovePowerhousePackageInputSchema, "global");
9140
+ const addPackageDocumentType = (input) => createAction("ADD_PACKAGE_DOCUMENT_TYPE", { ...input }, void 0, AddPackageDocumentTypeInputSchema, "global");
9141
+ const removePackageDocumentType = (input) => createAction("REMOVE_PACKAGE_DOCUMENT_TYPE", { ...input }, void 0, RemovePackageDocumentTypeInputSchema, "global");
9142
+ const setPackageVersion = (input) => createAction("SET_PACKAGE_VERSION", { ...input }, void 0, SetPackageVersionInputSchema, "global");
9143
+ //#endregion
9144
+ //#region document-models/ph-clint-project/v1/gen/publishing/creators.ts
9145
+ /**
9146
+ * WARNING: DO NOT EDIT
9147
+ * This file is auto-generated and updated by codegen
9148
+ */
9149
+ var creators_exports = /* @__PURE__ */ __exportAll({
9150
+ bumpVersion: () => bumpVersion,
9151
+ publishDev: () => publishDev,
9152
+ publishProduction: () => publishProduction,
9153
+ publishStaging: () => publishStaging,
9154
+ setPublishStatus: () => setPublishStatus
9155
+ });
9156
+ const bumpVersion = (input) => createAction("BUMP_VERSION", { ...input }, void 0, BumpVersionInputSchema, "global");
9157
+ const publishDev = (input) => createAction("PUBLISH_DEV", { ...input }, void 0, PublishDevInputSchema, "global");
9158
+ const publishStaging = (input) => createAction("PUBLISH_STAGING", { ...input }, void 0, PublishStagingInputSchema, "global");
9159
+ const publishProduction = (input) => createAction("PUBLISH_PRODUCTION", { ...input }, void 0, PublishProductionInputSchema, "global");
9160
+ const setPublishStatus = (input) => createAction("SET_PUBLISH_STATUS", { ...input }, void 0, SetPublishStatusInputSchema, "global");
9161
+ //#endregion
9162
+ //#region document-models/ph-clint-project/v1/actions.ts
9163
+ /**
9164
+ * WARNING: DO NOT EDIT
9165
+ * This file is auto-generated and updated by codegen
9166
+ */
9167
+ /** Actions for the PhClintProject document model */
9168
+ const actions = {
9169
+ ...baseActions,
9170
+ ...creators_exports$3,
9171
+ ...creators_exports$5,
9172
+ ...creators_exports$6,
9173
+ ...creators_exports$4,
9174
+ ...creators_exports$1,
9175
+ ...creators_exports$7,
9176
+ ...creators_exports,
9177
+ ...creators_exports$2,
9178
+ ...creators_exports$8
9179
+ };
9180
+ //#endregion
9181
+ //#region document-models/ph-clint-project/v1/gen/document-model.ts
9182
+ const documentModel = {
9183
+ id: "powerhouse/ph-clint-project",
9184
+ name: "PhClintProject",
9185
+ author: {
9186
+ name: "Powerhouse Inc.",
9187
+ website: "https://powerhouse.inc"
9188
+ },
9189
+ extension: "pcp",
9190
+ description: "A ph-clint implementation project specification. Drives code generation of a ph-clint CLI project: identity fields (name, scope, version, description, bin) plus three feature toggles (Powerhouse, Mastra, Routine). Enabling Powerhouse is irreversible; enabling Mastra auto-enables Routine; disabling Routine is blocked while Mastra is on.",
9191
+ specifications: [{
9192
+ state: {
9193
+ local: {
9194
+ schema: "",
9195
+ examples: [],
9196
+ initialValue: ""
9197
+ },
9198
+ 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}",
9200
+ 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}"
9202
+ }
9203
+ },
9204
+ modules: [
9205
+ {
9206
+ id: "m-identity",
9207
+ name: "identity",
9208
+ description: "Package identity fields: name, scope, version, description, bin",
9209
+ operations: [
9210
+ {
9211
+ id: "o-set-description",
9212
+ name: "SET_DESCRIPTION",
9213
+ description: "Set the package description.",
9214
+ schema: "input SetDescriptionInput {\n description: String!\n}",
9215
+ template: "Set the package description.",
9216
+ reducer: "state.description = action.input.description;",
9217
+ errors: [],
9218
+ examples: [],
9219
+ scope: "global"
9220
+ },
9221
+ {
9222
+ id: "o-set-version",
9223
+ name: "SET_VERSION",
9224
+ description: "Set the package version. Must be a valid semver string.",
9225
+ schema: "input SetVersionInput {\n version: String!\n}",
9226
+ template: "Set the package version. Must be a valid semver string.",
9227
+ 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;",
9228
+ errors: [{
9229
+ id: "e-set-version-invalid",
9230
+ name: "InvalidVersionError",
9231
+ code: "INVALID_VERSION",
9232
+ description: "The version must be a valid semver string (major.minor.patch, optionally with prerelease/build metadata).",
9233
+ template: "Invalid version: {{version}}"
9234
+ }],
9235
+ examples: [],
9236
+ scope: "global"
9237
+ },
9238
+ {
9239
+ id: "o-set-package-identifier",
9240
+ name: "SET_PACKAGE_IDENTIFIER",
9241
+ description: "Set the package identifier. Parses scope and name from a string like '@scope/name-cli' or just 'name-cli'. Auto-adds '-cli' suffix if missing, stores scope with '@' prefix.",
9242
+ schema: "input SetPackageIdentifierInput {\n identifier: String!\n}",
9243
+ template: "Set the package identifier. Parses scope and name from a string like '@scope/name-cli' or just 'name-cli'.",
9244
+ reducer: "const trimmed = action.input.identifier.trim();\nif (!trimmed) {\n throw new InvalidPackageIdentifierError('Package identifier must not be empty');\n}\nlet scopePart = null;\nlet namePart = trimmed;\nif (trimmed.includes('/')) {\n const parts = trimmed.split('/');\n if (parts.length !== 2 || !parts[0] || !parts[1]) {\n throw new InvalidPackageIdentifierError(`Invalid package identifier: ${trimmed}`);\n }\n scopePart = parts[0].replace(/^@/, '');\n namePart = parts[1];\n}\nif (scopePart !== null) {\n if (!/^[a-z][a-z0-9-]*$/.test(scopePart)) {\n throw new InvalidPackageIdentifierError(`Invalid scope: ${scopePart}`);\n }\n}\nif (!namePart.endsWith('-cli')) {\n namePart = namePart + '-cli';\n}\nif (!/^[a-z][a-z0-9-]*$/.test(namePart)) {\n throw new InvalidPackageIdentifierError(`Invalid package name: ${namePart}`);\n}\nstate.scope = scopePart ? `@${scopePart}` : null;\nstate.name = namePart;\nconst managed = state.packages.find((p) => p.managed);\nif (managed) {\n const appBase = namePart.replace(/-cli$/, '-app');\n managed.packageName = scopePart ? `@${scopePart}/${appBase}` : appBase;\n managed.id = `app-${namePart}`;\n}",
9245
+ errors: [{
9246
+ id: "e-invalid-package-identifier",
9247
+ name: "InvalidPackageIdentifierError",
9248
+ code: "INVALID_PACKAGE_IDENTIFIER",
9249
+ description: "The package identifier is invalid. Must be a valid npm package name with optional scope.",
9250
+ template: ""
9251
+ }],
9252
+ examples: [],
9253
+ scope: "global"
9254
+ }
9255
+ ]
9256
+ },
9257
+ {
9258
+ id: "m-features-powerhouse",
9259
+ name: "features_powerhouse",
9260
+ description: "Powerhouse integration level. Ordered enum: Disabled < Reactor < Switchboard < Connect. Once above Disabled, cannot go back to Disabled (irreversible migration).",
9261
+ operations: [{
9262
+ id: "o-set-powerhouse-level",
9263
+ name: "SET_POWERHOUSE_LEVEL",
9264
+ description: "Set the Powerhouse integration level. Ordered: Disabled < Reactor < Switchboard < Connect. Lowering below Reactor once above Disabled is not allowed (irreversible migration).",
9265
+ schema: "input SetPowerhouseLevelInput {\n level: PowerhouseLevel!\n skipAutoProxy: Boolean\n}",
9266
+ template: "Set the Powerhouse integration level. Ordered: Disabled < Reactor < Switchboard < Connect. Lowering below Reactor once above Disabled is not allowed (irreversible migration).",
9267
+ reducer: "const LEVELS = ['Disabled', 'Reactor', 'Switchboard', 'Connect'];\nconst current = LEVELS.indexOf(state.features.powerhouse);\nconst next = LEVELS.indexOf(action.input.level);\nif (current >= 1 && next < 1) {\n throw new CannotLowerPowerhouseError(\n 'Cannot lower Powerhouse level below Reactor once enabled',\n );\n}\nstate.features.powerhouse = action.input.level;\nif (current === 0 && next >= 1) {\n const hasManaged = state.packages.some((p) => p.managed);\n if (!hasManaged) {\n const baseName = state.name\n ? state.name.replace(/-cli$/, '-app')\n : 'app';\n const appName =\n state.scope && state.name\n ? `${state.scope}/${baseName}`\n : baseName;\n state.packages.push({\n id: `app-${state.name || 'managed'}`,\n packageName: appName,\n documentTypes: ['*/*'],\n version: null,\n managed: true,\n });\n }\n}\nif (next >= 2 && !action.input.skipAutoProxy) {\n state.deployment.proxyEnabled = true;\n}",
9268
+ errors: [{
9269
+ id: "e-cannot-lower-powerhouse",
9270
+ name: "CannotLowerPowerhouseError",
9271
+ code: "CANNOT_LOWER_POWERHOUSE",
9272
+ description: "Cannot lower the Powerhouse level below Reactor once it has been set above Disabled.",
9273
+ template: "Cannot lower Powerhouse level below Reactor once enabled"
9274
+ }],
9275
+ examples: [],
9276
+ scope: "global"
9277
+ }]
9278
+ },
9279
+ {
9280
+ id: "m-features-mastra",
9281
+ name: "features_mastra",
9282
+ description: "Mastra agent feature toggle. Orthogonal to Routine.",
9283
+ operations: [
9284
+ {
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}",
9291
+ 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.",
9302
+ template: ""
9303
+ }],
9304
+ examples: [],
9305
+ scope: "global"
9306
+ },
9307
+ {
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: [],
9315
+ examples: [],
9316
+ scope: "global"
9317
+ },
9318
+ {
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});",
9371
+ errors: [
9372
+ {
9373
+ id: "e-add-model-not-enabled",
9374
+ name: "MastraNotEnabledError",
9375
+ code: "MASTRA_NOT_ENABLED",
9376
+ description: "Mastra must be enabled before managing models.",
9377
+ template: ""
9378
+ },
9379
+ {
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.",
9384
+ template: ""
9385
+ },
9386
+ {
9387
+ id: "e-add-model-duplicate",
9388
+ name: "DuplicateModelError",
9389
+ code: "DUPLICATE_MODEL",
9390
+ description: "A model with this ID already exists.",
9391
+ template: ""
9392
+ }
9393
+ ],
9394
+ examples: [],
9395
+ scope: "global"
9396
+ },
9397
+ {
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}",
9404
+ 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.",
9409
+ template: ""
9410
+ }, {
9411
+ id: "e-remove-model-not-found",
9412
+ name: "ModelNotFoundError",
9413
+ code: "MODEL_NOT_FOUND",
9414
+ description: "The specified model was not found.",
9415
+ template: ""
9416
+ }],
9417
+ examples: [],
9418
+ scope: "global"
9419
+ },
9420
+ {
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;",
9427
+ 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.",
9432
+ template: ""
9433
+ }, {
9434
+ id: "e-set-default-model-not-found",
9435
+ name: "ModelNotFoundError",
9436
+ code: "MODEL_NOT_FOUND",
9437
+ description: "The specified model was not found.",
9438
+ template: ""
9439
+ }],
9440
+ examples: [],
9441
+ scope: "global"
9442
+ },
9443
+ {
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}",
9450
+ errors: [
9451
+ {
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.",
9463
+ template: ""
9464
+ },
9465
+ {
9466
+ id: "e-add-profile-duplicate",
9467
+ name: "DuplicateProfileError",
9468
+ code: "DUPLICATE_PROFILE",
9469
+ description: "A profile with this ID already exists.",
9470
+ template: ""
9471
+ },
9472
+ {
9473
+ id: "e-add-profile-not-found",
9474
+ name: "ProfileNotFoundError",
9475
+ code: "PROFILE_NOT_FOUND",
9476
+ description: "The insertBefore profile was not found.",
9477
+ template: ""
9478
+ }
9479
+ ],
9480
+ examples: [],
9481
+ scope: "global"
9482
+ },
9483
+ {
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);",
9513
+ 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.",
9524
+ template: ""
9525
+ }],
9526
+ examples: [],
9527
+ scope: "global"
9528
+ },
9529
+ {
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}",
9536
+ 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.",
9547
+ template: ""
9548
+ }],
9549
+ examples: [],
9550
+ scope: "global"
9551
+ },
9552
+ {
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
+ }],
9566
+ examples: [],
9567
+ scope: "global"
9568
+ },
9569
+ {
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;",
9576
+ 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.",
9581
+ 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",
9587
+ template: ""
9588
+ }],
9589
+ examples: [],
9590
+ scope: "global"
9591
+ },
9592
+ {
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;",
9599
+ errors: [{
9600
+ id: "e-mastra-not-enabled-clear-img",
9601
+ name: "MastraNotEnabledError",
9602
+ code: "MASTRA_NOT_ENABLED",
9603
+ description: "Mastra must be enabled",
9604
+ template: ""
9605
+ }],
9606
+ examples: [],
9607
+ scope: "global"
9608
+ },
9609
+ {
9610
+ id: "o-set-enable-chat",
9611
+ name: "SET_ENABLE_CHAT",
9612
+ description: "Enable or disable the chat integration. When enabled, auto-adds @powerhousedao/clint-common as a managed package with powerhouse/chat-session doc type. When disabled, removes it if it only has that doc type.",
9613
+ schema: "input SetEnableChatInput {\n enabled: Boolean!\n}",
9614
+ template: "Toggle the chat integration feature. Requires both Mastra and Powerhouse to be enabled.",
9615
+ reducer: "if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot toggle chat when Mastra is disabled.');\n}\nif (state.features.powerhouse === 'Disabled') {\n throw new PowerhouseNotEnabledError('Cannot toggle chat when Powerhouse is disabled.');\n}\nstate.features.mastra.common.enableChat = action.input.enabled;\nconst CLINT_COMMON_PKG = '@powerhousedao/clint-common';\nconst CHAT_DOC_TYPE = 'powerhouse/chat-session';\nif (action.input.enabled) {\n const existing = state.packages.find((p) => p.packageName === CLINT_COMMON_PKG);\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 const idx = state.packages.findIndex(\n (p) => p.packageName === CLINT_COMMON_PKG && p.managed,\n );\n if (idx !== -1) {\n const pkg = state.packages[idx];\n if (pkg.documentTypes.length === 1 && pkg.documentTypes[0] === CHAT_DOC_TYPE) {\n state.packages.splice(idx, 1);\n } else {\n const dtIdx = pkg.documentTypes.indexOf(CHAT_DOC_TYPE);\n if (dtIdx !== -1) pkg.documentTypes.splice(dtIdx, 1);\n }\n }\n}",
9616
+ errors: [{
9617
+ id: "e-chat-mastra-not-enabled",
9618
+ name: "MastraNotEnabledError",
9619
+ code: "MASTRA_NOT_ENABLED",
9620
+ description: "Mastra must be enabled before toggling chat.",
9621
+ template: ""
9622
+ }, {
9623
+ id: "e-chat-powerhouse-not-enabled",
9624
+ name: "PowerhouseNotEnabledError",
9625
+ code: "POWERHOUSE_NOT_ENABLED",
9626
+ description: "Powerhouse must be enabled (Reactor or above) before toggling chat.",
9627
+ template: ""
9628
+ }],
9629
+ examples: [],
9630
+ scope: "global"
9631
+ }
9632
+ ]
9633
+ },
9634
+ {
9635
+ id: "m-features-routine",
9636
+ name: "features_routine",
9637
+ description: "Routine loop feature toggle.",
9638
+ 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: [],
9646
+ examples: [],
9647
+ scope: "global"
9648
+ }, {
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: [],
9656
+ examples: [],
9657
+ scope: "global"
9658
+ }]
9659
+ },
9660
+ {
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.",
9664
+ operations: [
9665
+ {
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);",
9689
+ errors: [
9690
+ {
9691
+ id: "e-package-not-found-remove",
9692
+ name: "PackageNotFoundError",
9693
+ code: "PACKAGE_NOT_FOUND",
9694
+ description: "The specified package ID was not found.",
9695
+ template: ""
9696
+ },
9697
+ {
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.",
9702
+ template: ""
9703
+ },
9704
+ {
9705
+ id: "e-cannot-remove-managed",
9706
+ name: "CannotRemoveManagedPackageError",
9707
+ code: "CANNOT_REMOVE_MANAGED_PACKAGE",
9708
+ description: "Cannot remove a managed (framework-controlled) package",
9709
+ template: ""
9710
+ }
9711
+ ],
9712
+ examples: [],
9713
+ scope: "global"
9714
+ },
9715
+ {
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.",
9735
+ template: ""
9736
+ },
9737
+ {
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.",
9742
+ template: ""
9743
+ }
9744
+ ],
9745
+ examples: [],
9746
+ scope: "global"
9747
+ },
9748
+ {
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);",
9755
+ 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.",
9760
+ template: ""
9761
+ }, {
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.",
9766
+ template: ""
9767
+ }],
9768
+ examples: [],
9769
+ scope: "global"
9770
+ },
9771
+ {
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;",
9778
+ errors: [{
9779
+ id: "e-pkg-not-found-set-ver",
9780
+ name: "PackageNotFoundError",
9781
+ code: "PACKAGE_NOT_FOUND",
9782
+ description: "Referenced package does not exist",
9783
+ template: ""
9784
+ }, {
9785
+ id: "e-invalid-version",
9786
+ name: "InvalidVersionError",
9787
+ code: "INVALID_VERSION",
9788
+ description: "Version string is not valid semver",
9789
+ template: ""
9790
+ }],
9791
+ examples: [],
9792
+ scope: "global"
9793
+ }
9794
+ ]
9795
+ },
9796
+ {
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.",
9800
+ operations: [
9801
+ {
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
+ }],
9821
+ examples: [],
9822
+ scope: "global"
9823
+ },
9824
+ {
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);",
9831
+ 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.",
9836
+ template: ""
9837
+ }],
9838
+ examples: [],
9839
+ scope: "global"
9840
+ },
9841
+ {
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;",
9848
+ errors: [
9849
+ {
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.",
9854
+ template: ""
9855
+ },
9856
+ {
9857
+ id: "e-invalid-skill-name-set",
9858
+ name: "InvalidSkillNameError",
9859
+ code: "INVALID_SKILL_NAME",
9860
+ description: "Skill name must be lowercase kebab-case.",
9861
+ template: ""
9862
+ },
9863
+ {
9864
+ id: "e-duplicate-skill-set-name",
9865
+ name: "DuplicateSkillError",
9866
+ code: "DUPLICATE_SKILL",
9867
+ description: "Another skill already uses this name.",
9868
+ template: ""
9869
+ }
9870
+ ],
9871
+ examples: [],
9872
+ scope: "global"
9873
+ },
9874
+ {
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;",
9881
+ 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.",
9886
+ template: ""
9887
+ }],
9888
+ examples: [],
9889
+ scope: "global"
9890
+ }
9891
+ ]
9892
+ },
9893
+ {
9894
+ id: "m-publishing",
9895
+ name: "publishing",
9896
+ description: "Version bumping and publish records. Tracks dev/staging/production publish intents and their status.",
9897
+ operations: [
9898
+ {
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
+ }],
9912
+ examples: [],
9913
+ scope: "global"
9914
+ },
9915
+ {
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: [],
9934
+ examples: [],
9935
+ scope: "global"
9936
+ },
9937
+ {
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: [],
9945
+ examples: [],
9946
+ scope: "global"
9947
+ },
9948
+ {
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
+ }],
9962
+ examples: [],
9963
+ 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: [
9988
+ {
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
+ }],
10002
+ examples: [],
10003
+ scope: "global"
10004
+ },
10005
+ {
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
+ }],
10019
+ examples: [],
10020
+ scope: "global"
10021
+ },
10022
+ {
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: [],
10030
+ examples: [],
10031
+ scope: "global"
10032
+ },
10033
+ {
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: [],
10041
+ examples: [],
10042
+ scope: "global"
10043
+ }
10044
+ ]
10045
+ }
10046
+ ],
10047
+ version: 1,
10048
+ changeLog: []
10049
+ }]
10050
+ };
10051
+ //#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") {
10056
+ super(message);
10057
+ }
10058
+ };
10059
+ var ResourceNotFoundError = class extends Error {
10060
+ errorCode = "ResourceNotFoundError";
10061
+ constructor(message = "ResourceNotFoundError") {
10062
+ super(message);
10063
+ }
10064
+ };
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;
10082
+ }
10083
+ };
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") {
10089
+ super(message);
10090
+ }
10091
+ };
10092
+ var DuplicateSkillError = class extends Error {
10093
+ errorCode = "DuplicateSkillError";
10094
+ constructor(message = "DuplicateSkillError") {
10095
+ super(message);
10096
+ }
10097
+ };
10098
+ var SkillNotFoundError = class extends Error {
10099
+ errorCode = "SkillNotFoundError";
10100
+ constructor(message = "SkillNotFoundError") {
10101
+ super(message);
10102
+ }
10103
+ };
10104
+ //#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
+ });
10115
+ },
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);
10120
+ },
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;
10127
+ },
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;
10132
+ }
10133
+ };
10134
+ //#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") {
10139
+ super(message);
10140
+ }
10141
+ };
10142
+ var InvalidAgentNameError = class extends Error {
10143
+ errorCode = "InvalidAgentNameError";
10144
+ constructor(message = "InvalidAgentNameError") {
10145
+ super(message);
10146
+ }
10147
+ };
10148
+ var MastraNotEnabledError = class extends Error {
10149
+ errorCode = "MastraNotEnabledError";
10150
+ constructor(message = "MastraNotEnabledError") {
10151
+ super(message);
10152
+ }
10153
+ };
10154
+ var InvalidModelIdError = class extends Error {
10155
+ errorCode = "InvalidModelIdError";
10156
+ constructor(message = "InvalidModelIdError") {
10157
+ super(message);
10158
+ }
10159
+ };
10160
+ var DuplicateModelError = class extends Error {
10161
+ errorCode = "DuplicateModelError";
10162
+ constructor(message = "DuplicateModelError") {
10163
+ super(message);
10164
+ }
10165
+ };
10166
+ var ModelNotFoundError = class extends Error {
10167
+ errorCode = "ModelNotFoundError";
10168
+ constructor(message = "ModelNotFoundError") {
10169
+ super(message);
10170
+ }
10171
+ };
10172
+ var InvalidProfileIdError = class extends Error {
10173
+ errorCode = "InvalidProfileIdError";
10174
+ constructor(message = "InvalidProfileIdError") {
10175
+ super(message);
10176
+ }
10177
+ };
10178
+ var DuplicateProfileError = class extends Error {
10179
+ errorCode = "DuplicateProfileError";
10180
+ constructor(message = "DuplicateProfileError") {
10181
+ super(message);
10182
+ }
10183
+ };
10184
+ var ProfileNotFoundError = class extends Error {
10185
+ errorCode = "ProfileNotFoundError";
10186
+ constructor(message = "ProfileNotFoundError") {
10187
+ super(message);
10188
+ }
10189
+ };
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") {
10199
+ super(message);
10200
+ }
10201
+ };
10202
+ //#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
+ },
10271
+ addProfileOperation(state, action) {
10272
+ if (!state.features.mastra.enabled) throw new MastraNotEnabledError("Cannot add profile when Mastra is disabled.");
10273
+ 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
+ if (state.features.mastra.profiles.find((p) => p.id === action.input.id)) throw new DuplicateProfileError(`Profile already exists: ${action.input.id}`);
10275
+ const profile = {
10276
+ id: action.input.id,
10277
+ title: action.input.title,
10278
+ content: action.input.content
10279
+ };
10280
+ if (action.input.insertBefore) {
10281
+ 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
+ }
10353
+ }
10354
+ }
10355
+ };
10356
+ //#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") {
10361
+ super(message);
10362
+ }
10363
+ };
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
+ }
10389
+ }
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;
10400
+ }
10401
+ };
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") {
10407
+ super(message);
10408
+ }
10409
+ };
10410
+ var InvalidPackageIdentifierError = class extends Error {
10411
+ errorCode = "InvalidPackageIdentifierError";
10412
+ constructor(message = "InvalidPackageIdentifierError") {
10413
+ super(message);
10414
+ }
10415
+ };
10416
+ //#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;
10424
+ },
10425
+ setDescriptionOperation(state, action) {
10426
+ state.description = action.input.description;
10427
+ },
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
+ }
10452
+ }
10453
+ };
10454
+ //#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
+ //#region document-models/ph-clint-project/v1/gen/powerhouse-packages/error.ts
10516
+ var DuplicatePackageError = class extends Error {
10517
+ errorCode = "DuplicatePackageError";
10518
+ constructor(message = "DuplicatePackageError") {
10519
+ super(message);
10520
+ }
10521
+ };
10522
+ var PackageNotFoundError = class extends Error {
10523
+ errorCode = "PackageNotFoundError";
10524
+ constructor(message = "PackageNotFoundError") {
10525
+ super(message);
10526
+ }
10527
+ };
10528
+ var CannotRemoveManagedPackageError = class extends Error {
10529
+ errorCode = "CannotRemoveManagedPackageError";
10530
+ constructor(message = "CannotRemoveManagedPackageError") {
10531
+ super(message);
10532
+ }
10533
+ };
10534
+ var InvalidDocumentTypeError = class extends Error {
10535
+ errorCode = "InvalidDocumentTypeError";
10536
+ constructor(message = "InvalidDocumentTypeError") {
10537
+ super(message);
10538
+ }
10539
+ };
10540
+ var DuplicateDocumentTypeError = class extends Error {
10541
+ errorCode = "DuplicateDocumentTypeError";
10542
+ constructor(message = "DuplicateDocumentTypeError") {
10543
+ super(message);
10544
+ }
10545
+ };
10546
+ var DocumentTypeNotFoundError = class extends Error {
10547
+ errorCode = "DocumentTypeNotFoundError";
10548
+ constructor(message = "DocumentTypeNotFoundError") {
10549
+ super(message);
10550
+ }
10551
+ };
10552
+ var InvalidVersionError$1 = class extends Error {
10553
+ errorCode = "InvalidVersionError";
10554
+ constructor(message = "InvalidVersionError") {
10555
+ super(message);
10556
+ }
10557
+ };
10558
+ //#endregion
10559
+ //#region document-models/ph-clint-project/v1/src/reducers/powerhouse-packages.ts
10560
+ const SEMVER = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
10561
+ const phClintProjectPowerhousePackagesOperations = {
10562
+ addPowerhousePackageOperation(state, action) {
10563
+ if (state.packages.find((p) => p.id === action.input.id || p.packageName === action.input.packageName)) throw new DuplicatePackageError(`Package already exists: ${action.input.packageName}`);
10564
+ state.packages.push({
10565
+ id: action.input.id,
10566
+ packageName: action.input.packageName,
10567
+ documentTypes: [],
10568
+ version: null,
10569
+ managed: false
10570
+ });
10571
+ },
10572
+ removePowerhousePackageOperation(state, action) {
10573
+ const idx = state.packages.findIndex((p) => p.id === action.input.id);
10574
+ if (idx === -1) throw new PackageNotFoundError(`Package not found: ${action.input.id}`);
10575
+ if (state.packages[idx].managed) throw new CannotRemoveManagedPackageError("Cannot remove a managed package");
10576
+ state.packages.splice(idx, 1);
10577
+ },
10578
+ addPackageDocumentTypeOperation(state, action) {
10579
+ if (action.input.documentType !== "*/*" && !/^[a-z0-9-]+\/[a-z0-9-]+$/.test(action.input.documentType)) throw new InvalidDocumentTypeError(`Invalid document type format: ${action.input.documentType}. Expected org/name.`);
10580
+ const pkg = state.packages.find((p) => p.id === action.input.packageId);
10581
+ if (!pkg) throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);
10582
+ if (action.input.documentType === "*/*") {
10583
+ pkg.documentTypes.length = 0;
10584
+ pkg.documentTypes.push("*/*");
10585
+ return;
10586
+ }
10587
+ if (pkg.documentTypes.includes("*/*")) return;
10588
+ if (pkg.documentTypes.includes(action.input.documentType)) throw new DuplicateDocumentTypeError(`Document type already registered: ${action.input.documentType}`);
10589
+ pkg.documentTypes.push(action.input.documentType);
10590
+ },
10591
+ removePackageDocumentTypeOperation(state, action) {
10592
+ const pkg = state.packages.find((p) => p.id === action.input.packageId);
10593
+ if (!pkg) throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);
10594
+ const idx = pkg.documentTypes.indexOf(action.input.documentType);
10595
+ if (idx === -1) throw new DocumentTypeNotFoundError(`Document type not found: ${action.input.documentType}`);
10596
+ pkg.documentTypes.splice(idx, 1);
10597
+ },
10598
+ setPackageVersionOperation(state, action) {
10599
+ const pkg = state.packages.find((p) => p.id === action.input.packageId);
10600
+ if (!pkg) throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);
10601
+ if (action.input.version != null) {
10602
+ if (!SEMVER.test(action.input.version)) throw new InvalidVersionError$1(`Invalid version: ${action.input.version}`);
10603
+ }
10604
+ pkg.version = action.input.version || null;
10605
+ }
10606
+ };
10607
+ //#endregion
10608
+ //#region document-models/ph-clint-project/v1/gen/publishing/error.ts
10609
+ var InvalidVersionError = class extends Error {
10610
+ errorCode = "InvalidVersionError";
10611
+ constructor(message = "InvalidVersionError") {
10612
+ super(message);
10613
+ }
10614
+ };
10615
+ var PublishRecordNotFoundError = class extends Error {
10616
+ errorCode = "PublishRecordNotFoundError";
10617
+ constructor(message = "PublishRecordNotFoundError") {
10618
+ super(message);
10619
+ }
10620
+ };
10621
+ //#endregion
10622
+ //#region document-models/ph-clint-project/v1/src/reducers/publishing.ts
10623
+ const phClintProjectPublishingOperations = {
10624
+ bumpVersionOperation(state, action) {
10625
+ if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(action.input.version)) throw new InvalidVersionError(`Invalid version: ${action.input.version}`);
10626
+ state.version = action.input.version;
10627
+ },
10628
+ publishDevOperation(state, action) {
10629
+ state.publishHistory.push({
10630
+ id: action.input.id,
10631
+ tag: "Dev",
10632
+ version: state.version,
10633
+ timestamp: action.input.timestamp,
10634
+ status: "Pending"
10635
+ });
10636
+ },
10637
+ publishStagingOperation(state, action) {
10638
+ state.publishHistory.push({
10639
+ id: action.input.id,
10640
+ tag: "Staging",
10641
+ version: state.version,
10642
+ timestamp: action.input.timestamp,
10643
+ status: "Pending"
10644
+ });
10645
+ },
10646
+ publishProductionOperation(state, action) {
10647
+ state.publishHistory.push({
10648
+ id: action.input.id,
10649
+ tag: "Production",
10650
+ version: state.version,
10651
+ timestamp: action.input.timestamp,
10652
+ status: "Pending"
10653
+ });
10654
+ },
10655
+ setPublishStatusOperation(state, action) {
10656
+ const record = state.publishHistory.find((r) => r.id === action.input.id);
10657
+ if (!record) throw new PublishRecordNotFoundError(`Publish record not found: ${action.input.id}`);
10658
+ record.status = action.input.status;
10659
+ }
10660
+ };
10661
+ //#endregion
10475
10662
  //#region document-models/ph-clint-project/v1/gen/reducer.ts
10476
10663
  const stateReducer = (state, action, dispatch) => {
10477
10664
  if (isDocumentAction(action)) return state;
@@ -10632,140 +10819,27 @@ const stateReducer = (state, action, dispatch) => {
10632
10819
  SetProxyEnabledInputSchema().parse(action.input);
10633
10820
  phClintProjectDeploymentOperations.setProxyEnabledOperation(state[action.scope], action, dispatch);
10634
10821
  break;
10822
+ case "SET_OBSERVABILITY_ENABLED":
10823
+ SetObservabilityEnabledInputSchema().parse(action.input);
10824
+ phClintProjectDeploymentOperations.setObservabilityEnabledOperation(state[action.scope], action, dispatch);
10825
+ break;
10635
10826
  default: return state;
10636
10827
  }
10637
10828
  };
10638
10829
  const reducer = createReducer(stateReducer);
10639
10830
  //#endregion
10640
- //#region document-models/ph-clint-project/v1/gen/identity/creators.ts
10641
- var creators_exports$8 = /* @__PURE__ */ __exportAll({
10642
- setDescription: () => setDescription,
10643
- setPackageIdentifier: () => setPackageIdentifier,
10644
- setVersion: () => setVersion
10645
- });
10646
- const setDescription = (input) => createAction("SET_DESCRIPTION", { ...input }, void 0, SetDescriptionInputSchema, "global");
10647
- const setVersion = (input) => createAction("SET_VERSION", { ...input }, void 0, SetVersionInputSchema, "global");
10648
- const setPackageIdentifier = (input) => createAction("SET_PACKAGE_IDENTIFIER", { ...input }, void 0, SetPackageIdentifierInputSchema, "global");
10649
- //#endregion
10650
- //#region document-models/ph-clint-project/v1/gen/features-powerhouse/creators.ts
10651
- var creators_exports$7 = /* @__PURE__ */ __exportAll({ setPowerhouseLevel: () => setPowerhouseLevel });
10652
- const setPowerhouseLevel = (input) => createAction("SET_POWERHOUSE_LEVEL", { ...input }, void 0, SetPowerhouseLevelInputSchema, "global");
10653
- //#endregion
10654
- //#region document-models/ph-clint-project/v1/gen/features-mastra/creators.ts
10655
- var creators_exports$6 = /* @__PURE__ */ __exportAll({
10656
- addModel: () => addModel,
10657
- addProfile: () => addProfile,
10658
- clearAgentImage: () => clearAgentImage,
10659
- disableMastra: () => disableMastra,
10660
- enableMastra: () => enableMastra,
10661
- removeModel: () => removeModel,
10662
- removeProfile: () => removeProfile,
10663
- reorderProfiles: () => reorderProfiles,
10664
- setAgentDescription: () => setAgentDescription,
10665
- setAgentId: () => setAgentId,
10666
- setAgentImage: () => setAgentImage,
10667
- setAgentName: () => setAgentName,
10668
- setDefaultModel: () => setDefaultModel,
10669
- setEnableChat: () => setEnableChat,
10670
- updateProfile: () => updateProfile
10671
- });
10672
- const enableMastra = (input) => createAction("ENABLE_MASTRA", { ...input }, void 0, EnableMastraInputSchema, "global");
10673
- const disableMastra = (input) => createAction("DISABLE_MASTRA", { ...input }, void 0, DisableMastraInputSchema, "global");
10674
- const setAgentId = (input) => createAction("SET_AGENT_ID", { ...input }, void 0, SetAgentIdInputSchema, "global");
10675
- const setAgentName = (input) => createAction("SET_AGENT_NAME", { ...input }, void 0, SetAgentNameInputSchema, "global");
10676
- const addModel = (input) => createAction("ADD_MODEL", { ...input }, void 0, AddModelInputSchema, "global");
10677
- const removeModel = (input) => createAction("REMOVE_MODEL", { ...input }, void 0, RemoveModelInputSchema, "global");
10678
- const setDefaultModel = (input) => createAction("SET_DEFAULT_MODEL", { ...input }, void 0, SetDefaultModelInputSchema, "global");
10679
- const addProfile = (input) => createAction("ADD_PROFILE", { ...input }, void 0, AddProfileInputSchema, "global");
10680
- const updateProfile = (input) => createAction("UPDATE_PROFILE", { ...input }, void 0, UpdateProfileInputSchema, "global");
10681
- const removeProfile = (input) => createAction("REMOVE_PROFILE", { ...input }, void 0, RemoveProfileInputSchema, "global");
10682
- const reorderProfiles = (input) => createAction("REORDER_PROFILES", { ...input }, void 0, ReorderProfilesInputSchema, "global");
10683
- const setAgentDescription = (input) => createAction("SET_AGENT_DESCRIPTION", { ...input }, void 0, SetAgentDescriptionInputSchema, "global");
10684
- const setAgentImage = (input) => createAction("SET_AGENT_IMAGE", { ...input }, void 0, SetAgentImageInputSchema, "global");
10685
- const clearAgentImage = (input) => createAction("CLEAR_AGENT_IMAGE", { ...input }, void 0, ClearAgentImageInputSchema, "global");
10686
- const setEnableChat = (input) => createAction("SET_ENABLE_CHAT", { ...input }, void 0, SetEnableChatInputSchema, "global");
10687
- //#endregion
10688
- //#region document-models/ph-clint-project/v1/gen/features-routine/creators.ts
10689
- var creators_exports$5 = /* @__PURE__ */ __exportAll({
10690
- disableRoutine: () => disableRoutine,
10691
- enableRoutine: () => enableRoutine
10692
- });
10693
- const enableRoutine = (input) => createAction("ENABLE_ROUTINE", { ...input }, void 0, EnableRoutineInputSchema, "global");
10694
- const disableRoutine = (input) => createAction("DISABLE_ROUTINE", { ...input }, void 0, DisableRoutineInputSchema, "global");
10695
- //#endregion
10696
- //#region document-models/ph-clint-project/v1/gen/powerhouse-packages/creators.ts
10697
- var creators_exports$4 = /* @__PURE__ */ __exportAll({
10698
- addPackageDocumentType: () => addPackageDocumentType,
10699
- addPowerhousePackage: () => addPowerhousePackage,
10700
- removePackageDocumentType: () => removePackageDocumentType,
10701
- removePowerhousePackage: () => removePowerhousePackage,
10702
- setPackageVersion: () => setPackageVersion
10703
- });
10704
- const addPowerhousePackage = (input) => createAction("ADD_POWERHOUSE_PACKAGE", { ...input }, void 0, AddPowerhousePackageInputSchema, "global");
10705
- const removePowerhousePackage = (input) => createAction("REMOVE_POWERHOUSE_PACKAGE", { ...input }, void 0, RemovePowerhousePackageInputSchema, "global");
10706
- const addPackageDocumentType = (input) => createAction("ADD_PACKAGE_DOCUMENT_TYPE", { ...input }, void 0, AddPackageDocumentTypeInputSchema, "global");
10707
- const removePackageDocumentType = (input) => createAction("REMOVE_PACKAGE_DOCUMENT_TYPE", { ...input }, void 0, RemovePackageDocumentTypeInputSchema, "global");
10708
- const setPackageVersion = (input) => createAction("SET_PACKAGE_VERSION", { ...input }, void 0, SetPackageVersionInputSchema, "global");
10709
- //#endregion
10710
- //#region document-models/ph-clint-project/v1/gen/external-skills/creators.ts
10711
- var creators_exports$3 = /* @__PURE__ */ __exportAll({
10712
- addExternalSkill: () => addExternalSkill,
10713
- removeExternalSkill: () => removeExternalSkill,
10714
- setExternalSkillGithubUrl: () => setExternalSkillGithubUrl,
10715
- setExternalSkillName: () => setExternalSkillName
10716
- });
10717
- const addExternalSkill = (input) => createAction("ADD_EXTERNAL_SKILL", { ...input }, void 0, AddExternalSkillInputSchema, "global");
10718
- const removeExternalSkill = (input) => createAction("REMOVE_EXTERNAL_SKILL", { ...input }, void 0, RemoveExternalSkillInputSchema, "global");
10719
- const setExternalSkillName = (input) => createAction("SET_EXTERNAL_SKILL_NAME", { ...input }, void 0, SetExternalSkillNameInputSchema, "global");
10720
- const setExternalSkillGithubUrl = (input) => createAction("SET_EXTERNAL_SKILL_GITHUB_URL", { ...input }, void 0, SetExternalSkillGithubUrlInputSchema, "global");
10721
- //#endregion
10722
- //#region document-models/ph-clint-project/v1/gen/publishing/creators.ts
10723
- var creators_exports$2 = /* @__PURE__ */ __exportAll({
10724
- bumpVersion: () => bumpVersion,
10725
- publishDev: () => publishDev,
10726
- publishProduction: () => publishProduction,
10727
- publishStaging: () => publishStaging,
10728
- setPublishStatus: () => setPublishStatus
10729
- });
10730
- const bumpVersion = (input) => createAction("BUMP_VERSION", { ...input }, void 0, BumpVersionInputSchema, "global");
10731
- const publishDev = (input) => createAction("PUBLISH_DEV", { ...input }, void 0, PublishDevInputSchema, "global");
10732
- const publishStaging = (input) => createAction("PUBLISH_STAGING", { ...input }, void 0, PublishStagingInputSchema, "global");
10733
- const publishProduction = (input) => createAction("PUBLISH_PRODUCTION", { ...input }, void 0, PublishProductionInputSchema, "global");
10734
- const setPublishStatus = (input) => createAction("SET_PUBLISH_STATUS", { ...input }, void 0, SetPublishStatusInputSchema, "global");
10735
- //#endregion
10736
- //#region document-models/ph-clint-project/v1/gen/lifecycle/creators.ts
10737
- var creators_exports$1 = /* @__PURE__ */ __exportAll({ importSpec: () => importSpec });
10738
- const importSpec = (input) => createAction("IMPORT_SPEC", { ...input }, void 0, ImportSpecInputSchema, "global");
10739
- //#endregion
10740
- //#region document-models/ph-clint-project/v1/gen/deployment/creators.ts
10741
- var creators_exports = /* @__PURE__ */ __exportAll({
10742
- addSupportedResource: () => addSupportedResource,
10743
- removeSupportedResource: () => removeSupportedResource,
10744
- setProxyEnabled: () => setProxyEnabled
10745
- });
10746
- const addSupportedResource = (input) => createAction("ADD_SUPPORTED_RESOURCE", { ...input }, void 0, AddSupportedResourceInputSchema, "global");
10747
- const removeSupportedResource = (input) => createAction("REMOVE_SUPPORTED_RESOURCE", { ...input }, void 0, RemoveSupportedResourceInputSchema, "global");
10748
- const setProxyEnabled = (input) => createAction("SET_PROXY_ENABLED", { ...input }, void 0, SetProxyEnabledInputSchema, "global");
10749
- //#endregion
10750
- //#region document-models/ph-clint-project/v1/actions.ts
10751
- /** Actions for the PhClintProject document model */
10752
- const actions = {
10753
- ...baseActions,
10754
- ...creators_exports$8,
10755
- ...creators_exports$7,
10756
- ...creators_exports$6,
10757
- ...creators_exports$5,
10758
- ...creators_exports$4,
10759
- ...creators_exports$3,
10760
- ...creators_exports$2,
10761
- ...creators_exports$1,
10762
- ...creators_exports
10763
- };
10764
- //#endregion
10765
10831
  //#region document-models/ph-clint-project/v1/gen/document-type.ts
10832
+ /**
10833
+ * WARNING: DO NOT EDIT
10834
+ * This file is auto-generated and updated by codegen
10835
+ */
10766
10836
  const phClintProjectDocumentType = "powerhouse/ph-clint-project";
10767
10837
  //#endregion
10768
10838
  //#region document-models/ph-clint-project/v1/gen/document-schema.ts
10839
+ /**
10840
+ * WARNING: DO NOT EDIT
10841
+ * This file is auto-generated and updated by codegen
10842
+ */
10769
10843
  /** Schema for validating the header object of a PhClintProject document */
10770
10844
  const PhClintProjectDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({ documentType: literal(phClintProjectDocumentType) });
10771
10845
  /** Schema for validating the state object of a PhClintProject document */
@@ -10817,6 +10891,7 @@ const initialGlobalState = {
10817
10891
  publishHistory: [],
10818
10892
  deployment: {
10819
10893
  proxyEnabled: false,
10894
+ observabilityEnabled: false,
10820
10895
  supportedResources: [
10821
10896
  "vetra-agent-s",
10822
10897
  "vetra-agent-m",
@@ -10888,6 +10963,6 @@ const PhClintProject = {
10888
10963
  documentModel: createState(defaultBaseState(), documentModel)
10889
10964
  };
10890
10965
  //#endregion
10891
- export { setAgentName as $, SetAgentImageInputSchema as $t, setExternalSkillGithubUrl as A, createZip as An, PhClintDeploymentSchema as At, enableRoutine as B, validateStateSchemaName as Bn, PublishRecordSchema as Bt, publishDev as C, baseSaveToFileHandle as Cn, ImportModelInputSchema as Ct, addExternalSkill as D, createPresignedHeader as Dn, ImportSpecInputSchema as Dt, setPublishStatus as E, createBaseState as En, ImportSkillInputSchema as Et, removePackageDocumentType as F, replayDocument as Fn, PhClintRoutineFeatureSchema as Ft, disableMastra as G, boolean as Gn, RemoveModelInputSchema as Gt, addProfile as H, _enum as Hn, PublishStatusSchema as Ht, removePowerhousePackage as I, setName as In, PowerhouseLevelSchema as It, removeProfile as J, string as Jn, RemoveProfileInputSchema as Jt, enableMastra as K, literal as Kn, RemovePackageDocumentTypeInputSchema as Kt, setPackageVersion as L, undo as Ln, PowerhousePackageSchema as Lt, addPackageDocumentType as M, documentModelDocumentType as Mn, PhClintMastraCommonSchema as Mt, addPowerhousePackage as N, isDocumentAction as Nn, PhClintMastraFeatureSchema as Nt, creators_exports$3 as O, createReducer as On, PhClintAgentModelSchema as Ot, creators_exports$4 as P, redo as Pn, PhClintProjectStateSchema as Pt, setAgentImage as Q, SetAgentIdInputSchema as Qt, creators_exports$5 as R, validateInitialState as Rn, PublishDevInputSchema as Rt, creators_exports$2 as S, baseLoadFromInput as Sn, ExternalSkillSchema as St, publishStaging as T, createAction as Tn, ImportProfileInputSchema as Tt, clearAgentImage as U, any as Un, PublishTagSchema as Ut, addModel as V, capitalCase as Vn, PublishStagingInputSchema as Vt, creators_exports$6 as W, array as Wn, RemoveExternalSkillInputSchema as Wt, setAgentDescription as X, generateId as Xn, ReorderProfilesInputSchema as Xt, reorderProfiles as Y, union as Yn, RemoveSupportedResourceInputSchema as Yt, setAgentId as Z, SetAgentDescriptionInputSchema as Zt, removeSupportedResource as _, documentModelDocumentModelModule as _n, ClearAgentImageInputSchema as _t, utils$1 as a, SetExternalSkillNameInputSchema as an, creators_exports$8 as at, importSpec as b, BaseDocumentStateSchema as bn, EnableMastraInputSchema as bt, PhClintProjectPHStateSchema as c, SetPowerhouseLevelInputSchema as cn, setVersion as ct, isPhClintProjectDocument as d, SetVersionInputSchema as dn, AddModelInputSchema as dt, SetAgentNameInputSchema as en, setDefaultModel as et, isPhClintProjectState as f, UpdateProfileInputSchema as fn, AddPackageDocumentTypeInputSchema as ft, creators_exports as g, PHDocumentController as gn, BumpVersionInputSchema as gt, addSupportedResource as h, documentModel as hn, AddSupportedResourceInputSchema as ht, initialLocalState as i, SetExternalSkillGithubUrlInputSchema as in, setPowerhouseLevel as it, setExternalSkillName as j, defaultBaseState as jn, PhClintFeaturesSchema as jt, removeExternalSkill as k, createState as kn, PhClintAgentProfileSchema as kt, assertIsPhClintProjectDocument as l, SetProxyEnabledInputSchema as ln, reducer as lt, actions as m, isDefinedNonNullAny as mn, AddProfileInputSchema as mt, utils as n, SetDescriptionInputSchema as nn, updateProfile as nt, PhClintProjectDocumentHeaderSchema as o, SetPackageIdentifierInputSchema as on, setDescription as ot, phClintProjectDocumentType as p, definedNonNullAnySchema as pn, AddPowerhousePackageInputSchema as pt, removeModel as q, object as qn, RemovePowerhousePackageInputSchema as qt, initialGlobalState as r, SetEnableChatInputSchema as rn, creators_exports$7 as rt, PhClintProjectDocumentSchema as s, SetPackageVersionInputSchema as sn, setPackageIdentifier as st, PhClintProject as t, SetDefaultModelInputSchema as tn, setEnableChat as tt, assertIsPhClintProjectState as u, SetPublishStatusInputSchema as un, AddExternalSkillInputSchema as ut, setProxyEnabled as v, logger as vn, DisableMastraInputSchema as vt, publishProduction as w, buildSignedAction as wn, ImportPackageInputSchema as wt, bumpVersion as x, baseCreateDocument as xn, EnableRoutineInputSchema as xt, creators_exports$1 as y, BaseDocumentHeaderSchema as yn, DisableRoutineInputSchema as yt, disableRoutine as z, validateModules as zn, PublishProductionInputSchema as zt };
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 };
10892
10967
 
10893
- //# sourceMappingURL=module-B8cTCphJ.mjs.map
10968
+ //# sourceMappingURL=module-DayL4J7r.mjs.map