@codemation/core 1.0.1 → 2.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 (86) hide show
  1. package/CHANGELOG.md +293 -0
  2. package/dist/{EngineRuntimeRegistration.types-kxQA5NLt.d.ts → EngineRuntimeRegistration.types-D1fyApMI.d.ts} +2 -2
  3. package/dist/{EngineWorkflowRunnerService-Ba2AvBnL.d.cts → EngineRuntimeRegistration.types-pB3FnzqR.d.cts} +17 -17
  4. package/dist/{InMemoryRunDataFactory-Ou4tQUOS.d.cts → InMemoryRunDataFactory-Xw7v4-sj.d.cts} +31 -29
  5. package/dist/InMemoryRunEventBusRegistry-VM3OWnHo.cjs +47 -0
  6. package/dist/InMemoryRunEventBusRegistry-VM3OWnHo.cjs.map +1 -0
  7. package/dist/InMemoryRunEventBusRegistry-sM4z4n_i.js +41 -0
  8. package/dist/InMemoryRunEventBusRegistry-sM4z4n_i.js.map +1 -0
  9. package/dist/{RunIntentService-dteLjNiT.d.ts → RunIntentService-BE9CAkbf.d.ts} +602 -213
  10. package/dist/{RunIntentService-Dyh_dH0k.d.cts → RunIntentService-siBSjaaY.d.cts} +430 -125
  11. package/dist/bootstrap/index.cjs +5 -2
  12. package/dist/bootstrap/index.d.cts +212 -135
  13. package/dist/bootstrap/index.d.ts +4 -4
  14. package/dist/bootstrap/index.js +3 -3
  15. package/dist/{bootstrap-Cko6udwL.cjs → bootstrap-Cm5ruQxx.cjs} +253 -3
  16. package/dist/bootstrap-Cm5ruQxx.cjs.map +1 -0
  17. package/dist/{bootstrap-CL68rqWg.js → bootstrap-D3r505ko.js} +236 -4
  18. package/dist/bootstrap-D3r505ko.js.map +1 -0
  19. package/dist/{index-CyfGTfU1.d.ts → index-DeLl1Tne.d.ts} +574 -242
  20. package/dist/index.cjs +328 -180
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +441 -103
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +305 -163
  25. package/dist/index.js.map +1 -1
  26. package/dist/{runtime-284ok0cm.js → runtime-BGNbRnqs.js} +764 -75
  27. package/dist/runtime-BGNbRnqs.js.map +1 -0
  28. package/dist/{runtime-B3Og-_St.cjs → runtime-DKXJwTNv.cjs} +841 -80
  29. package/dist/runtime-DKXJwTNv.cjs.map +1 -0
  30. package/dist/testing.cjs +4 -4
  31. package/dist/testing.cjs.map +1 -1
  32. package/dist/testing.d.cts +2 -2
  33. package/dist/testing.d.ts +2 -2
  34. package/dist/testing.js +3 -3
  35. package/package.json +7 -2
  36. package/src/authoring/DefinedCollectionRegistry.ts +17 -0
  37. package/src/authoring/defineCollection.types.ts +181 -0
  38. package/src/authoring/definePollingTrigger.types.ts +396 -0
  39. package/src/authoring/definePollingTriggerInternals.ts +74 -0
  40. package/src/authoring/index.ts +19 -0
  41. package/src/bootstrap/index.ts +9 -0
  42. package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +5 -1
  43. package/src/contracts/assertionTypes.ts +63 -0
  44. package/src/contracts/baseTypes.ts +12 -0
  45. package/src/contracts/collectionTypes.ts +44 -0
  46. package/src/contracts/credentialTypes.ts +23 -1
  47. package/src/contracts/index.ts +4 -0
  48. package/src/contracts/runTypes.ts +27 -1
  49. package/src/contracts/runtimeTypes.ts +34 -0
  50. package/src/contracts/testTriggerTypes.ts +66 -0
  51. package/src/contracts/workflowTypes.ts +30 -7
  52. package/src/contracts.ts +59 -0
  53. package/src/events/runEvents.ts +49 -0
  54. package/src/execution/ChildExecutionScopeFactory.ts +4 -7
  55. package/src/execution/DefaultExecutionContextFactory.ts +6 -0
  56. package/src/execution/NodeInstanceFactory.ts +13 -1
  57. package/src/execution/NodeInstantiationError.ts +16 -0
  58. package/src/execution/WorkflowRunExecutionContextFactory.ts +3 -0
  59. package/src/execution/index.ts +1 -0
  60. package/src/index.ts +7 -0
  61. package/src/orchestration/AbortControllerFactory.ts +9 -0
  62. package/src/orchestration/NodeExecutionRequestHandlerService.ts +1 -0
  63. package/src/orchestration/RunContinuationService.ts +3 -0
  64. package/src/orchestration/RunStartService.ts +114 -2
  65. package/src/orchestration/TestSuiteOrchestrator.ts +350 -0
  66. package/src/orchestration/TestSuiteRunIdFactory.ts +11 -0
  67. package/src/orchestration/TriggerRuntimeService.ts +34 -7
  68. package/src/orchestration/index.ts +9 -0
  69. package/src/runtime/EngineFactory.ts +11 -0
  70. package/src/triggers/polling/PollingTriggerDedupWindow.ts +23 -0
  71. package/src/triggers/polling/PollingTriggerLogger.ts +18 -0
  72. package/src/triggers/polling/PollingTriggerRuntime.ts +122 -0
  73. package/src/triggers/polling/index.ts +5 -0
  74. package/src/types/index.ts +12 -9
  75. package/src/workflow/dsl/NodeIdSlugifier.ts +18 -0
  76. package/src/workflow/dsl/WorkflowBuilder.ts +71 -3
  77. package/src/workflow/dsl/WorkflowDefinitionError.ts +15 -0
  78. package/src/workflow/index.ts +2 -0
  79. package/dist/InMemoryRunEventBusRegistry-B0_C4OnP.cjs +0 -262
  80. package/dist/InMemoryRunEventBusRegistry-B0_C4OnP.cjs.map +0 -1
  81. package/dist/InMemoryRunEventBusRegistry-C2U83Hmv.js +0 -238
  82. package/dist/InMemoryRunEventBusRegistry-C2U83Hmv.js.map +0 -1
  83. package/dist/bootstrap-CL68rqWg.js.map +0 -1
  84. package/dist/bootstrap-Cko6udwL.cjs.map +0 -1
  85. package/dist/runtime-284ok0cm.js.map +0 -1
  86. package/dist/runtime-B3Og-_St.cjs.map +0 -1
@@ -1,60 +1,13 @@
1
- import { $t as RunDataFactory, Aa as RunPruneCandidate, Ai as CredentialType, Ar as WebhookInvocationMatch, Ba as WorkflowExecutionRepository, Bn as BinaryStorageWriteResult, Bt as NodeId, Ca as PersistedWorkflowSnapshotNode, Di as CredentialSessionFactoryArgs, Dr as HttpMethod, Et as Items, Fn as BinaryBody, Fr as WorkflowActivationPolicy, Ft as NodeConnectionName, Gn as ExecutionContext, Gt as NodeOutputs, Hi as TypeToken, Ia as RunSummary, In as BinaryStorage, Ir as ExecutionTelemetry, It as NodeDefinition, Jr as TelemetrySpanScope, Kn as ExecutionContextFactory, Ln as BinaryStorageReadResult, Lr as ExecutionTelemetryFactory, Mi as CredentialTypeId, Mt as MutableRunData, Nn as RetryPolicySpec, Nr as WebhookTriggerRoutingDiagnostics, Nt as NodeActivationId, Oi as CredentialSessionService, Pt as NodeConfigBase, Qn as NodeActivationRequest, Ra as WorkflowExecutionListingRepository, Rn as BinaryStorageStatResult, Sr as WorkflowRepository, St as ExecutionMode, Ti as CredentialRequirement, Vn as EngineDeps, Wn as ExecutionBinaryService, Wt as NodeOffloadPolicy, X as CostCatalog, Xn as NodeActivationContinuation, Xt as ParentExecutionRef, Z as CostCatalogEntry, Zt as PersistedRunPolicySnapshot, aa as RunEventSubscription, ai as CostTrackingTelemetry, ar as NodeExecutionScheduler, ba as PersistedRunSchedulingState, ca as ConnectionInvocationRecord, cr as NodeResolver, en as RunDataSnapshot, er as NodeActivationScheduler, gi as CredentialHealth, gn as WorkflowId, hi as CredentialFieldSchema, ia as RunEventBus, in as RunnableNodeInputJson, ji as CredentialTypeDefinition, jr as WebhookTriggerMatcher, jt as JsonValue, l as WorkflowSnapshotCodec, li as CostTrackingUsageRecord, nr as NodeExecutionContext, or as NodeExecutionStatePublisher, pa as NodeExecutionSnapshot, qt as NodeSchedulerDecision, ra as RunEvent, rn as RunnableNodeConfig, rr as NodeExecutionRequest, rt as ParamDeep, sa as ConnectionInvocationId, si as CostTrackingTelemetryFactory, ta as EngineExecutionLimitsPolicy, tn as RunId, tr as NodeBinaryAttachmentService, tt as Expr, u as Engine, ua as EngineRunCounters, ui as AnyCredentialType, un as WorkflowDefinition, ur as PreparedNodeActivationDispatch, vt as ActivationIdFactory, wt as Item, xa as PersistedRunState, xi as CredentialJsonRecord, xr as WorkflowNodeInstanceFactory, yt as BinaryAttachment, za as WorkflowExecutionPruneRepository } from "./RunIntentService-dteLjNiT.js";
1
+ import { $t as PersistedRunPolicySnapshot, Aa as TypeToken, Ai as CredentialSessionFactoryArgs, Bi as PollingTriggerLogger, Bn as BinaryStorageWriteResult, Bt as NodeDefinition, Ca as WorkflowExecutionRepository, Cr as WorkflowRepository, Fi as CredentialTypeId, Fn as BinaryBody, Ga as RunEvent, Gn as ExecutionContext, In as BinaryStorage, Ir as WorkflowActivationPolicy, It as JsonValue, Ja as TestCaseRunStatus, Jt as NodeOutputs, Ka as RunEventBus, Ki as EngineRunCounters, Kn as ExecutionContextFactory, Ln as BinaryStorageReadResult, Lr as ExecutionTelemetry, Lt as MutableRunData, Mr as WebhookTriggerMatcher, Ni as CredentialType, Nn as RetryPolicySpec, Oi as CredentialRequirement, Or as HttpMethod, Ot as ExecutionMode, Pi as CredentialTypeDefinition, Pr as WebhookTriggerRoutingDiagnostics, Qn as NodeActivationRequest, Qt as ParentExecutionRef, Rn as BinaryStorageStatResult, Rr as ExecutionTelemetryFactory, Rt as NodeActivationId, Sa as WorkflowExecutionPruneRepository, Sr as WorkflowNodeInstanceFactory, Tt as BinaryAttachment, Ua as EngineExecutionLimitsPolicy, Ui as ConnectionInvocationId, Vn as EngineDeps, Wi as ConnectionInvocationRecord, Wn as ExecutionBinaryService, Xa as TestSuiteRunId, Xn as NodeActivationContinuation, Xt as NodeSchedulerDecision, Ya as TestSuiteRunStatus, Yi as NodeExecutionSnapshot, Yr as TelemetrySpanScope, aa as PersistedWorkflowSnapshotNode, an as RunnableNodeInputJson, ar as NodeExecutionScheduler, br as TriggerSetupStateRepository, ci as CostTrackingTelemetryFactory, cr as NodeResolver, ct as Expr, da as RunExecutionOptions, dn as WorkflowDefinition, dr as PreparedNodeActivationDispatch, en as RunDataFactory, eo as NodeConnectionName, er as NodeActivationScheduler, fa as RunPruneCandidate, fi as CollectionsContext, i as WorkflowSnapshotCodec, in as RunnableNodeConfig, io as WorkflowId, ji as CredentialSessionService, jr as WebhookInvocationMatch, jt as Items, kr as TriggerInstanceId, kt as Item, ma as RunResult, na as PersistedRunSchedulingState, nn as RunId, nr as NodeExecutionContext, oi as CostTrackingTelemetry, or as NodeExecutionStatePublisher, ot as CostCatalog, pi as AnyCredentialType, qa as RunEventSubscription, qt as NodeOffloadPolicy, ra as PersistedRunState, rr as NodeExecutionRequest, sn as TriggerNodeConfig, st as CostCatalogEntry, tn as RunDataSnapshot, to as NodeId, tr as NodeBinaryAttachmentService, u as Engine, ui as CostTrackingUsageRecord, ut as ParamDeep, va as RunSummary, vi as CredentialFieldSchema, wi as CredentialJsonRecord, wt as ActivationIdFactory, xa as WorkflowExecutionListingRepository, xr as TriggerTestItemsContext, ya as RunTestContext, yi as CredentialHealth, zt as NodeConfigBase } from "./RunIntentService-BE9CAkbf.js";
2
2
  import { ZodType, input, output, z } from "zod";
3
3
 
4
- //#region src/workflowSnapshots/MissingRuntimeFallbacksFactory.d.ts
5
- declare class MissingRuntimeFallbacks {
6
- createDefinition(snapshotNode: PersistedWorkflowSnapshotNode): NodeDefinition;
7
- }
8
- //#endregion
9
- //#region src/runtime/EngineFactory.d.ts
10
- /**
11
- * {@link EngineDeps} plus optional overrides for workflow-snapshot materialization.
12
- * Overrides keep default construction in this factory while allowing tests or advanced wiring to inject instances.
13
- */
14
- type EngineCompositionDeps = EngineDeps & {
15
- workflowSnapshotCodec?: WorkflowSnapshotCodec;
16
- missingRuntimeFallbacks?: MissingRuntimeFallbacks;
17
- /** When set, used for run-start, trigger, and continuation limit defaults. */
18
- executionLimitsPolicy?: EngineExecutionLimitsPolicy;
19
- };
20
- /**
21
- * Composes the {@link Engine} graph from {@link EngineCompositionDeps}. Production wiring usually goes through
22
- * {@link import("../bootstrap/runtime/EngineRuntimeRegistrar").EngineRuntimeRegistrar}; this factory remains for tests and custom composition.
23
- * Exported from `@codemation/core/bootstrap` (not the main `@codemation/core` barrel).
24
- */
25
- declare class EngineFactory {
26
- create(deps: EngineCompositionDeps): Engine;
27
- }
28
- //#endregion
29
- //#region src/events/NodeEventPublisher.d.ts
30
- /** Publishes node lifecycle snapshots onto the run {@link RunEventBus}. */
31
- declare class NodeEventPublisher {
32
- private readonly eventBus;
33
- constructor(eventBus: RunEventBus | undefined);
34
- publish(kind: "nodeQueued" | "nodeStarted" | "nodeCompleted" | "nodeFailed", snapshot: NodeExecutionSnapshot): Promise<void>;
35
- }
36
- //#endregion
37
- //#region src/execution/ChildExecutionScopeFactory.d.ts
4
+ //#region src/orchestration/AbortControllerFactory.d.ts
38
5
  /**
39
- * Builds a re-rooted child execution context for sub-agent (and other deeply-nested) invocations.
40
- *
41
- * At the orchestrator's `agent.tool.call` boundary the inner runtime needs a ctx whose:
42
- * - `nodeId` is the tool's connection node id (so inner LLM/tool connection ids derive correctly),
43
- * - `activationId` is fresh (so its connection-invocation rows are uniquely identifiable),
44
- * - `telemetry` parents children under the tool-call span (not the orchestrator's node span),
45
- * - `binary` is scoped to the new (nodeId, activationId),
46
- * - `parentInvocationId` points back to the tool-call invocation for downstream lineage.
6
+ * Mints fresh {@link AbortController}s. Injected (rather than direct `new`) to honor the
7
+ * codebase's no-direct-construction rule and to give tests a seam for substituting a fake.
47
8
  */
48
- declare class ChildExecutionScopeFactory {
49
- private readonly activationIdFactory;
50
- constructor(activationIdFactory: ActivationIdFactory);
51
- forSubAgent<TConfig$1 extends RunnableNodeConfig<any, any>>(args: Readonly<{
52
- parentCtx: NodeExecutionContext<TConfig$1>;
53
- childNodeId: NodeId;
54
- childConfig: TConfig$1;
55
- parentInvocationId: ConnectionInvocationId;
56
- parentSpan: TelemetrySpanScope;
57
- }>): NodeExecutionContext<TConfig$1>;
9
+ declare class AbortControllerFactory {
10
+ create(): AbortController;
58
11
  }
59
12
  //#endregion
60
13
  //#region src/execution/CredentialResolverFactory.d.ts
@@ -64,122 +17,12 @@ declare class CredentialResolverFactory {
64
17
  create(workflowId: WorkflowId, nodeId: NodeId, config?: NodeExecutionContext["config"]): NodeExecutionContext["getCredential"];
65
18
  }
66
19
  //#endregion
67
- //#region src/execution/asyncSleeper.types.d.ts
68
- interface AsyncSleeper {
69
- sleep(ms: number): Promise<void>;
70
- }
71
- //#endregion
72
- //#region src/execution/DefaultAsyncSleeper.d.ts
73
- declare class DefaultAsyncSleeper implements AsyncSleeper {
74
- sleep(ms: number): Promise<void>;
75
- }
76
- //#endregion
77
- //#region src/execution/DefaultExecutionContextFactory.d.ts
78
- declare class DefaultExecutionContextFactory implements ExecutionContextFactory {
79
- private readonly binaryStorage;
80
- private readonly telemetryFactory;
81
- private readonly costTrackingFactory;
82
- private readonly currentDate;
83
- private readonly telemetryDecoratorFactory;
84
- constructor(binaryStorage?: BinaryStorage, telemetryFactory?: ExecutionTelemetryFactory, costTrackingFactory?: CostTrackingTelemetryFactory, currentDate?: () => Date);
85
- create(args: {
86
- runId: RunId;
87
- workflowId: WorkflowId;
88
- parent?: ParentExecutionRef;
89
- policySnapshot?: PersistedRunPolicySnapshot;
90
- subworkflowDepth: number;
91
- engineMaxNodeActivations: number;
92
- engineMaxSubworkflowDepth: number;
93
- data: RunDataSnapshot;
94
- nodeState?: NodeExecutionStatePublisher;
95
- telemetry?: ExecutionContext["telemetry"];
96
- getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
97
- }): ExecutionContext;
98
- }
99
- //#endregion
100
- //#region src/execution/CatalogBackedCostTrackingTelemetryFactory.d.ts
101
- declare class CatalogBackedCostTrackingTelemetryFactory implements CostTrackingTelemetryFactory {
102
- private readonly costCatalog;
103
- constructor(costCatalog: CostCatalog);
104
- create(args: Readonly<{
105
- telemetry: ExecutionTelemetry;
106
- }>): CostTrackingTelemetry;
107
- }
108
- //#endregion
109
- //#region src/execution/InProcessRetryRunner.d.ts
110
- declare class InProcessRetryRunner {
111
- private readonly sleeper;
112
- constructor(sleeper: AsyncSleeper);
113
- run<T>(policy: RetryPolicySpec | undefined, work: () => Promise<T>): Promise<T>;
114
- private static delayAfterFailureMs;
115
- private static normalizePolicy;
116
- private static assertPositiveInt;
117
- private static assertNonNegativeFinite;
118
- private static assertMultiplier;
119
- }
120
- //#endregion
121
- //#region src/execution/ItemExprResolver.d.ts
122
- /**
123
- * Resolves {@link import("../contracts/itemExpr").ItemExpr} leaves on runnable config before {@link RunnableNode.execute}.
124
- */
125
- declare class ItemExprResolver {
126
- resolveConfigForItem<TConfig$1 extends RunnableNodeConfig<any, any>>(ctx: NodeExecutionContext<TConfig$1>, item: Item, itemIndex: number, items: ReadonlyArray<Item>): Promise<NodeExecutionContext<TConfig$1>>;
127
- }
128
- //#endregion
129
- //#region src/execution/RunnableOutputBehaviorResolver.d.ts
130
- type RunnableOutputBehavior = Readonly<{
131
- keepBinaries: boolean;
132
- }>;
133
- declare class RunnableOutputBehaviorResolver {
134
- resolve(config: RunnableNodeConfig): RunnableOutputBehavior;
135
- private isKeepBinariesEnabled;
136
- }
137
- //#endregion
138
- //#region src/execution/NodeOutputNormalizer.d.ts
139
- declare class NodeOutputNormalizer {
140
- normalizeExecuteResult(args: Readonly<{
141
- baseItem: Item;
142
- raw: unknown;
143
- behavior: RunnableOutputBehavior;
144
- }>): NodeOutputs;
145
- private arrayFanOutToMain;
146
- private emitPortsToOutputs;
147
- private normalizePortPayload;
148
- private isItemLike;
149
- private applyOutput;
150
- }
151
- //#endregion
152
- //#region src/execution/NodeExecutor.d.ts
153
- declare class NodeExecutor {
154
- private readonly nodeInstanceFactory;
155
- private readonly retryRunner;
156
- private readonly fanInMerger;
157
- private readonly outputNormalizer;
158
- private readonly itemExprResolver;
159
- private readonly outputBehaviorResolver;
160
- constructor(nodeInstanceFactory: WorkflowNodeInstanceFactory, retryRunner: InProcessRetryRunner, itemExprResolver?: ItemExprResolver, outputBehaviorResolver?: RunnableOutputBehaviorResolver);
161
- execute(request: NodeActivationRequest): Promise<NodeOutputs>;
162
- private executeMultiInputActivation;
163
- private executeSingleInputNode;
164
- private isTriggerNode;
165
- private isRunnableNode;
166
- private hasExecuteMulti;
167
- private asMultiFromSingleActivation;
168
- private executeRunnableActivation;
169
- /** Use resolver ctx only when {@link NodeExecutionContext.config} is non-nullish. */
170
- private pickExecutionContext;
171
- private resolveInputSchema;
172
- private assertItemJsonNotTopLevelArray;
173
- private assertNoPortEnvelopeBypass;
174
- }
175
- //#endregion
176
- //#region src/execution/NodeInstanceFactory.d.ts
177
- declare class NodeInstanceFactory implements WorkflowNodeInstanceFactory {
178
- private readonly nodeResolver;
179
- constructor(nodeResolver: NodeResolver);
180
- createNodes(workflow: WorkflowDefinition): Map<NodeId, unknown>;
181
- createNode(definition: WorkflowDefinition["nodes"][number]): unknown;
182
- createByType(type: TypeToken<unknown>): unknown;
20
+ //#region src/events/NodeEventPublisher.d.ts
21
+ /** Publishes node lifecycle snapshots onto the run {@link RunEventBus}. */
22
+ declare class NodeEventPublisher {
23
+ private readonly eventBus;
24
+ constructor(eventBus: RunEventBus | undefined);
25
+ publish(kind: "nodeQueued" | "nodeStarted" | "nodeCompleted" | "nodeFailed", snapshot: NodeExecutionSnapshot): Promise<void>;
183
26
  }
184
27
  //#endregion
185
28
  //#region src/contracts/Clock.d.ts
@@ -192,7 +35,7 @@ declare class SystemClock implements Clock {
192
35
  }
193
36
  //#endregion
194
37
  //#region src/authoring/defineNode.types.d.ts
195
- type MaybePromise$1<TValue> = TValue | Promise<TValue>;
38
+ type MaybePromise$2<TValue> = TValue | Promise<TValue>;
196
39
  type ResolvableCredentialType = AnyCredentialType | CredentialTypeId;
197
40
  type SessionForCredentialType<TCredential extends ResolvableCredentialType> = TCredential extends AnyCredentialType ? Awaited<ReturnType<TCredential["createSession"]>> : unknown;
198
41
  type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
@@ -258,7 +101,7 @@ interface DefineNodeOptions<TKey$1 extends string, TConfig$1 extends CredentialJ
258
101
  readonly inputSchema?: ZodType<TInputJson>;
259
102
  /** Preserve inbound `item.binary` when `execute` returns plain JSON or item-shaped results without `binary`. */
260
103
  readonly keepBinaries?: boolean;
261
- execute(args: DefineNodeExecuteArgs<TConfig$1, TInputJson>, context: DefinedNodeRunContext<TConfig$1, TBindings>): MaybePromise$1<TOutputJson>;
104
+ execute(args: DefineNodeExecuteArgs<TConfig$1, TInputJson>, context: DefinedNodeRunContext<TConfig$1, TBindings>): MaybePromise$2<TOutputJson>;
262
105
  }
263
106
  /**
264
107
  * Batch-oriented defined node: `run` receives all item JSON once (last item in activation); emits one output per input row.
@@ -271,7 +114,7 @@ interface DefineBatchNodeOptions<TKey$1 extends string, TConfig$1 extends Creden
271
114
  readonly input?: Readonly<Record<keyof TConfig$1 & string, unknown>>;
272
115
  readonly configSchema?: z.ZodType<TConfig$1>;
273
116
  readonly credentials?: TBindings;
274
- run(items: ReadonlyArray<TInputJson>, context: DefinedNodeRunContext<TConfig$1, TBindings>): MaybePromise$1<ReadonlyArray<TOutputJson>>;
117
+ run(items: ReadonlyArray<TInputJson>, context: DefinedNodeRunContext<TConfig$1, TBindings>): MaybePromise$2<ReadonlyArray<TOutputJson>>;
275
118
  }
276
119
  declare function defineNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, TBindings extends DefinedNodeCredentialBindings | undefined = undefined>(options: DefineNodeOptions<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings>): DefinedNode<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings>;
277
120
  declare function defineBatchNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, TBindings extends DefinedNodeCredentialBindings | undefined = undefined>(options: DefineBatchNodeOptions<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings>): DefinedNode<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings>;
@@ -284,7 +127,7 @@ declare class DefinedNodeRegistry {
284
127
  }
285
128
  //#endregion
286
129
  //#region src/authoring/defineCredential.types.d.ts
287
- type MaybePromise<TValue> = TValue | Promise<TValue>;
130
+ type MaybePromise$1<TValue> = TValue | Promise<TValue>;
288
131
  type CredentialFieldInput = CredentialFieldSchema["type"] | Readonly<Omit<CredentialFieldSchema, "key">>;
289
132
  type CredentialFieldMap<TConfig$1 extends CredentialJsonRecord> = Readonly<Record<keyof TConfig$1 & string, CredentialFieldInput>>;
290
133
  type ZodObjectSchema<TConfig$1 extends CredentialJsonRecord = CredentialJsonRecord> = z.ZodType<TConfig$1>;
@@ -297,8 +140,8 @@ interface DefineCredentialOptions<TPublicSource extends CredentialFieldMap<any>
297
140
  readonly secret: TSecretSource;
298
141
  readonly supportedSourceKinds?: CredentialTypeDefinition["supportedSourceKinds"];
299
142
  readonly auth?: CredentialTypeDefinition["auth"];
300
- createSession(args: CredentialSessionFactoryArgs<InferCredentialConfig<TPublicSource>, InferCredentialConfig<TSecretSource>>): MaybePromise<TSession>;
301
- test(args: CredentialSessionFactoryArgs<InferCredentialConfig<TPublicSource>, InferCredentialConfig<TSecretSource>>): MaybePromise<CredentialHealth>;
143
+ createSession(args: CredentialSessionFactoryArgs<InferCredentialConfig<TPublicSource>, InferCredentialConfig<TSecretSource>>): MaybePromise$1<TSession>;
144
+ test(args: CredentialSessionFactoryArgs<InferCredentialConfig<TPublicSource>, InferCredentialConfig<TSecretSource>>): MaybePromise$1<CredentialHealth>;
302
145
  }
303
146
  declare function defineCredential<TPublicSource extends CredentialFieldMap<any> | ZodObjectSchema<any>, TSecretSource extends CredentialFieldMap<any> | ZodObjectSchema<any>, TSession>(options: DefineCredentialOptions<TPublicSource, TSecretSource, TSession>): CredentialType<InferCredentialConfig<TPublicSource>, InferCredentialConfig<TSecretSource>, TSession> & {
304
147
  readonly key: string;
@@ -592,6 +435,219 @@ type AgentAttachmentRole = "languageModel" | "tool" | "nestedAgent";
592
435
  */
593
436
  declare function callableTool<TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny>(options: CallableToolConfigOptions<TInputSchema, TOutputSchema>): CallableToolConfig<TInputSchema, TOutputSchema>;
594
437
  //#endregion
438
+ //#region src/authoring/defineCollection.types.d.ts
439
+ type CollectionFieldType = "text" | "int" | "bigint" | "double" | "bool" | "timestamptz" | "jsonb" | "uuid";
440
+ interface CollectionColumnBuilder {
441
+ notNull(): CollectionColumnBuilder;
442
+ default(value: unknown): CollectionColumnBuilder;
443
+ readonly _type: CollectionFieldType;
444
+ readonly _nullable: boolean;
445
+ readonly _default?: unknown;
446
+ }
447
+ declare const c: {
448
+ readonly text: () => CollectionColumnBuilder;
449
+ readonly int: () => CollectionColumnBuilder;
450
+ readonly bigint: () => CollectionColumnBuilder;
451
+ readonly double: () => CollectionColumnBuilder;
452
+ readonly bool: () => CollectionColumnBuilder;
453
+ readonly timestamptz: () => CollectionColumnBuilder;
454
+ readonly jsonb: () => CollectionColumnBuilder;
455
+ readonly uuid: () => CollectionColumnBuilder;
456
+ };
457
+ interface CollectionFieldDefinition {
458
+ readonly type: CollectionFieldType;
459
+ readonly nullable: boolean;
460
+ readonly default?: unknown;
461
+ }
462
+ interface CollectionIndexDefinition {
463
+ readonly on: ReadonlyArray<string>;
464
+ readonly unique?: boolean;
465
+ }
466
+ interface CollectionDefinition {
467
+ readonly name: string;
468
+ readonly fields: Readonly<Record<string, CollectionFieldDefinition>>;
469
+ readonly indexes: ReadonlyArray<CollectionIndexDefinition>;
470
+ }
471
+ interface DefinedCollection<TDefinition extends CollectionDefinition = CollectionDefinition> {
472
+ readonly kind: "defined-collection";
473
+ readonly definition: TDefinition;
474
+ register(context: {
475
+ registerCollection(d: CollectionDefinition): void;
476
+ }): void;
477
+ }
478
+ interface DefineCollectionOptions {
479
+ readonly name: string;
480
+ readonly fields: Record<string, CollectionColumnBuilder>;
481
+ readonly indexes?: ReadonlyArray<CollectionIndexDefinition>;
482
+ }
483
+ declare function defineCollection<TName extends string>(options: DefineCollectionOptions & {
484
+ name: TName;
485
+ }): DefinedCollection<CollectionDefinition & {
486
+ name: TName;
487
+ }>;
488
+ //#endregion
489
+ //#region src/authoring/DefinedCollectionRegistry.d.ts
490
+ declare class DefinedCollectionRegistry {
491
+ private static readonly definitions;
492
+ static register(definition: CollectionDefinition): void;
493
+ static resolve(name: string): CollectionDefinition | undefined;
494
+ static list(): ReadonlyArray<CollectionDefinition>;
495
+ }
496
+ //#endregion
497
+ //#region src/authoring/definePollingTrigger.types.d.ts
498
+ type MaybePromise<TValue> = TValue | Promise<TValue>;
499
+ /**
500
+ * Context passed into the `poll` callback on each tick.
501
+ */
502
+ interface DefinePollingTriggerPollContext<TConfig$1 extends CredentialJsonRecord, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined> {
503
+ readonly config: TConfig$1;
504
+ readonly state: TState;
505
+ readonly credentials: DefinedNodeCredentialAccessors<TBindings>;
506
+ }
507
+ /**
508
+ * What `poll` must return each tick.
509
+ */
510
+ interface DefinePollingTriggerPollResult<TItemJson, TState extends JsonValue | undefined> {
511
+ /**
512
+ * New items to emit. Each item may carry an optional `dedupKey`; duplicate keys are
513
+ * filtered out against a rolling dedup window (managed internally by the runtime).
514
+ * Items without a `dedupKey` are always emitted.
515
+ */
516
+ readonly items: ReadonlyArray<{
517
+ json: TItemJson;
518
+ dedupKey?: string;
519
+ }>;
520
+ /** Persisted as the trigger's setup state for the next tick. */
521
+ readonly nextState: TState;
522
+ }
523
+ /**
524
+ * Context passed into the `execute` callback for post-emit enrichment (e.g. fetching
525
+ * attachment bytes). Mirrors `NodeExecutionContext` so plugin authors use familiar patterns.
526
+ */
527
+ type DefinePollingTriggerExecuteContext<TConfig$1 extends TriggerNodeConfig<any, any>> = NodeExecutionContext<TConfig$1>;
528
+ /**
529
+ * Context passed into the `testItems` callback.
530
+ */
531
+ type DefinePollingTriggerTestItemsContext<TConfig$1 extends TriggerNodeConfig<any, any>> = TriggerTestItemsContext<TConfig$1>;
532
+ /**
533
+ * Options accepted by `definePollingTrigger`.
534
+ */
535
+ interface DefinePollingTriggerOptions<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TItemJson, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
536
+ /**
537
+ * Unique node-token-id-style key, e.g. `"msgraph-mail.on-new-mail"`.
538
+ * Used as the persisted runtime type name — must be stable across deployments.
539
+ */
540
+ readonly key: TKey$1;
541
+ readonly title: string;
542
+ readonly description?: string;
543
+ /** Canvas icon (same contract as `NodeConfigBase.icon`). */
544
+ readonly icon?: string;
545
+ /**
546
+ * Zod schema for the trigger's user-facing configuration.
547
+ * When provided, the returned `create()` method is typed against the inferred config type.
548
+ */
549
+ readonly configSchema?: ZodType<TConfig$1>;
550
+ /** Credential bindings keyed by slot (same format as `defineNode`). */
551
+ readonly credentials?: TBindings;
552
+ /**
553
+ * Called once when the trigger arms (or re-arms after a server restart) to provide the
554
+ * initial value for `state` when no persisted state exists.
555
+ */
556
+ initialState?(): TState;
557
+ /**
558
+ * Polling interval in milliseconds. The runtime enforces a minimum of 25 ms.
559
+ * @default 60_000
560
+ */
561
+ readonly pollIntervalMs?: number;
562
+ /**
563
+ * The per-tick poll logic. Called by the runtime each interval.
564
+ * Must return new items plus the next persisted state.
565
+ */
566
+ poll(pollCtx: DefinePollingTriggerPollContext<TConfig$1, TState, TBindings>): MaybePromise<DefinePollingTriggerPollResult<TItemJson, TState>>;
567
+ /**
568
+ * Optional post-emit enrichment step (runs in the normal node-execute phase after the
569
+ * trigger fires and the workflow run starts). Use for expensive per-item work such as
570
+ * fetching attachment bytes via `ctx.binary.attach`. When omitted, the trigger passes
571
+ * items through unchanged.
572
+ */
573
+ execute?(items: Items<TItemJson>, ctx: NodeExecutionContext<DefinedPollingTriggerConfig<TConfig$1, TItemJson>>): MaybePromise<NodeOutputs>;
574
+ /**
575
+ * Optional implementation for the workflow UI's "Test" button. Should return a small
576
+ * sample of current items without consulting or mutating polling state.
577
+ */
578
+ testItems?(ctx: TriggerTestItemsContext<DefinedPollingTriggerConfig<TConfig$1, TItemJson>>): MaybePromise<Items<TItemJson>>;
579
+ }
580
+ /**
581
+ * The object returned by `definePollingTrigger`. Register it via
582
+ * `definePlugin({ nodes: [myTrigger] })` or call `.register(ctx)` directly.
583
+ *
584
+ * `poll` is also directly callable for unit-testing — no runtime needed.
585
+ */
586
+ interface DefinedPollingTrigger<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TItemJson, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
587
+ readonly kind: "defined-polling-trigger";
588
+ readonly key: TKey$1;
589
+ readonly title: string;
590
+ readonly description?: string;
591
+ /**
592
+ * Create the trigger config for use in workflow definitions.
593
+ * @param cfg - User-facing trigger configuration.
594
+ * @param name - Display name (defaults to `title`).
595
+ * @param id - Optional stable node id.
596
+ */
597
+ create(cfg: TConfig$1, name?: string, id?: string): DefinedPollingTriggerConfig<TConfig$1, TItemJson>;
598
+ /**
599
+ * Test seam: call `poll` directly without starting the runtime.
600
+ * Returns `{ items, nextState }` just like the real runtime receives.
601
+ */
602
+ poll(pollCtx: Omit<DefinePollingTriggerPollContext<TConfig$1, TState, TBindings>, "credentials"> & {
603
+ credentials?: DefinedNodeCredentialAccessors<TBindings>;
604
+ }): MaybePromise<DefinePollingTriggerPollResult<TItemJson, TState>>;
605
+ /** Registers the synthesised runtime class with the plugin container. */
606
+ register(context: {
607
+ registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
608
+ }): void;
609
+ }
610
+ /**
611
+ * TriggerNodeConfig produced by `DefinedPollingTrigger.create(...)`.
612
+ * Holds user configuration and credential requirements for the engine.
613
+ * The setup state type is opaque `JsonValue | undefined` — the runtime
614
+ * uses an internal wrapped shape that plugin authors never see.
615
+ */
616
+ declare class DefinedPollingTriggerConfig<TConfig$1 extends CredentialJsonRecord, TItemJson> implements TriggerNodeConfig<TItemJson, JsonValue | undefined> {
617
+ readonly name: string;
618
+ readonly cfg: TConfig$1;
619
+ private readonly credentialRequirements;
620
+ readonly id?: string | undefined;
621
+ readonly kind: "trigger";
622
+ readonly type: TypeToken<unknown>;
623
+ readonly icon: string | undefined;
624
+ constructor(name: string, cfg: TConfig$1, typeToken: TypeToken<unknown>, icon: string | undefined, credentialRequirements: ReadonlyArray<CredentialRequirement>, id?: string | undefined);
625
+ getCredentialRequirements(): ReadonlyArray<CredentialRequirement>;
626
+ }
627
+ /**
628
+ * Declarative helper for authoring polling triggers.
629
+ *
630
+ * ```ts
631
+ * export const onNewMail = definePollingTrigger({
632
+ * key: "my-plugin.on-new-mail",
633
+ * title: "On new mail",
634
+ * configSchema: z.object({ folder: z.string() }),
635
+ * credentials: { auth: myOAuthCredentialType },
636
+ * initialState: () => ({ lastSeenId: undefined }),
637
+ * pollIntervalMs: 60_000,
638
+ * async poll({ config, state, credentials }) {
639
+ * const session = await credentials.auth();
640
+ * const messages = await fetchMessages(session, config.folder, state.lastSeenId);
641
+ * return {
642
+ * items: messages.map(m => ({ json: m, dedupKey: m.id })),
643
+ * nextState: { lastSeenId: messages[0]?.id ?? state.lastSeenId },
644
+ * };
645
+ * },
646
+ * });
647
+ * ```
648
+ */
649
+ declare function definePollingTrigger<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TItemJson, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined = undefined>(options: DefinePollingTriggerOptions<TKey$1, TConfig$1, TItemJson, TState, TBindings>): DefinedPollingTrigger<TKey$1, TConfig$1, TItemJson, TState, TBindings>;
650
+ //#endregion
595
651
  //#region src/ai/AgentConnectionNodeCollector.d.ts
596
652
  type AgentConnectionNodeRole = "languageModel" | "tool" | "nestedAgent";
597
653
  type AgentConnectionCredentialSource = Readonly<{
@@ -756,84 +812,150 @@ declare class DefaultExecutionBinaryService implements ExecutionBinaryService {
756
812
  openReadStream(attachment: BinaryAttachment): Promise<BinaryStorageReadResult | undefined>;
757
813
  }
758
814
  //#endregion
759
- //#region src/runStorage/InMemoryBinaryStorageRegistry.d.ts
760
- declare class InMemoryBinaryStorage implements BinaryStorage {
761
- readonly driverName = "memory";
762
- private readonly values;
763
- write(args: {
764
- storageKey: string;
765
- body: BinaryBody;
766
- }): Promise<BinaryStorageWriteResult>;
767
- openReadStream(storageKey: string): Promise<BinaryStorageReadResult | undefined>;
768
- stat(storageKey: string): Promise<BinaryStorageStatResult>;
769
- delete(storageKey: string): Promise<void>;
815
+ //#region src/execution/ChildExecutionScopeFactory.d.ts
816
+ /**
817
+ * Builds a re-rooted child execution context for sub-agent (and other deeply-nested) invocations.
818
+ *
819
+ * At the orchestrator's `agent.tool.call` boundary the inner runtime needs a ctx whose:
820
+ * - `nodeId` is the tool's connection node id (so inner LLM/tool connection ids derive correctly),
821
+ * - `activationId` is fresh (so its connection-invocation rows are uniquely identifiable),
822
+ * - `telemetry` parents children under the tool-call span (not the orchestrator's node span),
823
+ * - `binary` is scoped to the new (nodeId, activationId),
824
+ * - `parentInvocationId` points back to the tool-call invocation for downstream lineage.
825
+ *
826
+ * Registered via factory in {@link EngineRuntimeRegistrar} so constructors stay free of parameter
827
+ * decorators (Next/SWC and coverage tooling cannot parse them on in-repo sources).
828
+ */
829
+ declare class ChildExecutionScopeFactory {
830
+ private readonly activationIdFactory;
831
+ constructor(activationIdFactory: ActivationIdFactory);
832
+ forSubAgent<TConfig$1 extends RunnableNodeConfig<any, any>>(args: Readonly<{
833
+ parentCtx: NodeExecutionContext<TConfig$1>;
834
+ childNodeId: NodeId;
835
+ childConfig: TConfig$1;
836
+ parentInvocationId: ConnectionInvocationId;
837
+ parentSpan: TelemetrySpanScope;
838
+ }>): NodeExecutionContext<TConfig$1>;
770
839
  }
771
840
  //#endregion
772
- //#region src/runStorage/InMemoryRunDataFactory.d.ts
773
- declare class InMemoryRunDataFactory implements RunDataFactory {
774
- create(initial?: Record<NodeId, NodeOutputs>): MutableRunData;
841
+ //#region src/execution/asyncSleeper.types.d.ts
842
+ interface AsyncSleeper {
843
+ sleep(ms: number): Promise<void>;
775
844
  }
776
845
  //#endregion
777
- //#region src/runStorage/InMemoryWorkflowExecutionRepository.d.ts
778
- declare class InMemoryWorkflowExecutionRepository implements WorkflowExecutionRepository, WorkflowExecutionListingRepository, WorkflowExecutionPruneRepository {
779
- private readonly runs;
780
- createRun(args: {
846
+ //#region src/execution/DefaultAsyncSleeper.d.ts
847
+ declare class DefaultAsyncSleeper implements AsyncSleeper {
848
+ sleep(ms: number): Promise<void>;
849
+ }
850
+ //#endregion
851
+ //#region src/execution/DefaultExecutionContextFactory.d.ts
852
+ declare class DefaultExecutionContextFactory implements ExecutionContextFactory {
853
+ private readonly binaryStorage;
854
+ private readonly telemetryFactory;
855
+ private readonly costTrackingFactory;
856
+ private readonly currentDate;
857
+ private readonly collections?;
858
+ private readonly telemetryDecoratorFactory;
859
+ constructor(binaryStorage?: BinaryStorage, telemetryFactory?: ExecutionTelemetryFactory, costTrackingFactory?: CostTrackingTelemetryFactory, currentDate?: () => Date, collections?: CollectionsContext | undefined);
860
+ create(args: {
781
861
  runId: RunId;
782
862
  workflowId: WorkflowId;
783
- startedAt: string;
784
863
  parent?: ParentExecutionRef;
785
- executionOptions?: PersistedRunState["executionOptions"];
786
- control?: PersistedRunState["control"];
787
- workflowSnapshot?: PersistedRunState["workflowSnapshot"];
788
- mutableState?: PersistedRunState["mutableState"];
789
- policySnapshot?: PersistedRunState["policySnapshot"];
790
- engineCounters?: EngineRunCounters;
791
- }): Promise<void>;
792
- load(runId: RunId): Promise<PersistedRunState | undefined>;
793
- loadSchedulingState(runId: RunId): Promise<PersistedRunSchedulingState | undefined>;
794
- save(state: PersistedRunState): Promise<void>;
795
- deleteRun(runId: RunId): Promise<void>;
796
- listRuns(args?: Readonly<{
797
- workflowId?: WorkflowId;
798
- limit?: number;
799
- }>): Promise<ReadonlyArray<RunSummary>>;
800
- listRunsOlderThan(args: Readonly<{
801
- nowIso: string;
802
- defaultRetentionSeconds: number;
803
- limit?: number;
804
- }>): Promise<ReadonlyArray<RunPruneCandidate>>;
864
+ policySnapshot?: PersistedRunPolicySnapshot;
865
+ subworkflowDepth: number;
866
+ engineMaxNodeActivations: number;
867
+ engineMaxSubworkflowDepth: number;
868
+ data: RunDataSnapshot;
869
+ nodeState?: NodeExecutionStatePublisher;
870
+ telemetry?: ExecutionContext["telemetry"];
871
+ getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
872
+ testContext?: RunTestContext;
873
+ }): ExecutionContext;
805
874
  }
806
875
  //#endregion
807
- //#region src/runStorage/RunSummaryMapper.d.ts
808
- /** Maps persisted run state to API run summaries for listings. */
809
- declare class RunSummaryMapper {
810
- static fromPersistedState(state: PersistedRunState): RunSummary;
876
+ //#region src/execution/CatalogBackedCostTrackingTelemetryFactory.d.ts
877
+ declare class CatalogBackedCostTrackingTelemetryFactory implements CostTrackingTelemetryFactory {
878
+ private readonly costCatalog;
879
+ constructor(costCatalog: CostCatalog);
880
+ create(args: Readonly<{
881
+ telemetry: ExecutionTelemetry;
882
+ }>): CostTrackingTelemetry;
811
883
  }
812
884
  //#endregion
813
- //#region src/runtime/WorkflowRepositoryWebhookTriggerMatcher.d.ts
885
+ //#region src/execution/InProcessRetryRunner.d.ts
886
+ declare class InProcessRetryRunner {
887
+ private readonly sleeper;
888
+ constructor(sleeper: AsyncSleeper);
889
+ run<T>(policy: RetryPolicySpec | undefined, work: () => Promise<T>): Promise<T>;
890
+ private static delayAfterFailureMs;
891
+ private static normalizePolicy;
892
+ private static assertPositiveInt;
893
+ private static assertNonNegativeFinite;
894
+ private static assertMultiplier;
895
+ }
896
+ //#endregion
897
+ //#region src/execution/ItemExprResolver.d.ts
814
898
  /**
815
- * Resolves webhook HTTP routes from the live workflow repository (no trigger setup / registration).
816
- * Maintains an in-memory index keyed by user-defined endpoint path for O(1) lookups after reload.
899
+ * Resolves {@link import("../contracts/itemExpr").ItemExpr} leaves on runnable config before {@link RunnableNode.execute}.
817
900
  */
818
- declare class WorkflowRepositoryWebhookTriggerMatcher implements WebhookTriggerMatcher {
819
- private readonly workflowRepository;
820
- private readonly workflowActivationPolicy;
821
- private readonly diagnostics?;
822
- private readonly routeByPath;
823
- private engineRoutesActive;
824
- constructor(workflowRepository: WorkflowRepository, workflowActivationPolicy: WorkflowActivationPolicy, diagnostics?: WebhookTriggerRoutingDiagnostics | undefined);
825
- onEngineWorkflowsLoaded(): void;
826
- onEngineStopped(): void;
827
- reloadWebhookRoutes(): void;
828
- lookup(endpointPath: string): WebhookInvocationMatch | undefined;
829
- match(args: {
830
- endpointPath: string;
831
- method: HttpMethod;
832
- }): WebhookInvocationMatch | undefined;
833
- private rebuildRouteIndex;
834
- private collectWebhookEndpointPaths;
835
- private tryMatchFromTriggerNode;
836
- private normalizeEndpointPath;
901
+ declare class ItemExprResolver {
902
+ resolveConfigForItem<TConfig$1 extends RunnableNodeConfig<any, any>>(ctx: NodeExecutionContext<TConfig$1>, item: Item, itemIndex: number, items: ReadonlyArray<Item>): Promise<NodeExecutionContext<TConfig$1>>;
903
+ }
904
+ //#endregion
905
+ //#region src/execution/RunnableOutputBehaviorResolver.d.ts
906
+ type RunnableOutputBehavior = Readonly<{
907
+ keepBinaries: boolean;
908
+ }>;
909
+ declare class RunnableOutputBehaviorResolver {
910
+ resolve(config: RunnableNodeConfig): RunnableOutputBehavior;
911
+ private isKeepBinariesEnabled;
912
+ }
913
+ //#endregion
914
+ //#region src/execution/NodeOutputNormalizer.d.ts
915
+ declare class NodeOutputNormalizer {
916
+ normalizeExecuteResult(args: Readonly<{
917
+ baseItem: Item;
918
+ raw: unknown;
919
+ behavior: RunnableOutputBehavior;
920
+ }>): NodeOutputs;
921
+ private arrayFanOutToMain;
922
+ private emitPortsToOutputs;
923
+ private normalizePortPayload;
924
+ private isItemLike;
925
+ private applyOutput;
926
+ }
927
+ //#endregion
928
+ //#region src/execution/NodeExecutor.d.ts
929
+ declare class NodeExecutor {
930
+ private readonly nodeInstanceFactory;
931
+ private readonly retryRunner;
932
+ private readonly fanInMerger;
933
+ private readonly outputNormalizer;
934
+ private readonly itemExprResolver;
935
+ private readonly outputBehaviorResolver;
936
+ constructor(nodeInstanceFactory: WorkflowNodeInstanceFactory, retryRunner: InProcessRetryRunner, itemExprResolver?: ItemExprResolver, outputBehaviorResolver?: RunnableOutputBehaviorResolver);
937
+ execute(request: NodeActivationRequest): Promise<NodeOutputs>;
938
+ private executeMultiInputActivation;
939
+ private executeSingleInputNode;
940
+ private isTriggerNode;
941
+ private isRunnableNode;
942
+ private hasExecuteMulti;
943
+ private asMultiFromSingleActivation;
944
+ private executeRunnableActivation;
945
+ /** Use resolver ctx only when {@link NodeExecutionContext.config} is non-nullish. */
946
+ private pickExecutionContext;
947
+ private resolveInputSchema;
948
+ private assertItemJsonNotTopLevelArray;
949
+ private assertNoPortEnvelopeBypass;
950
+ }
951
+ //#endregion
952
+ //#region src/execution/NodeInstanceFactory.d.ts
953
+ declare class NodeInstanceFactory implements WorkflowNodeInstanceFactory {
954
+ private readonly nodeResolver;
955
+ constructor(nodeResolver: NodeResolver);
956
+ createNodes(workflow: WorkflowDefinition): Map<NodeId, unknown>;
957
+ createNode(definition: WorkflowDefinition["nodes"][number]): unknown;
958
+ createByType(type: TypeToken<unknown>): unknown;
837
959
  }
838
960
  //#endregion
839
961
  //#region src/execution/StaticCostCatalog.d.ts
@@ -910,5 +1032,215 @@ declare class LocalOnlyScheduler implements NodeExecutionScheduler {
910
1032
  }>;
911
1033
  }
912
1034
  //#endregion
913
- export { AgentTurnLimitBehavior as $, EngineFactory as $t, AgentConnectionNodeCollector as A, DefinedNodeConfigInput as At, AgentMessageDto as B, NodeExecutor as Bt, PersistedRuntimeTypeDecoratorOptions as C, DefineCredentialOptions as Ct, InMemoryRunEventBus as D, DefineNodeExecuteArgs as Dt, EventPublishingWorkflowExecutionRepository as E, DefineBatchNodeOptions as Et, AgentCanvasPresentation as F, defineBatchNode as Ft, AgentModelInvocationOptions as G, CatalogBackedCostTrackingTelemetryFactory as Gt, AgentMessageRole as H, RunnableOutputBehaviorResolver as Ht, AgentGuardrailConfig as I, defineNode as It, AgentToolCall as J, AsyncSleeper as Jt, AgentNodeConfig as K, DefaultExecutionContextFactory as Kt, AgentGuardrailDefaults as L, Clock as Lt, AgentConnectionNodeRole as M, DefinedNodeCredentialBinding as Mt, callableTool as N, DefinedNodeCredentialBindings as Nt, ConnectionInvocationEventPublisher as O, DefineNodeOptions as Ot, AgentAttachmentRole as P, DefinedNodeRunContext as Pt, AgentToolToken as Q, EngineCompositionDeps as Qt, AgentMessageBuildArgs as R, SystemClock as Rt, InjectableRuntimeDecoratorComposer as S, NodeBackedToolConfig as St, PersistedRuntimeTypeMetadata as T, DefinedNodeRegistry as Tt, AgentMessageTemplate as U, ItemExprResolver as Ut, AgentMessageLine as V, NodeOutputNormalizer as Vt, AgentMessageTemplateContent as W, InProcessRetryRunner as Wt, AgentToolDefinition as X, ChildExecutionScopeFactory as Xt, AgentToolCallPlanner as Y, CredentialResolverFactory as Yt, AgentToolExecuteArgs as Z, NodeEventPublisher as Zt, node as _, CallableToolKindToken as _t, ConfigDrivenOffloadPolicy as a, NodeBackedToolInputMapper as at, PersistedRuntimeTypeNameResolver as b, CallableToolConfigOptions as bt, RunSummaryMapper as c, NodeBackedToolOutputMapperArgs as ct, InMemoryBinaryStorage as d, ToolConfig as dt, ChatLanguageModel as et, DefaultExecutionBinaryService as f, ToolExecuteArgs as ft, getPersistedRuntimeTypeMetadata as g, AgentToolFactory as gt, chatModel as h, AgentMessageConfigNormalizer as ht, InlineDrivingScheduler as i, NodeBackedToolConfigOptions as it, AgentConnectionNodeDescriptor as j, DefinedNodeCredentialAccessors as jt, AgentConnectionCredentialSource as k, DefinedNode as kt, InMemoryWorkflowExecutionRepository as l, StructuredOutputOptions as lt, ItemsInputNormalizer as m, AgentConfigInspector as mt, HintOnlyOffloadPolicy as n, ChatModelConfig as nt, StaticCostCatalog as o, NodeBackedToolInputMapperArgs as ot, UnavailableBinaryStorage as p, ZodSchemaAny as pt, AgentTool as q, DefaultAsyncSleeper as qt, DefaultDrivingScheduler as r, ChatModelFactory as rt, WorkflowRepositoryWebhookTriggerMatcher as s, NodeBackedToolOutputMapper as st, LocalOnlyScheduler as t, ChatLanguageModelCallOptions as tt, InMemoryRunDataFactory as u, Tool as ut, tool as v, CallableToolFactory as vt, PersistedRuntimeTypeKind as w, defineCredential as wt, PersistedRuntimeTypeMetadataStore as x, CallableToolExecuteHandler as xt, StackTraceCallSitePathResolver as y, CallableToolConfig as yt, AgentMessageConfig as z, NodeInstanceFactory as zt };
914
- //# sourceMappingURL=index-CyfGTfU1.d.ts.map
1035
+ //#region src/runStorage/InMemoryBinaryStorageRegistry.d.ts
1036
+ declare class InMemoryBinaryStorage implements BinaryStorage {
1037
+ readonly driverName = "memory";
1038
+ private readonly values;
1039
+ write(args: {
1040
+ storageKey: string;
1041
+ body: BinaryBody;
1042
+ }): Promise<BinaryStorageWriteResult>;
1043
+ openReadStream(storageKey: string): Promise<BinaryStorageReadResult | undefined>;
1044
+ stat(storageKey: string): Promise<BinaryStorageStatResult>;
1045
+ delete(storageKey: string): Promise<void>;
1046
+ }
1047
+ //#endregion
1048
+ //#region src/runStorage/InMemoryRunDataFactory.d.ts
1049
+ declare class InMemoryRunDataFactory implements RunDataFactory {
1050
+ create(initial?: Record<NodeId, NodeOutputs>): MutableRunData;
1051
+ }
1052
+ //#endregion
1053
+ //#region src/runStorage/InMemoryWorkflowExecutionRepository.d.ts
1054
+ declare class InMemoryWorkflowExecutionRepository implements WorkflowExecutionRepository, WorkflowExecutionListingRepository, WorkflowExecutionPruneRepository {
1055
+ private readonly runs;
1056
+ createRun(args: {
1057
+ runId: RunId;
1058
+ workflowId: WorkflowId;
1059
+ startedAt: string;
1060
+ parent?: ParentExecutionRef;
1061
+ executionOptions?: PersistedRunState["executionOptions"];
1062
+ control?: PersistedRunState["control"];
1063
+ workflowSnapshot?: PersistedRunState["workflowSnapshot"];
1064
+ mutableState?: PersistedRunState["mutableState"];
1065
+ policySnapshot?: PersistedRunState["policySnapshot"];
1066
+ engineCounters?: EngineRunCounters;
1067
+ }): Promise<void>;
1068
+ load(runId: RunId): Promise<PersistedRunState | undefined>;
1069
+ loadSchedulingState(runId: RunId): Promise<PersistedRunSchedulingState | undefined>;
1070
+ save(state: PersistedRunState): Promise<void>;
1071
+ deleteRun(runId: RunId): Promise<void>;
1072
+ listRuns(args?: Readonly<{
1073
+ workflowId?: WorkflowId;
1074
+ limit?: number;
1075
+ }>): Promise<ReadonlyArray<RunSummary>>;
1076
+ listRunsOlderThan(args: Readonly<{
1077
+ nowIso: string;
1078
+ defaultRetentionSeconds: number;
1079
+ limit?: number;
1080
+ }>): Promise<ReadonlyArray<RunPruneCandidate>>;
1081
+ }
1082
+ //#endregion
1083
+ //#region src/runStorage/RunSummaryMapper.d.ts
1084
+ /** Maps persisted run state to API run summaries for listings. */
1085
+ declare class RunSummaryMapper {
1086
+ static fromPersistedState(state: PersistedRunState): RunSummary;
1087
+ }
1088
+ //#endregion
1089
+ //#region src/workflowSnapshots/MissingRuntimeFallbacksFactory.d.ts
1090
+ declare class MissingRuntimeFallbacks {
1091
+ createDefinition(snapshotNode: PersistedWorkflowSnapshotNode): NodeDefinition;
1092
+ }
1093
+ //#endregion
1094
+ //#region src/runtime/EngineFactory.d.ts
1095
+ /**
1096
+ * {@link EngineDeps} plus optional overrides for workflow-snapshot materialization.
1097
+ * Overrides keep default construction in this factory while allowing tests or advanced wiring to inject instances.
1098
+ */
1099
+ type EngineCompositionDeps = EngineDeps & {
1100
+ workflowSnapshotCodec?: WorkflowSnapshotCodec;
1101
+ missingRuntimeFallbacks?: MissingRuntimeFallbacks;
1102
+ /** When set, used for run-start, trigger, and continuation limit defaults. */
1103
+ executionLimitsPolicy?: EngineExecutionLimitsPolicy;
1104
+ };
1105
+ /**
1106
+ * Composes the {@link Engine} graph from {@link EngineCompositionDeps}. Production wiring usually goes through
1107
+ * {@link import("../bootstrap/runtime/EngineRuntimeRegistrar").EngineRuntimeRegistrar}; this factory remains for tests and custom composition.
1108
+ * Exported from `@codemation/core/bootstrap` (not the main `@codemation/core` barrel).
1109
+ */
1110
+ declare class EngineFactory {
1111
+ create(deps: EngineCompositionDeps): Engine;
1112
+ }
1113
+ //#endregion
1114
+ //#region src/runtime/WorkflowRepositoryWebhookTriggerMatcher.d.ts
1115
+ /**
1116
+ * Resolves webhook HTTP routes from the live workflow repository (no trigger setup / registration).
1117
+ * Maintains an in-memory index keyed by user-defined endpoint path for O(1) lookups after reload.
1118
+ */
1119
+ declare class WorkflowRepositoryWebhookTriggerMatcher implements WebhookTriggerMatcher {
1120
+ private readonly workflowRepository;
1121
+ private readonly workflowActivationPolicy;
1122
+ private readonly diagnostics?;
1123
+ private readonly routeByPath;
1124
+ private engineRoutesActive;
1125
+ constructor(workflowRepository: WorkflowRepository, workflowActivationPolicy: WorkflowActivationPolicy, diagnostics?: WebhookTriggerRoutingDiagnostics | undefined);
1126
+ onEngineWorkflowsLoaded(): void;
1127
+ onEngineStopped(): void;
1128
+ reloadWebhookRoutes(): void;
1129
+ lookup(endpointPath: string): WebhookInvocationMatch | undefined;
1130
+ match(args: {
1131
+ endpointPath: string;
1132
+ method: HttpMethod;
1133
+ }): WebhookInvocationMatch | undefined;
1134
+ private rebuildRouteIndex;
1135
+ private collectWebhookEndpointPaths;
1136
+ private tryMatchFromTriggerNode;
1137
+ private normalizeEndpointPath;
1138
+ }
1139
+ //#endregion
1140
+ //#region src/triggers/polling/PollingTriggerRuntime.d.ts
1141
+ interface PollingRunCycleArgs<TState> {
1142
+ previousState: TState | undefined;
1143
+ signal: AbortSignal;
1144
+ }
1145
+ interface PollingRunCycleResult<TState, TItem> {
1146
+ items: Items<TItem>;
1147
+ nextState: TState;
1148
+ }
1149
+ interface PollingTriggerStartArgs<TState, TItem> {
1150
+ trigger: TriggerInstanceId;
1151
+ intervalMs: number;
1152
+ seedState?: TState;
1153
+ runCycle: (cycleCtx: PollingRunCycleArgs<TState>) => Promise<PollingRunCycleResult<TState, TItem>>;
1154
+ emit: (items: Items) => Promise<void>;
1155
+ }
1156
+ /**
1157
+ * Generic polling-trigger runtime. Owns the set-interval loop, overlap guard, and persistence.
1158
+ * Constructed by {@link import("../../runtime/EngineFactory").EngineFactory} and exposed to plugin
1159
+ * authors via {@link import("../../contracts/runtimeTypes").TriggerSetupContext}.polling.
1160
+ */
1161
+ declare class PollingTriggerRuntime {
1162
+ private readonly triggerSetupStateRepository;
1163
+ private readonly logger;
1164
+ private readonly activeTriggers;
1165
+ private readonly intervalsByTrigger;
1166
+ private readonly busyTriggers;
1167
+ constructor(triggerSetupStateRepository: TriggerSetupStateRepository, logger: PollingTriggerLogger);
1168
+ start<TState, TItem>(args: PollingTriggerStartArgs<TState, TItem>): Promise<TState | undefined>;
1169
+ stop(trigger: TriggerInstanceId): Promise<void>;
1170
+ private ensureLoop;
1171
+ private runCycle;
1172
+ private toKey;
1173
+ private describe;
1174
+ private logError;
1175
+ }
1176
+ //#endregion
1177
+ //#region src/orchestration/TestSuiteRunIdFactory.d.ts
1178
+ /**
1179
+ * Mints unique TestSuiteRun identifiers. Separated from {@link import("../types").RunIdFactory}
1180
+ * so suite ids and per-case workflow run ids never alias.
1181
+ */
1182
+ declare class TestSuiteRunIdFactory {
1183
+ makeTestSuiteRunId(): TestSuiteRunId;
1184
+ }
1185
+ //#endregion
1186
+ //#region src/orchestration/TestSuiteOrchestrator.d.ts
1187
+ /**
1188
+ * Engine-facade subset the orchestrator needs. Kept narrow on purpose so unit tests can
1189
+ * substitute a fake without depending on the full Engine wiring.
1190
+ */
1191
+ interface TestSuiteOrchestratorEngine {
1192
+ runWorkflow(wf: WorkflowDefinition, startAt: NodeId, items: Items, parent?: ParentExecutionRef, executionOptions?: RunExecutionOptions): Promise<RunResult>;
1193
+ waitForCompletion(runId: RunId): Promise<Extract<RunResult, {
1194
+ status: "completed" | "failed";
1195
+ }>>;
1196
+ }
1197
+ interface TestSuiteCaseOutcome {
1198
+ readonly testCaseIndex: number;
1199
+ readonly runId: RunId;
1200
+ readonly status: TestCaseRunStatus;
1201
+ }
1202
+ interface TestSuiteRunResult {
1203
+ readonly testSuiteRunId: TestSuiteRunId;
1204
+ readonly workflowId: WorkflowId;
1205
+ readonly triggerNodeId: NodeId;
1206
+ readonly status: TestSuiteRunStatus;
1207
+ readonly totalCases: number;
1208
+ readonly passedCases: number;
1209
+ readonly failedCases: number;
1210
+ readonly cases: ReadonlyArray<TestSuiteCaseOutcome>;
1211
+ }
1212
+ interface RunTestSuiteArgs {
1213
+ readonly workflow: WorkflowDefinition;
1214
+ readonly triggerNodeId: NodeId;
1215
+ readonly testSuiteRunId?: TestSuiteRunId;
1216
+ readonly concurrency?: number;
1217
+ readonly signal?: AbortSignal;
1218
+ }
1219
+ /**
1220
+ * Drives a {@link TestTriggerNodeConfig.generateItems} iterable into one workflow run per item,
1221
+ * with bounded concurrency. Pure engine logic — no persistence, no HTTP, no UI. Hosts adapt by
1222
+ * subscribing to {@link RunEventBus} and writing rows on `testSuite*` / `testCase*` / `nodeCompleted`.
1223
+ *
1224
+ * Cancellation: the supplied `AbortSignal` aborts the source iterable (so credentialed pulls bail)
1225
+ * and stops scheduling further cases. In-flight cases are awaited; engine-level cancellation of
1226
+ * an already-dispatched run is not yet wired (Phase 2).
1227
+ */
1228
+ declare class TestSuiteOrchestrator {
1229
+ private readonly engine;
1230
+ private readonly testSuiteRunIdFactory;
1231
+ private readonly credentialResolverFactory;
1232
+ private readonly abortControllerFactory;
1233
+ private readonly eventBus;
1234
+ private readonly currentDate;
1235
+ constructor(engine: TestSuiteOrchestratorEngine, testSuiteRunIdFactory: TestSuiteRunIdFactory, credentialResolverFactory: CredentialResolverFactory, abortControllerFactory: AbortControllerFactory, eventBus: RunEventBus | undefined, currentDate?: () => Date);
1236
+ runSuite(args: RunTestSuiteArgs): Promise<TestSuiteRunResult>;
1237
+ private runOneCase;
1238
+ private deriveSuiteStatus;
1239
+ private now;
1240
+ /** Defensive label resolver — author-supplied callbacks throw / return non-strings; we tolerate both. */
1241
+ private resolveCaseLabel;
1242
+ private publish;
1243
+ }
1244
+ //#endregion
1245
+ export { AgentConnectionNodeCollector as $, ZodSchemaAny as $t, CatalogBackedCostTrackingTelemetryFactory as A, AgentMessageTemplateContent as At, node as B, ChatLanguageModel as Bt, StaticCostCatalog as C, Clock as Cn, AgentGuardrailDefaults as Ct, RunnableOutputBehaviorResolver as D, AbortControllerFactory as Dn, AgentMessageLine as Dt, NodeOutputNormalizer as E, CredentialResolverFactory as En, AgentMessageDto as Et, DefaultExecutionBinaryService as F, AgentToolCallPlanner as Ft, InjectableRuntimeDecoratorComposer as G, NodeBackedToolInputMapper as Gt, StackTraceCallSitePathResolver as H, ChatModelConfig as Ht, UnavailableBinaryStorage as I, AgentToolDefinition as It, PersistedRuntimeTypeMetadata as J, NodeBackedToolOutputMapperArgs as Jt, PersistedRuntimeTypeDecoratorOptions as K, NodeBackedToolInputMapperArgs as Kt, ItemsInputNormalizer as L, AgentToolExecuteArgs as Lt, DefaultAsyncSleeper as M, AgentNodeConfig as Mt, AsyncSleeper as N, AgentTool as Nt, ItemExprResolver as O, AgentMessageRole as Ot, ChildExecutionScopeFactory as P, AgentToolCall as Pt, AgentConnectionCredentialSource as Q, ToolExecuteArgs as Qt, chatModel as R, AgentToolToken as Rt, ConfigDrivenOffloadPolicy as S, defineNode as Sn, AgentGuardrailConfig as St, NodeExecutor as T, NodeEventPublisher as Tn, AgentMessageConfig as Tt, PersistedRuntimeTypeNameResolver as U, ChatModelFactory as Ut, tool as V, ChatLanguageModelCallOptions as Vt, PersistedRuntimeTypeMetadataStore as W, NodeBackedToolConfigOptions as Wt, InMemoryRunEventBus as X, Tool as Xt, EventPublishingWorkflowExecutionRepository as Y, StructuredOutputOptions as Yt, ConnectionInvocationEventPublisher as Z, ToolConfig as Zt, InMemoryBinaryStorage as _, DefinedNodeCredentialAccessors as _n, c as _t, TestSuiteRunResult as a, CallableToolConfig as an, DefinePollingTriggerPollResult as at, DefaultDrivingScheduler as b, DefinedNodeRunContext as bn, AgentAttachmentRole as bt, PollingRunCycleResult as c, NodeBackedToolConfig as cn, DefinedPollingTriggerConfig as ct, WorkflowRepositoryWebhookTriggerMatcher as d, DefinedNodeRegistry as dn, CollectionColumnBuilder as dt, AgentConfigInspector as en, AgentConnectionNodeDescriptor as et, EngineCompositionDeps as f, DefineBatchNodeOptions as fn, CollectionDefinition as ft, InMemoryRunDataFactory as g, DefinedNodeConfigInput as gn, DefinedCollection as gt, InMemoryWorkflowExecutionRepository as h, DefinedNode as hn, DefineCollectionOptions as ht, TestSuiteOrchestratorEngine as i, CallableToolFactory as in, DefinePollingTriggerPollContext as it, DefaultExecutionContextFactory as j, AgentModelInvocationOptions as jt, InProcessRetryRunner as k, AgentMessageTemplate as kt, PollingTriggerRuntime as l, DefineCredentialOptions as ln, definePollingTrigger as lt, RunSummaryMapper as m, DefineNodeOptions as mn, CollectionIndexDefinition as mt, TestSuiteCaseOutcome as n, AgentToolFactory as nn, DefinePollingTriggerExecuteContext as nt, TestSuiteRunIdFactory as o, CallableToolConfigOptions as on, DefinePollingTriggerTestItemsContext as ot, EngineFactory as p, DefineNodeExecuteArgs as pn, CollectionFieldDefinition as pt, PersistedRuntimeTypeKind as q, NodeBackedToolOutputMapper as qt, TestSuiteOrchestrator as r, CallableToolKindToken as rn, DefinePollingTriggerOptions as rt, PollingRunCycleArgs as s, CallableToolExecuteHandler as sn, DefinedPollingTrigger as st, RunTestSuiteArgs as t, AgentMessageConfigNormalizer as tn, AgentConnectionNodeRole as tt, PollingTriggerStartArgs as u, defineCredential as un, DefinedCollectionRegistry as ut, LocalOnlyScheduler as v, DefinedNodeCredentialBinding as vn, defineCollection as vt, NodeInstanceFactory as w, SystemClock as wn, AgentMessageBuildArgs as wt, InlineDrivingScheduler as x, defineBatchNode as xn, AgentCanvasPresentation as xt, HintOnlyOffloadPolicy as y, DefinedNodeCredentialBindings as yn, callableTool as yt, getPersistedRuntimeTypeMetadata as z, AgentTurnLimitBehavior as zt };
1246
+ //# sourceMappingURL=index-DeLl1Tne.d.ts.map