@powerhousedao/ph-clint-app 0.1.0-dev.91 → 0.1.0-dev.93
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.
- package/dist/connect/assets/{ClearStorageModal-CXoNWmRe-CpE72nB8.js → ClearStorageModal-CXoNWmRe-CfudY7gP.js} +2 -2
- package/dist/connect/assets/{ClearStorageModal-CXoNWmRe-CpE72nB8.js.map → ClearStorageModal-CXoNWmRe-CfudY7gP.js.map} +1 -1
- package/dist/connect/assets/{DebugSettingsModal-5SDhy5gt-Me3H9oNw.js → DebugSettingsModal-5SDhy5gt-Oc_wrZVo.js} +2 -2
- package/dist/connect/assets/{DebugSettingsModal-5SDhy5gt-Me3H9oNw.js.map → DebugSettingsModal-5SDhy5gt-Oc_wrZVo.js.map} +1 -1
- package/dist/connect/assets/{InspectorModal-BsSihzuc-DVTFZSUH.js → InspectorModal-BsSihzuc-adr3q93h.js} +2 -2
- package/dist/connect/assets/{InspectorModal-BsSihzuc-DVTFZSUH.js.map → InspectorModal-BsSihzuc-adr3q93h.js.map} +1 -1
- package/dist/connect/assets/{SettingsModal-S_A5qf95-nzYOCl3o.js → SettingsModal-S_A5qf95-DqxCHnLy.js} +2 -2
- package/dist/connect/assets/{SettingsModal-S_A5qf95-nzYOCl3o.js.map → SettingsModal-S_A5qf95-DqxCHnLy.js.map} +1 -1
- package/dist/connect/assets/{components-ByEUkO4U-DoBYY0k7.js → components-ByEUkO4U-DHdzb1cM.js} +4 -4
- package/dist/connect/assets/{components-ByEUkO4U-DoBYY0k7.js.map → components-ByEUkO4U-DHdzb1cM.js.map} +1 -1
- package/dist/connect/assets/{connect.config-Bt4pvvWV-DPiXrGYV.js → connect.config-Bt4pvvWV-TF7SRwB1.js} +2 -2
- package/dist/connect/assets/{connect.config-Bt4pvvWV-DPiXrGYV.js.map → connect.config-Bt4pvvWV-TF7SRwB1.js.map} +1 -1
- package/dist/connect/assets/{index-CK9tPzCS.js → index-Bgr9U9X9.js} +3 -3
- package/dist/connect/assets/{index-CK9tPzCS.js.map → index-Bgr9U9X9.js.map} +1 -1
- package/dist/connect/assets/{load-BWibkoFV-DWy1LALw.js → load-BWibkoFV-jV3p7MXQ.js} +2 -2
- package/dist/connect/assets/{load-BWibkoFV-DWy1LALw.js.map → load-BWibkoFV-jV3p7MXQ.js.map} +1 -1
- package/dist/connect/assets/{module-5NdQh7xr.js → module-bwULLGwn.js} +2 -2
- package/dist/connect/assets/{module-5NdQh7xr.js.map → module-bwULLGwn.js.map} +1 -1
- package/dist/connect/assets/{pglite-seed-BWk7yOwr-BHQsaOhO.js → pglite-seed-BWk7yOwr-BjLA_ztF.js} +2 -2
- package/dist/connect/assets/{pglite-seed-BWk7yOwr-BHQsaOhO.js.map → pglite-seed-BWk7yOwr-BjLA_ztF.js.map} +1 -1
- package/dist/connect/assets/{reactor-BxNvHOKC-CSy_kfH0.js → reactor-BxNvHOKC-DEqXBEvK.js} +2 -2
- package/dist/connect/assets/{reactor-BxNvHOKC-CSy_kfH0.js.map → reactor-BxNvHOKC-DEqXBEvK.js.map} +1 -1
- package/dist/connect/assets/{registerServiceWorker-D9l1kja7-C-5yx671.js → registerServiceWorker-D9l1kja7-DG9mrLlt.js} +2 -2
- package/dist/connect/assets/{registerServiceWorker-D9l1kja7-C-5yx671.js.map → registerServiceWorker-D9l1kja7-DG9mrLlt.js.map} +1 -1
- package/dist/connect/index.html +1 -1
- package/dist/connect/powerhouse.config.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";64EACC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAe,OAAO,OAApB,IAA2B,OAAoB,OAAO,OAApB,IAA2B,OAAoB,OAAO,WAApB,IAA+B,WAAwB,OAAO,KAApB,IAAyB,KAAK,EAAE,CAAC,EAAG,IAAI,EAAE,OAAK,CAAE,MAAM,IAAI,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC,EAAE,gBAAgB,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AgC,EAAE,CAGxC,IAAK,IAAM,KAAW,EAAW,CAC/B,IAAM,EAAoB,MAAM,EAAQ,EAAa,EAAO,aAAa,CACzE,EAAW,KAAK,GAAG,EAAkB,CAGvC,OAAO,otKChBE,GAAqB,GCC5B,CAAE,uBAAuB,GAAa,GAAa,WAEzB,OAAO,CAAC,aAAa,EAAG,CAAC,KAAe,CAClE,GACF,GAAmB,EAAU,EAE/B","names":["updateLocalPackage"],"ignoreList":[0],"sources":["../../../../../node_modules/.pnpm/@powerhousedao+connect@6.2.0-dev.23_@babel+runtime@7.29.2_@parcel+watcher@2.5.6_@sentry_92fbcdab943457b0ffd54c0864a4f38d/node_modules/@powerhousedao/connect/dist/start-connect.js","../../../document-models/ph-clint-project/v1/gen/document-model.ts","../../../document-models/ph-clint-project/v1/gen/deployment/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/deployment.ts","../../../document-models/ph-clint-project/v1/gen/external-skills/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/external-skills.ts","../../../document-models/ph-clint-project/v1/gen/features-mastra/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/features-mastra.ts","../../../document-models/ph-clint-project/v1/gen/features-powerhouse/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/features-powerhouse.ts","../../../document-models/ph-clint-project/v1/src/reducers/features-routine.ts","../../../document-models/ph-clint-project/v1/gen/identity/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/identity.ts","../../../document-models/ph-clint-project/v1/src/reducers/lifecycle.ts","../../../document-models/ph-clint-project/v1/gen/mastra-agent-bindings/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/mastra-agent-bindings.ts","../../../document-models/ph-clint-project/v1/gen/mastra-main-agent/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/mastra-main-agent.ts","../../../document-models/ph-clint-project/v1/gen/mastra-models/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/mastra-models.ts","../../../document-models/ph-clint-project/v1/gen/mastra-profiles/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/mastra-profiles.ts","../../../document-models/ph-clint-project/v1/gen/mastra-sub-agents/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/mastra-sub-agents.ts","../../../document-models/ph-clint-project/v1/gen/powerhouse-packages/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/powerhouse-packages.ts","../../../document-models/ph-clint-project/v1/gen/publishing/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/publishing.ts","../../../document-models/ph-clint-project/v1/gen/reducer.ts","../../../document-models/ph-clint-project/upgrades/versions.ts","../../../document-models/ph-clint-project/upgrades/upgrade-manifest.ts","../../../document-models/ph-clint-project/v1/gen/utils.ts","../../../document-models/ph-clint-project/v1/utils.ts","../../../document-models/ph-clint-project/v1/module.ts","../../../document-models/ph-clint-project/v1/gen/controller.ts","../../../document-models/ph-clint-project/v1/gen/ph-factories.ts","../../../document-models/document-models.ts","../../../document-models/upgrade-manifests.ts","../../../editors/editors.ts","../../../editors/ph-clint-project-editor/module.ts","../../../processors/factory.ts","../../../index.ts","../../../main.tsx"],"sourcesContent":["\n!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"2f8a11cf-bc6b-5fbf-9031-7723d0609b7b\")}catch(e){}}();\nimport { r as loadRuntimeConfig } from \"./runtime-config-DL3QjcfM.js\";\nimport { createRoot } from \"react-dom/client\";\nimport { jsx } from \"react/jsx-runtime\";\n//#region start-connect.tsx\nawait loadRuntimeConfig();\nconst { AppLoader } = await import(\"./components-ByEUkO4U.js\");\nfunction updateLocalPackage(pkg) {\n\twindow.ph?.vetraPackageManager?.updateLocalPackage(pkg);\n}\nfunction startConnect(localPackage) {\n\tif (!window.ph) window.ph = {};\n\tcreateRoot(document.getElementById(\"root\")).render(/* @__PURE__ */ jsx(AppLoader, { localPackage }));\n\treturn { updateLocalPackage };\n}\n//#endregion\nexport { startConnect };\n\n//# sourceMappingURL=start-connect.js.map\n//# debugId=2f8a11cf-bc6b-5fbf-9031-7723d0609b7b\n","import type { DocumentModelGlobalState } from 'document-model';\n\nexport const documentModel: DocumentModelGlobalState = {\n id: 'powerhouse/ph-clint-project',\n name: 'PhClintProject',\n author: {\n name: 'Powerhouse Inc.',\n website: 'https://powerhouse.inc',\n },\n extension: 'pcp',\n description:\n '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.',\n specifications: [\n {\n state: {\n local: {\n schema: '',\n examples: [],\n initialValue: '',\n },\n global: {\n schema:\n 'type PhClintProjectState {\\n name: String\\n scope: String\\n version: String!\\n description: String!\\n features: PhClintFeatures!\\n packages: [PowerhousePackage!]!\\n externalSkills: [ExternalSkill!]!\\n publishHistory: [PublishRecord!]!\\n deployment: PhClintDeployment!\\n}\\n\\ntype PhClintFeatures {\\n powerhouse: PowerhouseLevel!\\n mastra: PhClintMastraFeature!\\n routine: PhClintRoutineFeature!\\n}\\n\\nenum PowerhouseLevel {\\n Disabled\\n Reactor\\n Switchboard\\n Connect\\n}\\n\\ntype PhClintMastraFeature {\\n enabled: Boolean!\\n mainAgent: PhClintMainAgent\\n subAgents: [PhClintSubAgent!]!\\n models: [PhClintAgentModel!]!\\n profiles: [PhClintAgentProfile!]!\\n common: PhClintMastraCommon!\\n}\\n\\ntype PhClintMainAgent {\\n id: OID!\\n name: String!\\n description: String\\n attachment: String\\n modelId: OID!\\n profileIds: [OID!]!\\n skills: [String!]!\\n toolPatterns: [String!]!\\n}\\n\\ntype PhClintSubAgent {\\n id: OID!\\n name: String!\\n description: String!\\n modelId: OID!\\n profileIds: [OID!]!\\n skills: [String!]!\\n toolPatterns: [String!]!\\n}\\n\\ntype PhClintMastraCommon {\\n enableChat: Boolean!\\n}\\n\\ntype PhClintAgentModel {\\n id: OID!\\n}\\n\\ntype PhClintAgentProfile {\\n id: OID!\\n title: String!\\n content: String!\\n}\\n\\ntype PhClintRoutineFeature {\\n enabled: Boolean!\\n}\\n\\ntype PowerhousePackage {\\n id: OID!\\n packageName: String!\\n documentTypes: [String!]!\\n version: String\\n managed: Boolean!\\n}\\n\\ntype ExternalSkill {\\n id: OID!\\n name: String!\\n githubUrl: URL!\\n}\\n\\nenum PublishTag {\\n Dev\\n Staging\\n Production\\n}\\n\\nenum PublishStatus {\\n Pending\\n InProgress\\n Succeeded\\n Failed\\n}\\n\\ntype PublishRecord {\\n id: OID!\\n tag: PublishTag!\\n version: String!\\n timestamp: DateTime!\\n status: PublishStatus!\\n}\\n\\ntype PhClintDeployment {\\n proxyEnabled: Boolean!\\n observabilityEnabled: Boolean!\\n supportedResources: [String!]!\\n}',\n examples: [],\n initialValue:\n '{\\n \"name\": null,\\n \"scope\": null,\\n \"version\": \"0.1.0\",\\n \"description\": \"\",\\n \"features\": {\\n \"powerhouse\": \"Disabled\",\\n \"mastra\": {\\n \"enabled\": false,\\n \"mainAgent\": null,\\n \"subAgents\": [],\\n \"models\": [],\\n \"profiles\": [],\\n \"common\": { \"enableChat\": false }\\n },\\n \"routine\": { \"enabled\": false }\\n },\\n \"packages\": [],\\n \"externalSkills\": [],\\n \"publishHistory\": [],\\n \"deployment\": {\\n \"proxyEnabled\": false,\\n \"observabilityEnabled\": false,\\n \"supportedResources\": [\\n \"vetra-agent-s\",\\n \"vetra-agent-m\",\\n \"vetra-agent-l\",\\n \"vetra-agent-xl\",\\n \"vetra-agent-xxl\"\\n ]\\n }\\n}',\n },\n },\n modules: [\n {\n id: 'm-identity',\n name: 'identity',\n description: 'Package identity fields: name, scope, version, description, bin',\n operations: [\n {\n id: 'o-set-description',\n name: 'SET_DESCRIPTION',\n description: 'Set the package description.',\n schema: 'input SetDescriptionInput {\\n description: String!\\n}',\n template: 'Set the package description.',\n reducer: 'state.description = action.input.description;',\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-version',\n name: 'SET_VERSION',\n description: 'Set the package version. Must be a valid semver string.',\n schema: 'input SetVersionInput {\\n version: String!\\n}',\n template: 'Set the package version. Must be a valid semver string.',\n 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;',\n errors: [\n {\n id: 'e-set-version-invalid',\n name: 'InvalidVersionError',\n code: 'INVALID_VERSION',\n description: 'The version must be a valid semver string (major.minor.patch, optionally with prerelease/build metadata).',\n template: 'Invalid version: {{version}}',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-package-identifier',\n name: 'SET_PACKAGE_IDENTIFIER',\n 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.\",\n schema: 'input SetPackageIdentifierInput {\\n identifier: String!\\n}',\n template: \"Set the package identifier. Parses scope and name from a string like '@scope/name-cli' or just 'name-cli'.\",\n reducer:\n \"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}\",\n errors: [\n {\n id: 'e-invalid-package-identifier',\n name: 'InvalidPackageIdentifierError',\n code: 'INVALID_PACKAGE_IDENTIFIER',\n description: 'The package identifier is invalid. Must be a valid npm package name with optional scope.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-features-powerhouse',\n name: 'features_powerhouse',\n description: 'Powerhouse integration level. Ordered enum: Disabled < Reactor < Switchboard < Connect. Once above Disabled, cannot go back to Disabled (irreversible migration).',\n operations: [\n {\n id: 'o-set-powerhouse-level',\n name: 'SET_POWERHOUSE_LEVEL',\n description: 'Set the Powerhouse integration level. Ordered: Disabled < Reactor < Switchboard < Connect. Lowering below Reactor once above Disabled is not allowed (irreversible migration).',\n schema: 'input SetPowerhouseLevelInput {\\n level: PowerhouseLevel!\\n skipAutoProxy: Boolean\\n}',\n template: 'Set the Powerhouse integration level. Ordered: Disabled < Reactor < Switchboard < Connect. Lowering below Reactor once above Disabled is not allowed (irreversible migration).',\n reducer:\n \"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}\",\n errors: [\n {\n id: 'e-cannot-lower-powerhouse',\n name: 'CannotLowerPowerhouseError',\n code: 'CANNOT_LOWER_POWERHOUSE',\n description: 'Cannot lower the Powerhouse level below Reactor once it has been set above Disabled.',\n template: 'Cannot lower Powerhouse level below Reactor once enabled',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-features-routine',\n name: 'features_routine',\n description: 'Routine loop feature toggle.',\n operations: [\n {\n id: 'o-enable-routine',\n name: 'ENABLE_ROUTINE',\n description: 'Enable the routine loop. Idempotent.',\n schema: 'input EnableRoutineInput {\\n _: Boolean\\n}',\n template: 'Enable the routine loop. Idempotent.',\n reducer: 'state.features.routine.enabled = true;',\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-disable-routine',\n name: 'DISABLE_ROUTINE',\n description: 'Disable the routine loop. Always allowed.',\n schema: 'input DisableRoutineInput {\\n _: Boolean\\n}',\n template: 'Disable the routine loop.',\n reducer: 'state.features.routine.enabled = false;',\n errors: [],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-powerhouse-packages',\n name: 'powerhouse_packages',\n description: 'Manage reactor packages and their document types. The app package is auto-created when Powerhouse level goes above Disabled.',\n operations: [\n {\n id: 'o-add-powerhouse-package',\n name: 'ADD_POWERHOUSE_PACKAGE',\n description: 'Add an external reactor package. The app package is auto-managed by SET_POWERHOUSE_LEVEL.',\n schema: 'input AddPowerhousePackageInput {\\n id: OID!\\n packageName: String!\\n}',\n template: 'Add an external reactor package. The app package is auto-managed by SET_POWERHOUSE_LEVEL.',\n reducer:\n '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});',\n errors: [\n {\n id: 'e-duplicate-package',\n name: 'DuplicatePackageError',\n code: 'DUPLICATE_PACKAGE',\n description: 'A package with the same ID or name already exists.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-powerhouse-package',\n name: 'REMOVE_POWERHOUSE_PACKAGE',\n description: 'Remove a reactor package. Cannot remove the auto-managed app package.',\n schema: 'input RemovePowerhousePackageInput {\\n id: OID!\\n}',\n template: 'Remove a reactor package. Cannot remove the auto-managed app package.',\n reducer:\n '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);',\n errors: [\n {\n id: 'e-package-not-found-remove',\n name: 'PackageNotFoundError',\n code: 'PACKAGE_NOT_FOUND',\n description: 'The specified package ID was not found.',\n template: '',\n },\n {\n id: 'e-cannot-remove-app-package',\n name: 'CannotRemoveAppPackageError',\n code: 'CANNOT_REMOVE_APP_PACKAGE',\n description: 'The auto-managed app package cannot be removed.',\n template: '',\n },\n {\n id: 'e-cannot-remove-managed',\n name: 'CannotRemoveManagedPackageError',\n code: 'CANNOT_REMOVE_MANAGED_PACKAGE',\n description: 'Cannot remove a managed (framework-controlled) package',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-add-package-document-type',\n name: 'ADD_PACKAGE_DOCUMENT_TYPE',\n description: 'Add a document type ID to a package (app or external).',\n schema: 'input AddPackageDocumentTypeInput {\\n packageId: OID!\\n documentType: String!\\n}',\n template: 'Add a document type ID to a package (app or external).',\n reducer:\n \"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);\",\n errors: [\n {\n id: 'e-invalid-document-type',\n name: 'InvalidDocumentTypeError',\n code: 'INVALID_DOCUMENT_TYPE',\n description: 'Document type must match org/name format (e.g. powerhouse/ph-clint-project).',\n template: '',\n },\n {\n id: 'e-package-not-found-add-dt',\n name: 'PackageNotFoundError',\n code: 'PACKAGE_NOT_FOUND',\n description: 'The specified package ID was not found.',\n template: '',\n },\n {\n id: 'e-duplicate-document-type',\n name: 'DuplicateDocumentTypeError',\n code: 'DUPLICATE_DOCUMENT_TYPE',\n description: 'This document type is already registered in the package.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-package-document-type',\n name: 'REMOVE_PACKAGE_DOCUMENT_TYPE',\n description: 'Remove a document type ID from a package.',\n schema: 'input RemovePackageDocumentTypeInput {\\n packageId: OID!\\n documentType: String!\\n}',\n template: 'Remove a document type ID from a package.',\n reducer:\n '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);',\n errors: [\n {\n id: 'e-package-not-found-rm-dt',\n name: 'PackageNotFoundError',\n code: 'PACKAGE_NOT_FOUND',\n description: 'The specified package ID was not found.',\n template: '',\n },\n {\n id: 'e-document-type-not-found',\n name: 'DocumentTypeNotFoundError',\n code: 'DOCUMENT_TYPE_NOT_FOUND',\n description: 'The specified document type was not found in this package.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-package-version',\n name: 'SET_PACKAGE_VERSION',\n description: '',\n schema: 'input SetPackageVersionInput {\\n packageId: OID!\\n version: String\\n}',\n template: '',\n reducer:\n '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;',\n errors: [\n {\n id: 'e-pkg-not-found-set-ver',\n name: 'PackageNotFoundError',\n code: 'PACKAGE_NOT_FOUND',\n description: 'Referenced package does not exist',\n template: '',\n },\n {\n id: 'e-invalid-version',\n name: 'InvalidVersionError',\n code: 'INVALID_VERSION',\n description: 'Version string is not valid semver',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-external-skills',\n name: 'external_skills',\n description: 'External skills from the skills.sh ecosystem. Each skill has a name and GitHub URL for installation.',\n operations: [\n {\n id: 'o-add-external-skill',\n name: 'ADD_EXTERNAL_SKILL',\n description: 'Add an external skill. Name must be lowercase kebab-case.',\n schema: 'input AddExternalSkillInput {\\n id: OID!\\n name: String!\\n githubUrl: URL!\\n}',\n template: 'Add an external skill. Name must be lowercase kebab-case.',\n reducer:\n '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});',\n errors: [\n {\n id: 'e-invalid-skill-name',\n name: 'InvalidSkillNameError',\n code: 'INVALID_SKILL_NAME',\n description: 'Skill name must be lowercase kebab-case (e.g. playwright-cli).',\n template: '',\n },\n {\n id: 'e-duplicate-skill',\n name: 'DuplicateSkillError',\n code: 'DUPLICATE_SKILL',\n description: 'A skill with the same ID or name already exists.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-external-skill',\n name: 'REMOVE_EXTERNAL_SKILL',\n description: 'Remove an external skill by ID.',\n schema: 'input RemoveExternalSkillInput {\\n id: OID!\\n}',\n template: 'Remove an external skill by ID.',\n 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);',\n errors: [\n {\n id: 'e-skill-not-found-remove',\n name: 'SkillNotFoundError',\n code: 'SKILL_NOT_FOUND',\n description: 'The specified skill ID was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-external-skill-name',\n name: 'SET_EXTERNAL_SKILL_NAME',\n description: 'Update the name of an external skill.',\n schema: 'input SetExternalSkillNameInput {\\n id: OID!\\n name: String!\\n}',\n template: 'Update the name of an external skill.',\n reducer:\n '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;',\n errors: [\n {\n id: 'e-skill-not-found-set-name',\n name: 'SkillNotFoundError',\n code: 'SKILL_NOT_FOUND',\n description: 'The specified skill ID was not found.',\n template: '',\n },\n {\n id: 'e-invalid-skill-name-set',\n name: 'InvalidSkillNameError',\n code: 'INVALID_SKILL_NAME',\n description: 'Skill name must be lowercase kebab-case.',\n template: '',\n },\n {\n id: 'e-duplicate-skill-set-name',\n name: 'DuplicateSkillError',\n code: 'DUPLICATE_SKILL',\n description: 'Another skill already uses this name.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-external-skill-github-url',\n name: 'SET_EXTERNAL_SKILL_GITHUB_URL',\n description: 'Update the GitHub URL of an external skill.',\n schema: 'input SetExternalSkillGithubUrlInput {\\n id: OID!\\n githubUrl: URL!\\n}',\n template: 'Update the GitHub URL of an external skill.',\n 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;',\n errors: [\n {\n id: 'e-skill-not-found-set-url',\n name: 'SkillNotFoundError',\n code: 'SKILL_NOT_FOUND',\n description: 'The specified skill ID was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-publishing',\n name: 'publishing',\n description: 'Version bumping and publish records. Tracks dev/staging/production publish intents and their status.',\n operations: [\n {\n id: 'o-bump-version',\n name: 'BUMP_VERSION',\n description: 'Bump the project version. Must be a valid semver string greater than the current version.',\n schema: 'input BumpVersionInput {\\n version: String!\\n}',\n template: 'Bump the project version. Must be a valid semver string greater than the current version.',\n 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;',\n errors: [\n {\n id: 'e-invalid-version-bump',\n name: 'InvalidVersionError',\n code: 'INVALID_VERSION',\n description: 'The version must be a valid semver string.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-publish-dev',\n name: 'PUBLISH_DEV',\n description: 'Record a dev publish intent. Creates a Pending publish record.',\n schema: 'input PublishDevInput {\\n id: OID!\\n timestamp: DateTime!\\n}',\n template: 'Record a dev publish intent. Creates a Pending publish record.',\n 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});\",\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-publish-staging',\n name: 'PUBLISH_STAGING',\n description: 'Record a staging publish intent. Creates a Pending publish record.',\n schema: 'input PublishStagingInput {\\n id: OID!\\n timestamp: DateTime!\\n}',\n template: 'Record a staging publish intent. Creates a Pending publish record.',\n 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});\",\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-publish-production',\n name: 'PUBLISH_PRODUCTION',\n description: 'Record a production publish intent. Creates a Pending publish record.',\n schema: 'input PublishProductionInput {\\n id: OID!\\n timestamp: DateTime!\\n}',\n template: 'Record a production publish intent. Creates a Pending publish record.',\n 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});\",\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-publish-status',\n name: 'SET_PUBLISH_STATUS',\n description: 'Update the status of a publish record. Used by the trigger after publish completes.',\n schema: 'input SetPublishStatusInput {\\n id: OID!\\n status: PublishStatus!\\n}',\n template: 'Update the status of a publish record. Used by the trigger after publish completes.',\n 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;',\n errors: [\n {\n id: 'e-publish-record-not-found',\n name: 'PublishRecordNotFoundError',\n code: 'PUBLISH_RECORD_NOT_FOUND',\n description: 'The specified publish record ID was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-lifecycle',\n name: 'lifecycle',\n description: 'Document lifecycle operations. IMPORT_SPEC bulk-imports a full project spec into the document.',\n operations: [\n {\n id: 'o-import-spec',\n name: 'IMPORT_SPEC',\n 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.',\n schema:\n 'input ImportSpecInput {\\n name: String!\\n scope: String\\n version: String!\\n description: String!\\n powerhouse: PowerhouseLevel!\\n mastraEnabled: Boolean!\\n routineEnabled: Boolean!\\n packages: [ImportPackageInput!]!\\n externalSkills: [ImportSkillInput!]!\\n mainAgent: ImportMainAgentInput\\n subAgents: [ImportSubAgentInput!]!\\n models: [ImportModelInput!]!\\n profiles: [ImportProfileInput!]!\\n enableChat: Boolean\\n proxyEnabled: Boolean\\n observabilityEnabled: Boolean\\n supportedResources: [String!]\\n}\\n\\ninput ImportPackageInput {\\n id: OID!\\n packageName: String!\\n documentTypes: [String!]!\\n version: String\\n}\\n\\ninput ImportSkillInput {\\n id: OID!\\n name: String!\\n githubUrl: URL!\\n}\\n\\ninput ImportModelInput {\\n id: OID!\\n}\\n\\ninput ImportProfileInput {\\n id: OID!\\n title: String!\\n content: String!\\n}\\n\\ninput ImportMainAgentInput {\\n id: OID!\\n name: String!\\n description: String\\n attachment: String\\n modelId: OID!\\n profileIds: [OID!]!\\n skills: [String!]!\\n toolPatterns: [String!]!\\n}\\n\\ninput ImportSubAgentInput {\\n id: OID!\\n name: String!\\n description: String!\\n modelId: OID!\\n profileIds: [OID!]!\\n skills: [String!]!\\n toolPatterns: [String!]!\\n}',\n 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.',\n reducer:\n \"state.name = action.input.name;\\nstate.scope = action.input.scope || null;\\nstate.version = action.input.version;\\nstate.description = action.input.description;\\nstate.features.powerhouse = action.input.powerhouse;\\nstate.features.mastra.enabled = action.input.mastraEnabled;\\nstate.features.routine.enabled = action.input.routineEnabled;\\n\\nconst appBase = action.input.name.replace(/-cli$/, '-app');\\nconst appPkgName = action.input.scope\\n ? `${action.input.scope}/${appBase}`\\n : appBase;\\nconst phEnabled = action.input.powerhouse !== 'Disabled';\\n\\nstate.packages = action.input.packages.map((p) => ({\\n id: p.id,\\n packageName: p.packageName,\\n documentTypes: [...p.documentTypes],\\n version: p.version || null,\\n managed: phEnabled && p.packageName === appPkgName,\\n}));\\nstate.externalSkills = action.input.externalSkills.map((s) => ({\\n id: s.id,\\n name: s.name,\\n githubUrl: s.githubUrl,\\n}));\\n\\nstate.features.mastra.models = action.input.models.map((m) => ({\\n id: m.id,\\n}));\\nstate.features.mastra.profiles = action.input.profiles.map((p) => ({\\n id: p.id,\\n title: p.title,\\n content: p.content,\\n}));\\n\\nif (action.input.mainAgent && state.features.mastra.enabled) {\\n const m = action.input.mainAgent;\\n state.features.mastra.mainAgent = {\\n id: m.id,\\n name: m.name,\\n description: m.description || null,\\n attachment: m.attachment || null,\\n modelId: m.modelId,\\n profileIds: [...m.profileIds],\\n skills: [...m.skills],\\n toolPatterns: [...m.toolPatterns],\\n };\\n} else {\\n state.features.mastra.mainAgent = null;\\n}\\n\\nif (state.features.mastra.enabled) {\\n state.features.mastra.subAgents = action.input.subAgents.map((s) => ({\\n id: s.id,\\n name: s.name,\\n description: s.description,\\n modelId: s.modelId,\\n profileIds: [...s.profileIds],\\n skills: [...s.skills],\\n toolPatterns: [...s.toolPatterns],\\n }));\\n} else {\\n state.features.mastra.subAgents = [];\\n}\\n\\nif (\\n action.input.enableChat &&\\n state.features.mastra.enabled &&\\n state.features.powerhouse !== 'Disabled'\\n) {\\n state.features.mastra.common.enableChat = true;\\n const CLINT_COMMON_PKG = '@powerhousedao/clint-common';\\n const CHAT_DOC_TYPE = 'powerhouse/chat-session';\\n const existing = state.packages.find(\\n (p) => p.packageName === CLINT_COMMON_PKG,\\n );\\n if (!existing) {\\n state.packages.push({\\n id: 'pkg-clint-common',\\n packageName: CLINT_COMMON_PKG,\\n documentTypes: [CHAT_DOC_TYPE],\\n version: null,\\n managed: true,\\n });\\n } else if (!existing.documentTypes.includes(CHAT_DOC_TYPE)) {\\n existing.documentTypes.push(CHAT_DOC_TYPE);\\n }\\n} else {\\n state.features.mastra.common.enableChat = false;\\n}\\n\\nstate.deployment.proxyEnabled = action.input.proxyEnabled ?? false;\\nstate.deployment.observabilityEnabled = action.input.observabilityEnabled ?? false;\\nstate.deployment.supportedResources = action.input.supportedResources\\n ? [...action.input.supportedResources]\\n : [];\",\n errors: [],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-deployment',\n name: 'deployment',\n description: 'Deployment settings: service announcement toggle and supported resource tiers.',\n operations: [\n {\n id: 'o-add-supported-resource',\n name: 'ADD_SUPPORTED_RESOURCE',\n description: 'Add a supported resource tier. Guards against duplicates.',\n schema: 'input AddSupportedResourceInput {\\n resource: String!\\n}',\n template: 'Add a supported resource tier. Guards against duplicates.',\n reducer:\n '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);',\n errors: [\n {\n id: 'e-duplicate-resource',\n name: 'DuplicateResourceError',\n code: 'DUPLICATE_RESOURCE',\n description: 'This resource is already in the supported resources list.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-supported-resource',\n name: 'REMOVE_SUPPORTED_RESOURCE',\n description: 'Remove a supported resource tier.',\n schema: 'input RemoveSupportedResourceInput {\\n resource: String!\\n}',\n template: 'Remove a supported resource tier.',\n reducer:\n '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);',\n errors: [\n {\n id: 'e-resource-not-found',\n name: 'ResourceNotFoundError',\n code: 'RESOURCE_NOT_FOUND',\n description: 'The specified resource was not found in the supported resources list.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-proxy-enabled',\n name: 'SET_PROXY_ENABLED',\n description: 'Toggle the embedded reverse proxy.',\n schema: 'input SetProxyEnabledInput {\\n enabled: Boolean!\\n}',\n template: 'Toggle the embedded reverse proxy.',\n reducer: 'state.deployment.proxyEnabled = action.input.enabled;',\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-observability-enabled',\n name: 'SET_OBSERVABILITY_ENABLED',\n description: 'Toggle the observability plugin (Sentry + OpenTelemetry).',\n schema: 'input SetObservabilityEnabledInput {\\n enabled: Boolean!\\n}',\n template: 'Toggle the observability plugin (Sentry + OpenTelemetry).',\n reducer: 'state.deployment.observabilityEnabled = action.input.enabled;',\n errors: [],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-features-mastra',\n name: 'features_mastra',\n description: 'Top-level Mastra feature toggles: enable/disable and chat integration.',\n operations: [\n {\n id: 'o-enable-mastra',\n name: 'ENABLE_MASTRA',\n description: 'Enable Mastra. Seeds mainAgent with a default model (clint/demo-agent) and a base profile. Idempotent.',\n schema: 'input EnableMastraInput {\\n agentId: OID!\\n agentName: String!\\n}',\n template: 'Enable the Mastra agent feature. Seeds mainAgent with the seeded model + profile.',\n reducer:\n \"if (!/^[a-z][a-z0-9-]*$/.test(action.input.agentId)) {\\n throw new InvalidAgentIdError(\\n `Invalid agent ID: ${action.input.agentId}. Must be lowercase kebab-case.`,\\n );\\n}\\nconst trimmedName = action.input.agentName.trim();\\nif (!trimmedName) {\\n throw new InvalidAgentNameError('Agent name must not be empty.');\\n}\\nstate.features.mastra.enabled = true;\\nif (state.features.mastra.models.length === 0) {\\n state.features.mastra.models.push({ id: 'clint/demo-agent' });\\n}\\nif (state.features.mastra.profiles.length === 0) {\\n state.features.mastra.profiles.push({ id: 'base', title: 'Base Profile', content: 'You are a helpful assistant.' });\\n}\\nconst existing = state.features.mastra.mainAgent;\\nif (!existing) {\\n state.features.mastra.mainAgent = {\\n id: action.input.agentId,\\n name: trimmedName,\\n description: null,\\n attachment: null,\\n modelId: 'clint/demo-agent',\\n profileIds: ['base'],\\n skills: [],\\n toolPatterns: [],\\n };\\n} else {\\n existing.id = action.input.agentId;\\n existing.name = trimmedName;\\n}\",\n errors: [\n {\n id: 'e-enable-mastra-invalid-id',\n name: 'InvalidAgentIdError',\n code: 'INVALID_AGENT_ID',\n description: 'The agent ID must match /^[a-z][a-z0-9-]*$/ \\u2014 lowercase kebab-case.',\n template: '',\n },\n {\n id: 'e-enable-mastra-invalid-name',\n name: 'InvalidAgentNameError',\n code: 'INVALID_AGENT_NAME',\n description: 'The agent name must not be empty after trimming.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-disable-mastra',\n name: 'DISABLE_MASTRA',\n description: 'Disable Mastra. Clears mainAgent, subAgents, models, profiles and the chat integration. Removes the auto-managed clint-common package.',\n schema: 'input DisableMastraInput {\\n _: Boolean\\n}',\n template: 'Disable the Mastra agent feature.',\n reducer:\n \"state.features.mastra.enabled = false;\\nstate.features.mastra.mainAgent = null;\\nstate.features.mastra.subAgents = [];\\nstate.features.mastra.models = [];\\nstate.features.mastra.profiles = [];\\nstate.features.mastra.common.enableChat = false;\\nconst ccIdx = state.packages.findIndex(\\n (p) => p.packageName === '@powerhousedao/clint-common' && p.managed,\\n);\\nif (ccIdx !== -1) {\\n state.packages.splice(ccIdx, 1);\\n}\",\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-enable-chat',\n name: 'SET_ENABLE_CHAT',\n 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.',\n schema: 'input SetEnableChatInput {\\n enabled: Boolean!\\n}',\n template: 'Toggle the chat integration feature. Requires both Mastra and Powerhouse to be enabled.',\n reducer:\n \"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}\",\n errors: [\n {\n id: 'e-chat-mastra-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before toggling chat.',\n template: '',\n },\n {\n id: 'e-chat-powerhouse-not-enabled',\n name: 'PowerhouseNotEnabledError',\n code: 'POWERHOUSE_NOT_ENABLED',\n description: 'Powerhouse must be enabled (Reactor or above) before toggling chat.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-mastra-models',\n name: 'mastra_models',\n description: 'Model library CRUD. Models are referenced by main and sub agents via modelId.',\n operations: [\n {\n id: 'o-add-model',\n name: 'ADD_MODEL',\n description: 'Add a model to the library. ID must be provider/model-name format. First model is forced default. If isDefault is true, previous default is unset.',\n schema: 'input AddModelInput {\\n id: OID!\\n}',\n template: 'Add a model to the library.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot add model when Mastra is disabled.');\\n}\\nif (!/^[a-z0-9-]+\\\\/[a-z0-9._-]+$/.test(action.input.id)) {\\n throw new InvalidModelIdError(`Invalid model ID: ${action.input.id}. Must be provider/model-name format.`);\\n}\\nif (state.features.mastra.models.find((m) => m.id === action.input.id)) {\\n throw new DuplicateModelError(`Model already exists: ${action.input.id}`);\\n}\\nstate.features.mastra.models.push({ id: action.input.id });\",\n errors: [\n {\n id: 'e-add-model-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing models.',\n template: '',\n },\n {\n id: 'e-add-model-invalid-id',\n name: 'InvalidModelIdError',\n code: 'INVALID_MODEL_ID',\n description: 'Model ID must match provider/model-name format.',\n template: '',\n },\n {\n id: 'e-add-model-duplicate',\n name: 'DuplicateModelError',\n code: 'DUPLICATE_MODEL',\n description: 'A model with this ID already exists.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-model',\n name: 'REMOVE_MODEL',\n description: 'Remove a model from the library. Rejects when any agent (main or sub) references it. Promotes first remaining to default if removing the current default.',\n schema: 'input RemoveModelInput {\\n id: OID!\\n}',\n template: 'Remove a model from the library.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot remove model when Mastra is disabled.');\\n}\\nconst idx = state.features.mastra.models.findIndex((m) => m.id === action.input.id);\\nif (idx === -1) {\\n throw new ModelNotFoundError(`Model not found: ${action.input.id}`);\\n}\\nconst main = state.features.mastra.mainAgent;\\nconst usedByMain = !!main && main.modelId === action.input.id;\\nconst usedBySub = state.features.mastra.subAgents.some(\\n (s) => s.modelId === action.input.id,\\n);\\nif (usedByMain || usedBySub) {\\n throw new ModelInUseError(\\n `Model ${action.input.id} is in use by an agent.`,\\n );\\n}\\nstate.features.mastra.models.splice(idx, 1);\",\n errors: [\n {\n id: 'e-remove-model-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing models.',\n template: '',\n },\n {\n id: 'e-remove-model-not-found',\n name: 'ModelNotFoundError',\n code: 'MODEL_NOT_FOUND',\n description: 'The specified model was not found.',\n template: '',\n },\n {\n id: 'e-remove-model-in-use',\n name: 'ModelInUseError',\n code: 'MODEL_IN_USE',\n description: 'Cannot remove a model that is still referenced by an agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-mastra-profiles',\n name: 'mastra_profiles',\n description: 'Profile library CRUD. Profiles are referenced by main and sub agents via profileIds.',\n operations: [\n {\n id: 'o-add-profile',\n name: 'ADD_PROFILE',\n description: 'Add a profile to the library. Inserted before insertBefore if provided, otherwise appended.',\n schema: 'input AddProfileInput {\\n id: OID!\\n title: String!\\n content: String!\\n insertBefore: OID\\n}',\n template: 'Add a profile to the library.',\n reducer:\n \"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}\",\n errors: [\n {\n id: 'e-add-profile-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing profiles.',\n template: '',\n },\n {\n id: 'e-add-profile-invalid-id',\n name: 'InvalidProfileIdError',\n code: 'INVALID_PROFILE_ID',\n description: 'Profile ID must match /^[a-z][a-z0-9-]*$/ \\u2014 lowercase kebab-case.',\n template: '',\n },\n {\n id: 'e-add-profile-duplicate',\n name: 'DuplicateProfileError',\n code: 'DUPLICATE_PROFILE',\n description: 'A profile with this ID already exists.',\n template: '',\n },\n {\n id: 'e-add-profile-not-found',\n name: 'ProfileNotFoundError',\n code: 'PROFILE_NOT_FOUND',\n description: 'The insertBefore profile was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-update-profile',\n name: 'UPDATE_PROFILE',\n description: \"Update an existing profile's title and/or content. Only updates provided fields.\",\n schema: 'input UpdateProfileInput {\\n id: OID!\\n title: String\\n content: String\\n}',\n template: 'Update an existing profile.',\n reducer:\n \"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;\",\n errors: [\n {\n id: 'e-update-profile-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing profiles.',\n template: '',\n },\n {\n id: 'e-update-profile-not-found',\n name: 'ProfileNotFoundError',\n code: 'PROFILE_NOT_FOUND',\n description: 'The specified profile was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-profile',\n name: 'REMOVE_PROFILE',\n description: 'Remove a profile from the library. Rejects when any agent (main or sub) references it.',\n schema: 'input RemoveProfileInput {\\n id: OID!\\n}',\n template: 'Remove a profile from the library.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot remove profile when Mastra is disabled.');\\n}\\nconst idx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.id);\\nif (idx === -1) {\\n throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);\\n}\\nconst main = state.features.mastra.mainAgent;\\nconst usedByMain = !!main && main.profileIds.includes(action.input.id);\\nconst usedBySub = state.features.mastra.subAgents.some(\\n (s) => s.profileIds.includes(action.input.id),\\n);\\nif (usedByMain || usedBySub) {\\n throw new ProfileInUseError(\\n `Profile ${action.input.id} is in use by an agent.`,\\n );\\n}\\nstate.features.mastra.profiles.splice(idx, 1);\",\n errors: [\n {\n id: 'e-remove-profile-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing profiles.',\n template: '',\n },\n {\n id: 'e-remove-profile-not-found',\n name: 'ProfileNotFoundError',\n code: 'PROFILE_NOT_FOUND',\n description: 'The specified profile was not found.',\n template: '',\n },\n {\n id: 'e-remove-profile-in-use',\n name: 'ProfileInUseError',\n code: 'PROFILE_IN_USE',\n description: 'Cannot remove a profile that is still referenced by an agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-reorder-profiles',\n name: 'REORDER_PROFILES',\n description: 'Move one or more profiles before another profile, or to the end if insertBefore is null.',\n schema: 'input ReorderProfilesInput {\\n ids: [OID!]!\\n insertBefore: OID\\n}',\n template: 'Reorder profiles.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot reorder profiles when Mastra is disabled.');\\n}\\nconst moving = [];\\nfor (const id of action.input.ids) {\\n const profile = state.features.mastra.profiles.find(p => p.id === id);\\n if (!profile) {\\n throw new ProfileNotFoundError(`Profile not found: ${id}`);\\n }\\n moving.push(profile);\\n}\\nstate.features.mastra.profiles = state.features.mastra.profiles.filter(p => !action.input.ids.includes(p.id));\\nif (action.input.insertBefore) {\\n const beforeIdx = state.features.mastra.profiles.findIndex(p => p.id === action.input.insertBefore);\\n if (beforeIdx === -1) {\\n throw new ProfileNotFoundError(`insertBefore profile not found: ${action.input.insertBefore}`);\\n }\\n state.features.mastra.profiles.splice(beforeIdx, 0, ...moving);\\n} else {\\n state.features.mastra.profiles.push(...moving);\\n}\",\n errors: [\n {\n id: 'e-reorder-profiles-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing profiles.',\n template: '',\n },\n {\n id: 'e-reorder-profiles-not-found',\n name: 'ProfileNotFoundError',\n code: 'PROFILE_NOT_FOUND',\n description: 'A referenced profile was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-mastra-main-agent',\n name: 'mastra_main_agent',\n description: 'Main agent identity ops. Main agent ID is set at ENABLE_MASTRA and stable thereafter \\u2014 to change it, disable then re-enable.',\n operations: [\n {\n id: 'o-set-main-agent-name',\n name: 'SET_MAIN_AGENT_NAME',\n description: \"Set the main agent's display name. Must be non-empty after trim.\",\n schema: 'input SetMainAgentNameInput {\\n name: String!\\n}',\n template: \"Set the main agent's display name.\",\n reducer:\n \"const main = state.features.mastra.mainAgent;\\nif (!state.features.mastra.enabled || !main) {\\n throw new MastraNotEnabledError(\\n 'Cannot set main agent name when Mastra is disabled.',\\n );\\n}\\nconst trimmed = action.input.name.trim();\\nif (!trimmed) {\\n throw new InvalidAgentNameError('Agent name must not be empty.');\\n}\\nmain.name = trimmed;\",\n errors: [\n {\n id: 'e-set-main-name-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing the main agent.',\n template: '',\n },\n {\n id: 'e-set-main-name-invalid',\n name: 'InvalidAgentNameError',\n code: 'INVALID_AGENT_NAME',\n description: 'The agent name must not be empty after trimming.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-main-agent-description',\n name: 'SET_MAIN_AGENT_DESCRIPTION',\n description: \"Set the main agent's description.\",\n schema: 'input SetMainAgentDescriptionInput {\\n description: String!\\n}',\n template: \"Set the main agent's description.\",\n reducer:\n \"const main = state.features.mastra.mainAgent;\\nif (!state.features.mastra.enabled || !main) {\\n throw new MastraNotEnabledError(\\n 'Cannot set main agent description when Mastra is disabled.',\\n );\\n}\\nmain.description = action.input.description;\",\n errors: [\n {\n id: 'e-set-main-desc-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing the main agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-clear-main-agent-description',\n name: 'CLEAR_MAIN_AGENT_DESCRIPTION',\n description: \"Clear the main agent's description.\",\n schema: 'input ClearMainAgentDescriptionInput {\\n _: Boolean\\n}',\n template: \"Clear the main agent's description.\",\n reducer:\n \"const main = state.features.mastra.mainAgent;\\nif (!state.features.mastra.enabled || !main) {\\n throw new MastraNotEnabledError(\\n 'Cannot clear main agent description when Mastra is disabled.',\\n );\\n}\\nmain.description = null;\",\n errors: [\n {\n id: 'e-clear-main-desc-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing the main agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-main-agent-image',\n name: 'SET_MAIN_AGENT_IMAGE',\n description: \"Set the main agent's avatar attachment ref.\",\n schema: 'input SetMainAgentImageInput {\\n attachment: String!\\n}',\n template: \"Set the main agent's avatar.\",\n reducer:\n \"const main = state.features.mastra.mainAgent;\\nif (!state.features.mastra.enabled || !main) {\\n throw new MastraNotEnabledError(\\n 'Cannot set main agent image when Mastra is disabled.',\\n );\\n}\\nif (!action.input.attachment.startsWith('attachment://')) {\\n throw new InvalidAgentImageError(\\n 'Agent image must be an attachment ref (attachment://...)',\\n );\\n}\\nmain.attachment = action.input.attachment;\",\n errors: [\n {\n id: 'e-set-main-image-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing the main agent.',\n template: '',\n },\n {\n id: 'e-set-main-image-invalid',\n name: 'InvalidAgentImageError',\n code: 'INVALID_AGENT_IMAGE',\n description: 'Agent image must be an attachment ref',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-clear-main-agent-image',\n name: 'CLEAR_MAIN_AGENT_IMAGE',\n description: \"Clear the main agent's avatar.\",\n schema: 'input ClearMainAgentImageInput {\\n _: Boolean\\n}',\n template: \"Clear the main agent's avatar.\",\n reducer:\n \"const main = state.features.mastra.mainAgent;\\nif (!state.features.mastra.enabled || !main) {\\n throw new MastraNotEnabledError(\\n 'Cannot clear main agent image when Mastra is disabled.',\\n );\\n}\\nmain.attachment = null;\",\n errors: [\n {\n id: 'e-clear-main-image-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing the main agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-mastra-sub-agents',\n name: 'mastra_sub_agents',\n description: 'Sub-agent CRUD. Sub-agent ids are unique across the main agent and all other sub-agents.',\n operations: [\n {\n id: 'o-add-sub-agent',\n name: 'ADD_SUB_AGENT',\n description: 'Add a sub-agent. ID must be lowercase kebab-case and unique (across main + sub agents). modelId must exist in the model library. Seeds empty profileIds/skills/toolPatterns.',\n schema: 'input AddSubAgentInput {\\n id: OID!\\n name: String!\\n description: String!\\n modelId: OID!\\n}',\n template: 'Add a sub-agent.',\n reducer:\n \"const main = state.features.mastra.mainAgent;\\nif (!state.features.mastra.enabled || !main) {\\n throw new MastraNotEnabledError(\\n 'Cannot add sub-agent when Mastra is disabled.',\\n );\\n}\\nif (!/^[a-z][a-z0-9-]*$/.test(action.input.id)) {\\n throw new InvalidAgentIdError(\\n `Invalid sub-agent ID: ${action.input.id}. Must be lowercase kebab-case.`,\\n );\\n}\\nconst trimmedName = action.input.name.trim();\\nif (!trimmedName) {\\n throw new InvalidAgentNameError('Sub-agent name must not be empty.');\\n}\\nif (main.id === action.input.id) {\\n throw new DuplicateAgentIdError(\\n `Agent ID already taken by main agent: ${action.input.id}`,\\n );\\n}\\nif (state.features.mastra.subAgents.find((s) => s.id === action.input.id)) {\\n throw new DuplicateAgentIdError(\\n `Sub-agent already exists: ${action.input.id}`,\\n );\\n}\\nif (!state.features.mastra.models.find((m) => m.id === action.input.modelId)) {\\n throw new ModelReferenceNotFoundError(\\n `Model not in library: ${action.input.modelId}`,\\n );\\n}\\nstate.features.mastra.subAgents.push({\\n id: action.input.id,\\n name: trimmedName,\\n description: action.input.description,\\n modelId: action.input.modelId,\\n profileIds: [],\\n skills: [],\\n toolPatterns: [],\\n});\",\n errors: [\n {\n id: 'e-add-sub-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing sub-agents.',\n template: '',\n },\n {\n id: 'e-add-sub-invalid-id',\n name: 'InvalidAgentIdError',\n code: 'INVALID_AGENT_ID',\n description: 'Sub-agent ID must be lowercase kebab-case.',\n template: '',\n },\n {\n id: 'e-add-sub-invalid-name',\n name: 'InvalidAgentNameError',\n code: 'INVALID_AGENT_NAME',\n description: 'Sub-agent name must not be empty after trimming.',\n template: '',\n },\n {\n id: 'e-add-sub-duplicate',\n name: 'DuplicateAgentIdError',\n code: 'DUPLICATE_AGENT_ID',\n description: 'An agent with this ID already exists (main or sub).',\n template: '',\n },\n {\n id: 'e-add-sub-model-not-found',\n name: 'ModelReferenceNotFoundError',\n code: 'MODEL_REFERENCE_NOT_FOUND',\n description: 'The referenced modelId does not exist in the model library.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-sub-agent',\n name: 'REMOVE_SUB_AGENT',\n description: 'Remove a sub-agent.',\n schema: 'input RemoveSubAgentInput {\\n id: OID!\\n}',\n template: 'Remove a sub-agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot remove sub-agent when Mastra is disabled.');\\n}\\nconst idx = state.features.mastra.subAgents.findIndex(s => s.id === action.input.id);\\nif (idx === -1) {\\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\\n}\\nstate.features.mastra.subAgents.splice(idx, 1);\",\n errors: [\n {\n id: 'e-remove-sub-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing sub-agents.',\n template: '',\n },\n {\n id: 'e-remove-sub-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified sub-agent was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-sub-agent-name',\n name: 'SET_SUB_AGENT_NAME',\n description: \"Set a sub-agent's display name.\",\n schema: 'input SetSubAgentNameInput {\\n id: OID!\\n name: String!\\n}',\n template: \"Set a sub-agent's display name.\",\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot set sub-agent name when Mastra is disabled.');\\n}\\nconst sub = state.features.mastra.subAgents.find(s => s.id === action.input.id);\\nif (!sub) {\\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\\n}\\nconst trimmed = action.input.name.trim();\\nif (!trimmed) {\\n throw new InvalidAgentNameError('Sub-agent name must not be empty.');\\n}\\nsub.name = trimmed;\",\n errors: [\n {\n id: 'e-set-sub-name-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing sub-agents.',\n template: '',\n },\n {\n id: 'e-set-sub-name-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified sub-agent was not found.',\n template: '',\n },\n {\n id: 'e-set-sub-name-invalid',\n name: 'InvalidAgentNameError',\n code: 'INVALID_AGENT_NAME',\n description: 'Sub-agent name must not be empty after trimming.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-sub-agent-description',\n name: 'SET_SUB_AGENT_DESCRIPTION',\n description: \"Set a sub-agent's description.\",\n schema: 'input SetSubAgentDescriptionInput {\\n id: OID!\\n description: String!\\n}',\n template: \"Set a sub-agent's description.\",\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot set sub-agent description when Mastra is disabled.');\\n}\\nconst sub = state.features.mastra.subAgents.find(s => s.id === action.input.id);\\nif (!sub) {\\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\\n}\\nsub.description = action.input.description;\",\n errors: [\n {\n id: 'e-set-sub-desc-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing sub-agents.',\n template: '',\n },\n {\n id: 'e-set-sub-desc-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified sub-agent was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-mastra-agent-bindings',\n name: 'mastra_agent_bindings',\n description: 'Per-agent assignments of model, profile references, skills, and tool-name patterns. agentId resolves to main if it matches mainAgent.id, else looks up subAgents.',\n operations: [\n {\n id: 'o-set-agent-model',\n name: 'SET_AGENT_MODEL',\n description: \"Set the agent's model. modelId must exist in the model library. agentId resolves to main or a sub.\",\n schema: 'input SetAgentModelInput {\\n agentId: OID!\\n modelId: OID!\\n}',\n template: 'Bind an agent to a model.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot set agent model when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nif (!state.features.mastra.models.find((m) => m.id === action.input.modelId)) {\\n throw new ModelReferenceNotFoundError(\\n `Model not in library: ${action.input.modelId}`,\\n );\\n}\\nagent.modelId = action.input.modelId;\",\n errors: [\n {\n id: 'e-set-model-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing agent bindings.',\n template: '',\n },\n {\n id: 'e-set-model-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId resolves to neither main nor any sub-agent.',\n template: '',\n },\n {\n id: 'e-set-model-ref-not-found',\n name: 'ModelReferenceNotFoundError',\n code: 'MODEL_REFERENCE_NOT_FOUND',\n description: 'The referenced modelId does not exist in the model library.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-add-agent-profile-ref',\n name: 'ADD_AGENT_PROFILE_REF',\n description: 'Add a profile reference to an agent. profileId must exist in the profile library. Inserts before insertBefore if provided, otherwise appends. Dedup: silent if already present.',\n schema: 'input AddAgentProfileRefInput {\\n agentId: OID!\\n profileId: OID!\\n insertBefore: OID\\n}',\n template: 'Add a profile reference to an agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot add profile ref when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nif (!state.features.mastra.profiles.find((p) => p.id === action.input.profileId)) {\\n throw new ProfileReferenceNotFoundError(\\n `Profile not in library: ${action.input.profileId}`,\\n );\\n}\\nif (agent.profileIds.includes(action.input.profileId)) {\\n return;\\n}\\nif (action.input.insertBefore) {\\n const beforeIdx = agent.profileIds.indexOf(action.input.insertBefore);\\n if (beforeIdx === -1) {\\n throw new ProfileReferenceNotFoundError(\\n `insertBefore profile not in agent's profileIds: ${action.input.insertBefore}`,\\n );\\n }\\n agent.profileIds.splice(beforeIdx, 0, action.input.profileId);\\n} else {\\n agent.profileIds.push(action.input.profileId);\\n}\",\n errors: [\n {\n id: 'e-add-profile-ref-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-add-profile-ref-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-add-profile-ref-not-found',\n name: 'ProfileReferenceNotFoundError',\n code: 'PROFILE_REFERENCE_NOT_FOUND',\n description: 'The referenced profileId does not exist in the profile library, or insertBefore is not present in the agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-agent-profile-ref',\n name: 'REMOVE_AGENT_PROFILE_REF',\n description: 'Remove a profile reference from an agent.',\n schema: 'input RemoveAgentProfileRefInput {\\n agentId: OID!\\n profileId: OID!\\n}',\n template: 'Remove a profile reference from an agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot remove profile ref when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nconst idx = agent.profileIds.indexOf(action.input.profileId);\\nif (idx === -1) {\\n throw new ProfileReferenceNotFoundError(\\n `Profile not in agent's profileIds: ${action.input.profileId}`,\\n );\\n}\\nagent.profileIds.splice(idx, 1);\",\n errors: [\n {\n id: 'e-remove-profile-ref-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-remove-profile-ref-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-remove-profile-ref-not-found',\n name: 'ProfileReferenceNotFoundError',\n code: 'PROFILE_REFERENCE_NOT_FOUND',\n description: \"The profileId is not present in this agent's profileIds.\",\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-reorder-agent-profile-refs',\n name: 'REORDER_AGENT_PROFILE_REFS',\n description: \"Reorder an agent's profile references. Moves the given ids before insertBefore, or to the end if insertBefore is null.\",\n schema: 'input ReorderAgentProfileRefsInput {\\n agentId: OID!\\n ids: [OID!]!\\n insertBefore: OID\\n}',\n template: \"Reorder an agent's profile references.\",\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot reorder profile refs when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nfor (const id of action.input.ids) {\\n if (!agent.profileIds.includes(id)) {\\n throw new ProfileReferenceNotFoundError(\\n `Profile not in agent's profileIds: ${id}`,\\n );\\n }\\n}\\nconst remaining = agent.profileIds.filter(\\n (id) => !action.input.ids.includes(id),\\n);\\nif (action.input.insertBefore) {\\n const beforeIdx = remaining.indexOf(action.input.insertBefore);\\n if (beforeIdx === -1) {\\n throw new ProfileReferenceNotFoundError(\\n `insertBefore profile not in agent's profileIds: ${action.input.insertBefore}`,\\n );\\n }\\n remaining.splice(beforeIdx, 0, ...action.input.ids);\\n} else {\\n remaining.push(...action.input.ids);\\n}\\nagent.profileIds = remaining;\",\n errors: [\n {\n id: 'e-reorder-refs-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-reorder-refs-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-reorder-refs-not-found',\n name: 'ProfileReferenceNotFoundError',\n code: 'PROFILE_REFERENCE_NOT_FOUND',\n description: 'A referenced profileId is not present in this agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-add-agent-skill',\n name: 'ADD_AGENT_SKILL',\n description: 'Add a skill name to an agent. Dedup: silent if already present.',\n schema: 'input AddAgentSkillInput {\\n agentId: OID!\\n name: String!\\n}',\n template: 'Add a skill to an agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot add skill when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nconst trimmed = action.input.name.trim();\\nif (!/^[a-z][a-z0-9-]*$/.test(trimmed)) {\\n throw new InvalidSkillNameError(\\n `Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`,\\n );\\n}\\nif (!agent.skills.includes(trimmed)) {\\n agent.skills.push(trimmed);\\n}\",\n errors: [\n {\n id: 'e-add-skill-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-add-skill-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-add-skill-invalid',\n name: 'InvalidSkillNameError',\n code: 'INVALID_SKILL_NAME',\n description: 'Skill name must be lowercase kebab-case.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-agent-skill',\n name: 'REMOVE_AGENT_SKILL',\n description: 'Remove a skill name from an agent.',\n schema: 'input RemoveAgentSkillInput {\\n agentId: OID!\\n name: String!\\n}',\n template: 'Remove a skill from an agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot remove skill when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nconst idx = agent.skills.indexOf(action.input.name);\\nif (idx === -1) {\\n throw new SkillNotFoundError(`Skill not on agent: ${action.input.name}`);\\n}\\nagent.skills.splice(idx, 1);\",\n errors: [\n {\n id: 'e-remove-skill-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-remove-skill-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-remove-skill-not-found',\n name: 'SkillNotFoundError',\n code: 'SKILL_NOT_FOUND',\n description: 'The skill name is not on this agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-add-agent-tool-pattern',\n name: 'ADD_AGENT_TOOL_PATTERN',\n description: 'Add a tool-name glob pattern to an agent. Dedup: silent if already present.',\n schema: 'input AddAgentToolPatternInput {\\n agentId: OID!\\n pattern: String!\\n}',\n template: 'Add a tool-name pattern to an agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot add tool pattern when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nconst trimmed = action.input.pattern.trim();\\nif (!trimmed) {\\n throw new InvalidToolPatternError('Tool pattern must not be empty after trimming.');\\n}\\nif (!agent.toolPatterns.includes(trimmed)) {\\n agent.toolPatterns.push(trimmed);\\n}\",\n errors: [\n {\n id: 'e-add-pattern-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-add-pattern-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-add-pattern-invalid',\n name: 'InvalidToolPatternError',\n code: 'INVALID_TOOL_PATTERN',\n description: 'Tool pattern must not be empty after trimming.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-agent-tool-pattern',\n name: 'REMOVE_AGENT_TOOL_PATTERN',\n description: 'Remove a tool-name glob pattern from an agent.',\n schema: 'input RemoveAgentToolPatternInput {\\n agentId: OID!\\n pattern: String!\\n}',\n template: 'Remove a tool-name pattern from an agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot remove tool pattern when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nconst idx = agent.toolPatterns.indexOf(action.input.pattern);\\nif (idx === -1) {\\n throw new ToolPatternNotFoundError(\\n `Tool pattern not on agent: ${action.input.pattern}`,\\n );\\n}\\nagent.toolPatterns.splice(idx, 1);\",\n errors: [\n {\n id: 'e-remove-pattern-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-remove-pattern-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-remove-pattern-not-found',\n name: 'ToolPatternNotFoundError',\n code: 'TOOL_PATTERN_NOT_FOUND',\n description: 'The tool pattern is not on this agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n ],\n version: 1,\n changeLog: [],\n },\n ],\n};\n","export type ErrorCode = 'DuplicateResourceError' | 'ResourceNotFoundError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class DuplicateResourceError extends Error implements ReducerError {\n errorCode = 'DuplicateResourceError' as ErrorCode;\n constructor(message = 'DuplicateResourceError') {\n super(message);\n }\n}\n\nexport class ResourceNotFoundError extends Error implements ReducerError {\n errorCode = 'ResourceNotFoundError' as ErrorCode;\n constructor(message = 'ResourceNotFoundError') {\n super(message);\n }\n}\n\nexport const errors = {\n AddSupportedResource: { DuplicateResourceError },\n RemoveSupportedResource: { ResourceNotFoundError },\n};\n","import type { PhClintProjectDeploymentOperations } from 'document-models/ph-clint-project/v1';\nimport { DuplicateResourceError, ResourceNotFoundError } from '../../gen/deployment/error.js';\n\nexport const phClintProjectDeploymentOperations: PhClintProjectDeploymentOperations = {\n addSupportedResourceOperation(state, action) {\n if (state.deployment.supportedResources.includes(action.input.resource)) {\n throw new DuplicateResourceError(`Resource already exists: ${action.input.resource}`);\n }\n state.deployment.supportedResources.push(action.input.resource);\n },\n removeSupportedResourceOperation(state, action) {\n const idx = state.deployment.supportedResources.indexOf(action.input.resource);\n if (idx === -1) {\n throw new ResourceNotFoundError(`Resource not found: ${action.input.resource}`);\n }\n state.deployment.supportedResources.splice(idx, 1);\n },\n setProxyEnabledOperation(state, action) {\n state.deployment.proxyEnabled = action.input.enabled;\n },\n setObservabilityEnabledOperation(state, action) {\n state.deployment.observabilityEnabled = action.input.enabled;\n },\n};\n","export type ErrorCode = 'InvalidSkillNameError' | 'DuplicateSkillError' | 'SkillNotFoundError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidSkillNameError extends Error implements ReducerError {\n errorCode = 'InvalidSkillNameError' as ErrorCode;\n constructor(message = 'InvalidSkillNameError') {\n super(message);\n }\n}\n\nexport class DuplicateSkillError extends Error implements ReducerError {\n errorCode = 'DuplicateSkillError' as ErrorCode;\n constructor(message = 'DuplicateSkillError') {\n super(message);\n }\n}\n\nexport class SkillNotFoundError extends Error implements ReducerError {\n errorCode = 'SkillNotFoundError' as ErrorCode;\n constructor(message = 'SkillNotFoundError') {\n super(message);\n }\n}\n\nexport const errors = {\n AddExternalSkill: { InvalidSkillNameError, DuplicateSkillError },\n RemoveExternalSkill: { SkillNotFoundError },\n SetExternalSkillName: {\n SkillNotFoundError,\n InvalidSkillNameError,\n DuplicateSkillError,\n },\n SetExternalSkillGithubUrl: { SkillNotFoundError },\n};\n","import type { PhClintProjectExternalSkillsOperations } from 'document-models/ph-clint-project/v1';\nimport { DuplicateSkillError, InvalidSkillNameError, SkillNotFoundError } from '../../gen/external-skills/error.js';\n\nexport const phClintProjectExternalSkillsOperations: PhClintProjectExternalSkillsOperations = {\n addExternalSkillOperation(state, action) {\n 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 }\n const exists = state.externalSkills.find((s) => s.id === action.input.id || s.name === action.input.name);\n if (exists) {\n throw new DuplicateSkillError(`Skill already exists: ${action.input.name}`);\n }\n state.externalSkills.push({\n id: action.input.id,\n name: action.input.name,\n githubUrl: action.input.githubUrl,\n });\n },\n removeExternalSkillOperation(state, action) {\n const idx = state.externalSkills.findIndex((s) => s.id === action.input.id);\n if (idx === -1) {\n throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);\n }\n state.externalSkills.splice(idx, 1);\n },\n setExternalSkillNameOperation(state, action) {\n const skill = state.externalSkills.find((s) => s.id === action.input.id);\n if (!skill) {\n throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);\n }\n 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 }\n const duplicate = state.externalSkills.find((s) => s.name === action.input.name && s.id !== action.input.id);\n if (duplicate) {\n throw new DuplicateSkillError(`Skill name already in use: ${action.input.name}`);\n }\n skill.name = action.input.name;\n },\n setExternalSkillGithubUrlOperation(state, action) {\n const skill = state.externalSkills.find((s) => s.id === action.input.id);\n if (!skill) {\n throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);\n }\n skill.githubUrl = action.input.githubUrl;\n },\n};\n","export type ErrorCode = 'InvalidAgentIdError' | 'InvalidAgentNameError' | 'MastraNotEnabledError' | 'PowerhouseNotEnabledError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidAgentIdError extends Error implements ReducerError {\n errorCode = 'InvalidAgentIdError' as ErrorCode;\n constructor(message = 'InvalidAgentIdError') {\n super(message);\n }\n}\n\nexport class InvalidAgentNameError extends Error implements ReducerError {\n errorCode = 'InvalidAgentNameError' as ErrorCode;\n constructor(message = 'InvalidAgentNameError') {\n super(message);\n }\n}\n\nexport class MastraNotEnabledError extends Error implements ReducerError {\n errorCode = 'MastraNotEnabledError' as ErrorCode;\n constructor(message = 'MastraNotEnabledError') {\n super(message);\n }\n}\n\nexport class PowerhouseNotEnabledError extends Error implements ReducerError {\n errorCode = 'PowerhouseNotEnabledError' as ErrorCode;\n constructor(message = 'PowerhouseNotEnabledError') {\n super(message);\n }\n}\n\nexport const errors = {\n EnableMastra: { InvalidAgentIdError, InvalidAgentNameError },\n SetEnableChat: { MastraNotEnabledError, PowerhouseNotEnabledError },\n};\n","import type { PhClintProjectFeaturesMastraOperations } from 'document-models/ph-clint-project/v1';\nimport { InvalidAgentIdError, InvalidAgentNameError, MastraNotEnabledError, PowerhouseNotEnabledError } from '../../gen/features-mastra/error.js';\n\nexport const phClintProjectFeaturesMastraOperations: PhClintProjectFeaturesMastraOperations = {\n enableMastraOperation(state, action) {\n if (!/^[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 }\n const trimmedName = action.input.agentName.trim();\n if (!trimmedName) {\n throw new InvalidAgentNameError('Agent name must not be empty.');\n }\n state.features.mastra.enabled = true;\n if (state.features.mastra.models.length === 0) {\n state.features.mastra.models.push({ id: 'clint/demo-agent' });\n }\n if (state.features.mastra.profiles.length === 0) {\n state.features.mastra.profiles.push({\n id: 'base',\n title: 'Base Profile',\n content: 'You are a helpful assistant.',\n });\n }\n const existing = state.features.mastra.mainAgent;\n if (!existing) {\n state.features.mastra.mainAgent = {\n id: action.input.agentId,\n name: trimmedName,\n description: null,\n attachment: null,\n modelId: 'clint/demo-agent',\n profileIds: ['base'],\n skills: [],\n toolPatterns: [],\n };\n } else {\n existing.id = action.input.agentId;\n existing.name = trimmedName;\n }\n },\n disableMastraOperation(state) {\n state.features.mastra.enabled = false;\n state.features.mastra.mainAgent = null;\n state.features.mastra.subAgents = [];\n state.features.mastra.models = [];\n state.features.mastra.profiles = [];\n state.features.mastra.common.enableChat = false;\n const ccIdx = state.packages.findIndex((p) => p.packageName === '@powerhousedao/clint-common' && p.managed);\n if (ccIdx !== -1) {\n state.packages.splice(ccIdx, 1);\n }\n },\n setEnableChatOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot toggle chat when Mastra is disabled.');\n }\n if (state.features.powerhouse === 'Disabled') {\n throw new PowerhouseNotEnabledError('Cannot toggle chat when Powerhouse is disabled.');\n }\n state.features.mastra.common.enableChat = action.input.enabled;\n const CLINT_COMMON_PKG = '@powerhousedao/clint-common';\n const CHAT_DOC_TYPE = 'powerhouse/chat-session';\n if (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((p) => p.packageName === CLINT_COMMON_PKG && p.managed);\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 }\n },\n};\n","export type ErrorCode = 'CannotLowerPowerhouseError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class CannotLowerPowerhouseError extends Error implements ReducerError {\n errorCode = 'CannotLowerPowerhouseError' as ErrorCode;\n constructor(message = 'CannotLowerPowerhouseError') {\n super(message);\n }\n}\n\nexport const errors = {\n SetPowerhouseLevel: { CannotLowerPowerhouseError },\n};\n","import type { PhClintProjectFeaturesPowerhouseOperations } from 'document-models/ph-clint-project/v1';\nimport { CannotLowerPowerhouseError } from '../../gen/features-powerhouse/error.js';\n\nconst LEVELS = ['Disabled', 'Reactor', 'Switchboard', 'Connect'] as const;\n\nexport const phClintProjectFeaturesPowerhouseOperations: PhClintProjectFeaturesPowerhouseOperations = {\n setPowerhouseLevelOperation(state, action) {\n const current = LEVELS.indexOf(state.features.powerhouse);\n const next = LEVELS.indexOf(action.input.level);\n if (current >= 1 && next < 1) {\n throw new CannotLowerPowerhouseError('Cannot lower Powerhouse level below Reactor once enabled');\n }\n state.features.powerhouse = action.input.level;\n // Auto-create managed app package when transitioning from Disabled to enabled\n if (current === 0 && next >= 1) {\n const hasManaged = state.packages.some((p) => p.managed);\n if (!hasManaged) {\n const baseName = state.name ? state.name.replace(/-cli$/, '-app') : 'app';\n const appName = state.scope && state.name ? `${state.scope}/${baseName}` : 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 }\n // Auto-enable proxy when reaching Switchboard or above\n if (next >= 2 && !action.input.skipAutoProxy) {\n state.deployment.proxyEnabled = true;\n }\n },\n};\n","import type { PhClintProjectFeaturesRoutineOperations } from 'document-models/ph-clint-project/v1';\n\nexport const phClintProjectFeaturesRoutineOperations: PhClintProjectFeaturesRoutineOperations = {\n enableRoutineOperation(state) {\n state.features.routine.enabled = true;\n },\n disableRoutineOperation(state) {\n state.features.routine.enabled = false;\n },\n};\n","export type ErrorCode = 'InvalidVersionError' | 'InvalidPackageIdentifierError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidVersionError extends Error implements ReducerError {\n errorCode = 'InvalidVersionError' as ErrorCode;\n constructor(message = 'InvalidVersionError') {\n super(message);\n }\n}\n\nexport class InvalidPackageIdentifierError extends Error implements ReducerError {\n errorCode = 'InvalidPackageIdentifierError' as ErrorCode;\n constructor(message = 'InvalidPackageIdentifierError') {\n super(message);\n }\n}\n\nexport const errors = {\n SetVersion: { InvalidVersionError },\n SetPackageIdentifier: { InvalidPackageIdentifierError },\n};\n","import type { PhClintProjectIdentityOperations } from 'document-models/ph-clint-project/v1';\nimport { InvalidPackageIdentifierError, InvalidVersionError } from '../../gen/identity/error.js';\n\nconst SEMVER_PATTERN = /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\nconst NAME_PATTERN = /^[a-z][a-z0-9-]*$/;\n\nexport const phClintProjectIdentityOperations: PhClintProjectIdentityOperations = {\n setVersionOperation(state, action) {\n if (!SEMVER_PATTERN.test(action.input.version)) {\n throw new InvalidVersionError(`Invalid version: ${action.input.version}`);\n }\n state.version = action.input.version;\n },\n setDescriptionOperation(state, action) {\n state.description = action.input.description;\n },\n setPackageIdentifierOperation(state, action) {\n const trimmed = action.input.identifier.trim();\n if (!trimmed) {\n throw new InvalidPackageIdentifierError('Package identifier must not be empty');\n }\n let scopePart: string | null = null;\n let namePart = trimmed;\n if (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 }\n if (scopePart !== null) {\n if (!NAME_PATTERN.test(scopePart)) {\n throw new InvalidPackageIdentifierError(`Invalid scope: ${scopePart}`);\n }\n }\n if (!namePart.endsWith('-cli')) {\n namePart = namePart + '-cli';\n }\n if (!NAME_PATTERN.test(namePart)) {\n throw new InvalidPackageIdentifierError(`Invalid package name: ${namePart}`);\n }\n state.scope = scopePart ? `@${scopePart}` : null;\n state.name = namePart;\n // Update managed app package name to match new identity\n const managed = state.packages.find((p) => p.managed);\n if (managed) {\n const appBase = namePart.replace(/-cli$/, '-app');\n managed.packageName = scopePart ? `@${scopePart}/${appBase}` : appBase;\n managed.id = `app-${namePart}`;\n }\n },\n};\n","import type { PhClintProjectLifecycleOperations } from 'document-models/ph-clint-project/v1';\n\nexport const phClintProjectLifecycleOperations: PhClintProjectLifecycleOperations = {\n importSpecOperation(state, action) {\n state.name = action.input.name;\n state.scope = action.input.scope || null;\n state.version = action.input.version;\n state.description = action.input.description;\n state.features.powerhouse = action.input.powerhouse;\n state.features.mastra.enabled = action.input.mastraEnabled;\n state.features.routine.enabled = action.input.routineEnabled;\n\n const appBase = action.input.name.replace(/-cli$/, '-app');\n const appPkgName = action.input.scope ? `${action.input.scope}/${appBase}` : appBase;\n const phEnabled = action.input.powerhouse !== 'Disabled';\n\n state.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 }));\n state.externalSkills = action.input.externalSkills.map((s) => ({\n id: s.id,\n name: s.name,\n githubUrl: s.githubUrl,\n }));\n\n state.features.mastra.models = action.input.models.map((m) => ({\n id: m.id,\n }));\n state.features.mastra.profiles = action.input.profiles.map((p) => ({\n id: p.id,\n title: p.title,\n content: p.content,\n }));\n\n if (action.input.mainAgent && state.features.mastra.enabled) {\n const m = action.input.mainAgent;\n state.features.mastra.mainAgent = {\n id: m.id,\n name: m.name,\n description: m.description || null,\n attachment: m.attachment || null,\n modelId: m.modelId,\n profileIds: [...m.profileIds],\n skills: [...m.skills],\n toolPatterns: [...m.toolPatterns],\n };\n } else {\n state.features.mastra.mainAgent = null;\n }\n\n if (state.features.mastra.enabled) {\n state.features.mastra.subAgents = action.input.subAgents.map((s) => ({\n id: s.id,\n name: s.name,\n description: s.description,\n modelId: s.modelId,\n profileIds: [...s.profileIds],\n skills: [...s.skills],\n toolPatterns: [...s.toolPatterns],\n }));\n } else {\n state.features.mastra.subAgents = [];\n }\n\n if (action.input.enableChat && state.features.mastra.enabled && state.features.powerhouse !== 'Disabled') {\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((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 state.features.mastra.common.enableChat = false;\n }\n\n state.deployment.proxyEnabled = action.input.proxyEnabled ?? false;\n state.deployment.observabilityEnabled = action.input.observabilityEnabled ?? false;\n state.deployment.supportedResources = action.input.supportedResources ? [...action.input.supportedResources] : [];\n },\n};\n","export type ErrorCode = 'MastraNotEnabledError' | 'AgentNotFoundError' | 'ModelReferenceNotFoundError' | 'ProfileReferenceNotFoundError' | 'InvalidSkillNameError' | 'SkillNotFoundError' | 'InvalidToolPatternError' | 'ToolPatternNotFoundError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class MastraNotEnabledError extends Error implements ReducerError {\n errorCode = 'MastraNotEnabledError' as ErrorCode;\n constructor(message = 'MastraNotEnabledError') {\n super(message);\n }\n}\n\nexport class AgentNotFoundError extends Error implements ReducerError {\n errorCode = 'AgentNotFoundError' as ErrorCode;\n constructor(message = 'AgentNotFoundError') {\n super(message);\n }\n}\n\nexport class ModelReferenceNotFoundError extends Error implements ReducerError {\n errorCode = 'ModelReferenceNotFoundError' as ErrorCode;\n constructor(message = 'ModelReferenceNotFoundError') {\n super(message);\n }\n}\n\nexport class ProfileReferenceNotFoundError extends Error implements ReducerError {\n errorCode = 'ProfileReferenceNotFoundError' as ErrorCode;\n constructor(message = 'ProfileReferenceNotFoundError') {\n super(message);\n }\n}\n\nexport class InvalidSkillNameError extends Error implements ReducerError {\n errorCode = 'InvalidSkillNameError' as ErrorCode;\n constructor(message = 'InvalidSkillNameError') {\n super(message);\n }\n}\n\nexport class SkillNotFoundError extends Error implements ReducerError {\n errorCode = 'SkillNotFoundError' as ErrorCode;\n constructor(message = 'SkillNotFoundError') {\n super(message);\n }\n}\n\nexport class InvalidToolPatternError extends Error implements ReducerError {\n errorCode = 'InvalidToolPatternError' as ErrorCode;\n constructor(message = 'InvalidToolPatternError') {\n super(message);\n }\n}\n\nexport class ToolPatternNotFoundError extends Error implements ReducerError {\n errorCode = 'ToolPatternNotFoundError' as ErrorCode;\n constructor(message = 'ToolPatternNotFoundError') {\n super(message);\n }\n}\n\nexport const errors = {\n SetAgentModel: {\n MastraNotEnabledError,\n AgentNotFoundError,\n ModelReferenceNotFoundError,\n },\n AddAgentProfileRef: {\n MastraNotEnabledError,\n AgentNotFoundError,\n ProfileReferenceNotFoundError,\n },\n RemoveAgentProfileRef: {\n MastraNotEnabledError,\n AgentNotFoundError,\n ProfileReferenceNotFoundError,\n },\n ReorderAgentProfileRefs: {\n MastraNotEnabledError,\n AgentNotFoundError,\n ProfileReferenceNotFoundError,\n },\n AddAgentSkill: {\n MastraNotEnabledError,\n AgentNotFoundError,\n InvalidSkillNameError,\n },\n RemoveAgentSkill: {\n MastraNotEnabledError,\n AgentNotFoundError,\n SkillNotFoundError,\n },\n AddAgentToolPattern: {\n MastraNotEnabledError,\n AgentNotFoundError,\n InvalidToolPatternError,\n },\n RemoveAgentToolPattern: {\n MastraNotEnabledError,\n AgentNotFoundError,\n ToolPatternNotFoundError,\n },\n};\n","import type { PhClintProjectMastraAgentBindingsOperations } from 'document-models/ph-clint-project/v1';\nimport {\n AgentNotFoundError,\n InvalidSkillNameError,\n InvalidToolPatternError,\n MastraNotEnabledError,\n ModelReferenceNotFoundError,\n ProfileReferenceNotFoundError,\n SkillNotFoundError,\n ToolPatternNotFoundError,\n} from '../../gen/mastra-agent-bindings/error.js';\nimport type { PhClintMainAgent, PhClintSubAgent } from '../../gen/schema/types.js';\n\ntype Agent = PhClintMainAgent | PhClintSubAgent;\n\nfunction resolveAgent(main: PhClintMainAgent | null | undefined, subs: PhClintSubAgent[], agentId: string): Agent | undefined {\n if (main && main.id === agentId) return main;\n return subs.find((s) => s.id === agentId);\n}\n\nexport const phClintProjectMastraAgentBindingsOperations: PhClintProjectMastraAgentBindingsOperations = {\n setAgentModelOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set agent model when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n if (!state.features.mastra.models.find((m) => m.id === action.input.modelId)) {\n throw new ModelReferenceNotFoundError(`Model not in library: ${action.input.modelId}`);\n }\n agent.modelId = action.input.modelId;\n },\n addAgentProfileRefOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add profile ref when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n if (!state.features.mastra.profiles.find((p) => p.id === action.input.profileId)) {\n throw new ProfileReferenceNotFoundError(`Profile not in library: ${action.input.profileId}`);\n }\n if (agent.profileIds.includes(action.input.profileId)) {\n return;\n }\n if (action.input.insertBefore) {\n const beforeIdx = agent.profileIds.indexOf(action.input.insertBefore);\n if (beforeIdx === -1) {\n throw new ProfileReferenceNotFoundError(`insertBefore profile not in agent's profileIds: ${action.input.insertBefore}`);\n }\n agent.profileIds.splice(beforeIdx, 0, action.input.profileId);\n } else {\n agent.profileIds.push(action.input.profileId);\n }\n },\n removeAgentProfileRefOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove profile ref when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n const idx = agent.profileIds.indexOf(action.input.profileId);\n if (idx === -1) {\n throw new ProfileReferenceNotFoundError(`Profile not in agent's profileIds: ${action.input.profileId}`);\n }\n agent.profileIds.splice(idx, 1);\n },\n reorderAgentProfileRefsOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot reorder profile refs when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n for (const id of action.input.ids) {\n if (!agent.profileIds.includes(id)) {\n throw new ProfileReferenceNotFoundError(`Profile not in agent's profileIds: ${id}`);\n }\n }\n const remaining = agent.profileIds.filter((id) => !action.input.ids.includes(id));\n if (action.input.insertBefore) {\n const beforeIdx = remaining.indexOf(action.input.insertBefore);\n if (beforeIdx === -1) {\n throw new ProfileReferenceNotFoundError(`insertBefore profile not in agent's profileIds: ${action.input.insertBefore}`);\n }\n remaining.splice(beforeIdx, 0, ...action.input.ids);\n } else {\n remaining.push(...action.input.ids);\n }\n agent.profileIds = remaining;\n },\n addAgentSkillOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add skill when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n const trimmed = action.input.name.trim();\n if (!/^[a-z][a-z0-9-]*$/.test(trimmed)) {\n throw new InvalidSkillNameError(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);\n }\n if (!agent.skills.includes(trimmed)) {\n agent.skills.push(trimmed);\n }\n },\n removeAgentSkillOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove skill when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n const idx = agent.skills.indexOf(action.input.name);\n if (idx === -1) {\n throw new SkillNotFoundError(`Skill not on agent: ${action.input.name}`);\n }\n agent.skills.splice(idx, 1);\n },\n addAgentToolPatternOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add tool pattern when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n const trimmed = action.input.pattern.trim();\n if (!trimmed) {\n throw new InvalidToolPatternError('Tool pattern must not be empty after trimming.');\n }\n if (!agent.toolPatterns.includes(trimmed)) {\n agent.toolPatterns.push(trimmed);\n }\n },\n removeAgentToolPatternOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove tool pattern when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n const idx = agent.toolPatterns.indexOf(action.input.pattern);\n if (idx === -1) {\n throw new ToolPatternNotFoundError(`Tool pattern not on agent: ${action.input.pattern}`);\n }\n agent.toolPatterns.splice(idx, 1);\n },\n};\n","export type ErrorCode = 'MastraNotEnabledError' | 'InvalidAgentNameError' | 'InvalidAgentImageError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class MastraNotEnabledError extends Error implements ReducerError {\n errorCode = 'MastraNotEnabledError' as ErrorCode;\n constructor(message = 'MastraNotEnabledError') {\n super(message);\n }\n}\n\nexport class InvalidAgentNameError extends Error implements ReducerError {\n errorCode = 'InvalidAgentNameError' as ErrorCode;\n constructor(message = 'InvalidAgentNameError') {\n super(message);\n }\n}\n\nexport class InvalidAgentImageError extends Error implements ReducerError {\n errorCode = 'InvalidAgentImageError' as ErrorCode;\n constructor(message = 'InvalidAgentImageError') {\n super(message);\n }\n}\n\nexport const errors = {\n SetMainAgentName: { MastraNotEnabledError, InvalidAgentNameError },\n SetMainAgentDescription: { MastraNotEnabledError },\n ClearMainAgentDescription: { MastraNotEnabledError },\n SetMainAgentImage: { MastraNotEnabledError, InvalidAgentImageError },\n ClearMainAgentImage: { MastraNotEnabledError },\n};\n","import type { PhClintProjectMastraMainAgentOperations } from 'document-models/ph-clint-project/v1';\nimport { InvalidAgentImageError, InvalidAgentNameError, MastraNotEnabledError } from '../../gen/mastra-main-agent/error.js';\n\nexport const phClintProjectMastraMainAgentOperations: PhClintProjectMastraMainAgentOperations = {\n setMainAgentNameOperation(state, action) {\n const main = state.features.mastra.mainAgent;\n if (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError('Cannot set main agent name when Mastra is disabled.');\n }\n const trimmed = action.input.name.trim();\n if (!trimmed) {\n throw new InvalidAgentNameError('Agent name must not be empty.');\n }\n main.name = trimmed;\n },\n setMainAgentDescriptionOperation(state, action) {\n const main = state.features.mastra.mainAgent;\n if (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError('Cannot set main agent description when Mastra is disabled.');\n }\n main.description = action.input.description;\n },\n clearMainAgentDescriptionOperation(state) {\n const main = state.features.mastra.mainAgent;\n if (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError('Cannot clear main agent description when Mastra is disabled.');\n }\n main.description = null;\n },\n setMainAgentImageOperation(state, action) {\n const main = state.features.mastra.mainAgent;\n if (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError('Cannot set main agent image when Mastra is disabled.');\n }\n if (!action.input.attachment.startsWith('attachment://')) {\n throw new InvalidAgentImageError('Agent image must be an attachment ref (attachment://...)');\n }\n main.attachment = action.input.attachment;\n },\n clearMainAgentImageOperation(state) {\n const main = state.features.mastra.mainAgent;\n if (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError('Cannot clear main agent image when Mastra is disabled.');\n }\n main.attachment = null;\n },\n};\n","export type ErrorCode = 'MastraNotEnabledError' | 'InvalidModelIdError' | 'DuplicateModelError' | 'ModelNotFoundError' | 'ModelInUseError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class MastraNotEnabledError extends Error implements ReducerError {\n errorCode = 'MastraNotEnabledError' as ErrorCode;\n constructor(message = 'MastraNotEnabledError') {\n super(message);\n }\n}\n\nexport class InvalidModelIdError extends Error implements ReducerError {\n errorCode = 'InvalidModelIdError' as ErrorCode;\n constructor(message = 'InvalidModelIdError') {\n super(message);\n }\n}\n\nexport class DuplicateModelError extends Error implements ReducerError {\n errorCode = 'DuplicateModelError' as ErrorCode;\n constructor(message = 'DuplicateModelError') {\n super(message);\n }\n}\n\nexport class ModelNotFoundError extends Error implements ReducerError {\n errorCode = 'ModelNotFoundError' as ErrorCode;\n constructor(message = 'ModelNotFoundError') {\n super(message);\n }\n}\n\nexport class ModelInUseError extends Error implements ReducerError {\n errorCode = 'ModelInUseError' as ErrorCode;\n constructor(message = 'ModelInUseError') {\n super(message);\n }\n}\n\nexport const errors = {\n AddModel: { MastraNotEnabledError, InvalidModelIdError, DuplicateModelError },\n RemoveModel: { MastraNotEnabledError, ModelNotFoundError, ModelInUseError },\n};\n","import type { PhClintProjectMastraModelsOperations } from 'document-models/ph-clint-project/v1';\nimport { DuplicateModelError, InvalidModelIdError, MastraNotEnabledError, ModelInUseError, ModelNotFoundError } from '../../gen/mastra-models/error.js';\n\nexport const phClintProjectMastraModelsOperations: PhClintProjectMastraModelsOperations = {\n addModelOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add model when Mastra is disabled.');\n }\n if (!/^[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 }\n if (state.features.mastra.models.find((m) => m.id === action.input.id)) {\n throw new DuplicateModelError(`Model already exists: ${action.input.id}`);\n }\n state.features.mastra.models.push({ id: action.input.id });\n },\n removeModelOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove model when Mastra is disabled.');\n }\n const idx = state.features.mastra.models.findIndex((m) => m.id === action.input.id);\n if (idx === -1) {\n throw new ModelNotFoundError(`Model not found: ${action.input.id}`);\n }\n const main = state.features.mastra.mainAgent;\n const usedByMain = !!main && main.modelId === action.input.id;\n const usedBySub = state.features.mastra.subAgents.some((s) => s.modelId === action.input.id);\n if (usedByMain || usedBySub) {\n throw new ModelInUseError(`Model ${action.input.id} is in use by an agent.`);\n }\n state.features.mastra.models.splice(idx, 1);\n },\n};\n","export type ErrorCode = 'MastraNotEnabledError' | 'InvalidProfileIdError' | 'DuplicateProfileError' | 'ProfileNotFoundError' | 'ProfileInUseError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class MastraNotEnabledError extends Error implements ReducerError {\n errorCode = 'MastraNotEnabledError' as ErrorCode;\n constructor(message = 'MastraNotEnabledError') {\n super(message);\n }\n}\n\nexport class InvalidProfileIdError extends Error implements ReducerError {\n errorCode = 'InvalidProfileIdError' as ErrorCode;\n constructor(message = 'InvalidProfileIdError') {\n super(message);\n }\n}\n\nexport class DuplicateProfileError extends Error implements ReducerError {\n errorCode = 'DuplicateProfileError' as ErrorCode;\n constructor(message = 'DuplicateProfileError') {\n super(message);\n }\n}\n\nexport class ProfileNotFoundError extends Error implements ReducerError {\n errorCode = 'ProfileNotFoundError' as ErrorCode;\n constructor(message = 'ProfileNotFoundError') {\n super(message);\n }\n}\n\nexport class ProfileInUseError extends Error implements ReducerError {\n errorCode = 'ProfileInUseError' as ErrorCode;\n constructor(message = 'ProfileInUseError') {\n super(message);\n }\n}\n\nexport const errors = {\n AddProfile: {\n MastraNotEnabledError,\n InvalidProfileIdError,\n DuplicateProfileError,\n ProfileNotFoundError,\n },\n UpdateProfile: { MastraNotEnabledError, ProfileNotFoundError },\n RemoveProfile: {\n MastraNotEnabledError,\n ProfileNotFoundError,\n ProfileInUseError,\n },\n ReorderProfiles: { MastraNotEnabledError, ProfileNotFoundError },\n};\n","import type { PhClintProjectMastraProfilesOperations } from 'document-models/ph-clint-project/v1';\nimport { DuplicateProfileError, InvalidProfileIdError, MastraNotEnabledError, ProfileInUseError, ProfileNotFoundError } from '../../gen/mastra-profiles/error.js';\n\nexport const phClintProjectMastraProfilesOperations: PhClintProjectMastraProfilesOperations = {\n addProfileOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add profile when Mastra is disabled.');\n }\n if (!/^[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 }\n if (state.features.mastra.profiles.find((p) => p.id === action.input.id)) {\n throw new DuplicateProfileError(`Profile already exists: ${action.input.id}`);\n }\n const profile = {\n id: action.input.id,\n title: action.input.title,\n content: action.input.content,\n };\n if (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 }\n },\n updateProfileOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot update profile when Mastra is disabled.');\n }\n const profile = state.features.mastra.profiles.find((p) => p.id === action.input.id);\n if (!profile) {\n throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);\n }\n if (action.input.title) profile.title = action.input.title;\n if (action.input.content) profile.content = action.input.content;\n },\n removeProfileOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove profile when Mastra is disabled.');\n }\n const idx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.id);\n if (idx === -1) {\n throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);\n }\n const main = state.features.mastra.mainAgent;\n const usedByMain = !!main && main.profileIds.includes(action.input.id);\n const usedBySub = state.features.mastra.subAgents.some((s) => s.profileIds.includes(action.input.id));\n if (usedByMain || usedBySub) {\n throw new ProfileInUseError(`Profile ${action.input.id} is in use by an agent.`);\n }\n state.features.mastra.profiles.splice(idx, 1);\n },\n reorderProfilesOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot reorder profiles when Mastra is disabled.');\n }\n const moving = [];\n for (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 state.features.mastra.profiles = state.features.mastra.profiles.filter((p) => !action.input.ids.includes(p.id));\n if (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 }\n },\n};\n","export type ErrorCode = 'MastraNotEnabledError' | 'InvalidAgentIdError' | 'InvalidAgentNameError' | 'DuplicateAgentIdError' | 'ModelReferenceNotFoundError' | 'AgentNotFoundError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class MastraNotEnabledError extends Error implements ReducerError {\n errorCode = 'MastraNotEnabledError' as ErrorCode;\n constructor(message = 'MastraNotEnabledError') {\n super(message);\n }\n}\n\nexport class InvalidAgentIdError extends Error implements ReducerError {\n errorCode = 'InvalidAgentIdError' as ErrorCode;\n constructor(message = 'InvalidAgentIdError') {\n super(message);\n }\n}\n\nexport class InvalidAgentNameError extends Error implements ReducerError {\n errorCode = 'InvalidAgentNameError' as ErrorCode;\n constructor(message = 'InvalidAgentNameError') {\n super(message);\n }\n}\n\nexport class DuplicateAgentIdError extends Error implements ReducerError {\n errorCode = 'DuplicateAgentIdError' as ErrorCode;\n constructor(message = 'DuplicateAgentIdError') {\n super(message);\n }\n}\n\nexport class ModelReferenceNotFoundError extends Error implements ReducerError {\n errorCode = 'ModelReferenceNotFoundError' as ErrorCode;\n constructor(message = 'ModelReferenceNotFoundError') {\n super(message);\n }\n}\n\nexport class AgentNotFoundError extends Error implements ReducerError {\n errorCode = 'AgentNotFoundError' as ErrorCode;\n constructor(message = 'AgentNotFoundError') {\n super(message);\n }\n}\n\nexport const errors = {\n AddSubAgent: {\n MastraNotEnabledError,\n InvalidAgentIdError,\n InvalidAgentNameError,\n DuplicateAgentIdError,\n ModelReferenceNotFoundError,\n },\n RemoveSubAgent: { MastraNotEnabledError, AgentNotFoundError },\n SetSubAgentName: {\n MastraNotEnabledError,\n AgentNotFoundError,\n InvalidAgentNameError,\n },\n SetSubAgentDescription: { MastraNotEnabledError, AgentNotFoundError },\n};\n","import type { PhClintProjectMastraSubAgentsOperations } from 'document-models/ph-clint-project/v1';\nimport { AgentNotFoundError, DuplicateAgentIdError, InvalidAgentIdError, InvalidAgentNameError, MastraNotEnabledError, ModelReferenceNotFoundError } from '../../gen/mastra-sub-agents/error.js';\n\nexport const phClintProjectMastraSubAgentsOperations: PhClintProjectMastraSubAgentsOperations = {\n addSubAgentOperation(state, action) {\n const main = state.features.mastra.mainAgent;\n if (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError('Cannot add sub-agent when Mastra is disabled.');\n }\n if (!/^[a-z][a-z0-9-]*$/.test(action.input.id)) {\n throw new InvalidAgentIdError(`Invalid sub-agent ID: ${action.input.id}. Must be lowercase kebab-case.`);\n }\n const trimmedName = action.input.name.trim();\n if (!trimmedName) {\n throw new InvalidAgentNameError('Sub-agent name must not be empty.');\n }\n if (main.id === action.input.id) {\n throw new DuplicateAgentIdError(`Agent ID already taken by main agent: ${action.input.id}`);\n }\n if (state.features.mastra.subAgents.find((s) => s.id === action.input.id)) {\n throw new DuplicateAgentIdError(`Sub-agent already exists: ${action.input.id}`);\n }\n if (!state.features.mastra.models.find((m) => m.id === action.input.modelId)) {\n throw new ModelReferenceNotFoundError(`Model not in library: ${action.input.modelId}`);\n }\n state.features.mastra.subAgents.push({\n id: action.input.id,\n name: trimmedName,\n description: action.input.description,\n modelId: action.input.modelId,\n profileIds: [],\n skills: [],\n toolPatterns: [],\n });\n },\n removeSubAgentOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove sub-agent when Mastra is disabled.');\n }\n const idx = state.features.mastra.subAgents.findIndex((s) => s.id === action.input.id);\n if (idx === -1) {\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\n }\n state.features.mastra.subAgents.splice(idx, 1);\n },\n setSubAgentNameOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set sub-agent name when Mastra is disabled.');\n }\n const sub = state.features.mastra.subAgents.find((s) => s.id === action.input.id);\n if (!sub) {\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\n }\n const trimmed = action.input.name.trim();\n if (!trimmed) {\n throw new InvalidAgentNameError('Sub-agent name must not be empty.');\n }\n sub.name = trimmed;\n },\n setSubAgentDescriptionOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set sub-agent description when Mastra is disabled.');\n }\n const sub = state.features.mastra.subAgents.find((s) => s.id === action.input.id);\n if (!sub) {\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\n }\n sub.description = action.input.description;\n },\n};\n","export type ErrorCode =\n | 'DuplicatePackageError'\n | 'PackageNotFoundError'\n | 'CannotRemoveAppPackageError'\n | 'CannotRemoveManagedPackageError'\n | 'InvalidDocumentTypeError'\n | 'DuplicateDocumentTypeError'\n | 'DocumentTypeNotFoundError'\n | 'InvalidVersionError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class DuplicatePackageError extends Error implements ReducerError {\n errorCode = 'DuplicatePackageError' as ErrorCode;\n constructor(message = 'DuplicatePackageError') {\n super(message);\n }\n}\n\nexport class PackageNotFoundError extends Error implements ReducerError {\n errorCode = 'PackageNotFoundError' as ErrorCode;\n constructor(message = 'PackageNotFoundError') {\n super(message);\n }\n}\n\nexport class CannotRemoveAppPackageError extends Error implements ReducerError {\n errorCode = 'CannotRemoveAppPackageError' as ErrorCode;\n constructor(message = 'CannotRemoveAppPackageError') {\n super(message);\n }\n}\n\nexport class CannotRemoveManagedPackageError extends Error implements ReducerError {\n errorCode = 'CannotRemoveManagedPackageError' as ErrorCode;\n constructor(message = 'CannotRemoveManagedPackageError') {\n super(message);\n }\n}\n\nexport class InvalidDocumentTypeError extends Error implements ReducerError {\n errorCode = 'InvalidDocumentTypeError' as ErrorCode;\n constructor(message = 'InvalidDocumentTypeError') {\n super(message);\n }\n}\n\nexport class DuplicateDocumentTypeError extends Error implements ReducerError {\n errorCode = 'DuplicateDocumentTypeError' as ErrorCode;\n constructor(message = 'DuplicateDocumentTypeError') {\n super(message);\n }\n}\n\nexport class DocumentTypeNotFoundError extends Error implements ReducerError {\n errorCode = 'DocumentTypeNotFoundError' as ErrorCode;\n constructor(message = 'DocumentTypeNotFoundError') {\n super(message);\n }\n}\n\nexport class InvalidVersionError extends Error implements ReducerError {\n errorCode = 'InvalidVersionError' as ErrorCode;\n constructor(message = 'InvalidVersionError') {\n super(message);\n }\n}\n\nexport const errors = {\n AddPowerhousePackage: { DuplicatePackageError },\n RemovePowerhousePackage: {\n PackageNotFoundError,\n CannotRemoveAppPackageError,\n CannotRemoveManagedPackageError,\n },\n AddPackageDocumentType: {\n InvalidDocumentTypeError,\n PackageNotFoundError,\n DuplicateDocumentTypeError,\n },\n RemovePackageDocumentType: {\n PackageNotFoundError,\n DocumentTypeNotFoundError,\n },\n SetPackageVersion: { PackageNotFoundError, InvalidVersionError },\n};\n","import type { PhClintProjectPowerhousePackagesOperations } from 'document-models/ph-clint-project/v1';\nimport { CannotRemoveManagedPackageError, DocumentTypeNotFoundError, DuplicateDocumentTypeError, DuplicatePackageError, InvalidDocumentTypeError, InvalidVersionError, PackageNotFoundError } from '../../gen/powerhouse-packages/error.js';\n\nconst SEMVER = /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\n\nexport const phClintProjectPowerhousePackagesOperations: PhClintProjectPowerhousePackagesOperations = {\n addPowerhousePackageOperation(state, action) {\n const exists = state.packages.find((p) => p.id === action.input.id || p.packageName === action.input.packageName);\n if (exists) {\n throw new DuplicatePackageError(`Package already exists: ${action.input.packageName}`);\n }\n state.packages.push({\n id: action.input.id,\n packageName: action.input.packageName,\n documentTypes: [],\n version: null,\n managed: false,\n });\n },\n removePowerhousePackageOperation(state, action) {\n const idx = state.packages.findIndex((p) => p.id === action.input.id);\n if (idx === -1) {\n throw new PackageNotFoundError(`Package not found: ${action.input.id}`);\n }\n const pkg = state.packages[idx];\n if (pkg.managed) {\n throw new CannotRemoveManagedPackageError('Cannot remove a managed package');\n }\n state.packages.splice(idx, 1);\n },\n addPackageDocumentTypeOperation(state, action) {\n if (action.input.documentType !== '*/*' && !/^[a-z0-9-]+\\/[a-z0-9-]+$/.test(action.input.documentType)) {\n throw new InvalidDocumentTypeError(`Invalid document type format: ${action.input.documentType}. Expected org/name.`);\n }\n const pkg = state.packages.find((p) => p.id === action.input.packageId);\n if (!pkg) {\n throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);\n }\n if (action.input.documentType === '*/*') {\n pkg.documentTypes.length = 0;\n pkg.documentTypes.push('*/*');\n return;\n }\n if (pkg.documentTypes.includes('*/*')) {\n return;\n }\n if (pkg.documentTypes.includes(action.input.documentType)) {\n throw new DuplicateDocumentTypeError(`Document type already registered: ${action.input.documentType}`);\n }\n pkg.documentTypes.push(action.input.documentType);\n },\n removePackageDocumentTypeOperation(state, action) {\n const pkg = state.packages.find((p) => p.id === action.input.packageId);\n if (!pkg) {\n throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);\n }\n const idx = pkg.documentTypes.indexOf(action.input.documentType);\n if (idx === -1) {\n throw new DocumentTypeNotFoundError(`Document type not found: ${action.input.documentType}`);\n }\n pkg.documentTypes.splice(idx, 1);\n },\n setPackageVersionOperation(state, action) {\n const pkg = state.packages.find((p) => p.id === action.input.packageId);\n if (!pkg) {\n throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);\n }\n if (action.input.version != null) {\n if (!SEMVER.test(action.input.version)) {\n throw new InvalidVersionError(`Invalid version: ${action.input.version}`);\n }\n }\n pkg.version = action.input.version || null;\n },\n};\n","export type ErrorCode = 'InvalidVersionError' | 'PublishRecordNotFoundError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidVersionError extends Error implements ReducerError {\n errorCode = 'InvalidVersionError' as ErrorCode;\n constructor(message = 'InvalidVersionError') {\n super(message);\n }\n}\n\nexport class PublishRecordNotFoundError extends Error implements ReducerError {\n errorCode = 'PublishRecordNotFoundError' as ErrorCode;\n constructor(message = 'PublishRecordNotFoundError') {\n super(message);\n }\n}\n\nexport const errors = {\n BumpVersion: { InvalidVersionError },\n SetPublishStatus: { PublishRecordNotFoundError },\n};\n","import type { PhClintProjectPublishingOperations } from 'document-models/ph-clint-project/v1';\nimport { InvalidVersionError, PublishRecordNotFoundError } from '../../gen/publishing/error.js';\n\nexport const phClintProjectPublishingOperations: PhClintProjectPublishingOperations = {\n bumpVersionOperation(state, action) {\n 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 }\n state.version = action.input.version;\n },\n publishDevOperation(state, action) {\n state.publishHistory.push({\n id: action.input.id,\n tag: 'Dev',\n version: state.version,\n timestamp: action.input.timestamp,\n status: 'Pending',\n });\n },\n publishStagingOperation(state, action) {\n state.publishHistory.push({\n id: action.input.id,\n tag: 'Staging',\n version: state.version,\n timestamp: action.input.timestamp,\n status: 'Pending',\n });\n },\n publishProductionOperation(state, action) {\n state.publishHistory.push({\n id: action.input.id,\n tag: 'Production',\n version: state.version,\n timestamp: action.input.timestamp,\n status: 'Pending',\n });\n },\n setPublishStatusOperation(state, action) {\n const record = state.publishHistory.find((r) => r.id === action.input.id);\n if (!record) {\n throw new PublishRecordNotFoundError(`Publish record not found: ${action.input.id}`);\n }\n record.status = action.input.status;\n },\n};\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from 'document-model';\nimport { createReducer, isDocumentAction } from 'document-model';\nimport type { PhClintProjectPHState } from 'document-models/ph-clint-project/v1';\n\nimport { phClintProjectDeploymentOperations } from '../src/reducers/deployment.js';\nimport { phClintProjectExternalSkillsOperations } from '../src/reducers/external-skills.js';\nimport { phClintProjectFeaturesMastraOperations } from '../src/reducers/features-mastra.js';\nimport { phClintProjectFeaturesPowerhouseOperations } from '../src/reducers/features-powerhouse.js';\nimport { phClintProjectFeaturesRoutineOperations } from '../src/reducers/features-routine.js';\nimport { phClintProjectIdentityOperations } from '../src/reducers/identity.js';\nimport { phClintProjectLifecycleOperations } from '../src/reducers/lifecycle.js';\nimport { phClintProjectMastraAgentBindingsOperations } from '../src/reducers/mastra-agent-bindings.js';\nimport { phClintProjectMastraMainAgentOperations } from '../src/reducers/mastra-main-agent.js';\nimport { phClintProjectMastraModelsOperations } from '../src/reducers/mastra-models.js';\nimport { phClintProjectMastraProfilesOperations } from '../src/reducers/mastra-profiles.js';\nimport { phClintProjectMastraSubAgentsOperations } from '../src/reducers/mastra-sub-agents.js';\nimport { phClintProjectPowerhousePackagesOperations } from '../src/reducers/powerhouse-packages.js';\nimport { phClintProjectPublishingOperations } from '../src/reducers/publishing.js';\n\nimport {\n AddAgentProfileRefInputSchema,\n AddAgentSkillInputSchema,\n AddAgentToolPatternInputSchema,\n AddExternalSkillInputSchema,\n AddModelInputSchema,\n AddPackageDocumentTypeInputSchema,\n AddPowerhousePackageInputSchema,\n AddProfileInputSchema,\n AddSubAgentInputSchema,\n AddSupportedResourceInputSchema,\n BumpVersionInputSchema,\n ClearMainAgentDescriptionInputSchema,\n ClearMainAgentImageInputSchema,\n DisableMastraInputSchema,\n DisableRoutineInputSchema,\n EnableMastraInputSchema,\n EnableRoutineInputSchema,\n ImportSpecInputSchema,\n PublishDevInputSchema,\n PublishProductionInputSchema,\n PublishStagingInputSchema,\n RemoveAgentProfileRefInputSchema,\n RemoveAgentSkillInputSchema,\n RemoveAgentToolPatternInputSchema,\n RemoveExternalSkillInputSchema,\n RemoveModelInputSchema,\n RemovePackageDocumentTypeInputSchema,\n RemovePowerhousePackageInputSchema,\n RemoveProfileInputSchema,\n RemoveSubAgentInputSchema,\n RemoveSupportedResourceInputSchema,\n ReorderAgentProfileRefsInputSchema,\n ReorderProfilesInputSchema,\n SetAgentModelInputSchema,\n SetDescriptionInputSchema,\n SetEnableChatInputSchema,\n SetExternalSkillGithubUrlInputSchema,\n SetExternalSkillNameInputSchema,\n SetMainAgentDescriptionInputSchema,\n SetMainAgentImageInputSchema,\n SetMainAgentNameInputSchema,\n SetObservabilityEnabledInputSchema,\n SetPackageIdentifierInputSchema,\n SetPackageVersionInputSchema,\n SetPowerhouseLevelInputSchema,\n SetProxyEnabledInputSchema,\n SetPublishStatusInputSchema,\n SetSubAgentDescriptionInputSchema,\n SetSubAgentNameInputSchema,\n SetVersionInputSchema,\n UpdateProfileInputSchema,\n} from './schema/zod.js';\n\nconst stateReducer: StateReducer<PhClintProjectPHState> = (state, action, dispatch) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case 'SET_DESCRIPTION': {\n SetDescriptionInputSchema().parse(action.input);\n\n phClintProjectIdentityOperations.setDescriptionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_VERSION': {\n SetVersionInputSchema().parse(action.input);\n\n phClintProjectIdentityOperations.setVersionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_PACKAGE_IDENTIFIER': {\n SetPackageIdentifierInputSchema().parse(action.input);\n\n phClintProjectIdentityOperations.setPackageIdentifierOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_POWERHOUSE_LEVEL': {\n SetPowerhouseLevelInputSchema().parse(action.input);\n\n phClintProjectFeaturesPowerhouseOperations.setPowerhouseLevelOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ENABLE_ROUTINE': {\n EnableRoutineInputSchema().parse(action.input);\n\n phClintProjectFeaturesRoutineOperations.enableRoutineOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'DISABLE_ROUTINE': {\n DisableRoutineInputSchema().parse(action.input);\n\n phClintProjectFeaturesRoutineOperations.disableRoutineOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_POWERHOUSE_PACKAGE': {\n AddPowerhousePackageInputSchema().parse(action.input);\n\n phClintProjectPowerhousePackagesOperations.addPowerhousePackageOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_POWERHOUSE_PACKAGE': {\n RemovePowerhousePackageInputSchema().parse(action.input);\n\n phClintProjectPowerhousePackagesOperations.removePowerhousePackageOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_PACKAGE_DOCUMENT_TYPE': {\n AddPackageDocumentTypeInputSchema().parse(action.input);\n\n phClintProjectPowerhousePackagesOperations.addPackageDocumentTypeOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_PACKAGE_DOCUMENT_TYPE': {\n RemovePackageDocumentTypeInputSchema().parse(action.input);\n\n phClintProjectPowerhousePackagesOperations.removePackageDocumentTypeOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_PACKAGE_VERSION': {\n SetPackageVersionInputSchema().parse(action.input);\n\n phClintProjectPowerhousePackagesOperations.setPackageVersionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_EXTERNAL_SKILL': {\n AddExternalSkillInputSchema().parse(action.input);\n\n phClintProjectExternalSkillsOperations.addExternalSkillOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_EXTERNAL_SKILL': {\n RemoveExternalSkillInputSchema().parse(action.input);\n\n phClintProjectExternalSkillsOperations.removeExternalSkillOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_EXTERNAL_SKILL_NAME': {\n SetExternalSkillNameInputSchema().parse(action.input);\n\n phClintProjectExternalSkillsOperations.setExternalSkillNameOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_EXTERNAL_SKILL_GITHUB_URL': {\n SetExternalSkillGithubUrlInputSchema().parse(action.input);\n\n phClintProjectExternalSkillsOperations.setExternalSkillGithubUrlOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'BUMP_VERSION': {\n BumpVersionInputSchema().parse(action.input);\n\n phClintProjectPublishingOperations.bumpVersionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'PUBLISH_DEV': {\n PublishDevInputSchema().parse(action.input);\n\n phClintProjectPublishingOperations.publishDevOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'PUBLISH_STAGING': {\n PublishStagingInputSchema().parse(action.input);\n\n phClintProjectPublishingOperations.publishStagingOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'PUBLISH_PRODUCTION': {\n PublishProductionInputSchema().parse(action.input);\n\n phClintProjectPublishingOperations.publishProductionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_PUBLISH_STATUS': {\n SetPublishStatusInputSchema().parse(action.input);\n\n phClintProjectPublishingOperations.setPublishStatusOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'IMPORT_SPEC': {\n ImportSpecInputSchema().parse(action.input);\n\n phClintProjectLifecycleOperations.importSpecOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_SUPPORTED_RESOURCE': {\n AddSupportedResourceInputSchema().parse(action.input);\n\n phClintProjectDeploymentOperations.addSupportedResourceOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_SUPPORTED_RESOURCE': {\n RemoveSupportedResourceInputSchema().parse(action.input);\n\n phClintProjectDeploymentOperations.removeSupportedResourceOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_PROXY_ENABLED': {\n SetProxyEnabledInputSchema().parse(action.input);\n\n phClintProjectDeploymentOperations.setProxyEnabledOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_OBSERVABILITY_ENABLED': {\n SetObservabilityEnabledInputSchema().parse(action.input);\n\n phClintProjectDeploymentOperations.setObservabilityEnabledOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ENABLE_MASTRA': {\n EnableMastraInputSchema().parse(action.input);\n\n phClintProjectFeaturesMastraOperations.enableMastraOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'DISABLE_MASTRA': {\n DisableMastraInputSchema().parse(action.input);\n\n phClintProjectFeaturesMastraOperations.disableMastraOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_ENABLE_CHAT': {\n SetEnableChatInputSchema().parse(action.input);\n\n phClintProjectFeaturesMastraOperations.setEnableChatOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_MODEL': {\n AddModelInputSchema().parse(action.input);\n\n phClintProjectMastraModelsOperations.addModelOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_MODEL': {\n RemoveModelInputSchema().parse(action.input);\n\n phClintProjectMastraModelsOperations.removeModelOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_PROFILE': {\n AddProfileInputSchema().parse(action.input);\n\n phClintProjectMastraProfilesOperations.addProfileOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'UPDATE_PROFILE': {\n UpdateProfileInputSchema().parse(action.input);\n\n phClintProjectMastraProfilesOperations.updateProfileOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_PROFILE': {\n RemoveProfileInputSchema().parse(action.input);\n\n phClintProjectMastraProfilesOperations.removeProfileOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REORDER_PROFILES': {\n ReorderProfilesInputSchema().parse(action.input);\n\n phClintProjectMastraProfilesOperations.reorderProfilesOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_MAIN_AGENT_NAME': {\n SetMainAgentNameInputSchema().parse(action.input);\n\n phClintProjectMastraMainAgentOperations.setMainAgentNameOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_MAIN_AGENT_DESCRIPTION': {\n SetMainAgentDescriptionInputSchema().parse(action.input);\n\n phClintProjectMastraMainAgentOperations.setMainAgentDescriptionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'CLEAR_MAIN_AGENT_DESCRIPTION': {\n ClearMainAgentDescriptionInputSchema().parse(action.input);\n\n phClintProjectMastraMainAgentOperations.clearMainAgentDescriptionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_MAIN_AGENT_IMAGE': {\n SetMainAgentImageInputSchema().parse(action.input);\n\n phClintProjectMastraMainAgentOperations.setMainAgentImageOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'CLEAR_MAIN_AGENT_IMAGE': {\n ClearMainAgentImageInputSchema().parse(action.input);\n\n phClintProjectMastraMainAgentOperations.clearMainAgentImageOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_SUB_AGENT': {\n AddSubAgentInputSchema().parse(action.input);\n\n phClintProjectMastraSubAgentsOperations.addSubAgentOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_SUB_AGENT': {\n RemoveSubAgentInputSchema().parse(action.input);\n\n phClintProjectMastraSubAgentsOperations.removeSubAgentOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_SUB_AGENT_NAME': {\n SetSubAgentNameInputSchema().parse(action.input);\n\n phClintProjectMastraSubAgentsOperations.setSubAgentNameOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_SUB_AGENT_DESCRIPTION': {\n SetSubAgentDescriptionInputSchema().parse(action.input);\n\n phClintProjectMastraSubAgentsOperations.setSubAgentDescriptionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_AGENT_MODEL': {\n SetAgentModelInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.setAgentModelOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_AGENT_PROFILE_REF': {\n AddAgentProfileRefInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.addAgentProfileRefOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_AGENT_PROFILE_REF': {\n RemoveAgentProfileRefInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.removeAgentProfileRefOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REORDER_AGENT_PROFILE_REFS': {\n ReorderAgentProfileRefsInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.reorderAgentProfileRefsOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_AGENT_SKILL': {\n AddAgentSkillInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.addAgentSkillOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_AGENT_SKILL': {\n RemoveAgentSkillInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.removeAgentSkillOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_AGENT_TOOL_PATTERN': {\n AddAgentToolPatternInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.addAgentToolPatternOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_AGENT_TOOL_PATTERN': {\n RemoveAgentToolPatternInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.removeAgentToolPatternOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<PhClintProjectPHState> = createReducer(stateReducer);\n","export const supportedVersions = [1] as const;\n\nexport const latestVersion = supportedVersions[0];\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { UpgradeManifest } from 'document-model';\nimport { latestVersion, supportedVersions } from './versions.js';\n\nexport const phClintProjectUpgradeManifest: UpgradeManifest<typeof supportedVersions> = {\n documentType: 'powerhouse/ph-clint-project',\n latestVersion,\n supportedVersions,\n upgrades: {},\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils, PHBaseState, Reducer } from 'document-model';\nimport { baseCreateDocument, baseLoadFromInputVersioned, baseSaveToFileHandle, defaultBaseState } from 'document-model';\nimport { phClintProjectUpgradeManifest } from '../../upgrades/upgrade-manifest.js';\nimport { assertIsPhClintProjectDocument, assertIsPhClintProjectState, isPhClintProjectDocument, isPhClintProjectState } from './document-schema.js';\nimport { phClintProjectDocumentType } from './document-type.js';\nimport { reducer } from './reducer.js';\nimport type { PhClintProjectGlobalState, PhClintProjectLocalState, PhClintProjectPHState } from './types.js';\n\nexport const initialGlobalState: PhClintProjectGlobalState = {\n name: null,\n scope: null,\n version: '0.1.0',\n description: '',\n features: {\n powerhouse: 'Disabled',\n mastra: {\n enabled: false,\n mainAgent: null,\n subAgents: [],\n models: [],\n profiles: [],\n common: { enableChat: false },\n },\n routine: { enabled: false },\n },\n packages: [],\n externalSkills: [],\n publishHistory: [],\n deployment: {\n proxyEnabled: false,\n observabilityEnabled: false,\n supportedResources: ['vetra-agent-s', 'vetra-agent-m', 'vetra-agent-l', 'vetra-agent-xl', 'vetra-agent-xxl'],\n },\n};\nexport const initialLocalState: PhClintProjectLocalState = {};\n\nexport const utils: DocumentModelUtils<PhClintProjectPHState> = {\n fileExtension: 'pcp',\n createState(state) {\n return {\n ...defaultBaseState(),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(utils.createState, state, phClintProjectDocumentType);\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInputVersioned(input, {\n reducers: { 1: reducer as unknown as Reducer<PHBaseState> },\n upgradeManifest: phClintProjectUpgradeManifest,\n });\n },\n isStateOfType(state) {\n return isPhClintProjectState(state);\n },\n assertIsStateOfType(state) {\n return assertIsPhClintProjectState(state);\n },\n isDocumentOfType(document) {\n return isPhClintProjectDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsPhClintProjectDocument(document);\n },\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from 'document-model';\nimport type { PhClintProjectPHState } from './gen/types.js';\nimport { utils as genUtils } from './gen/utils.js';\nimport * as customUtils from './src/utils.js';\n\n/** Utils for the PhClintProject document model */\nexport const utils: DocumentModelUtils<PhClintProjectPHState> = {\n ...genUtils,\n ...customUtils,\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelModule } from 'document-model';\nimport { createState, defaultBaseState } from 'document-model';\nimport { actions } from './actions.js';\nimport { documentModel } from './gen/document-model.js';\nimport { reducer } from './gen/reducer.js';\nimport type { PhClintProjectPHState } from './gen/types.js';\nimport { utils } from './utils.js';\n\n/** Document model module for the PhClintProject document type */\nexport const PhClintProject = {\n version: 1,\n reducer,\n actions,\n utils,\n documentModel: createState(defaultBaseState(), documentModel),\n} as const satisfies DocumentModelModule<PhClintProjectPHState>;\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { PHDocumentController } from 'document-model';\nimport { PhClintProject } from '../module.js';\nimport type { PhClintProjectAction, PhClintProjectPHState } from './types.js';\n\nexport const PhClintProjectController = PHDocumentController.forDocumentModel<PhClintProjectPHState, PhClintProjectAction>(PhClintProject);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n * Factory methods for creating PhClintProjectDocument instances\n */\nimport type { PHAuthState, PHBaseState, PHDocumentState } from 'document-model';\nimport { createBaseState, defaultBaseState } from 'document-model';\nimport type { PhClintProjectDocument, PhClintProjectGlobalState, PhClintProjectLocalState, PhClintProjectPHState } from './types.js';\nimport { utils } from './utils.js';\n\nexport function defaultGlobalState(): PhClintProjectGlobalState {\n return {\n name: null,\n scope: null,\n version: '0.1.0',\n description: '',\n features: {\n powerhouse: 'Disabled',\n mastra: {\n enabled: false,\n mainAgent: null,\n subAgents: [],\n models: [],\n profiles: [],\n common: { enableChat: false },\n },\n routine: { enabled: false },\n },\n packages: [],\n externalSkills: [],\n publishHistory: [],\n deployment: {\n proxyEnabled: false,\n observabilityEnabled: false,\n supportedResources: ['vetra-agent-s', 'vetra-agent-m', 'vetra-agent-l', 'vetra-agent-xl', 'vetra-agent-xxl'],\n },\n };\n}\n\nexport function defaultLocalState(): PhClintProjectLocalState {\n return {};\n}\n\nexport function defaultPHState(): PhClintProjectPHState {\n return {\n ...defaultBaseState(),\n global: defaultGlobalState(),\n local: defaultLocalState(),\n };\n}\n\nexport function createGlobalState(state?: Partial<PhClintProjectGlobalState>): PhClintProjectGlobalState {\n return {\n ...defaultGlobalState(),\n ...(state || {}),\n };\n}\n\nexport function createLocalState(state?: Partial<PhClintProjectLocalState>): PhClintProjectLocalState {\n return {\n ...defaultLocalState(),\n ...(state || {}),\n } as PhClintProjectLocalState;\n}\n\nexport function createState(baseState?: Partial<PHBaseState>, globalState?: Partial<PhClintProjectGlobalState>, localState?: Partial<PhClintProjectLocalState>): PhClintProjectPHState {\n return {\n ...createBaseState(baseState?.auth, baseState?.document),\n global: createGlobalState(globalState),\n local: createLocalState(localState),\n };\n}\n\n/**\n * Creates a PhClintProjectDocument with custom global and local state\n * This properly handles the PHBaseState requirements while allowing\n * document-specific state to be set.\n */\nexport function createPhClintProjectDocument(\n state?: Partial<{\n auth?: Partial<PHAuthState>;\n document?: Partial<PHDocumentState>;\n global?: Partial<PhClintProjectGlobalState>;\n local?: Partial<PhClintProjectLocalState>;\n }>,\n): PhClintProjectDocument {\n const document = utils.createDocument(state ? createState(createBaseState(state.auth, state.document), state.global, state.local) : undefined);\n\n return document;\n}\n","import { PhClintProject as PhClintProjectV1 } from 'document-models/ph-clint-project/v1';\n\n/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\n\nexport const documentModels = [PhClintProjectV1] as const;\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { UpgradeManifest } from 'document-model';\nimport { phClintProjectUpgradeManifest } from 'document-models/ph-clint-project/upgrades';\n\nexport const upgradeManifests: UpgradeManifest<readonly number[]>[] = [phClintProjectUpgradeManifest];\n","import type { EditorModule } from 'document-model';\nimport { PhClintProjectEditor } from './ph-clint-project-editor/module.js';\n\nexport const editors: EditorModule[] = [PhClintProjectEditor];\n","import type { EditorModule } from 'document-model';\nimport { lazy } from 'react';\n\n/** Document editor module for the \"[\"powerhouse/ph-clint-project\"]\" document type */\nexport const PhClintProjectEditor: EditorModule = {\n Component: lazy(() => import('./editor.js')),\n documentTypes: ['powerhouse/ph-clint-project'],\n config: {\n id: 'ph-clint-project-editor',\n name: 'PhClintProjectEditor',\n },\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { IProcessorHostModule, ProcessorRecord } from '@powerhousedao/reactor-browser';\nimport type { PHDocumentHeader } from 'document-model';\n\nexport const processorFactory = async (module: IProcessorHostModule) => {\n const { processorFactoryBuilders } = module.processorApp === 'connect' ? await import('./connect.js') : await import('./switchboard.js');\n\n const factories = await Promise.all(processorFactoryBuilders.map(async (buildFactory) => await buildFactory(module)));\n\n // Return the inner function that will be called for each drive\n return async (driveHeader: PHDocumentHeader): Promise<ProcessorRecord[]> => {\n const processors: ProcessorRecord[] = [];\n\n // Call each cached factory with the driveHeader\n for (const factory of factories) {\n const factoryProcessors = await factory(driveHeader, module.processorApp);\n processors.push(...factoryProcessors);\n }\n\n return processors;\n };\n};\n","import type { Manifest } from 'document-model';\nimport manifestJson from './powerhouse.manifest.json' with { type: 'json' };\nexport { documentModels } from './document-models/document-models.js';\nexport { upgradeManifests } from './document-models/upgrade-manifests.js';\nexport { editors } from './editors/editors.js';\nexport { processorFactory } from './processors/factory.js';\nexport const manifest: Manifest = manifestJson;\n\n// Top-level re-exports of registered document models — consumed by\n// `src/framework.gen.ts` in the CLI side, so impl code never has to\n// reach into `document-models/<slug>/v1/module.js` directly.\nexport { PhClintProject } from './document-models/ph-clint-project/v1/module.js';\nexport * from './document-models/ph-clint-project/index.js';\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { startConnect, type ImportHmr } from '@powerhousedao/connect';\nimport * as localPackage from './index.js';\n\nconst { updateLocalPackage } = startConnect(localPackage);\n\n(import.meta as ImportHmr).hot?.accept(['./index.js'], ([newModule]) => {\n if (newModule) {\n updateLocalPackage(newModule);\n }\n});\n"],"file":"index-CK9tPzCS.js"}
|
|
1
|
+
{"version":3,"mappings":";64EACC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAe,OAAO,OAApB,IAA2B,OAAoB,OAAO,OAApB,IAA2B,OAAoB,OAAO,WAApB,IAA+B,WAAwB,OAAO,KAApB,IAAyB,KAAK,EAAE,CAAC,EAAG,IAAI,EAAE,OAAK,CAAE,MAAM,IAAI,EAAE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C,CAAC,CAGrH,OAAO,KAAO,IAA8D,CAC1E,IAAM,EAAgC,EAAE,CAGxC,IAAK,IAAM,KAAW,EAAW,CAC/B,IAAM,EAAoB,MAAM,EAAQ,EAAa,EAAO,aAAa,CACzE,EAAW,KAAK,GAAG,EAAkB,CAGvC,OAAO,otKChBE,GAAqB,GCC5B,CAAE,uBAAuB,GAAa,GAAa,WAEzB,OAAO,CAAC,aAAa,EAAG,CAAC,KAAe,CAClE,GACF,GAAmB,EAAU,EAE/B","names":["updateLocalPackage"],"ignoreList":[0],"sources":["../../../../../node_modules/.pnpm/@powerhousedao+connect@6.2.0-dev.23_@babel+runtime@7.29.2_@parcel+watcher@2.5.6_@sentry_92fbcdab943457b0ffd54c0864a4f38d/node_modules/@powerhousedao/connect/dist/start-connect.js","../../../document-models/ph-clint-project/v1/gen/document-model.ts","../../../document-models/ph-clint-project/v1/gen/deployment/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/deployment.ts","../../../document-models/ph-clint-project/v1/gen/external-skills/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/external-skills.ts","../../../document-models/ph-clint-project/v1/gen/features-mastra/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/features-mastra.ts","../../../document-models/ph-clint-project/v1/gen/features-powerhouse/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/features-powerhouse.ts","../../../document-models/ph-clint-project/v1/src/reducers/features-routine.ts","../../../document-models/ph-clint-project/v1/gen/identity/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/identity.ts","../../../document-models/ph-clint-project/v1/src/reducers/lifecycle.ts","../../../document-models/ph-clint-project/v1/gen/mastra-agent-bindings/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/mastra-agent-bindings.ts","../../../document-models/ph-clint-project/v1/gen/mastra-main-agent/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/mastra-main-agent.ts","../../../document-models/ph-clint-project/v1/gen/mastra-models/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/mastra-models.ts","../../../document-models/ph-clint-project/v1/gen/mastra-profiles/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/mastra-profiles.ts","../../../document-models/ph-clint-project/v1/gen/mastra-sub-agents/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/mastra-sub-agents.ts","../../../document-models/ph-clint-project/v1/gen/powerhouse-packages/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/powerhouse-packages.ts","../../../document-models/ph-clint-project/v1/gen/publishing/error.ts","../../../document-models/ph-clint-project/v1/src/reducers/publishing.ts","../../../document-models/ph-clint-project/v1/gen/reducer.ts","../../../document-models/ph-clint-project/upgrades/versions.ts","../../../document-models/ph-clint-project/upgrades/upgrade-manifest.ts","../../../document-models/ph-clint-project/v1/gen/utils.ts","../../../document-models/ph-clint-project/v1/utils.ts","../../../document-models/ph-clint-project/v1/module.ts","../../../document-models/ph-clint-project/v1/gen/controller.ts","../../../document-models/ph-clint-project/v1/gen/ph-factories.ts","../../../document-models/document-models.ts","../../../document-models/upgrade-manifests.ts","../../../editors/editors.ts","../../../editors/ph-clint-project-editor/module.ts","../../../processors/factory.ts","../../../index.ts","../../../main.tsx"],"sourcesContent":["\n!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"2f8a11cf-bc6b-5fbf-9031-7723d0609b7b\")}catch(e){}}();\nimport { r as loadRuntimeConfig } from \"./runtime-config-DL3QjcfM.js\";\nimport { createRoot } from \"react-dom/client\";\nimport { jsx } from \"react/jsx-runtime\";\n//#region start-connect.tsx\nawait loadRuntimeConfig();\nconst { AppLoader } = await import(\"./components-ByEUkO4U.js\");\nfunction updateLocalPackage(pkg) {\n\twindow.ph?.vetraPackageManager?.updateLocalPackage(pkg);\n}\nfunction startConnect(localPackage) {\n\tif (!window.ph) window.ph = {};\n\tcreateRoot(document.getElementById(\"root\")).render(/* @__PURE__ */ jsx(AppLoader, { localPackage }));\n\treturn { updateLocalPackage };\n}\n//#endregion\nexport { startConnect };\n\n//# sourceMappingURL=start-connect.js.map\n//# debugId=2f8a11cf-bc6b-5fbf-9031-7723d0609b7b\n","import type { DocumentModelGlobalState } from 'document-model';\n\nexport const documentModel: DocumentModelGlobalState = {\n id: 'powerhouse/ph-clint-project',\n name: 'PhClintProject',\n author: {\n name: 'Powerhouse Inc.',\n website: 'https://powerhouse.inc',\n },\n extension: 'pcp',\n description:\n '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.',\n specifications: [\n {\n state: {\n local: {\n schema: '',\n examples: [],\n initialValue: '',\n },\n global: {\n schema:\n 'type PhClintProjectState {\\n name: String\\n scope: String\\n version: String!\\n description: String!\\n features: PhClintFeatures!\\n packages: [PowerhousePackage!]!\\n externalSkills: [ExternalSkill!]!\\n publishHistory: [PublishRecord!]!\\n deployment: PhClintDeployment!\\n}\\n\\ntype PhClintFeatures {\\n powerhouse: PowerhouseLevel!\\n mastra: PhClintMastraFeature!\\n routine: PhClintRoutineFeature!\\n}\\n\\nenum PowerhouseLevel {\\n Disabled\\n Reactor\\n Switchboard\\n Connect\\n}\\n\\ntype PhClintMastraFeature {\\n enabled: Boolean!\\n mainAgent: PhClintMainAgent\\n subAgents: [PhClintSubAgent!]!\\n models: [PhClintAgentModel!]!\\n profiles: [PhClintAgentProfile!]!\\n common: PhClintMastraCommon!\\n}\\n\\ntype PhClintMainAgent {\\n id: OID!\\n name: String!\\n description: String\\n attachment: String\\n modelId: OID!\\n profileIds: [OID!]!\\n skills: [String!]!\\n toolPatterns: [String!]!\\n}\\n\\ntype PhClintSubAgent {\\n id: OID!\\n name: String!\\n description: String!\\n modelId: OID!\\n profileIds: [OID!]!\\n skills: [String!]!\\n toolPatterns: [String!]!\\n}\\n\\ntype PhClintMastraCommon {\\n enableChat: Boolean!\\n}\\n\\ntype PhClintAgentModel {\\n id: OID!\\n}\\n\\ntype PhClintAgentProfile {\\n id: OID!\\n title: String!\\n content: String!\\n}\\n\\ntype PhClintRoutineFeature {\\n enabled: Boolean!\\n}\\n\\ntype PowerhousePackage {\\n id: OID!\\n packageName: String!\\n documentTypes: [String!]!\\n version: String\\n managed: Boolean!\\n}\\n\\ntype ExternalSkill {\\n id: OID!\\n name: String!\\n githubUrl: URL!\\n}\\n\\nenum PublishTag {\\n Dev\\n Staging\\n Production\\n}\\n\\nenum PublishStatus {\\n Pending\\n InProgress\\n Succeeded\\n Failed\\n}\\n\\ntype PublishRecord {\\n id: OID!\\n tag: PublishTag!\\n version: String!\\n timestamp: DateTime!\\n status: PublishStatus!\\n}\\n\\ntype PhClintDeployment {\\n proxyEnabled: Boolean!\\n observabilityEnabled: Boolean!\\n supportedResources: [String!]!\\n}',\n examples: [],\n initialValue:\n '{\\n \"name\": null,\\n \"scope\": null,\\n \"version\": \"0.1.0\",\\n \"description\": \"\",\\n \"features\": {\\n \"powerhouse\": \"Disabled\",\\n \"mastra\": {\\n \"enabled\": false,\\n \"mainAgent\": null,\\n \"subAgents\": [],\\n \"models\": [],\\n \"profiles\": [],\\n \"common\": { \"enableChat\": false }\\n },\\n \"routine\": { \"enabled\": false }\\n },\\n \"packages\": [],\\n \"externalSkills\": [],\\n \"publishHistory\": [],\\n \"deployment\": {\\n \"proxyEnabled\": false,\\n \"observabilityEnabled\": false,\\n \"supportedResources\": [\\n \"vetra-agent-s\",\\n \"vetra-agent-m\",\\n \"vetra-agent-l\",\\n \"vetra-agent-xl\",\\n \"vetra-agent-xxl\"\\n ]\\n }\\n}',\n },\n },\n modules: [\n {\n id: 'm-identity',\n name: 'identity',\n description: 'Package identity fields: name, scope, version, description, bin',\n operations: [\n {\n id: 'o-set-description',\n name: 'SET_DESCRIPTION',\n description: 'Set the package description.',\n schema: 'input SetDescriptionInput {\\n description: String!\\n}',\n template: 'Set the package description.',\n reducer: 'state.description = action.input.description;',\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-version',\n name: 'SET_VERSION',\n description: 'Set the package version. Must be a valid semver string.',\n schema: 'input SetVersionInput {\\n version: String!\\n}',\n template: 'Set the package version. Must be a valid semver string.',\n 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;',\n errors: [\n {\n id: 'e-set-version-invalid',\n name: 'InvalidVersionError',\n code: 'INVALID_VERSION',\n description: 'The version must be a valid semver string (major.minor.patch, optionally with prerelease/build metadata).',\n template: 'Invalid version: {{version}}',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-package-identifier',\n name: 'SET_PACKAGE_IDENTIFIER',\n 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.\",\n schema: 'input SetPackageIdentifierInput {\\n identifier: String!\\n}',\n template: \"Set the package identifier. Parses scope and name from a string like '@scope/name-cli' or just 'name-cli'.\",\n reducer:\n \"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}\",\n errors: [\n {\n id: 'e-invalid-package-identifier',\n name: 'InvalidPackageIdentifierError',\n code: 'INVALID_PACKAGE_IDENTIFIER',\n description: 'The package identifier is invalid. Must be a valid npm package name with optional scope.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-features-powerhouse',\n name: 'features_powerhouse',\n description: 'Powerhouse integration level. Ordered enum: Disabled < Reactor < Switchboard < Connect. Once above Disabled, cannot go back to Disabled (irreversible migration).',\n operations: [\n {\n id: 'o-set-powerhouse-level',\n name: 'SET_POWERHOUSE_LEVEL',\n description: 'Set the Powerhouse integration level. Ordered: Disabled < Reactor < Switchboard < Connect. Lowering below Reactor once above Disabled is not allowed (irreversible migration).',\n schema: 'input SetPowerhouseLevelInput {\\n level: PowerhouseLevel!\\n skipAutoProxy: Boolean\\n}',\n template: 'Set the Powerhouse integration level. Ordered: Disabled < Reactor < Switchboard < Connect. Lowering below Reactor once above Disabled is not allowed (irreversible migration).',\n reducer:\n \"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}\",\n errors: [\n {\n id: 'e-cannot-lower-powerhouse',\n name: 'CannotLowerPowerhouseError',\n code: 'CANNOT_LOWER_POWERHOUSE',\n description: 'Cannot lower the Powerhouse level below Reactor once it has been set above Disabled.',\n template: 'Cannot lower Powerhouse level below Reactor once enabled',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-features-routine',\n name: 'features_routine',\n description: 'Routine loop feature toggle.',\n operations: [\n {\n id: 'o-enable-routine',\n name: 'ENABLE_ROUTINE',\n description: 'Enable the routine loop. Idempotent.',\n schema: 'input EnableRoutineInput {\\n _: Boolean\\n}',\n template: 'Enable the routine loop. Idempotent.',\n reducer: 'state.features.routine.enabled = true;',\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-disable-routine',\n name: 'DISABLE_ROUTINE',\n description: 'Disable the routine loop. Always allowed.',\n schema: 'input DisableRoutineInput {\\n _: Boolean\\n}',\n template: 'Disable the routine loop.',\n reducer: 'state.features.routine.enabled = false;',\n errors: [],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-powerhouse-packages',\n name: 'powerhouse_packages',\n description: 'Manage reactor packages and their document types. The app package is auto-created when Powerhouse level goes above Disabled.',\n operations: [\n {\n id: 'o-add-powerhouse-package',\n name: 'ADD_POWERHOUSE_PACKAGE',\n description: 'Add an external reactor package. The app package is auto-managed by SET_POWERHOUSE_LEVEL.',\n schema: 'input AddPowerhousePackageInput {\\n id: OID!\\n packageName: String!\\n}',\n template: 'Add an external reactor package. The app package is auto-managed by SET_POWERHOUSE_LEVEL.',\n reducer:\n '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});',\n errors: [\n {\n id: 'e-duplicate-package',\n name: 'DuplicatePackageError',\n code: 'DUPLICATE_PACKAGE',\n description: 'A package with the same ID or name already exists.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-powerhouse-package',\n name: 'REMOVE_POWERHOUSE_PACKAGE',\n description: 'Remove a reactor package. Cannot remove the auto-managed app package.',\n schema: 'input RemovePowerhousePackageInput {\\n id: OID!\\n}',\n template: 'Remove a reactor package. Cannot remove the auto-managed app package.',\n reducer:\n '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);',\n errors: [\n {\n id: 'e-package-not-found-remove',\n name: 'PackageNotFoundError',\n code: 'PACKAGE_NOT_FOUND',\n description: 'The specified package ID was not found.',\n template: '',\n },\n {\n id: 'e-cannot-remove-app-package',\n name: 'CannotRemoveAppPackageError',\n code: 'CANNOT_REMOVE_APP_PACKAGE',\n description: 'The auto-managed app package cannot be removed.',\n template: '',\n },\n {\n id: 'e-cannot-remove-managed',\n name: 'CannotRemoveManagedPackageError',\n code: 'CANNOT_REMOVE_MANAGED_PACKAGE',\n description: 'Cannot remove a managed (framework-controlled) package',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-add-package-document-type',\n name: 'ADD_PACKAGE_DOCUMENT_TYPE',\n description: 'Add a document type ID to a package (app or external).',\n schema: 'input AddPackageDocumentTypeInput {\\n packageId: OID!\\n documentType: String!\\n}',\n template: 'Add a document type ID to a package (app or external).',\n reducer:\n \"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);\",\n errors: [\n {\n id: 'e-invalid-document-type',\n name: 'InvalidDocumentTypeError',\n code: 'INVALID_DOCUMENT_TYPE',\n description: 'Document type must match org/name format (e.g. powerhouse/ph-clint-project).',\n template: '',\n },\n {\n id: 'e-package-not-found-add-dt',\n name: 'PackageNotFoundError',\n code: 'PACKAGE_NOT_FOUND',\n description: 'The specified package ID was not found.',\n template: '',\n },\n {\n id: 'e-duplicate-document-type',\n name: 'DuplicateDocumentTypeError',\n code: 'DUPLICATE_DOCUMENT_TYPE',\n description: 'This document type is already registered in the package.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-package-document-type',\n name: 'REMOVE_PACKAGE_DOCUMENT_TYPE',\n description: 'Remove a document type ID from a package.',\n schema: 'input RemovePackageDocumentTypeInput {\\n packageId: OID!\\n documentType: String!\\n}',\n template: 'Remove a document type ID from a package.',\n reducer:\n '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);',\n errors: [\n {\n id: 'e-package-not-found-rm-dt',\n name: 'PackageNotFoundError',\n code: 'PACKAGE_NOT_FOUND',\n description: 'The specified package ID was not found.',\n template: '',\n },\n {\n id: 'e-document-type-not-found',\n name: 'DocumentTypeNotFoundError',\n code: 'DOCUMENT_TYPE_NOT_FOUND',\n description: 'The specified document type was not found in this package.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-package-version',\n name: 'SET_PACKAGE_VERSION',\n description: '',\n schema: 'input SetPackageVersionInput {\\n packageId: OID!\\n version: String\\n}',\n template: '',\n reducer:\n '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;',\n errors: [\n {\n id: 'e-pkg-not-found-set-ver',\n name: 'PackageNotFoundError',\n code: 'PACKAGE_NOT_FOUND',\n description: 'Referenced package does not exist',\n template: '',\n },\n {\n id: 'e-invalid-version',\n name: 'InvalidVersionError',\n code: 'INVALID_VERSION',\n description: 'Version string is not valid semver',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-external-skills',\n name: 'external_skills',\n description: 'External skills from the skills.sh ecosystem. Each skill has a name and GitHub URL for installation.',\n operations: [\n {\n id: 'o-add-external-skill',\n name: 'ADD_EXTERNAL_SKILL',\n description: 'Add an external skill. Name must be lowercase kebab-case.',\n schema: 'input AddExternalSkillInput {\\n id: OID!\\n name: String!\\n githubUrl: URL!\\n}',\n template: 'Add an external skill. Name must be lowercase kebab-case.',\n reducer:\n '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});',\n errors: [\n {\n id: 'e-invalid-skill-name',\n name: 'InvalidSkillNameError',\n code: 'INVALID_SKILL_NAME',\n description: 'Skill name must be lowercase kebab-case (e.g. playwright-cli).',\n template: '',\n },\n {\n id: 'e-duplicate-skill',\n name: 'DuplicateSkillError',\n code: 'DUPLICATE_SKILL',\n description: 'A skill with the same ID or name already exists.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-external-skill',\n name: 'REMOVE_EXTERNAL_SKILL',\n description: 'Remove an external skill by ID.',\n schema: 'input RemoveExternalSkillInput {\\n id: OID!\\n}',\n template: 'Remove an external skill by ID.',\n 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);',\n errors: [\n {\n id: 'e-skill-not-found-remove',\n name: 'SkillNotFoundError',\n code: 'SKILL_NOT_FOUND',\n description: 'The specified skill ID was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-external-skill-name',\n name: 'SET_EXTERNAL_SKILL_NAME',\n description: 'Update the name of an external skill.',\n schema: 'input SetExternalSkillNameInput {\\n id: OID!\\n name: String!\\n}',\n template: 'Update the name of an external skill.',\n reducer:\n '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;',\n errors: [\n {\n id: 'e-skill-not-found-set-name',\n name: 'SkillNotFoundError',\n code: 'SKILL_NOT_FOUND',\n description: 'The specified skill ID was not found.',\n template: '',\n },\n {\n id: 'e-invalid-skill-name-set',\n name: 'InvalidSkillNameError',\n code: 'INVALID_SKILL_NAME',\n description: 'Skill name must be lowercase kebab-case.',\n template: '',\n },\n {\n id: 'e-duplicate-skill-set-name',\n name: 'DuplicateSkillError',\n code: 'DUPLICATE_SKILL',\n description: 'Another skill already uses this name.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-external-skill-github-url',\n name: 'SET_EXTERNAL_SKILL_GITHUB_URL',\n description: 'Update the GitHub URL of an external skill.',\n schema: 'input SetExternalSkillGithubUrlInput {\\n id: OID!\\n githubUrl: URL!\\n}',\n template: 'Update the GitHub URL of an external skill.',\n 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;',\n errors: [\n {\n id: 'e-skill-not-found-set-url',\n name: 'SkillNotFoundError',\n code: 'SKILL_NOT_FOUND',\n description: 'The specified skill ID was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-publishing',\n name: 'publishing',\n description: 'Version bumping and publish records. Tracks dev/staging/production publish intents and their status.',\n operations: [\n {\n id: 'o-bump-version',\n name: 'BUMP_VERSION',\n description: 'Bump the project version. Must be a valid semver string greater than the current version.',\n schema: 'input BumpVersionInput {\\n version: String!\\n}',\n template: 'Bump the project version. Must be a valid semver string greater than the current version.',\n 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;',\n errors: [\n {\n id: 'e-invalid-version-bump',\n name: 'InvalidVersionError',\n code: 'INVALID_VERSION',\n description: 'The version must be a valid semver string.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-publish-dev',\n name: 'PUBLISH_DEV',\n description: 'Record a dev publish intent. Creates a Pending publish record.',\n schema: 'input PublishDevInput {\\n id: OID!\\n timestamp: DateTime!\\n}',\n template: 'Record a dev publish intent. Creates a Pending publish record.',\n 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});\",\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-publish-staging',\n name: 'PUBLISH_STAGING',\n description: 'Record a staging publish intent. Creates a Pending publish record.',\n schema: 'input PublishStagingInput {\\n id: OID!\\n timestamp: DateTime!\\n}',\n template: 'Record a staging publish intent. Creates a Pending publish record.',\n 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});\",\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-publish-production',\n name: 'PUBLISH_PRODUCTION',\n description: 'Record a production publish intent. Creates a Pending publish record.',\n schema: 'input PublishProductionInput {\\n id: OID!\\n timestamp: DateTime!\\n}',\n template: 'Record a production publish intent. Creates a Pending publish record.',\n 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});\",\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-publish-status',\n name: 'SET_PUBLISH_STATUS',\n description: 'Update the status of a publish record. Used by the trigger after publish completes.',\n schema: 'input SetPublishStatusInput {\\n id: OID!\\n status: PublishStatus!\\n}',\n template: 'Update the status of a publish record. Used by the trigger after publish completes.',\n 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;',\n errors: [\n {\n id: 'e-publish-record-not-found',\n name: 'PublishRecordNotFoundError',\n code: 'PUBLISH_RECORD_NOT_FOUND',\n description: 'The specified publish record ID was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-lifecycle',\n name: 'lifecycle',\n description: 'Document lifecycle operations. IMPORT_SPEC bulk-imports a full project spec into the document.',\n operations: [\n {\n id: 'o-import-spec',\n name: 'IMPORT_SPEC',\n 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.',\n schema:\n 'input ImportSpecInput {\\n name: String!\\n scope: String\\n version: String!\\n description: String!\\n powerhouse: PowerhouseLevel!\\n mastraEnabled: Boolean!\\n routineEnabled: Boolean!\\n packages: [ImportPackageInput!]!\\n externalSkills: [ImportSkillInput!]!\\n mainAgent: ImportMainAgentInput\\n subAgents: [ImportSubAgentInput!]!\\n models: [ImportModelInput!]!\\n profiles: [ImportProfileInput!]!\\n enableChat: Boolean\\n proxyEnabled: Boolean\\n observabilityEnabled: Boolean\\n supportedResources: [String!]\\n}\\n\\ninput ImportPackageInput {\\n id: OID!\\n packageName: String!\\n documentTypes: [String!]!\\n version: String\\n}\\n\\ninput ImportSkillInput {\\n id: OID!\\n name: String!\\n githubUrl: URL!\\n}\\n\\ninput ImportModelInput {\\n id: OID!\\n}\\n\\ninput ImportProfileInput {\\n id: OID!\\n title: String!\\n content: String!\\n}\\n\\ninput ImportMainAgentInput {\\n id: OID!\\n name: String!\\n description: String\\n attachment: String\\n modelId: OID!\\n profileIds: [OID!]!\\n skills: [String!]!\\n toolPatterns: [String!]!\\n}\\n\\ninput ImportSubAgentInput {\\n id: OID!\\n name: String!\\n description: String!\\n modelId: OID!\\n profileIds: [OID!]!\\n skills: [String!]!\\n toolPatterns: [String!]!\\n}',\n 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.',\n reducer:\n \"state.name = action.input.name;\\nstate.scope = action.input.scope || null;\\nstate.version = action.input.version;\\nstate.description = action.input.description;\\nstate.features.powerhouse = action.input.powerhouse;\\nstate.features.mastra.enabled = action.input.mastraEnabled;\\nstate.features.routine.enabled = action.input.routineEnabled;\\n\\nconst appBase = action.input.name.replace(/-cli$/, '-app');\\nconst appPkgName = action.input.scope\\n ? `${action.input.scope}/${appBase}`\\n : appBase;\\nconst phEnabled = action.input.powerhouse !== 'Disabled';\\n\\nstate.packages = action.input.packages.map((p) => ({\\n id: p.id,\\n packageName: p.packageName,\\n documentTypes: [...p.documentTypes],\\n version: p.version || null,\\n managed: phEnabled && p.packageName === appPkgName,\\n}));\\nstate.externalSkills = action.input.externalSkills.map((s) => ({\\n id: s.id,\\n name: s.name,\\n githubUrl: s.githubUrl,\\n}));\\n\\nstate.features.mastra.models = action.input.models.map((m) => ({\\n id: m.id,\\n}));\\nstate.features.mastra.profiles = action.input.profiles.map((p) => ({\\n id: p.id,\\n title: p.title,\\n content: p.content,\\n}));\\n\\nif (action.input.mainAgent && state.features.mastra.enabled) {\\n const m = action.input.mainAgent;\\n state.features.mastra.mainAgent = {\\n id: m.id,\\n name: m.name,\\n description: m.description || null,\\n attachment: m.attachment || null,\\n modelId: m.modelId,\\n profileIds: [...m.profileIds],\\n skills: [...m.skills],\\n toolPatterns: [...m.toolPatterns],\\n };\\n} else {\\n state.features.mastra.mainAgent = null;\\n}\\n\\nif (state.features.mastra.enabled) {\\n state.features.mastra.subAgents = action.input.subAgents.map((s) => ({\\n id: s.id,\\n name: s.name,\\n description: s.description,\\n modelId: s.modelId,\\n profileIds: [...s.profileIds],\\n skills: [...s.skills],\\n toolPatterns: [...s.toolPatterns],\\n }));\\n} else {\\n state.features.mastra.subAgents = [];\\n}\\n\\nif (\\n action.input.enableChat &&\\n state.features.mastra.enabled &&\\n state.features.powerhouse !== 'Disabled'\\n) {\\n state.features.mastra.common.enableChat = true;\\n const CLINT_COMMON_PKG = '@powerhousedao/clint-common';\\n const CHAT_DOC_TYPE = 'powerhouse/chat-session';\\n const existing = state.packages.find(\\n (p) => p.packageName === CLINT_COMMON_PKG,\\n );\\n if (!existing) {\\n state.packages.push({\\n id: 'pkg-clint-common',\\n packageName: CLINT_COMMON_PKG,\\n documentTypes: [CHAT_DOC_TYPE],\\n version: null,\\n managed: true,\\n });\\n } else if (!existing.documentTypes.includes(CHAT_DOC_TYPE)) {\\n existing.documentTypes.push(CHAT_DOC_TYPE);\\n }\\n} else {\\n state.features.mastra.common.enableChat = false;\\n}\\n\\nstate.deployment.proxyEnabled = action.input.proxyEnabled ?? false;\\nstate.deployment.observabilityEnabled = action.input.observabilityEnabled ?? false;\\nstate.deployment.supportedResources = action.input.supportedResources\\n ? [...action.input.supportedResources]\\n : [];\",\n errors: [],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-deployment',\n name: 'deployment',\n description: 'Deployment settings: service announcement toggle and supported resource tiers.',\n operations: [\n {\n id: 'o-add-supported-resource',\n name: 'ADD_SUPPORTED_RESOURCE',\n description: 'Add a supported resource tier. Guards against duplicates.',\n schema: 'input AddSupportedResourceInput {\\n resource: String!\\n}',\n template: 'Add a supported resource tier. Guards against duplicates.',\n reducer:\n '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);',\n errors: [\n {\n id: 'e-duplicate-resource',\n name: 'DuplicateResourceError',\n code: 'DUPLICATE_RESOURCE',\n description: 'This resource is already in the supported resources list.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-supported-resource',\n name: 'REMOVE_SUPPORTED_RESOURCE',\n description: 'Remove a supported resource tier.',\n schema: 'input RemoveSupportedResourceInput {\\n resource: String!\\n}',\n template: 'Remove a supported resource tier.',\n reducer:\n '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);',\n errors: [\n {\n id: 'e-resource-not-found',\n name: 'ResourceNotFoundError',\n code: 'RESOURCE_NOT_FOUND',\n description: 'The specified resource was not found in the supported resources list.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-proxy-enabled',\n name: 'SET_PROXY_ENABLED',\n description: 'Toggle the embedded reverse proxy.',\n schema: 'input SetProxyEnabledInput {\\n enabled: Boolean!\\n}',\n template: 'Toggle the embedded reverse proxy.',\n reducer: 'state.deployment.proxyEnabled = action.input.enabled;',\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-observability-enabled',\n name: 'SET_OBSERVABILITY_ENABLED',\n description: 'Toggle the observability plugin (Sentry + OpenTelemetry).',\n schema: 'input SetObservabilityEnabledInput {\\n enabled: Boolean!\\n}',\n template: 'Toggle the observability plugin (Sentry + OpenTelemetry).',\n reducer: 'state.deployment.observabilityEnabled = action.input.enabled;',\n errors: [],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-features-mastra',\n name: 'features_mastra',\n description: 'Top-level Mastra feature toggles: enable/disable and chat integration.',\n operations: [\n {\n id: 'o-enable-mastra',\n name: 'ENABLE_MASTRA',\n description: 'Enable Mastra. Seeds mainAgent with a default model (clint/demo-agent) and a base profile. Idempotent.',\n schema: 'input EnableMastraInput {\\n agentId: OID!\\n agentName: String!\\n}',\n template: 'Enable the Mastra agent feature. Seeds mainAgent with the seeded model + profile.',\n reducer:\n \"if (!/^[a-z][a-z0-9-]*$/.test(action.input.agentId)) {\\n throw new InvalidAgentIdError(\\n `Invalid agent ID: ${action.input.agentId}. Must be lowercase kebab-case.`,\\n );\\n}\\nconst trimmedName = action.input.agentName.trim();\\nif (!trimmedName) {\\n throw new InvalidAgentNameError('Agent name must not be empty.');\\n}\\nstate.features.mastra.enabled = true;\\nif (state.features.mastra.models.length === 0) {\\n state.features.mastra.models.push({ id: 'clint/demo-agent' });\\n}\\nif (state.features.mastra.profiles.length === 0) {\\n state.features.mastra.profiles.push({ id: 'base', title: 'Base Profile', content: 'You are a helpful assistant.' });\\n}\\nconst existing = state.features.mastra.mainAgent;\\nif (!existing) {\\n state.features.mastra.mainAgent = {\\n id: action.input.agentId,\\n name: trimmedName,\\n description: null,\\n attachment: null,\\n modelId: 'clint/demo-agent',\\n profileIds: ['base'],\\n skills: [],\\n toolPatterns: [],\\n };\\n} else {\\n existing.id = action.input.agentId;\\n existing.name = trimmedName;\\n}\",\n errors: [\n {\n id: 'e-enable-mastra-invalid-id',\n name: 'InvalidAgentIdError',\n code: 'INVALID_AGENT_ID',\n description: 'The agent ID must match /^[a-z][a-z0-9-]*$/ \\u2014 lowercase kebab-case.',\n template: '',\n },\n {\n id: 'e-enable-mastra-invalid-name',\n name: 'InvalidAgentNameError',\n code: 'INVALID_AGENT_NAME',\n description: 'The agent name must not be empty after trimming.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-disable-mastra',\n name: 'DISABLE_MASTRA',\n description: 'Disable Mastra. Clears mainAgent, subAgents, models, profiles and the chat integration. Removes the auto-managed clint-common package.',\n schema: 'input DisableMastraInput {\\n _: Boolean\\n}',\n template: 'Disable the Mastra agent feature.',\n reducer:\n \"state.features.mastra.enabled = false;\\nstate.features.mastra.mainAgent = null;\\nstate.features.mastra.subAgents = [];\\nstate.features.mastra.models = [];\\nstate.features.mastra.profiles = [];\\nstate.features.mastra.common.enableChat = false;\\nconst ccIdx = state.packages.findIndex(\\n (p) => p.packageName === '@powerhousedao/clint-common' && p.managed,\\n);\\nif (ccIdx !== -1) {\\n state.packages.splice(ccIdx, 1);\\n}\",\n errors: [],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-enable-chat',\n name: 'SET_ENABLE_CHAT',\n 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.',\n schema: 'input SetEnableChatInput {\\n enabled: Boolean!\\n}',\n template: 'Toggle the chat integration feature. Requires both Mastra and Powerhouse to be enabled.',\n reducer:\n \"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}\",\n errors: [\n {\n id: 'e-chat-mastra-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before toggling chat.',\n template: '',\n },\n {\n id: 'e-chat-powerhouse-not-enabled',\n name: 'PowerhouseNotEnabledError',\n code: 'POWERHOUSE_NOT_ENABLED',\n description: 'Powerhouse must be enabled (Reactor or above) before toggling chat.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-mastra-models',\n name: 'mastra_models',\n description: 'Model library CRUD. Models are referenced by main and sub agents via modelId.',\n operations: [\n {\n id: 'o-add-model',\n name: 'ADD_MODEL',\n description: 'Add a model to the library. ID must be provider/model-name format. First model is forced default. If isDefault is true, previous default is unset.',\n schema: 'input AddModelInput {\\n id: OID!\\n}',\n template: 'Add a model to the library.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot add model when Mastra is disabled.');\\n}\\nif (!/^[a-z0-9-]+\\\\/[a-z0-9._-]+$/.test(action.input.id)) {\\n throw new InvalidModelIdError(`Invalid model ID: ${action.input.id}. Must be provider/model-name format.`);\\n}\\nif (state.features.mastra.models.find((m) => m.id === action.input.id)) {\\n throw new DuplicateModelError(`Model already exists: ${action.input.id}`);\\n}\\nstate.features.mastra.models.push({ id: action.input.id });\",\n errors: [\n {\n id: 'e-add-model-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing models.',\n template: '',\n },\n {\n id: 'e-add-model-invalid-id',\n name: 'InvalidModelIdError',\n code: 'INVALID_MODEL_ID',\n description: 'Model ID must match provider/model-name format.',\n template: '',\n },\n {\n id: 'e-add-model-duplicate',\n name: 'DuplicateModelError',\n code: 'DUPLICATE_MODEL',\n description: 'A model with this ID already exists.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-model',\n name: 'REMOVE_MODEL',\n description: 'Remove a model from the library. Rejects when any agent (main or sub) references it. Promotes first remaining to default if removing the current default.',\n schema: 'input RemoveModelInput {\\n id: OID!\\n}',\n template: 'Remove a model from the library.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot remove model when Mastra is disabled.');\\n}\\nconst idx = state.features.mastra.models.findIndex((m) => m.id === action.input.id);\\nif (idx === -1) {\\n throw new ModelNotFoundError(`Model not found: ${action.input.id}`);\\n}\\nconst main = state.features.mastra.mainAgent;\\nconst usedByMain = !!main && main.modelId === action.input.id;\\nconst usedBySub = state.features.mastra.subAgents.some(\\n (s) => s.modelId === action.input.id,\\n);\\nif (usedByMain || usedBySub) {\\n throw new ModelInUseError(\\n `Model ${action.input.id} is in use by an agent.`,\\n );\\n}\\nstate.features.mastra.models.splice(idx, 1);\",\n errors: [\n {\n id: 'e-remove-model-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing models.',\n template: '',\n },\n {\n id: 'e-remove-model-not-found',\n name: 'ModelNotFoundError',\n code: 'MODEL_NOT_FOUND',\n description: 'The specified model was not found.',\n template: '',\n },\n {\n id: 'e-remove-model-in-use',\n name: 'ModelInUseError',\n code: 'MODEL_IN_USE',\n description: 'Cannot remove a model that is still referenced by an agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-mastra-profiles',\n name: 'mastra_profiles',\n description: 'Profile library CRUD. Profiles are referenced by main and sub agents via profileIds.',\n operations: [\n {\n id: 'o-add-profile',\n name: 'ADD_PROFILE',\n description: 'Add a profile to the library. Inserted before insertBefore if provided, otherwise appended.',\n schema: 'input AddProfileInput {\\n id: OID!\\n title: String!\\n content: String!\\n insertBefore: OID\\n}',\n template: 'Add a profile to the library.',\n reducer:\n \"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}\",\n errors: [\n {\n id: 'e-add-profile-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing profiles.',\n template: '',\n },\n {\n id: 'e-add-profile-invalid-id',\n name: 'InvalidProfileIdError',\n code: 'INVALID_PROFILE_ID',\n description: 'Profile ID must match /^[a-z][a-z0-9-]*$/ \\u2014 lowercase kebab-case.',\n template: '',\n },\n {\n id: 'e-add-profile-duplicate',\n name: 'DuplicateProfileError',\n code: 'DUPLICATE_PROFILE',\n description: 'A profile with this ID already exists.',\n template: '',\n },\n {\n id: 'e-add-profile-not-found',\n name: 'ProfileNotFoundError',\n code: 'PROFILE_NOT_FOUND',\n description: 'The insertBefore profile was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-update-profile',\n name: 'UPDATE_PROFILE',\n description: \"Update an existing profile's title and/or content. Only updates provided fields.\",\n schema: 'input UpdateProfileInput {\\n id: OID!\\n title: String\\n content: String\\n}',\n template: 'Update an existing profile.',\n reducer:\n \"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;\",\n errors: [\n {\n id: 'e-update-profile-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing profiles.',\n template: '',\n },\n {\n id: 'e-update-profile-not-found',\n name: 'ProfileNotFoundError',\n code: 'PROFILE_NOT_FOUND',\n description: 'The specified profile was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-profile',\n name: 'REMOVE_PROFILE',\n description: 'Remove a profile from the library. Rejects when any agent (main or sub) references it.',\n schema: 'input RemoveProfileInput {\\n id: OID!\\n}',\n template: 'Remove a profile from the library.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot remove profile when Mastra is disabled.');\\n}\\nconst idx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.id);\\nif (idx === -1) {\\n throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);\\n}\\nconst main = state.features.mastra.mainAgent;\\nconst usedByMain = !!main && main.profileIds.includes(action.input.id);\\nconst usedBySub = state.features.mastra.subAgents.some(\\n (s) => s.profileIds.includes(action.input.id),\\n);\\nif (usedByMain || usedBySub) {\\n throw new ProfileInUseError(\\n `Profile ${action.input.id} is in use by an agent.`,\\n );\\n}\\nstate.features.mastra.profiles.splice(idx, 1);\",\n errors: [\n {\n id: 'e-remove-profile-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing profiles.',\n template: '',\n },\n {\n id: 'e-remove-profile-not-found',\n name: 'ProfileNotFoundError',\n code: 'PROFILE_NOT_FOUND',\n description: 'The specified profile was not found.',\n template: '',\n },\n {\n id: 'e-remove-profile-in-use',\n name: 'ProfileInUseError',\n code: 'PROFILE_IN_USE',\n description: 'Cannot remove a profile that is still referenced by an agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-reorder-profiles',\n name: 'REORDER_PROFILES',\n description: 'Move one or more profiles before another profile, or to the end if insertBefore is null.',\n schema: 'input ReorderProfilesInput {\\n ids: [OID!]!\\n insertBefore: OID\\n}',\n template: 'Reorder profiles.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot reorder profiles when Mastra is disabled.');\\n}\\nconst moving = [];\\nfor (const id of action.input.ids) {\\n const profile = state.features.mastra.profiles.find(p => p.id === id);\\n if (!profile) {\\n throw new ProfileNotFoundError(`Profile not found: ${id}`);\\n }\\n moving.push(profile);\\n}\\nstate.features.mastra.profiles = state.features.mastra.profiles.filter(p => !action.input.ids.includes(p.id));\\nif (action.input.insertBefore) {\\n const beforeIdx = state.features.mastra.profiles.findIndex(p => p.id === action.input.insertBefore);\\n if (beforeIdx === -1) {\\n throw new ProfileNotFoundError(`insertBefore profile not found: ${action.input.insertBefore}`);\\n }\\n state.features.mastra.profiles.splice(beforeIdx, 0, ...moving);\\n} else {\\n state.features.mastra.profiles.push(...moving);\\n}\",\n errors: [\n {\n id: 'e-reorder-profiles-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing profiles.',\n template: '',\n },\n {\n id: 'e-reorder-profiles-not-found',\n name: 'ProfileNotFoundError',\n code: 'PROFILE_NOT_FOUND',\n description: 'A referenced profile was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-mastra-main-agent',\n name: 'mastra_main_agent',\n description: 'Main agent identity ops. Main agent ID is set at ENABLE_MASTRA and stable thereafter \\u2014 to change it, disable then re-enable.',\n operations: [\n {\n id: 'o-set-main-agent-name',\n name: 'SET_MAIN_AGENT_NAME',\n description: \"Set the main agent's display name. Must be non-empty after trim.\",\n schema: 'input SetMainAgentNameInput {\\n name: String!\\n}',\n template: \"Set the main agent's display name.\",\n reducer:\n \"const main = state.features.mastra.mainAgent;\\nif (!state.features.mastra.enabled || !main) {\\n throw new MastraNotEnabledError(\\n 'Cannot set main agent name when Mastra is disabled.',\\n );\\n}\\nconst trimmed = action.input.name.trim();\\nif (!trimmed) {\\n throw new InvalidAgentNameError('Agent name must not be empty.');\\n}\\nmain.name = trimmed;\",\n errors: [\n {\n id: 'e-set-main-name-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing the main agent.',\n template: '',\n },\n {\n id: 'e-set-main-name-invalid',\n name: 'InvalidAgentNameError',\n code: 'INVALID_AGENT_NAME',\n description: 'The agent name must not be empty after trimming.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-main-agent-description',\n name: 'SET_MAIN_AGENT_DESCRIPTION',\n description: \"Set the main agent's description.\",\n schema: 'input SetMainAgentDescriptionInput {\\n description: String!\\n}',\n template: \"Set the main agent's description.\",\n reducer:\n \"const main = state.features.mastra.mainAgent;\\nif (!state.features.mastra.enabled || !main) {\\n throw new MastraNotEnabledError(\\n 'Cannot set main agent description when Mastra is disabled.',\\n );\\n}\\nmain.description = action.input.description;\",\n errors: [\n {\n id: 'e-set-main-desc-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing the main agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-clear-main-agent-description',\n name: 'CLEAR_MAIN_AGENT_DESCRIPTION',\n description: \"Clear the main agent's description.\",\n schema: 'input ClearMainAgentDescriptionInput {\\n _: Boolean\\n}',\n template: \"Clear the main agent's description.\",\n reducer:\n \"const main = state.features.mastra.mainAgent;\\nif (!state.features.mastra.enabled || !main) {\\n throw new MastraNotEnabledError(\\n 'Cannot clear main agent description when Mastra is disabled.',\\n );\\n}\\nmain.description = null;\",\n errors: [\n {\n id: 'e-clear-main-desc-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing the main agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-main-agent-image',\n name: 'SET_MAIN_AGENT_IMAGE',\n description: \"Set the main agent's avatar attachment ref.\",\n schema: 'input SetMainAgentImageInput {\\n attachment: String!\\n}',\n template: \"Set the main agent's avatar.\",\n reducer:\n \"const main = state.features.mastra.mainAgent;\\nif (!state.features.mastra.enabled || !main) {\\n throw new MastraNotEnabledError(\\n 'Cannot set main agent image when Mastra is disabled.',\\n );\\n}\\nif (!action.input.attachment.startsWith('attachment://')) {\\n throw new InvalidAgentImageError(\\n 'Agent image must be an attachment ref (attachment://...)',\\n );\\n}\\nmain.attachment = action.input.attachment;\",\n errors: [\n {\n id: 'e-set-main-image-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing the main agent.',\n template: '',\n },\n {\n id: 'e-set-main-image-invalid',\n name: 'InvalidAgentImageError',\n code: 'INVALID_AGENT_IMAGE',\n description: 'Agent image must be an attachment ref',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-clear-main-agent-image',\n name: 'CLEAR_MAIN_AGENT_IMAGE',\n description: \"Clear the main agent's avatar.\",\n schema: 'input ClearMainAgentImageInput {\\n _: Boolean\\n}',\n template: \"Clear the main agent's avatar.\",\n reducer:\n \"const main = state.features.mastra.mainAgent;\\nif (!state.features.mastra.enabled || !main) {\\n throw new MastraNotEnabledError(\\n 'Cannot clear main agent image when Mastra is disabled.',\\n );\\n}\\nmain.attachment = null;\",\n errors: [\n {\n id: 'e-clear-main-image-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing the main agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-mastra-sub-agents',\n name: 'mastra_sub_agents',\n description: 'Sub-agent CRUD. Sub-agent ids are unique across the main agent and all other sub-agents.',\n operations: [\n {\n id: 'o-add-sub-agent',\n name: 'ADD_SUB_AGENT',\n description: 'Add a sub-agent. ID must be lowercase kebab-case and unique (across main + sub agents). modelId must exist in the model library. Seeds empty profileIds/skills/toolPatterns.',\n schema: 'input AddSubAgentInput {\\n id: OID!\\n name: String!\\n description: String!\\n modelId: OID!\\n}',\n template: 'Add a sub-agent.',\n reducer:\n \"const main = state.features.mastra.mainAgent;\\nif (!state.features.mastra.enabled || !main) {\\n throw new MastraNotEnabledError(\\n 'Cannot add sub-agent when Mastra is disabled.',\\n );\\n}\\nif (!/^[a-z][a-z0-9-]*$/.test(action.input.id)) {\\n throw new InvalidAgentIdError(\\n `Invalid sub-agent ID: ${action.input.id}. Must be lowercase kebab-case.`,\\n );\\n}\\nconst trimmedName = action.input.name.trim();\\nif (!trimmedName) {\\n throw new InvalidAgentNameError('Sub-agent name must not be empty.');\\n}\\nif (main.id === action.input.id) {\\n throw new DuplicateAgentIdError(\\n `Agent ID already taken by main agent: ${action.input.id}`,\\n );\\n}\\nif (state.features.mastra.subAgents.find((s) => s.id === action.input.id)) {\\n throw new DuplicateAgentIdError(\\n `Sub-agent already exists: ${action.input.id}`,\\n );\\n}\\nif (!state.features.mastra.models.find((m) => m.id === action.input.modelId)) {\\n throw new ModelReferenceNotFoundError(\\n `Model not in library: ${action.input.modelId}`,\\n );\\n}\\nstate.features.mastra.subAgents.push({\\n id: action.input.id,\\n name: trimmedName,\\n description: action.input.description,\\n modelId: action.input.modelId,\\n profileIds: [],\\n skills: [],\\n toolPatterns: [],\\n});\",\n errors: [\n {\n id: 'e-add-sub-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing sub-agents.',\n template: '',\n },\n {\n id: 'e-add-sub-invalid-id',\n name: 'InvalidAgentIdError',\n code: 'INVALID_AGENT_ID',\n description: 'Sub-agent ID must be lowercase kebab-case.',\n template: '',\n },\n {\n id: 'e-add-sub-invalid-name',\n name: 'InvalidAgentNameError',\n code: 'INVALID_AGENT_NAME',\n description: 'Sub-agent name must not be empty after trimming.',\n template: '',\n },\n {\n id: 'e-add-sub-duplicate',\n name: 'DuplicateAgentIdError',\n code: 'DUPLICATE_AGENT_ID',\n description: 'An agent with this ID already exists (main or sub).',\n template: '',\n },\n {\n id: 'e-add-sub-model-not-found',\n name: 'ModelReferenceNotFoundError',\n code: 'MODEL_REFERENCE_NOT_FOUND',\n description: 'The referenced modelId does not exist in the model library.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-sub-agent',\n name: 'REMOVE_SUB_AGENT',\n description: 'Remove a sub-agent.',\n schema: 'input RemoveSubAgentInput {\\n id: OID!\\n}',\n template: 'Remove a sub-agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot remove sub-agent when Mastra is disabled.');\\n}\\nconst idx = state.features.mastra.subAgents.findIndex(s => s.id === action.input.id);\\nif (idx === -1) {\\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\\n}\\nstate.features.mastra.subAgents.splice(idx, 1);\",\n errors: [\n {\n id: 'e-remove-sub-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing sub-agents.',\n template: '',\n },\n {\n id: 'e-remove-sub-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified sub-agent was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-sub-agent-name',\n name: 'SET_SUB_AGENT_NAME',\n description: \"Set a sub-agent's display name.\",\n schema: 'input SetSubAgentNameInput {\\n id: OID!\\n name: String!\\n}',\n template: \"Set a sub-agent's display name.\",\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot set sub-agent name when Mastra is disabled.');\\n}\\nconst sub = state.features.mastra.subAgents.find(s => s.id === action.input.id);\\nif (!sub) {\\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\\n}\\nconst trimmed = action.input.name.trim();\\nif (!trimmed) {\\n throw new InvalidAgentNameError('Sub-agent name must not be empty.');\\n}\\nsub.name = trimmed;\",\n errors: [\n {\n id: 'e-set-sub-name-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing sub-agents.',\n template: '',\n },\n {\n id: 'e-set-sub-name-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified sub-agent was not found.',\n template: '',\n },\n {\n id: 'e-set-sub-name-invalid',\n name: 'InvalidAgentNameError',\n code: 'INVALID_AGENT_NAME',\n description: 'Sub-agent name must not be empty after trimming.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-set-sub-agent-description',\n name: 'SET_SUB_AGENT_DESCRIPTION',\n description: \"Set a sub-agent's description.\",\n schema: 'input SetSubAgentDescriptionInput {\\n id: OID!\\n description: String!\\n}',\n template: \"Set a sub-agent's description.\",\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot set sub-agent description when Mastra is disabled.');\\n}\\nconst sub = state.features.mastra.subAgents.find(s => s.id === action.input.id);\\nif (!sub) {\\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\\n}\\nsub.description = action.input.description;\",\n errors: [\n {\n id: 'e-set-sub-desc-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing sub-agents.',\n template: '',\n },\n {\n id: 'e-set-sub-desc-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified sub-agent was not found.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n {\n id: 'm-mastra-agent-bindings',\n name: 'mastra_agent_bindings',\n description: 'Per-agent assignments of model, profile references, skills, and tool-name patterns. agentId resolves to main if it matches mainAgent.id, else looks up subAgents.',\n operations: [\n {\n id: 'o-set-agent-model',\n name: 'SET_AGENT_MODEL',\n description: \"Set the agent's model. modelId must exist in the model library. agentId resolves to main or a sub.\",\n schema: 'input SetAgentModelInput {\\n agentId: OID!\\n modelId: OID!\\n}',\n template: 'Bind an agent to a model.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot set agent model when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nif (!state.features.mastra.models.find((m) => m.id === action.input.modelId)) {\\n throw new ModelReferenceNotFoundError(\\n `Model not in library: ${action.input.modelId}`,\\n );\\n}\\nagent.modelId = action.input.modelId;\",\n errors: [\n {\n id: 'e-set-model-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled before managing agent bindings.',\n template: '',\n },\n {\n id: 'e-set-model-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId resolves to neither main nor any sub-agent.',\n template: '',\n },\n {\n id: 'e-set-model-ref-not-found',\n name: 'ModelReferenceNotFoundError',\n code: 'MODEL_REFERENCE_NOT_FOUND',\n description: 'The referenced modelId does not exist in the model library.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-add-agent-profile-ref',\n name: 'ADD_AGENT_PROFILE_REF',\n description: 'Add a profile reference to an agent. profileId must exist in the profile library. Inserts before insertBefore if provided, otherwise appends. Dedup: silent if already present.',\n schema: 'input AddAgentProfileRefInput {\\n agentId: OID!\\n profileId: OID!\\n insertBefore: OID\\n}',\n template: 'Add a profile reference to an agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot add profile ref when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nif (!state.features.mastra.profiles.find((p) => p.id === action.input.profileId)) {\\n throw new ProfileReferenceNotFoundError(\\n `Profile not in library: ${action.input.profileId}`,\\n );\\n}\\nif (agent.profileIds.includes(action.input.profileId)) {\\n return;\\n}\\nif (action.input.insertBefore) {\\n const beforeIdx = agent.profileIds.indexOf(action.input.insertBefore);\\n if (beforeIdx === -1) {\\n throw new ProfileReferenceNotFoundError(\\n `insertBefore profile not in agent's profileIds: ${action.input.insertBefore}`,\\n );\\n }\\n agent.profileIds.splice(beforeIdx, 0, action.input.profileId);\\n} else {\\n agent.profileIds.push(action.input.profileId);\\n}\",\n errors: [\n {\n id: 'e-add-profile-ref-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-add-profile-ref-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-add-profile-ref-not-found',\n name: 'ProfileReferenceNotFoundError',\n code: 'PROFILE_REFERENCE_NOT_FOUND',\n description: 'The referenced profileId does not exist in the profile library, or insertBefore is not present in the agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-agent-profile-ref',\n name: 'REMOVE_AGENT_PROFILE_REF',\n description: 'Remove a profile reference from an agent.',\n schema: 'input RemoveAgentProfileRefInput {\\n agentId: OID!\\n profileId: OID!\\n}',\n template: 'Remove a profile reference from an agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot remove profile ref when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nconst idx = agent.profileIds.indexOf(action.input.profileId);\\nif (idx === -1) {\\n throw new ProfileReferenceNotFoundError(\\n `Profile not in agent's profileIds: ${action.input.profileId}`,\\n );\\n}\\nagent.profileIds.splice(idx, 1);\",\n errors: [\n {\n id: 'e-remove-profile-ref-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-remove-profile-ref-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-remove-profile-ref-not-found',\n name: 'ProfileReferenceNotFoundError',\n code: 'PROFILE_REFERENCE_NOT_FOUND',\n description: \"The profileId is not present in this agent's profileIds.\",\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-reorder-agent-profile-refs',\n name: 'REORDER_AGENT_PROFILE_REFS',\n description: \"Reorder an agent's profile references. Moves the given ids before insertBefore, or to the end if insertBefore is null.\",\n schema: 'input ReorderAgentProfileRefsInput {\\n agentId: OID!\\n ids: [OID!]!\\n insertBefore: OID\\n}',\n template: \"Reorder an agent's profile references.\",\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot reorder profile refs when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nfor (const id of action.input.ids) {\\n if (!agent.profileIds.includes(id)) {\\n throw new ProfileReferenceNotFoundError(\\n `Profile not in agent's profileIds: ${id}`,\\n );\\n }\\n}\\nconst remaining = agent.profileIds.filter(\\n (id) => !action.input.ids.includes(id),\\n);\\nif (action.input.insertBefore) {\\n const beforeIdx = remaining.indexOf(action.input.insertBefore);\\n if (beforeIdx === -1) {\\n throw new ProfileReferenceNotFoundError(\\n `insertBefore profile not in agent's profileIds: ${action.input.insertBefore}`,\\n );\\n }\\n remaining.splice(beforeIdx, 0, ...action.input.ids);\\n} else {\\n remaining.push(...action.input.ids);\\n}\\nagent.profileIds = remaining;\",\n errors: [\n {\n id: 'e-reorder-refs-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-reorder-refs-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-reorder-refs-not-found',\n name: 'ProfileReferenceNotFoundError',\n code: 'PROFILE_REFERENCE_NOT_FOUND',\n description: 'A referenced profileId is not present in this agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-add-agent-skill',\n name: 'ADD_AGENT_SKILL',\n description: 'Add a skill name to an agent. Dedup: silent if already present.',\n schema: 'input AddAgentSkillInput {\\n agentId: OID!\\n name: String!\\n}',\n template: 'Add a skill to an agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot add skill when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nconst trimmed = action.input.name.trim();\\nif (!/^[a-z][a-z0-9-]*$/.test(trimmed)) {\\n throw new InvalidSkillNameError(\\n `Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`,\\n );\\n}\\nif (!agent.skills.includes(trimmed)) {\\n agent.skills.push(trimmed);\\n}\",\n errors: [\n {\n id: 'e-add-skill-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-add-skill-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-add-skill-invalid',\n name: 'InvalidSkillNameError',\n code: 'INVALID_SKILL_NAME',\n description: 'Skill name must be lowercase kebab-case.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-agent-skill',\n name: 'REMOVE_AGENT_SKILL',\n description: 'Remove a skill name from an agent.',\n schema: 'input RemoveAgentSkillInput {\\n agentId: OID!\\n name: String!\\n}',\n template: 'Remove a skill from an agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot remove skill when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nconst idx = agent.skills.indexOf(action.input.name);\\nif (idx === -1) {\\n throw new SkillNotFoundError(`Skill not on agent: ${action.input.name}`);\\n}\\nagent.skills.splice(idx, 1);\",\n errors: [\n {\n id: 'e-remove-skill-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-remove-skill-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-remove-skill-not-found',\n name: 'SkillNotFoundError',\n code: 'SKILL_NOT_FOUND',\n description: 'The skill name is not on this agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-add-agent-tool-pattern',\n name: 'ADD_AGENT_TOOL_PATTERN',\n description: 'Add a tool-name glob pattern to an agent. Dedup: silent if already present.',\n schema: 'input AddAgentToolPatternInput {\\n agentId: OID!\\n pattern: String!\\n}',\n template: 'Add a tool-name pattern to an agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot add tool pattern when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nconst trimmed = action.input.pattern.trim();\\nif (!trimmed) {\\n throw new InvalidToolPatternError('Tool pattern must not be empty after trimming.');\\n}\\nif (!agent.toolPatterns.includes(trimmed)) {\\n agent.toolPatterns.push(trimmed);\\n}\",\n errors: [\n {\n id: 'e-add-pattern-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-add-pattern-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-add-pattern-invalid',\n name: 'InvalidToolPatternError',\n code: 'INVALID_TOOL_PATTERN',\n description: 'Tool pattern must not be empty after trimming.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n {\n id: 'o-remove-agent-tool-pattern',\n name: 'REMOVE_AGENT_TOOL_PATTERN',\n description: 'Remove a tool-name glob pattern from an agent.',\n schema: 'input RemoveAgentToolPatternInput {\\n agentId: OID!\\n pattern: String!\\n}',\n template: 'Remove a tool-name pattern from an agent.',\n reducer:\n \"if (!state.features.mastra.enabled) {\\n throw new MastraNotEnabledError('Cannot remove tool pattern when Mastra is disabled.');\\n}\\nconst main = state.features.mastra.mainAgent;\\nlet agent;\\nif (main && main.id === action.input.agentId) {\\n agent = main;\\n} else {\\n agent = state.features.mastra.subAgents.find(\\n (s) => s.id === action.input.agentId,\\n );\\n}\\nif (!agent) {\\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\\n}\\nconst idx = agent.toolPatterns.indexOf(action.input.pattern);\\nif (idx === -1) {\\n throw new ToolPatternNotFoundError(\\n `Tool pattern not on agent: ${action.input.pattern}`,\\n );\\n}\\nagent.toolPatterns.splice(idx, 1);\",\n errors: [\n {\n id: 'e-remove-pattern-not-enabled',\n name: 'MastraNotEnabledError',\n code: 'MASTRA_NOT_ENABLED',\n description: 'Mastra must be enabled.',\n template: '',\n },\n {\n id: 'e-remove-pattern-agent-not-found',\n name: 'AgentNotFoundError',\n code: 'AGENT_NOT_FOUND',\n description: 'The specified agentId was not found.',\n template: '',\n },\n {\n id: 'e-remove-pattern-not-found',\n name: 'ToolPatternNotFoundError',\n code: 'TOOL_PATTERN_NOT_FOUND',\n description: 'The tool pattern is not on this agent.',\n template: '',\n },\n ],\n examples: [],\n scope: 'global',\n },\n ],\n },\n ],\n version: 1,\n changeLog: [],\n },\n ],\n};\n","export type ErrorCode = 'DuplicateResourceError' | 'ResourceNotFoundError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class DuplicateResourceError extends Error implements ReducerError {\n errorCode = 'DuplicateResourceError' as ErrorCode;\n constructor(message = 'DuplicateResourceError') {\n super(message);\n }\n}\n\nexport class ResourceNotFoundError extends Error implements ReducerError {\n errorCode = 'ResourceNotFoundError' as ErrorCode;\n constructor(message = 'ResourceNotFoundError') {\n super(message);\n }\n}\n\nexport const errors = {\n AddSupportedResource: { DuplicateResourceError },\n RemoveSupportedResource: { ResourceNotFoundError },\n};\n","import type { PhClintProjectDeploymentOperations } from 'document-models/ph-clint-project/v1';\nimport { DuplicateResourceError, ResourceNotFoundError } from '../../gen/deployment/error.js';\n\nexport const phClintProjectDeploymentOperations: PhClintProjectDeploymentOperations = {\n addSupportedResourceOperation(state, action) {\n if (state.deployment.supportedResources.includes(action.input.resource)) {\n throw new DuplicateResourceError(`Resource already exists: ${action.input.resource}`);\n }\n state.deployment.supportedResources.push(action.input.resource);\n },\n removeSupportedResourceOperation(state, action) {\n const idx = state.deployment.supportedResources.indexOf(action.input.resource);\n if (idx === -1) {\n throw new ResourceNotFoundError(`Resource not found: ${action.input.resource}`);\n }\n state.deployment.supportedResources.splice(idx, 1);\n },\n setProxyEnabledOperation(state, action) {\n state.deployment.proxyEnabled = action.input.enabled;\n },\n setObservabilityEnabledOperation(state, action) {\n state.deployment.observabilityEnabled = action.input.enabled;\n },\n};\n","export type ErrorCode = 'InvalidSkillNameError' | 'DuplicateSkillError' | 'SkillNotFoundError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidSkillNameError extends Error implements ReducerError {\n errorCode = 'InvalidSkillNameError' as ErrorCode;\n constructor(message = 'InvalidSkillNameError') {\n super(message);\n }\n}\n\nexport class DuplicateSkillError extends Error implements ReducerError {\n errorCode = 'DuplicateSkillError' as ErrorCode;\n constructor(message = 'DuplicateSkillError') {\n super(message);\n }\n}\n\nexport class SkillNotFoundError extends Error implements ReducerError {\n errorCode = 'SkillNotFoundError' as ErrorCode;\n constructor(message = 'SkillNotFoundError') {\n super(message);\n }\n}\n\nexport const errors = {\n AddExternalSkill: { InvalidSkillNameError, DuplicateSkillError },\n RemoveExternalSkill: { SkillNotFoundError },\n SetExternalSkillName: {\n SkillNotFoundError,\n InvalidSkillNameError,\n DuplicateSkillError,\n },\n SetExternalSkillGithubUrl: { SkillNotFoundError },\n};\n","import type { PhClintProjectExternalSkillsOperations } from 'document-models/ph-clint-project/v1';\nimport { DuplicateSkillError, InvalidSkillNameError, SkillNotFoundError } from '../../gen/external-skills/error.js';\n\nexport const phClintProjectExternalSkillsOperations: PhClintProjectExternalSkillsOperations = {\n addExternalSkillOperation(state, action) {\n 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 }\n const exists = state.externalSkills.find((s) => s.id === action.input.id || s.name === action.input.name);\n if (exists) {\n throw new DuplicateSkillError(`Skill already exists: ${action.input.name}`);\n }\n state.externalSkills.push({\n id: action.input.id,\n name: action.input.name,\n githubUrl: action.input.githubUrl,\n });\n },\n removeExternalSkillOperation(state, action) {\n const idx = state.externalSkills.findIndex((s) => s.id === action.input.id);\n if (idx === -1) {\n throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);\n }\n state.externalSkills.splice(idx, 1);\n },\n setExternalSkillNameOperation(state, action) {\n const skill = state.externalSkills.find((s) => s.id === action.input.id);\n if (!skill) {\n throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);\n }\n 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 }\n const duplicate = state.externalSkills.find((s) => s.name === action.input.name && s.id !== action.input.id);\n if (duplicate) {\n throw new DuplicateSkillError(`Skill name already in use: ${action.input.name}`);\n }\n skill.name = action.input.name;\n },\n setExternalSkillGithubUrlOperation(state, action) {\n const skill = state.externalSkills.find((s) => s.id === action.input.id);\n if (!skill) {\n throw new SkillNotFoundError(`Skill not found: ${action.input.id}`);\n }\n skill.githubUrl = action.input.githubUrl;\n },\n};\n","export type ErrorCode = 'InvalidAgentIdError' | 'InvalidAgentNameError' | 'MastraNotEnabledError' | 'PowerhouseNotEnabledError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidAgentIdError extends Error implements ReducerError {\n errorCode = 'InvalidAgentIdError' as ErrorCode;\n constructor(message = 'InvalidAgentIdError') {\n super(message);\n }\n}\n\nexport class InvalidAgentNameError extends Error implements ReducerError {\n errorCode = 'InvalidAgentNameError' as ErrorCode;\n constructor(message = 'InvalidAgentNameError') {\n super(message);\n }\n}\n\nexport class MastraNotEnabledError extends Error implements ReducerError {\n errorCode = 'MastraNotEnabledError' as ErrorCode;\n constructor(message = 'MastraNotEnabledError') {\n super(message);\n }\n}\n\nexport class PowerhouseNotEnabledError extends Error implements ReducerError {\n errorCode = 'PowerhouseNotEnabledError' as ErrorCode;\n constructor(message = 'PowerhouseNotEnabledError') {\n super(message);\n }\n}\n\nexport const errors = {\n EnableMastra: { InvalidAgentIdError, InvalidAgentNameError },\n SetEnableChat: { MastraNotEnabledError, PowerhouseNotEnabledError },\n};\n","import type { PhClintProjectFeaturesMastraOperations } from 'document-models/ph-clint-project/v1';\nimport { InvalidAgentIdError, InvalidAgentNameError, MastraNotEnabledError, PowerhouseNotEnabledError } from '../../gen/features-mastra/error.js';\n\nexport const phClintProjectFeaturesMastraOperations: PhClintProjectFeaturesMastraOperations = {\n enableMastraOperation(state, action) {\n if (!/^[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 }\n const trimmedName = action.input.agentName.trim();\n if (!trimmedName) {\n throw new InvalidAgentNameError('Agent name must not be empty.');\n }\n state.features.mastra.enabled = true;\n if (state.features.mastra.models.length === 0) {\n state.features.mastra.models.push({ id: 'clint/demo-agent' });\n }\n if (state.features.mastra.profiles.length === 0) {\n state.features.mastra.profiles.push({\n id: 'base',\n title: 'Base Profile',\n content: 'You are a helpful assistant.',\n });\n }\n const existing = state.features.mastra.mainAgent;\n if (!existing) {\n state.features.mastra.mainAgent = {\n id: action.input.agentId,\n name: trimmedName,\n description: null,\n attachment: null,\n modelId: 'clint/demo-agent',\n profileIds: ['base'],\n skills: [],\n toolPatterns: [],\n };\n } else {\n existing.id = action.input.agentId;\n existing.name = trimmedName;\n }\n },\n disableMastraOperation(state) {\n state.features.mastra.enabled = false;\n state.features.mastra.mainAgent = null;\n state.features.mastra.subAgents = [];\n state.features.mastra.models = [];\n state.features.mastra.profiles = [];\n state.features.mastra.common.enableChat = false;\n const ccIdx = state.packages.findIndex((p) => p.packageName === '@powerhousedao/clint-common' && p.managed);\n if (ccIdx !== -1) {\n state.packages.splice(ccIdx, 1);\n }\n },\n setEnableChatOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot toggle chat when Mastra is disabled.');\n }\n if (state.features.powerhouse === 'Disabled') {\n throw new PowerhouseNotEnabledError('Cannot toggle chat when Powerhouse is disabled.');\n }\n state.features.mastra.common.enableChat = action.input.enabled;\n const CLINT_COMMON_PKG = '@powerhousedao/clint-common';\n const CHAT_DOC_TYPE = 'powerhouse/chat-session';\n if (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((p) => p.packageName === CLINT_COMMON_PKG && p.managed);\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 }\n },\n};\n","export type ErrorCode = 'CannotLowerPowerhouseError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class CannotLowerPowerhouseError extends Error implements ReducerError {\n errorCode = 'CannotLowerPowerhouseError' as ErrorCode;\n constructor(message = 'CannotLowerPowerhouseError') {\n super(message);\n }\n}\n\nexport const errors = {\n SetPowerhouseLevel: { CannotLowerPowerhouseError },\n};\n","import type { PhClintProjectFeaturesPowerhouseOperations } from 'document-models/ph-clint-project/v1';\nimport { CannotLowerPowerhouseError } from '../../gen/features-powerhouse/error.js';\n\nconst LEVELS = ['Disabled', 'Reactor', 'Switchboard', 'Connect'] as const;\n\nexport const phClintProjectFeaturesPowerhouseOperations: PhClintProjectFeaturesPowerhouseOperations = {\n setPowerhouseLevelOperation(state, action) {\n const current = LEVELS.indexOf(state.features.powerhouse);\n const next = LEVELS.indexOf(action.input.level);\n if (current >= 1 && next < 1) {\n throw new CannotLowerPowerhouseError('Cannot lower Powerhouse level below Reactor once enabled');\n }\n state.features.powerhouse = action.input.level;\n // Auto-create managed app package when transitioning from Disabled to enabled\n if (current === 0 && next >= 1) {\n const hasManaged = state.packages.some((p) => p.managed);\n if (!hasManaged) {\n const baseName = state.name ? state.name.replace(/-cli$/, '-app') : 'app';\n const appName = state.scope && state.name ? `${state.scope}/${baseName}` : 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 }\n // Auto-enable proxy when reaching Switchboard or above\n if (next >= 2 && !action.input.skipAutoProxy) {\n state.deployment.proxyEnabled = true;\n }\n },\n};\n","import type { PhClintProjectFeaturesRoutineOperations } from 'document-models/ph-clint-project/v1';\n\nexport const phClintProjectFeaturesRoutineOperations: PhClintProjectFeaturesRoutineOperations = {\n enableRoutineOperation(state) {\n state.features.routine.enabled = true;\n },\n disableRoutineOperation(state) {\n state.features.routine.enabled = false;\n },\n};\n","export type ErrorCode = 'InvalidVersionError' | 'InvalidPackageIdentifierError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidVersionError extends Error implements ReducerError {\n errorCode = 'InvalidVersionError' as ErrorCode;\n constructor(message = 'InvalidVersionError') {\n super(message);\n }\n}\n\nexport class InvalidPackageIdentifierError extends Error implements ReducerError {\n errorCode = 'InvalidPackageIdentifierError' as ErrorCode;\n constructor(message = 'InvalidPackageIdentifierError') {\n super(message);\n }\n}\n\nexport const errors = {\n SetVersion: { InvalidVersionError },\n SetPackageIdentifier: { InvalidPackageIdentifierError },\n};\n","import type { PhClintProjectIdentityOperations } from 'document-models/ph-clint-project/v1';\nimport { InvalidPackageIdentifierError, InvalidVersionError } from '../../gen/identity/error.js';\n\nconst SEMVER_PATTERN = /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\nconst NAME_PATTERN = /^[a-z][a-z0-9-]*$/;\n\nexport const phClintProjectIdentityOperations: PhClintProjectIdentityOperations = {\n setVersionOperation(state, action) {\n if (!SEMVER_PATTERN.test(action.input.version)) {\n throw new InvalidVersionError(`Invalid version: ${action.input.version}`);\n }\n state.version = action.input.version;\n },\n setDescriptionOperation(state, action) {\n state.description = action.input.description;\n },\n setPackageIdentifierOperation(state, action) {\n const trimmed = action.input.identifier.trim();\n if (!trimmed) {\n throw new InvalidPackageIdentifierError('Package identifier must not be empty');\n }\n let scopePart: string | null = null;\n let namePart = trimmed;\n if (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 }\n if (scopePart !== null) {\n if (!NAME_PATTERN.test(scopePart)) {\n throw new InvalidPackageIdentifierError(`Invalid scope: ${scopePart}`);\n }\n }\n if (!namePart.endsWith('-cli')) {\n namePart = namePart + '-cli';\n }\n if (!NAME_PATTERN.test(namePart)) {\n throw new InvalidPackageIdentifierError(`Invalid package name: ${namePart}`);\n }\n state.scope = scopePart ? `@${scopePart}` : null;\n state.name = namePart;\n // Update managed app package name to match new identity\n const managed = state.packages.find((p) => p.managed);\n if (managed) {\n const appBase = namePart.replace(/-cli$/, '-app');\n managed.packageName = scopePart ? `@${scopePart}/${appBase}` : appBase;\n managed.id = `app-${namePart}`;\n }\n },\n};\n","import type { PhClintProjectLifecycleOperations } from 'document-models/ph-clint-project/v1';\n\nexport const phClintProjectLifecycleOperations: PhClintProjectLifecycleOperations = {\n importSpecOperation(state, action) {\n state.name = action.input.name;\n state.scope = action.input.scope || null;\n state.version = action.input.version;\n state.description = action.input.description;\n state.features.powerhouse = action.input.powerhouse;\n state.features.mastra.enabled = action.input.mastraEnabled;\n state.features.routine.enabled = action.input.routineEnabled;\n\n const appBase = action.input.name.replace(/-cli$/, '-app');\n const appPkgName = action.input.scope ? `${action.input.scope}/${appBase}` : appBase;\n const phEnabled = action.input.powerhouse !== 'Disabled';\n\n state.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 }));\n state.externalSkills = action.input.externalSkills.map((s) => ({\n id: s.id,\n name: s.name,\n githubUrl: s.githubUrl,\n }));\n\n state.features.mastra.models = action.input.models.map((m) => ({\n id: m.id,\n }));\n state.features.mastra.profiles = action.input.profiles.map((p) => ({\n id: p.id,\n title: p.title,\n content: p.content,\n }));\n\n if (action.input.mainAgent && state.features.mastra.enabled) {\n const m = action.input.mainAgent;\n state.features.mastra.mainAgent = {\n id: m.id,\n name: m.name,\n description: m.description || null,\n attachment: m.attachment || null,\n modelId: m.modelId,\n profileIds: [...m.profileIds],\n skills: [...m.skills],\n toolPatterns: [...m.toolPatterns],\n };\n } else {\n state.features.mastra.mainAgent = null;\n }\n\n if (state.features.mastra.enabled) {\n state.features.mastra.subAgents = action.input.subAgents.map((s) => ({\n id: s.id,\n name: s.name,\n description: s.description,\n modelId: s.modelId,\n profileIds: [...s.profileIds],\n skills: [...s.skills],\n toolPatterns: [...s.toolPatterns],\n }));\n } else {\n state.features.mastra.subAgents = [];\n }\n\n if (action.input.enableChat && state.features.mastra.enabled && state.features.powerhouse !== 'Disabled') {\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((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 state.features.mastra.common.enableChat = false;\n }\n\n state.deployment.proxyEnabled = action.input.proxyEnabled ?? false;\n state.deployment.observabilityEnabled = action.input.observabilityEnabled ?? false;\n state.deployment.supportedResources = action.input.supportedResources ? [...action.input.supportedResources] : [];\n },\n};\n","export type ErrorCode = 'MastraNotEnabledError' | 'AgentNotFoundError' | 'ModelReferenceNotFoundError' | 'ProfileReferenceNotFoundError' | 'InvalidSkillNameError' | 'SkillNotFoundError' | 'InvalidToolPatternError' | 'ToolPatternNotFoundError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class MastraNotEnabledError extends Error implements ReducerError {\n errorCode = 'MastraNotEnabledError' as ErrorCode;\n constructor(message = 'MastraNotEnabledError') {\n super(message);\n }\n}\n\nexport class AgentNotFoundError extends Error implements ReducerError {\n errorCode = 'AgentNotFoundError' as ErrorCode;\n constructor(message = 'AgentNotFoundError') {\n super(message);\n }\n}\n\nexport class ModelReferenceNotFoundError extends Error implements ReducerError {\n errorCode = 'ModelReferenceNotFoundError' as ErrorCode;\n constructor(message = 'ModelReferenceNotFoundError') {\n super(message);\n }\n}\n\nexport class ProfileReferenceNotFoundError extends Error implements ReducerError {\n errorCode = 'ProfileReferenceNotFoundError' as ErrorCode;\n constructor(message = 'ProfileReferenceNotFoundError') {\n super(message);\n }\n}\n\nexport class InvalidSkillNameError extends Error implements ReducerError {\n errorCode = 'InvalidSkillNameError' as ErrorCode;\n constructor(message = 'InvalidSkillNameError') {\n super(message);\n }\n}\n\nexport class SkillNotFoundError extends Error implements ReducerError {\n errorCode = 'SkillNotFoundError' as ErrorCode;\n constructor(message = 'SkillNotFoundError') {\n super(message);\n }\n}\n\nexport class InvalidToolPatternError extends Error implements ReducerError {\n errorCode = 'InvalidToolPatternError' as ErrorCode;\n constructor(message = 'InvalidToolPatternError') {\n super(message);\n }\n}\n\nexport class ToolPatternNotFoundError extends Error implements ReducerError {\n errorCode = 'ToolPatternNotFoundError' as ErrorCode;\n constructor(message = 'ToolPatternNotFoundError') {\n super(message);\n }\n}\n\nexport const errors = {\n SetAgentModel: {\n MastraNotEnabledError,\n AgentNotFoundError,\n ModelReferenceNotFoundError,\n },\n AddAgentProfileRef: {\n MastraNotEnabledError,\n AgentNotFoundError,\n ProfileReferenceNotFoundError,\n },\n RemoveAgentProfileRef: {\n MastraNotEnabledError,\n AgentNotFoundError,\n ProfileReferenceNotFoundError,\n },\n ReorderAgentProfileRefs: {\n MastraNotEnabledError,\n AgentNotFoundError,\n ProfileReferenceNotFoundError,\n },\n AddAgentSkill: {\n MastraNotEnabledError,\n AgentNotFoundError,\n InvalidSkillNameError,\n },\n RemoveAgentSkill: {\n MastraNotEnabledError,\n AgentNotFoundError,\n SkillNotFoundError,\n },\n AddAgentToolPattern: {\n MastraNotEnabledError,\n AgentNotFoundError,\n InvalidToolPatternError,\n },\n RemoveAgentToolPattern: {\n MastraNotEnabledError,\n AgentNotFoundError,\n ToolPatternNotFoundError,\n },\n};\n","import type { PhClintProjectMastraAgentBindingsOperations } from 'document-models/ph-clint-project/v1';\nimport {\n AgentNotFoundError,\n InvalidSkillNameError,\n InvalidToolPatternError,\n MastraNotEnabledError,\n ModelReferenceNotFoundError,\n ProfileReferenceNotFoundError,\n SkillNotFoundError,\n ToolPatternNotFoundError,\n} from '../../gen/mastra-agent-bindings/error.js';\nimport type { PhClintMainAgent, PhClintSubAgent } from '../../gen/schema/types.js';\n\ntype Agent = PhClintMainAgent | PhClintSubAgent;\n\nfunction resolveAgent(main: PhClintMainAgent | null | undefined, subs: PhClintSubAgent[], agentId: string): Agent | undefined {\n if (main && main.id === agentId) return main;\n return subs.find((s) => s.id === agentId);\n}\n\nexport const phClintProjectMastraAgentBindingsOperations: PhClintProjectMastraAgentBindingsOperations = {\n setAgentModelOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set agent model when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n if (!state.features.mastra.models.find((m) => m.id === action.input.modelId)) {\n throw new ModelReferenceNotFoundError(`Model not in library: ${action.input.modelId}`);\n }\n agent.modelId = action.input.modelId;\n },\n addAgentProfileRefOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add profile ref when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n if (!state.features.mastra.profiles.find((p) => p.id === action.input.profileId)) {\n throw new ProfileReferenceNotFoundError(`Profile not in library: ${action.input.profileId}`);\n }\n if (agent.profileIds.includes(action.input.profileId)) {\n return;\n }\n if (action.input.insertBefore) {\n const beforeIdx = agent.profileIds.indexOf(action.input.insertBefore);\n if (beforeIdx === -1) {\n throw new ProfileReferenceNotFoundError(`insertBefore profile not in agent's profileIds: ${action.input.insertBefore}`);\n }\n agent.profileIds.splice(beforeIdx, 0, action.input.profileId);\n } else {\n agent.profileIds.push(action.input.profileId);\n }\n },\n removeAgentProfileRefOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove profile ref when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n const idx = agent.profileIds.indexOf(action.input.profileId);\n if (idx === -1) {\n throw new ProfileReferenceNotFoundError(`Profile not in agent's profileIds: ${action.input.profileId}`);\n }\n agent.profileIds.splice(idx, 1);\n },\n reorderAgentProfileRefsOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot reorder profile refs when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n for (const id of action.input.ids) {\n if (!agent.profileIds.includes(id)) {\n throw new ProfileReferenceNotFoundError(`Profile not in agent's profileIds: ${id}`);\n }\n }\n const remaining = agent.profileIds.filter((id) => !action.input.ids.includes(id));\n if (action.input.insertBefore) {\n const beforeIdx = remaining.indexOf(action.input.insertBefore);\n if (beforeIdx === -1) {\n throw new ProfileReferenceNotFoundError(`insertBefore profile not in agent's profileIds: ${action.input.insertBefore}`);\n }\n remaining.splice(beforeIdx, 0, ...action.input.ids);\n } else {\n remaining.push(...action.input.ids);\n }\n agent.profileIds = remaining;\n },\n addAgentSkillOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add skill when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n const trimmed = action.input.name.trim();\n if (!/^[a-z][a-z0-9-]*$/.test(trimmed)) {\n throw new InvalidSkillNameError(`Invalid skill name: ${action.input.name}. Must be lowercase kebab-case.`);\n }\n if (!agent.skills.includes(trimmed)) {\n agent.skills.push(trimmed);\n }\n },\n removeAgentSkillOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove skill when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n const idx = agent.skills.indexOf(action.input.name);\n if (idx === -1) {\n throw new SkillNotFoundError(`Skill not on agent: ${action.input.name}`);\n }\n agent.skills.splice(idx, 1);\n },\n addAgentToolPatternOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add tool pattern when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n const trimmed = action.input.pattern.trim();\n if (!trimmed) {\n throw new InvalidToolPatternError('Tool pattern must not be empty after trimming.');\n }\n if (!agent.toolPatterns.includes(trimmed)) {\n agent.toolPatterns.push(trimmed);\n }\n },\n removeAgentToolPatternOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove tool pattern when Mastra is disabled.');\n }\n const agent = resolveAgent(state.features.mastra.mainAgent, state.features.mastra.subAgents, action.input.agentId);\n if (!agent) {\n throw new AgentNotFoundError(`Agent not found: ${action.input.agentId}`);\n }\n const idx = agent.toolPatterns.indexOf(action.input.pattern);\n if (idx === -1) {\n throw new ToolPatternNotFoundError(`Tool pattern not on agent: ${action.input.pattern}`);\n }\n agent.toolPatterns.splice(idx, 1);\n },\n};\n","export type ErrorCode = 'MastraNotEnabledError' | 'InvalidAgentNameError' | 'InvalidAgentImageError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class MastraNotEnabledError extends Error implements ReducerError {\n errorCode = 'MastraNotEnabledError' as ErrorCode;\n constructor(message = 'MastraNotEnabledError') {\n super(message);\n }\n}\n\nexport class InvalidAgentNameError extends Error implements ReducerError {\n errorCode = 'InvalidAgentNameError' as ErrorCode;\n constructor(message = 'InvalidAgentNameError') {\n super(message);\n }\n}\n\nexport class InvalidAgentImageError extends Error implements ReducerError {\n errorCode = 'InvalidAgentImageError' as ErrorCode;\n constructor(message = 'InvalidAgentImageError') {\n super(message);\n }\n}\n\nexport const errors = {\n SetMainAgentName: { MastraNotEnabledError, InvalidAgentNameError },\n SetMainAgentDescription: { MastraNotEnabledError },\n ClearMainAgentDescription: { MastraNotEnabledError },\n SetMainAgentImage: { MastraNotEnabledError, InvalidAgentImageError },\n ClearMainAgentImage: { MastraNotEnabledError },\n};\n","import type { PhClintProjectMastraMainAgentOperations } from 'document-models/ph-clint-project/v1';\nimport { InvalidAgentImageError, InvalidAgentNameError, MastraNotEnabledError } from '../../gen/mastra-main-agent/error.js';\n\nexport const phClintProjectMastraMainAgentOperations: PhClintProjectMastraMainAgentOperations = {\n setMainAgentNameOperation(state, action) {\n const main = state.features.mastra.mainAgent;\n if (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError('Cannot set main agent name when Mastra is disabled.');\n }\n const trimmed = action.input.name.trim();\n if (!trimmed) {\n throw new InvalidAgentNameError('Agent name must not be empty.');\n }\n main.name = trimmed;\n },\n setMainAgentDescriptionOperation(state, action) {\n const main = state.features.mastra.mainAgent;\n if (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError('Cannot set main agent description when Mastra is disabled.');\n }\n main.description = action.input.description;\n },\n clearMainAgentDescriptionOperation(state) {\n const main = state.features.mastra.mainAgent;\n if (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError('Cannot clear main agent description when Mastra is disabled.');\n }\n main.description = null;\n },\n setMainAgentImageOperation(state, action) {\n const main = state.features.mastra.mainAgent;\n if (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError('Cannot set main agent image when Mastra is disabled.');\n }\n if (!action.input.attachment.startsWith('attachment://')) {\n throw new InvalidAgentImageError('Agent image must be an attachment ref (attachment://...)');\n }\n main.attachment = action.input.attachment;\n },\n clearMainAgentImageOperation(state) {\n const main = state.features.mastra.mainAgent;\n if (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError('Cannot clear main agent image when Mastra is disabled.');\n }\n main.attachment = null;\n },\n};\n","export type ErrorCode = 'MastraNotEnabledError' | 'InvalidModelIdError' | 'DuplicateModelError' | 'ModelNotFoundError' | 'ModelInUseError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class MastraNotEnabledError extends Error implements ReducerError {\n errorCode = 'MastraNotEnabledError' as ErrorCode;\n constructor(message = 'MastraNotEnabledError') {\n super(message);\n }\n}\n\nexport class InvalidModelIdError extends Error implements ReducerError {\n errorCode = 'InvalidModelIdError' as ErrorCode;\n constructor(message = 'InvalidModelIdError') {\n super(message);\n }\n}\n\nexport class DuplicateModelError extends Error implements ReducerError {\n errorCode = 'DuplicateModelError' as ErrorCode;\n constructor(message = 'DuplicateModelError') {\n super(message);\n }\n}\n\nexport class ModelNotFoundError extends Error implements ReducerError {\n errorCode = 'ModelNotFoundError' as ErrorCode;\n constructor(message = 'ModelNotFoundError') {\n super(message);\n }\n}\n\nexport class ModelInUseError extends Error implements ReducerError {\n errorCode = 'ModelInUseError' as ErrorCode;\n constructor(message = 'ModelInUseError') {\n super(message);\n }\n}\n\nexport const errors = {\n AddModel: { MastraNotEnabledError, InvalidModelIdError, DuplicateModelError },\n RemoveModel: { MastraNotEnabledError, ModelNotFoundError, ModelInUseError },\n};\n","import type { PhClintProjectMastraModelsOperations } from 'document-models/ph-clint-project/v1';\nimport { DuplicateModelError, InvalidModelIdError, MastraNotEnabledError, ModelInUseError, ModelNotFoundError } from '../../gen/mastra-models/error.js';\n\nexport const phClintProjectMastraModelsOperations: PhClintProjectMastraModelsOperations = {\n addModelOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add model when Mastra is disabled.');\n }\n if (!/^[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 }\n if (state.features.mastra.models.find((m) => m.id === action.input.id)) {\n throw new DuplicateModelError(`Model already exists: ${action.input.id}`);\n }\n state.features.mastra.models.push({ id: action.input.id });\n },\n removeModelOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove model when Mastra is disabled.');\n }\n const idx = state.features.mastra.models.findIndex((m) => m.id === action.input.id);\n if (idx === -1) {\n throw new ModelNotFoundError(`Model not found: ${action.input.id}`);\n }\n const main = state.features.mastra.mainAgent;\n const usedByMain = !!main && main.modelId === action.input.id;\n const usedBySub = state.features.mastra.subAgents.some((s) => s.modelId === action.input.id);\n if (usedByMain || usedBySub) {\n throw new ModelInUseError(`Model ${action.input.id} is in use by an agent.`);\n }\n state.features.mastra.models.splice(idx, 1);\n },\n};\n","export type ErrorCode = 'MastraNotEnabledError' | 'InvalidProfileIdError' | 'DuplicateProfileError' | 'ProfileNotFoundError' | 'ProfileInUseError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class MastraNotEnabledError extends Error implements ReducerError {\n errorCode = 'MastraNotEnabledError' as ErrorCode;\n constructor(message = 'MastraNotEnabledError') {\n super(message);\n }\n}\n\nexport class InvalidProfileIdError extends Error implements ReducerError {\n errorCode = 'InvalidProfileIdError' as ErrorCode;\n constructor(message = 'InvalidProfileIdError') {\n super(message);\n }\n}\n\nexport class DuplicateProfileError extends Error implements ReducerError {\n errorCode = 'DuplicateProfileError' as ErrorCode;\n constructor(message = 'DuplicateProfileError') {\n super(message);\n }\n}\n\nexport class ProfileNotFoundError extends Error implements ReducerError {\n errorCode = 'ProfileNotFoundError' as ErrorCode;\n constructor(message = 'ProfileNotFoundError') {\n super(message);\n }\n}\n\nexport class ProfileInUseError extends Error implements ReducerError {\n errorCode = 'ProfileInUseError' as ErrorCode;\n constructor(message = 'ProfileInUseError') {\n super(message);\n }\n}\n\nexport const errors = {\n AddProfile: {\n MastraNotEnabledError,\n InvalidProfileIdError,\n DuplicateProfileError,\n ProfileNotFoundError,\n },\n UpdateProfile: { MastraNotEnabledError, ProfileNotFoundError },\n RemoveProfile: {\n MastraNotEnabledError,\n ProfileNotFoundError,\n ProfileInUseError,\n },\n ReorderProfiles: { MastraNotEnabledError, ProfileNotFoundError },\n};\n","import type { PhClintProjectMastraProfilesOperations } from 'document-models/ph-clint-project/v1';\nimport { DuplicateProfileError, InvalidProfileIdError, MastraNotEnabledError, ProfileInUseError, ProfileNotFoundError } from '../../gen/mastra-profiles/error.js';\n\nexport const phClintProjectMastraProfilesOperations: PhClintProjectMastraProfilesOperations = {\n addProfileOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot add profile when Mastra is disabled.');\n }\n if (!/^[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 }\n if (state.features.mastra.profiles.find((p) => p.id === action.input.id)) {\n throw new DuplicateProfileError(`Profile already exists: ${action.input.id}`);\n }\n const profile = {\n id: action.input.id,\n title: action.input.title,\n content: action.input.content,\n };\n if (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 }\n },\n updateProfileOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot update profile when Mastra is disabled.');\n }\n const profile = state.features.mastra.profiles.find((p) => p.id === action.input.id);\n if (!profile) {\n throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);\n }\n if (action.input.title) profile.title = action.input.title;\n if (action.input.content) profile.content = action.input.content;\n },\n removeProfileOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove profile when Mastra is disabled.');\n }\n const idx = state.features.mastra.profiles.findIndex((p) => p.id === action.input.id);\n if (idx === -1) {\n throw new ProfileNotFoundError(`Profile not found: ${action.input.id}`);\n }\n const main = state.features.mastra.mainAgent;\n const usedByMain = !!main && main.profileIds.includes(action.input.id);\n const usedBySub = state.features.mastra.subAgents.some((s) => s.profileIds.includes(action.input.id));\n if (usedByMain || usedBySub) {\n throw new ProfileInUseError(`Profile ${action.input.id} is in use by an agent.`);\n }\n state.features.mastra.profiles.splice(idx, 1);\n },\n reorderProfilesOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot reorder profiles when Mastra is disabled.');\n }\n const moving = [];\n for (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 state.features.mastra.profiles = state.features.mastra.profiles.filter((p) => !action.input.ids.includes(p.id));\n if (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 }\n },\n};\n","export type ErrorCode = 'MastraNotEnabledError' | 'InvalidAgentIdError' | 'InvalidAgentNameError' | 'DuplicateAgentIdError' | 'ModelReferenceNotFoundError' | 'AgentNotFoundError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class MastraNotEnabledError extends Error implements ReducerError {\n errorCode = 'MastraNotEnabledError' as ErrorCode;\n constructor(message = 'MastraNotEnabledError') {\n super(message);\n }\n}\n\nexport class InvalidAgentIdError extends Error implements ReducerError {\n errorCode = 'InvalidAgentIdError' as ErrorCode;\n constructor(message = 'InvalidAgentIdError') {\n super(message);\n }\n}\n\nexport class InvalidAgentNameError extends Error implements ReducerError {\n errorCode = 'InvalidAgentNameError' as ErrorCode;\n constructor(message = 'InvalidAgentNameError') {\n super(message);\n }\n}\n\nexport class DuplicateAgentIdError extends Error implements ReducerError {\n errorCode = 'DuplicateAgentIdError' as ErrorCode;\n constructor(message = 'DuplicateAgentIdError') {\n super(message);\n }\n}\n\nexport class ModelReferenceNotFoundError extends Error implements ReducerError {\n errorCode = 'ModelReferenceNotFoundError' as ErrorCode;\n constructor(message = 'ModelReferenceNotFoundError') {\n super(message);\n }\n}\n\nexport class AgentNotFoundError extends Error implements ReducerError {\n errorCode = 'AgentNotFoundError' as ErrorCode;\n constructor(message = 'AgentNotFoundError') {\n super(message);\n }\n}\n\nexport const errors = {\n AddSubAgent: {\n MastraNotEnabledError,\n InvalidAgentIdError,\n InvalidAgentNameError,\n DuplicateAgentIdError,\n ModelReferenceNotFoundError,\n },\n RemoveSubAgent: { MastraNotEnabledError, AgentNotFoundError },\n SetSubAgentName: {\n MastraNotEnabledError,\n AgentNotFoundError,\n InvalidAgentNameError,\n },\n SetSubAgentDescription: { MastraNotEnabledError, AgentNotFoundError },\n};\n","import type { PhClintProjectMastraSubAgentsOperations } from 'document-models/ph-clint-project/v1';\nimport { AgentNotFoundError, DuplicateAgentIdError, InvalidAgentIdError, InvalidAgentNameError, MastraNotEnabledError, ModelReferenceNotFoundError } from '../../gen/mastra-sub-agents/error.js';\n\nexport const phClintProjectMastraSubAgentsOperations: PhClintProjectMastraSubAgentsOperations = {\n addSubAgentOperation(state, action) {\n const main = state.features.mastra.mainAgent;\n if (!state.features.mastra.enabled || !main) {\n throw new MastraNotEnabledError('Cannot add sub-agent when Mastra is disabled.');\n }\n if (!/^[a-z][a-z0-9-]*$/.test(action.input.id)) {\n throw new InvalidAgentIdError(`Invalid sub-agent ID: ${action.input.id}. Must be lowercase kebab-case.`);\n }\n const trimmedName = action.input.name.trim();\n if (!trimmedName) {\n throw new InvalidAgentNameError('Sub-agent name must not be empty.');\n }\n if (main.id === action.input.id) {\n throw new DuplicateAgentIdError(`Agent ID already taken by main agent: ${action.input.id}`);\n }\n if (state.features.mastra.subAgents.find((s) => s.id === action.input.id)) {\n throw new DuplicateAgentIdError(`Sub-agent already exists: ${action.input.id}`);\n }\n if (!state.features.mastra.models.find((m) => m.id === action.input.modelId)) {\n throw new ModelReferenceNotFoundError(`Model not in library: ${action.input.modelId}`);\n }\n state.features.mastra.subAgents.push({\n id: action.input.id,\n name: trimmedName,\n description: action.input.description,\n modelId: action.input.modelId,\n profileIds: [],\n skills: [],\n toolPatterns: [],\n });\n },\n removeSubAgentOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot remove sub-agent when Mastra is disabled.');\n }\n const idx = state.features.mastra.subAgents.findIndex((s) => s.id === action.input.id);\n if (idx === -1) {\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\n }\n state.features.mastra.subAgents.splice(idx, 1);\n },\n setSubAgentNameOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set sub-agent name when Mastra is disabled.');\n }\n const sub = state.features.mastra.subAgents.find((s) => s.id === action.input.id);\n if (!sub) {\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\n }\n const trimmed = action.input.name.trim();\n if (!trimmed) {\n throw new InvalidAgentNameError('Sub-agent name must not be empty.');\n }\n sub.name = trimmed;\n },\n setSubAgentDescriptionOperation(state, action) {\n if (!state.features.mastra.enabled) {\n throw new MastraNotEnabledError('Cannot set sub-agent description when Mastra is disabled.');\n }\n const sub = state.features.mastra.subAgents.find((s) => s.id === action.input.id);\n if (!sub) {\n throw new AgentNotFoundError(`Sub-agent not found: ${action.input.id}`);\n }\n sub.description = action.input.description;\n },\n};\n","export type ErrorCode =\n | 'DuplicatePackageError'\n | 'PackageNotFoundError'\n | 'CannotRemoveAppPackageError'\n | 'CannotRemoveManagedPackageError'\n | 'InvalidDocumentTypeError'\n | 'DuplicateDocumentTypeError'\n | 'DocumentTypeNotFoundError'\n | 'InvalidVersionError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class DuplicatePackageError extends Error implements ReducerError {\n errorCode = 'DuplicatePackageError' as ErrorCode;\n constructor(message = 'DuplicatePackageError') {\n super(message);\n }\n}\n\nexport class PackageNotFoundError extends Error implements ReducerError {\n errorCode = 'PackageNotFoundError' as ErrorCode;\n constructor(message = 'PackageNotFoundError') {\n super(message);\n }\n}\n\nexport class CannotRemoveAppPackageError extends Error implements ReducerError {\n errorCode = 'CannotRemoveAppPackageError' as ErrorCode;\n constructor(message = 'CannotRemoveAppPackageError') {\n super(message);\n }\n}\n\nexport class CannotRemoveManagedPackageError extends Error implements ReducerError {\n errorCode = 'CannotRemoveManagedPackageError' as ErrorCode;\n constructor(message = 'CannotRemoveManagedPackageError') {\n super(message);\n }\n}\n\nexport class InvalidDocumentTypeError extends Error implements ReducerError {\n errorCode = 'InvalidDocumentTypeError' as ErrorCode;\n constructor(message = 'InvalidDocumentTypeError') {\n super(message);\n }\n}\n\nexport class DuplicateDocumentTypeError extends Error implements ReducerError {\n errorCode = 'DuplicateDocumentTypeError' as ErrorCode;\n constructor(message = 'DuplicateDocumentTypeError') {\n super(message);\n }\n}\n\nexport class DocumentTypeNotFoundError extends Error implements ReducerError {\n errorCode = 'DocumentTypeNotFoundError' as ErrorCode;\n constructor(message = 'DocumentTypeNotFoundError') {\n super(message);\n }\n}\n\nexport class InvalidVersionError extends Error implements ReducerError {\n errorCode = 'InvalidVersionError' as ErrorCode;\n constructor(message = 'InvalidVersionError') {\n super(message);\n }\n}\n\nexport const errors = {\n AddPowerhousePackage: { DuplicatePackageError },\n RemovePowerhousePackage: {\n PackageNotFoundError,\n CannotRemoveAppPackageError,\n CannotRemoveManagedPackageError,\n },\n AddPackageDocumentType: {\n InvalidDocumentTypeError,\n PackageNotFoundError,\n DuplicateDocumentTypeError,\n },\n RemovePackageDocumentType: {\n PackageNotFoundError,\n DocumentTypeNotFoundError,\n },\n SetPackageVersion: { PackageNotFoundError, InvalidVersionError },\n};\n","import type { PhClintProjectPowerhousePackagesOperations } from 'document-models/ph-clint-project/v1';\nimport { CannotRemoveManagedPackageError, DocumentTypeNotFoundError, DuplicateDocumentTypeError, DuplicatePackageError, InvalidDocumentTypeError, InvalidVersionError, PackageNotFoundError } from '../../gen/powerhouse-packages/error.js';\n\nconst SEMVER = /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\n\nexport const phClintProjectPowerhousePackagesOperations: PhClintProjectPowerhousePackagesOperations = {\n addPowerhousePackageOperation(state, action) {\n const exists = state.packages.find((p) => p.id === action.input.id || p.packageName === action.input.packageName);\n if (exists) {\n throw new DuplicatePackageError(`Package already exists: ${action.input.packageName}`);\n }\n state.packages.push({\n id: action.input.id,\n packageName: action.input.packageName,\n documentTypes: [],\n version: null,\n managed: false,\n });\n },\n removePowerhousePackageOperation(state, action) {\n const idx = state.packages.findIndex((p) => p.id === action.input.id);\n if (idx === -1) {\n throw new PackageNotFoundError(`Package not found: ${action.input.id}`);\n }\n const pkg = state.packages[idx];\n if (pkg.managed) {\n throw new CannotRemoveManagedPackageError('Cannot remove a managed package');\n }\n state.packages.splice(idx, 1);\n },\n addPackageDocumentTypeOperation(state, action) {\n if (action.input.documentType !== '*/*' && !/^[a-z0-9-]+\\/[a-z0-9-]+$/.test(action.input.documentType)) {\n throw new InvalidDocumentTypeError(`Invalid document type format: ${action.input.documentType}. Expected org/name.`);\n }\n const pkg = state.packages.find((p) => p.id === action.input.packageId);\n if (!pkg) {\n throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);\n }\n if (action.input.documentType === '*/*') {\n pkg.documentTypes.length = 0;\n pkg.documentTypes.push('*/*');\n return;\n }\n if (pkg.documentTypes.includes('*/*')) {\n return;\n }\n if (pkg.documentTypes.includes(action.input.documentType)) {\n throw new DuplicateDocumentTypeError(`Document type already registered: ${action.input.documentType}`);\n }\n pkg.documentTypes.push(action.input.documentType);\n },\n removePackageDocumentTypeOperation(state, action) {\n const pkg = state.packages.find((p) => p.id === action.input.packageId);\n if (!pkg) {\n throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);\n }\n const idx = pkg.documentTypes.indexOf(action.input.documentType);\n if (idx === -1) {\n throw new DocumentTypeNotFoundError(`Document type not found: ${action.input.documentType}`);\n }\n pkg.documentTypes.splice(idx, 1);\n },\n setPackageVersionOperation(state, action) {\n const pkg = state.packages.find((p) => p.id === action.input.packageId);\n if (!pkg) {\n throw new PackageNotFoundError(`Package not found: ${action.input.packageId}`);\n }\n if (action.input.version != null) {\n if (!SEMVER.test(action.input.version)) {\n throw new InvalidVersionError(`Invalid version: ${action.input.version}`);\n }\n }\n pkg.version = action.input.version || null;\n },\n};\n","export type ErrorCode = 'InvalidVersionError' | 'PublishRecordNotFoundError';\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidVersionError extends Error implements ReducerError {\n errorCode = 'InvalidVersionError' as ErrorCode;\n constructor(message = 'InvalidVersionError') {\n super(message);\n }\n}\n\nexport class PublishRecordNotFoundError extends Error implements ReducerError {\n errorCode = 'PublishRecordNotFoundError' as ErrorCode;\n constructor(message = 'PublishRecordNotFoundError') {\n super(message);\n }\n}\n\nexport const errors = {\n BumpVersion: { InvalidVersionError },\n SetPublishStatus: { PublishRecordNotFoundError },\n};\n","import type { PhClintProjectPublishingOperations } from 'document-models/ph-clint-project/v1';\nimport { InvalidVersionError, PublishRecordNotFoundError } from '../../gen/publishing/error.js';\n\nexport const phClintProjectPublishingOperations: PhClintProjectPublishingOperations = {\n bumpVersionOperation(state, action) {\n 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 }\n state.version = action.input.version;\n },\n publishDevOperation(state, action) {\n state.publishHistory.push({\n id: action.input.id,\n tag: 'Dev',\n version: state.version,\n timestamp: action.input.timestamp,\n status: 'Pending',\n });\n },\n publishStagingOperation(state, action) {\n state.publishHistory.push({\n id: action.input.id,\n tag: 'Staging',\n version: state.version,\n timestamp: action.input.timestamp,\n status: 'Pending',\n });\n },\n publishProductionOperation(state, action) {\n state.publishHistory.push({\n id: action.input.id,\n tag: 'Production',\n version: state.version,\n timestamp: action.input.timestamp,\n status: 'Pending',\n });\n },\n setPublishStatusOperation(state, action) {\n const record = state.publishHistory.find((r) => r.id === action.input.id);\n if (!record) {\n throw new PublishRecordNotFoundError(`Publish record not found: ${action.input.id}`);\n }\n record.status = action.input.status;\n },\n};\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from 'document-model';\nimport { createReducer, isDocumentAction } from 'document-model';\nimport type { PhClintProjectPHState } from 'document-models/ph-clint-project/v1';\n\nimport { phClintProjectDeploymentOperations } from '../src/reducers/deployment.js';\nimport { phClintProjectExternalSkillsOperations } from '../src/reducers/external-skills.js';\nimport { phClintProjectFeaturesMastraOperations } from '../src/reducers/features-mastra.js';\nimport { phClintProjectFeaturesPowerhouseOperations } from '../src/reducers/features-powerhouse.js';\nimport { phClintProjectFeaturesRoutineOperations } from '../src/reducers/features-routine.js';\nimport { phClintProjectIdentityOperations } from '../src/reducers/identity.js';\nimport { phClintProjectLifecycleOperations } from '../src/reducers/lifecycle.js';\nimport { phClintProjectMastraAgentBindingsOperations } from '../src/reducers/mastra-agent-bindings.js';\nimport { phClintProjectMastraMainAgentOperations } from '../src/reducers/mastra-main-agent.js';\nimport { phClintProjectMastraModelsOperations } from '../src/reducers/mastra-models.js';\nimport { phClintProjectMastraProfilesOperations } from '../src/reducers/mastra-profiles.js';\nimport { phClintProjectMastraSubAgentsOperations } from '../src/reducers/mastra-sub-agents.js';\nimport { phClintProjectPowerhousePackagesOperations } from '../src/reducers/powerhouse-packages.js';\nimport { phClintProjectPublishingOperations } from '../src/reducers/publishing.js';\n\nimport {\n AddAgentProfileRefInputSchema,\n AddAgentSkillInputSchema,\n AddAgentToolPatternInputSchema,\n AddExternalSkillInputSchema,\n AddModelInputSchema,\n AddPackageDocumentTypeInputSchema,\n AddPowerhousePackageInputSchema,\n AddProfileInputSchema,\n AddSubAgentInputSchema,\n AddSupportedResourceInputSchema,\n BumpVersionInputSchema,\n ClearMainAgentDescriptionInputSchema,\n ClearMainAgentImageInputSchema,\n DisableMastraInputSchema,\n DisableRoutineInputSchema,\n EnableMastraInputSchema,\n EnableRoutineInputSchema,\n ImportSpecInputSchema,\n PublishDevInputSchema,\n PublishProductionInputSchema,\n PublishStagingInputSchema,\n RemoveAgentProfileRefInputSchema,\n RemoveAgentSkillInputSchema,\n RemoveAgentToolPatternInputSchema,\n RemoveExternalSkillInputSchema,\n RemoveModelInputSchema,\n RemovePackageDocumentTypeInputSchema,\n RemovePowerhousePackageInputSchema,\n RemoveProfileInputSchema,\n RemoveSubAgentInputSchema,\n RemoveSupportedResourceInputSchema,\n ReorderAgentProfileRefsInputSchema,\n ReorderProfilesInputSchema,\n SetAgentModelInputSchema,\n SetDescriptionInputSchema,\n SetEnableChatInputSchema,\n SetExternalSkillGithubUrlInputSchema,\n SetExternalSkillNameInputSchema,\n SetMainAgentDescriptionInputSchema,\n SetMainAgentImageInputSchema,\n SetMainAgentNameInputSchema,\n SetObservabilityEnabledInputSchema,\n SetPackageIdentifierInputSchema,\n SetPackageVersionInputSchema,\n SetPowerhouseLevelInputSchema,\n SetProxyEnabledInputSchema,\n SetPublishStatusInputSchema,\n SetSubAgentDescriptionInputSchema,\n SetSubAgentNameInputSchema,\n SetVersionInputSchema,\n UpdateProfileInputSchema,\n} from './schema/zod.js';\n\nconst stateReducer: StateReducer<PhClintProjectPHState> = (state, action, dispatch) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case 'SET_DESCRIPTION': {\n SetDescriptionInputSchema().parse(action.input);\n\n phClintProjectIdentityOperations.setDescriptionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_VERSION': {\n SetVersionInputSchema().parse(action.input);\n\n phClintProjectIdentityOperations.setVersionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_PACKAGE_IDENTIFIER': {\n SetPackageIdentifierInputSchema().parse(action.input);\n\n phClintProjectIdentityOperations.setPackageIdentifierOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_POWERHOUSE_LEVEL': {\n SetPowerhouseLevelInputSchema().parse(action.input);\n\n phClintProjectFeaturesPowerhouseOperations.setPowerhouseLevelOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ENABLE_ROUTINE': {\n EnableRoutineInputSchema().parse(action.input);\n\n phClintProjectFeaturesRoutineOperations.enableRoutineOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'DISABLE_ROUTINE': {\n DisableRoutineInputSchema().parse(action.input);\n\n phClintProjectFeaturesRoutineOperations.disableRoutineOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_POWERHOUSE_PACKAGE': {\n AddPowerhousePackageInputSchema().parse(action.input);\n\n phClintProjectPowerhousePackagesOperations.addPowerhousePackageOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_POWERHOUSE_PACKAGE': {\n RemovePowerhousePackageInputSchema().parse(action.input);\n\n phClintProjectPowerhousePackagesOperations.removePowerhousePackageOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_PACKAGE_DOCUMENT_TYPE': {\n AddPackageDocumentTypeInputSchema().parse(action.input);\n\n phClintProjectPowerhousePackagesOperations.addPackageDocumentTypeOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_PACKAGE_DOCUMENT_TYPE': {\n RemovePackageDocumentTypeInputSchema().parse(action.input);\n\n phClintProjectPowerhousePackagesOperations.removePackageDocumentTypeOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_PACKAGE_VERSION': {\n SetPackageVersionInputSchema().parse(action.input);\n\n phClintProjectPowerhousePackagesOperations.setPackageVersionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_EXTERNAL_SKILL': {\n AddExternalSkillInputSchema().parse(action.input);\n\n phClintProjectExternalSkillsOperations.addExternalSkillOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_EXTERNAL_SKILL': {\n RemoveExternalSkillInputSchema().parse(action.input);\n\n phClintProjectExternalSkillsOperations.removeExternalSkillOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_EXTERNAL_SKILL_NAME': {\n SetExternalSkillNameInputSchema().parse(action.input);\n\n phClintProjectExternalSkillsOperations.setExternalSkillNameOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_EXTERNAL_SKILL_GITHUB_URL': {\n SetExternalSkillGithubUrlInputSchema().parse(action.input);\n\n phClintProjectExternalSkillsOperations.setExternalSkillGithubUrlOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'BUMP_VERSION': {\n BumpVersionInputSchema().parse(action.input);\n\n phClintProjectPublishingOperations.bumpVersionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'PUBLISH_DEV': {\n PublishDevInputSchema().parse(action.input);\n\n phClintProjectPublishingOperations.publishDevOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'PUBLISH_STAGING': {\n PublishStagingInputSchema().parse(action.input);\n\n phClintProjectPublishingOperations.publishStagingOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'PUBLISH_PRODUCTION': {\n PublishProductionInputSchema().parse(action.input);\n\n phClintProjectPublishingOperations.publishProductionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_PUBLISH_STATUS': {\n SetPublishStatusInputSchema().parse(action.input);\n\n phClintProjectPublishingOperations.setPublishStatusOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'IMPORT_SPEC': {\n ImportSpecInputSchema().parse(action.input);\n\n phClintProjectLifecycleOperations.importSpecOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_SUPPORTED_RESOURCE': {\n AddSupportedResourceInputSchema().parse(action.input);\n\n phClintProjectDeploymentOperations.addSupportedResourceOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_SUPPORTED_RESOURCE': {\n RemoveSupportedResourceInputSchema().parse(action.input);\n\n phClintProjectDeploymentOperations.removeSupportedResourceOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_PROXY_ENABLED': {\n SetProxyEnabledInputSchema().parse(action.input);\n\n phClintProjectDeploymentOperations.setProxyEnabledOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_OBSERVABILITY_ENABLED': {\n SetObservabilityEnabledInputSchema().parse(action.input);\n\n phClintProjectDeploymentOperations.setObservabilityEnabledOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ENABLE_MASTRA': {\n EnableMastraInputSchema().parse(action.input);\n\n phClintProjectFeaturesMastraOperations.enableMastraOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'DISABLE_MASTRA': {\n DisableMastraInputSchema().parse(action.input);\n\n phClintProjectFeaturesMastraOperations.disableMastraOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_ENABLE_CHAT': {\n SetEnableChatInputSchema().parse(action.input);\n\n phClintProjectFeaturesMastraOperations.setEnableChatOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_MODEL': {\n AddModelInputSchema().parse(action.input);\n\n phClintProjectMastraModelsOperations.addModelOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_MODEL': {\n RemoveModelInputSchema().parse(action.input);\n\n phClintProjectMastraModelsOperations.removeModelOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_PROFILE': {\n AddProfileInputSchema().parse(action.input);\n\n phClintProjectMastraProfilesOperations.addProfileOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'UPDATE_PROFILE': {\n UpdateProfileInputSchema().parse(action.input);\n\n phClintProjectMastraProfilesOperations.updateProfileOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_PROFILE': {\n RemoveProfileInputSchema().parse(action.input);\n\n phClintProjectMastraProfilesOperations.removeProfileOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REORDER_PROFILES': {\n ReorderProfilesInputSchema().parse(action.input);\n\n phClintProjectMastraProfilesOperations.reorderProfilesOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_MAIN_AGENT_NAME': {\n SetMainAgentNameInputSchema().parse(action.input);\n\n phClintProjectMastraMainAgentOperations.setMainAgentNameOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_MAIN_AGENT_DESCRIPTION': {\n SetMainAgentDescriptionInputSchema().parse(action.input);\n\n phClintProjectMastraMainAgentOperations.setMainAgentDescriptionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'CLEAR_MAIN_AGENT_DESCRIPTION': {\n ClearMainAgentDescriptionInputSchema().parse(action.input);\n\n phClintProjectMastraMainAgentOperations.clearMainAgentDescriptionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_MAIN_AGENT_IMAGE': {\n SetMainAgentImageInputSchema().parse(action.input);\n\n phClintProjectMastraMainAgentOperations.setMainAgentImageOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'CLEAR_MAIN_AGENT_IMAGE': {\n ClearMainAgentImageInputSchema().parse(action.input);\n\n phClintProjectMastraMainAgentOperations.clearMainAgentImageOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_SUB_AGENT': {\n AddSubAgentInputSchema().parse(action.input);\n\n phClintProjectMastraSubAgentsOperations.addSubAgentOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_SUB_AGENT': {\n RemoveSubAgentInputSchema().parse(action.input);\n\n phClintProjectMastraSubAgentsOperations.removeSubAgentOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_SUB_AGENT_NAME': {\n SetSubAgentNameInputSchema().parse(action.input);\n\n phClintProjectMastraSubAgentsOperations.setSubAgentNameOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_SUB_AGENT_DESCRIPTION': {\n SetSubAgentDescriptionInputSchema().parse(action.input);\n\n phClintProjectMastraSubAgentsOperations.setSubAgentDescriptionOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'SET_AGENT_MODEL': {\n SetAgentModelInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.setAgentModelOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_AGENT_PROFILE_REF': {\n AddAgentProfileRefInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.addAgentProfileRefOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_AGENT_PROFILE_REF': {\n RemoveAgentProfileRefInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.removeAgentProfileRefOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REORDER_AGENT_PROFILE_REFS': {\n ReorderAgentProfileRefsInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.reorderAgentProfileRefsOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_AGENT_SKILL': {\n AddAgentSkillInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.addAgentSkillOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_AGENT_SKILL': {\n RemoveAgentSkillInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.removeAgentSkillOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'ADD_AGENT_TOOL_PATTERN': {\n AddAgentToolPatternInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.addAgentToolPatternOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n case 'REMOVE_AGENT_TOOL_PATTERN': {\n RemoveAgentToolPatternInputSchema().parse(action.input);\n\n phClintProjectMastraAgentBindingsOperations.removeAgentToolPatternOperation((state as any)[action.scope], action as any, dispatch);\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<PhClintProjectPHState> = createReducer(stateReducer);\n","export const supportedVersions = [1] as const;\n\nexport const latestVersion = supportedVersions[0];\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { UpgradeManifest } from 'document-model';\nimport { latestVersion, supportedVersions } from './versions.js';\n\nexport const phClintProjectUpgradeManifest: UpgradeManifest<typeof supportedVersions> = {\n documentType: 'powerhouse/ph-clint-project',\n latestVersion,\n supportedVersions,\n upgrades: {},\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils, PHBaseState, Reducer } from 'document-model';\nimport { baseCreateDocument, baseLoadFromInputVersioned, baseSaveToFileHandle, defaultBaseState } from 'document-model';\nimport { phClintProjectUpgradeManifest } from '../../upgrades/upgrade-manifest.js';\nimport { assertIsPhClintProjectDocument, assertIsPhClintProjectState, isPhClintProjectDocument, isPhClintProjectState } from './document-schema.js';\nimport { phClintProjectDocumentType } from './document-type.js';\nimport { reducer } from './reducer.js';\nimport type { PhClintProjectGlobalState, PhClintProjectLocalState, PhClintProjectPHState } from './types.js';\n\nexport const initialGlobalState: PhClintProjectGlobalState = {\n name: null,\n scope: null,\n version: '0.1.0',\n description: '',\n features: {\n powerhouse: 'Disabled',\n mastra: {\n enabled: false,\n mainAgent: null,\n subAgents: [],\n models: [],\n profiles: [],\n common: { enableChat: false },\n },\n routine: { enabled: false },\n },\n packages: [],\n externalSkills: [],\n publishHistory: [],\n deployment: {\n proxyEnabled: false,\n observabilityEnabled: false,\n supportedResources: ['vetra-agent-s', 'vetra-agent-m', 'vetra-agent-l', 'vetra-agent-xl', 'vetra-agent-xxl'],\n },\n};\nexport const initialLocalState: PhClintProjectLocalState = {};\n\nexport const utils: DocumentModelUtils<PhClintProjectPHState> = {\n fileExtension: 'pcp',\n createState(state) {\n return {\n ...defaultBaseState(),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(utils.createState, state, phClintProjectDocumentType);\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInputVersioned(input, {\n reducers: { 1: reducer as unknown as Reducer<PHBaseState> },\n upgradeManifest: phClintProjectUpgradeManifest,\n });\n },\n isStateOfType(state) {\n return isPhClintProjectState(state);\n },\n assertIsStateOfType(state) {\n return assertIsPhClintProjectState(state);\n },\n isDocumentOfType(document) {\n return isPhClintProjectDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsPhClintProjectDocument(document);\n },\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from 'document-model';\nimport type { PhClintProjectPHState } from './gen/types.js';\nimport { utils as genUtils } from './gen/utils.js';\nimport * as customUtils from './src/utils.js';\n\n/** Utils for the PhClintProject document model */\nexport const utils: DocumentModelUtils<PhClintProjectPHState> = {\n ...genUtils,\n ...customUtils,\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelModule } from 'document-model';\nimport { createState, defaultBaseState } from 'document-model';\nimport { actions } from './actions.js';\nimport { documentModel } from './gen/document-model.js';\nimport { reducer } from './gen/reducer.js';\nimport type { PhClintProjectPHState } from './gen/types.js';\nimport { utils } from './utils.js';\n\n/** Document model module for the PhClintProject document type */\nexport const PhClintProject = {\n version: 1,\n reducer,\n actions,\n utils,\n documentModel: createState(defaultBaseState(), documentModel),\n} as const satisfies DocumentModelModule<PhClintProjectPHState>;\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { PHDocumentController } from 'document-model';\nimport { PhClintProject } from '../module.js';\nimport type { PhClintProjectAction, PhClintProjectPHState } from './types.js';\n\nexport const PhClintProjectController = PHDocumentController.forDocumentModel<PhClintProjectPHState, PhClintProjectAction>(PhClintProject);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n * Factory methods for creating PhClintProjectDocument instances\n */\nimport type { PHAuthState, PHBaseState, PHDocumentState } from 'document-model';\nimport { createBaseState, defaultBaseState } from 'document-model';\nimport type { PhClintProjectDocument, PhClintProjectGlobalState, PhClintProjectLocalState, PhClintProjectPHState } from './types.js';\nimport { utils } from './utils.js';\n\nexport function defaultGlobalState(): PhClintProjectGlobalState {\n return {\n name: null,\n scope: null,\n version: '0.1.0',\n description: '',\n features: {\n powerhouse: 'Disabled',\n mastra: {\n enabled: false,\n mainAgent: null,\n subAgents: [],\n models: [],\n profiles: [],\n common: { enableChat: false },\n },\n routine: { enabled: false },\n },\n packages: [],\n externalSkills: [],\n publishHistory: [],\n deployment: {\n proxyEnabled: false,\n observabilityEnabled: false,\n supportedResources: ['vetra-agent-s', 'vetra-agent-m', 'vetra-agent-l', 'vetra-agent-xl', 'vetra-agent-xxl'],\n },\n };\n}\n\nexport function defaultLocalState(): PhClintProjectLocalState {\n return {};\n}\n\nexport function defaultPHState(): PhClintProjectPHState {\n return {\n ...defaultBaseState(),\n global: defaultGlobalState(),\n local: defaultLocalState(),\n };\n}\n\nexport function createGlobalState(state?: Partial<PhClintProjectGlobalState>): PhClintProjectGlobalState {\n return {\n ...defaultGlobalState(),\n ...(state || {}),\n };\n}\n\nexport function createLocalState(state?: Partial<PhClintProjectLocalState>): PhClintProjectLocalState {\n return {\n ...defaultLocalState(),\n ...(state || {}),\n } as PhClintProjectLocalState;\n}\n\nexport function createState(baseState?: Partial<PHBaseState>, globalState?: Partial<PhClintProjectGlobalState>, localState?: Partial<PhClintProjectLocalState>): PhClintProjectPHState {\n return {\n ...createBaseState(baseState?.auth, baseState?.document),\n global: createGlobalState(globalState),\n local: createLocalState(localState),\n };\n}\n\n/**\n * Creates a PhClintProjectDocument with custom global and local state\n * This properly handles the PHBaseState requirements while allowing\n * document-specific state to be set.\n */\nexport function createPhClintProjectDocument(\n state?: Partial<{\n auth?: Partial<PHAuthState>;\n document?: Partial<PHDocumentState>;\n global?: Partial<PhClintProjectGlobalState>;\n local?: Partial<PhClintProjectLocalState>;\n }>,\n): PhClintProjectDocument {\n const document = utils.createDocument(state ? createState(createBaseState(state.auth, state.document), state.global, state.local) : undefined);\n\n return document;\n}\n","import { PhClintProject as PhClintProjectV1 } from 'document-models/ph-clint-project/v1';\n\n/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\n\nexport const documentModels = [PhClintProjectV1] as const;\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { UpgradeManifest } from 'document-model';\nimport { phClintProjectUpgradeManifest } from 'document-models/ph-clint-project/upgrades';\n\nexport const upgradeManifests: UpgradeManifest<readonly number[]>[] = [phClintProjectUpgradeManifest];\n","import type { EditorModule } from 'document-model';\nimport { PhClintProjectEditor } from './ph-clint-project-editor/module.js';\n\nexport const editors: EditorModule[] = [PhClintProjectEditor];\n","import type { EditorModule } from 'document-model';\nimport { lazy } from 'react';\n\n/** Document editor module for the \"[\"powerhouse/ph-clint-project\"]\" document type */\nexport const PhClintProjectEditor: EditorModule = {\n Component: lazy(() => import('./editor.js')),\n documentTypes: ['powerhouse/ph-clint-project'],\n config: {\n id: 'ph-clint-project-editor',\n name: 'PhClintProjectEditor',\n },\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { IProcessorHostModule, ProcessorRecord } from '@powerhousedao/reactor-browser';\nimport type { PHDocumentHeader } from 'document-model';\n\nexport const processorFactory = async (module: IProcessorHostModule) => {\n const { processorFactoryBuilders } = module.processorApp === 'connect' ? await import('./connect.js') : await import('./switchboard.js');\n\n const factories = await Promise.all(processorFactoryBuilders.map(async (buildFactory) => await buildFactory(module)));\n\n // Return the inner function that will be called for each drive\n return async (driveHeader: PHDocumentHeader): Promise<ProcessorRecord[]> => {\n const processors: ProcessorRecord[] = [];\n\n // Call each cached factory with the driveHeader\n for (const factory of factories) {\n const factoryProcessors = await factory(driveHeader, module.processorApp);\n processors.push(...factoryProcessors);\n }\n\n return processors;\n };\n};\n","import type { Manifest } from 'document-model';\nimport manifestJson from './powerhouse.manifest.json' with { type: 'json' };\nexport { documentModels } from './document-models/document-models.js';\nexport { upgradeManifests } from './document-models/upgrade-manifests.js';\nexport { editors } from './editors/editors.js';\nexport { processorFactory } from './processors/factory.js';\nexport const manifest: Manifest = manifestJson;\n\n// Top-level re-exports of registered document models — consumed by\n// `src/framework.gen.ts` in the CLI side, so impl code never has to\n// reach into `document-models/<slug>/v1/module.js` directly.\nexport { PhClintProject } from './document-models/ph-clint-project/v1/module.js';\nexport * from './document-models/ph-clint-project/index.js';\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { startConnect, type ImportHmr } from '@powerhousedao/connect';\nimport * as localPackage from './index.js';\n\nconst { updateLocalPackage } = startConnect(localPackage);\n\n(import.meta as ImportHmr).hot?.accept(['./index.js'], ([newModule]) => {\n if (newModule) {\n updateLocalPackage(newModule);\n }\n});\n"],"file":"index-Bgr9U9X9.js"}
|