@codemation/host 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/LICENSE +37 -1
  3. package/dist/{ApiPaths-Dv1dcHu_.js → ApiPaths-DCvrlIjg.js} +12 -1
  4. package/dist/{ApiPaths-Dv1dcHu_.js.map → ApiPaths-DCvrlIjg.js.map} +1 -1
  5. package/dist/{AppConfigFactory-Cx4qQvRk.js → AppConfigFactory-D4LL1aOR.js} +77 -297
  6. package/dist/AppConfigFactory-D4LL1aOR.js.map +1 -0
  7. package/dist/{AppConfigFactory-DnLoQ9Li.d.ts → AppConfigFactory-DncmwCD1.d.ts} +2918 -199
  8. package/dist/{AppContainerFactory-DqKYCRNP.js → AppContainerFactory-jpYXGZGe.js} +1733 -475
  9. package/dist/AppContainerFactory-jpYXGZGe.js.map +1 -0
  10. package/dist/{CodemationAppContext-CKVv9W9q.d.ts → CodemationAppContext-K51b7oXe.d.ts} +9 -3
  11. package/dist/{CodemationAuthoring.types-DA3G3s6d.d.ts → CodemationAuthoring.types-BXlXIl4K.d.ts} +9 -4
  12. package/dist/{CodemationAuthoring.types-NGkBcmmT.js → CodemationAuthoring.types-BteaR3Dc.js} +3 -2
  13. package/dist/CodemationAuthoring.types-BteaR3Dc.js.map +1 -0
  14. package/dist/{CodemationConfigNormalizer-BAKjetJ6.d.ts → CodemationConfigNormalizer-B4rDYC9h.d.ts} +3 -3
  15. package/dist/{CodemationConsumerConfigLoader-GYpBBvqE.js → CodemationConsumerConfigLoader-By-6tuGc.js} +3 -1
  16. package/dist/CodemationConsumerConfigLoader-By-6tuGc.js.map +1 -0
  17. package/dist/{CodemationConsumerConfigLoader-nxOqvv46.d.ts → CodemationConsumerConfigLoader-Dt4jyLx6.d.ts} +3 -2
  18. package/dist/{CodemationPluginListMerger-DKLAHT2b.d.ts → CodemationPluginListMerger-DS6I3Xe0.d.ts} +64 -27
  19. package/dist/{persistenceServer-C-hH4z6l.js → CodemationPostgresPrismaClientFactory-C7156Fe-.js} +2 -2
  20. package/dist/CodemationPostgresPrismaClientFactory-C7156Fe-.js.map +1 -0
  21. package/dist/CodemationPostgresPrismaClientFactory-CTNTPnDr.d.ts +9 -0
  22. package/dist/{CredentialContractsRegistry-Bq2bq28t.d.ts → CredentialContractsRegistry-Dgu-rEXi.d.ts} +16 -3
  23. package/dist/{CredentialServices-Be2I60Th.d.ts → CredentialServices-B3wPyp2y.d.ts} +4 -4
  24. package/dist/{CredentialServices-Dk8yypeL.js → CredentialServices-Bios0dM8.js} +10 -4
  25. package/dist/CredentialServices-Bios0dM8.js.map +1 -0
  26. package/dist/{InternalPingRegistrar-DY3kSfxP.js → InternalPingRegistrar-BavAAnvk.js} +19 -16
  27. package/dist/InternalPingRegistrar-BavAAnvk.js.map +1 -0
  28. package/dist/{ItemsInputNormalizer-_RwIfRIQ.d.ts → ItemsInputNormalizer-CFkfNMLt.d.ts} +1434 -1225
  29. package/dist/PrismaMigrationDeployer-DdEcXXVi.d.ts +14 -0
  30. package/dist/{PublicFrontendBootstrapFactory-CY2FS-5g.d.ts → PublicFrontendBootstrapFactory-ClEjZP74.d.ts} +2 -2
  31. package/dist/{PublicFrontendBootstrapJsonCodec-CXG9Dxft.d.ts → PublicFrontendBootstrapJsonCodec-HNItQ7ol.d.ts} +6 -1
  32. package/dist/{TelemetryContracts-BtDx84Cp.d.ts → TelemetryContracts-DpZEODQM.d.ts} +2 -2
  33. package/dist/{WorkflowPolicyUiPresentationFactory-6MyjCvBO.d.ts → WorkflowPolicyUiPresentationFactory-BNn2fvR_.d.ts} +2 -2
  34. package/dist/{WorkflowPolicyUiPresentationFactory-Bb-ae_Zh.js → WorkflowPolicyUiPresentationFactory-DfvD2VHk.js} +1 -1
  35. package/dist/{WorkflowPolicyUiPresentationFactory-Bb-ae_Zh.js.map → WorkflowPolicyUiPresentationFactory-DfvD2VHk.js.map} +1 -1
  36. package/dist/authoring.d.ts +4 -4
  37. package/dist/authoring.js +1 -1
  38. package/dist/client.d.ts +1 -1
  39. package/dist/client.js +1 -1
  40. package/dist/consumer.d.ts +5 -5
  41. package/dist/consumer.js +1 -1
  42. package/dist/credentials.d.ts +5 -5
  43. package/dist/credentials.js +1 -1
  44. package/dist/devServerSidecar.d.ts +2 -2
  45. package/dist/dto.d.ts +5 -5
  46. package/dist/{index-DilAYwnH.d.ts → index-ChIfeWzk.d.ts} +71 -28
  47. package/dist/index.d.ts +49 -17
  48. package/dist/index.js +106 -13
  49. package/dist/index.js.map +1 -0
  50. package/dist/infrastructure/persistence/PrismaMigrationOperations.d.ts +44 -0
  51. package/dist/infrastructure/persistence/PrismaMigrationOperations.js +302 -0
  52. package/dist/infrastructure/persistence/PrismaMigrationOperations.js.map +1 -0
  53. package/dist/mapping.d.ts +2 -2
  54. package/dist/mapping.js +1 -1
  55. package/dist/nextServer.d.ts +15 -39
  56. package/dist/nextServer.js +6 -6
  57. package/dist/pairing.d.ts +27 -8
  58. package/dist/pairing.js +19 -3
  59. package/dist/pairing.js.map +1 -0
  60. package/dist/{pairing.types-snfZ_OzB.d.ts → pairing.types-D9Bjn98U.d.ts} +1 -1
  61. package/dist/persistenceServer.d.ts +31 -7
  62. package/dist/persistenceServer.js +2 -2
  63. package/dist/{server-C4bS62rg.d.ts → server-B5trn7y4.d.ts} +5 -5
  64. package/dist/{server-Y7kxwtCK.js → server-BlG9qV5S.js} +5 -5
  65. package/dist/{server-Y7kxwtCK.js.map → server-BlG9qV5S.js.map} +1 -1
  66. package/dist/server.d.ts +10 -10
  67. package/dist/server.js +9 -9
  68. package/package.json +28 -25
  69. package/playwright.config.ts +8 -2
  70. package/playwright.scaffolded-dev.config.ts +8 -2
  71. package/prisma/migrations/20260526120000_credential_material_pointer/migration.sql +18 -0
  72. package/prisma/migrations/20260527120000_add_human_task/migration.sql +32 -0
  73. package/prisma/migrations/20260527130000_add_hitl_state_json/migration.sql +6 -0
  74. package/prisma/migrations/20260527130000_add_hmac_nonce/migration.sql +12 -0
  75. package/prisma/migrations.sqlite/20260526120000_credential_material_pointer/migration.sql +13 -0
  76. package/prisma/migrations.sqlite/20260527120000_add_human_task/migration.sql +30 -0
  77. package/prisma/migrations.sqlite/20260527130000_add_hitl_state_json/migration.sql +6 -0
  78. package/prisma/migrations.sqlite/20260527130000_add_hmac_nonce/migration.sql +9 -0
  79. package/prisma/schema.postgresql.prisma +48 -0
  80. package/prisma/schema.sqlite.prisma +48 -0
  81. package/prisma-generated/prisma-postgresql-client/edge.js +40 -6
  82. package/prisma-generated/prisma-postgresql-client/index-browser.js +36 -2
  83. package/prisma-generated/prisma-postgresql-client/index.d.ts +3179 -163
  84. package/prisma-generated/prisma-postgresql-client/index.js +40 -6
  85. package/prisma-generated/prisma-postgresql-client/package.json +1 -1
  86. package/prisma-generated/prisma-postgresql-client/schema.prisma +48 -0
  87. package/prisma-generated/prisma-sqlite-client/edge.js +40 -6
  88. package/prisma-generated/prisma-sqlite-client/index-browser.js +36 -2
  89. package/prisma-generated/prisma-sqlite-client/index.d.ts +3175 -163
  90. package/prisma-generated/prisma-sqlite-client/index.js +40 -6
  91. package/prisma-generated/prisma-sqlite-client/package.json +1 -1
  92. package/prisma-generated/prisma-sqlite-client/schema.prisma +48 -0
  93. package/src/application/contracts/CredentialContractsRegistry.ts +15 -0
  94. package/src/application/credentials/AppGalleryProjector.ts +69 -0
  95. package/src/application/hitl/DecideHumanTaskCommandHandler.ts +149 -0
  96. package/src/application/hitl/DecisionSchemaValidator.ts +22 -0
  97. package/src/application/hitl/HitlCallbackHandler.ts +96 -0
  98. package/src/application/mapping/WorkflowDefinitionMapper.ts +1 -3
  99. package/src/application/queries/CredentialQueryHandlers.ts +2 -0
  100. package/src/application/queries/GetCredentialAppsQuery.ts +4 -0
  101. package/src/application/queries/GetCredentialAppsQueryHandler.ts +27 -0
  102. package/src/application/telemetry/ResumeTelemetryContextForRun.ts +53 -0
  103. package/src/application/telemetry/TelemetryRetentionTimestampFactory.ts +9 -8
  104. package/src/applicationTokens.ts +11 -1
  105. package/src/auth/managed/ManagedCorsMiddleware.ts +20 -5
  106. package/src/bootstrap/AppContainerFactory.ts +121 -3
  107. package/src/bootstrap/runtime/HeadlessApiRuntime.ts +47 -0
  108. package/src/credentials/CachingCredentialMaterialProvider.ts +96 -0
  109. package/src/credentials/CompositeCredentialMaterialProvider.ts +47 -0
  110. package/src/credentials/ControlPlaneCatalogFetcher.ts +8 -28
  111. package/src/credentials/ControlPlaneCredentialMaterialProvider.ts +79 -0
  112. package/src/credentials/CredentialOAuth2MaterialReader.ts +2 -7
  113. package/src/credentials/InternalCredentialsBindingRegistrar.ts +83 -0
  114. package/src/credentials/LocalCredentialMaterialProvider.ts +92 -0
  115. package/src/domain/credentials/CredentialInstanceService.ts +5 -1
  116. package/src/domain/credentials/CredentialTypeRegistryImpl.ts +18 -4
  117. package/src/domain/workflows/WorkflowActivationPreflightRules.ts +7 -4
  118. package/src/dto.ts +2 -0
  119. package/src/hitl/ControlPlaneInboxChannel.ts +102 -0
  120. package/src/hitl/HitlResumeTokenSigner.ts +80 -0
  121. package/src/hitl/HitlTimeoutJobScheduler.ts +77 -0
  122. package/src/hitl/HitlTimeoutWorker.ts +138 -0
  123. package/src/hitl/InboxChannelResolver.ts +49 -0
  124. package/src/hitl/LocalInboxChannel.ts +37 -0
  125. package/src/index.ts +3 -0
  126. package/src/infrastructure/persistence/PrismaCredentialStore.ts +10 -0
  127. package/src/infrastructure/persistence/PrismaHmacNonceStore.ts +29 -0
  128. package/src/infrastructure/persistence/PrismaHumanTaskStore.ts +156 -0
  129. package/src/infrastructure/persistence/PrismaMigrationDeployer.ts +53 -383
  130. package/src/infrastructure/persistence/PrismaMigrationOperations.ts +401 -0
  131. package/src/infrastructure/persistence/PrismaWorkflowRunRepository.ts +39 -0
  132. package/src/mcp/AgentMcpIntegrationImpl.ts +5 -1
  133. package/src/pairing/HmacNonceStore.ts +14 -0
  134. package/src/pairing/HmacNonceStoreToken.ts +4 -0
  135. package/src/pairing/HmacRequestSigner.ts +10 -1
  136. package/src/pairing/InMemoryHmacNonceStore.ts +24 -0
  137. package/src/pairing/IncomingHmacVerifier.ts +28 -12
  138. package/src/pairing/InternalHmacAuthMiddleware.ts +1 -1
  139. package/src/pairing/index.ts +3 -0
  140. package/src/presentation/config/CodemationAuthoring.types.ts +7 -1
  141. package/src/presentation/config/CodemationConfig.ts +6 -0
  142. package/src/presentation/http/ApiPaths.ts +14 -0
  143. package/src/presentation/http/HeadlessHttpServerFactory.ts +56 -0
  144. package/src/presentation/http/hono/HonoHttpAnonymousRoutePolicyRegistry.ts +4 -0
  145. package/src/presentation/http/hono/registrars/CredentialHonoApiRouteRegistrar.ts +1 -0
  146. package/src/presentation/http/hono/registrars/HitlDecideHonoApiRouteRegistrar.ts +54 -0
  147. package/src/presentation/http/hono/registrars/HitlInternalCallbackHonoApiRouteRegistrar.ts +33 -0
  148. package/src/presentation/http/hono/registrars/HitlResumeHonoApiRouteRegistrar.ts +43 -0
  149. package/src/presentation/http/routeHandlers/CredentialHttpRouteHandler.ts +9 -0
  150. package/src/presentation/http/routeHandlers/OAuth2HttpRouteHandlerFactory.ts +1 -1
  151. package/src/presentation/server/CodemationConsumerConfigLoader.ts +7 -2
  152. package/src/presentation/websocket/WorkflowWebsocketServerFactory.ts +16 -0
  153. package/src/server.ts +7 -2
  154. package/src/workflows/InternalWorkflowTestRunRegistrar.ts +9 -0
  155. package/tsconfig.json +1 -0
  156. package/dist/AppConfigFactory-Cx4qQvRk.js.map +0 -1
  157. package/dist/AppContainerFactory-DqKYCRNP.js.map +0 -1
  158. package/dist/CodemationAuthoring.types-NGkBcmmT.js.map +0 -1
  159. package/dist/CodemationConsumerConfigLoader-GYpBBvqE.js.map +0 -1
  160. package/dist/CredentialServices-Dk8yypeL.js.map +0 -1
  161. package/dist/InternalPingRegistrar-DY3kSfxP.js.map +0 -1
  162. package/dist/persistenceServer-C-hH4z6l.js.map +0 -1
  163. package/dist/persistenceServer-CeTHtC6E.d.ts +0 -30
  164. package/src/credentials/catalogTypes.ts +0 -4
@@ -1,5 +1,5 @@
1
- import { a as DefinedCollection, i as CollectionDefinition } from "./index-DilAYwnH.js";
2
- import { T as McpServerDeclaration, X as WorkflowDefinition, _ as EngineExecutionLimitsPolicyConfig, g as TypeToken, h as Container, ut as AnyCredentialType } from "./ItemsInputNormalizer-_RwIfRIQ.js";
1
+ import { a as CollectionDefinition, o as DefinedCollection } from "./index-ChIfeWzk.js";
2
+ import { A as WorkflowDefinition, G as TypeToken, K as EngineExecutionLimitsPolicyConfig, W as Container, nt as McpServerDeclaration, rt as AnyCredentialType } from "./ItemsInputNormalizer-CFkfNMLt.js";
3
3
  import { a as CodemationAuthConfig, n as CodemationLogConfig, t as CodemationWhitelabelConfig, u as LoggerFactory } from "./CodemationWhitelabelConfig-Ca2mCUeC.js";
4
4
 
5
5
  //#region src/presentation/config/CodemationClassToken.d.ts
@@ -78,6 +78,12 @@ interface CodemationApplicationRuntimeConfig {
78
78
  }
79
79
  interface CodemationConfig {
80
80
  readonly app?: CodemationAppDefinition;
81
+ /**
82
+ * Reserved compatibility-date field. Declares the Codemation framework version this workspace
83
+ * targets. Logged at INFO level on boot. No enforcement in 1.0.0.
84
+ * See backlog/codemation-version-compatibility-gate.md.
85
+ */
86
+ readonly codemationVersion?: string;
81
87
  readonly register?: (context: CodemationAppContext) => void;
82
88
  readonly runtime?: CodemationApplicationRuntimeConfig;
83
89
  readonly workflows?: ReadonlyArray<WorkflowDefinition>;
@@ -186,4 +192,4 @@ interface CodemationAppContext extends CodemationRegistrationContextBase {
186
192
  }
187
193
  //#endregion
188
194
  export { CodemationContainerRegistration as C, CodemationWorkflowDiscovery as S, CodemationEngineExecutionLimitsConfig as _, AppPluginLoadSummary as a, CodemationSchedulerConfig as b, CodemationPluginContext as c, CodemationAppSchedulerConfig as d, CodemationAppSchedulerKind as f, CodemationDatabaseKind as g, CodemationDatabaseConfig as h, AppPersistenceConfig as i, CodemationPluginPackageMetadata as l, CodemationConfig as m, CodemationRegistrationContextBase as n, CodemationPlugin as o, CodemationApplicationRuntimeConfig as p, AppConfig as r, CodemationPluginConfig as s, CodemationAppContext as t, CodemationAppDefinition as u, CodemationEventBusConfig as v, CodemationClassToken as w, CodemationSchedulerKind as x, CodemationEventBusKind as y };
189
- //# sourceMappingURL=CodemationAppContext-CKVv9W9q.d.ts.map
195
+ //# sourceMappingURL=CodemationAppContext-K51b7oXe.d.ts.map
@@ -1,6 +1,6 @@
1
- import { a as DefinedCollection, o as DefinedNode, s as DefinedNodeConfigInput } from "./index-DilAYwnH.js";
2
- import { C as AnyRunnableNodeConfig, H as NodeInspectorSummaryRow, J as RunnableNodeConfig, L as Item, R as Items, S as ChainCursor, T as McpServerDeclaration, X as WorkflowDefinition, Y as RunnableNodeOutputJson, _t as CredentialJsonRecord, g as TypeToken, i as ToolConfig, l as NodeExecutionContext, n as AgentMessageConfig, r as ChatModelConfig, t as AgentGuardrailConfig, ut as AnyCredentialType } from "./ItemsInputNormalizer-_RwIfRIQ.js";
3
- import { c as CodemationPluginContext, m as CodemationConfig, o as CodemationPlugin, t as CodemationAppContext } from "./CodemationAppContext-CKVv9W9q.js";
1
+ import { o as DefinedCollection } from "./index-ChIfeWzk.js";
2
+ import { $ as DefinedNode, A as WorkflowDefinition, G as TypeToken, O as RunnableNodeConfig, Q as AnyRunnableNodeConfig, S as NodeInspectorSummaryRow, Z as ChainCursor, _ as Item, c as NodeExecutionContext, et as DefinedNodeConfigInput, i as ToolConfig, k as RunnableNodeOutputJson, n as AgentMessageConfig, nt as McpServerDeclaration, r as ChatModelConfig, rt as AnyCredentialType, t as AgentGuardrailConfig, ut as CredentialJsonRecord, v as Items } from "./ItemsInputNormalizer-CFkfNMLt.js";
3
+ import { c as CodemationPluginContext, m as CodemationConfig, o as CodemationPlugin, t as CodemationAppContext } from "./CodemationAppContext-K51b7oXe.js";
4
4
  import { t as CodemationWhitelabelConfig } from "./CodemationWhitelabelConfig-Ca2mCUeC.js";
5
5
  import { ZodType, z } from "zod";
6
6
  import "ai";
@@ -249,6 +249,11 @@ interface FriendlyCodemationExecutionConfig {
249
249
  }
250
250
  interface DefineCodemationAppOptions extends Omit<CodemationConfig, "app" | "credentialTypes" | "register" | "whitelabel" | "auth" | "collections"> {
251
251
  readonly name?: string;
252
+ /**
253
+ * Reserved compatibility-date field. Declares the Codemation framework version this workspace
254
+ * targets. No enforcement in 1.0.0 — presence only. See backlog/codemation-version-compatibility-gate.md.
255
+ */
256
+ readonly codemationVersion?: string;
252
257
  readonly auth?: CodemationConfig["auth"];
253
258
  readonly database?: FriendlyCodemationDatabaseConfig;
254
259
  readonly execution?: FriendlyCodemationExecutionConfig;
@@ -282,4 +287,4 @@ declare function definePlugin(options: DefinePluginOptions): CodemationPlugin &
282
287
  }>;
283
288
  //#endregion
284
289
  export { defineCodemationApp as a, FriendlyCodemationExecutionConfig as i, DefinePluginOptions as n, definePlugin as o, FriendlyCodemationDatabaseConfig as r, workflow as s, DefineCodemationAppOptions as t };
285
- //# sourceMappingURL=CodemationAuthoring.types-DA3G3s6d.d.ts.map
290
+ //# sourceMappingURL=CodemationAuthoring.types-BXlXIl4K.d.ts.map
@@ -4,7 +4,7 @@ var CodemationAuthoringConfigFactory = class {
4
4
  const appDefinition = this.createAppDefinition(options);
5
5
  const credentialTypes = [...options.credentialTypes ?? [], ...options.credentials ?? []];
6
6
  const register = this.composeAppRegister(options.register, options.nodes, options.collections);
7
- const { workflows, plugins, runtime, log, mcpServers } = options;
7
+ const { workflows, plugins, runtime, log, mcpServers, codemationVersion } = options;
8
8
  return {
9
9
  workflows,
10
10
  workflowDiscovery: this.mergeWorkflowDiscovery(options.workflowDiscovery, options.workflowsDir),
@@ -12,6 +12,7 @@ var CodemationAuthoringConfigFactory = class {
12
12
  runtime,
13
13
  log,
14
14
  mcpServers,
15
+ codemationVersion,
15
16
  app: appDefinition,
16
17
  credentialTypes,
17
18
  register
@@ -97,4 +98,4 @@ function definePlugin(options) {
97
98
 
98
99
  //#endregion
99
100
  export { definePlugin as n, defineCodemationApp as t };
100
- //# sourceMappingURL=CodemationAuthoring.types-NGkBcmmT.js.map
101
+ //# sourceMappingURL=CodemationAuthoring.types-BteaR3Dc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodemationAuthoring.types-BteaR3Dc.js","names":[],"sources":["../src/presentation/config/CodemationAuthoring.types.ts"],"sourcesContent":["import type { AnyCredentialType, DefinedCollection, DefinedNode, McpServerDeclaration } from \"@codemation/core\";\nimport type { CodemationAppContext } from \"./CodemationAppContext\";\nimport type {\n CodemationAppDefinition,\n CodemationAppSchedulerConfig,\n CodemationConfig,\n CodemationDatabaseConfig,\n} from \"./CodemationConfig\";\nimport type { CodemationPlugin, CodemationPluginContext } from \"./CodemationPlugin\";\nimport type { CodemationWhitelabelConfig } from \"./CodemationWhitelabelConfig\";\n\nexport interface FriendlyCodemationDatabaseConfig {\n readonly kind: \"postgresql\" | \"sqlite\";\n readonly url?: string;\n /** Name of an environment variable whose value is the PostgreSQL connection URL. Co-exclusive with `url`. */\n readonly urlEnv?: string;\n readonly filePath?: string;\n}\n\nexport interface FriendlyCodemationExecutionConfig {\n readonly mode?: \"inline\" | \"queue\";\n /** Name of an environment variable whose value is \"inline\" or \"queue\". Co-exclusive with `mode`. */\n readonly modeEnv?: string;\n readonly queuePrefix?: string;\n readonly workerQueues?: ReadonlyArray<string>;\n readonly redisUrl?: string;\n /** Name of an environment variable whose value is the Redis connection URL. Co-exclusive with `redisUrl`. */\n readonly redisUrlEnv?: string;\n}\n\nexport interface DefineCodemationAppOptions extends Omit<\n CodemationConfig,\n \"app\" | \"credentialTypes\" | \"register\" | \"whitelabel\" | \"auth\" | \"collections\"\n> {\n readonly name?: string;\n /**\n * Reserved compatibility-date field. Declares the Codemation framework version this workspace\n * targets. No enforcement in 1.0.0 — presence only. See backlog/codemation-version-compatibility-gate.md.\n */\n readonly codemationVersion?: string;\n readonly auth?: CodemationConfig[\"auth\"];\n readonly database?: FriendlyCodemationDatabaseConfig;\n readonly execution?: FriendlyCodemationExecutionConfig;\n readonly nodes?: ReadonlyArray<DefinedNode<string, Record<string, unknown>, unknown, unknown>>;\n readonly collections?: ReadonlyArray<DefinedCollection>;\n readonly credentialTypes?: ReadonlyArray<AnyCredentialType>;\n readonly credentials?: ReadonlyArray<AnyCredentialType>;\n readonly register?: (context: CodemationAppContext) => void;\n readonly whitelabel?: CodemationWhitelabelConfig;\n /**\n * Path (relative to the consumer project root) to a directory from which workflows are auto-discovered.\n * All `*.ts` / `*.tsx` files (excluding `*.test.*` and `*.d.ts`) are imported and any exported\n * `WorkflowDefinition` values are registered. Co-exclusive with providing this directory in\n * `workflowDiscovery.directories`.\n */\n readonly workflowsDir?: string;\n}\n\nexport interface DefinePluginOptions {\n readonly name?: string;\n readonly pluginPackageId?: string;\n readonly nodes?: ReadonlyArray<DefinedNode<string, Record<string, unknown>, unknown, unknown>>;\n readonly collections?: ReadonlyArray<DefinedCollection>;\n readonly credentials?: ReadonlyArray<AnyCredentialType>;\n readonly mcpServers?: ReadonlyArray<McpServerDeclaration>;\n readonly register?: (context: CodemationPluginContext) => void | Promise<void>;\n readonly sandbox?: CodemationConfig;\n}\n\nclass CodemationAuthoringConfigFactory {\n static createApp(options: DefineCodemationAppOptions): CodemationConfig {\n const appDefinition = this.createAppDefinition(options);\n const credentialTypes = [...(options.credentialTypes ?? []), ...(options.credentials ?? [])];\n const register = this.composeAppRegister(options.register, options.nodes, options.collections);\n const { workflows, plugins, runtime, log, mcpServers, codemationVersion } = options;\n const workflowDiscovery = this.mergeWorkflowDiscovery(options.workflowDiscovery, options.workflowsDir);\n return {\n workflows,\n workflowDiscovery,\n plugins,\n runtime,\n log,\n mcpServers,\n codemationVersion,\n app: appDefinition,\n credentialTypes,\n register,\n };\n }\n\n static createPlugin(options: DefinePluginOptions): CodemationPlugin & Readonly<{ sandbox?: CodemationConfig }> {\n return {\n pluginPackageId: options.pluginPackageId,\n sandbox: options.sandbox,\n mcpServers: options.mcpServers,\n async register(context: CodemationPluginContext): Promise<void> {\n for (const nodeDefinition of options.nodes ?? []) {\n nodeDefinition.register(context);\n }\n for (const collection of options.collections ?? []) {\n collection.register(context);\n }\n for (const credential of options.credentials ?? []) {\n context.registerCredentialType(credential);\n }\n await options.register?.(context);\n },\n };\n }\n\n private static createAppDefinition(options: DefineCodemationAppOptions): CodemationAppDefinition | undefined {\n const scheduler = this.createSchedulerConfig(options.execution);\n const database = this.createDatabaseConfig(options.database);\n const whitelabel = this.createWhitelabel(options.name, options.whitelabel);\n if (!options.auth && !database && !scheduler && !whitelabel) {\n return undefined;\n }\n return {\n auth: options.auth,\n database,\n scheduler,\n whitelabel,\n };\n }\n\n private static createDatabaseConfig(\n database: FriendlyCodemationDatabaseConfig | undefined,\n ): CodemationDatabaseConfig | undefined {\n if (!database) {\n return undefined;\n }\n if (database.kind === \"sqlite\") {\n return {\n kind: \"sqlite\",\n sqliteFilePath: database.filePath,\n };\n }\n if (database.url !== undefined && database.urlEnv !== undefined) {\n throw new Error(\n \"defineCodemationApp: database.url and database.urlEnv are mutually exclusive — provide one or the other.\",\n );\n }\n const url = database.urlEnv !== undefined ? process.env[database.urlEnv] : database.url;\n return {\n kind: \"postgresql\",\n url,\n };\n }\n\n private static createSchedulerConfig(\n execution: FriendlyCodemationExecutionConfig | undefined,\n ): CodemationAppSchedulerConfig | undefined {\n if (!execution) {\n return undefined;\n }\n if (execution.mode !== undefined && execution.modeEnv !== undefined) {\n throw new Error(\n \"defineCodemationApp: execution.mode and execution.modeEnv are mutually exclusive — provide one or the other.\",\n );\n }\n if (execution.redisUrl !== undefined && execution.redisUrlEnv !== undefined) {\n throw new Error(\n \"defineCodemationApp: execution.redisUrl and execution.redisUrlEnv are mutually exclusive — provide one or the other.\",\n );\n }\n const rawMode = execution.modeEnv !== undefined ? process.env[execution.modeEnv] : execution.mode;\n const mode = rawMode === \"inline\" || rawMode === \"queue\" ? rawMode : undefined;\n const redisUrl = execution.redisUrlEnv !== undefined ? process.env[execution.redisUrlEnv] : execution.redisUrl;\n return {\n kind: mode,\n queuePrefix: execution.queuePrefix,\n workerQueues: execution.workerQueues,\n redisUrl,\n };\n }\n\n private static mergeWorkflowDiscovery(\n existing: CodemationConfig[\"workflowDiscovery\"],\n workflowsDir: string | undefined,\n ): CodemationConfig[\"workflowDiscovery\"] {\n if (!workflowsDir) {\n return existing;\n }\n const existingDirectories = existing?.directories ?? [];\n return {\n directories: [...existingDirectories, workflowsDir],\n };\n }\n\n private static createWhitelabel(\n name: string | undefined,\n whitelabel: CodemationWhitelabelConfig | undefined,\n ): CodemationWhitelabelConfig | undefined {\n if (!name && !whitelabel) {\n return undefined;\n }\n return {\n productName: name ?? whitelabel?.productName,\n logoPath: whitelabel?.logoPath,\n };\n }\n\n private static composeAppRegister(\n register: ((context: CodemationAppContext) => void) | undefined,\n nodes: ReadonlyArray<DefinedNode<string, Record<string, unknown>, unknown, unknown>> | undefined,\n collections: ReadonlyArray<DefinedCollection> | undefined,\n ): ((context: CodemationAppContext) => void) | undefined {\n if (!register && (!nodes || nodes.length === 0) && (!collections || collections.length === 0)) {\n return undefined;\n }\n return (context: CodemationAppContext) => {\n for (const nodeDefinition of nodes ?? []) {\n nodeDefinition.register(context);\n }\n for (const collection of collections ?? []) {\n collection.register(context);\n }\n register?.(context);\n };\n }\n}\n\nexport function defineCodemationApp(options: DefineCodemationAppOptions): CodemationConfig {\n return CodemationAuthoringConfigFactory.createApp(options);\n}\n\nexport function definePlugin(\n options: DefinePluginOptions,\n): CodemationPlugin & Readonly<{ sandbox?: CodemationConfig }> {\n return CodemationAuthoringConfigFactory.createPlugin(options);\n}\n"],"mappings":";AAqEA,IAAM,mCAAN,MAAuC;CACrC,OAAO,UAAU,SAAuD;EACtE,MAAM,gBAAgB,KAAK,oBAAoB,QAAQ;EACvD,MAAM,kBAAkB,CAAC,GAAI,QAAQ,mBAAmB,EAAE,EAAG,GAAI,QAAQ,eAAe,EAAE,CAAE;EAC5F,MA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b,WAC0C;AAC1C,MAAI,CAAC,UACH;AAEF,MAAI,UAAU,SAAS,UAAa,UAAU,YAAY,OACxD,OAAM,IAAI,MACR,+GACD;AAEH,MAAI,UAAU,aAAa,UAAa,UAAU,gBAAgB,OAChE,OAAM,IAAI,MACR,uHACD;EAEH,MAAM,UAAU,UAAU,YAAY,SAAY,QAAQ,IAAI,UAAU,WAAW,UAAU;EAC7F,MAAM,OAAO,YAAY,YAAY,YAAY,UAAU,UAAU;EACrE,MAAM,WAAW,UAAU,gBAAgB,SAAY,QAAQ,IAAI,UAAU,eAAe,UAAU;AACtG,SAAO;GACL,MAAM;GACN,aAAa,UAAU;GACvB,cAAc,UAAU;GACxB;GACD;;CAGH,OAAe,uBACb,UACA,cACuC;AACvC,MAAI,CAAC,aACH,QAAO;AAGT,SAAO,EACL,aAAa,CAAC,GAFY,UAAU,eAAe,EAAE,EAEf,aAAa,EACpD;;CAGH,OAAe,iBACb,MACA,YACwC;AACxC,MAAI,CAAC,QAAQ,CAAC,WACZ;AAEF,SAAO;GACL,aAAa,QAAQ,YAAY;GACjC,UAAU,YAAY;GACvB;;CAGH,OAAe,mBACb,UACA,OACA,aACuD;AACvD,MAAI,CAAC,aAAa,CAAC,SAAS,MAAM,WAAW,OAAO,CAAC,eAAe,YAAY,WAAW,GACzF;AAEF,UAAQ,YAAkC;AACxC,QAAK,MAAM,kBAAkB,SAAS,EAAE,CACtC,gBAAe,SAAS,QAAQ;AAElC,QAAK,MAAM,cAAc,eAAe,EAAE,CACxC,YAAW,SAAS,QAAQ;AAE9B,cAAW,QAAQ;;;;AAKzB,SAAgB,oBAAoB,SAAuD;AACzF,QAAO,iCAAiC,UAAU,QAAQ;;AAG5D,SAAgB,aACd,SAC6D;AAC7D,QAAO,iCAAiC,aAAa,QAAQ"}
@@ -1,5 +1,5 @@
1
- import { i as CollectionDefinition } from "./index-DilAYwnH.js";
2
- import { C as CodemationContainerRegistration, m as CodemationConfig } from "./CodemationAppContext-CKVv9W9q.js";
1
+ import { a as CollectionDefinition } from "./index-ChIfeWzk.js";
2
+ import { C as CodemationContainerRegistration, m as CodemationConfig } from "./CodemationAppContext-K51b7oXe.js";
3
3
 
4
4
  //#region src/presentation/config/CodemationConfigNormalizer.d.ts
5
5
  type NormalizedCodemationConfig = Omit<CodemationConfig, "collections"> & Readonly<{
@@ -8,4 +8,4 @@ type NormalizedCodemationConfig = Omit<CodemationConfig, "collections"> & Readon
8
8
  }>;
9
9
  //#endregion
10
10
  export { NormalizedCodemationConfig as t };
11
- //# sourceMappingURL=CodemationConfigNormalizer-BAKjetJ6.d.ts.map
11
+ //# sourceMappingURL=CodemationConfigNormalizer-B4rDYC9h.d.ts.map
@@ -351,6 +351,7 @@ var CodemationConsumerConfigLoader = class CodemationConsumerConfigLoader {
351
351
  discoveredWorkflowsEmptyMessageFactory = new DiscoveredWorkflowsEmptyMessageFactory();
352
352
  pathSegmentsComputer = new WorkflowDiscoveryPathSegmentsComputer();
353
353
  performanceDiagnosticsLogger = new ServerLoggerFactory(logLevelPolicyFactory).createPerformanceDiagnostics("codemation-config-loader.timing");
354
+ bootLogger = new ServerLoggerFactory(logLevelPolicyFactory).create("codemation.boot");
354
355
  /**
355
356
  * In-flight + completed load promises keyed by `${consumerRoot}|${configPathOverride}`. The
356
357
  * boot path constructs MULTIPLE CodemationConsumerConfigLoader instances (one inside the CLI's
@@ -400,6 +401,7 @@ var CodemationConsumerConfigLoader = class CodemationConsumerConfigLoader {
400
401
  const rawConfig = this.configExportsResolver.resolveConfig(moduleExports);
401
402
  if (!rawConfig) throw new Error(`Config file does not export a Codemation config object: ${bootstrapSource}`);
402
403
  const config = this.configNormalizer.normalize(rawConfig);
404
+ if (rawConfig.codemationVersion) this.bootLogger.info(`codemationVersion: ${rawConfig.codemationVersion}`);
403
405
  const workflowSources = await BootTimer.measureAsync("config.resolveWorkflowSources", () => this.resolveWorkflowSources(args.consumerRoot, config));
404
406
  phaseMs("resolveWorkflowSources");
405
407
  const workflows = await BootTimer.measureAsync("config.loadDiscoveredWorkflows", async () => this.mergeWorkflows(config.workflows ?? [], await this.loadDiscoveredWorkflows(args.consumerRoot, config, workflowSources, importSession)));
@@ -574,4 +576,4 @@ var CodemationConsumerConfigLoader = class CodemationConsumerConfigLoader {
574
576
 
575
577
  //#endregion
576
578
  export { CodemationConfigNormalizer as a, CodemationConsumerAppResolver as i, WorkflowDiscoveryPathSegmentsComputer as n, WorkflowModulePathFinder as r, CodemationConsumerConfigLoader as t };
577
- //# sourceMappingURL=CodemationConsumerConfigLoader-GYpBBvqE.js.map
579
+ //# sourceMappingURL=CodemationConsumerConfigLoader-By-6tuGc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodemationConsumerConfigLoader-By-6tuGc.js","names":["containerRegistrations: Array<CodemationContainerRegistration<unknown>>","credentialTypes: Array<AnyCredentialType>","collections: Array<CollectionDefinition>","workflows: Array<WorkflowDefinition>","workflowDirectories: Array<string>","workflows: WorkflowDefinition[]","workflowModulePaths: string[]","bestRoot: string | null","resolvedConfig: NormalizedCodemationConfig"],"sources":["../src/presentation/config/CodemationConfigNormalizer.ts","../src/presentation/server/CodemationConsumerConfigExportsResolver.ts","../src/presentation/server/DiscoveredWorkflowsEmptyMessageFactory.ts","../src/presentation/server/WorkflowDefinitionExportsResolver.ts","../src/presentation/server/CodemationConsumerAppResolver.ts","../src/presentation/server/WorkflowModulePathFinder.ts","../src/presentation/server/WorkflowDiscoveryPathSegmentsComputer.ts","../src/presentation/server/CodemationConsumerConfigLoader.ts"],"sourcesContent":["import type {\n AnyCredentialType,\n CollectionDefinition,\n Container,\n DefinedCollection,\n TypeToken,\n WorkflowDefinition,\n} from \"@codemation/core\";\nimport type { CodemationContainerRegistration } from \"../../bootstrap/CodemationContainerRegistration\";\nimport type { CodemationAppContext } from \"./CodemationAppContext\";\nimport type { CodemationAuthConfig } from \"./CodemationAuthConfig\";\nimport type { CodemationClassToken } from \"./CodemationClassToken\";\nimport type {\n CodemationApplicationRuntimeConfig,\n CodemationConfig,\n CodemationDatabaseConfig,\n CodemationEventBusConfig,\n CodemationSchedulerConfig,\n} from \"./CodemationConfig\";\n\nexport type NormalizedCodemationConfig = Omit<CodemationConfig, \"collections\"> &\n Readonly<{\n containerRegistrations: ReadonlyArray<CodemationContainerRegistration<unknown>>;\n collections: ReadonlyArray<CollectionDefinition>;\n }>;\n\nexport class CodemationConfigNormalizer {\n normalize(config: CodemationConfig): NormalizedCodemationConfig {\n const auth = config.app?.auth ?? config.auth;\n this.assertAuthConfig(auth);\n this.assertManagedModeConstraints(config, auth);\n const collected = this.collectRegistration(config);\n const normalizedRuntime = this.normalizeRuntimeConfig(config);\n const normalizedWorkflowDiscoveryDirectories = [\n ...(config.workflowDiscovery?.directories ?? []),\n ...collected.workflowDirectories,\n ];\n\n return {\n ...config,\n auth,\n containerRegistrations: collected.containerRegistrations,\n credentialTypes: [...(config.credentialTypes ?? []), ...collected.credentialTypes],\n collections: [...this.unwrapCollections(config.collections), ...collected.collections],\n log: config.app?.log ?? config.log,\n runtime: normalizedRuntime,\n whitelabel: config.app?.whitelabel ?? config.whitelabel,\n workflowDiscovery:\n normalizedWorkflowDiscoveryDirectories.length > 0\n ? { directories: normalizedWorkflowDiscoveryDirectories }\n : config.workflowDiscovery,\n workflows: this.mergeWorkflows(config.workflows ?? [], collected.workflows),\n };\n }\n\n /**\n * Enforces managed-mode invariants beyond what `assertAuthConfig` covers:\n * managed-mode workspaces are always Postgres and always require at least one workflow source.\n */\n private assertManagedModeConstraints(config: CodemationConfig, auth: CodemationAuthConfig | undefined): void {\n if (auth?.kind !== \"managed\") {\n return;\n }\n const hasWorkflows = (config.workflows?.length ?? 0) > 0;\n const hasWorkflowDiscovery = (config.workflowDiscovery?.directories?.length ?? 0) > 0;\n if (!hasWorkflows && !hasWorkflowDiscovery) {\n throw new Error(\n 'Managed-mode workspaces require at least one workflow source. Provide \"workflows\" or \"workflowsDir\" (which maps to workflowDiscovery.directories) in defineCodemationApp.',\n );\n }\n }\n\n private collectRegistration(config: CodemationConfig): Readonly<{\n containerRegistrations: ReadonlyArray<CodemationContainerRegistration<unknown>>;\n credentialTypes: ReadonlyArray<AnyCredentialType>;\n collections: ReadonlyArray<CollectionDefinition>;\n workflows: ReadonlyArray<WorkflowDefinition>;\n workflowDirectories: ReadonlyArray<string>;\n }> {\n if (!config.register) {\n return {\n containerRegistrations: [],\n credentialTypes: [],\n collections: [],\n workflows: [],\n workflowDirectories: [],\n };\n }\n\n const containerRegistrations: Array<CodemationContainerRegistration<unknown>> = [];\n const credentialTypes: Array<AnyCredentialType> = [];\n const collections: Array<CollectionDefinition> = [];\n const workflows: Array<WorkflowDefinition> = [];\n const workflowDirectories: Array<string> = [];\n\n const context: CodemationAppContext = {\n registerCredentialType(type) {\n credentialTypes.push(type);\n },\n registerCollection(definition) {\n collections.push(definition);\n },\n registerNode<TValue>(token: TypeToken<TValue>, implementation?: CodemationClassToken<TValue>) {\n containerRegistrations.push({\n token,\n useClass: implementation ?? (token as CodemationClassToken<TValue>),\n });\n },\n registerValue<TValue>(token: TypeToken<TValue>, value: TValue) {\n containerRegistrations.push({ token, useValue: value });\n },\n registerClass<TValue>(token: TypeToken<TValue>, implementation: CodemationClassToken<TValue>) {\n containerRegistrations.push({ token, useClass: implementation });\n },\n registerFactory<TValue>(token: TypeToken<TValue>, factory: (container: Container) => TValue) {\n containerRegistrations.push({ token, useFactory: factory });\n },\n registerWorkflow(workflow: WorkflowDefinition) {\n workflows.push(workflow);\n },\n registerWorkflows(nextWorkflows: ReadonlyArray<WorkflowDefinition>) {\n workflows.push(...nextWorkflows);\n },\n discoverWorkflows(...directories: ReadonlyArray<string>) {\n workflowDirectories.push(...directories);\n },\n };\n\n config.register(context);\n\n return {\n containerRegistrations,\n credentialTypes,\n collections,\n workflows,\n workflowDirectories,\n };\n }\n\n private unwrapCollections(\n entries: ReadonlyArray<CollectionDefinition | DefinedCollection> | undefined,\n ): ReadonlyArray<CollectionDefinition> {\n if (!entries) return [];\n return entries.map((entry) => (this.isDefinedCollection(entry) ? entry.definition : entry));\n }\n\n private isDefinedCollection(entry: CollectionDefinition | DefinedCollection): entry is DefinedCollection {\n return \"kind\" in entry && entry.kind === \"defined-collection\";\n }\n\n private normalizeRuntimeConfig(config: CodemationConfig): CodemationApplicationRuntimeConfig | undefined {\n if (!config.app) {\n return config.runtime;\n }\n const nextRuntime: CodemationApplicationRuntimeConfig = {\n ...(config.runtime ?? {}),\n frontendPort: config.app.frontendPort ?? config.runtime?.frontendPort,\n database: this.normalizeDatabaseConfig(config),\n eventBus: this.normalizeEventBusConfig(config),\n scheduler: this.normalizeSchedulerConfig(config),\n engineExecutionLimits: config.app.engineExecutionLimits ?? config.runtime?.engineExecutionLimits,\n };\n return nextRuntime;\n }\n\n private normalizeDatabaseConfig(config: CodemationConfig): CodemationDatabaseConfig | undefined {\n if (!config.app) {\n return config.runtime?.database;\n }\n if (config.app.database) {\n return config.app.database;\n }\n if (!config.app.databaseUrl) {\n return config.runtime?.database;\n }\n return {\n ...(config.runtime?.database ?? {}),\n url: config.app.databaseUrl,\n };\n }\n\n private normalizeSchedulerConfig(config: CodemationConfig): CodemationSchedulerConfig | undefined {\n if (!config.app?.scheduler) {\n return config.runtime?.scheduler;\n }\n const scheduler = config.app.scheduler;\n return {\n ...(config.runtime?.scheduler ?? {}),\n kind:\n scheduler.kind === \"queue\" ? \"bullmq\" : scheduler.kind === \"inline\" ? \"local\" : config.runtime?.scheduler?.kind,\n queuePrefix: scheduler.queuePrefix ?? config.runtime?.scheduler?.queuePrefix,\n workerQueues: scheduler.workerQueues ?? config.runtime?.scheduler?.workerQueues,\n };\n }\n\n private normalizeEventBusConfig(config: CodemationConfig): CodemationEventBusConfig | undefined {\n if (!config.app?.scheduler) {\n return config.runtime?.eventBus;\n }\n const scheduler = config.app.scheduler;\n const eventBusKind =\n scheduler.kind === \"queue\" ? \"redis\" : scheduler.kind === \"inline\" ? \"memory\" : config.runtime?.eventBus?.kind;\n return {\n ...(config.runtime?.eventBus ?? {}),\n kind: eventBusKind,\n queuePrefix: scheduler.queuePrefix ?? config.runtime?.eventBus?.queuePrefix,\n redisUrl: scheduler.redisUrl ?? config.runtime?.eventBus?.redisUrl,\n };\n }\n\n private assertAuthConfig(authConfig: CodemationConfig[\"auth\"]): void {\n if (authConfig?.kind !== \"managed\") {\n return;\n }\n if (authConfig.oauth && authConfig.oauth.length > 0) {\n throw new Error('auth.kind \"managed\" cannot be combined with oauth providers. Remove the oauth config.');\n }\n if (authConfig.oidc && authConfig.oidc.length > 0) {\n throw new Error('auth.kind \"managed\" cannot be combined with oidc providers. Remove the oidc config.');\n }\n if (authConfig.allowUnauthenticatedInDevelopment === true) {\n throw new Error(\n 'auth.kind \"managed\" cannot be combined with allowUnauthenticatedInDevelopment. Remove that flag.',\n );\n }\n }\n\n private mergeWorkflows(\n configuredWorkflows: ReadonlyArray<WorkflowDefinition>,\n registeredWorkflows: ReadonlyArray<WorkflowDefinition>,\n ): ReadonlyArray<WorkflowDefinition> | undefined {\n if (configuredWorkflows.length === 0 && registeredWorkflows.length === 0) {\n return undefined;\n }\n const workflowsById = new Map<string, WorkflowDefinition>();\n for (const workflow of registeredWorkflows) {\n workflowsById.set(workflow.id, workflow);\n }\n for (const workflow of configuredWorkflows) {\n workflowsById.set(workflow.id, workflow);\n }\n return [...workflowsById.values()];\n }\n}\n","import type { CodemationConfig } from \"../config/CodemationConfig\";\n\nexport class CodemationConsumerConfigExportsResolver {\n resolveConfig(moduleExports: Readonly<Record<string, unknown>>): CodemationConfig | null {\n const defaultExport = moduleExports.default;\n if (this.isConfig(defaultExport)) {\n return defaultExport;\n }\n const namedConfig = moduleExports.codemationHost ?? moduleExports.config;\n if (this.isConfig(namedConfig)) {\n return namedConfig;\n }\n return null;\n }\n\n private isConfig(value: unknown): value is CodemationConfig {\n if (!value || typeof value !== \"object\") {\n return false;\n }\n return (\n \"app\" in value ||\n \"register\" in value ||\n \"credentials\" in value ||\n \"runtime\" in value ||\n \"workflows\" in value ||\n \"workflowDiscovery\" in value ||\n \"plugins\" in value ||\n \"whitelabel\" in value ||\n \"auth\" in value ||\n \"log\" in value\n );\n }\n}\n","export class DiscoveredWorkflowsEmptyMessageFactory {\n create(discoveredPaths: ReadonlyArray<string>): string {\n const lines = discoveredPaths.map((p) => ` - ${p}`).join(\"\\n\");\n return [\n `Discovered ${discoveredPaths.length} file(s) under workflow discovery, but none export a WorkflowDefinition.`,\n lines,\n \"\",\n \"Move shared helpers outside the discovery directories (for example src/lib), or export at least one object with id, name, nodes, and edges from a workflow module.\",\n ].join(\"\\n\");\n }\n}\n","import type { WorkflowDefinition } from \"@codemation/core\";\nimport { WorkflowEdgePortValidator } from \"@codemation/core\";\n\n/**\n * Collects exported values that match the {@link WorkflowDefinition} shape.\n * Other exports (helpers, constants, type-only re-exports) are ignored.\n *\n * Throws if any workflow's edges reference output ports not declared by the\n * source node config. All violations are reported at once so an agent can\n * self-correct in a single pass.\n */\nexport class WorkflowDefinitionExportsResolver {\n private readonly portValidator = new WorkflowEdgePortValidator();\n\n resolve(moduleExports: Readonly<Record<string, unknown>>): ReadonlyArray<WorkflowDefinition> {\n const workflows: WorkflowDefinition[] = [];\n for (const exportedValue of Object.values(moduleExports)) {\n if (this.isWorkflowDefinition(exportedValue)) {\n this.validatePorts(exportedValue);\n workflows.push(exportedValue);\n }\n }\n return workflows;\n }\n\n private validatePorts(workflow: WorkflowDefinition): void {\n const result = this.portValidator.validate(workflow);\n if (!result.valid) {\n const lines = result.errors.map((e) => ` - ${e.message}`).join(\"\\n\");\n throw new Error(\n `Workflow \"${workflow.id}\" (\"${workflow.name}\") has ${result.errors.length} invalid edge port(s):\\n${lines}`,\n );\n }\n }\n\n private isWorkflowDefinition(value: unknown): value is WorkflowDefinition {\n if (!value || typeof value !== \"object\") {\n return false;\n }\n return \"id\" in value && \"name\" in value && \"nodes\" in value && \"edges\" in value;\n }\n}\n","import type { WorkflowDefinition } from \"@codemation/core\";\nimport { CodemationConfigNormalizer } from \"../config/CodemationConfigNormalizer\";\nimport type { NormalizedCodemationConfig } from \"../config/CodemationConfigNormalizer\";\nimport { CodemationConsumerConfigExportsResolver } from \"./CodemationConsumerConfigExportsResolver\";\nimport { DiscoveredWorkflowsEmptyMessageFactory } from \"./DiscoveredWorkflowsEmptyMessageFactory\";\nimport { WorkflowDefinitionExportsResolver } from \"./WorkflowDefinitionExportsResolver\";\n\nexport type CodemationConsumerApp = Readonly<{\n config: NormalizedCodemationConfig;\n workflowSources: ReadonlyArray<string>;\n}>;\n\nexport class CodemationConsumerAppResolver {\n private readonly configExportsResolver = new CodemationConsumerConfigExportsResolver();\n private readonly configNormalizer = new CodemationConfigNormalizer();\n private readonly workflowDefinitionExportsResolver = new WorkflowDefinitionExportsResolver();\n private readonly discoveredWorkflowsEmptyMessageFactory = new DiscoveredWorkflowsEmptyMessageFactory();\n\n resolve(\n args: Readonly<{\n configModule: Readonly<Record<string, unknown>>;\n workflowModules: ReadonlyArray<Readonly<Record<string, unknown>>>;\n workflowSourcePaths: ReadonlyArray<string>;\n workflowDiscoveryPathSegmentsList?: ReadonlyArray<readonly string[]>;\n }>,\n ): CodemationConsumerApp {\n const rawConfig = this.configExportsResolver.resolveConfig(args.configModule);\n if (!rawConfig) {\n throw new Error(\"Consumer app module does not export a Codemation config object.\");\n }\n const config = this.configNormalizer.normalize(rawConfig);\n const discoveredWorkflows = this.resolveDiscoveredWorkflows(\n args.workflowModules,\n args.workflowSourcePaths,\n args.workflowDiscoveryPathSegmentsList,\n );\n return {\n config: {\n ...config,\n workflows: this.mergeWorkflows(config.workflows ?? [], discoveredWorkflows),\n },\n workflowSources: args.workflowSourcePaths,\n };\n }\n\n private resolveDiscoveredWorkflows(\n workflowModules: ReadonlyArray<Readonly<Record<string, unknown>>>,\n workflowSourcePaths: ReadonlyArray<string>,\n workflowDiscoveryPathSegmentsList: ReadonlyArray<readonly string[]> | undefined,\n ): ReadonlyArray<WorkflowDefinition> {\n const workflowsById = new Map<string, WorkflowDefinition>();\n workflowModules.forEach((workflowModule: Readonly<Record<string, unknown>>, index: number) => {\n const pathSegments = workflowDiscoveryPathSegmentsList?.[index];\n const workflows = this.workflowDefinitionExportsResolver.resolve(workflowModule);\n workflows.forEach((workflow: WorkflowDefinition) => {\n const enriched =\n pathSegments && pathSegments.length > 0\n ? ({ ...workflow, discoveryPathSegments: pathSegments } satisfies WorkflowDefinition)\n : workflow;\n workflowsById.set(workflow.id, enriched);\n });\n });\n if (workflowsById.size === 0 && workflowSourcePaths.length > 0) {\n throw new Error(this.discoveredWorkflowsEmptyMessageFactory.create(workflowSourcePaths));\n }\n return [...workflowsById.values()];\n }\n\n private mergeWorkflows(\n configuredWorkflows: ReadonlyArray<WorkflowDefinition>,\n discoveredWorkflows: ReadonlyArray<WorkflowDefinition>,\n ): ReadonlyArray<WorkflowDefinition> {\n const workflowsById = new Map<string, WorkflowDefinition>();\n for (const workflow of discoveredWorkflows) {\n workflowsById.set(workflow.id, workflow);\n }\n for (const workflow of configuredWorkflows) {\n workflowsById.set(workflow.id, workflow);\n }\n return [...workflowsById.values()];\n }\n}\n","import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport class WorkflowModulePathFinder {\n static readonly defaultWorkflowDirectories = [\"src/workflows\", \"workflows\"] as const;\n private readonly workflowExtensions = new Set([\".ts\", \".js\", \".mts\", \".mjs\"]);\n\n async discoverModulePaths(\n args: Readonly<{\n consumerRoot: string;\n workflowDirectories: ReadonlyArray<string> | undefined;\n exists: (absolutePath: string) => Promise<boolean>;\n }>,\n ): Promise<ReadonlyArray<string>> {\n const directories = args.workflowDirectories ?? WorkflowModulePathFinder.defaultWorkflowDirectories;\n const workflowModulePaths: string[] = [];\n for (const directory of directories) {\n const absoluteDirectory = path.resolve(args.consumerRoot, directory);\n if (!(await args.exists(absoluteDirectory))) {\n continue;\n }\n workflowModulePaths.push(...(await this.collectWorkflowModulePaths(absoluteDirectory)));\n }\n return workflowModulePaths;\n }\n\n private async collectWorkflowModulePaths(directoryPath: string): Promise<ReadonlyArray<string>> {\n const entries = await readdir(directoryPath, { withFileTypes: true });\n const workflowModulePaths: string[] = [];\n for (const entry of entries) {\n const entryPath = path.resolve(directoryPath, entry.name);\n if (entry.isDirectory()) {\n workflowModulePaths.push(...(await this.collectWorkflowModulePaths(entryPath)));\n continue;\n }\n if (this.isWorkflowModulePath(entryPath)) {\n workflowModulePaths.push(entryPath);\n }\n }\n return workflowModulePaths;\n }\n\n private isWorkflowModulePath(modulePath: string): boolean {\n const extension = path.extname(modulePath);\n if (!this.workflowExtensions.has(extension)) {\n return false;\n }\n const basename = path.basename(modulePath);\n if (basename.endsWith(\".d.ts\") || basename.endsWith(\".d.mts\")) {\n return false;\n }\n const withoutExt = basename.slice(0, -extension.length);\n if (withoutExt.endsWith(\".test\") || withoutExt.endsWith(\".spec\")) {\n return false;\n }\n return true;\n }\n}\n","import path from \"node:path\";\n\nimport { WorkflowModulePathFinder } from \"./WorkflowModulePathFinder\";\n\nexport class WorkflowDiscoveryPathSegmentsComputer {\n compute(\n args: Readonly<{\n consumerRoot: string;\n workflowDiscoveryDirectories: ReadonlyArray<string>;\n absoluteWorkflowModulePath: string;\n }>,\n ): readonly string[] | undefined {\n const normalizedConsumer = path.resolve(args.consumerRoot);\n const normalizedWorkflowPath = path.resolve(args.absoluteWorkflowModulePath);\n const directories =\n args.workflowDiscoveryDirectories.length > 0\n ? args.workflowDiscoveryDirectories\n : [...WorkflowModulePathFinder.defaultWorkflowDirectories];\n\n let bestRoot: string | null = null;\n for (const directory of directories) {\n const absoluteDirectory = path.resolve(normalizedConsumer, directory);\n const isPrefix =\n normalizedWorkflowPath === absoluteDirectory ||\n normalizedWorkflowPath.startsWith(`${absoluteDirectory}${path.sep}`);\n if (!isPrefix) {\n continue;\n }\n if (!bestRoot || absoluteDirectory.length > bestRoot.length) {\n bestRoot = absoluteDirectory;\n }\n }\n if (!bestRoot) {\n return undefined;\n }\n const relative = path.relative(bestRoot, normalizedWorkflowPath);\n if (relative.startsWith(\"..\") || path.isAbsolute(relative)) {\n return undefined;\n }\n if (relative.length === 0) {\n return undefined;\n }\n const parts = relative.split(path.sep).filter((segment) => segment.length > 0);\n if (parts.length === 0) {\n return undefined;\n }\n const lastIndex = parts.length - 1;\n const last = parts[lastIndex] ?? \"\";\n const ext = path.extname(last);\n parts[lastIndex] = ext ? last.slice(0, -ext.length) : last;\n return parts;\n }\n}\n","import type { WorkflowDefinition } from \"@codemation/core\";\nimport { access, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { NamespacedUnregister } from \"tsx/esm/api\";\nimport type { CodemationConfig } from \"../config/CodemationConfig\";\nimport { CodemationConfigNormalizer } from \"../config/CodemationConfigNormalizer\";\nimport type { NormalizedCodemationConfig } from \"../config/CodemationConfigNormalizer\";\nimport { BootTimer } from \"../../bootstrap/perf/BootTimer\";\nimport { logLevelPolicyFactory } from \"../../infrastructure/logging/LogLevelPolicyFactory\";\nimport { ServerLoggerFactory } from \"../../infrastructure/logging/ServerLoggerFactory\";\nimport { DiscoveredWorkflowsEmptyMessageFactory } from \"./DiscoveredWorkflowsEmptyMessageFactory\";\nimport { CodemationConsumerConfigExportsResolver } from \"./CodemationConsumerConfigExportsResolver\";\nimport { WorkflowDefinitionExportsResolver } from \"./WorkflowDefinitionExportsResolver\";\nimport { WorkflowDiscoveryPathSegmentsComputer } from \"./WorkflowDiscoveryPathSegmentsComputer\";\nimport { WorkflowModulePathFinder } from \"./WorkflowModulePathFinder\";\n\nexport type CodemationConsumerConfigResolution = Readonly<{\n config: NormalizedCodemationConfig;\n bootstrapSource: string | null;\n workflowSources: ReadonlyArray<string>;\n}>;\n\ntype ConsumerImportSession = Readonly<{\n shouldResetImporter: boolean;\n resetCacheKeys: Set<string>;\n}>;\n\nexport class CodemationConsumerConfigLoader {\n private static readonly importerRegistrationsByTsconfig = new Map<string, NamespacedUnregister>();\n private static readonly importerNamespaceVersionByTsconfig = new Map<string, number>();\n private readonly configExportsResolver = new CodemationConsumerConfigExportsResolver();\n private readonly configNormalizer = new CodemationConfigNormalizer();\n private readonly workflowModulePathFinder = new WorkflowModulePathFinder();\n private readonly workflowDefinitionExportsResolver = new WorkflowDefinitionExportsResolver();\n private readonly discoveredWorkflowsEmptyMessageFactory = new DiscoveredWorkflowsEmptyMessageFactory();\n private readonly pathSegmentsComputer = new WorkflowDiscoveryPathSegmentsComputer();\n private readonly performanceDiagnosticsLogger = new ServerLoggerFactory(\n logLevelPolicyFactory,\n ).createPerformanceDiagnostics(\"codemation-config-loader.timing\");\n private readonly bootLogger = new ServerLoggerFactory(logLevelPolicyFactory).create(\"codemation.boot\");\n /**\n * In-flight + completed load promises keyed by `${consumerRoot}|${configPathOverride}`. The\n * boot path constructs MULTIPLE CodemationConsumerConfigLoader instances (one inside the CLI's\n * DatabaseMigrationsApplyService, another inside NextHostEdgeSeedLoader, another inside\n * AppConfigLoader for the disposable runtime) and each independently calls `load(...)`. Without\n * a cache shared across instances, the same `${consumerRoot}` ends up importing\n * codemation.config.ts + discovered workflow modules ~3 times for a single dev boot. The cache\n * has to be static so it spans every loader instance in the process.\n *\n * Callers MUST invoke `invalidateAll()` on a source-change reload — the dev source watcher\n * already tears the runtime down and reboots; it just needs to clear this map first.\n */\n private static readonly resolutionCache = new Map<string, Promise<CodemationConsumerConfigResolution>>();\n\n static invalidateAll(): void {\n this.resolutionCache.clear();\n }\n\n async load(\n args: Readonly<{ consumerRoot: string; configPathOverride?: string }>,\n ): Promise<CodemationConsumerConfigResolution> {\n const cacheKey = `${args.consumerRoot}|${args.configPathOverride ?? \"\"}`;\n const cached = CodemationConsumerConfigLoader.resolutionCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n const promise = this.loadUncached(args);\n CodemationConsumerConfigLoader.resolutionCache.set(cacheKey, promise);\n try {\n return await promise;\n } catch (error) {\n // A failed load shouldn't poison the cache — future retries should re-attempt.\n CodemationConsumerConfigLoader.resolutionCache.delete(cacheKey);\n throw error;\n }\n }\n\n private async loadUncached(\n args: Readonly<{ consumerRoot: string; configPathOverride?: string }>,\n ): Promise<CodemationConsumerConfigResolution> {\n const loadStarted = performance.now();\n let mark = loadStarted;\n const importSession = this.createImportSession();\n const phaseDurations = new Map<string, number>();\n const phaseMs = (label: string): void => {\n const now = performance.now();\n const delta = now - mark;\n mark = now;\n phaseDurations.set(label, delta);\n this.performanceDiagnosticsLogger.info(\n `load.${label} +${delta.toFixed(1)}ms (cumulative ${(now - loadStarted).toFixed(1)}ms)`,\n );\n };\n const bootstrapSource = await BootTimer.measureAsync(\"config.resolveConfigPath\", () =>\n this.resolveConfigPath(args.consumerRoot, args.configPathOverride),\n );\n phaseMs(\"resolveConfigPath\");\n if (!bootstrapSource) {\n throw new Error(\n 'Codemation config not found. Expected \"codemation.config.ts\" in the consumer project root or \"src/\".',\n );\n }\n const moduleExports = await BootTimer.measureAsync(\"config.importConfigModule\", () =>\n this.importModule(bootstrapSource, importSession),\n );\n phaseMs(\"importConfigModule\");\n const rawConfig = this.configExportsResolver.resolveConfig(moduleExports);\n if (!rawConfig) {\n throw new Error(`Config file does not export a Codemation config object: ${bootstrapSource}`);\n }\n const config = this.configNormalizer.normalize(rawConfig);\n if (rawConfig.codemationVersion) {\n this.bootLogger.info(`codemationVersion: ${rawConfig.codemationVersion}`);\n }\n const workflowSources = await BootTimer.measureAsync(\"config.resolveWorkflowSources\", () =>\n this.resolveWorkflowSources(args.consumerRoot, config),\n );\n phaseMs(\"resolveWorkflowSources\");\n const workflows = await BootTimer.measureAsync(\"config.loadDiscoveredWorkflows\", async () =>\n this.mergeWorkflows(\n config.workflows ?? [],\n await this.loadDiscoveredWorkflows(args.consumerRoot, config, workflowSources, importSession),\n ),\n );\n phaseMs(\"loadDiscoveredWorkflows\");\n const resolvedConfig: NormalizedCodemationConfig = {\n ...config,\n workflows,\n };\n logLevelPolicyFactory.create().applyCodemationLogConfig(resolvedConfig.log);\n return {\n config: resolvedConfig,\n bootstrapSource,\n workflowSources,\n };\n }\n\n private async resolveConfigPath(\n consumerRoot: string,\n configPathOverride: string | undefined,\n ): Promise<string | null> {\n if (configPathOverride) {\n const explicitPath = path.isAbsolute(configPathOverride)\n ? configPathOverride\n : path.resolve(consumerRoot, configPathOverride);\n if (!(await this.exists(explicitPath))) {\n throw new Error(`Config file not found: ${explicitPath}`);\n }\n return explicitPath;\n }\n for (const candidate of this.getConventionCandidates(consumerRoot)) {\n if (await this.exists(candidate)) {\n return candidate;\n }\n }\n return null;\n }\n\n private getConventionCandidates(consumerRoot: string): ReadonlyArray<string> {\n return [\n path.resolve(consumerRoot, \"codemation.config.ts\"),\n path.resolve(consumerRoot, \"codemation.config.js\"),\n path.resolve(consumerRoot, \"src\", \"codemation.config.ts\"),\n path.resolve(consumerRoot, \"src\", \"codemation.config.js\"),\n ];\n }\n\n private async resolveWorkflowSources(consumerRoot: string, config: CodemationConfig): Promise<ReadonlyArray<string>> {\n if ((config.workflowDiscovery?.directories?.length ?? 0) === 0) {\n return [];\n }\n const discoveredPaths = await this.workflowModulePathFinder.discoverModulePaths({\n consumerRoot,\n workflowDirectories: config.workflowDiscovery?.directories,\n exists: (absolutePath) => this.exists(absolutePath),\n });\n return [...discoveredPaths].sort((left: string, right: string) => left.localeCompare(right));\n }\n\n private async loadDiscoveredWorkflows(\n consumerRoot: string,\n config: CodemationConfig,\n workflowSources: ReadonlyArray<string>,\n importSession: ConsumerImportSession,\n ): Promise<ReadonlyArray<WorkflowDefinition>> {\n const workflowDiscoveryDirectories = config.workflowDiscovery?.directories ?? [];\n const workflowsById = new Map<string, WorkflowDefinition>();\n const loadedWorkflowModules = await Promise.all(\n workflowSources.map(async (workflowSource: string) => ({\n workflowSource,\n segments: this.pathSegmentsComputer.compute({\n consumerRoot,\n workflowDiscoveryDirectories,\n absoluteWorkflowModulePath: workflowSource,\n }),\n moduleExports: await BootTimer.measureAsync(\n `workflow.${path.basename(workflowSource).replace(/\\.tsx?$/, \"\")}`,\n () => this.importModule(workflowSource, importSession),\n ),\n })),\n );\n for (const loadedWorkflowModule of loadedWorkflowModules) {\n for (const workflow of this.workflowDefinitionExportsResolver.resolve(loadedWorkflowModule.moduleExports)) {\n const enriched =\n loadedWorkflowModule.segments && loadedWorkflowModule.segments.length > 0\n ? ({ ...workflow, discoveryPathSegments: loadedWorkflowModule.segments } satisfies WorkflowDefinition)\n : workflow;\n workflowsById.set(workflow.id, enriched);\n }\n }\n if (workflowsById.size === 0 && workflowSources.length > 0) {\n throw new Error(this.discoveredWorkflowsEmptyMessageFactory.create(workflowSources));\n }\n return [...workflowsById.values()];\n }\n\n private mergeWorkflows(\n configuredWorkflows: ReadonlyArray<WorkflowDefinition>,\n discoveredWorkflows: ReadonlyArray<WorkflowDefinition>,\n ): ReadonlyArray<WorkflowDefinition> {\n const workflowsById = new Map<string, WorkflowDefinition>();\n for (const workflow of discoveredWorkflows) {\n workflowsById.set(workflow.id, workflow);\n }\n for (const workflow of configuredWorkflows) {\n workflowsById.set(workflow.id, workflow);\n }\n return [...workflowsById.values()];\n }\n\n private async importModule(\n modulePath: string,\n importSession: ConsumerImportSession,\n ): Promise<Record<string, unknown>> {\n if (this.shouldUseNativeRuntimeImport()) {\n return await this.importModuleWithNativeRuntime(modulePath);\n }\n const tsconfigPath = await this.resolveTsconfigPath(modulePath);\n const cacheKey = tsconfigPath || \"default\";\n const shouldResetImporter = importSession.shouldResetImporter;\n const didResetImporterForThisImport = shouldResetImporter && !importSession.resetCacheKeys.has(cacheKey);\n if (didResetImporterForThisImport) {\n await this.resetImporter(tsconfigPath);\n importSession.resetCacheKeys.add(cacheKey);\n }\n const importSpecifier = await this.createImportSpecifier(modulePath);\n for (let attempt = 0; attempt < 3; attempt += 1) {\n try {\n const importedModule = await (\n await this.getOrCreateImporter(tsconfigPath)\n ).import(importSpecifier, import.meta.url);\n return importedModule as Record<string, unknown>;\n } catch (error) {\n if (!this.isStoppedTransformServiceError(error) || attempt === 2) {\n throw error;\n }\n await this.resetImporter(tsconfigPath);\n }\n }\n throw new Error(`Failed to import consumer module after retries: ${modulePath}`);\n }\n\n private async importModuleWithNativeRuntime(modulePath: string): Promise<Record<string, unknown>> {\n const importedModule = await import(await this.createImportSpecifier(modulePath));\n return importedModule as Record<string, unknown>;\n }\n\n private async resolveTsconfigPath(modulePath: string): Promise<string | false> {\n const overridePath = process.env.CODEMATION_TSCONFIG_PATH;\n if (overridePath && (await this.exists(overridePath))) {\n return overridePath;\n }\n const discoveredPath = await this.findNearestTsconfig(modulePath);\n return discoveredPath ?? false;\n }\n\n private async getOrCreateImporter(tsconfigPath: string | false): Promise<NamespacedUnregister> {\n const cacheKey = tsconfigPath || \"default\";\n const existingImporter = CodemationConsumerConfigLoader.importerRegistrationsByTsconfig.get(cacheKey);\n if (existingImporter) {\n return existingImporter;\n }\n const { register } = await import(/* webpackIgnore: true */ this.resolveTsxImporterModuleSpecifier());\n const namespaceVersion = this.nextNamespaceVersion(cacheKey);\n const nextImporter = register({\n // A fresh namespace prevents cache hits from prior scoped imports after a dev rebuild.\n namespace: this.toNamespace(cacheKey, namespaceVersion),\n tsconfig: tsconfigPath,\n });\n CodemationConsumerConfigLoader.importerRegistrationsByTsconfig.set(cacheKey, nextImporter);\n return nextImporter;\n }\n\n private async resetImporter(tsconfigPath: string | false): Promise<void> {\n const cacheKey = tsconfigPath || \"default\";\n const existingImporter = CodemationConsumerConfigLoader.importerRegistrationsByTsconfig.get(cacheKey);\n if (!existingImporter) {\n return;\n }\n CodemationConsumerConfigLoader.importerRegistrationsByTsconfig.delete(cacheKey);\n await existingImporter.unregister().catch(() => null);\n }\n\n private nextNamespaceVersion(cacheKey: string): number {\n const nextVersion = (CodemationConsumerConfigLoader.importerNamespaceVersionByTsconfig.get(cacheKey) ?? 0) + 1;\n CodemationConsumerConfigLoader.importerNamespaceVersionByTsconfig.set(cacheKey, nextVersion);\n return nextVersion;\n }\n\n private toNamespace(cacheKey: string, namespaceVersion: number): string {\n return `codemation_consumer_${cacheKey.replace(/[^a-zA-Z0-9_-]+/g, \"_\")}_${namespaceVersion}`;\n }\n\n private resolveTsxImporterModuleSpecifier(): string {\n return [\"tsx\", \"esm\", \"api\"].join(\"/\");\n }\n\n private async findNearestTsconfig(modulePath: string): Promise<string | null> {\n let currentDirectory = path.dirname(modulePath);\n while (true) {\n const candidate = path.resolve(currentDirectory, \"tsconfig.json\");\n if (await this.exists(candidate)) {\n return candidate;\n }\n const parentDirectory = path.dirname(currentDirectory);\n if (parentDirectory === currentDirectory) {\n return null;\n }\n currentDirectory = parentDirectory;\n }\n }\n\n private async createImportSpecifier(modulePath: string): Promise<string> {\n const moduleUrl = pathToFileURL(modulePath);\n const moduleStats = await stat(modulePath);\n moduleUrl.searchParams.set(\"t\", String(moduleStats.mtimeMs));\n return moduleUrl.href;\n }\n\n private shouldUseNativeRuntimeImport(): boolean {\n return process.env.CODEMATION_TS_RUNTIME === \"ts-node\";\n }\n\n private shouldResetImporterBeforeImport(): boolean {\n return (process.env.CODEMATION_DEV_SERVER_TOKEN?.trim().length ?? 0) > 0;\n }\n\n private createImportSession(): ConsumerImportSession {\n return {\n resetCacheKeys: new Set<string>(),\n shouldResetImporter: this.shouldResetImporterBeforeImport(),\n };\n }\n\n private isStoppedTransformServiceError(error: unknown): boolean {\n return error instanceof Error && error.message.includes(\"The service is no longer running\");\n }\n\n private async exists(filePath: string): Promise<boolean> {\n try {\n await access(filePath);\n return true;\n } catch {\n return false;\n }\n }\n}\n"],"mappings":";;;;;;;;AA0BA,IAAa,6BAAb,MAAwC;CACtC,UAAU,QAAsD;EAC9D,MAAM,OAAO,OAAO,KAAK,QAAQ,OAAO;AACxC,OAAK,iBAAiB,KAAK;AAC3B,OAAK,6BAA6B,QAAQ,KAAK;EAC/C,MAAM,YAAY,KAAK,oBAAoB,OAAO;EAClD,MAAM,oBAAoB,KAAK,uBAAuB,OAAO;EAC7D,MAAM,yCAAyC,CAC7C,GAAI,OAAO,mBAAmB,eAAe,EAAE,EAC/C,GAAG,UAAU,oBACd;AAED,SAAO;GACL,GAAG;GACH;GACA,wBAAwB,UA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AC9D,SAAO,iBAAiB,SAAS,MAAM,QAAQ,SAAS,mCAAmC;;CAG7F,MAAc,OAAO,UAAoC;AACvD,MAAI;AACF,SAAM,OAAO,SAAS;AACtB,UAAO;UACD;AACN,UAAO"}
@@ -1,4 +1,4 @@
1
- import { t as NormalizedCodemationConfig } from "./CodemationConfigNormalizer-BAKjetJ6.js";
1
+ import { t as NormalizedCodemationConfig } from "./CodemationConfigNormalizer-B4rDYC9h.js";
2
2
 
3
3
  //#region src/presentation/server/CodemationConsumerAppResolver.d.ts
4
4
  type CodemationConsumerApp = Readonly<{
@@ -36,6 +36,7 @@ declare class CodemationConsumerConfigLoader {
36
36
  private readonly discoveredWorkflowsEmptyMessageFactory;
37
37
  private readonly pathSegmentsComputer;
38
38
  private readonly performanceDiagnosticsLogger;
39
+ private readonly bootLogger;
39
40
  /**
40
41
  * In-flight + completed load promises keyed by `${consumerRoot}|${configPathOverride}`. The
41
42
  * boot path constructs MULTIPLE CodemationConsumerConfigLoader instances (one inside the CLI's
@@ -78,4 +79,4 @@ declare class CodemationConsumerConfigLoader {
78
79
  }
79
80
  //#endregion
80
81
  export { CodemationConsumerAppResolver as i, CodemationConsumerConfigResolution as n, CodemationConsumerApp as r, CodemationConsumerConfigLoader as t };
81
- //# sourceMappingURL=CodemationConsumerConfigLoader-nxOqvv46.d.ts.map
82
+ //# sourceMappingURL=CodemationConsumerConfigLoader-Dt4jyLx6.d.ts.map
@@ -1,13 +1,14 @@
1
- import { c as Clock, i as CollectionDefinition, r as Engine, t as OAuthFlowExecutor } from "./index-DilAYwnH.js";
2
- import { $ as PersistedRunState, A as WorkflowRunDetailDto, G as PersistedRunPolicySnapshot, K as RunId, T as McpServerDeclaration, X as WorkflowDefinition, b as TestCaseRunStatus, d as NodeExecutionRequestHandler, f as NodeExecutionScheduler, g as TypeToken, h as Container, kt as WorkflowId, o as BinaryStorage, p as WorkflowRepository, rt as RunPruneCandidate, st as RunSummary, tt as RunCurrentState, ut as AnyCredentialType, v as RunEvent, w as WorkflowActivationPolicy, y as RunEventBus } from "./ItemsInputNormalizer-_RwIfRIQ.js";
3
- import { C as CodemationContainerRegistration, l as CodemationPluginPackageMetadata, o as CodemationPlugin, r as AppConfig } from "./CodemationAppContext-CKVv9W9q.js";
1
+ import { a as CollectionDefinition, i as Engine, n as OAuthFlowExecutor, s as Clock, t as CredentialMaterialProvider } from "./index-ChIfeWzk.js";
2
+ import { A as WorkflowDefinition, E as RunId, F as RunCurrentState, G as TypeToken, J as RunEventBus, L as RunPruneCandidate, N as PersistedRunState, T as PersistedRunPolicySnapshot, Tt as WorkflowRunDetailDto, V as RunSummary, W as Container, Y as TestCaseRunStatus, a as BinaryStorage, d as NodeExecutionScheduler, jt as WorkflowId, nt as McpServerDeclaration, p as WorkflowRepository, q as RunEvent, rt as AnyCredentialType, tt as WorkflowActivationPolicy, u as NodeExecutionRequestHandler } from "./ItemsInputNormalizer-CFkfNMLt.js";
3
+ import { C as CodemationContainerRegistration, l as CodemationPluginPackageMetadata, o as CodemationPlugin, r as AppConfig } from "./CodemationAppContext-K51b7oXe.js";
4
4
  import { a as CodemationAuthConfig, l as Logger, t as CodemationWhitelabelConfig, u as LoggerFactory } from "./CodemationWhitelabelConfig-Ca2mCUeC.js";
5
5
  import { t as LogLevelPolicyFactory } from "./LogLevelPolicyFactory-ewCHLDLn.js";
6
- import { t as CredentialStore } from "./CredentialServices-Be2I60Th.js";
7
- import { i as TelemetryMetricPointStore, n as TelemetryArtifactStore, o as TelemetrySpanStore, r as TelemetryExporter, s as TelemetrySpanUpsert, t as RunTraceContextRepository } from "./TelemetryContracts-BtDx84Cp.js";
8
- import { n as PrismaMigrationDeployer, r as PrismaDatabaseClient } from "./AppConfigFactory-DnLoQ9Li.js";
9
- import { s as ProcessRunner } from "./PublicFrontendBootstrapFactory-CY2FS-5g.js";
6
+ import { t as CredentialStore } from "./CredentialServices-B3wPyp2y.js";
7
+ import { i as TelemetryMetricPointStore, n as TelemetryArtifactStore, o as TelemetrySpanStore, r as TelemetryExporter, s as TelemetrySpanUpsert, t as RunTraceContextRepository } from "./TelemetryContracts-DpZEODQM.js";
8
+ import { n as PrismaDatabaseClient } from "./AppConfigFactory-DncmwCD1.js";
9
+ import { t as PrismaMigrationDeployer } from "./PrismaMigrationDeployer-DdEcXXVi.js";
10
10
  import { t as InternalHonoApiRouteRegistrar } from "./InternalHonoApiRouteRegistrar-Ce1yxpnO.js";
11
+ import { s as ProcessRunner } from "./PublicFrontendBootstrapFactory-ClEjZP74.js";
11
12
  import "reflect-metadata";
12
13
  import { Hono, MiddlewareHandler } from "hono";
13
14
  import "jose";
@@ -600,6 +601,52 @@ interface SessionVerifier {
600
601
  verify(request: Request): Promise<AuthenticatedPrincipal | null>;
601
602
  }
602
603
  //#endregion
604
+ //#region src/presentation/http/ServerHttpRouteParams.d.ts
605
+ type ServerHttpRouteParams = Readonly<Record<string, string>>;
606
+ //#endregion
607
+ //#region src/presentation/http/routeHandlers/BinaryHttpRouteHandlerFactory.d.ts
608
+ declare class BinaryHttpRouteHandler {
609
+ private readonly queryBus;
610
+ private readonly commandBus;
611
+ private readonly binaryStorage;
612
+ constructor(queryBus: QueryBus, commandBus: CommandBus, binaryStorage: BinaryStorage);
613
+ getRunBinaryContent(_: Request, params: ServerHttpRouteParams): Promise<Response>;
614
+ getWorkflowOverlayBinaryContent(_: Request, params: ServerHttpRouteParams): Promise<Response>;
615
+ postWorkflowDebuggerOverlayBinaryUpload(request: Request, params: ServerHttpRouteParams): Promise<Response>;
616
+ private createBinaryResponse;
617
+ private createContentDisposition;
618
+ private escapeFilename;
619
+ }
620
+ //#endregion
621
+ //#region src/presentation/http/hono/HonoApiRouteRegistrar.d.ts
622
+ interface HonoApiRouteRegistrar {
623
+ register(app: Hono): void;
624
+ }
625
+ //#endregion
626
+ //#region src/auth/managed/ManagedCorsMiddleware.d.ts
627
+ /**
628
+ * CORS allowlist middleware for managed mode.
629
+ *
630
+ * `CP_WEB_ORIGIN` (provisioner-injected) is a comma-separated allowlist of the
631
+ * browser origins the CP UI may be served from — e.g. the Caddy origin and the
632
+ * direct dev port. The request's own origin is echoed back only when it is a
633
+ * member; all other origins are refused on preflight with a 403.
634
+ */
635
+ declare class ManagedCorsMiddleware {
636
+ private readonly allowedOrigins;
637
+ constructor(allowedOrigin: string);
638
+ private isAllowed;
639
+ handle(): MiddlewareHandler;
640
+ }
641
+ //#endregion
642
+ //#region src/presentation/http/hono/CodemationHonoApiAppFactory.d.ts
643
+ declare class CodemationHonoApiApp {
644
+ private readonly app;
645
+ constructor(sessionVerifier: SessionVerifier, registrars: ReadonlyArray<HonoApiRouteRegistrar>, binaryHttpRouteHandler: BinaryHttpRouteHandler, internalRegistrars: ReadonlyArray<InternalHonoApiRouteRegistrar>, corsMiddlewareList: ReadonlyArray<ManagedCorsMiddleware>);
646
+ getHono(): Hono;
647
+ fetch(request: Request): Response | Promise<Response>;
648
+ }
649
+ //#endregion
603
650
  //#region src/application/bus/CommandHandler.d.ts
604
651
  declare abstract class CommandHandler<TCommand extends Command<TResult>, TResult> {
605
652
  abstract execute(command: TCommand): Promise<TResult>;
@@ -642,24 +689,6 @@ interface WorkflowDebuggerOverlayRepository {
642
689
  save(state: WorkflowDebuggerOverlayState): Promise<void>;
643
690
  }
644
691
  //#endregion
645
- //#region src/presentation/http/hono/HonoApiRouteRegistrar.d.ts
646
- interface HonoApiRouteRegistrar {
647
- register(app: Hono): void;
648
- }
649
- //#endregion
650
- //#region src/auth/managed/ManagedCorsMiddleware.d.ts
651
- /**
652
- * CORS allowlist middleware for managed mode.
653
- *
654
- * Only the single `CP_WEB_ORIGIN` value (provisioner-injected) is permitted.
655
- * All other origins are refused on preflight with a 403.
656
- */
657
- declare class ManagedCorsMiddleware {
658
- private readonly allowedOrigin;
659
- constructor(allowedOrigin: string);
660
- handle(): MiddlewareHandler;
661
- }
662
- //#endregion
663
692
  //#region src/audit/IAuditEmitter.d.ts
664
693
  /**
665
694
  * Workspace-local audit emitter contract.
@@ -732,6 +761,14 @@ declare const ApplicationTokens: {
732
761
  readonly WorkflowAuditEmitter: TypeToken<IWorkflowAuditEmitter>;
733
762
  readonly ProcessRunner: TypeToken<ProcessRunner>;
734
763
  readonly OAuthFlowExecutor: TypeToken<OAuthFlowExecutor>;
764
+ /**
765
+ * The provider that `CachingCredentialMaterialProvider` wraps. Bound to
766
+ * `LocalCredentialMaterialProvider` in standalone mode and to
767
+ * `CompositeCredentialMaterialProvider` in managed mode (which dispatches
768
+ * by `ref.source`). See `packages/host/src/credentials/` and
769
+ * `planning/sprints/credentials-vault/02-controlplane-material-provider.md`.
770
+ */
771
+ readonly CredentialMaterialInnerProvider: TypeToken<CredentialMaterialProvider>;
735
772
  };
736
773
  //#endregion
737
774
  //#region src/bootstrap/CodemationBootstrapRequest.d.ts
@@ -763,5 +800,5 @@ declare class CodemationPluginListMerger {
763
800
  private tryAdd;
764
801
  }
765
802
  //#endregion
766
- export { Command as S, AppContainerFactory as _, HonoApiRouteRegistrar as a, Query as b, WorkerRuntime as c, ServerLoggerFactory as d, LogFilter as f, AppContainerLifecycle as g, DatabaseMigrations as h, ManagedCorsMiddleware as i, FrontendRuntime as l, CollectionSchemaSyncerHolder as m, CodemationBootstrapRequest as n, WorkflowDebuggerOverlayRepository as o, WorkflowRunRepository as p, ApplicationTokens as r, SessionVerifier as s, CodemationPluginListMerger as t, WorkflowRunRetentionPruneScheduler as u, WorkflowWebsocketServer as v, CommandBus as x, QueryBus as y };
767
- //# sourceMappingURL=CodemationPluginListMerger-DKLAHT2b.d.ts.map
803
+ export { Command as C, CommandBus as S, AppContainerLifecycle as _, CodemationHonoApiApp as a, QueryBus as b, SessionVerifier as c, WorkflowRunRetentionPruneScheduler as d, ServerLoggerFactory as f, DatabaseMigrations as g, CollectionSchemaSyncerHolder as h, WorkflowDebuggerOverlayRepository as i, WorkerRuntime as l, WorkflowRunRepository as m, CodemationBootstrapRequest as n, BinaryHttpRouteHandler as o, LogFilter as p, ApplicationTokens as r, ServerHttpRouteParams as s, CodemationPluginListMerger as t, FrontendRuntime as u, AppContainerFactory as v, Query as x, WorkflowWebsocketServer as y };
804
+ //# sourceMappingURL=CodemationPluginListMerger-DS6I3Xe0.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { i as __toESM } from "./chunk-7V6ThxGB.js";
2
- import { a as require_client } from "./AppConfigFactory-Cx4qQvRk.js";
2
+ import { a as require_client } from "./AppConfigFactory-D4LL1aOR.js";
3
3
  import { PrismaPg } from "@prisma/adapter-pg";
4
4
 
5
5
  //#region src/infrastructure/persistence/CodemationPostgresPrismaClientFactory.ts
@@ -12,4 +12,4 @@ var CodemationPostgresPrismaClientFactory = class {
12
12
 
13
13
  //#endregion
14
14
  export { CodemationPostgresPrismaClientFactory as t };
15
- //# sourceMappingURL=persistenceServer-C-hH4z6l.js.map
15
+ //# sourceMappingURL=CodemationPostgresPrismaClientFactory-C7156Fe-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodemationPostgresPrismaClientFactory-C7156Fe-.js","names":["PrismaClient"],"sources":["../src/infrastructure/persistence/CodemationPostgresPrismaClientFactory.ts"],"sourcesContent":["import { PrismaPg } from \"@prisma/adapter-pg\";\nimport { PrismaClient } from \"../../../prisma-generated/prisma-postgresql-client/client.js\";\n\nexport class CodemationPostgresPrismaClientFactory {\n static create(databaseUrl: string): PrismaClient {\n const adapter = new PrismaPg({ connectionString: databaseUrl });\n return new PrismaClient({ adapter });\n }\n}\n"],"mappings":";;;;;;AAGA,IAAa,wCAAb,MAAmD;CACjD,OAAO,OAAO,aAAmC;AAE/C,SAAO,IAAIA,2BAAa,EAAE,SADV,IAAI,SAAS,EAAE,kBAAkB,aAAa,CAAC,EAC5B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { r as PrismaClient } from "./AppConfigFactory-DncmwCD1.js";
2
+
3
+ //#region src/infrastructure/persistence/CodemationPostgresPrismaClientFactory.d.ts
4
+ declare class CodemationPostgresPrismaClientFactory {
5
+ static create(databaseUrl: string): PrismaClient;
6
+ }
7
+ //#endregion
8
+ export { CodemationPostgresPrismaClientFactory as t };
9
+ //# sourceMappingURL=CodemationPostgresPrismaClientFactory-CTNTPnDr.d.ts.map
@@ -1,4 +1,4 @@
1
- import { Ct as CredentialSetupStatus, Et as CredentialTypeId, bt as CredentialRequirement, ht as CredentialInstanceId, mt as CredentialHealth, vt as CredentialMaterialSourceKind } from "./ItemsInputNormalizer-_RwIfRIQ.js";
1
+ import { ct as CredentialInstanceId, dt as CredentialMaterialSourceKind, gt as CredentialSetupStatus, pt as CredentialRequirement, st as CredentialHealth, yt as CredentialTypeId } from "./ItemsInputNormalizer-CFkfNMLt.js";
2
2
 
3
3
  //#region src/application/contracts/CredentialContractsRegistry.d.ts
4
4
  type CredentialInstanceDto = Readonly<{
@@ -65,6 +65,19 @@ type UpsertCredentialBindingRequest = Readonly<{
65
65
  slotKey: string;
66
66
  instanceId: CredentialInstanceId;
67
67
  }>;
68
+ type AppGalleryEntry = Readonly<{
69
+ mcpId: string;
70
+ displayName: string;
71
+ description: string;
72
+ iconUrl: string | null;
73
+ acceptedCredentialTypes: ReadonlyArray<string>;
74
+ primaryOAuthTypeId: string | null;
75
+ instances: ReadonlyArray<CredentialInstanceDto>;
76
+ }>;
77
+ type AppsResponse = Readonly<{
78
+ apps: ReadonlyArray<AppGalleryEntry>;
79
+ customInstances: ReadonlyArray<CredentialInstanceDto>;
80
+ }>;
68
81
  //#endregion
69
- export { UpdateCredentialInstanceRequest as a, WorkflowCredentialHealthSlotDto as c, CredentialOAuth2ConnectionDto as i, CredentialInstanceDto as n, UpsertCredentialBindingRequest as o, CredentialInstanceWithSecretsDto as r, WorkflowCredentialHealthDto as s, CreateCredentialInstanceRequest as t };
70
- //# sourceMappingURL=CredentialContractsRegistry-Bq2bq28t.d.ts.map
82
+ export { CredentialInstanceWithSecretsDto as a, UpsertCredentialBindingRequest as c, CredentialInstanceDto as i, WorkflowCredentialHealthDto as l, AppsResponse as n, CredentialOAuth2ConnectionDto as o, CreateCredentialInstanceRequest as r, UpdateCredentialInstanceRequest as s, AppGalleryEntry as t, WorkflowCredentialHealthSlotDto as u };
83
+ //# sourceMappingURL=CredentialContractsRegistry-Dgu-rEXi.d.ts.map
@@ -1,7 +1,7 @@
1
- import { Dt as CredentialTypeRegistry, Et as CredentialTypeId, St as CredentialSessionService, T as McpServerDeclaration, Tt as CredentialTypeDefinition, X as WorkflowDefinition, _t as CredentialJsonRecord, bt as CredentialRequirement, dt as CredentialBinding, ft as CredentialBindingKey, gt as CredentialInstanceRecord, ht as CredentialInstanceId, mt as CredentialHealth, p as WorkflowRepository, pt as CredentialFieldSchema, ut as AnyCredentialType, wt as CredentialType, yt as CredentialOAuth2AuthDefinition } from "./ItemsInputNormalizer-_RwIfRIQ.js";
2
- import { r as AppConfig } from "./CodemationAppContext-CKVv9W9q.js";
1
+ import { A as WorkflowDefinition, _t as CredentialType, at as CredentialBindingKey, bt as CredentialTypeRegistry, ct as CredentialInstanceId, ft as CredentialOAuth2AuthDefinition, ht as CredentialSessionService, it as CredentialBinding, lt as CredentialInstanceRecord, nt as McpServerDeclaration, ot as CredentialFieldSchema, p as WorkflowRepository, pt as CredentialRequirement, rt as AnyCredentialType, st as CredentialHealth, ut as CredentialJsonRecord, vt as CredentialTypeDefinition, yt as CredentialTypeId } from "./ItemsInputNormalizer-CFkfNMLt.js";
2
+ import { r as AppConfig } from "./CodemationAppContext-K51b7oXe.js";
3
3
  import { u as LoggerFactory } from "./CodemationWhitelabelConfig-Ca2mCUeC.js";
4
- import { a as UpdateCredentialInstanceRequest, n as CredentialInstanceDto, r as CredentialInstanceWithSecretsDto, s as WorkflowCredentialHealthDto, t as CreateCredentialInstanceRequest } from "./CredentialContractsRegistry-Bq2bq28t.js";
4
+ import { a as CredentialInstanceWithSecretsDto, i as CredentialInstanceDto, l as WorkflowCredentialHealthDto, r as CreateCredentialInstanceRequest, s as UpdateCredentialInstanceRequest } from "./CredentialContractsRegistry-Dgu-rEXi.js";
5
5
 
6
6
  //#region src/domain/credentials/CredentialTypeRegistryImpl.d.ts
7
7
  type CredentialTypeSource = "plugin" | "config" | "controlPlane";
@@ -284,4 +284,4 @@ type MutableCredentialSessionService = CredentialSessionService & Readonly<{
284
284
  }>;
285
285
  //#endregion
286
286
  export { CredentialSecretCipher as a, CredentialInstanceService as i, CredentialType$1 as n, McpServerCatalog as o, CredentialBindingService as r, CredentialStore as t };
287
- //# sourceMappingURL=CredentialServices-Be2I60Th.d.ts.map
287
+ //# sourceMappingURL=CredentialServices-B3wPyp2y.d.ts.map
@@ -154,7 +154,8 @@ const ApplicationTokens = {
154
154
  Clock: Symbol.for("codemation.application.Clock"),
155
155
  WorkflowAuditEmitter: Symbol.for("codemation.application.WorkflowAuditEmitter"),
156
156
  ProcessRunner: Symbol.for("codemation.application.ProcessRunner"),
157
- OAuthFlowExecutor: Symbol.for("codemation.application.OAuthFlowExecutor")
157
+ OAuthFlowExecutor: Symbol.for("codemation.application.OAuthFlowExecutor"),
158
+ CredentialMaterialInnerProvider: Symbol.for("codemation.application.CredentialMaterialInnerProvider")
158
159
  };
159
160
 
160
161
  //#endregion
@@ -744,8 +745,9 @@ let CredentialInstanceService = class CredentialInstanceService$1 {
744
745
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
745
746
  const strippedPublic = this.stripEnvManagedFieldValues(publicFields, request.publicConfig ?? {});
746
747
  const strippedSecretForRef = this.stripEnvManagedFieldValues(secretFields, request.secretConfig ?? {});
748
+ const instanceId = randomUUID();
747
749
  const instance = {
748
- instanceId: randomUUID(),
750
+ instanceId,
749
751
  typeId: request.typeId,
750
752
  displayName: request.displayName.trim(),
751
753
  sourceKind: request.sourceKind,
@@ -754,7 +756,11 @@ let CredentialInstanceService = class CredentialInstanceService$1 {
754
756
  tags: Object.freeze([...request.tags ?? []]),
755
757
  setupStatus: credentialType.definition.auth?.kind === "oauth2" ? "draft" : "ready",
756
758
  createdAt: timestamp,
757
- updatedAt: timestamp
759
+ updatedAt: timestamp,
760
+ material: {
761
+ source: "local",
762
+ ref: instanceId
763
+ }
758
764
  };
759
765
  await this.credentialStore.saveInstance({
760
766
  instance,
@@ -1271,4 +1277,4 @@ CredentialTestService = __decorate([
1271
1277
 
1272
1278
  //#endregion
1273
1279
  export { CredentialInstanceService as a, CredentialSecretCipher as c, McpServerCatalog as d, ApplicationRequestError as f, OpenAiApiKeyCredentialHealthTester as g, OpenAiApiKeyCredentialTypeFactory as h, CredentialBindingService as i, CredentialFieldEnvOverlayService as l, ApplicationTokens as m, CredentialSessionServiceImpl as n, CredentialOAuth2ScopeResolver as o, CredentialTypeRegistryImpl as p, CredentialRuntimeMaterialService as r, CredentialMaterialResolver as s, CredentialTestService as t, WorkflowCredentialNodeResolver as u };
1274
- //# sourceMappingURL=CredentialServices-Dk8yypeL.js.map
1280
+ //# sourceMappingURL=CredentialServices-Bios0dM8.js.map