@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
@@ -0,0 +1,14 @@
1
+ import { i as AppPersistenceConfig } from "./CodemationAppContext-K51b7oXe.js";
2
+
3
+ //#region src/infrastructure/persistence/PrismaMigrationDeployer.d.ts
4
+ declare class PrismaMigrationDeployer {
5
+ deployPersistence(persistence: AppPersistenceConfig, env?: Readonly<NodeJS.ProcessEnv>): Promise<void>;
6
+ deploy(args: Readonly<{
7
+ databaseUrl: string;
8
+ env?: Readonly<NodeJS.ProcessEnv>;
9
+ }>): Promise<void>;
10
+ resolvePackageRoot(env?: Readonly<NodeJS.ProcessEnv>): Promise<string>;
11
+ }
12
+ //#endregion
13
+ export { PrismaMigrationDeployer as t };
14
+ //# sourceMappingURL=PrismaMigrationDeployer-DdEcXXVi.d.ts.map
@@ -1,4 +1,4 @@
1
- import { r as AppConfig } from "./CodemationAppContext-CKVv9W9q.js";
1
+ import { r as AppConfig } from "./CodemationAppContext-K51b7oXe.js";
2
2
  import { a as CodemationAuthConfig } from "./CodemationWhitelabelConfig-Ca2mCUeC.js";
3
3
  import { a as CodemationFrontendAuthSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-Cev3qK46.js";
4
4
  import { ChildProcess } from "node:child_process";
@@ -79,4 +79,4 @@ declare class PublicFrontendBootstrapFactory {
79
79
  }
80
80
  //#endregion
81
81
  export { ProcessRunOptions as a, CodemationFrontendAuthSnapshotFactory as i, InternalAuthBootstrapFactory as n, ProcessRunResult as o, FrontendAppConfigFactory as r, ProcessRunner as s, PublicFrontendBootstrapFactory as t };
82
- //# sourceMappingURL=PublicFrontendBootstrapFactory-CY2FS-5g.d.ts.map
82
+ //# sourceMappingURL=PublicFrontendBootstrapFactory-ClEjZP74.d.ts.map
@@ -44,6 +44,7 @@ declare class ApiPaths {
44
44
  static credentialTypes(): string;
45
45
  static credentialsEnvStatus(): string;
46
46
  static credentialInstances(): string;
47
+ static credentialApps(): string;
47
48
  static credentialInstance(instanceId: string, withSecrets?: boolean): string;
48
49
  static credentialInstanceTest(instanceId: string): string;
49
50
  static credentialBindings(): string;
@@ -82,6 +83,10 @@ declare class ApiPaths {
82
83
  static whitelabelLogo(): string;
83
84
  static frontendBootstrap(): string;
84
85
  static internalAuthBootstrap(): string;
86
+ /** Token-authenticated: resume a suspended HITL task. */
87
+ static hitlTaskResume(taskId: string): string;
88
+ /** Session-authenticated: record a decision on a suspended HITL task. */
89
+ static hitlTaskDecide(taskId: string): string;
85
90
  }
86
91
  //#endregion
87
92
  //#region src/presentation/frontend/CodemationFrontendAuthSnapshotJsonCodec.d.ts
@@ -116,4 +121,4 @@ declare class PublicFrontendBootstrapJsonCodec {
116
121
  }
117
122
  //#endregion
118
123
  export { ApiPaths as a, CodemationFrontendAuthSnapshotJsonCodec as i, InternalAuthBootstrapJsonCodec as n, FrontendAppConfigJsonCodec as r, PublicFrontendBootstrapJsonCodec as t };
119
- //# sourceMappingURL=PublicFrontendBootstrapJsonCodec-CXG9Dxft.d.ts.map
124
+ //# sourceMappingURL=PublicFrontendBootstrapJsonCodec-HNItQ7ol.d.ts.map
@@ -1,4 +1,4 @@
1
- import { M as TelemetryAttributes, N as TelemetryMetricRecord, P as TelemetrySpanEventRecord, j as TelemetryArtifactAttachment } from "./ItemsInputNormalizer-_RwIfRIQ.js";
1
+ import { Dt as TelemetryAttributes, Et as TelemetryArtifactAttachment, Ot as TelemetryMetricRecord, kt as TelemetrySpanEventRecord } from "./ItemsInputNormalizer-CFkfNMLt.js";
2
2
 
3
3
  //#region src/domain/telemetry/TelemetryContracts.d.ts
4
4
  type TelemetrySpanStatus = "running" | "completed" | "failed";
@@ -204,4 +204,4 @@ interface TelemetryExporter {
204
204
  }
205
205
  //#endregion
206
206
  export { TelemetrySpanStatus as a, TelemetryMetricPointStore as i, TelemetryArtifactStore as n, TelemetrySpanStore as o, TelemetryExporter as r, TelemetrySpanUpsert as s, RunTraceContextRepository as t };
207
- //# sourceMappingURL=TelemetryContracts-BtDx84Cp.d.ts.map
207
+ //# sourceMappingURL=TelemetryContracts-DpZEODQM.d.ts.map
@@ -1,4 +1,4 @@
1
- import { V as NodeDefinition, X as WorkflowDefinition } from "./ItemsInputNormalizer-_RwIfRIQ.js";
1
+ import { A as WorkflowDefinition, x as NodeDefinition } from "./ItemsInputNormalizer-CFkfNMLt.js";
2
2
 
3
3
  //#region src/application/mapping/WorkflowPolicyUiPresentationFactory.d.ts
4
4
  /** UI-facing policy labels derived from workflow/node definitions (live or hydrated snapshot). */
@@ -12,4 +12,4 @@ declare class WorkflowPolicyUiPresentationFactory {
12
12
  }
13
13
  //#endregion
14
14
  export { WorkflowPolicyUiPresentationFactory as t };
15
- //# sourceMappingURL=WorkflowPolicyUiPresentationFactory-6MyjCvBO.d.ts.map
15
+ //# sourceMappingURL=WorkflowPolicyUiPresentationFactory-BNn2fvR_.d.ts.map
@@ -32,4 +32,4 @@ var WorkflowPolicyUiPresentationFactory = class {
32
32
 
33
33
  //#endregion
34
34
  export { WorkflowPolicyUiPresentationFactory as t };
35
- //# sourceMappingURL=WorkflowPolicyUiPresentationFactory-Bb-ae_Zh.js.map
35
+ //# sourceMappingURL=WorkflowPolicyUiPresentationFactory-DfvD2VHk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WorkflowPolicyUiPresentationFactory-Bb-ae_Zh.js","names":[],"sources":["../src/application/mapping/WorkflowPolicyUiPresentationFactory.ts"],"sourcesContent":["import type { NodeDefinition, RetryPolicySpec, WorkflowDefinition } from \"@codemation/core/browser\";\n\n/** UI-facing policy labels derived from workflow/node definitions (live or hydrated snapshot). */\nexport class WorkflowPolicyUiPresentationFactory {\n workflowHasErrorHandler(workflow: WorkflowDefinition): boolean {\n return workflow.workflowErrorHandler !== undefined;\n }\n\n nodeRetrySummary(config: NodeDefinition[\"config\"]): string | undefined {\n const spec = config.retryPolicy as RetryPolicySpec | undefined;\n if (!spec) return undefined;\n if (spec.kind === \"none\") return \"Retry: off\";\n if (spec.kind === \"fixed\") return `Retry: ${spec.maxAttempts}x @ ${spec.delayMs}ms`;\n if (spec.kind === \"exponential\") {\n const jitter = spec.jitter ? \", jitter\" : \"\";\n return `Retry: exp ${spec.maxAttempts}x from ${spec.initialDelayMs}ms (x${spec.multiplier}${jitter})`;\n }\n return undefined;\n }\n\n nodeHasErrorHandler(config: NodeDefinition[\"config\"]): boolean {\n return config.nodeErrorHandler !== undefined;\n }\n\n snapshotNodeRetrySummary(config: unknown): string | undefined {\n const record = this.asRecord(config);\n const spec = record.retryPolicy as RetryPolicySpec | undefined;\n if (!spec || typeof spec !== \"object\") return undefined;\n return this.nodeRetrySummary({ retryPolicy: spec } as NodeDefinition[\"config\"]);\n }\n\n snapshotNodeHasErrorHandler(config: unknown): boolean {\n return this.asRecord(config).nodeErrorHandler !== undefined;\n }\n\n private asRecord(value: unknown): Readonly<Record<string, unknown>> {\n return value !== null && typeof value === \"object\" ? (value as Record<string, unknown>) : {};\n }\n}\n"],"mappings":";;AAGA,IAAa,sCAAb,MAAiD;CAC/C,wBAAwB,UAAuC;AAC7D,SAAO,SAAS,yBAAyB;;CAG3C,iBAAiB,QAAsD;EACrE,MAAM,OAAO,OAAO;AACpB,MAAI,CAAC,KAAM,QAAO;AAClB,MAAI,KAAK,SAAS,OAAQ,QAAO;AACjC,MAAI,KAAK,SAAS,QAAS,QAAO,UAAU,KAAK,YAAY,MAAM,KAAK,QAAQ;AAChF,MAAI,KAAK,SAAS,eAAe;GAC/B,MAAM,SAAS,KAAK,SAAS,aAAa;AAC1C,UAAO,cAAc,KAAK,YAAY,SAAS,KAAK,eAAe,OAAO,KAAK,aAAa,OAAO;;;CAKvG,oBAAoB,QAA2C;AAC7D,SAAO,OAAO,qBAAqB;;CAGrC,yBAAyB,QAAqC;EAE5D,MAAM,OADS,KAAK,SAAS,OAAO,CAChB;AACpB,MAAI,CAAC,QAAQ,OAAO,SAAS,SAAU,QAAO;AAC9C,SAAO,KAAK,iBAAiB,EAAE,aAAa,MAAM,CAA6B;;CAGjF,4BAA4B,QAA0B;AACpD,SAAO,KAAK,SAAS,OAAO,CAAC,qBAAqB;;CAGpD,AAAQ,SAAS,OAAmD;AAClE,SAAO,UAAU,QAAQ,OAAO,UAAU,WAAY,QAAoC,EAAE"}
1
+ {"version":3,"file":"WorkflowPolicyUiPresentationFactory-DfvD2VHk.js","names":[],"sources":["../src/application/mapping/WorkflowPolicyUiPresentationFactory.ts"],"sourcesContent":["import type { NodeDefinition, RetryPolicySpec, WorkflowDefinition } from \"@codemation/core/browser\";\n\n/** UI-facing policy labels derived from workflow/node definitions (live or hydrated snapshot). */\nexport class WorkflowPolicyUiPresentationFactory {\n workflowHasErrorHandler(workflow: WorkflowDefinition): boolean {\n return workflow.workflowErrorHandler !== undefined;\n }\n\n nodeRetrySummary(config: NodeDefinition[\"config\"]): string | undefined {\n const spec = config.retryPolicy as RetryPolicySpec | undefined;\n if (!spec) return undefined;\n if (spec.kind === \"none\") return \"Retry: off\";\n if (spec.kind === \"fixed\") return `Retry: ${spec.maxAttempts}x @ ${spec.delayMs}ms`;\n if (spec.kind === \"exponential\") {\n const jitter = spec.jitter ? \", jitter\" : \"\";\n return `Retry: exp ${spec.maxAttempts}x from ${spec.initialDelayMs}ms (x${spec.multiplier}${jitter})`;\n }\n return undefined;\n }\n\n nodeHasErrorHandler(config: NodeDefinition[\"config\"]): boolean {\n return config.nodeErrorHandler !== undefined;\n }\n\n snapshotNodeRetrySummary(config: unknown): string | undefined {\n const record = this.asRecord(config);\n const spec = record.retryPolicy as RetryPolicySpec | undefined;\n if (!spec || typeof spec !== \"object\") return undefined;\n return this.nodeRetrySummary({ retryPolicy: spec } as NodeDefinition[\"config\"]);\n }\n\n snapshotNodeHasErrorHandler(config: unknown): boolean {\n return this.asRecord(config).nodeErrorHandler !== undefined;\n }\n\n private asRecord(value: unknown): Readonly<Record<string, unknown>> {\n return value !== null && typeof value === \"object\" ? (value as Record<string, unknown>) : {};\n }\n}\n"],"mappings":";;AAGA,IAAa,sCAAb,MAAiD;CAC/C,wBAAwB,UAAuC;AAC7D,SAAO,SAAS,yBAAyB;;CAG3C,iBAAiB,QAAsD;EACrE,MAAM,OAAO,OAAO;AACpB,MAAI,CAAC,KAAM,QAAO;AAClB,MAAI,KAAK,SAAS,OAAQ,QAAO;AACjC,MAAI,KAAK,SAAS,QAAS,QAAO,UAAU,KAAK,YAAY,MAAM,KAAK,QAAQ;AAChF,MAAI,KAAK,SAAS,eAAe;GAC/B,MAAM,SAAS,KAAK,SAAS,aAAa;AAC1C,UAAO,cAAc,KAAK,YAAY,SAAS,KAAK,eAAe,OAAO,KAAK,aAAa,OAAO;;;CAKvG,oBAAoB,QAA2C;AAC7D,SAAO,OAAO,qBAAqB;;CAGrC,yBAAyB,QAAqC;EAE5D,MAAM,OADS,KAAK,SAAS,OAAO,CAChB;AACpB,MAAI,CAAC,QAAQ,OAAO,SAAS,SAAU,QAAO;AAC9C,SAAO,KAAK,iBAAiB,EAAE,aAAa,MAAM,CAA6B;;CAGjF,4BAA4B,QAA0B;AACpD,SAAO,KAAK,SAAS,OAAO,CAAC,qBAAqB;;CAGpD,AAAQ,SAAS,OAAmD;AAClE,SAAO,UAAU,QAAQ,OAAO,UAAU,WAAY,QAAoC,EAAE"}
@@ -1,6 +1,6 @@
1
- import "./index-DilAYwnH.js";
2
- import "./ItemsInputNormalizer-_RwIfRIQ.js";
3
- import { a as defineCodemationApp, i as FriendlyCodemationExecutionConfig, n as DefinePluginOptions, o as definePlugin, r as FriendlyCodemationDatabaseConfig, s as workflow, t as DefineCodemationAppOptions } from "./CodemationAuthoring.types-DA3G3s6d.js";
4
- import { _ as CodemationEngineExecutionLimitsConfig, b as CodemationSchedulerConfig, c as CodemationPluginContext, d as CodemationAppSchedulerConfig, f as CodemationAppSchedulerKind, g as CodemationDatabaseKind, h as CodemationDatabaseConfig, m as CodemationConfig, n as CodemationRegistrationContextBase, o as CodemationPlugin, p as CodemationApplicationRuntimeConfig, s as CodemationPluginConfig, t as CodemationAppContext, u as CodemationAppDefinition, v as CodemationEventBusConfig, x as CodemationSchedulerKind, y as CodemationEventBusKind } from "./CodemationAppContext-CKVv9W9q.js";
1
+ import "./index-ChIfeWzk.js";
2
+ import "./ItemsInputNormalizer-CFkfNMLt.js";
3
+ import { a as defineCodemationApp, i as FriendlyCodemationExecutionConfig, n as DefinePluginOptions, o as definePlugin, r as FriendlyCodemationDatabaseConfig, s as workflow, t as DefineCodemationAppOptions } from "./CodemationAuthoring.types-BXlXIl4K.js";
4
+ import { _ as CodemationEngineExecutionLimitsConfig, b as CodemationSchedulerConfig, c as CodemationPluginContext, d as CodemationAppSchedulerConfig, f as CodemationAppSchedulerKind, g as CodemationDatabaseKind, h as CodemationDatabaseConfig, m as CodemationConfig, n as CodemationRegistrationContextBase, o as CodemationPlugin, p as CodemationApplicationRuntimeConfig, s as CodemationPluginConfig, t as CodemationAppContext, u as CodemationAppDefinition, v as CodemationEventBusConfig, x as CodemationSchedulerKind, y as CodemationEventBusKind } from "./CodemationAppContext-K51b7oXe.js";
5
5
  import "./CodemationWhitelabelConfig-Ca2mCUeC.js";
6
6
  export { type CodemationAppContext, type CodemationAppDefinition, type CodemationAppSchedulerConfig, type CodemationAppSchedulerKind, type CodemationApplicationRuntimeConfig, type CodemationConfig, type CodemationDatabaseConfig, type CodemationDatabaseKind, type CodemationEngineExecutionLimitsConfig, type CodemationEventBusConfig, type CodemationEventBusKind, type CodemationPlugin, type CodemationPluginConfig, type CodemationPluginContext, type CodemationRegistrationContextBase, type CodemationSchedulerConfig, type CodemationSchedulerKind, type DefineCodemationAppOptions, type DefinePluginOptions, type FriendlyCodemationDatabaseConfig, type FriendlyCodemationExecutionConfig, defineCodemationApp, definePlugin, workflow };
package/dist/authoring.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as definePlugin, t as defineCodemationApp } from "./CodemationAuthoring.types-NGkBcmmT.js";
1
+ import { n as definePlugin, t as defineCodemationApp } from "./CodemationAuthoring.types-BteaR3Dc.js";
2
2
  import { workflow } from "@codemation/core-nodes";
3
3
 
4
4
  export { defineCodemationApp, definePlugin, workflow };
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { l as Logger, t as CodemationWhitelabelConfig, u as LoggerFactory } from "./CodemationWhitelabelConfig-Ca2mCUeC.js";
2
2
  import { i as LogLevelPolicy, n as logLevelPolicyFactory, r as LogLevel } from "./LogLevelPolicyFactory-ewCHLDLn.js";
3
- import { a as ApiPaths, i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-CXG9Dxft.js";
3
+ import { a as ApiPaths, i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-HNItQ7ol.js";
4
4
  import { a as CodemationFrontendAuthSnapshot, i as CodemationFrontendAuthProviderSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-Cev3qK46.js";
5
5
 
6
6
  //#region src/infrastructure/logging/BrowserLoggerFactory.d.ts
package/dist/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as logLevelPolicyFactory, r as ConsoleLogger } from "./LogLevelPolicyFactory-DCUzIN6G.js";
2
- import { n as InAppCallbackUrlPolicy, t as ApiPaths } from "./ApiPaths-Dv1dcHu_.js";
2
+ import { n as InAppCallbackUrlPolicy, t as ApiPaths } from "./ApiPaths-DCvrlIjg.js";
3
3
  import { i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-CegIF_ne.js";
4
4
 
5
5
  //#region src/infrastructure/logging/BrowserLoggerFactory.ts
@@ -1,7 +1,7 @@
1
- import "./index-DilAYwnH.js";
2
- import "./ItemsInputNormalizer-_RwIfRIQ.js";
3
- import "./CodemationAppContext-CKVv9W9q.js";
1
+ import "./index-ChIfeWzk.js";
2
+ import "./ItemsInputNormalizer-CFkfNMLt.js";
3
+ import "./CodemationAppContext-K51b7oXe.js";
4
4
  import "./CodemationWhitelabelConfig-Ca2mCUeC.js";
5
- import "./CodemationConfigNormalizer-BAKjetJ6.js";
6
- import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-nxOqvv46.js";
5
+ import "./CodemationConfigNormalizer-B4rDYC9h.js";
6
+ import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-Dt4jyLx6.js";
7
7
  export { type CodemationConsumerApp, CodemationConsumerAppResolver, CodemationConsumerConfigLoader, type CodemationConsumerConfigResolution };
package/dist/consumer.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./LogLevelPolicyFactory-DCUzIN6G.js";
2
- import { i as CodemationConsumerAppResolver, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-GYpBBvqE.js";
2
+ import { i as CodemationConsumerAppResolver, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-By-6tuGc.js";
3
3
  import "./ServerLoggerFactory-Ckk52S3w.js";
4
4
  import "./decorateParam-BWxkAUSj.js";
5
5
  import "./decorate-CXWmflG_.js";
@@ -1,9 +1,9 @@
1
- import "./index-DilAYwnH.js";
2
- import { mt as CredentialHealth, ut as AnyCredentialType, xt as CredentialSessionFactoryArgs } from "./ItemsInputNormalizer-_RwIfRIQ.js";
3
- import "./CodemationAppContext-CKVv9W9q.js";
1
+ import "./index-ChIfeWzk.js";
2
+ import { mt as CredentialSessionFactoryArgs, rt as AnyCredentialType, st as CredentialHealth } from "./ItemsInputNormalizer-CFkfNMLt.js";
3
+ import "./CodemationAppContext-K51b7oXe.js";
4
4
  import "./CodemationWhitelabelConfig-Ca2mCUeC.js";
5
- import { i as CredentialInstanceService, n as CredentialType, r as CredentialBindingService } from "./CredentialServices-Be2I60Th.js";
6
- import "./CredentialContractsRegistry-Bq2bq28t.js";
5
+ import { i as CredentialInstanceService, n as CredentialType, r as CredentialBindingService } from "./CredentialServices-B3wPyp2y.js";
6
+ import "./CredentialContractsRegistry-Dgu-rEXi.js";
7
7
 
8
8
  //#region src/infrastructure/credentials/OpenAiApiKeyCredentialShapes.types.d.ts
9
9
  /**
@@ -1,6 +1,6 @@
1
1
  import "./decorateParam-BWxkAUSj.js";
2
2
  import "./decorate-CXWmflG_.js";
3
- import { a as CredentialInstanceService, g as OpenAiApiKeyCredentialHealthTester, h as OpenAiApiKeyCredentialTypeFactory, i as CredentialBindingService } from "./CredentialServices-Dk8yypeL.js";
3
+ import { a as CredentialInstanceService, g as OpenAiApiKeyCredentialHealthTester, h as OpenAiApiKeyCredentialTypeFactory, i as CredentialBindingService } from "./CredentialServices-Bios0dM8.js";
4
4
 
5
5
  //#region src/credentials.ts
6
6
  const defaultOpenAiApiKeyCredentialTypeFactory = new OpenAiApiKeyCredentialTypeFactory(new OpenAiApiKeyCredentialHealthTester(globalThis.fetch));
@@ -1,5 +1,5 @@
1
- import "./index-DilAYwnH.js";
2
- import { X as WorkflowDefinition, h as Container } from "./ItemsInputNormalizer-_RwIfRIQ.js";
1
+ import "./index-ChIfeWzk.js";
2
+ import { A as WorkflowDefinition, W as Container } from "./ItemsInputNormalizer-CFkfNMLt.js";
3
3
 
4
4
  //#region src/presentation/server/CodemationTsyringeParamInfoReader.d.ts
5
5
  declare class CodemationTsyringeParamInfoReader {
package/dist/dto.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import "./index-DilAYwnH.js";
2
- import { at as RunStatus, b as TestCaseRunStatus, x as TestSuiteRunStatus, z as JsonValue } from "./ItemsInputNormalizer-_RwIfRIQ.js";
3
- import { a as UpdateCredentialInstanceRequest, c as WorkflowCredentialHealthSlotDto, i as CredentialOAuth2ConnectionDto, n as CredentialInstanceDto, o as UpsertCredentialBindingRequest, r as CredentialInstanceWithSecretsDto, s as WorkflowCredentialHealthDto, t as CreateCredentialInstanceRequest } from "./CredentialContractsRegistry-Bq2bq28t.js";
4
- import { a as TelemetrySpanStatus } from "./TelemetryContracts-BtDx84Cp.js";
1
+ import "./index-ChIfeWzk.js";
2
+ import { X as TestSuiteRunStatus, Y as TestCaseRunStatus, y as JsonValue, z as RunStatus } from "./ItemsInputNormalizer-CFkfNMLt.js";
3
+ import { a as CredentialInstanceWithSecretsDto, c as UpsertCredentialBindingRequest, i as CredentialInstanceDto, l as WorkflowCredentialHealthDto, n as AppsResponse, o as CredentialOAuth2ConnectionDto, r as CreateCredentialInstanceRequest, s as UpdateCredentialInstanceRequest, t as AppGalleryEntry, u as WorkflowCredentialHealthSlotDto } from "./CredentialContractsRegistry-Dgu-rEXi.js";
4
+ import { a as TelemetrySpanStatus } from "./TelemetryContracts-DpZEODQM.js";
5
5
  import { i as WorkflowSummary, n as WorkflowEdgeDto, r as WorkflowNodeDto, t as WorkflowDto } from "./WorkflowViewContracts-B7aFQcIw.js";
6
6
  import { _ as withInviteUserResponseLoginMethodsDefaults, a as CollectionSummaryDto, c as AcceptUserInviteRequestDto, d as UpdateUserAccountStatusRequestDto, f as UpsertLocalBootstrapUserResultDto, g as VerifyUserInviteResponseDto, h as UserAccountStatus, i as CollectionRowDto, l as InviteUserRequestDto, m as UserAccountDtoInput, n as CollectionFieldDto, o as ListCollectionRowsResponseDto, p as UserAccountDto, r as CollectionIndexDto, s as SyncCollectionsResponseDto, t as CollectionDetailDto, u as InviteUserResponseDto, v as withUserAccountLoginMethodsDefaults } from "./CollectionContracts.types-DDyFYT_D.js";
7
7
 
@@ -213,5 +213,5 @@ interface TestAssertionDto {
213
213
  readonly createdAt: string;
214
214
  }
215
215
  //#endregion
216
- export { type AcceptUserInviteRequestDto, type AssertionMetricTrendDto, type AssertionMetricTrendPointDto, type CollectionDetailDto, type CollectionFieldDto, type CollectionIndexDto, type CollectionRowDto, type CollectionSummaryDto, type CreateCredentialInstanceRequest, type CredentialInstanceDto, type CredentialInstanceWithSecretsDto, type CredentialOAuth2ConnectionDto, type InviteUserRequestDto, type InviteUserResponseDto, type ListCollectionRowsResponseDto, type StartTestSuiteRunRequest, type StartTestSuiteRunResponse, type SyncCollectionsResponseDto, type TelemetryDashboardAiAggregateDto, type TelemetryDashboardBucketCostDto, type TelemetryDashboardBucketIntervalDto, type TelemetryDashboardCostAggregateDto, type TelemetryDashboardCostCurrencyTotalDto, type TelemetryDashboardCostKeyTotalDto, type TelemetryDashboardDimensionsDto, type TelemetryDashboardFiltersDto, type TelemetryDashboardRunAggregateDto, type TelemetryDashboardRunListItemDto, type TelemetryDashboardRunOriginDto, type TelemetryDashboardRunsDto, type TelemetryDashboardRunsRequestDto, type TelemetryDashboardSummaryDto, type TelemetryDashboardTimeseriesBucketDto, type TelemetryDashboardTimeseriesDto, type TelemetryDashboardTimeseriesRequestDto, type TestAssertionDto, type TestSuiteChildRunDto, type TestSuiteRunDetailDto, type TestSuiteRunSummaryDto, type UpdateCredentialInstanceRequest, type UpdateUserAccountStatusRequestDto, type UpsertCredentialBindingRequest, type UpsertLocalBootstrapUserResultDto, type UserAccountDto, type UserAccountDtoInput, type UserAccountStatus, type VerifyUserInviteResponseDto, type WorkflowCredentialHealthDto, type WorkflowCredentialHealthSlotDto, type WorkflowDto, type WorkflowEdgeDto, type WorkflowNodeDto, type WorkflowSummary, withInviteUserResponseLoginMethodsDefaults, withUserAccountLoginMethodsDefaults };
216
+ export { type AcceptUserInviteRequestDto, type AppGalleryEntry, type AppsResponse, type AssertionMetricTrendDto, type AssertionMetricTrendPointDto, type CollectionDetailDto, type CollectionFieldDto, type CollectionIndexDto, type CollectionRowDto, type CollectionSummaryDto, type CreateCredentialInstanceRequest, type CredentialInstanceDto, type CredentialInstanceWithSecretsDto, type CredentialOAuth2ConnectionDto, type InviteUserRequestDto, type InviteUserResponseDto, type ListCollectionRowsResponseDto, type StartTestSuiteRunRequest, type StartTestSuiteRunResponse, type SyncCollectionsResponseDto, type TelemetryDashboardAiAggregateDto, type TelemetryDashboardBucketCostDto, type TelemetryDashboardBucketIntervalDto, type TelemetryDashboardCostAggregateDto, type TelemetryDashboardCostCurrencyTotalDto, type TelemetryDashboardCostKeyTotalDto, type TelemetryDashboardDimensionsDto, type TelemetryDashboardFiltersDto, type TelemetryDashboardRunAggregateDto, type TelemetryDashboardRunListItemDto, type TelemetryDashboardRunOriginDto, type TelemetryDashboardRunsDto, type TelemetryDashboardRunsRequestDto, type TelemetryDashboardSummaryDto, type TelemetryDashboardTimeseriesBucketDto, type TelemetryDashboardTimeseriesDto, type TelemetryDashboardTimeseriesRequestDto, type TestAssertionDto, type TestSuiteChildRunDto, type TestSuiteRunDetailDto, type TestSuiteRunSummaryDto, type UpdateCredentialInstanceRequest, type UpdateUserAccountStatusRequestDto, type UpsertCredentialBindingRequest, type UpsertLocalBootstrapUserResultDto, type UserAccountDto, type UserAccountDtoInput, type UserAccountStatus, type VerifyUserInviteResponseDto, type WorkflowCredentialHealthDto, type WorkflowCredentialHealthSlotDto, type WorkflowDto, type WorkflowEdgeDto, type WorkflowNodeDto, type WorkflowSummary, withInviteUserResponseLoginMethodsDefaults, withUserAccountLoginMethodsDefaults };
217
217
  //# sourceMappingURL=dto.d.ts.map
@@ -1,5 +1,5 @@
1
- import { B as NodeActivationId, D as WebhookInvocationMatch, E as HttpMethod, Et as CredentialTypeId, J as RunnableNodeConfig, K as RunId, O as WebhookTriggerMatcher, Ot as NodeId, Q as NodeInputsByPort, R as Items, U as NodeOutputs, W as ParentExecutionRef, X as WorkflowDefinition, Z as CurrentStateExecutionRequest, _t as CredentialJsonRecord, a as ParamDeep, c as NodeActivationContinuation, ct as WebhookRunResult, d as NodeExecutionRequestHandler, et as PersistedWorkflowTokenRegistryLike, g as TypeToken, it as RunResult, k as WebhookTriggerResolution, kt as WorkflowId, lt as WorkflowExecutionRepository, m as WorkflowSnapshotResolver, nt as RunExecutionOptions, ot as RunStopCondition, p as WorkflowRepository, s as LiveWorkflowRepository, tt as RunCurrentState, u as NodeExecutionRequest, ut as AnyCredentialType } from "./ItemsInputNormalizer-_RwIfRIQ.js";
2
- import { ZodType, z } from "zod";
1
+ import { A as WorkflowDefinition, At as NodeId, B as RunStopCondition, C as NodeOutputs, Ct as WebhookTriggerMatcher, E as RunId, F as RunCurrentState, H as WebhookRunResult, I as RunExecutionOptions, M as NodeInputsByPort, P as PersistedWorkflowTokenRegistryLike, R as RunResult, St as WebhookInvocationMatch, U as WorkflowExecutionRepository, b as NodeActivationId, f as ResumeContext, j as CurrentStateExecutionRequest, jt as WorkflowId, l as NodeExecutionRequest, m as WorkflowSnapshotResolver, o as LiveWorkflowRepository, p as WorkflowRepository, s as NodeActivationContinuation, u as NodeExecutionRequestHandler, v as Items, w as ParentExecutionRef, wt as WebhookTriggerResolution, xt as HttpMethod } from "./ItemsInputNormalizer-CFkfNMLt.js";
2
+ import { ZodType } from "zod";
3
3
 
4
4
  //#region ../core/src/contracts/Clock.d.ts
5
5
  /** Port for time; inject `SystemClock` in production and a fake/test clock in tests. */
@@ -7,28 +7,6 @@ interface Clock {
7
7
  now(): Date;
8
8
  }
9
9
  //#endregion
10
- //#region ../core/src/authoring/defineNode.types.d.ts
11
- type ResolvableCredentialType = AnyCredentialType | CredentialTypeId;
12
- type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
13
- readonly type: ResolvableCredentialType | ReadonlyArray<ResolvableCredentialType>;
14
- readonly label?: string;
15
- readonly optional?: true;
16
- readonly helpText?: string;
17
- readonly helpUrl?: string;
18
- }>;
19
- type DefinedNodeCredentialBindings = Readonly<Record<string, DefinedNodeCredentialBinding>>;
20
- type DefinedNodeConfigInput<TConfigResolved extends CredentialJsonRecord, TItemJson> = ParamDeep<TConfigResolved, TItemJson>;
21
- interface DefinedNode<TKey$1 extends string, TConfig extends CredentialJsonRecord, TInputJson, TOutputJson, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
22
- readonly kind: "defined-node";
23
- readonly key: TKey$1;
24
- readonly title: string;
25
- readonly description?: string;
26
- create<TConfigItemJson = TInputJson>(config: DefinedNodeConfigInput<TConfig, TConfigItemJson>, name?: string, id?: string): RunnableNodeConfig<TInputJson, TOutputJson>;
27
- register(context: {
28
- registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
29
- }): void;
30
- }
31
- //#endregion
32
10
  //#region ../core/src/authoring/defineCollection.types.d.ts
33
11
  type CollectionFieldType = "text" | "int" | "bigint" | "double" | "bool" | "timestamptz" | "jsonb" | "uuid";
34
12
  interface CollectionFieldDefinition {
@@ -102,9 +80,14 @@ interface EngineRunContinuationService {
102
80
  error: Error;
103
81
  }): Promise<RunResult>;
104
82
  waitForCompletion(runId: RunId): Promise<Extract<RunResult, {
105
- status: "completed" | "failed";
83
+ status: "completed" | "failed" | "halted";
106
84
  }>>;
107
85
  waitForWebhookResponse(runId: RunId): Promise<WebhookRunResult>;
86
+ resumeRun(args: {
87
+ runId: RunId;
88
+ taskId: string;
89
+ resumeContext: ResumeContext;
90
+ }): Promise<RunResult>;
108
91
  }
109
92
  interface EngineNodeExecutionRequestHandler {
110
93
  handleNodeExecutionRequest(request: NodeExecutionRequest): Promise<void>;
@@ -181,9 +164,18 @@ declare class Engine implements NodeActivationContinuation, NodeExecutionRequest
181
164
  error: Error;
182
165
  }): Promise<RunResult>;
183
166
  waitForCompletion(runId: RunId): Promise<Extract<RunResult, {
184
- status: "completed" | "failed";
167
+ status: "completed" | "failed" | "halted";
185
168
  }>>;
186
169
  waitForWebhookResponse(runId: RunId): Promise<WebhookRunResult>;
170
+ /**
171
+ * Re-activate a suspended run item with a human decision (HITL).
172
+ * The HTTP resume endpoint calls this; this method exposes the engine primitive.
173
+ */
174
+ resumeRun(args: {
175
+ runId: RunId;
176
+ taskId: string;
177
+ resumeContext: ResumeContext;
178
+ }): Promise<RunResult>;
187
179
  handleNodeExecutionRequest(request: NodeExecutionRequest): Promise<void>;
188
180
  }
189
181
  //#endregion
@@ -293,5 +285,56 @@ interface OAuthFlowExecutor {
293
285
  }): Promise<OAuthMaterial>;
294
286
  }
295
287
  //#endregion
296
- export { DefinedCollection as a, Clock as c, CollectionDefinition as i, RunIntentService as n, DefinedNode as o, Engine as r, DefinedNodeConfigInput as s, OAuthFlowExecutor as t };
297
- //# sourceMappingURL=index-DilAYwnH.d.ts.map
288
+ //#region ../core/src/credentials/CredentialMaterialProvider.types.d.ts
289
+ /**
290
+ * Material provider seam — see `docs/design/credentials-oauth-unification.md`,
291
+ * "Material provider seam" section. Sits beside the workspace's
292
+ * `CredentialStore`; persistence of the row stays at the store, persistence of
293
+ * the bytes goes through this provider so they can live at the control plane
294
+ * in managed mode.
295
+ */
296
+ /**
297
+ * Pointer to material bytes. For local rows `ref` is the workspace instance id
298
+ * and the bytes co-locate with the row (existing `CredentialOAuth2Material` /
299
+ * `CredentialSecretMaterial` tables). For control-plane rows `ref` is the
300
+ * CP-side credential id; the workspace stores only the pointer.
301
+ */
302
+ type CredentialMaterialRef = Readonly<{
303
+ source: "local" | "control-plane";
304
+ id: string;
305
+ }>;
306
+ /**
307
+ * Decrypted material bytes returned by a provider. Shape matches
308
+ * `OAuthMaterial` — every supported credential type today is OAuth-shaped.
309
+ */
310
+ type MaterialBundle = OAuthMaterial;
311
+ /**
312
+ * Caller context recorded by the CP material endpoint per fetch (D5 in the
313
+ * `credentials-vault` sprint README). The local provider accepts but ignores
314
+ * it; standalone mode has no audit log.
315
+ */
316
+ type CallerContext = Readonly<{
317
+ workspaceId: string;
318
+ caller: Readonly<{
319
+ kind: "workflow-node";
320
+ workflowId: string;
321
+ nodeId: string;
322
+ }> | Readonly<{
323
+ kind: "concierge";
324
+ chatId: string;
325
+ }> | Readonly<{
326
+ kind: "research-agent";
327
+ chatId: string;
328
+ }> | Readonly<{
329
+ kind: "manual";
330
+ userId: string;
331
+ }>;
332
+ reason?: string;
333
+ }>;
334
+ interface CredentialMaterialProvider {
335
+ getMaterial(ref: CredentialMaterialRef, context: CallerContext): Promise<MaterialBundle>;
336
+ setMaterial(ref: CredentialMaterialRef, material: MaterialBundle): Promise<void>;
337
+ }
338
+ //#endregion
339
+ export { CollectionDefinition as a, Engine as i, OAuthFlowExecutor as n, DefinedCollection as o, RunIntentService as r, Clock as s, CredentialMaterialProvider as t };
340
+ //# sourceMappingURL=index-ChIfeWzk.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,24 +1,26 @@
1
- import "./index-DilAYwnH.js";
2
- import { $ as PersistedRunState, R as Items, tt as RunCurrentState } from "./ItemsInputNormalizer-_RwIfRIQ.js";
3
- import { a as defineCodemationApp, i as FriendlyCodemationExecutionConfig, n as DefinePluginOptions, o as definePlugin, r as FriendlyCodemationDatabaseConfig, s as workflow, t as DefineCodemationAppOptions } from "./CodemationAuthoring.types-DA3G3s6d.js";
4
- import { S as CodemationWorkflowDiscovery, _ as CodemationEngineExecutionLimitsConfig, a as AppPluginLoadSummary, b as CodemationSchedulerConfig, c as CodemationPluginContext, d as CodemationAppSchedulerConfig, f as CodemationAppSchedulerKind, g as CodemationDatabaseKind, h as CodemationDatabaseConfig, l as CodemationPluginPackageMetadata, m as CodemationConfig, n as CodemationRegistrationContextBase, o as CodemationPlugin, p as CodemationApplicationRuntimeConfig, r as AppConfig, s as CodemationPluginConfig, t as CodemationAppContext, u as CodemationAppDefinition, v as CodemationEventBusConfig, w as CodemationClassToken, x as CodemationSchedulerKind, y as CodemationEventBusKind } from "./CodemationAppContext-CKVv9W9q.js";
5
- import { a as CodemationAuthConfig, c as CodemationAuthOidcProviderConfig, i as CodemationLogRule, n as CodemationLogConfig, o as CodemationAuthKind, r as CodemationLogLevelName, s as CodemationAuthOAuthProviderConfig, t as CodemationWhitelabelConfig } from "./CodemationWhitelabelConfig-Ca2mCUeC.js";
1
+ import "./index-ChIfeWzk.js";
2
+ import { F as RunCurrentState, N as PersistedRunState, v as Items } from "./ItemsInputNormalizer-CFkfNMLt.js";
3
+ import { a as defineCodemationApp, i as FriendlyCodemationExecutionConfig, n as DefinePluginOptions, o as definePlugin, r as FriendlyCodemationDatabaseConfig, s as workflow, t as DefineCodemationAppOptions } from "./CodemationAuthoring.types-BXlXIl4K.js";
4
+ import { S as CodemationWorkflowDiscovery, _ as CodemationEngineExecutionLimitsConfig, a as AppPluginLoadSummary, b as CodemationSchedulerConfig, c as CodemationPluginContext, d as CodemationAppSchedulerConfig, f as CodemationAppSchedulerKind, g as CodemationDatabaseKind, h as CodemationDatabaseConfig, l as CodemationPluginPackageMetadata, m as CodemationConfig, n as CodemationRegistrationContextBase, o as CodemationPlugin, p as CodemationApplicationRuntimeConfig, r as AppConfig, s as CodemationPluginConfig, t as CodemationAppContext, u as CodemationAppDefinition, v as CodemationEventBusConfig, w as CodemationClassToken, x as CodemationSchedulerKind, y as CodemationEventBusKind } from "./CodemationAppContext-K51b7oXe.js";
5
+ import { a as CodemationAuthConfig, c as CodemationAuthOidcProviderConfig, i as CodemationLogRule, l as Logger, n as CodemationLogConfig, o as CodemationAuthKind, r as CodemationLogLevelName, s as CodemationAuthOAuthProviderConfig, t as CodemationWhitelabelConfig } from "./CodemationWhitelabelConfig-Ca2mCUeC.js";
6
6
  import "./LogLevelPolicyFactory-ewCHLDLn.js";
7
- import { a as ApiPaths, i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-CXG9Dxft.js";
7
+ import { a as ApiPaths, i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-HNItQ7ol.js";
8
8
  import { a as CodemationFrontendAuthSnapshot, i as CodemationFrontendAuthProviderSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-Cev3qK46.js";
9
- import "./CodemationConfigNormalizer-BAKjetJ6.js";
10
- import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-nxOqvv46.js";
11
- import "./CredentialServices-Be2I60Th.js";
12
- import "./CredentialContractsRegistry-Bq2bq28t.js";
13
- import "./TelemetryContracts-BtDx84Cp.js";
9
+ import "./CodemationConfigNormalizer-B4rDYC9h.js";
10
+ import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-Dt4jyLx6.js";
11
+ import "./CredentialServices-B3wPyp2y.js";
12
+ import "./CredentialContractsRegistry-Dgu-rEXi.js";
13
+ import "./TelemetryContracts-DpZEODQM.js";
14
14
  import "./WorkflowViewContracts-B7aFQcIw.js";
15
15
  import { a as CollectionSummaryDto, f as UpsertLocalBootstrapUserResultDto, i as CollectionRowDto, o as ListCollectionRowsResponseDto, p as UserAccountDto, s as SyncCollectionsResponseDto, t as CollectionDetailDto } from "./CollectionContracts.types-DDyFYT_D.js";
16
- import { S as Command, _ as AppContainerFactory, b as Query, c as WorkerRuntime, g as AppContainerLifecycle, h as DatabaseMigrations, l as FrontendRuntime, m as CollectionSchemaSyncerHolder, n as CodemationBootstrapRequest, r as ApplicationTokens, t as CodemationPluginListMerger, x as CommandBus, y as QueryBus } from "./CodemationPluginListMerger-DKLAHT2b.js";
17
- import { r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-DnLoQ9Li.js";
18
- import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-CY2FS-5g.js";
16
+ import { C as Command, S as CommandBus, _ as AppContainerLifecycle, a as CodemationHonoApiApp, b as QueryBus, g as DatabaseMigrations, h as CollectionSchemaSyncerHolder, l as WorkerRuntime, n as CodemationBootstrapRequest, r as ApplicationTokens, t as CodemationPluginListMerger, u as FrontendRuntime, v as AppContainerFactory, x as Query, y as WorkflowWebsocketServer } from "./CodemationPluginListMerger-DS6I3Xe0.js";
17
+ import { n as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-DncmwCD1.js";
18
+ import "./PrismaMigrationDeployer-DdEcXXVi.js";
19
19
  import "./InternalHonoApiRouteRegistrar-Ce1yxpnO.js";
20
- import { n as CodemationPostgresPrismaClientFactory } from "./persistenceServer-CeTHtC6E.js";
21
- import { c as CodemationServerGateway } from "./server-C4bS62rg.js";
20
+ import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-ClEjZP74.js";
21
+ import { t as CodemationPostgresPrismaClientFactory } from "./CodemationPostgresPrismaClientFactory-CTNTPnDr.js";
22
+ import { c as CodemationServerGateway } from "./server-B5trn7y4.js";
23
+ import { Server } from "node:http";
22
24
 
23
25
  //#region src/application/queries/ListUserAccountsQuery.d.ts
24
26
  declare class ListUserAccountsQuery extends Query<ReadonlyArray<UserAccountDto>> {}
@@ -76,6 +78,36 @@ declare class BootTimer {
76
78
  private static popPhase;
77
79
  }
78
80
  //#endregion
81
+ //#region src/presentation/websocket/WorkflowWebsocketServerFactory.d.ts
82
+ declare class WorkflowWebsocketServerFactory {
83
+ create(appConfig: AppConfig): WorkflowWebsocketServer;
84
+ }
85
+ //#endregion
86
+ //#region src/presentation/http/HeadlessHttpServerFactory.d.ts
87
+ /**
88
+ * Creates a Node.js http.Server that bridges IncomingMessage to Hono's Fetch API.
89
+ * Used by {@link import("../../bootstrap/runtime/HeadlessApiRuntime").HeadlessApiRuntime}
90
+ * to serve the Hono API without Next.js.
91
+ */
92
+ declare class HeadlessHttpServerFactory {
93
+ create(honoApp: CodemationHonoApiApp, port: number, logger: Logger): Server;
94
+ }
95
+ //#endregion
96
+ //#region src/bootstrap/runtime/HeadlessApiRuntime.d.ts
97
+ /**
98
+ * Boots the Codemation API + WebSocket servers without the Next.js UI process.
99
+ * Used by `codemation serve web --headless` for workspace pod containers where the
100
+ * UI is served externally (e.g. from the control-plane's customer-ui).
101
+ */
102
+ declare class HeadlessApiRuntime {
103
+ private readonly appContainerFactory;
104
+ private readonly websocketServerFactory;
105
+ private readonly httpServerFactory;
106
+ private readonly logger;
107
+ constructor(appContainerFactory: AppContainerFactory, websocketServerFactory: WorkflowWebsocketServerFactory, httpServerFactory: HeadlessHttpServerFactory, logger: Logger);
108
+ start(appConfig: AppConfig): Promise<void>;
109
+ }
110
+ //#endregion
79
111
  //#region src/application/collections/ListCollectionsQuery.d.ts
80
112
  declare class ListCollectionsQuery extends Query<ReadonlyArray<CollectionSummaryDto>> {}
81
113
  //#endregion
@@ -178,5 +210,5 @@ interface CodemationPackageManifest {
178
210
  readonly plugin?: string;
179
211
  }
180
212
  //#endregion
181
- export { ApiPaths, type AppConfig, AppConfigFactory, AppContainerFactory, AppContainerLifecycle, type AppPluginLoadSummary, ApplicationRequestError, ApplicationTokens, BootTimer, type BootTracePhase, type CodemationAppContext, type CodemationAppDefinition, type CodemationAppSchedulerConfig, type CodemationAppSchedulerKind, type CodemationApplicationRuntimeConfig, type CodemationAuthConfig, type CodemationAuthKind, type CodemationAuthOAuthProviderConfig, type CodemationAuthOidcProviderConfig, CodemationBootstrapRequest, type CodemationClassToken, type CodemationConfig, CodemationConsumerConfigLoader, type CodemationDatabaseConfig, type CodemationDatabaseKind, type CodemationEngineExecutionLimitsConfig, type CodemationEventBusConfig, type CodemationEventBusKind, type CodemationFrontendAuthProviderSnapshot, type CodemationFrontendAuthSnapshot, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, type CodemationLogConfig, type CodemationLogLevelName, type CodemationLogRule, type CodemationPackageManifest, type CodemationPlugin, type CodemationPluginConfig, type CodemationPluginContext, CodemationPluginListMerger, CodemationPluginPackageMetadata, CodemationPostgresPrismaClientFactory, type CodemationRegistrationContextBase, type CodemationSchedulerConfig, type CodemationSchedulerKind, CodemationServerGateway, type CodemationWhitelabelConfig, type CodemationWorkflowDiscovery, CollectionSchemaSyncerHolder, type CommandBus, DatabaseMigrations, type DefineCodemationAppOptions, type DefinePluginOptions, DeleteCollectionRowCommand, type FriendlyCodemationDatabaseConfig, type FriendlyCodemationExecutionConfig, type FrontendAppConfig, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, FrontendRuntime, GetCollectionQuery, GetCollectionRowQuery, GetRunStateQuery, InsertCollectionRowCommand, type InternalAuthBootstrap, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, ListCollectionRowsQuery, ListCollectionsQuery, ListUserAccountsQuery, type PrismaDatabaseClient as PrismaClient, type PublicFrontendBootstrap, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, type QueryBus, type RunCommandResult, StartWorkflowRunCommand, SyncCollectionsCommand, UpdateCollectionRowCommand, UpsertLocalBootstrapUserCommand, type UpsertLocalBootstrapUserResultDto, WorkerRuntime, defineCodemationApp, definePlugin, workflow };
213
+ export { ApiPaths, type AppConfig, AppConfigFactory, AppContainerFactory, AppContainerLifecycle, type AppPluginLoadSummary, ApplicationRequestError, ApplicationTokens, BootTimer, type BootTracePhase, type CodemationAppContext, type CodemationAppDefinition, type CodemationAppSchedulerConfig, type CodemationAppSchedulerKind, type CodemationApplicationRuntimeConfig, type CodemationAuthConfig, type CodemationAuthKind, type CodemationAuthOAuthProviderConfig, type CodemationAuthOidcProviderConfig, CodemationBootstrapRequest, type CodemationClassToken, type CodemationConfig, CodemationConsumerConfigLoader, type CodemationDatabaseConfig, type CodemationDatabaseKind, type CodemationEngineExecutionLimitsConfig, type CodemationEventBusConfig, type CodemationEventBusKind, type CodemationFrontendAuthProviderSnapshot, type CodemationFrontendAuthSnapshot, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, type CodemationLogConfig, type CodemationLogLevelName, type CodemationLogRule, type CodemationPackageManifest, type CodemationPlugin, type CodemationPluginConfig, type CodemationPluginContext, CodemationPluginListMerger, CodemationPluginPackageMetadata, CodemationPostgresPrismaClientFactory, type CodemationRegistrationContextBase, type CodemationSchedulerConfig, type CodemationSchedulerKind, CodemationServerGateway, type CodemationWhitelabelConfig, type CodemationWorkflowDiscovery, CollectionSchemaSyncerHolder, type CommandBus, DatabaseMigrations, type DefineCodemationAppOptions, type DefinePluginOptions, DeleteCollectionRowCommand, type FriendlyCodemationDatabaseConfig, type FriendlyCodemationExecutionConfig, type FrontendAppConfig, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, FrontendRuntime, GetCollectionQuery, GetCollectionRowQuery, GetRunStateQuery, HeadlessApiRuntime, HeadlessHttpServerFactory, InsertCollectionRowCommand, type InternalAuthBootstrap, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, ListCollectionRowsQuery, ListCollectionsQuery, ListUserAccountsQuery, type PrismaDatabaseClient as PrismaClient, type PublicFrontendBootstrap, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, type QueryBus, type RunCommandResult, StartWorkflowRunCommand, SyncCollectionsCommand, UpdateCollectionRowCommand, UpsertLocalBootstrapUserCommand, type UpsertLocalBootstrapUserResultDto, WorkerRuntime, WorkflowWebsocketServerFactory, defineCodemationApp, definePlugin, workflow };
182
214
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,20 +1,113 @@
1
- import { n as definePlugin, t as defineCodemationApp } from "./CodemationAuthoring.types-NGkBcmmT.js";
2
- import "./LogLevelPolicyFactory-DCUzIN6G.js";
3
- import { t as ApiPaths } from "./ApiPaths-Dv1dcHu_.js";
1
+ import { n as definePlugin, t as defineCodemationApp } from "./CodemationAuthoring.types-BteaR3Dc.js";
2
+ import { n as logLevelPolicyFactory } from "./LogLevelPolicyFactory-DCUzIN6G.js";
3
+ import { t as ApiPaths } from "./ApiPaths-DCvrlIjg.js";
4
4
  import { i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-CegIF_ne.js";
5
- import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-GYpBBvqE.js";
6
- import { o as BootTimer } from "./ServerLoggerFactory-Ckk52S3w.js";
5
+ import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-By-6tuGc.js";
6
+ import { o as BootTimer, t as ServerLoggerFactory } from "./ServerLoggerFactory-Ckk52S3w.js";
7
7
  import "./decorateParam-BWxkAUSj.js";
8
8
  import "./decorate-CXWmflG_.js";
9
- import { f as ApplicationRequestError, m as ApplicationTokens } from "./CredentialServices-Dk8yypeL.js";
9
+ import { f as ApplicationRequestError, m as ApplicationTokens } from "./CredentialServices-Bios0dM8.js";
10
10
  import "./CodemationTsyringeTypeInfoRegistrar-Bj6FJYFz.js";
11
- import { D as FrontendAppConfigFactory, E as InternalAuthBootstrapFactory, F as StartWorkflowRunCommand, I as UpsertLocalBootstrapUserCommand, L as ListUserAccountsQuery, N as GetRunStateQuery, O as CodemationFrontendAuthSnapshotFactory, T as PublicFrontendBootstrapFactory, a as GetCollectionQuery, c as InsertCollectionRowCommand, d as FrontendRuntime, f as CollectionSchemaSyncerHolder, i as GetCollectionRowQuery, l as DeleteCollectionRowCommand, m as AppContainerLifecycle, n as ListCollectionsQuery, o as UpdateCollectionRowCommand, p as DatabaseMigrations, r as ListCollectionRowsQuery, s as SyncCollectionsCommand, t as AppContainerFactory, u as WorkerRuntime } from "./AppContainerFactory-DqKYCRNP.js";
12
- import "./WorkflowPolicyUiPresentationFactory-Bb-ae_Zh.js";
13
- import "./InternalPingRegistrar-DY3kSfxP.js";
14
- import { r as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-Cx4qQvRk.js";
11
+ import { C as CodemationHonoApiApp, D as FrontendAppConfigFactory, E as InternalAuthBootstrapFactory, F as StartWorkflowRunCommand, I as UpsertLocalBootstrapUserCommand, L as ListUserAccountsQuery, N as GetRunStateQuery, O as CodemationFrontendAuthSnapshotFactory, T as PublicFrontendBootstrapFactory, a as GetCollectionQuery, c as InsertCollectionRowCommand, d as FrontendRuntime, f as CollectionSchemaSyncerHolder, i as GetCollectionRowQuery, k as WorkflowWebsocketServer, l as DeleteCollectionRowCommand, m as AppContainerLifecycle, n as ListCollectionsQuery, o as UpdateCollectionRowCommand, p as DatabaseMigrations, r as ListCollectionRowsQuery, s as SyncCollectionsCommand, t as AppContainerFactory, u as WorkerRuntime } from "./AppContainerFactory-jpYXGZGe.js";
12
+ import "./InternalPingRegistrar-BavAAnvk.js";
13
+ import "./WorkflowPolicyUiPresentationFactory-DfvD2VHk.js";
14
+ import { r as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-D4LL1aOR.js";
15
15
  import { n as CodemationBootstrapRequest, t as CodemationPluginListMerger } from "./CodemationPluginListMerger-D1B1IEbt.js";
16
- import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-C-hH4z6l.js";
17
- import { r as CodemationServerGateway } from "./server-Y7kxwtCK.js";
16
+ import { t as CodemationPostgresPrismaClientFactory } from "./CodemationPostgresPrismaClientFactory-C7156Fe-.js";
17
+ import { r as CodemationServerGateway } from "./server-BlG9qV5S.js";
18
18
  import { workflow } from "@codemation/core-nodes";
19
+ import { createServer } from "node:http";
19
20
 
20
- export { ApiPaths, AppConfigFactory, AppContainerFactory, AppContainerLifecycle, ApplicationRequestError, ApplicationTokens, BootTimer, CodemationBootstrapRequest, CodemationConsumerConfigLoader, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, CodemationPluginListMerger, CodemationPluginPackageMetadata, CodemationPostgresPrismaClientFactory, CodemationServerGateway, CollectionSchemaSyncerHolder, DatabaseMigrations, DeleteCollectionRowCommand, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, FrontendRuntime, GetCollectionQuery, GetCollectionRowQuery, GetRunStateQuery, InsertCollectionRowCommand, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, ListCollectionRowsQuery, ListCollectionsQuery, ListUserAccountsQuery, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, StartWorkflowRunCommand, SyncCollectionsCommand, UpdateCollectionRowCommand, UpsertLocalBootstrapUserCommand, WorkerRuntime, defineCodemationApp, definePlugin, workflow };
21
+ //#region src/bootstrap/runtime/HeadlessApiRuntime.ts
22
+ /**
23
+ * Boots the Codemation API + WebSocket servers without the Next.js UI process.
24
+ * Used by `codemation serve web --headless` for workspace pod containers where the
25
+ * UI is served externally (e.g. from the control-plane's customer-ui).
26
+ */
27
+ var HeadlessApiRuntime = class {
28
+ constructor(appContainerFactory, websocketServerFactory, httpServerFactory, logger) {
29
+ this.appContainerFactory = appContainerFactory;
30
+ this.websocketServerFactory = websocketServerFactory;
31
+ this.httpServerFactory = httpServerFactory;
32
+ this.logger = logger;
33
+ }
34
+ async start(appConfig) {
35
+ const port = Number(appConfig.env.PORT ?? 4001);
36
+ this.logger.info(`Starting codemation headless API runtime`);
37
+ this.logger.info(`HTTP port: ${port}, WS port: ${appConfig.webSocketPort}`);
38
+ const websocketServer = this.websocketServerFactory.create(appConfig);
39
+ const container = await this.appContainerFactory.create({
40
+ appConfig,
41
+ sharedWorkflowWebsocketServer: websocketServer
42
+ });
43
+ await container.resolve(FrontendRuntime).start();
44
+ const honoApp = container.resolve(CodemationHonoApiApp);
45
+ const httpServer = this.httpServerFactory.create(honoApp, port, this.logger);
46
+ await new Promise((resolve) => {
47
+ httpServer.listen(port, () => {
48
+ this.logger.info(`codemation headless API listening on port ${port}`);
49
+ resolve();
50
+ });
51
+ });
52
+ }
53
+ };
54
+
55
+ //#endregion
56
+ //#region src/presentation/websocket/WorkflowWebsocketServerFactory.ts
57
+ const loggerFactory = new ServerLoggerFactory(logLevelPolicyFactory);
58
+ var WorkflowWebsocketServerFactory = class {
59
+ create(appConfig) {
60
+ return new WorkflowWebsocketServer(appConfig.webSocketPort, appConfig.webSocketBindHost, loggerFactory.create("codemation-websocket.server"));
61
+ }
62
+ };
63
+
64
+ //#endregion
65
+ //#region src/presentation/http/HeadlessHttpServerFactory.ts
66
+ /**
67
+ * Creates a Node.js http.Server that bridges IncomingMessage to Hono's Fetch API.
68
+ * Used by {@link import("../../bootstrap/runtime/HeadlessApiRuntime").HeadlessApiRuntime}
69
+ * to serve the Hono API without Next.js.
70
+ */
71
+ var HeadlessHttpServerFactory = class {
72
+ create(honoApp, port, logger) {
73
+ return createServer((req, res) => {
74
+ const url = new URL(req.url ?? "/", `http://${req.headers.host ?? `127.0.0.1:${port}`}`);
75
+ const headers = new Headers();
76
+ for (const [key, value] of Object.entries(req.headers)) {
77
+ if (value === void 0) continue;
78
+ if (Array.isArray(value)) for (const v of value) headers.append(key, v);
79
+ else headers.set(key, value);
80
+ }
81
+ const chunks = [];
82
+ req.on("data", (chunk) => chunks.push(chunk));
83
+ req.on("end", () => {
84
+ const body = chunks.length > 0 ? Buffer.concat(chunks) : null;
85
+ const fetchRequest = new Request(url, {
86
+ method: req.method ?? "GET",
87
+ headers,
88
+ body: body?.byteLength ? body : void 0,
89
+ duplex: "half"
90
+ });
91
+ Promise.resolve(honoApp.fetch(fetchRequest)).then(async (fetchResponse) => {
92
+ const responseHeaders = {};
93
+ fetchResponse.headers.forEach((value, key) => {
94
+ responseHeaders[key] = value;
95
+ });
96
+ res.writeHead(fetchResponse.status, responseHeaders);
97
+ const responseBody = await fetchResponse.arrayBuffer();
98
+ res.end(Buffer.from(responseBody));
99
+ }).catch((err) => {
100
+ logger.error("Unhandled request error", err instanceof Error ? err : new Error(String(err)));
101
+ if (!res.headersSent) {
102
+ res.writeHead(500);
103
+ res.end("Internal server error");
104
+ }
105
+ });
106
+ });
107
+ });
108
+ }
109
+ };
110
+
111
+ //#endregion
112
+ export { ApiPaths, AppConfigFactory, AppContainerFactory, AppContainerLifecycle, ApplicationRequestError, ApplicationTokens, BootTimer, CodemationBootstrapRequest, CodemationConsumerConfigLoader, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, CodemationPluginListMerger, CodemationPluginPackageMetadata, CodemationPostgresPrismaClientFactory, CodemationServerGateway, CollectionSchemaSyncerHolder, DatabaseMigrations, DeleteCollectionRowCommand, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, FrontendRuntime, GetCollectionQuery, GetCollectionRowQuery, GetRunStateQuery, HeadlessApiRuntime, HeadlessHttpServerFactory, InsertCollectionRowCommand, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, ListCollectionRowsQuery, ListCollectionsQuery, ListUserAccountsQuery, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, StartWorkflowRunCommand, SyncCollectionsCommand, UpdateCollectionRowCommand, UpsertLocalBootstrapUserCommand, WorkerRuntime, WorkflowWebsocketServerFactory, defineCodemationApp, definePlugin, workflow };
113
+ //# sourceMappingURL=index.js.map