@codemation/host 0.3.0 → 1.0.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 (46) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/dist/{AppConfigFactory-Dq7ttwQ_.d.ts → AppConfigFactory-PFmDg5Sg.d.ts} +3 -3
  3. package/dist/{AppContainerFactory-D9je1sSV.js → AppContainerFactory-Cr3JeVmg.js} +85 -132
  4. package/dist/AppContainerFactory-Cr3JeVmg.js.map +1 -0
  5. package/dist/{CodemationAppContext-P7P-xZhQ.d.ts → CodemationAppContext-DP_-56c6.d.ts} +2 -2
  6. package/dist/{CodemationAuthoring.types-OMYu7vKP.d.ts → CodemationAuthoring.types-zJ2t73Bn.d.ts} +4 -3
  7. package/dist/{CodemationConfigNormalizer-BCtBrJDe.d.ts → CodemationConfigNormalizer-B8RGUwAe.d.ts} +2 -2
  8. package/dist/{CodemationConsumerConfigLoader-evvw4b_a.d.ts → CodemationConsumerConfigLoader-C_QVwcI3.d.ts} +2 -2
  9. package/dist/{CodemationPluginListMerger-PSTtEQjC.d.ts → CodemationPluginListMerger-Bgn1CIX9.d.ts} +5 -5
  10. package/dist/{CredentialServices-0Hk8RFY1.d.ts → CredentialServices-95DPogx-.d.ts} +3 -3
  11. package/dist/{PublicFrontendBootstrapFactory-D0_ds7nS.d.ts → PublicFrontendBootstrapFactory-C_iLgPV-.d.ts} +2 -2
  12. package/dist/authoring.d.ts +3 -3
  13. package/dist/consumer.d.ts +4 -4
  14. package/dist/credentials.d.ts +3 -3
  15. package/dist/devServerSidecar.d.ts +1 -1
  16. package/dist/{index-CeS2saCe.d.ts → index-W4eSjdCM.d.ts} +26 -15
  17. package/dist/index.d.ts +11 -11
  18. package/dist/index.js +2 -2
  19. package/dist/nextServer.d.ts +7 -7
  20. package/dist/nextServer.js +1 -1
  21. package/dist/{persistenceServer-CJeu1STC.d.ts → persistenceServer-_pqP_0nw.d.ts} +2 -2
  22. package/dist/persistenceServer.d.ts +5 -5
  23. package/dist/{server-C_ZIEOTY.js → server-BE4PLhcb.js} +2 -2
  24. package/dist/{server-C_ZIEOTY.js.map → server-BE4PLhcb.js.map} +1 -1
  25. package/dist/{server-Clvg5x1w.d.ts → server-Q5uwa6iR.d.ts} +5 -5
  26. package/dist/server.d.ts +8 -8
  27. package/dist/server.js +2 -2
  28. package/package.json +7 -5
  29. package/src/bootstrap/AppContainerFactory.ts +77 -81
  30. package/src/bootstrap/CodemationContainerRegistrationRegistrar.ts +1 -3
  31. package/src/infrastructure/config/CodemationPluginRegistrar.ts +2 -6
  32. package/src/infrastructure/di/HandlesDomainEventRegistry.ts +5 -7
  33. package/src/infrastructure/persistence/PrismaWorkflowRunRepository.ts +8 -0
  34. package/src/presentation/http/hono/registrars/AuthHonoApiRouteRegistrar.ts +1 -3
  35. package/src/presentation/http/hono/registrars/BinaryHonoApiRouteRegistrar.ts +1 -3
  36. package/src/presentation/http/hono/registrars/BootstrapHonoApiRouteRegistrar.ts +1 -3
  37. package/src/presentation/http/hono/registrars/CredentialHonoApiRouteRegistrar.ts +1 -3
  38. package/src/presentation/http/hono/registrars/DevHonoApiRouteRegistrar.ts +1 -3
  39. package/src/presentation/http/hono/registrars/OAuth2HonoApiRouteRegistrar.ts +1 -3
  40. package/src/presentation/http/hono/registrars/RunHonoApiRouteRegistrar.ts +1 -3
  41. package/src/presentation/http/hono/registrars/TelemetryHonoApiRouteRegistrar.ts +1 -3
  42. package/src/presentation/http/hono/registrars/UserHonoApiRouteRegistrar.ts +1 -3
  43. package/src/presentation/http/hono/registrars/WebhookHonoApiRouteRegistrar.ts +1 -3
  44. package/src/presentation/http/hono/registrars/WhitelabelHonoApiRouteRegistrar.ts +1 -3
  45. package/src/presentation/http/hono/registrars/WorkflowHonoApiRouteRegistrar.ts +1 -3
  46. package/dist/AppContainerFactory-D9je1sSV.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { G as EngineExecutionLimitsPolicyConfig, I as WorkflowDefinition, U as Container, W as TypeToken, l as AnyCredentialType } from "./index-CeS2saCe.js";
1
+ import { G as EngineExecutionLimitsPolicyConfig, I as WorkflowDefinition, U as Container, W as TypeToken, l as AnyCredentialType } from "./index-W4eSjdCM.js";
2
2
  import { a as CodemationAuthConfig, n as CodemationLogConfig, t as CodemationWhitelabelConfig, u as LoggerFactory } from "./CodemationWhitelabelConfig-D5rYcLlj.js";
3
3
 
4
4
  //#region src/presentation/config/CodemationClassToken.d.ts
@@ -177,4 +177,4 @@ interface CodemationAppContext extends CodemationRegistrationContextBase {
177
177
  }
178
178
  //#endregion
179
179
  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 };
180
- //# sourceMappingURL=CodemationAppContext-P7P-xZhQ.d.ts.map
180
+ //# sourceMappingURL=CodemationAppContext-DP_-56c6.d.ts.map
@@ -1,7 +1,8 @@
1
- import { A as Items, F as RunnableNodeOutputJson, I as WorkflowDefinition, J as ChainCursor, P as RunnableNodeConfig, W as TypeToken, Y as AnyRunnableNodeConfig, a as ChatModelConfig, c as DefinedNodeConfigInput, g as CredentialJsonRecord, i as AgentMessageConfig, k as Item, l as AnyCredentialType, o as ToolConfig, r as AgentGuardrailConfig, s as DefinedNode, z as NodeExecutionContext } from "./index-CeS2saCe.js";
2
- import { c as CodemationPluginContext, m as CodemationConfig, o as CodemationPlugin, t as CodemationAppContext } from "./CodemationAppContext-P7P-xZhQ.js";
1
+ import { A as Items, F as RunnableNodeOutputJson, I as WorkflowDefinition, J as ChainCursor, P as RunnableNodeConfig, W as TypeToken, Y as AnyRunnableNodeConfig, a as ChatModelConfig, c as DefinedNodeConfigInput, g as CredentialJsonRecord, i as AgentMessageConfig, k as Item, l as AnyCredentialType, o as ToolConfig, r as AgentGuardrailConfig, s as DefinedNode, z as NodeExecutionContext } from "./index-W4eSjdCM.js";
2
+ import { c as CodemationPluginContext, m as CodemationConfig, o as CodemationPlugin, t as CodemationAppContext } from "./CodemationAppContext-DP_-56c6.js";
3
3
  import { t as CodemationWhitelabelConfig } from "./CodemationWhitelabelConfig-D5rYcLlj.js";
4
4
  import { ZodType, z } from "zod";
5
+ import "ai";
5
6
 
6
7
  //#region ../core-nodes/src/nodes/aggregate.d.ts
7
8
  declare class Aggregate<TIn = unknown, TOut = unknown> implements RunnableNodeConfig<TIn, TOut> {
@@ -259,4 +260,4 @@ declare function definePlugin(options: DefinePluginOptions): CodemationPlugin &
259
260
  }>;
260
261
  //#endregion
261
262
  export { defineCodemationApp as a, FriendlyCodemationExecutionConfig as i, DefinePluginOptions as n, definePlugin as o, FriendlyCodemationDatabaseConfig as r, workflow as s, DefineCodemationAppOptions as t };
262
- //# sourceMappingURL=CodemationAuthoring.types-OMYu7vKP.d.ts.map
263
+ //# sourceMappingURL=CodemationAuthoring.types-zJ2t73Bn.d.ts.map
@@ -1,4 +1,4 @@
1
- import { C as CodemationContainerRegistration, m as CodemationConfig } from "./CodemationAppContext-P7P-xZhQ.js";
1
+ import { C as CodemationContainerRegistration, m as CodemationConfig } from "./CodemationAppContext-DP_-56c6.js";
2
2
 
3
3
  //#region src/presentation/config/CodemationConfigNormalizer.d.ts
4
4
  type NormalizedCodemationConfig = CodemationConfig & Readonly<{
@@ -6,4 +6,4 @@ type NormalizedCodemationConfig = CodemationConfig & Readonly<{
6
6
  }>;
7
7
  //#endregion
8
8
  export { NormalizedCodemationConfig as t };
9
- //# sourceMappingURL=CodemationConfigNormalizer-BCtBrJDe.d.ts.map
9
+ //# sourceMappingURL=CodemationConfigNormalizer-B8RGUwAe.d.ts.map
@@ -1,4 +1,4 @@
1
- import { t as NormalizedCodemationConfig } from "./CodemationConfigNormalizer-BCtBrJDe.js";
1
+ import { t as NormalizedCodemationConfig } from "./CodemationConfigNormalizer-B8RGUwAe.js";
2
2
 
3
3
  //#region src/presentation/server/CodemationConsumerAppResolver.d.ts
4
4
  type CodemationConsumerApp = Readonly<{
@@ -63,4 +63,4 @@ declare class CodemationConsumerConfigLoader {
63
63
  }
64
64
  //#endregion
65
65
  export { CodemationConsumerAppResolver as i, CodemationConsumerConfigResolution as n, CodemationConsumerApp as r, CodemationConsumerConfigLoader as t };
66
- //# sourceMappingURL=CodemationConsumerConfigLoader-evvw4b_a.d.ts.map
66
+ //# sourceMappingURL=CodemationConsumerConfigLoader-C_QVwcI3.d.ts.map
@@ -1,9 +1,9 @@
1
- import { $ as PersistedRunState, B as NodeExecutionRequestHandler, H as WorkflowRepository, I as WorkflowDefinition, K as RunEvent, L as WorkflowId, M as RunId, Q as WorkflowRunDetailDto, R as BinaryStorage, U as Container, V as NodeExecutionScheduler, W as TypeToken, X as WorkflowActivationPolicy, at as TelemetryMetricRecord, et as RunCurrentState, it as TelemetryAttributes, j as PersistedRunPolicySnapshot, l as AnyCredentialType, n as Engine, nt as RunSummary, ot as TelemetrySpanEventRecord, q as RunEventBus, rt as TelemetryArtifactAttachment, st as Clock, tt as RunPruneCandidate } from "./index-CeS2saCe.js";
2
- import { C as CodemationContainerRegistration, l as CodemationPluginPackageMetadata, o as CodemationPlugin, r as AppConfig } from "./CodemationAppContext-P7P-xZhQ.js";
1
+ import { $ as PersistedRunState, B as NodeExecutionRequestHandler, H as WorkflowRepository, I as WorkflowDefinition, K as RunEvent, L as WorkflowId, M as RunId, Q as WorkflowRunDetailDto, R as BinaryStorage, U as Container, V as NodeExecutionScheduler, W as TypeToken, X as WorkflowActivationPolicy, at as TelemetryMetricRecord, et as RunCurrentState, it as TelemetryAttributes, j as PersistedRunPolicySnapshot, l as AnyCredentialType, n as Engine, nt as RunSummary, ot as TelemetrySpanEventRecord, q as RunEventBus, rt as TelemetryArtifactAttachment, st as Clock, tt as RunPruneCandidate } from "./index-W4eSjdCM.js";
2
+ import { C as CodemationContainerRegistration, l as CodemationPluginPackageMetadata, o as CodemationPlugin, r as AppConfig } from "./CodemationAppContext-DP_-56c6.js";
3
3
  import { a as CodemationAuthConfig, l as Logger, t as CodemationWhitelabelConfig, u as LoggerFactory } from "./CodemationWhitelabelConfig-D5rYcLlj.js";
4
4
  import { t as LogLevelPolicy } from "./LogLevelPolicy-CkiJAH75.js";
5
- import { t as CredentialStore } from "./CredentialServices-0Hk8RFY1.js";
6
- import { n as PrismaMigrationDeployer, r as PrismaDatabaseClient } from "./AppConfigFactory-Dq7ttwQ_.js";
5
+ import { t as CredentialStore } from "./CredentialServices-95DPogx-.js";
6
+ import { n as PrismaMigrationDeployer, r as PrismaDatabaseClient } from "./AppConfigFactory-PFmDg5Sg.js";
7
7
  import "reflect-metadata";
8
8
  import { Hono } from "hono";
9
9
 
@@ -671,4 +671,4 @@ declare class CodemationPluginListMerger {
671
671
  }
672
672
  //#endregion
673
673
  export { Command as S, AppContainerFactory as _, WorkflowDebuggerOverlayRepository as a, Query as b, FrontendRuntime as c, LogLevelPolicyFactory as d, logLevelPolicyFactory as f, AppContainerLifecycle as g, DatabaseMigrations as h, HonoApiRouteRegistrar as i, WorkflowRunRetentionPruneScheduler as l, WorkflowRunRepository as m, CodemationBootstrapRequest as n, SessionVerifier as o, LogFilter as p, ApplicationTokens as r, WorkerRuntime as s, CodemationPluginListMerger as t, ServerLoggerFactory as u, WorkflowWebsocketServer as v, CommandBus as x, QueryBus as y };
674
- //# sourceMappingURL=CodemationPluginListMerger-PSTtEQjC.d.ts.map
674
+ //# sourceMappingURL=CodemationPluginListMerger-Bgn1CIX9.d.ts.map
@@ -1,5 +1,5 @@
1
- import { C as CredentialType, E as CredentialTypeRegistry, H as WorkflowRepository, I as WorkflowDefinition, S as CredentialSetupStatus, T as CredentialTypeId, _ as CredentialMaterialSourceKind, d as CredentialBindingKey, f as CredentialFieldSchema, g as CredentialJsonRecord, h as CredentialInstanceRecord, l as AnyCredentialType, m as CredentialInstanceId, p as CredentialHealth, u as CredentialBinding, v as CredentialOAuth2AuthDefinition, w as CredentialTypeDefinition, x as CredentialSessionService, y as CredentialRequirement } from "./index-CeS2saCe.js";
2
- import { r as AppConfig } from "./CodemationAppContext-P7P-xZhQ.js";
1
+ import { C as CredentialType, E as CredentialTypeRegistry, H as WorkflowRepository, I as WorkflowDefinition, S as CredentialSetupStatus, T as CredentialTypeId, _ as CredentialMaterialSourceKind, d as CredentialBindingKey, f as CredentialFieldSchema, g as CredentialJsonRecord, h as CredentialInstanceRecord, l as AnyCredentialType, m as CredentialInstanceId, p as CredentialHealth, u as CredentialBinding, v as CredentialOAuth2AuthDefinition, w as CredentialTypeDefinition, x as CredentialSessionService, y as CredentialRequirement } from "./index-W4eSjdCM.js";
2
+ import { r as AppConfig } from "./CodemationAppContext-DP_-56c6.js";
3
3
 
4
4
  //#region src/domain/credentials/CredentialTypeRegistryImpl.d.ts
5
5
  declare class CredentialTypeRegistryImpl implements CredentialTypeRegistry {
@@ -298,4 +298,4 @@ type MutableCredentialSessionService = CredentialSessionService & Readonly<{
298
298
  }>;
299
299
  //#endregion
300
300
  export { CredentialInstanceService as a, CredentialSecretCipher as c, CredentialBindingService as i, CredentialFieldEnvOverlayService as l, CredentialType$1 as n, CredentialOAuth2ScopeResolver as o, CredentialRuntimeMaterialService as r, CredentialMaterialResolver as s, CredentialStore as t, CredentialTypeRegistryImpl as u };
301
- //# sourceMappingURL=CredentialServices-0Hk8RFY1.d.ts.map
301
+ //# sourceMappingURL=CredentialServices-95DPogx-.d.ts.map
@@ -1,4 +1,4 @@
1
- import { r as AppConfig } from "./CodemationAppContext-P7P-xZhQ.js";
1
+ import { r as AppConfig } from "./CodemationAppContext-DP_-56c6.js";
2
2
  import { a as CodemationAuthConfig } from "./CodemationWhitelabelConfig-D5rYcLlj.js";
3
3
  import { a as CodemationFrontendAuthSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-ci0Vwxrb.js";
4
4
 
@@ -90,4 +90,4 @@ declare class PublicFrontendBootstrapFactory {
90
90
  }
91
91
  //#endregion
92
92
  export { WorkflowDto as a, CodemationFrontendAuthSnapshotFactory as i, InternalAuthBootstrapFactory as n, WorkflowSummary as o, FrontendAppConfigFactory as r, PublicFrontendBootstrapFactory as t };
93
- //# sourceMappingURL=PublicFrontendBootstrapFactory-D0_ds7nS.d.ts.map
93
+ //# sourceMappingURL=PublicFrontendBootstrapFactory-C_iLgPV-.d.ts.map
@@ -1,5 +1,5 @@
1
- import "./index-CeS2saCe.js";
2
- 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-OMYu7vKP.js";
3
- 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-P7P-xZhQ.js";
1
+ import "./index-W4eSjdCM.js";
2
+ 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-zJ2t73Bn.js";
3
+ 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-DP_-56c6.js";
4
4
  import "./CodemationWhitelabelConfig-D5rYcLlj.js";
5
5
  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 };
@@ -1,6 +1,6 @@
1
- import "./index-CeS2saCe.js";
2
- import "./CodemationAppContext-P7P-xZhQ.js";
1
+ import "./index-W4eSjdCM.js";
2
+ import "./CodemationAppContext-DP_-56c6.js";
3
3
  import "./CodemationWhitelabelConfig-D5rYcLlj.js";
4
- import "./CodemationConfigNormalizer-BCtBrJDe.js";
5
- import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-evvw4b_a.js";
4
+ import "./CodemationConfigNormalizer-B8RGUwAe.js";
5
+ import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-C_QVwcI3.js";
6
6
  export { type CodemationConsumerApp, CodemationConsumerAppResolver, CodemationConsumerConfigLoader, type CodemationConsumerConfigResolution };
@@ -1,7 +1,7 @@
1
- import { b as CredentialSessionFactoryArgs, l as AnyCredentialType, p as CredentialHealth } from "./index-CeS2saCe.js";
2
- import "./CodemationAppContext-P7P-xZhQ.js";
1
+ import { b as CredentialSessionFactoryArgs, l as AnyCredentialType, p as CredentialHealth } from "./index-W4eSjdCM.js";
2
+ import "./CodemationAppContext-DP_-56c6.js";
3
3
  import "./CodemationWhitelabelConfig-D5rYcLlj.js";
4
- import { a as CredentialInstanceService, i as CredentialBindingService, n as CredentialType } from "./CredentialServices-0Hk8RFY1.js";
4
+ import { a as CredentialInstanceService, i as CredentialBindingService, n as CredentialType } from "./CredentialServices-95DPogx-.js";
5
5
 
6
6
  //#region src/infrastructure/credentials/OpenAiApiKeyCredentialShapes.types.d.ts
7
7
  /**
@@ -1,4 +1,4 @@
1
- import { I as WorkflowDefinition, U as Container } from "./index-CeS2saCe.js";
1
+ import { I as WorkflowDefinition, U as Container } from "./index-W4eSjdCM.js";
2
2
 
3
3
  //#region src/presentation/server/CodemationTsyringeParamInfoReader.d.ts
4
4
  declare class CodemationTsyringeParamInfoReader {
@@ -1215,7 +1215,6 @@ interface AgentCanvasPresentation<TIcon extends string = string> {
1215
1215
  readonly label?: string;
1216
1216
  readonly icon?: TIcon;
1217
1217
  }
1218
- type ZodSchemaAny = ZodType<any, any, any>;
1219
1218
  interface ToolConfig {
1220
1219
  readonly type: TypeToken<unknown>;
1221
1220
  readonly name: string;
@@ -1267,25 +1266,37 @@ interface ChatModelConfig {
1267
1266
  readonly presentation?: AgentCanvasPresentation;
1268
1267
  getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
1269
1268
  }
1270
- interface LangChainChatModelLike {
1271
- invoke(input: unknown, options?: unknown): Promise<unknown>;
1272
- bindTools?(tools: ReadonlyArray<unknown>): LangChainChatModelLike;
1273
- withStructuredOutput?(outputSchema: ZodSchemaAny, config?: ChatModelStructuredOutputOptions): LangChainStructuredOutputModelLike;
1274
- }
1275
- interface LangChainStructuredOutputModelLike {
1276
- invoke(input: unknown, options?: unknown): Promise<unknown>;
1269
+ /**
1270
+ * Provider-neutral chat language model wrapper returned by a {@link ChatModelFactory}.
1271
+ *
1272
+ * Thin adapter around an AI SDK `LanguageModelV2` (from `@ai-sdk/provider`) plus the call-site
1273
+ * defaults Codemation needs at every generate/stream: the provider label, the model name used for
1274
+ * pricing / telemetry, and the default invocation options (max output tokens, temperature,
1275
+ * provider-specific overrides).
1276
+ *
1277
+ * The consumer (AIAgentNode / AgentStructuredOutputRunner) passes `languageModel` directly into
1278
+ * `generateText({ model, ... })` from the `ai` package.
1279
+ */
1280
+ interface ChatLanguageModel {
1281
+ /** AI SDK `LanguageModelV2` instance (kept `unknown` to avoid leaking the SDK type into `@codemation/core`). */
1282
+ readonly languageModel: unknown;
1283
+ /** Stable pricing/telemetry key — e.g. `"gpt-4.1-nano"`. */
1284
+ readonly modelName: string;
1285
+ /** Provider label — e.g. `"openai"`. Used for cost tracking. */
1286
+ readonly provider?: string;
1287
+ /** Defaults merged into every call. Consumers may override per-invocation. */
1288
+ readonly defaultCallOptions?: ChatLanguageModelCallOptions;
1277
1289
  }
1278
- interface ChatModelStructuredOutputOptions {
1279
- readonly method?: "jsonSchema" | "functionCalling" | "jsonMode";
1280
- readonly strict?: boolean;
1281
- readonly includeRaw?: boolean;
1282
- readonly tools?: ReadonlyArray<unknown>;
1290
+ interface ChatLanguageModelCallOptions {
1291
+ readonly maxOutputTokens?: number;
1292
+ readonly temperature?: number;
1293
+ readonly providerOptions?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
1283
1294
  }
1284
1295
  interface ChatModelFactory<TConfig$1 extends ChatModelConfig = ChatModelConfig> {
1285
1296
  create(args: Readonly<{
1286
1297
  config: TConfig$1;
1287
1298
  ctx: NodeExecutionContext<any>;
1288
- }>): Promise<LangChainChatModelLike> | LangChainChatModelLike;
1299
+ }>): Promise<ChatLanguageModel> | ChatLanguageModel;
1289
1300
  }
1290
1301
  //#endregion
1291
1302
  //#region ../core/src/orchestration/Engine.d.ts
@@ -1483,4 +1494,4 @@ declare class RunIntentService {
1483
1494
  }
1484
1495
  //#endregion
1485
1496
  export { PersistedRunState as $, Items as A, NodeExecutionRequestHandler as B, CredentialType as C, ActivationIdFactory as D, CredentialTypeRegistry as E, RunnableNodeOutputJson as F, EngineExecutionLimitsPolicyConfig as G, WorkflowRepository as H, WorkflowDefinition as I, ChainCursor as J, RunEvent as K, WorkflowId as L, RunId as M, RunIdFactory as N, BinaryAttachment as O, RunnableNodeConfig as P, WorkflowRunDetailDto as Q, BinaryStorage as R, CredentialSetupStatus as S, CredentialTypeId as T, Container as U, NodeExecutionScheduler as V, TypeToken as W, WorkflowActivationPolicy as X, AnyRunnableNodeConfig as Y, WebhookInvocationMatch as Z, CredentialMaterialSourceKind as _, ChatModelConfig as a, TelemetryMetricRecord as at, CredentialSessionFactoryArgs as b, DefinedNodeConfigInput as c, CredentialBindingKey as d, RunCurrentState as et, CredentialFieldSchema as f, CredentialJsonRecord as g, CredentialInstanceRecord as h, AgentMessageConfig as i, TelemetryAttributes as it, PersistedRunPolicySnapshot as j, Item as k, AnyCredentialType as l, CredentialInstanceId as m, Engine as n, RunSummary as nt, ToolConfig as o, TelemetrySpanEventRecord as ot, CredentialHealth as p, RunEventBus as q, AgentGuardrailConfig as r, TelemetryArtifactAttachment as rt, DefinedNode as s, Clock as st, RunIntentService as t, RunPruneCandidate as tt, CredentialBinding as u, CredentialOAuth2AuthDefinition as v, CredentialTypeDefinition as w, CredentialSessionService as x, CredentialRequirement as y, NodeExecutionContext as z };
1486
- //# sourceMappingURL=index-CeS2saCe.d.ts.map
1497
+ //# sourceMappingURL=index-W4eSjdCM.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,18 +1,18 @@
1
- import "./index-CeS2saCe.js";
2
- 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-OMYu7vKP.js";
3
- 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-P7P-xZhQ.js";
1
+ import "./index-W4eSjdCM.js";
2
+ 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-zJ2t73Bn.js";
3
+ 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-DP_-56c6.js";
4
4
  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-D5rYcLlj.js";
5
5
  import "./LogLevelPolicy-CkiJAH75.js";
6
6
  import { a as CodemationFrontendAuthSnapshot, i as CodemationFrontendAuthProviderSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-ci0Vwxrb.js";
7
7
  import { i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-Ja0GQgpp.js";
8
- import "./CodemationConfigNormalizer-BCtBrJDe.js";
9
- import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-evvw4b_a.js";
10
- import "./CredentialServices-0Hk8RFY1.js";
11
- import { S as Command, _ as AppContainerFactory, b as Query, c as FrontendRuntime, g as AppContainerLifecycle, h as DatabaseMigrations, n as CodemationBootstrapRequest, r as ApplicationTokens, s as WorkerRuntime, t as CodemationPluginListMerger, x as CommandBus, y as QueryBus } from "./CodemationPluginListMerger-PSTtEQjC.js";
12
- import { r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-Dq7ttwQ_.js";
13
- import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-CJeu1STC.js";
14
- import { c as CodemationServerGateway, l as ApiPaths } from "./server-Clvg5x1w.js";
15
- import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-D0_ds7nS.js";
8
+ import "./CodemationConfigNormalizer-B8RGUwAe.js";
9
+ import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-C_QVwcI3.js";
10
+ import "./CredentialServices-95DPogx-.js";
11
+ import { S as Command, _ as AppContainerFactory, b as Query, c as FrontendRuntime, g as AppContainerLifecycle, h as DatabaseMigrations, n as CodemationBootstrapRequest, r as ApplicationTokens, s as WorkerRuntime, t as CodemationPluginListMerger, x as CommandBus, y as QueryBus } from "./CodemationPluginListMerger-Bgn1CIX9.js";
12
+ import { r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-PFmDg5Sg.js";
13
+ import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-_pqP_0nw.js";
14
+ import { c as CodemationServerGateway, l as ApiPaths } from "./server-Q5uwa6iR.js";
15
+ import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-C_iLgPV-.js";
16
16
 
17
17
  //#region src/application/contracts/userDirectoryContracts.types.d.ts
18
18
  type UserAccountStatus = "invited" | "active" | "inactive";
package/dist/index.js CHANGED
@@ -6,11 +6,11 @@ import "./ServerLoggerFactory-CsNW5qhz.js";
6
6
  import "./decorateParam-D7WPDFAf.js";
7
7
  import "./decorate-Dq0XLibd.js";
8
8
  import { d as ApplicationTokens } from "./CredentialServices-BNBMFOPt.js";
9
- import { D as ListUserAccountsQuery, E as UpsertLocalBootstrapUserCommand, _ as FrontendAppConfigFactory, a as AppContainerLifecycle, b as ApiPaths, g as InternalAuthBootstrapFactory, h as PublicFrontendBootstrapFactory, i as DatabaseMigrations, n as WorkerRuntime, r as FrontendRuntime, t as AppContainerFactory, v as CodemationFrontendAuthSnapshotFactory } from "./AppContainerFactory-D9je1sSV.js";
9
+ import { D as ListUserAccountsQuery, E as UpsertLocalBootstrapUserCommand, _ as FrontendAppConfigFactory, a as AppContainerLifecycle, b as ApiPaths, g as InternalAuthBootstrapFactory, h as PublicFrontendBootstrapFactory, i as DatabaseMigrations, n as WorkerRuntime, r as FrontendRuntime, t as AppContainerFactory, v as CodemationFrontendAuthSnapshotFactory } from "./AppContainerFactory-Cr3JeVmg.js";
10
10
  import { n as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-BPp02HMv.js";
11
11
  import { n as CodemationBootstrapRequest, t as CodemationPluginListMerger } from "./CodemationPluginListMerger-_lZaa6gO.js";
12
12
  import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-CA0_q0D7.js";
13
- import { r as CodemationServerGateway } from "./server-C_ZIEOTY.js";
13
+ import { r as CodemationServerGateway } from "./server-BE4PLhcb.js";
14
14
  import { workflow } from "@codemation/core-nodes";
15
15
 
16
16
  export { ApiPaths, AppConfigFactory, AppContainerFactory, AppContainerLifecycle, ApplicationTokens, CodemationBootstrapRequest, CodemationConsumerConfigLoader, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, CodemationPluginListMerger, CodemationPluginPackageMetadata, CodemationPostgresPrismaClientFactory, CodemationServerGateway, DatabaseMigrations, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, FrontendRuntime, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, ListUserAccountsQuery, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, UpsertLocalBootstrapUserCommand, WorkerRuntime, defineCodemationApp, definePlugin, workflow };
@@ -1,13 +1,13 @@
1
- import { D as ActivationIdFactory, I as WorkflowDefinition$1, N as RunIdFactory, O as BinaryAttachment, R as BinaryStorage, X as WorkflowActivationPolicy, Z as WebhookInvocationMatch, k as Item, t as RunIntentService, v as CredentialOAuth2AuthDefinition, w as CredentialTypeDefinition } from "./index-CeS2saCe.js";
2
- import { r as AppConfig } from "./CodemationAppContext-P7P-xZhQ.js";
1
+ import { D as ActivationIdFactory, I as WorkflowDefinition$1, N as RunIdFactory, O as BinaryAttachment, R as BinaryStorage, X as WorkflowActivationPolicy, Z as WebhookInvocationMatch, k as Item, t as RunIntentService, v as CredentialOAuth2AuthDefinition, w as CredentialTypeDefinition } from "./index-W4eSjdCM.js";
2
+ import { r as AppConfig } from "./CodemationAppContext-DP_-56c6.js";
3
3
  import { l as Logger, u as LoggerFactory } from "./CodemationWhitelabelConfig-D5rYcLlj.js";
4
4
  import "./LogLevelPolicy-CkiJAH75.js";
5
5
  import { a as CodemationFrontendAuthSnapshot, i as CodemationFrontendAuthProviderSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-ci0Vwxrb.js";
6
- import "./CodemationConfigNormalizer-BCtBrJDe.js";
7
- import { a as CredentialInstanceService, c as CredentialSecretCipher, i as CredentialBindingService, l as CredentialFieldEnvOverlayService, o as CredentialOAuth2ScopeResolver, r as CredentialRuntimeMaterialService, s as CredentialMaterialResolver, t as CredentialStore, u as CredentialTypeRegistryImpl } from "./CredentialServices-0Hk8RFY1.js";
8
- import { _ as AppContainerFactory, a as WorkflowDebuggerOverlayRepository, c as FrontendRuntime, d as LogLevelPolicyFactory, f as logLevelPolicyFactory, g as AppContainerLifecycle, h as DatabaseMigrations, i as HonoApiRouteRegistrar, l as WorkflowRunRetentionPruneScheduler, m as WorkflowRunRepository, n as CodemationBootstrapRequest, o as SessionVerifier, p as LogFilter, r as ApplicationTokens, s as WorkerRuntime, t as CodemationPluginListMerger, u as ServerLoggerFactory, v as WorkflowWebsocketServer, x as CommandBus, y as QueryBus } from "./CodemationPluginListMerger-PSTtEQjC.js";
9
- import { t as AppConfigFactory } from "./AppConfigFactory-Dq7ttwQ_.js";
10
- import { a as WorkflowDto, n as InternalAuthBootstrapFactory, o as WorkflowSummary, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-D0_ds7nS.js";
6
+ import "./CodemationConfigNormalizer-B8RGUwAe.js";
7
+ import { a as CredentialInstanceService, c as CredentialSecretCipher, i as CredentialBindingService, l as CredentialFieldEnvOverlayService, o as CredentialOAuth2ScopeResolver, r as CredentialRuntimeMaterialService, s as CredentialMaterialResolver, t as CredentialStore, u as CredentialTypeRegistryImpl } from "./CredentialServices-95DPogx-.js";
8
+ import { _ as AppContainerFactory, a as WorkflowDebuggerOverlayRepository, c as FrontendRuntime, d as LogLevelPolicyFactory, f as logLevelPolicyFactory, g as AppContainerLifecycle, h as DatabaseMigrations, i as HonoApiRouteRegistrar, l as WorkflowRunRetentionPruneScheduler, m as WorkflowRunRepository, n as CodemationBootstrapRequest, o as SessionVerifier, p as LogFilter, r as ApplicationTokens, s as WorkerRuntime, t as CodemationPluginListMerger, u as ServerLoggerFactory, v as WorkflowWebsocketServer, x as CommandBus, y as QueryBus } from "./CodemationPluginListMerger-Bgn1CIX9.js";
9
+ import { t as AppConfigFactory } from "./AppConfigFactory-PFmDg5Sg.js";
10
+ import { a as WorkflowDto, n as InternalAuthBootstrapFactory, o as WorkflowSummary, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-C_iLgPV-.js";
11
11
  import { Hono } from "hono";
12
12
  import { NodeDefinition, WorkflowDefinition } from "@codemation/core/browser";
13
13
 
@@ -3,7 +3,7 @@ import { a as FilteringLogger, i as PerformanceLogPolicy, n as PerformanceLogPol
3
3
  import "./decorateParam-D7WPDFAf.js";
4
4
  import "./decorate-Dq0XLibd.js";
5
5
  import { a as CredentialInstanceService, d as ApplicationTokens, i as CredentialBindingService } from "./CredentialServices-BNBMFOPt.js";
6
- import { S as WorkflowPolicyUiPresentationFactory, T as RunBinaryAttachmentLookupService, _ as FrontendAppConfigFactory, a as AppContainerLifecycle, c as WebhookHttpRouteHandler, d as OAuth2HttpRouteHandler, f as CredentialHttpRouteHandler, g as InternalAuthBootstrapFactory, h as PublicFrontendBootstrapFactory, i as DatabaseMigrations, l as RequestToWebhookItemMapper, m as BinaryHttpRouteHandler, n as WorkerRuntime, o as WorkflowRunRetentionPruneScheduler, p as CodemationHonoApiApp, r as FrontendRuntime, s as WorkflowHttpRouteHandler, t as AppContainerFactory, u as RunHttpRouteHandler, x as WorkflowDefinitionMapper, y as WorkflowWebsocketServer } from "./AppContainerFactory-D9je1sSV.js";
6
+ import { S as WorkflowPolicyUiPresentationFactory, T as RunBinaryAttachmentLookupService, _ as FrontendAppConfigFactory, a as AppContainerLifecycle, c as WebhookHttpRouteHandler, d as OAuth2HttpRouteHandler, f as CredentialHttpRouteHandler, g as InternalAuthBootstrapFactory, h as PublicFrontendBootstrapFactory, i as DatabaseMigrations, l as RequestToWebhookItemMapper, m as BinaryHttpRouteHandler, n as WorkerRuntime, o as WorkflowRunRetentionPruneScheduler, p as CodemationHonoApiApp, r as FrontendRuntime, s as WorkflowHttpRouteHandler, t as AppContainerFactory, u as RunHttpRouteHandler, x as WorkflowDefinitionMapper, y as WorkflowWebsocketServer } from "./AppContainerFactory-Cr3JeVmg.js";
7
7
  import { t as AppConfigFactory } from "./AppConfigFactory-BPp02HMv.js";
8
8
  import { n as CodemationBootstrapRequest, t as CodemationPluginListMerger } from "./CodemationPluginListMerger-_lZaa6gO.js";
9
9
 
@@ -1,4 +1,4 @@
1
- import { i as PrismaClient } from "./AppConfigFactory-Dq7ttwQ_.js";
1
+ import { i as PrismaClient } from "./AppConfigFactory-PFmDg5Sg.js";
2
2
 
3
3
  //#region src/infrastructure/persistence/CodemationPostgresPrismaClientFactory.d.ts
4
4
  declare class CodemationPostgresPrismaClientFactory {
@@ -6,4 +6,4 @@ declare class CodemationPostgresPrismaClientFactory {
6
6
  }
7
7
  //#endregion
8
8
  export { CodemationPostgresPrismaClientFactory as t };
9
- //# sourceMappingURL=persistenceServer-CJeu1STC.d.ts.map
9
+ //# sourceMappingURL=persistenceServer-_pqP_0nw.d.ts.map
@@ -1,7 +1,7 @@
1
- import "./index-CeS2saCe.js";
2
- import { i as AppPersistenceConfig } from "./CodemationAppContext-P7P-xZhQ.js";
1
+ import "./index-W4eSjdCM.js";
2
+ import { i as AppPersistenceConfig } from "./CodemationAppContext-DP_-56c6.js";
3
3
  import "./CodemationWhitelabelConfig-D5rYcLlj.js";
4
- import "./CodemationConfigNormalizer-BCtBrJDe.js";
5
- import { n as PrismaMigrationDeployer, r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-Dq7ttwQ_.js";
6
- import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-CJeu1STC.js";
4
+ import "./CodemationConfigNormalizer-B8RGUwAe.js";
5
+ import { n as PrismaMigrationDeployer, r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-PFmDg5Sg.js";
6
+ import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-_pqP_0nw.js";
7
7
  export { AppConfigFactory, AppPersistenceConfig, CodemationPostgresPrismaClientFactory, PrismaDatabaseClient as PrismaClient, PrismaMigrationDeployer };
@@ -1,6 +1,6 @@
1
1
  import { a as CodemationConfigNormalizer, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-DovlxZNb.js";
2
2
  import { d as ApplicationTokens } from "./CredentialServices-BNBMFOPt.js";
3
- import { C as GetWorkflowSummariesQuery, a as AppContainerLifecycle, p as CodemationHonoApiApp, r as FrontendRuntime, t as AppContainerFactory, w as GetWorkflowDetailQuery, x as WorkflowDefinitionMapper } from "./AppContainerFactory-D9je1sSV.js";
3
+ import { C as GetWorkflowSummariesQuery, a as AppContainerLifecycle, p as CodemationHonoApiApp, r as FrontendRuntime, t as AppContainerFactory, w as GetWorkflowDetailQuery, x as WorkflowDefinitionMapper } from "./AppContainerFactory-Cr3JeVmg.js";
4
4
  import { n as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-BPp02HMv.js";
5
5
  import { readFile, readdir } from "node:fs/promises";
6
6
  import path from "node:path";
@@ -218,4 +218,4 @@ var CodemationPluginDiscovery = class {
218
218
 
219
219
  //#endregion
220
220
  export { AppConfigLoader as n, CodemationServerGateway as r, CodemationPluginDiscovery as t };
221
- //# sourceMappingURL=server-C_ZIEOTY.js.map
221
+ //# sourceMappingURL=server-BE4PLhcb.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-C_ZIEOTY.js","names":["config: CodemationConfig","consumerRoot: string","configSource?: string","workflowSources: ReadonlyArray<string>","env?: Readonly<NodeJS.ProcessEnv>","consumerConfigLoader: CodemationConsumerConfigLoader","appConfigFactory: AppConfigFactory","discoveredPackages: CodemationDiscoveredPluginPackage[]","resolvedPackages: CodemationResolvedPluginPackage[]","packageRoots: string[]"],"sources":["../src/presentation/http/CodemationServerGatewayFactory.ts","../src/presentation/server/AppConfigLoader.ts","../src/presentation/server/CodemationPluginDiscovery.ts"],"sourcesContent":["import { accessSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { QueryBus } from \"../../application/bus/QueryBus\";\nimport type { WorkflowDto, WorkflowSummary } from \"../../application/contracts/WorkflowViewContracts\";\nimport { WorkflowDefinitionMapper } from \"../../application/mapping/WorkflowDefinitionMapper\";\nimport { GetWorkflowDetailQuery } from \"../../application/queries/GetWorkflowDetailQuery\";\nimport { GetWorkflowSummariesQuery } from \"../../application/queries/GetWorkflowSummariesQuery\";\nimport { ApplicationTokens } from \"../../applicationTokens\";\nimport { AppContainerFactory } from \"../../bootstrap/AppContainerFactory\";\nimport { AppContainerLifecycle } from \"../../bootstrap/AppContainerLifecycle\";\nimport { FrontendRuntime } from \"../../bootstrap/runtime/FrontendRuntime\";\nimport { AppConfigFactory } from \"../../bootstrap/runtime/AppConfigFactory\";\nimport type { CodemationConfig } from \"../config/CodemationConfig\";\nimport { CodemationConfigNormalizer } from \"../config/CodemationConfigNormalizer\";\nimport { CodemationHonoApiApp } from \"./hono/CodemationHonoApiAppFactory\";\n\ntype ServerGatewayContext = Readonly<{\n container: import(\"@codemation/core\").Container;\n httpApi: CodemationHonoApiApp;\n queryBus: QueryBus;\n workflowDefinitionMapper: WorkflowDefinitionMapper;\n}>;\n\nexport class CodemationServerGateway {\n private static readonly contextsByConfig = new WeakMap<object, Promise<ServerGatewayContext>>();\n\n constructor(\n private readonly config: CodemationConfig,\n private readonly consumerRoot: string,\n private readonly configSource?: string,\n private readonly workflowSources: ReadonlyArray<string> = [],\n private readonly env?: Readonly<NodeJS.ProcessEnv>,\n ) {}\n\n async dispatch(request: Request): Promise<Response> {\n return await (await this.getContext()).httpApi.fetch(request);\n }\n\n async prepare(): Promise<void> {\n await this.getContext();\n }\n\n async close(): Promise<void> {\n const cachedContext = CodemationServerGateway.contextsByConfig.get(this.config as object);\n if (!cachedContext) {\n return;\n }\n CodemationServerGateway.contextsByConfig.delete(this.config as object);\n await (await cachedContext).container.resolve(AppContainerLifecycle).stop();\n }\n\n async loadWorkflowSummaries(): Promise<ReadonlyArray<WorkflowSummary>> {\n const context = await this.getContext();\n const workflows = await context.queryBus.execute(new GetWorkflowSummariesQuery());\n return workflows.map((workflow) => context.workflowDefinitionMapper.toSummary(workflow));\n }\n\n async loadWorkflowDetail(workflowId: string): Promise<WorkflowDto> {\n const context = await this.getContext();\n const workflow = await context.queryBus.execute(new GetWorkflowDetailQuery(workflowId));\n if (!workflow) {\n throw new Error(`Unknown workflowId: ${workflowId}`);\n }\n return await context.workflowDefinitionMapper.map(workflow);\n }\n\n private getContext(): Promise<ServerGatewayContext> {\n const cachedContext = CodemationServerGateway.contextsByConfig.get(this.config as object);\n if (cachedContext) {\n return cachedContext;\n }\n const nextContext = this.createContext();\n CodemationServerGateway.contextsByConfig.set(this.config as object, nextContext);\n return nextContext;\n }\n\n private async createContext(): Promise<ServerGatewayContext> {\n const repoRoot = this.detectWorkspaceRoot(this.consumerRoot);\n // This gateway is the config/env boundary that materializes AppConfig from raw inputs.\n // eslint-disable-next-line no-restricted-properties\n const env = this.env ?? process.env;\n const appConfig = new AppConfigFactory().create({\n repoRoot,\n consumerRoot: this.consumerRoot,\n env,\n config: new CodemationConfigNormalizer().normalize(this.config),\n workflowSources: this.resolveWorkflowSources(),\n });\n const container = await new AppContainerFactory().create({\n appConfig,\n sharedWorkflowWebsocketServer: null,\n });\n await container.resolve(FrontendRuntime).start();\n return {\n container,\n httpApi: container.resolve(CodemationHonoApiApp),\n queryBus: container.resolve(ApplicationTokens.QueryBus),\n workflowDefinitionMapper: container.resolve(WorkflowDefinitionMapper),\n };\n }\n\n private resolveWorkflowSources(): ReadonlyArray<string> {\n if (this.workflowSources.length > 0) {\n return [...this.workflowSources];\n }\n if (!this.configSource || !this.config.workflows || this.config.workflows.length === 0) {\n return [];\n }\n return [this.configSource];\n }\n private detectWorkspaceRoot(startDirectory: string): string {\n let currentDirectory = path.resolve(startDirectory);\n while (true) {\n try {\n accessSync(path.resolve(currentDirectory, \"pnpm-workspace.yaml\"));\n return currentDirectory;\n } catch {\n const parentDirectory = path.dirname(currentDirectory);\n if (parentDirectory === currentDirectory) {\n return startDirectory;\n }\n currentDirectory = parentDirectory;\n }\n }\n }\n}\n","import type { AppConfig } from \"../config/AppConfig\";\nimport { CodemationConsumerConfigLoader } from \"./CodemationConsumerConfigLoader\";\nimport { AppConfigFactory } from \"../../bootstrap/runtime/AppConfigFactory\";\n\nexport type AppConfigLoadResult = Readonly<{\n appConfig: AppConfig;\n bootstrapSource: string | null;\n}>;\n\nexport class AppConfigLoader {\n constructor(\n private readonly consumerConfigLoader: CodemationConsumerConfigLoader = new CodemationConsumerConfigLoader(),\n private readonly appConfigFactory: AppConfigFactory = new AppConfigFactory(),\n ) {}\n\n async load(\n args: Readonly<{\n consumerRoot: string;\n repoRoot: string;\n env: NodeJS.ProcessEnv;\n configPathOverride?: string;\n }>,\n ): Promise<AppConfigLoadResult> {\n const resolution = await this.consumerConfigLoader.load({\n consumerRoot: args.consumerRoot,\n configPathOverride: args.configPathOverride,\n });\n return {\n appConfig: this.appConfigFactory.create({\n repoRoot: args.repoRoot,\n consumerRoot: args.consumerRoot,\n env: args.env,\n config: resolution.config,\n workflowSources: resolution.workflowSources,\n }),\n bootstrapSource: resolution.bootstrapSource,\n };\n }\n}\n","import type { CodemationPackageManifest } from \"../config/CodemationPackageManifest\";\nimport { CodemationPluginPackageMetadata, type CodemationPlugin } from \"../config/CodemationPlugin\";\nimport { readFile, readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nexport type CodemationDiscoveredPluginPackage = Readonly<{\n packageName: string;\n packageRoot: string;\n pluginEntry: string;\n developmentEntry?: string;\n}>;\n\nexport type CodemationResolvedPluginPackage = Readonly<\n CodemationDiscoveredPluginPackage & {\n plugin: CodemationPlugin;\n }\n>;\n\ntype PackageJsonShape = Readonly<{\n codemation?: CodemationPackageManifest;\n name?: string;\n exports?: Readonly<Record<string, unknown>>;\n}>;\n\nexport class CodemationPluginDiscovery {\n private readonly pluginPackageMetadata = new CodemationPluginPackageMetadata();\n\n async discover(consumerRoot: string): Promise<ReadonlyArray<CodemationDiscoveredPluginPackage>> {\n const nodeModulesRoot = path.resolve(consumerRoot, \"node_modules\");\n const packageRoots = await this.collectPackageRoots(nodeModulesRoot);\n const discoveredPackages: CodemationDiscoveredPluginPackage[] = [];\n for (const packageRoot of packageRoots) {\n const packageJson = await this.readPackageJson(path.resolve(packageRoot, \"package.json\"));\n const pluginManifest = packageJson.codemation?.plugin;\n if (!packageJson.name || typeof pluginManifest !== \"string\" || pluginManifest.trim().length === 0) {\n continue;\n }\n discoveredPackages.push({\n packageName: packageJson.name,\n packageRoot,\n pluginEntry: pluginManifest,\n developmentEntry: await this.resolveDevelopmentPluginEntry(packageRoot),\n });\n }\n return discoveredPackages.sort((left, right) => left.packageName.localeCompare(right.packageName));\n }\n\n async resolvePlugins(consumerRoot: string): Promise<ReadonlyArray<CodemationResolvedPluginPackage>> {\n const discoveredPackages = await this.discover(consumerRoot);\n return await this.resolveDiscoveredPackages(discoveredPackages);\n }\n\n async resolveDiscoveredPackages(\n discoveredPackages: ReadonlyArray<CodemationDiscoveredPluginPackage>,\n ): Promise<ReadonlyArray<CodemationResolvedPluginPackage>> {\n const resolvedPackages: CodemationResolvedPluginPackage[] = [];\n for (const discoveredPackage of discoveredPackages) {\n resolvedPackages.push({\n ...discoveredPackage,\n plugin: await this.loadPlugin(discoveredPackage),\n });\n }\n return resolvedPackages;\n }\n\n private async collectPackageRoots(nodeModulesRoot: string): Promise<ReadonlyArray<string>> {\n try {\n const entries = await readdir(nodeModulesRoot, { withFileTypes: true });\n const packageRoots: string[] = [];\n for (const entry of entries) {\n if (!entry.isDirectory() && !entry.isSymbolicLink()) {\n continue;\n }\n if (entry.name.startsWith(\"@\")) {\n const scopedEntries = await readdir(path.resolve(nodeModulesRoot, entry.name), { withFileTypes: true });\n for (const scopedEntry of scopedEntries) {\n if (scopedEntry.isDirectory() || scopedEntry.isSymbolicLink()) {\n packageRoots.push(path.resolve(nodeModulesRoot, entry.name, scopedEntry.name));\n }\n }\n continue;\n }\n packageRoots.push(path.resolve(nodeModulesRoot, entry.name));\n }\n return packageRoots;\n } catch {\n return [];\n }\n }\n\n private async readPackageJson(packageJsonPath: string): Promise<PackageJsonShape> {\n try {\n const rawPackageJson = await readFile(packageJsonPath, \"utf8\");\n return JSON.parse(rawPackageJson) as PackageJsonShape;\n } catch {\n return {};\n }\n }\n\n private async loadPlugin(discoveredPackage: CodemationDiscoveredPluginPackage): Promise<CodemationPlugin> {\n const pluginModulePath = path.resolve(discoveredPackage.packageRoot, this.resolvePluginEntry(discoveredPackage));\n const importedModule = (await import(\n /* webpackIgnore: true */ this.resolvePluginModuleSpecifier(pluginModulePath)\n )) as Record<string, unknown>;\n const exportedValue = importedModule.default;\n const plugin = this.resolvePluginValue(exportedValue);\n if (!plugin) {\n throw new Error(`Plugin package \"${discoveredPackage.packageName}\" did not default-export a Codemation plugin.`);\n }\n return this.pluginPackageMetadata.attachPackageName(plugin, discoveredPackage.packageName);\n }\n\n private resolvePluginValue(value: unknown): CodemationPlugin | null {\n if (this.isPluginConfig(value)) {\n return value;\n }\n return null;\n }\n\n private isPluginConfig(value: unknown): value is CodemationPlugin {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return false;\n }\n const pluginValue = value as {\n credentialTypes?: unknown;\n register?: unknown;\n sandbox?: unknown;\n };\n if (pluginValue.register !== undefined && typeof pluginValue.register !== \"function\") {\n return false;\n }\n if (pluginValue.credentialTypes !== undefined && !Array.isArray(pluginValue.credentialTypes)) {\n return false;\n }\n return (\n pluginValue.register !== undefined ||\n pluginValue.credentialTypes !== undefined ||\n pluginValue.sandbox !== undefined ||\n Object.keys(pluginValue).length === 0\n );\n }\n\n private resolvePluginEntry(discoveredPackage: CodemationDiscoveredPluginPackage): string {\n const preferSource =\n process.env.CODEMATION_PREFER_PLUGIN_SOURCE_ENTRY === \"true\" &&\n typeof discoveredPackage.developmentEntry === \"string\" &&\n discoveredPackage.developmentEntry.trim().length > 0;\n const selectedEntry = preferSource ? discoveredPackage.developmentEntry : discoveredPackage.pluginEntry;\n return selectedEntry;\n }\n\n private async resolveDevelopmentPluginEntry(packageRoot: string): Promise<string | undefined> {\n const candidates = [\n path.resolve(packageRoot, \"codemation.plugin.ts\"),\n path.resolve(packageRoot, \"codemation.plugin.js\"),\n path.resolve(packageRoot, \"src\", \"codemation.plugin.ts\"),\n path.resolve(packageRoot, \"src\", \"codemation.plugin.js\"),\n ];\n for (const candidate of candidates) {\n if (await this.exists(candidate)) {\n return path.relative(packageRoot, candidate);\n }\n }\n return undefined;\n }\n\n private async exists(filePath: string): Promise<boolean> {\n try {\n await readFile(filePath, \"utf8\");\n return true;\n } catch {\n return false;\n }\n }\n\n private resolvePluginModuleSpecifier(pluginModulePath: string): string {\n return pathToFileURL(pluginModulePath).href;\n }\n}\n"],"mappings":";;;;;;;;;;AAuBA,IAAa,0BAAb,MAAa,wBAAwB;CACnC,OAAwB,mCAAmB,IAAI,SAAgD;CAE/F,YACE,AAAiBA,QACjB,AAAiBC,cACjB,AAAiBC,cACjB,AAAiBC,kBAAyC,EAAE,EAC5D,AAAiBC,KACjB;EALiB;EACA;EACA;EACA;EACA;;CAGnB,MAAM,SAAS,SAAqC;AAClD,SAAO,OAAO,MAAM,KAAK,YAAY,EAAE,QAAQ,MAAM,QAAQ;;CAG/D,MAAM,UAAyB;AAC7B,QAAM,KAAK,YAAY;;CAGzB,MAAM,QAAuB;EAC3B,MAAM,gBAAgB,wBAAwB,iBAAiB,IAAI,KAAK,OAAiB;AACzF,MAAI,CAAC,cACH;AAEF,0BAAwB,iBAAiB,OAAO,KAAK,OAAiB;AACtE,SAAO,MAAM,eAAe,UAAU,QAAQ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,UAAU,CAC9B,QAAO,KAAK,SAAS,aAAa,UAAU;;CAMlD,MAAc,OAAO,UAAoC;AACvD,MAAI;AACF,SAAM,SAAS,UAAU,OAAO;AAChC,UAAO;UACD;AACN,UAAO;;;CAIX,AAAQ,6BAA6B,kBAAkC;AACrE,SAAO,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"server-BE4PLhcb.js","names":["config: CodemationConfig","consumerRoot: string","configSource?: string","workflowSources: ReadonlyArray<string>","env?: Readonly<NodeJS.ProcessEnv>","consumerConfigLoader: CodemationConsumerConfigLoader","appConfigFactory: AppConfigFactory","discoveredPackages: CodemationDiscoveredPluginPackage[]","resolvedPackages: CodemationResolvedPluginPackage[]","packageRoots: string[]"],"sources":["../src/presentation/http/CodemationServerGatewayFactory.ts","../src/presentation/server/AppConfigLoader.ts","../src/presentation/server/CodemationPluginDiscovery.ts"],"sourcesContent":["import { accessSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { QueryBus } from \"../../application/bus/QueryBus\";\nimport type { WorkflowDto, WorkflowSummary } from \"../../application/contracts/WorkflowViewContracts\";\nimport { WorkflowDefinitionMapper } from \"../../application/mapping/WorkflowDefinitionMapper\";\nimport { GetWorkflowDetailQuery } from \"../../application/queries/GetWorkflowDetailQuery\";\nimport { GetWorkflowSummariesQuery } from \"../../application/queries/GetWorkflowSummariesQuery\";\nimport { ApplicationTokens } from \"../../applicationTokens\";\nimport { AppContainerFactory } from \"../../bootstrap/AppContainerFactory\";\nimport { AppContainerLifecycle } from \"../../bootstrap/AppContainerLifecycle\";\nimport { FrontendRuntime } from \"../../bootstrap/runtime/FrontendRuntime\";\nimport { AppConfigFactory } from \"../../bootstrap/runtime/AppConfigFactory\";\nimport type { CodemationConfig } from \"../config/CodemationConfig\";\nimport { CodemationConfigNormalizer } from \"../config/CodemationConfigNormalizer\";\nimport { CodemationHonoApiApp } from \"./hono/CodemationHonoApiAppFactory\";\n\ntype ServerGatewayContext = Readonly<{\n container: import(\"@codemation/core\").Container;\n httpApi: CodemationHonoApiApp;\n queryBus: QueryBus;\n workflowDefinitionMapper: WorkflowDefinitionMapper;\n}>;\n\nexport class CodemationServerGateway {\n private static readonly contextsByConfig = new WeakMap<object, Promise<ServerGatewayContext>>();\n\n constructor(\n private readonly config: CodemationConfig,\n private readonly consumerRoot: string,\n private readonly configSource?: string,\n private readonly workflowSources: ReadonlyArray<string> = [],\n private readonly env?: Readonly<NodeJS.ProcessEnv>,\n ) {}\n\n async dispatch(request: Request): Promise<Response> {\n return await (await this.getContext()).httpApi.fetch(request);\n }\n\n async prepare(): Promise<void> {\n await this.getContext();\n }\n\n async close(): Promise<void> {\n const cachedContext = CodemationServerGateway.contextsByConfig.get(this.config as object);\n if (!cachedContext) {\n return;\n }\n CodemationServerGateway.contextsByConfig.delete(this.config as object);\n await (await cachedContext).container.resolve(AppContainerLifecycle).stop();\n }\n\n async loadWorkflowSummaries(): Promise<ReadonlyArray<WorkflowSummary>> {\n const context = await this.getContext();\n const workflows = await context.queryBus.execute(new GetWorkflowSummariesQuery());\n return workflows.map((workflow) => context.workflowDefinitionMapper.toSummary(workflow));\n }\n\n async loadWorkflowDetail(workflowId: string): Promise<WorkflowDto> {\n const context = await this.getContext();\n const workflow = await context.queryBus.execute(new GetWorkflowDetailQuery(workflowId));\n if (!workflow) {\n throw new Error(`Unknown workflowId: ${workflowId}`);\n }\n return await context.workflowDefinitionMapper.map(workflow);\n }\n\n private getContext(): Promise<ServerGatewayContext> {\n const cachedContext = CodemationServerGateway.contextsByConfig.get(this.config as object);\n if (cachedContext) {\n return cachedContext;\n }\n const nextContext = this.createContext();\n CodemationServerGateway.contextsByConfig.set(this.config as object, nextContext);\n return nextContext;\n }\n\n private async createContext(): Promise<ServerGatewayContext> {\n const repoRoot = this.detectWorkspaceRoot(this.consumerRoot);\n // This gateway is the config/env boundary that materializes AppConfig from raw inputs.\n // eslint-disable-next-line no-restricted-properties\n const env = this.env ?? process.env;\n const appConfig = new AppConfigFactory().create({\n repoRoot,\n consumerRoot: this.consumerRoot,\n env,\n config: new CodemationConfigNormalizer().normalize(this.config),\n workflowSources: this.resolveWorkflowSources(),\n });\n const container = await new AppContainerFactory().create({\n appConfig,\n sharedWorkflowWebsocketServer: null,\n });\n await container.resolve(FrontendRuntime).start();\n return {\n container,\n httpApi: container.resolve(CodemationHonoApiApp),\n queryBus: container.resolve(ApplicationTokens.QueryBus),\n workflowDefinitionMapper: container.resolve(WorkflowDefinitionMapper),\n };\n }\n\n private resolveWorkflowSources(): ReadonlyArray<string> {\n if (this.workflowSources.length > 0) {\n return [...this.workflowSources];\n }\n if (!this.configSource || !this.config.workflows || this.config.workflows.length === 0) {\n return [];\n }\n return [this.configSource];\n }\n private detectWorkspaceRoot(startDirectory: string): string {\n let currentDirectory = path.resolve(startDirectory);\n while (true) {\n try {\n accessSync(path.resolve(currentDirectory, \"pnpm-workspace.yaml\"));\n return currentDirectory;\n } catch {\n const parentDirectory = path.dirname(currentDirectory);\n if (parentDirectory === currentDirectory) {\n return startDirectory;\n }\n currentDirectory = parentDirectory;\n }\n }\n }\n}\n","import type { AppConfig } from \"../config/AppConfig\";\nimport { CodemationConsumerConfigLoader } from \"./CodemationConsumerConfigLoader\";\nimport { AppConfigFactory } from \"../../bootstrap/runtime/AppConfigFactory\";\n\nexport type AppConfigLoadResult = Readonly<{\n appConfig: AppConfig;\n bootstrapSource: string | null;\n}>;\n\nexport class AppConfigLoader {\n constructor(\n private readonly consumerConfigLoader: CodemationConsumerConfigLoader = new CodemationConsumerConfigLoader(),\n private readonly appConfigFactory: AppConfigFactory = new AppConfigFactory(),\n ) {}\n\n async load(\n args: Readonly<{\n consumerRoot: string;\n repoRoot: string;\n env: NodeJS.ProcessEnv;\n configPathOverride?: string;\n }>,\n ): Promise<AppConfigLoadResult> {\n const resolution = await this.consumerConfigLoader.load({\n consumerRoot: args.consumerRoot,\n configPathOverride: args.configPathOverride,\n });\n return {\n appConfig: this.appConfigFactory.create({\n repoRoot: args.repoRoot,\n consumerRoot: args.consumerRoot,\n env: args.env,\n config: resolution.config,\n workflowSources: resolution.workflowSources,\n }),\n bootstrapSource: resolution.bootstrapSource,\n };\n }\n}\n","import type { CodemationPackageManifest } from \"../config/CodemationPackageManifest\";\nimport { CodemationPluginPackageMetadata, type CodemationPlugin } from \"../config/CodemationPlugin\";\nimport { readFile, readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nexport type CodemationDiscoveredPluginPackage = Readonly<{\n packageName: string;\n packageRoot: string;\n pluginEntry: string;\n developmentEntry?: string;\n}>;\n\nexport type CodemationResolvedPluginPackage = Readonly<\n CodemationDiscoveredPluginPackage & {\n plugin: CodemationPlugin;\n }\n>;\n\ntype PackageJsonShape = Readonly<{\n codemation?: CodemationPackageManifest;\n name?: string;\n exports?: Readonly<Record<string, unknown>>;\n}>;\n\nexport class CodemationPluginDiscovery {\n private readonly pluginPackageMetadata = new CodemationPluginPackageMetadata();\n\n async discover(consumerRoot: string): Promise<ReadonlyArray<CodemationDiscoveredPluginPackage>> {\n const nodeModulesRoot = path.resolve(consumerRoot, \"node_modules\");\n const packageRoots = await this.collectPackageRoots(nodeModulesRoot);\n const discoveredPackages: CodemationDiscoveredPluginPackage[] = [];\n for (const packageRoot of packageRoots) {\n const packageJson = await this.readPackageJson(path.resolve(packageRoot, \"package.json\"));\n const pluginManifest = packageJson.codemation?.plugin;\n if (!packageJson.name || typeof pluginManifest !== \"string\" || pluginManifest.trim().length === 0) {\n continue;\n }\n discoveredPackages.push({\n packageName: packageJson.name,\n packageRoot,\n pluginEntry: pluginManifest,\n developmentEntry: await this.resolveDevelopmentPluginEntry(packageRoot),\n });\n }\n return discoveredPackages.sort((left, right) => left.packageName.localeCompare(right.packageName));\n }\n\n async resolvePlugins(consumerRoot: string): Promise<ReadonlyArray<CodemationResolvedPluginPackage>> {\n const discoveredPackages = await this.discover(consumerRoot);\n return await this.resolveDiscoveredPackages(discoveredPackages);\n }\n\n async resolveDiscoveredPackages(\n discoveredPackages: ReadonlyArray<CodemationDiscoveredPluginPackage>,\n ): Promise<ReadonlyArray<CodemationResolvedPluginPackage>> {\n const resolvedPackages: CodemationResolvedPluginPackage[] = [];\n for (const discoveredPackage of discoveredPackages) {\n resolvedPackages.push({\n ...discoveredPackage,\n plugin: await this.loadPlugin(discoveredPackage),\n });\n }\n return resolvedPackages;\n }\n\n private async collectPackageRoots(nodeModulesRoot: string): Promise<ReadonlyArray<string>> {\n try {\n const entries = await readdir(nodeModulesRoot, { withFileTypes: true });\n const packageRoots: string[] = [];\n for (const entry of entries) {\n if (!entry.isDirectory() && !entry.isSymbolicLink()) {\n continue;\n }\n if (entry.name.startsWith(\"@\")) {\n const scopedEntries = await readdir(path.resolve(nodeModulesRoot, entry.name), { withFileTypes: true });\n for (const scopedEntry of scopedEntries) {\n if (scopedEntry.isDirectory() || scopedEntry.isSymbolicLink()) {\n packageRoots.push(path.resolve(nodeModulesRoot, entry.name, scopedEntry.name));\n }\n }\n continue;\n }\n packageRoots.push(path.resolve(nodeModulesRoot, entry.name));\n }\n return packageRoots;\n } catch {\n return [];\n }\n }\n\n private async readPackageJson(packageJsonPath: string): Promise<PackageJsonShape> {\n try {\n const rawPackageJson = await readFile(packageJsonPath, \"utf8\");\n return JSON.parse(rawPackageJson) as PackageJsonShape;\n } catch {\n return {};\n }\n }\n\n private async loadPlugin(discoveredPackage: CodemationDiscoveredPluginPackage): Promise<CodemationPlugin> {\n const pluginModulePath = path.resolve(discoveredPackage.packageRoot, this.resolvePluginEntry(discoveredPackage));\n const importedModule = (await import(\n /* webpackIgnore: true */ this.resolvePluginModuleSpecifier(pluginModulePath)\n )) as Record<string, unknown>;\n const exportedValue = importedModule.default;\n const plugin = this.resolvePluginValue(exportedValue);\n if (!plugin) {\n throw new Error(`Plugin package \"${discoveredPackage.packageName}\" did not default-export a Codemation plugin.`);\n }\n return this.pluginPackageMetadata.attachPackageName(plugin, discoveredPackage.packageName);\n }\n\n private resolvePluginValue(value: unknown): CodemationPlugin | null {\n if (this.isPluginConfig(value)) {\n return value;\n }\n return null;\n }\n\n private isPluginConfig(value: unknown): value is CodemationPlugin {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return false;\n }\n const pluginValue = value as {\n credentialTypes?: unknown;\n register?: unknown;\n sandbox?: unknown;\n };\n if (pluginValue.register !== undefined && typeof pluginValue.register !== \"function\") {\n return false;\n }\n if (pluginValue.credentialTypes !== undefined && !Array.isArray(pluginValue.credentialTypes)) {\n return false;\n }\n return (\n pluginValue.register !== undefined ||\n pluginValue.credentialTypes !== undefined ||\n pluginValue.sandbox !== undefined ||\n Object.keys(pluginValue).length === 0\n );\n }\n\n private resolvePluginEntry(discoveredPackage: CodemationDiscoveredPluginPackage): string {\n const preferSource =\n process.env.CODEMATION_PREFER_PLUGIN_SOURCE_ENTRY === \"true\" &&\n typeof discoveredPackage.developmentEntry === \"string\" &&\n discoveredPackage.developmentEntry.trim().length > 0;\n const selectedEntry = preferSource ? discoveredPackage.developmentEntry : discoveredPackage.pluginEntry;\n return selectedEntry;\n }\n\n private async resolveDevelopmentPluginEntry(packageRoot: string): Promise<string | undefined> {\n const candidates = [\n path.resolve(packageRoot, \"codemation.plugin.ts\"),\n path.resolve(packageRoot, \"codemation.plugin.js\"),\n path.resolve(packageRoot, \"src\", \"codemation.plugin.ts\"),\n path.resolve(packageRoot, \"src\", \"codemation.plugin.js\"),\n ];\n for (const candidate of candidates) {\n if (await this.exists(candidate)) {\n return path.relative(packageRoot, candidate);\n }\n }\n return undefined;\n }\n\n private async exists(filePath: string): Promise<boolean> {\n try {\n await readFile(filePath, \"utf8\");\n return true;\n } catch {\n return false;\n }\n }\n\n private resolvePluginModuleSpecifier(pluginModulePath: string): string {\n return pathToFileURL(pluginModulePath).href;\n }\n}\n"],"mappings":";;;;;;;;;;AAuBA,IAAa,0BAAb,MAAa,wBAAwB;CACnC,OAAwB,mCAAmB,IAAI,SAAgD;CAE/F,YACE,AAAiBA,QACjB,AAAiBC,cACjB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B,mBAA8D;AAMvF,SAJE,QAAQ,IAAI,0CAA0C,UACtD,OAAO,kBAAkB,qBAAqB,YAC9C,kBAAkB,iBAAiB,MAAM,CAAC,SAAS,IAChB,kBAAkB,mBAAmB,kBAAkB;;CAI9F,MAAc,8BAA8B,aAAkD;EAC5F,MAAM,aAAa;GACjB,KAAK,QAAQ,aAAa,uBAAuB;GACjD,KAAK,QAAQ,aAAa,uBAAuB;GACjD,KAAK,QAAQ,aAAa,OAAO,uBAAuB;GACxD,KAAK,QAAQ,aAAa,OAAO,uBAAuB;GACzD;AACD,OAAK,MAAM,aAAa,WACtB,KAAI,MAAM,KAAK,OAAO,UAAU,CAC9B,QAAO,KAAK,SAAS,aAAa,UAAU;;CAMlD,MAAc,OAAO,UAAoC;AACvD,MAAI;AACF,SAAM,SAAS,UAAU,OAAO;AAChC,UAAO;UACD;AACN,UAAO;;;CAIX,AAAQ,6BAA6B,kBAAkC;AACrE,SAAO,cAAc,iBAAiB,CAAC"}
@@ -1,7 +1,7 @@
1
- import { m as CodemationConfig, o as CodemationPlugin, r as AppConfig } from "./CodemationAppContext-P7P-xZhQ.js";
2
- import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-evvw4b_a.js";
3
- import { t as AppConfigFactory } from "./AppConfigFactory-Dq7ttwQ_.js";
4
- import { a as WorkflowDto, o as WorkflowSummary } from "./PublicFrontendBootstrapFactory-D0_ds7nS.js";
1
+ import { m as CodemationConfig, o as CodemationPlugin, r as AppConfig } from "./CodemationAppContext-DP_-56c6.js";
2
+ import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-C_QVwcI3.js";
3
+ import { t as AppConfigFactory } from "./AppConfigFactory-PFmDg5Sg.js";
4
+ import { a as WorkflowDto, o as WorkflowSummary } from "./PublicFrontendBootstrapFactory-C_iLgPV-.js";
5
5
 
6
6
  //#region src/presentation/http/ApiPaths.d.ts
7
7
  declare class ApiPaths {
@@ -156,4 +156,4 @@ declare class WorkflowDiscoveryPathSegmentsComputer {
156
156
  }
157
157
  //#endregion
158
158
  export { CodemationResolvedPluginPackage as a, CodemationServerGateway as c, CodemationPluginDiscovery as i, ApiPaths as l, WorkflowModulePathFinder as n, AppConfigLoadResult as o, CodemationDiscoveredPluginPackage as r, AppConfigLoader as s, WorkflowDiscoveryPathSegmentsComputer as t };
159
- //# sourceMappingURL=server-Clvg5x1w.d.ts.map
159
+ //# sourceMappingURL=server-Q5uwa6iR.d.ts.map
package/dist/server.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import "./index-CeS2saCe.js";
2
- import "./CodemationAppContext-P7P-xZhQ.js";
1
+ import "./index-W4eSjdCM.js";
2
+ import "./CodemationAppContext-DP_-56c6.js";
3
3
  import "./CodemationWhitelabelConfig-D5rYcLlj.js";
4
4
  import { n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-ci0Vwxrb.js";
5
5
  import { i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-Ja0GQgpp.js";
6
- import "./CodemationConfigNormalizer-BCtBrJDe.js";
7
- import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-evvw4b_a.js";
8
- import { r as PrismaDatabaseClient } from "./AppConfigFactory-Dq7ttwQ_.js";
9
- import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-CJeu1STC.js";
10
- import { a as CodemationResolvedPluginPackage, c as CodemationServerGateway, i as CodemationPluginDiscovery, l as ApiPaths, n as WorkflowModulePathFinder, o as AppConfigLoadResult, r as CodemationDiscoveredPluginPackage, s as AppConfigLoader, t as WorkflowDiscoveryPathSegmentsComputer } from "./server-Clvg5x1w.js";
11
- import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-D0_ds7nS.js";
6
+ import "./CodemationConfigNormalizer-B8RGUwAe.js";
7
+ import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-C_QVwcI3.js";
8
+ import { r as PrismaDatabaseClient } from "./AppConfigFactory-PFmDg5Sg.js";
9
+ import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-_pqP_0nw.js";
10
+ import { a as CodemationResolvedPluginPackage, c as CodemationServerGateway, i as CodemationPluginDiscovery, l as ApiPaths, n as WorkflowModulePathFinder, o as AppConfigLoadResult, r as CodemationDiscoveredPluginPackage, s as AppConfigLoader, t as WorkflowDiscoveryPathSegmentsComputer } from "./server-Q5uwa6iR.js";
11
+ import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-C_iLgPV-.js";
12
12
  export { ApiPaths, AppConfigLoadResult, AppConfigLoader, CodemationConsumerApp, CodemationConsumerAppResolver, CodemationConsumerConfigLoader, CodemationConsumerConfigResolution, CodemationDiscoveredPluginPackage, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, CodemationPluginDiscovery, CodemationPostgresPrismaClientFactory, CodemationResolvedPluginPackage, CodemationServerGateway, FrontendAppConfig, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, InternalAuthBootstrap, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, PrismaDatabaseClient as PrismaClient, PublicFrontendBootstrap, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, WorkflowDiscoveryPathSegmentsComputer, WorkflowModulePathFinder };
package/dist/server.js CHANGED
@@ -5,9 +5,9 @@ import "./ServerLoggerFactory-CsNW5qhz.js";
5
5
  import "./decorateParam-D7WPDFAf.js";
6
6
  import "./decorate-Dq0XLibd.js";
7
7
  import "./CredentialServices-BNBMFOPt.js";
8
- import { _ as FrontendAppConfigFactory, b as ApiPaths, g as InternalAuthBootstrapFactory, h as PublicFrontendBootstrapFactory, v as CodemationFrontendAuthSnapshotFactory } from "./AppContainerFactory-D9je1sSV.js";
8
+ import { _ as FrontendAppConfigFactory, b as ApiPaths, g as InternalAuthBootstrapFactory, h as PublicFrontendBootstrapFactory, v as CodemationFrontendAuthSnapshotFactory } from "./AppContainerFactory-Cr3JeVmg.js";
9
9
  import "./AppConfigFactory-BPp02HMv.js";
10
10
  import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-CA0_q0D7.js";
11
- import { n as AppConfigLoader, r as CodemationServerGateway, t as CodemationPluginDiscovery } from "./server-C_ZIEOTY.js";
11
+ import { n as AppConfigLoader, r as CodemationServerGateway, t as CodemationPluginDiscovery } from "./server-BE4PLhcb.js";
12
12
 
13
13
  export { ApiPaths, AppConfigLoader, CodemationConsumerAppResolver, CodemationConsumerConfigLoader, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, CodemationPluginDiscovery, CodemationPostgresPrismaClientFactory, CodemationServerGateway, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, WorkflowDiscoveryPathSegmentsComputer, WorkflowModulePathFinder };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemation/host",
3
- "version": "0.3.0",
3
+ "version": "1.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -83,6 +83,8 @@
83
83
  "./package.json": "./package.json"
84
84
  },
85
85
  "dependencies": {
86
+ "ai": "^6.0.168",
87
+ "@ai-sdk/provider": "^3.0.8",
86
88
  "@auth/core": "^0.34.3",
87
89
  "@auth/prisma-adapter": "^2.11.1",
88
90
  "@better-auth/prisma-adapter": "^1.5.6",
@@ -119,9 +121,9 @@
119
121
  "tsx": "^4.21.0",
120
122
  "ws": "^8.19.0",
121
123
  "zxcvbn": "^4.4.2",
122
- "@codemation/core": "0.8.0",
123
- "@codemation/core-nodes": "0.4.2",
124
- "@codemation/eventbus-redis": "0.0.30"
124
+ "@codemation/core": "1.0.0",
125
+ "@codemation/eventbus-redis": "0.0.32",
126
+ "@codemation/core-nodes": "1.0.0"
125
127
  },
126
128
  "devDependencies": {
127
129
  "@playwright/test": "^1.58.2",
@@ -147,7 +149,7 @@
147
149
  "typescript": "^5.9.3",
148
150
  "vitest": "^4.0.18",
149
151
  "zod": "^4.3.6",
150
- "@codemation/core-nodes-gmail": "0.1.4"
152
+ "@codemation/core-nodes-gmail": "0.1.6"
151
153
  },
152
154
  "scripts": {
153
155
  "changeset:verify": "pnpm --workspace-root run changeset:verify",