@codemation/host 0.1.6 → 0.2.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 (47) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/{AppConfigFactory-BiFHnorf.d.ts → AppConfigFactory-DHdAGOmC.d.ts} +3 -3
  3. package/dist/{AppContainerFactory-BRU02PTm.js → AppContainerFactory-BKaAUIi-.js} +91 -27
  4. package/dist/AppContainerFactory-BKaAUIi-.js.map +1 -0
  5. package/dist/{CodemationConfig-DuGk7uN5.d.ts → CodemationConfig-DBbMU3HB.d.ts} +2 -2
  6. package/dist/{CodemationConfigNormalizer-BP2-0ZDE.d.ts → CodemationConfigNormalizer-C8wC0skq.d.ts} +2 -2
  7. package/dist/{CodemationConsumerConfigLoader-D5CSz3TQ.d.ts → CodemationConsumerConfigLoader-Ceh6sB3X.d.ts} +3 -2
  8. package/dist/{CodemationConsumerConfigLoader-C_ISRrpI.js → CodemationConsumerConfigLoader-D6LFSlp5.js} +20 -7
  9. package/dist/CodemationConsumerConfigLoader-D6LFSlp5.js.map +1 -0
  10. package/dist/{CodemationPluginListMerger-DFzGgfyI.d.ts → CodemationPluginListMerger-Cx9DnyR-.d.ts} +5 -5
  11. package/dist/{CredentialServices-Bhejvys-.d.ts → CredentialServices-CYETzKyb.d.ts} +14 -5
  12. package/dist/{CredentialServices-xVxVA9Tq.js → CredentialServices-D8BBZH1i.js} +40 -6
  13. package/dist/CredentialServices-D8BBZH1i.js.map +1 -0
  14. package/dist/{PublicFrontendBootstrapFactory-CSgWyTra.d.ts → PublicFrontendBootstrapFactory-DeMjp3cs.d.ts} +5 -2
  15. package/dist/consumer.d.ts +4 -4
  16. package/dist/consumer.js +1 -1
  17. package/dist/credentials.d.ts +3 -3
  18. package/dist/credentials.js +1 -1
  19. package/dist/devServerSidecar.d.ts +1 -1
  20. package/dist/{index-BQaZZmOm.d.ts → index-dK05sTQ4.d.ts} +50 -60
  21. package/dist/index.d.ts +97 -12
  22. package/dist/index.js +4 -4
  23. package/dist/nextServer.d.ts +16 -8
  24. package/dist/nextServer.js +2 -2
  25. package/dist/{persistenceServer-fdldtXJH.d.ts → persistenceServer-D9vUTMqc.d.ts} +2 -2
  26. package/dist/persistenceServer.d.ts +5 -5
  27. package/dist/{server-ChTCEc6R.js → server-C-WZcsId.js} +5 -6
  28. package/dist/{server-ChTCEc6R.js.map → server-C-WZcsId.js.map} +1 -1
  29. package/dist/{server-Cpzpy1Ar.d.ts → server-fxqY2WEi.d.ts} +5 -5
  30. package/dist/server.d.ts +8 -8
  31. package/dist/server.js +4 -4
  32. package/package.json +6 -5
  33. package/playwright.config.ts +10 -6
  34. package/src/application/contracts/WorkflowViewContracts.ts +3 -0
  35. package/src/application/mapping/WorkflowDefinitionMapper.ts +117 -19
  36. package/src/bootstrap/AppContainerFactory.ts +2 -0
  37. package/src/domain/credentials/CredentialInstanceService.ts +8 -1
  38. package/src/domain/credentials/CredentialOAuth2ScopeResolver.ts +61 -0
  39. package/src/domain/credentials/CredentialServices.ts +1 -0
  40. package/src/domain/credentials/OAuth2ConnectServiceFactory.ts +9 -2
  41. package/src/presentation/http/routeHandlers/CredentialHttpRouteHandler.ts +2 -1
  42. package/src/presentation/http/routeHandlers/WorkflowHttpRouteHandler.ts +4 -2
  43. package/src/presentation/server/CodemationConsumerConfigLoader.ts +28 -5
  44. package/src/presentation/server/CodemationPluginDiscovery.ts +4 -6
  45. package/dist/AppContainerFactory-BRU02PTm.js.map +0 -1
  46. package/dist/CodemationConsumerConfigLoader-C_ISRrpI.js.map +0 -1
  47. package/dist/CredentialServices-xVxVA9Tq.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { t as CodemationAuthConfig } from "./CodemationAuthConfig-7hEfICPf.js";
2
2
  import { a as CodemationFrontendAuthSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-DCniMBGu.js";
3
- import { g as AppConfig } from "./CodemationConfig-DuGk7uN5.js";
3
+ import { g as AppConfig } from "./CodemationConfig-DBbMU3HB.js";
4
4
 
5
5
  //#region src/application/contracts/WorkflowViewContracts.d.ts
6
6
  type WorkflowNodeDto = Readonly<{
@@ -17,6 +17,9 @@ type WorkflowNodeDto = Readonly<{
17
17
  hasNodeErrorHandler?: boolean;
18
18
  /** When true, downstream nodes may run even when this node outputs zero items. */
19
19
  continueWhenEmptyOutput?: boolean;
20
+ /** Declared I/O ports from node config (unioned with ports inferred from edges on the canvas). */
21
+ declaredOutputPorts?: ReadonlyArray<string>;
22
+ declaredInputPorts?: ReadonlyArray<string>;
20
23
  }>;
21
24
  type WorkflowEdgeDto = Readonly<{
22
25
  from: Readonly<{
@@ -87,4 +90,4 @@ declare class PublicFrontendBootstrapFactory {
87
90
  }
88
91
  //#endregion
89
92
  export { WorkflowDto as a, CodemationFrontendAuthSnapshotFactory as i, InternalAuthBootstrapFactory as n, WorkflowSummary as o, FrontendAppConfigFactory as r, PublicFrontendBootstrapFactory as t };
90
- //# sourceMappingURL=PublicFrontendBootstrapFactory-CSgWyTra.d.ts.map
93
+ //# sourceMappingURL=PublicFrontendBootstrapFactory-DeMjp3cs.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import "./CodemationAuthConfig-7hEfICPf.js";
2
- import "./index-BQaZZmOm.js";
3
- import "./CodemationConfig-DuGk7uN5.js";
4
- import "./CodemationConfigNormalizer-BP2-0ZDE.js";
5
- import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-D5CSz3TQ.js";
2
+ import "./index-dK05sTQ4.js";
3
+ import "./CodemationConfig-DBbMU3HB.js";
4
+ import "./CodemationConfigNormalizer-C8wC0skq.js";
5
+ import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-Ceh6sB3X.js";
6
6
  export { type CodemationConsumerApp, CodemationConsumerAppResolver, CodemationConsumerConfigLoader, type CodemationConsumerConfigResolution };
package/dist/consumer.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./ConsoleLogger-ClPU7jtc.js";
2
- import { i as CodemationConsumerAppResolver, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-C_ISRrpI.js";
2
+ import { i as CodemationConsumerAppResolver, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-D6LFSlp5.js";
3
3
  import "./ServerLoggerFactory-BltIIDfQ.js";
4
4
  import "./decorateParam-DrsXNPuw.js";
5
5
  import "./decorate-B0PP651O.js";
@@ -1,7 +1,7 @@
1
1
  import "./CodemationAuthConfig-7hEfICPf.js";
2
- import { d as CredentialHealth, s as AnyCredentialType, v as CredentialSessionFactoryArgs } from "./index-BQaZZmOm.js";
3
- import "./CodemationConfig-DuGk7uN5.js";
4
- import { a as CredentialInstanceService, i as CredentialBindingService, n as CredentialType } from "./CredentialServices-Bhejvys-.js";
2
+ import { d as CredentialHealth, s as AnyCredentialType, v as CredentialSessionFactoryArgs } from "./index-dK05sTQ4.js";
3
+ import "./CodemationConfig-DBbMU3HB.js";
4
+ import { a as CredentialInstanceService, i as CredentialBindingService, n as CredentialType } from "./CredentialServices-CYETzKyb.js";
5
5
 
6
6
  //#region src/infrastructure/credentials/OpenAiApiKeyCredentialShapes.types.d.ts
7
7
  /**
@@ -1,6 +1,6 @@
1
1
  import "./decorateParam-DrsXNPuw.js";
2
2
  import "./decorate-B0PP651O.js";
3
- import { a as CredentialInstanceService, i as CredentialBindingService, m as OpenAiApiKeyCredentialHealthTester, p as OpenAiApiKeyCredentialTypeFactory } from "./CredentialServices-xVxVA9Tq.js";
3
+ import { a as CredentialInstanceService, h as OpenAiApiKeyCredentialHealthTester, i as CredentialBindingService, m as OpenAiApiKeyCredentialTypeFactory } from "./CredentialServices-D8BBZH1i.js";
4
4
 
5
5
  //#region src/credentials.ts
6
6
  const defaultOpenAiApiKeyCredentialTypeFactory = new OpenAiApiKeyCredentialTypeFactory(new OpenAiApiKeyCredentialHealthTester(globalThis.fetch));
@@ -1,4 +1,4 @@
1
- import { M as WorkflowDefinition, R as Container } from "./index-BQaZZmOm.js";
1
+ import { B as Container, N as WorkflowDefinition } from "./index-dK05sTQ4.js";
2
2
 
3
3
  //#region src/presentation/server/CodemationTsyringeParamInfoReader.d.ts
4
4
  declare class CodemationTsyringeParamInfoReader {
@@ -395,17 +395,17 @@ interface WorkflowActivationPolicy {
395
395
  }
396
396
  //#endregion
397
397
  //#region ../core/src/workflow/dsl/workflowBuilderTypes.d.ts
398
- type AnyRunnableNodeConfig = RunnableNodeConfig<any, any, any>;
398
+ type AnyRunnableNodeConfig = RunnableNodeConfig<any, any>;
399
399
  type AnyTriggerNodeConfig = TriggerNodeConfig<any>;
400
- type ValidStepSequence<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps extends readonly [] ? readonly [] : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<infer _TIn, infer TNextJson, TCurrentJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? readonly [TFirst, ...ValidStepSequence<TNextJson, TRest>] : never : never : TSteps;
401
- type StepSequenceOutput<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? TSteps extends readonly [] ? TCurrentJson : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<infer _TIn, infer TNextJson, TCurrentJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? StepSequenceOutput<TNextJson, TRest> : never : never : TCurrentJson : TCurrentJson;
400
+ type ValidStepSequence<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps extends readonly [] ? readonly [] : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<TCurrentJson, infer TNextJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? readonly [TFirst, ...ValidStepSequence<TNextJson, TRest>] : never : never : TSteps;
401
+ type StepSequenceOutput<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? TSteps extends readonly [] ? TCurrentJson : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<TCurrentJson, infer TNextJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? StepSequenceOutput<TNextJson, TRest> : never : never : TCurrentJson : TCurrentJson;
402
402
  type TypesMatch<TLeft, TRight> = [TLeft] extends [TRight] ? ([TRight] extends [TLeft] ? true : false) : false;
403
403
  type BranchOutputGuard<TCurrentJson, TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined, TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TypesMatch<StepSequenceOutput<TCurrentJson, TTrueSteps>, StepSequenceOutput<TCurrentJson, TFalseSteps>> extends true ? unknown : never;
404
404
  type BranchStepsArg<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps & ValidStepSequence<TCurrentJson, TSteps>;
405
- type BranchMoreArgs<TCurrentJson, TFirstStep extends RunnableNodeConfig<any, any, TCurrentJson>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TRestSteps & ValidStepSequence<RunnableNodeOutputJson<TFirstStep>, TRestSteps>;
405
+ type BranchMoreArgs<TCurrentJson, TFirstStep extends RunnableNodeConfig<TCurrentJson, any>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TRestSteps & ValidStepSequence<RunnableNodeOutputJson<TFirstStep>, TRestSteps>;
406
406
  type BooleanWhenOverloads<TCurrentJson, TReturn> = {
407
407
  <TSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, steps: BranchStepsArg<TCurrentJson, TSteps>): TReturn;
408
- <TFirstStep extends RunnableNodeConfig<any, any, TCurrentJson>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, step: TFirstStep, ...more: BranchMoreArgs<TCurrentJson, TFirstStep, TRestSteps>): TReturn;
408
+ <TFirstStep extends RunnableNodeConfig<TCurrentJson, any>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, step: TFirstStep, ...more: BranchMoreArgs<TCurrentJson, TFirstStep, TRestSteps>): TReturn;
409
409
  };
410
410
  //#endregion
411
411
  //#region ../core/src/workflow/dsl/WhenBuilder.d.ts
@@ -420,6 +420,11 @@ declare class WhenBuilder<TCurrentJson> {
420
420
  }
421
421
  //#endregion
422
422
  //#region ../core/src/workflow/dsl/ChainCursorResolver.d.ts
423
+ type ChainCursorEndpoint = Readonly<{
424
+ node: NodeRef;
425
+ output: OutputPortKey;
426
+ inputPortHint?: InputPortKey;
427
+ }>;
423
428
  type ChainCursorWhenOverloads<TCurrentJson> = BooleanWhenOverloads<TCurrentJson, WhenBuilder<TCurrentJson>> & {
424
429
  <TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined, TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined>(branches: Readonly<{
425
430
  true?: TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? BranchStepsArg<TCurrentJson, TTrueSteps> : never;
@@ -428,12 +433,14 @@ type ChainCursorWhenOverloads<TCurrentJson> = BooleanWhenOverloads<TCurrentJson,
428
433
  };
429
434
  declare class ChainCursor<TCurrentJson> {
430
435
  private readonly wf;
431
- private readonly cursor;
432
- private readonly cursorOutput;
433
- constructor(wf: WorkflowBuilder, cursor: NodeRef, cursorOutput: OutputPortKey);
434
- then<TInputJson$1, TOutputJson$1, TConfig$1 extends RunnableNodeConfig<TInputJson$1, TOutputJson$1, TCurrentJson>>(config: TConfig$1): ChainCursor<RunnableNodeOutputJson<TConfig$1>>;
436
+ private readonly endpoints;
437
+ constructor(wf: WorkflowBuilder, endpoints: ReadonlyArray<ChainCursorEndpoint>);
438
+ then<TOutputJson$1, TConfig$1 extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig$1): ChainCursor<RunnableNodeOutputJson<TConfig$1>>;
439
+ thenIntoInputHints<TOutputJson$1, TConfig$1 extends RunnableNodeConfig<any, TOutputJson$1>>(config: TConfig$1): ChainCursor<RunnableNodeOutputJson<TConfig$1>>;
435
440
  readonly when: ChainCursorWhenOverloads<TCurrentJson>;
441
+ route<TNextJson$1>(branches: Readonly<Record<OutputPortKey, (branch: ChainCursor<TCurrentJson>) => ChainCursor<TNextJson$1> | undefined>>): ChainCursor<TNextJson$1>;
436
442
  build(): WorkflowDefinition;
443
+ private resolveSharedInputPortHint;
437
444
  }
438
445
  //#endregion
439
446
  //#region ../core/src/workflow/dsl/WorkflowBuilder.d.ts
@@ -446,9 +453,7 @@ declare class WorkflowBuilder {
446
453
  constructor(meta: {
447
454
  id: WorkflowId;
448
455
  name: string;
449
- }, options?: Readonly<{
450
- makeMergeNode?: (name: string) => AnyRunnableNodeConfig;
451
- }> | undefined);
456
+ }, options?: Readonly<Record<string, never>> | undefined);
452
457
  private add;
453
458
  private connect;
454
459
  trigger<TConfig$1 extends AnyTriggerNodeConfig>(config: TConfig$1): ChainCursor<TriggerNodeOutputJson<TConfig$1>>;
@@ -733,65 +738,42 @@ interface NodeConfigBase {
733
738
  * main batches skip downstream execution and propagate the empty path.
734
739
  */
735
740
  readonly continueWhenEmptyOutput?: boolean;
741
+ /**
742
+ * Declared I/O port names for canvas authoring (unioned with ports inferred from edges).
743
+ * Use for dynamic routers (Switch) and future error ports.
744
+ */
745
+ readonly declaredOutputPorts?: ReadonlyArray<OutputPortKey>;
746
+ readonly declaredInputPorts?: ReadonlyArray<InputPortKey>;
736
747
  getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
737
748
  }
738
749
  declare const runnableNodeInputType: unique symbol;
739
750
  declare const runnableNodeOutputType: unique symbol;
740
- /** Phantom: JSON shape on the wire from upstream before {@link RunnableNodeConfig.mapInput}. */
741
- declare const runnableNodeWireType: unique symbol;
742
751
  declare const triggerNodeOutputType: unique symbol;
752
+ type LineageCarryPolicy = "emitOnly" | "carryThrough";
743
753
  /**
744
- * Read-only execution slice passed to {@link RunnableNodeConfig.mapInput} (aligned with the engine’s
745
- * node execution context for `runId`, `data`, etc.). Use **`ctx.data`** to read **any completed** upstream
746
- * node’s outputs in this run (e.g. `ctx.data.getOutputItems(nodeIdA, "main")` while mapping at D), not only
747
- * the immediate predecessor’s {@link ItemInputMapperArgs.item}.
748
- */
749
- interface ItemInputMapperContext {
750
- readonly runId: RunId;
751
- readonly workflowId: WorkflowId;
752
- /** Node whose activation is being prepared (the consumer of `mapInput`). */
753
- readonly nodeId: NodeId;
754
- readonly activationId: NodeActivationId;
755
- readonly parent?: ParentExecutionRef;
756
- readonly data: RunDataSnapshot;
757
- }
758
- /**
759
- * Arguments for optional per-item input mapping applied by the engine before Zod validation.
754
+ * Runnable node: **`TInputJson`** is what **`inputSchema`** validates on **`item.json`** (the wire payload).
755
+ * **`TOutputJson`** is emitted `item.json` on outputs.
760
756
  */
761
- interface ItemInputMapperArgs<TWireJson$1 = unknown> {
762
- readonly item: Item<TWireJson$1>;
763
- readonly itemIndex: number;
764
- readonly items: Items<TWireJson$1>;
765
- readonly ctx: ItemInputMapperContext;
766
- }
767
- /**
768
- * Per-item mapper before Zod validation. Uses a **bivariant** method signature so concrete
769
- * `ItemInputMapper<SpecificWire, TIn>` remains assignable to `RunnableNodeConfig` fields typed as
770
- * `ItemInputMapper<unknown, unknown>` (same pattern as React-style callbacks).
771
- */
772
- type ItemInputMapper<TWireJson$1 = unknown, TInputJson$1 = unknown> = {
773
- bivarianceHack(args: ItemInputMapperArgs<TWireJson$1>): TInputJson$1 | Promise<TInputJson$1>;
774
- }["bivarianceHack"];
775
- /**
776
- * Runnable node: **`TInputJson`** is the payload after `mapInput` (if any) + Zod validation — what {@link ItemNode}
777
- * `executeOne` receives. **`TOutputJson`** is emitted `item.json` on outputs. **`TWireJson`** is `item.json` from
778
- * upstream **before** `mapInput`; it defaults to **`TInputJson`** when there is no mapper or wire differs from execute input.
779
- */
780
- interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown, TWireJson$1 = TInputJson$1> extends NodeConfigBase {
757
+ interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends NodeConfigBase {
781
758
  readonly kind: "node";
782
759
  readonly [runnableNodeInputType]?: TInputJson$1;
783
760
  readonly [runnableNodeOutputType]?: TOutputJson$1;
784
- readonly [runnableNodeWireType]?: TWireJson$1;
785
761
  /**
786
- * Optional Zod input contract for {@link ItemNode} when not set on the node class.
762
+ * Optional Zod input contract for {@link RunnableNode} when not set on the node class.
787
763
  * Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
788
764
  */
789
765
  readonly inputSchema?: ZodType<TInputJson$1>;
790
766
  /**
791
- * Optional per-item mapper: engine applies it before validating against the node’s `inputSchema`.
792
- * When omitted, the engine validates `item.json` directly.
767
+ * Overrides default lineage propagation for `execute` outputs (binary/meta/paired).
768
+ * Routers with multiple {@link RunnableNode#outputPorts} default to **`carryThrough`**; others default to **`emitOnly`**.
769
+ */
770
+ readonly lineageCarry?: LineageCarryPolicy;
771
+ /**
772
+ * When an activation receives **zero** input items, the engine normally runs `execute` zero times.
773
+ * Set to **`runOnce`** to run `execute` once with an empty `items` batch (and a synthetic wire item for schema parsing).
774
+ * Used by batch-style callback nodes (built-in `Callback`) so `callback([], ctx)` still runs.
793
775
  */
794
- readonly mapInput?: ItemInputMapper<TWireJson$1, TInputJson$1>;
776
+ readonly emptyBatchExecution?: "skip" | "runOnce";
795
777
  }
796
778
  declare const triggerNodeSetupStateType: unique symbol;
797
779
  interface TriggerNodeConfig<TOutputJson$1 = unknown, TSetupState$1 extends JsonValue | undefined = undefined> extends NodeConfigBase {
@@ -799,7 +781,7 @@ interface TriggerNodeConfig<TOutputJson$1 = unknown, TSetupState$1 extends JsonV
799
781
  readonly [triggerNodeOutputType]?: TOutputJson$1;
800
782
  readonly [triggerNodeSetupStateType]?: TSetupState$1;
801
783
  }
802
- type RunnableNodeOutputJson<TConfig$1 extends RunnableNodeConfig<any, any, any>> = TConfig$1 extends RunnableNodeConfig<any, infer TOutputJson, any> ? TOutputJson : never;
784
+ type RunnableNodeOutputJson<TConfig$1 extends RunnableNodeConfig<any, any>> = TConfig$1 extends RunnableNodeConfig<any, infer TOutputJson> ? TOutputJson : never;
803
785
  type TriggerNodeOutputJson<TConfig$1 extends TriggerNodeConfig<any, any>> = TConfig$1 extends TriggerNodeConfig<infer TOutputJson, any> ? TOutputJson : never;
804
786
  interface NodeDefinition {
805
787
  id: NodeId;
@@ -969,16 +951,24 @@ type OAuth2ProviderFromPublicConfig = Readonly<{
969
951
  tokenUrlFieldKey: string;
970
952
  userInfoUrlFieldKey?: string;
971
953
  }>;
954
+ type CredentialOAuth2ScopesFromPublicConfig = Readonly<{
955
+ presetFieldKey: string;
956
+ presetScopes: Readonly<Record<string, ReadonlyArray<string>>>;
957
+ customPresetKey?: string;
958
+ customScopesFieldKey?: string;
959
+ }>;
972
960
  type CredentialOAuth2AuthDefinition = Readonly<{
973
961
  kind: "oauth2";
974
962
  providerId: string;
975
963
  scopes: ReadonlyArray<string>;
964
+ scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig;
976
965
  clientIdFieldKey?: string;
977
966
  clientSecretFieldKey?: string;
978
967
  } | {
979
968
  kind: "oauth2";
980
969
  providerFromPublicConfig: OAuth2ProviderFromPublicConfig;
981
970
  scopes: ReadonlyArray<string>;
971
+ scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig;
982
972
  clientIdFieldKey?: string;
983
973
  clientSecretFieldKey?: string;
984
974
  }>;
@@ -1062,12 +1052,12 @@ type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
1062
1052
  readonly helpUrl?: string;
1063
1053
  }>;
1064
1054
  type DefinedNodeCredentialBindings = Readonly<Record<string, DefinedNodeCredentialBinding>>;
1065
- interface DefinedNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson$1, TOutputJson$1, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined, TWireJson$1 = TInputJson$1> {
1055
+ interface DefinedNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson$1, TOutputJson$1, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
1066
1056
  readonly kind: "defined-node";
1067
1057
  readonly key: TKey$1;
1068
1058
  readonly title: string;
1069
1059
  readonly description?: string;
1070
- create(config: TConfig$1, name?: string, id?: string): RunnableNodeConfig<TInputJson$1, TOutputJson$1, TWireJson$1>;
1060
+ create(config: TConfig$1, name?: string, id?: string): RunnableNodeConfig<TInputJson$1, TOutputJson$1>;
1071
1061
  register(context: {
1072
1062
  registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
1073
1063
  }): void;
@@ -1306,5 +1296,5 @@ declare class RunIntentService {
1306
1296
  private createWebhookExecutionOptions;
1307
1297
  }
1308
1298
  //#endregion
1309
- export { RunnableNodeConfig as A, EngineExecutionLimitsPolicyConfig as B, CredentialTypeId as C, Item as D, BinaryAttachment as E, NodeExecutionRequestHandler as F, WorkflowActivationPolicy as G, RunEventBus as H, NodeExecutionScheduler as I, PersistedRunState as J, WebhookInvocationMatch as K, WorkflowRepository as L, WorkflowDefinition as M, WorkflowId as N, RunId as O, BinaryStorage as P, Clock as Q, Container as R, CredentialTypeDefinition as S, ActivationIdFactory as T, ChainCursor as U, RunEvent as V, AnyRunnableNodeConfig as W, RunPruneCandidate as X, RunCurrentState as Y, RunSummary as Z, CredentialRequirement as _, ToolConfig as a, CredentialSetupStatus as b, CredentialBinding as c, CredentialHealth as d, CredentialInstanceId as f, CredentialOAuth2AuthDefinition as g, CredentialMaterialSourceKind as h, ChatModelConfig as i, RunnableNodeOutputJson as j, RunIdFactory as k, CredentialBindingKey as l, CredentialJsonRecord as m, Engine as n, DefinedNode as o, CredentialInstanceRecord as p, WorkflowRunDetailDto as q, AgentGuardrailConfig as r, AnyCredentialType as s, RunIntentService as t, CredentialFieldSchema as u, CredentialSessionFactoryArgs as v, CredentialTypeRegistry as w, CredentialType as x, CredentialSessionService as y, TypeToken as z };
1310
- //# sourceMappingURL=index-BQaZZmOm.d.ts.map
1299
+ export { RunSummary as $, RunIdFactory as A, Container as B, CredentialTypeId as C, Item as D, BinaryAttachment as E, BinaryStorage as F, ChainCursor as G, EngineExecutionLimitsPolicyConfig as H, NodeExecutionContext as I, WebhookInvocationMatch as J, AnyRunnableNodeConfig as K, NodeExecutionRequestHandler as L, RunnableNodeOutputJson as M, WorkflowDefinition as N, Items as O, WorkflowId as P, RunPruneCandidate as Q, NodeExecutionScheduler as R, CredentialTypeDefinition as S, ActivationIdFactory as T, RunEvent as U, TypeToken as V, RunEventBus as W, PersistedRunState as X, WorkflowRunDetailDto as Y, RunCurrentState as Z, CredentialRequirement as _, ToolConfig as a, CredentialSetupStatus as b, CredentialBinding as c, CredentialHealth as d, Clock as et, CredentialInstanceId as f, CredentialOAuth2AuthDefinition as g, CredentialMaterialSourceKind as h, ChatModelConfig as i, RunnableNodeConfig as j, RunId as k, CredentialBindingKey as l, CredentialJsonRecord as m, Engine as n, DefinedNode as o, CredentialInstanceRecord as p, WorkflowActivationPolicy as q, AgentGuardrailConfig as r, AnyCredentialType as s, RunIntentService as t, CredentialFieldSchema as u, CredentialSessionFactoryArgs as v, CredentialTypeRegistry as w, CredentialType as x, CredentialSessionService as y, WorkflowRepository as z };
1300
+ //# sourceMappingURL=index-dK05sTQ4.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  import { a as CodemationWhitelabelConfig, c as CodemationLogRule, i as CodemationAuthOidcProviderConfig, n as CodemationAuthKind, o as CodemationLogConfig, r as CodemationAuthOAuthProviderConfig, s as CodemationLogLevelName, t as CodemationAuthConfig } from "./CodemationAuthConfig-7hEfICPf.js";
2
2
  import { a as CodemationFrontendAuthSnapshot, i as CodemationFrontendAuthProviderSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-DCniMBGu.js";
3
3
  import { i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-BE0mhe1v.js";
4
- import { A as RunnableNodeConfig, M as WorkflowDefinition, U as ChainCursor, W as AnyRunnableNodeConfig, a as ToolConfig, i as ChatModelConfig, j as RunnableNodeOutputJson, o as DefinedNode, r as AgentGuardrailConfig, s as AnyCredentialType } from "./index-BQaZZmOm.js";
5
- import { S as CodemationPluginPackageMetadata, a as CodemationConfig, b as CodemationPluginConfig, c as CodemationEngineExecutionLimitsConfig, d as CodemationSchedulerConfig, f as CodemationSchedulerKind, g as AppConfig, h as CodemationRegistrationContextBase, i as CodemationApplicationRuntimeConfig, l as CodemationEventBusConfig, m as CodemationAppContext, n as CodemationAppSchedulerConfig, o as CodemationDatabaseConfig, p as CodemationWorkflowDiscovery, r as CodemationAppSchedulerKind, s as CodemationDatabaseKind, t as CodemationAppDefinition, u as CodemationEventBusKind, v as AppPluginLoadSummary, w as CodemationClassToken, x as CodemationPluginContext, y as CodemationPlugin } from "./CodemationConfig-DuGk7uN5.js";
6
- import "./CodemationConfigNormalizer-BP2-0ZDE.js";
7
- import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-D5CSz3TQ.js";
8
- import "./CredentialServices-Bhejvys-.js";
9
- import { _ as Command, c as WorkerRuntime, d as AppContainerLifecycle, f as AppContainerFactory, g as CommandBus, h as Query, l as FrontendRuntime, m as QueryBus, n as CodemationBootstrapRequest, r as ApplicationTokens, t as CodemationPluginListMerger, u as DatabaseMigrations } from "./CodemationPluginListMerger-DFzGgfyI.js";
10
- import { r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-BiFHnorf.js";
11
- import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-fdldtXJH.js";
12
- import { c as CodemationServerGateway, l as ApiPaths } from "./server-Cpzpy1Ar.js";
13
- import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-CSgWyTra.js";
4
+ import { D as Item, G as ChainCursor, I as NodeExecutionContext, K as AnyRunnableNodeConfig, M as RunnableNodeOutputJson, N as WorkflowDefinition, O as Items, V as TypeToken, a as ToolConfig, i as ChatModelConfig, j as RunnableNodeConfig, o as DefinedNode, r as AgentGuardrailConfig, s as AnyCredentialType } from "./index-dK05sTQ4.js";
5
+ import { S as CodemationPluginPackageMetadata, a as CodemationConfig, b as CodemationPluginConfig, c as CodemationEngineExecutionLimitsConfig, d as CodemationSchedulerConfig, f as CodemationSchedulerKind, g as AppConfig, h as CodemationRegistrationContextBase, i as CodemationApplicationRuntimeConfig, l as CodemationEventBusConfig, m as CodemationAppContext, n as CodemationAppSchedulerConfig, o as CodemationDatabaseConfig, p as CodemationWorkflowDiscovery, r as CodemationAppSchedulerKind, s as CodemationDatabaseKind, t as CodemationAppDefinition, u as CodemationEventBusKind, v as AppPluginLoadSummary, w as CodemationClassToken, x as CodemationPluginContext, y as CodemationPlugin } from "./CodemationConfig-DBbMU3HB.js";
6
+ import "./CodemationConfigNormalizer-C8wC0skq.js";
7
+ import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-Ceh6sB3X.js";
8
+ import "./CredentialServices-CYETzKyb.js";
9
+ import { _ as Command, c as WorkerRuntime, d as AppContainerLifecycle, f as AppContainerFactory, g as CommandBus, h as Query, l as FrontendRuntime, m as QueryBus, n as CodemationBootstrapRequest, r as ApplicationTokens, t as CodemationPluginListMerger, u as DatabaseMigrations } from "./CodemationPluginListMerger-Cx9DnyR-.js";
10
+ import { r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-DHdAGOmC.js";
11
+ import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-D9vUTMqc.js";
12
+ import { c as CodemationServerGateway, l as ApiPaths } from "./server-fxqY2WEi.js";
13
+ import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-DeMjp3cs.js";
14
14
  import { ZodType, z } from "zod";
15
15
 
16
16
  //#region src/application/contracts/userDirectoryContracts.types.d.ts
@@ -38,6 +38,56 @@ declare class UpsertLocalBootstrapUserCommand extends Command<UpsertLocalBootstr
38
38
  constructor(email: string, password: string);
39
39
  }
40
40
  //#endregion
41
+ //#region ../core-nodes/src/nodes/aggregate.d.ts
42
+ declare class Aggregate<TIn = unknown, TOut = unknown> implements RunnableNodeConfig<TIn, TOut> {
43
+ readonly name: string;
44
+ readonly aggregate: (items: Items<TIn>, ctx: NodeExecutionContext<Aggregate<TIn, TOut>>) => TOut | Promise<TOut>;
45
+ readonly id?: string | undefined;
46
+ readonly kind: "node";
47
+ readonly type: TypeToken<unknown>;
48
+ readonly execution: {
49
+ readonly hint: "local";
50
+ };
51
+ readonly icon: "lucide:layers";
52
+ constructor(name: string, aggregate: (items: Items<TIn>, ctx: NodeExecutionContext<Aggregate<TIn, TOut>>) => TOut | Promise<TOut>, id?: string | undefined);
53
+ }
54
+ //#endregion
55
+ //#region ../core-nodes/src/nodes/filter.d.ts
56
+ declare class Filter<TIn = unknown> implements RunnableNodeConfig<TIn, TIn> {
57
+ readonly name: string;
58
+ readonly predicate: (item: Item<TIn>, index: number, items: Items<TIn>, ctx: NodeExecutionContext<Filter<TIn>>) => boolean;
59
+ readonly id?: string | undefined;
60
+ readonly kind: "node";
61
+ readonly type: TypeToken<unknown>;
62
+ readonly execution: {
63
+ readonly hint: "local";
64
+ };
65
+ readonly icon: "lucide:filter";
66
+ constructor(name: string, predicate: (item: Item<TIn>, index: number, items: Items<TIn>, ctx: NodeExecutionContext<Filter<TIn>>) => boolean, id?: string | undefined);
67
+ }
68
+ //#endregion
69
+ //#region ../core-nodes/src/nodes/split.d.ts
70
+ declare class Split<TIn = unknown, TElem = unknown> implements RunnableNodeConfig<TIn, TElem> {
71
+ readonly name: string;
72
+ readonly getElements: (item: Item<TIn>, ctx: NodeExecutionContext<Split<TIn, TElem>>) => readonly TElem[];
73
+ readonly id?: string | undefined;
74
+ readonly kind: "node";
75
+ readonly type: TypeToken<unknown>;
76
+ readonly execution: {
77
+ readonly hint: "local";
78
+ };
79
+ /**
80
+ * When splitting yields zero items for a batch, downstream single-input nodes still run once with an empty batch.
81
+ * Mirrors {@link MapData}'s empty-output behavior.
82
+ */
83
+ readonly continueWhenEmptyOutput: true;
84
+ readonly icon: "lucide:ungroup";
85
+ constructor(name: string, getElements: (item: Item<TIn>, ctx: NodeExecutionContext<Split<TIn, TElem>>) => readonly TElem[], id?: string | undefined);
86
+ }
87
+ //#endregion
88
+ //#region ../core-nodes/src/nodes/merge.d.ts
89
+ type MergeMode = "passThrough" | "append" | "mergeByPosition";
90
+ //#endregion
41
91
  //#region ../core-nodes/src/workflowAuthoring/WorkflowAuthoringOptions.types.d.ts
42
92
  type WorkflowAgentPrompt<TCurrentJson> = string | ((item: TCurrentJson) => string);
43
93
  interface WorkflowAgentOptions<TCurrentJson, TOutputSchema extends z.ZodTypeAny | undefined = undefined> {
@@ -54,11 +104,17 @@ interface WorkflowAgentOptions<TCurrentJson, TOutputSchema extends z.ZodTypeAny
54
104
  declare class WorkflowBranchBuilder<TCurrentJson> {
55
105
  private readonly steps;
56
106
  constructor(steps?: ReadonlyArray<AnyRunnableNodeConfig>);
57
- then<TInputJson, TOutputJson, TConfig extends RunnableNodeConfig<TInputJson, TOutputJson, TCurrentJson>>(config: TConfig): WorkflowBranchBuilder<RunnableNodeOutputJson<TConfig>>;
107
+ then<TOutputJson, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson>>(config: TConfig): WorkflowBranchBuilder<RunnableNodeOutputJson<TConfig>>;
58
108
  map<TNextJson>(mapper: (item: TCurrentJson) => TNextJson): WorkflowBranchBuilder<TNextJson>;
59
109
  map<TNextJson>(name: string, mapper: (item: TCurrentJson) => TNextJson, id?: string): WorkflowBranchBuilder<TNextJson>;
60
110
  wait(duration: number | string): WorkflowBranchBuilder<TCurrentJson>;
61
111
  wait(name: string, duration: number | string, id?: string): WorkflowBranchBuilder<TCurrentJson>;
112
+ split<TElem>(getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[]): WorkflowBranchBuilder<TElem>;
113
+ split<TElem>(name: string, getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[], id?: string): WorkflowBranchBuilder<TElem>;
114
+ filter(predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean): WorkflowBranchBuilder<TCurrentJson>;
115
+ filter(name: string, predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean, id?: string): WorkflowBranchBuilder<TCurrentJson>;
116
+ aggregate<TOut>(aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>): WorkflowBranchBuilder<TOut>;
117
+ aggregate<TOut>(name: string, aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>, id?: string): WorkflowBranchBuilder<TOut>;
62
118
  agent<TOutputSchema extends z.ZodTypeAny>(options: WorkflowAgentOptions<TCurrentJson, TOutputSchema>): WorkflowBranchBuilder<z.output<TOutputSchema>>;
63
119
  agent(options: WorkflowAgentOptions<TCurrentJson, undefined>): WorkflowBranchBuilder<Record<string, unknown>>;
64
120
  agent<TOutputSchema extends z.ZodTypeAny>(name: string, options: WorkflowAgentOptions<TCurrentJson, TOutputSchema | undefined>): WorkflowBranchBuilder<TOutputSchema extends z.ZodTypeAny ? z.output<TOutputSchema> : Record<string, unknown>>;
@@ -68,14 +124,30 @@ declare class WorkflowBranchBuilder<TCurrentJson> {
68
124
  //#endregion
69
125
  //#region ../core-nodes/src/workflowAuthoring/WorkflowChain.types.d.ts
70
126
  type BranchCallback<TCurrentJson, TNextJson> = (branch: WorkflowBranchBuilder<TCurrentJson>) => WorkflowBranchBuilder<TNextJson>;
127
+ type RouteBranchCallback<TCurrentJson, TNextJson> = (branch: WorkflowChain<TCurrentJson>) => WorkflowChain<TNextJson>;
71
128
  declare class WorkflowChain<TCurrentJson> {
72
129
  private readonly chain;
73
130
  constructor(chain: ChainCursor<TCurrentJson>);
74
- then<TInputJson, TOutputJson, TConfig extends RunnableNodeConfig<TInputJson, TOutputJson, TCurrentJson>>(config: TConfig): WorkflowChain<RunnableNodeOutputJson<TConfig>>;
131
+ then<TOutputJson, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson>>(config: TConfig): WorkflowChain<RunnableNodeOutputJson<TConfig>>;
75
132
  map<TNextJson>(mapper: (item: TCurrentJson) => TNextJson): WorkflowChain<TNextJson>;
76
133
  map<TNextJson>(name: string, mapper: (item: TCurrentJson) => TNextJson, id?: string): WorkflowChain<TNextJson>;
77
134
  wait(duration: number | string): WorkflowChain<TCurrentJson>;
78
135
  wait(name: string, duration: number | string, id?: string): WorkflowChain<TCurrentJson>;
136
+ split<TElem>(getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[]): WorkflowChain<TElem>;
137
+ split<TElem>(name: string, getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[], id?: string): WorkflowChain<TElem>;
138
+ filter(predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean): WorkflowChain<TCurrentJson>;
139
+ filter(name: string, predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean, id?: string): WorkflowChain<TCurrentJson>;
140
+ aggregate<TOut>(aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>): WorkflowChain<TOut>;
141
+ aggregate<TOut>(name: string, aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>, id?: string): WorkflowChain<TOut>;
142
+ merge(): WorkflowChain<TCurrentJson>;
143
+ merge(cfg: Readonly<{
144
+ mode: MergeMode;
145
+ prefer?: ReadonlyArray<string>;
146
+ }>, id?: string): WorkflowChain<TCurrentJson>;
147
+ merge(name: string, cfg?: Readonly<{
148
+ mode: MergeMode;
149
+ prefer?: ReadonlyArray<string>;
150
+ }>, id?: string): WorkflowChain<TCurrentJson>;
79
151
  if<TBranchJson>(predicate: (item: TCurrentJson) => boolean, branches: Readonly<{
80
152
  true?: BranchCallback<TCurrentJson, TBranchJson>;
81
153
  false?: BranchCallback<TCurrentJson, TBranchJson>;
@@ -84,6 +156,19 @@ declare class WorkflowChain<TCurrentJson> {
84
156
  true?: BranchCallback<TCurrentJson, TBranchJson>;
85
157
  false?: BranchCallback<TCurrentJson, TBranchJson>;
86
158
  }>): WorkflowChain<TBranchJson>;
159
+ route<TBranchJson>(branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>): WorkflowChain<TBranchJson>;
160
+ switch<TBranchJson>(cfg: Readonly<{
161
+ cases: readonly string[];
162
+ defaultCase: string;
163
+ resolveCaseKey: (item: TCurrentJson) => string | Promise<string>;
164
+ branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>;
165
+ }>): WorkflowChain<TBranchJson>;
166
+ switch<TBranchJson>(name: string, cfg: Readonly<{
167
+ cases: readonly string[];
168
+ defaultCase: string;
169
+ resolveCaseKey: (item: TCurrentJson) => string | Promise<string>;
170
+ branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>;
171
+ }>, id?: string): WorkflowChain<TBranchJson>;
87
172
  agent<TOutputSchema extends z.ZodTypeAny>(options: WorkflowAgentOptions<TCurrentJson, TOutputSchema>): WorkflowChain<z.output<TOutputSchema>>;
88
173
  agent(options: WorkflowAgentOptions<TCurrentJson, undefined>): WorkflowChain<Record<string, unknown>>;
89
174
  agent<TOutputSchema extends z.ZodTypeAny>(name: string, options: WorkflowAgentOptions<TCurrentJson, TOutputSchema | undefined>): WorkflowChain<TOutputSchema extends z.ZodTypeAny ? z.output<TOutputSchema> : Record<string, unknown>>;
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import "./ConsoleLogger-ClPU7jtc.js";
2
2
  import { i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-BdiVGG5R.js";
3
- import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-C_ISRrpI.js";
3
+ import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-D6LFSlp5.js";
4
4
  import "./ServerLoggerFactory-BltIIDfQ.js";
5
5
  import "./decorateParam-DrsXNPuw.js";
6
6
  import "./decorate-B0PP651O.js";
7
- import { u as ApplicationTokens } from "./CredentialServices-xVxVA9Tq.js";
8
- import { E as ListUserAccountsQuery, T as UpsertLocalBootstrapUserCommand, _ as CodemationFrontendAuthSnapshotFactory, a as AppContainerLifecycle, g as FrontendAppConfigFactory, h as InternalAuthBootstrapFactory, i as DatabaseMigrations, m as PublicFrontendBootstrapFactory, n as WorkerRuntime, r as FrontendRuntime, t as AppContainerFactory, y as ApiPaths } from "./AppContainerFactory-BRU02PTm.js";
7
+ import { d as ApplicationTokens } from "./CredentialServices-D8BBZH1i.js";
8
+ import { E as ListUserAccountsQuery, T as UpsertLocalBootstrapUserCommand, _ as CodemationFrontendAuthSnapshotFactory, a as AppContainerLifecycle, g as FrontendAppConfigFactory, h as InternalAuthBootstrapFactory, i as DatabaseMigrations, m as PublicFrontendBootstrapFactory, n as WorkerRuntime, r as FrontendRuntime, t as AppContainerFactory, y as ApiPaths } from "./AppContainerFactory-BKaAUIi-.js";
9
9
  import { n as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-ByT1D8dM.js";
10
10
  import { n as CodemationBootstrapRequest, t as CodemationPluginListMerger } from "./CodemationPluginListMerger-CGwOTdZ7.js";
11
11
  import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-DMvIOGW8.js";
12
- import { r as CodemationServerGateway } from "./server-ChTCEc6R.js";
12
+ import { r as CodemationServerGateway } from "./server-C-WZcsId.js";
13
13
  import { workflow } from "@codemation/core-nodes";
14
14
 
15
15
  //#region src/presentation/config/CodemationAuthoring.types.ts
@@ -1,13 +1,13 @@
1
1
  import { l as Logger, u as LoggerFactory } from "./CodemationAuthConfig-7hEfICPf.js";
2
2
  import { t as LogLevelPolicy } from "./LogLevelPolicy-9IcPGZFk.js";
3
3
  import { a as CodemationFrontendAuthSnapshot, i as CodemationFrontendAuthProviderSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-DCniMBGu.js";
4
- import { D as Item, E as BinaryAttachment, G as WorkflowActivationPolicy, K as WebhookInvocationMatch, M as WorkflowDefinition$1, P as BinaryStorage, Q as Clock, S as CredentialTypeDefinition, T as ActivationIdFactory, g as CredentialOAuth2AuthDefinition, k as RunIdFactory, t as RunIntentService } from "./index-BQaZZmOm.js";
5
- import { g as AppConfig } from "./CodemationConfig-DuGk7uN5.js";
6
- import "./CodemationConfigNormalizer-BP2-0ZDE.js";
7
- import { a as CredentialInstanceService, c as CredentialFieldEnvOverlayService, i as CredentialBindingService, l as CredentialTypeRegistryImpl, o as CredentialMaterialResolver, r as CredentialRuntimeMaterialService, s as CredentialSecretCipher, t as CredentialStore } from "./CredentialServices-Bhejvys-.js";
8
- import { a as WorkflowDebuggerOverlayRepository, c as WorkerRuntime, d as AppContainerLifecycle, f as AppContainerFactory, g as CommandBus, i as HonoApiRouteRegistrar, l as FrontendRuntime, m as QueryBus, n as CodemationBootstrapRequest, o as WorkflowRunRepository, p as WorkflowWebsocketServer, r as ApplicationTokens, s as SessionVerifier, t as CodemationPluginListMerger, u as DatabaseMigrations } from "./CodemationPluginListMerger-DFzGgfyI.js";
9
- import { t as AppConfigFactory } from "./AppConfigFactory-BiFHnorf.js";
10
- import { a as WorkflowDto, n as InternalAuthBootstrapFactory, o as WorkflowSummary, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-CSgWyTra.js";
4
+ import { A as RunIdFactory, D as Item, E as BinaryAttachment, F as BinaryStorage, J as WebhookInvocationMatch, N as WorkflowDefinition$1, S as CredentialTypeDefinition, T as ActivationIdFactory, et as Clock, g as CredentialOAuth2AuthDefinition, q as WorkflowActivationPolicy, t as RunIntentService } from "./index-dK05sTQ4.js";
5
+ import { g as AppConfig } from "./CodemationConfig-DBbMU3HB.js";
6
+ import "./CodemationConfigNormalizer-C8wC0skq.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-CYETzKyb.js";
8
+ import { a as WorkflowDebuggerOverlayRepository, c as WorkerRuntime, d as AppContainerLifecycle, f as AppContainerFactory, g as CommandBus, i as HonoApiRouteRegistrar, l as FrontendRuntime, m as QueryBus, n as CodemationBootstrapRequest, o as WorkflowRunRepository, p as WorkflowWebsocketServer, r as ApplicationTokens, s as SessionVerifier, t as CodemationPluginListMerger, u as DatabaseMigrations } from "./CodemationPluginListMerger-Cx9DnyR-.js";
9
+ import { t as AppConfigFactory } from "./AppConfigFactory-DHdAGOmC.js";
10
+ import { a as WorkflowDto, n as InternalAuthBootstrapFactory, o as WorkflowSummary, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-DeMjp3cs.js";
11
11
  import { Hono } from "hono";
12
12
  import { NodeDefinition, WorkflowDefinition } from "@codemation/core/browser";
13
13
 
@@ -131,13 +131,20 @@ declare class WorkflowDefinitionMapper implements DataMapper<WorkflowDefinition$
131
131
  mapSync(workflow: WorkflowDefinition$1): WorkflowDto;
132
132
  toSummary(workflow: WorkflowDefinition$1): WorkflowSummary;
133
133
  private buildConnectionChildMeta;
134
+ private mapNodesAndEdges;
134
135
  private toNodes;
135
136
  private toEdges;
136
137
  private appendMaterializedConnectionEdges;
138
+ private buildAgentConnectionDescriptorIndex;
137
139
  private appendVirtualConnectionNodes;
138
140
  private appendVirtualConnectionEdges;
139
141
  private edgeKey;
140
142
  private createConnectionNode;
143
+ /**
144
+ * Omit optional port fields when undefined so persisted snapshot DTOs (which never serialize
145
+ * undefined keys) stay aligned with live workflow mapping.
146
+ */
147
+ private nodePortFieldsFromConfig;
141
148
  private nodeTypeName;
142
149
  }
143
150
  //#endregion
@@ -255,10 +262,11 @@ declare class OAuth2ConnectService {
255
262
  private readonly credentialFieldEnvOverlayService;
256
263
  private readonly credentialMaterialResolver;
257
264
  private readonly credentialSecretCipher;
265
+ private readonly credentialOAuth2ScopeResolver;
258
266
  private readonly oauth2ProviderRegistry;
259
267
  private readonly appConfig;
260
268
  private static readonly stateTtlMs;
261
- constructor(credentialStore: CredentialStore, credentialInstanceService: CredentialInstanceService, credentialTypeRegistry: CredentialTypeRegistryImpl, credentialRuntimeMaterialService: CredentialRuntimeMaterialService, credentialFieldEnvOverlayService: CredentialFieldEnvOverlayService, credentialMaterialResolver: CredentialMaterialResolver, credentialSecretCipher: CredentialSecretCipher, oauth2ProviderRegistry: OAuth2ProviderRegistry, appConfig: AppConfig);
269
+ constructor(credentialStore: CredentialStore, credentialInstanceService: CredentialInstanceService, credentialTypeRegistry: CredentialTypeRegistryImpl, credentialRuntimeMaterialService: CredentialRuntimeMaterialService, credentialFieldEnvOverlayService: CredentialFieldEnvOverlayService, credentialMaterialResolver: CredentialMaterialResolver, credentialSecretCipher: CredentialSecretCipher, credentialOAuth2ScopeResolver: CredentialOAuth2ScopeResolver, oauth2ProviderRegistry: OAuth2ProviderRegistry, appConfig: AppConfig);
262
270
  createAuthRedirect(instanceId: string, requestOrigin: string): Promise<OAuth2AuthRedirectResult>;
263
271
  handleCallback(args: Readonly<{
264
272
  code?: string | null;
@@ -2,8 +2,8 @@ import "./ConsoleLogger-ClPU7jtc.js";
2
2
  import { a as FilteringLogger, i as PerformanceLogPolicy, n as PerformanceLogPolicyFactory, o as LogLevelPolicyFactory, r as performanceLogPolicyFactory, s as logLevelPolicyFactory, t as ServerLoggerFactory } from "./ServerLoggerFactory-BltIIDfQ.js";
3
3
  import { n as __decorateMetadata, t as __decorateParam } from "./decorateParam-DrsXNPuw.js";
4
4
  import { t as __decorate } from "./decorate-B0PP651O.js";
5
- import { a as CredentialInstanceService, i as CredentialBindingService, u as ApplicationTokens } from "./CredentialServices-xVxVA9Tq.js";
6
- import { a as AppContainerLifecycle, b as WorkflowDefinitionMapper, c as RequestToWebhookItemMapper, d as CredentialHttpRouteHandler, f as CodemationHonoApiApp, g as FrontendAppConfigFactory, h as InternalAuthBootstrapFactory, i as DatabaseMigrations, l as RunHttpRouteHandler, m as PublicFrontendBootstrapFactory, n as WorkerRuntime, o as WorkflowHttpRouteHandler, p as BinaryHttpRouteHandler, r as FrontendRuntime, s as WebhookHttpRouteHandler, t as AppContainerFactory, u as OAuth2HttpRouteHandler, v as WorkflowWebsocketServer, w as RunBinaryAttachmentLookupService, x as WorkflowPolicyUiPresentationFactory } from "./AppContainerFactory-BRU02PTm.js";
5
+ import { a as CredentialInstanceService, d as ApplicationTokens, i as CredentialBindingService } from "./CredentialServices-D8BBZH1i.js";
6
+ import { a as AppContainerLifecycle, b as WorkflowDefinitionMapper, c as RequestToWebhookItemMapper, d as CredentialHttpRouteHandler, f as CodemationHonoApiApp, g as FrontendAppConfigFactory, h as InternalAuthBootstrapFactory, i as DatabaseMigrations, l as RunHttpRouteHandler, m as PublicFrontendBootstrapFactory, n as WorkerRuntime, o as WorkflowHttpRouteHandler, p as BinaryHttpRouteHandler, r as FrontendRuntime, s as WebhookHttpRouteHandler, t as AppContainerFactory, u as OAuth2HttpRouteHandler, v as WorkflowWebsocketServer, w as RunBinaryAttachmentLookupService, x as WorkflowPolicyUiPresentationFactory } from "./AppContainerFactory-BKaAUIi-.js";
7
7
  import { t as AppConfigFactory } from "./AppConfigFactory-ByT1D8dM.js";
8
8
  import { n as CodemationBootstrapRequest, t as CodemationPluginListMerger } from "./CodemationPluginListMerger-CGwOTdZ7.js";
9
9
  import { CoreTokens, inject, injectable } from "@codemation/core";
@@ -1,4 +1,4 @@
1
- import { i as PrismaClient } from "./AppConfigFactory-BiFHnorf.js";
1
+ import { i as PrismaClient } from "./AppConfigFactory-DHdAGOmC.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-fdldtXJH.d.ts.map
9
+ //# sourceMappingURL=persistenceServer-D9vUTMqc.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import "./CodemationAuthConfig-7hEfICPf.js";
2
- import "./index-BQaZZmOm.js";
3
- import { _ as AppPersistenceConfig } from "./CodemationConfig-DuGk7uN5.js";
4
- import "./CodemationConfigNormalizer-BP2-0ZDE.js";
5
- import { n as PrismaMigrationDeployer, r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-BiFHnorf.js";
6
- import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-fdldtXJH.js";
2
+ import "./index-dK05sTQ4.js";
3
+ import { _ as AppPersistenceConfig } from "./CodemationConfig-DBbMU3HB.js";
4
+ import "./CodemationConfigNormalizer-C8wC0skq.js";
5
+ import { n as PrismaMigrationDeployer, r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-DHdAGOmC.js";
6
+ import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-D9vUTMqc.js";
7
7
  export { AppConfigFactory, AppPersistenceConfig, CodemationPostgresPrismaClientFactory, PrismaDatabaseClient as PrismaClient, PrismaMigrationDeployer };
@@ -1,6 +1,6 @@
1
- import { a as CodemationConfigNormalizer, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-C_ISRrpI.js";
2
- import { u as ApplicationTokens } from "./CredentialServices-xVxVA9Tq.js";
3
- import { C as GetWorkflowDetailQuery, S as GetWorkflowSummariesQuery, a as AppContainerLifecycle, b as WorkflowDefinitionMapper, f as CodemationHonoApiApp, r as FrontendRuntime, t as AppContainerFactory } from "./AppContainerFactory-BRU02PTm.js";
1
+ import { a as CodemationConfigNormalizer, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-D6LFSlp5.js";
2
+ import { d as ApplicationTokens } from "./CredentialServices-D8BBZH1i.js";
3
+ import { C as GetWorkflowDetailQuery, S as GetWorkflowSummariesQuery, a as AppContainerLifecycle, b as WorkflowDefinitionMapper, f as CodemationHonoApiApp, r as FrontendRuntime, t as AppContainerFactory } from "./AppContainerFactory-BKaAUIi-.js";
4
4
  import { n as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-ByT1D8dM.js";
5
5
  import { readFile, readdir } from "node:fs/promises";
6
6
  import path from "node:path";
@@ -192,8 +192,7 @@ var CodemationPluginDiscovery = class {
192
192
  return pluginValue.register !== void 0 || pluginValue.credentialTypes !== void 0 || pluginValue.sandbox !== void 0 || Object.keys(pluginValue).length === 0;
193
193
  }
194
194
  resolvePluginEntry(discoveredPackage) {
195
- if (process.env.CODEMATION_PREFER_PLUGIN_SOURCE_ENTRY === "true" && typeof discoveredPackage.developmentEntry === "string" && discoveredPackage.developmentEntry.trim().length > 0) return discoveredPackage.developmentEntry;
196
- return discoveredPackage.pluginEntry;
195
+ return process.env.CODEMATION_PREFER_PLUGIN_SOURCE_ENTRY === "true" && typeof discoveredPackage.developmentEntry === "string" && discoveredPackage.developmentEntry.trim().length > 0 ? discoveredPackage.developmentEntry : discoveredPackage.pluginEntry;
197
196
  }
198
197
  async resolveDevelopmentPluginEntry(packageRoot) {
199
198
  const candidates = [
@@ -219,4 +218,4 @@ var CodemationPluginDiscovery = class {
219
218
 
220
219
  //#endregion
221
220
  export { AppConfigLoader as n, CodemationServerGateway as r, CodemationPluginDiscovery as t };
222
- //# sourceMappingURL=server-ChTCEc6R.js.map
221
+ //# sourceMappingURL=server-C-WZcsId.js.map