@codemation/core 0.14.0 → 0.15.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.
- package/CHANGELOG.md +68 -0
- package/dist/{CostCatalogContract-B9aYIqJu.d.cts → CostCatalogContract-Dwo-ZamG.d.cts} +2 -2
- package/dist/EngineRuntimeRegistration.types-BiNasx3G.d.cts +54 -0
- package/dist/EngineRuntimeRegistration.types-Dq4ucrdo.d.ts +21 -0
- package/dist/{InMemoryRunDataFactory-C3rIszrW.d.cts → InMemoryRunDataFactory-D2U9azmZ.d.cts} +2 -20
- package/dist/{InMemoryRunEventBusRegistry-Sa86VxuV.cjs → InMemoryRunEventBusRegistry-DO0WM9Lw.cjs} +1 -1
- package/dist/{InMemoryRunEventBusRegistry-Sa86VxuV.cjs.map → InMemoryRunEventBusRegistry-DO0WM9Lw.cjs.map} +1 -1
- package/dist/{InMemoryRunEventBusRegistry-Bwunvt1T.js → InMemoryRunEventBusRegistry-Layt2xgm.js} +1 -1
- package/dist/{InMemoryRunEventBusRegistry-Bwunvt1T.js.map → InMemoryRunEventBusRegistry-Layt2xgm.js.map} +1 -1
- package/dist/{ItemsInputNormalizer-UCpn7luX.d.cts → ItemsInputNormalizer-A5txcOWX.d.cts} +3 -98
- package/dist/{ItemsInputNormalizer-B9SdLG24.cjs → ItemsInputNormalizer-C1fv3sMW.cjs} +2 -2
- package/dist/ItemsInputNormalizer-C1fv3sMW.cjs.map +1 -0
- package/dist/{ItemsInputNormalizer-DoOawd9R.d.ts → ItemsInputNormalizer-D2vrMrX1.d.ts} +2 -62
- package/dist/{ItemsInputNormalizer-CZEODg94.js → ItemsInputNormalizer-fUYo4GLV.js} +2 -2
- package/dist/ItemsInputNormalizer-fUYo4GLV.js.map +1 -0
- package/dist/{RunIntentService-0f3ICjAz.d.cts → RunIntentService-DKxuHTUz.d.cts} +2 -15
- package/dist/{RunIntentService-Dx_HHxDX.d.ts → RunIntentService-DrpKli2k.d.ts} +2 -22
- package/dist/{agentMcpTypes-B11B3Hd-.d.cts → agentMcpTypes-BHX4RQCC.d.cts} +24 -524
- package/dist/bootstrap/index.cjs +9 -5
- package/dist/bootstrap/index.d.cts +32 -106
- package/dist/bootstrap/index.d.ts +18 -17
- package/dist/bootstrap/index.js +6 -5
- package/dist/{bootstrap-Be0LB0nh.cjs → bootstrap-CTB53rEF.cjs} +9 -60
- package/dist/bootstrap-CTB53rEF.cjs.map +1 -0
- package/dist/{bootstrap-pSQdsMfa.js → bootstrap-DmqKheCI.js} +6 -57
- package/dist/bootstrap-DmqKheCI.js.map +1 -0
- package/dist/browser.cjs +12 -11
- package/dist/browser.d.cts +4 -4
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +3 -2
- package/dist/contracts-7L1wJHdk.cjs +569 -0
- package/dist/contracts-7L1wJHdk.cjs.map +1 -0
- package/dist/contracts-CjJ5CZ7N.js +447 -0
- package/dist/contracts-CjJ5CZ7N.js.map +1 -0
- package/dist/contracts.cjs +9 -2
- package/dist/contracts.d.cts +5 -5
- package/dist/contracts.d.ts +2 -2
- package/dist/contracts.js +3 -2
- package/dist/{executionPersistenceContracts-CX9Ql8N1.d.cts → deploymentManifestTypes-B8CDmZZK.d.cts} +65 -81
- package/dist/di-C6Ubf9o5.cjs +179 -0
- package/dist/di-C6Ubf9o5.cjs.map +1 -0
- package/dist/di-Cjiil7U-.js +114 -0
- package/dist/di-Cjiil7U-.js.map +1 -0
- package/dist/{index-CbJdbIHe.d.ts → index-CRv3_pY3.d.ts} +87 -870
- package/dist/{index-uPnD9EE6.d.ts → index-mnLS0iQl.d.ts} +27 -400
- package/dist/index.cjs +44 -115
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -524
- package/dist/index.d.ts +5 -5
- package/dist/index.js +21 -98
- package/dist/index.js.map +1 -1
- package/dist/{params-Dwl10Ws9.d.cts → params-CrK4iuG1.d.cts} +2 -11
- package/dist/{runtime-CSunvf7A.js → runtime-CBFDpmiz.js} +46 -679
- package/dist/runtime-CBFDpmiz.js.map +1 -0
- package/dist/{runtime-n2tqRwaf.cjs → runtime-Due-FOZ2.cjs} +69 -752
- package/dist/runtime-Due-FOZ2.cjs.map +1 -0
- package/dist/testing.cjs +8 -40
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +3 -32
- package/dist/testing.d.ts +3 -32
- package/dist/testing.js +6 -38
- package/dist/testing.js.map +1 -1
- package/dist/{di-DhwtDRgs.cjs → workflowTypes-BW6Hhee7.cjs} +4 -229
- package/dist/workflowTypes-BW6Hhee7.cjs.map +1 -0
- package/dist/{di-CEV6wTc4.js → workflowTypes-DZtBTmKf.js} +3 -162
- package/dist/workflowTypes-DZtBTmKf.js.map +1 -0
- package/package.json +1 -1
- package/src/ai/AgentConnectionNodeCollector.ts +0 -4
- package/src/ai/AgentMessageConfigNormalizerFactory.ts +0 -4
- package/src/ai/AiHost.ts +0 -38
- package/src/ai/CallableToolConfig.ts +0 -9
- package/src/ai/CallableToolKindToken.ts +0 -4
- package/src/authoring/callableTool.types.ts +0 -3
- package/src/authoring/defineCollection.types.ts +0 -11
- package/src/authoring/defineHumanApprovalNode.types.ts +0 -116
- package/src/authoring/defineNode.types.ts +0 -25
- package/src/authoring/definePollingTrigger.types.ts +18 -152
- package/src/authoring/definePollingTriggerInternals.ts +0 -4
- package/src/authoring/nodeBaseOptions.types.ts +0 -14
- package/src/binaries/boundedReadBinary.types.ts +0 -16
- package/src/bootstrap/index.ts +8 -2
- package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +0 -5
- package/src/bootstrap/runtime/EngineRuntimeRegistration.types.ts +0 -23
- package/src/browser.ts +0 -3
- package/src/contracts/AgentBindError.ts +0 -5
- package/src/contracts/Clock.ts +0 -1
- package/src/contracts/CodemationTelemetryAttributeNames.ts +0 -10
- package/src/contracts/NoOpAgentMcpIntegration.ts +0 -6
- package/src/contracts/NoOpTelemetrySpanScope.ts +0 -7
- package/src/contracts/RetryPolicy.ts +0 -2
- package/src/contracts/agentMcpTypes.ts +0 -34
- package/src/contracts/assertionTypes.ts +0 -33
- package/src/contracts/baseTypes.ts +0 -6
- package/src/contracts/collectionTypes.ts +0 -25
- package/src/contracts/credentialTypes.ts +13 -60
- package/src/contracts/deploymentManifestTypes.ts +158 -0
- package/src/contracts/dispatchTypes.ts +29 -0
- package/src/contracts/executionPersistenceContracts.ts +0 -33
- package/src/contracts/hitlSeamTypes.ts +0 -14
- package/src/contracts/humanTaskStoreTypes.ts +0 -2
- package/src/contracts/inboxChannelTypes.ts +0 -9
- package/src/contracts/index.ts +3 -0
- package/src/contracts/itemExpr.ts +0 -18
- package/src/contracts/itemMeta.ts +0 -3
- package/src/contracts/mcpTypes.ts +0 -16
- package/src/contracts/retryPolicySpec.types.ts +0 -10
- package/src/contracts/runFinishedAtFactory.ts +0 -1
- package/src/contracts/runTypes.ts +0 -74
- package/src/contracts/runtimeTypes.ts +4 -131
- package/src/contracts/telemetryTypes.ts +0 -7
- package/src/contracts/testTriggerTypes.ts +0 -43
- package/src/contracts/triggerInvokerTypes.ts +6 -0
- package/src/contracts/webhookTypes.ts +0 -8
- package/src/contracts/workflowActivationPolicy.ts +0 -5
- package/src/contracts/workflowTypes.ts +4 -86
- package/src/contracts/workspaceFileTypes.ts +0 -72
- package/src/contracts.ts +18 -10
- package/src/credentials/CredentialMaterialProvider.types.ts +0 -28
- package/src/credentials/ManagedCredentialMaterialWriteError.ts +0 -6
- package/src/credentials/ManagedMaterialFetchError.ts +0 -6
- package/src/credentials/OAuthFlowExecutor.types.ts +0 -15
- package/src/di/CoreTokens.ts +2 -6
- package/src/events/ConnectionInvocationEventPublisher.ts +0 -7
- package/src/events/NodeEventPublisher.ts +0 -1
- package/src/events/runEvents.ts +0 -8
- package/src/execution/ActivationEnqueueService.ts +0 -10
- package/src/execution/ChildExecutionScopeFactory.ts +0 -13
- package/src/execution/FanInMergeByOriginMerger.ts +0 -11
- package/src/execution/InProcessRetryRunner.ts +0 -1
- package/src/execution/ItemExprResolver.ts +0 -3
- package/src/execution/NodeActivationRequestComposer.ts +0 -3
- package/src/execution/NodeActivationRequestInputPreparer.ts +0 -5
- package/src/execution/NodeExecutionSnapshotFactory.ts +0 -1
- package/src/execution/NodeExecutor.ts +1 -17
- package/src/execution/NodeSuspensionHandler.ts +1 -39
- package/src/execution/PersistedRunStateTerminalBuilder.ts +0 -5
- package/src/execution/RunSuspendedError.ts +0 -10
- package/src/execution/WorkflowRunExecutionContextFactory.ts +0 -3
- package/src/orchestration/AbortControllerFactory.ts +0 -4
- package/src/orchestration/Engine.ts +0 -9
- package/src/orchestration/NodeExecutionRequestHandlerService.ts +3 -4
- package/src/orchestration/RunContinuationService.ts +7 -39
- package/src/orchestration/RunStartService.ts +0 -7
- package/src/orchestration/TestSuiteOrchestrator.ts +0 -18
- package/src/orchestration/TestSuiteRunIdFactory.ts +0 -4
- package/src/orchestration/TriggerRuntimeService.ts +3 -2
- package/src/planning/CurrentStateFrontierPlanner.ts +0 -1
- package/src/planning/RunQueuePlanner.ts +0 -6
- package/src/policies/executionLimits/EngineExecutionLimitsPolicy.ts +0 -8
- package/src/policies/executionLimits/EngineExecutionLimitsPolicyFactory.ts +0 -3
- package/src/runStorage/RunSummaryMapper.ts +0 -1
- package/src/runtime/EngineFactory.ts +6 -11
- package/src/runtime/RunIntentService.ts +0 -4
- package/src/runtime/WorkflowRepositoryWebhookTriggerMatcher.ts +0 -4
- package/src/runtime-types/InjectableRuntimeDecoratorComposerRegistry.ts +0 -4
- package/src/runtime-types/PersistedRuntimeTypeMetadataStoreRegistry.ts +0 -4
- package/src/runtime-types/PersistedRuntimeTypeNameResolver.ts +0 -1
- package/src/runtime-types/persistedRuntimeTypeModelRegistry.ts +0 -4
- package/src/runtime-types/runtimeTypeDecorators.types.ts +0 -12
- package/src/scheduler/ConfigDrivenOffloadPolicy.ts +0 -1
- package/src/scheduler/DefaultDrivingScheduler.ts +0 -6
- package/src/scheduler/InlineDrivingScheduler.ts +0 -13
- package/src/serialization/ItemsInputNormalizer.ts +0 -5
- package/src/testing/CapturingScheduler.ts +0 -3
- package/src/testing/EngineTestKitRunIdFactory.ts +0 -3
- package/src/testing/ItemHarnessNode.ts +0 -3
- package/src/testing/ItemHarnessNodeConfig.ts +0 -4
- package/src/testing/PrefixedSequentialIdGenerator.ts +0 -3
- package/src/testing/RegistrarEngineTestKit.types.ts +0 -2
- package/src/testing/RejectingCredentialSessionService.ts +0 -4
- package/src/testing/SubWorkflowRunnerTestNode.ts +0 -3
- package/src/testing/WorkflowTestHarnessManualTrigger.ts +0 -3
- package/src/testing/WorkflowTestKitBuilder.ts +0 -4
- package/src/testing/WorkflowTestKitRunNodeWorkflowFactory.ts +0 -3
- package/src/testing.ts +0 -3
- package/src/triggers/polling/PollingTriggerDedupWindow.ts +0 -4
- package/src/triggers/polling/PollingTriggerLogger.ts +0 -5
- package/src/triggers/polling/PollingTriggerRuntime.ts +0 -5
- package/src/types/index.ts +0 -6
- package/src/validation/WorkflowEdgePortValidator.ts +0 -5
- package/src/workflow/definition/ConnectionInvocationIdFactory.ts +0 -7
- package/src/workflow/definition/ConnectionNodeIdFactory.ts +0 -6
- package/src/workflow/definition/NodeIterationIdFactory.ts +0 -13
- package/src/workflow/definition/WorkflowExecutableNodeClassifier.ts +0 -6
- package/src/workflow/dsl/ChainCursorResolver.ts +0 -20
- package/src/workflow/dsl/NodeIdSlugifier.ts +0 -9
- package/src/workflow/dsl/WhenBuilder.ts +0 -17
- package/src/workflow/dsl/WorkflowDefinitionError.ts +0 -9
- package/src/workflow/dsl/workflowBuilderTypes.ts +0 -24
- package/src/workflowSnapshots/MissingRuntimeParityGuard.ts +24 -0
- package/src/workflowSnapshots/PersistedWorkflowTokenRegistry.ts +0 -6
- package/src/workflowSnapshots/WorkflowParityMismatchError.ts +18 -0
- package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +0 -5
- package/src/workflowSnapshots/index.ts +3 -0
- package/dist/EngineRuntimeRegistration.types-BYAmGMdS.d.cts +0 -81
- package/dist/EngineRuntimeRegistration.types-CVLI8DsJ.d.ts +0 -44
- package/dist/ItemsInputNormalizer-B9SdLG24.cjs.map +0 -1
- package/dist/ItemsInputNormalizer-CZEODg94.js.map +0 -1
- package/dist/bootstrap-Be0LB0nh.cjs.map +0 -1
- package/dist/bootstrap-pSQdsMfa.js.map +0 -1
- package/dist/contracts-CK0x6w_G.cjs +0 -74
- package/dist/contracts-CK0x6w_G.cjs.map +0 -1
- package/dist/contracts-DXdfTdpW.js +0 -50
- package/dist/contracts-DXdfTdpW.js.map +0 -1
- package/dist/di-CEV6wTc4.js.map +0 -1
- package/dist/di-DhwtDRgs.cjs.map +0 -1
- package/dist/runtime-CSunvf7A.js.map +0 -1
- package/dist/runtime-n2tqRwaf.cjs.map +0 -1
|
@@ -19,56 +19,30 @@ import type { WorkflowActivationPolicy } from "./workflowActivationPolicy";
|
|
|
19
19
|
import type { TriggerInstanceId, WebhookTriggerMatcher } from "./webhookTypes";
|
|
20
20
|
import type { ZodType } from "zod";
|
|
21
21
|
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
// HITL primitives
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
|
|
26
|
-
/** Opaque unique identifier for a single HumanTask instance. */
|
|
27
22
|
export type HumanTaskId = string;
|
|
28
23
|
|
|
29
|
-
/**
|
|
30
|
-
* Duration string — ISO 8601 duration ("PT24H") or shorthand ("24h").
|
|
31
|
-
* Parsed by the timeout job; stored as-is in the suspension record.
|
|
32
|
-
*/
|
|
33
24
|
export type Duration = string;
|
|
34
25
|
|
|
35
|
-
/**
|
|
36
|
-
* Minimal handle handed to the `deliver` callback so it can route to the correct
|
|
37
|
-
* inbox channel.
|
|
38
|
-
*/
|
|
39
26
|
export interface HumanTaskHandle {
|
|
40
27
|
readonly taskId: HumanTaskId;
|
|
41
28
|
readonly runId: string;
|
|
42
29
|
readonly nodeId: string;
|
|
43
30
|
readonly expiresAt: Date;
|
|
44
|
-
/** TODO: real signed URL; placeholder empty string for now. */
|
|
45
31
|
readonly resumeUrl: string;
|
|
46
|
-
/**
|
|
47
|
-
* Arbitrary JSON metadata copied from `SuspensionRequest.request.metadata` at suspension time.
|
|
48
|
-
* Used by the agent runtime to round-trip the `agentCheckpoint` back to the
|
|
49
|
-
* resumed node via `ctx.resumeContext.task.metadata`.
|
|
50
|
-
*/
|
|
51
32
|
readonly metadata?: Readonly<Record<string, import("./workflowTypes").JsonValue>>;
|
|
52
33
|
}
|
|
53
34
|
|
|
54
|
-
/** Human-readable description surface shown to the reviewer. */
|
|
55
35
|
export interface HumanTaskSubject {
|
|
56
36
|
readonly title: string;
|
|
57
37
|
readonly summary: string;
|
|
58
38
|
readonly attributes?: import("./workflowTypes").JsonValue;
|
|
59
39
|
}
|
|
60
40
|
|
|
61
|
-
/** Identity of the person who made a decision on the task. */
|
|
62
41
|
export interface HumanTaskActor {
|
|
63
42
|
readonly actorId: string;
|
|
64
43
|
readonly displayName?: string;
|
|
65
44
|
}
|
|
66
45
|
|
|
67
|
-
/**
|
|
68
|
-
* Resume context injected into `NodeExecutionContext` when the engine re-activates
|
|
69
|
-
* a previously suspended node. `defineHumanApprovalNode` wraps this with parsed
|
|
70
|
-
* `TDecision`; at the engine layer `decision.value` is `unknown`.
|
|
71
|
-
*/
|
|
72
46
|
export interface ResumeContext {
|
|
73
47
|
readonly decision:
|
|
74
48
|
| Readonly<{ kind: "decided"; value: unknown; actor: HumanTaskActor; decidedAt: Date }>
|
|
@@ -78,25 +52,6 @@ export interface ResumeContext {
|
|
|
78
52
|
readonly task: HumanTaskHandle;
|
|
79
53
|
}
|
|
80
54
|
|
|
81
|
-
/**
|
|
82
|
-
* Thrown by a node's `execute()` to request durable suspension of the current item.
|
|
83
|
-
* The engine catches this, persists the suspension entry, calls `deliver`, and
|
|
84
|
-
* continues to the next item (per-item semantics).
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```ts
|
|
88
|
-
* throw new SuspensionRequest({
|
|
89
|
-
* decisionSchema: z.object({ approved: z.boolean() }),
|
|
90
|
-
* timeout: "PT24H",
|
|
91
|
-
* onTimeout: "halt",
|
|
92
|
-
* subject: { title: "Approve invoice", summary: "Invoice #1234 needs approval" },
|
|
93
|
-
* deliver: async (handle) => {
|
|
94
|
-
* await notifySlack(handle);
|
|
95
|
-
* return { channel: "slack", ts: "..." };
|
|
96
|
-
* },
|
|
97
|
-
* });
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
55
|
export class SuspensionRequest<
|
|
101
56
|
TDecision = unknown,
|
|
102
57
|
TDelivery extends import("./workflowTypes").JsonValue = import("./workflowTypes").JsonValue,
|
|
@@ -111,8 +66,6 @@ export class SuspensionRequest<
|
|
|
111
66
|
deliver: (handle: HumanTaskHandle) => Promise<TDelivery>;
|
|
112
67
|
}>,
|
|
113
68
|
) {
|
|
114
|
-
// Extending Error so wrappers like InProcessRetryRunner preserve identity
|
|
115
|
-
// (`instanceof SuspensionRequest`) instead of coercing via String(thrown).
|
|
116
69
|
super(`SuspensionRequest(${request.subject?.title ?? "untitled"})`);
|
|
117
70
|
this.name = "SuspensionRequest";
|
|
118
71
|
}
|
|
@@ -190,11 +143,6 @@ export interface NodeExecutionStatePublisher {
|
|
|
190
143
|
error: Error;
|
|
191
144
|
}): Promise<void>;
|
|
192
145
|
appendConnectionInvocation(args: ConnectionInvocationAppendArgs): Promise<void>;
|
|
193
|
-
/**
|
|
194
|
-
* Annotates the current snapshot for `nodeId` with the id of the child run spawned by a
|
|
195
|
-
* SubWorkflow invocation. Called from `SubWorkflowNode.execute` after `runById` resolves.
|
|
196
|
-
* The engine's subsequent `markCompleted` call preserves the value via `previous.childRunId`.
|
|
197
|
-
*/
|
|
198
146
|
setChildRunId?(args: { nodeId: NodeId; childRunId: RunId }): Promise<void>;
|
|
199
147
|
}
|
|
200
148
|
|
|
@@ -227,9 +175,7 @@ export interface BinaryStorage {
|
|
|
227
175
|
openReadStream(storageKey: string): Promise<BinaryStorageReadResult | undefined>;
|
|
228
176
|
stat(storageKey: string): Promise<BinaryStorageStatResult>;
|
|
229
177
|
delete(storageKey: string): Promise<void>;
|
|
230
|
-
/** Deletes multiple objects in bulk. Keys are batched internally. */
|
|
231
178
|
deleteMany(storageKeys: ReadonlyArray<string>): Promise<void>;
|
|
232
|
-
/** Lists all keys sharing a common prefix. Returns keys in arbitrary order. */
|
|
233
179
|
listByPrefix(prefix: string): Promise<ReadonlyArray<string>>;
|
|
234
180
|
}
|
|
235
181
|
|
|
@@ -246,27 +192,13 @@ export interface NodeBinaryAttachmentService extends ExecutionBinaryService {
|
|
|
246
192
|
withAttachment<TJson>(item: Item<TJson>, name: string, attachment: BinaryAttachment): Item<TJson>;
|
|
247
193
|
}
|
|
248
194
|
|
|
249
|
-
/** Default maximum bytes read into memory by the bounded helpers (50 MiB). */
|
|
250
195
|
export const BINARY_DEFAULT_MAX_BYTES = 50 * 1024 * 1024;
|
|
251
196
|
|
|
252
197
|
export interface ExecutionBinaryService {
|
|
253
198
|
forNode(args: { nodeId: NodeId; activationId: NodeActivationId }): NodeBinaryAttachmentService;
|
|
254
199
|
openReadStream(attachment: BinaryAttachment): Promise<BinaryStorageReadResult | undefined>;
|
|
255
|
-
/**
|
|
256
|
-
* Reads all bytes from the attachment into a contiguous `Uint8Array`.
|
|
257
|
-
* Checks `attachment.size` against `maxBytes` *before* any allocation; throws a bounded-read
|
|
258
|
-
* error when exceeded (no OOM). Throws if the stream is unavailable or the byte count mismatches.
|
|
259
|
-
*/
|
|
260
200
|
getBytes(attachment: BinaryAttachment, maxBytes?: number): Promise<Uint8Array>;
|
|
261
|
-
/**
|
|
262
|
-
* Reads the attachment and decodes the bytes as UTF-8 text.
|
|
263
|
-
* Subject to the same bounded-read safety as `getBytes`.
|
|
264
|
-
*/
|
|
265
201
|
getText(attachment: BinaryAttachment, maxBytes?: number): Promise<string>;
|
|
266
|
-
/**
|
|
267
|
-
* Reads the attachment, decodes as UTF-8 text, and parses as JSON.
|
|
268
|
-
* Throws a clear error on invalid JSON. Subject to the same bounded-read safety.
|
|
269
|
-
*/
|
|
270
202
|
getJson<T = unknown>(attachment: BinaryAttachment, maxBytes?: number): Promise<T>;
|
|
271
203
|
}
|
|
272
204
|
|
|
@@ -274,11 +206,8 @@ export interface ExecutionContext {
|
|
|
274
206
|
runId: RunId;
|
|
275
207
|
workflowId: WorkflowId;
|
|
276
208
|
parent?: ParentExecutionRef;
|
|
277
|
-
/** This run's subworkflow depth (0 = root). */
|
|
278
209
|
subworkflowDepth: number;
|
|
279
|
-
/** Effective activation budget cap for this run (after policy merge). */
|
|
280
210
|
engineMaxNodeActivations: number;
|
|
281
|
-
/** Effective subworkflow nesting cap for this run (after policy merge). */
|
|
282
211
|
engineMaxSubworkflowDepth: number;
|
|
283
212
|
now: () => Date;
|
|
284
213
|
data: RunDataSnapshot;
|
|
@@ -286,28 +215,11 @@ export interface ExecutionContext {
|
|
|
286
215
|
telemetry: ExecutionTelemetry;
|
|
287
216
|
binary: ExecutionBinaryService;
|
|
288
217
|
getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
|
|
289
|
-
/** Per-item iteration id, set by {@link NodeExecutor} on the ctx passed into runnable `execute`. */
|
|
290
218
|
iterationId?: NodeIterationId;
|
|
291
|
-
/** Item index (0-based) within the current activation's batch; set alongside {@link iterationId}. */
|
|
292
219
|
itemIndex?: number;
|
|
293
|
-
/** When set, this ctx is executing inside a sub-agent triggered by the named parent invocation. */
|
|
294
220
|
parentInvocationId?: ConnectionInvocationId;
|
|
295
|
-
/**
|
|
296
|
-
* Present iff the run was started by a TestSuiteOrchestrator. The {@link IsTestRunNode}
|
|
297
|
-
* branches on this; assertion-emitting nodes use it to decide whether to record results.
|
|
298
|
-
*/
|
|
299
221
|
testContext?: RunTestContext;
|
|
300
|
-
/**
|
|
301
|
-
* Collections registered in the codemation config, keyed by collection name.
|
|
302
|
-
*/
|
|
303
222
|
readonly collections?: CollectionsContext;
|
|
304
|
-
/**
|
|
305
|
-
* Resolve a DI token from the host container.
|
|
306
|
-
* Allows nodes to reach host-side services (e.g. `InboxChannelResolverToken`)
|
|
307
|
-
* without importing host code. Wired by `DefaultExecutionContextFactory`; throws
|
|
308
|
-
* a clear error when no resolver is configured (e.g. in unit tests that don't
|
|
309
|
-
* set up the full container).
|
|
310
|
-
*/
|
|
311
223
|
resolve<T>(token: TypeToken<T>): T;
|
|
312
224
|
}
|
|
313
225
|
|
|
@@ -334,19 +246,10 @@ export interface NodeExecutionContext<TConfig extends NodeConfigBase = NodeConfi
|
|
|
334
246
|
config: TConfig;
|
|
335
247
|
telemetry: NodeExecutionTelemetry;
|
|
336
248
|
binary: NodeBinaryAttachmentService;
|
|
337
|
-
/**
|
|
338
|
-
* Present when this node activation is a HITL resume.
|
|
339
|
-
* The node checks `ctx.resumeContext !== undefined` and takes the resume branch.
|
|
340
|
-
*/
|
|
341
249
|
resumeContext?: ResumeContext;
|
|
342
250
|
}
|
|
343
251
|
|
|
344
|
-
export interface
|
|
345
|
-
/**
|
|
346
|
-
* Start the polling loop. The runtime registers its own cleanup handle so callers do not need to
|
|
347
|
-
* call {@link TriggerSetupContext.registerCleanup} for the loop.
|
|
348
|
-
* @returns The state returned by the first cycle (or `undefined` when the overlap guard fired).
|
|
349
|
-
*/
|
|
252
|
+
export interface TriggerPollingPort {
|
|
350
253
|
start<TState, TItem>(args: {
|
|
351
254
|
intervalMs: number;
|
|
352
255
|
seedState?: TState;
|
|
@@ -355,7 +258,9 @@ export interface PollingTriggerHandle {
|
|
|
355
258
|
signal: AbortSignal;
|
|
356
259
|
}) => Promise<{ items: Items<TItem>; nextState: TState }>;
|
|
357
260
|
}): Promise<TState | undefined>;
|
|
358
|
-
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export interface PollingTriggerHandle extends TriggerPollingPort {
|
|
359
264
|
readonly dedup: import("../triggers/polling/PollingTriggerDedupWindow").PollingTriggerDedupWindow;
|
|
360
265
|
}
|
|
361
266
|
|
|
@@ -368,7 +273,6 @@ export interface TriggerSetupContext<
|
|
|
368
273
|
previousState: TSetupState;
|
|
369
274
|
registerCleanup(cleanup: TriggerCleanupHandle): void;
|
|
370
275
|
emit(items: Items): Promise<void>;
|
|
371
|
-
/** Generic polling-trigger surface. Pre-binds trigger id, emit, and registerCleanup. */
|
|
372
276
|
readonly polling: PollingTriggerHandle;
|
|
373
277
|
}
|
|
374
278
|
|
|
@@ -382,12 +286,6 @@ export interface TriggerTestItemsContext<
|
|
|
382
286
|
previousState: TSetupState;
|
|
383
287
|
}
|
|
384
288
|
|
|
385
|
-
/**
|
|
386
|
-
* Trigger setup state is intentionally engine-owned so future ownership and
|
|
387
|
-
* leader-election metadata can be coordinated centrally rather than pushed into
|
|
388
|
-
* package-level setup code.
|
|
389
|
-
*/
|
|
390
|
-
|
|
391
289
|
export interface PersistedTriggerSetupState<TState extends JsonValue | undefined = JsonValue | undefined> {
|
|
392
290
|
trigger: TriggerInstanceId;
|
|
393
291
|
updatedAt: string;
|
|
@@ -409,12 +307,6 @@ export interface EngineHost {
|
|
|
409
307
|
workflows?: WorkflowRunnerService;
|
|
410
308
|
}
|
|
411
309
|
|
|
412
|
-
/**
|
|
413
|
-
* Per-item runnable node: return JSON, an array to fan-out on `main`, an explicit `Item`, or {@link emitPorts}
|
|
414
|
-
* for multi-port emission. Engine applies `inputSchema.parse(item.json)` and passes the result as `args.input`
|
|
415
|
-
* (wire `item.json` is unchanged). Transform helpers may opt into binary preservation, while routers and
|
|
416
|
-
* pass-through nodes should return explicit items when they need to preserve full item state.
|
|
417
|
-
*/
|
|
418
310
|
export interface RunnableNodeExecuteArgs<
|
|
419
311
|
TConfig extends RunnableNodeConfig<any, any> = RunnableNodeConfig<any, any>,
|
|
420
312
|
TInputJson = unknown,
|
|
@@ -432,19 +324,11 @@ export interface RunnableNode<
|
|
|
432
324
|
_TOutputJson = unknown,
|
|
433
325
|
> {
|
|
434
326
|
readonly kind: "node";
|
|
435
|
-
/**
|
|
436
|
-
* Declared output ports (e.g. `["main"]`).
|
|
437
|
-
*
|
|
438
|
-
* Prefer describing dynamic router ports (Switch) and fixed multi-ports (If true/false)
|
|
439
|
-
* via {@link NodeConfigBase.declaredOutputPorts}. Engine defaults to `["main"]` when omitted.
|
|
440
|
-
*/
|
|
441
327
|
readonly outputPorts?: ReadonlyArray<OutputPortKey>;
|
|
442
|
-
/** When omitted, engine uses {@link RunnableNodeConfig.inputSchema} or `z.unknown()`. */
|
|
443
328
|
readonly inputSchema?: ZodType<TInputJson>;
|
|
444
329
|
execute(args: RunnableNodeExecuteArgs<TConfig, TInputJson>): Promise<unknown> | unknown;
|
|
445
330
|
}
|
|
446
331
|
|
|
447
|
-
/** @deprecated Use {@link RunnableNode} */
|
|
448
332
|
export type ItemNode<
|
|
449
333
|
TConfig extends RunnableNodeConfig<any, any> = RunnableNodeConfig<any, any>,
|
|
450
334
|
TInputJson = unknown,
|
|
@@ -453,12 +337,6 @@ export type ItemNode<
|
|
|
453
337
|
|
|
454
338
|
export interface MultiInputNode<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
455
339
|
kind: "node";
|
|
456
|
-
/**
|
|
457
|
-
* Declared output ports (typically `["main"]`).
|
|
458
|
-
*
|
|
459
|
-
* Prefer describing ports for authoring/canvas via {@link NodeConfigBase.declaredOutputPorts}.
|
|
460
|
-
* Engine defaults to `["main"]` when omitted.
|
|
461
|
-
*/
|
|
462
340
|
outputPorts?: ReadonlyArray<OutputPortKey>;
|
|
463
341
|
executeMulti(inputsByPort: NodeInputsByPort, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
|
|
464
342
|
}
|
|
@@ -582,7 +460,6 @@ export interface WorkflowSnapshotResolver {
|
|
|
582
460
|
}): WorkflowDefinition | undefined;
|
|
583
461
|
}
|
|
584
462
|
|
|
585
|
-
/** Optional host wiring for trigger lifecycle logs (boot skip + activation sync). */
|
|
586
463
|
export interface TriggerRuntimeDiagnostics {
|
|
587
464
|
info(message: string): void;
|
|
588
465
|
warn(message: string): void;
|
|
@@ -592,7 +469,6 @@ export interface EngineDeps {
|
|
|
592
469
|
credentialSessions: CredentialSessionService;
|
|
593
470
|
liveWorkflowRepository: LiveWorkflowRepository;
|
|
594
471
|
workflowRepository: WorkflowRepository;
|
|
595
|
-
/** When {@link AllWorkflowsActiveWorkflowActivationPolicy}, all workflows behave as active (tests). */
|
|
596
472
|
workflowActivationPolicy: WorkflowActivationPolicy;
|
|
597
473
|
nodeResolver: NodeResolver;
|
|
598
474
|
triggerSetupStateRepository: TriggerSetupStateRepository;
|
|
@@ -608,10 +484,7 @@ export interface EngineDeps {
|
|
|
608
484
|
eventBus?: RunEventBus;
|
|
609
485
|
tokenRegistry: PersistedWorkflowTokenRegistryLike;
|
|
610
486
|
workflowNodeInstanceFactory: WorkflowNodeInstanceFactory;
|
|
611
|
-
/** Defaults for prune/storage snapshot when workflow omits explicit policy fields. */
|
|
612
487
|
workflowPolicyRuntimeDefaults?: WorkflowPolicyRuntimeDefaults;
|
|
613
|
-
/** When set, logs inactive-workflow skips at boot and trigger start/stop on activation changes. */
|
|
614
488
|
triggerRuntimeDiagnostics?: TriggerRuntimeDiagnostics;
|
|
615
|
-
/** When set, the polling-trigger runtime uses this logger for cycle info/debug/error. */
|
|
616
489
|
pollingTriggerLogger?: import("../triggers/polling/PollingTriggerLogger").PollingTriggerLogger;
|
|
617
490
|
}
|
|
@@ -73,13 +73,6 @@ export interface TelemetrySpanScope extends TelemetryScope {
|
|
|
73
73
|
readonly traceId: string;
|
|
74
74
|
readonly spanId: string;
|
|
75
75
|
end(args?: TelemetrySpanEnd): Promise<void> | void;
|
|
76
|
-
/**
|
|
77
|
-
* Lift this span into a {@link NodeExecutionTelemetry} scoped to a different (nodeId, activationId).
|
|
78
|
-
* Children created via the returned telemetry's `startChildSpan` get this span as their parent.
|
|
79
|
-
*
|
|
80
|
-
* Used at the sub-agent boundary so that nested runtime telemetry parents under the agent.tool.call
|
|
81
|
-
* span instead of the orchestrator's node-level span.
|
|
82
|
-
*/
|
|
83
76
|
asNodeTelemetry(args: Readonly<{ nodeId: NodeId; activationId: NodeActivationId }>): NodeExecutionTelemetry;
|
|
84
77
|
}
|
|
85
78
|
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import type { Item, NodeId, WorkflowId } from "./workflowTypes";
|
|
2
2
|
import type { TriggerNodeConfig } from "./workflowTypes";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Identifier minted by the host (or in-memory test runner) for one execution of a test suite.
|
|
6
|
-
* One TestSuiteRun produces N child workflow runs, one per item yielded by `generateItems`.
|
|
7
|
-
*/
|
|
8
4
|
export type TestSuiteRunId = string;
|
|
9
5
|
|
|
10
|
-
/**
|
|
11
|
-
* Setup context passed to a {@link TestTriggerNodeConfig.generateItems} callback. Distinct from
|
|
12
|
-
* {@link import("./runtimeTypes").TriggerSetupContext} on purpose: test triggers are not
|
|
13
|
-
* activated by the live trigger lifecycle (webhooks, cron, polling) and never call `emit` —
|
|
14
|
-
* the orchestrator pulls from the iterable they return and dispatches one run per item.
|
|
15
|
-
*/
|
|
16
6
|
export interface TestTriggerSetupContext<
|
|
17
7
|
TConfig extends TestTriggerNodeConfig<unknown> = TestTriggerNodeConfig<unknown>,
|
|
18
8
|
> {
|
|
@@ -20,47 +10,14 @@ export interface TestTriggerSetupContext<
|
|
|
20
10
|
readonly nodeId: NodeId;
|
|
21
11
|
readonly config: TConfig;
|
|
22
12
|
readonly testSuiteRunId: TestSuiteRunId;
|
|
23
|
-
/**
|
|
24
|
-
* Resolves a credential session for a slot declared on this trigger's
|
|
25
|
-
* {@link import("./workflowTypes").NodeConfigBase.getCredentialRequirements}. Same contract as
|
|
26
|
-
* {@link import("./runtimeTypes").ExecutionContext.getCredential}.
|
|
27
|
-
*/
|
|
28
13
|
getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
|
|
29
|
-
/** AbortSignal raised when the suite is cancelled — long-running pulls should bail out. */
|
|
30
14
|
readonly signal: AbortSignal;
|
|
31
15
|
}
|
|
32
16
|
|
|
33
|
-
/**
|
|
34
|
-
* A trigger config that emits **test cases**. Each item yielded by {@link generateItems}
|
|
35
|
-
* becomes one workflow run (with `executionOptions.testContext` set), so 10 yielded items
|
|
36
|
-
* → 10 runs marked under the same TestSuiteRun.
|
|
37
|
-
*
|
|
38
|
-
* The trigger is otherwise a normal {@link TriggerNodeConfig} (so the canvas treats it like
|
|
39
|
-
* any other trigger), but its `triggerKind` is `"test"` so the live activation policy skips it.
|
|
40
|
-
*/
|
|
41
17
|
export interface TestTriggerNodeConfig<TOutputJson = unknown> extends TriggerNodeConfig<TOutputJson, undefined> {
|
|
42
18
|
readonly triggerKind: "test";
|
|
43
|
-
/**
|
|
44
|
-
* Author-supplied async iterable of items, evaluated lazily. Implementations may fetch from
|
|
45
|
-
* credentialed APIs, read fixture files, or yield hard-coded items. The orchestrator iterates
|
|
46
|
-
* and dispatches one run per item, with concurrency capped by {@link concurrency} (default 4).
|
|
47
|
-
*/
|
|
48
19
|
generateItems(ctx: TestTriggerSetupContext<TestTriggerNodeConfig<TOutputJson>>): AsyncIterable<Item<TOutputJson>>;
|
|
49
|
-
/** Per-suite-run cap on simultaneously-executing test cases. Default: 4. */
|
|
50
20
|
readonly concurrency?: number;
|
|
51
|
-
/**
|
|
52
|
-
* Free-form description of where the test cases come from — surfaced in the node properties
|
|
53
|
-
* panel and the suite-detail header so authors revisiting the workflow six months later
|
|
54
|
-
* remember which mailbox / folder / fixture file the cases originate from.
|
|
55
|
-
*
|
|
56
|
-
* Example: `"All emails in the Gmail label \"test/triage-fixtures\" — 14 messages as of 2026-05-03."`
|
|
57
|
-
*/
|
|
58
21
|
readonly description?: string;
|
|
59
|
-
/**
|
|
60
|
-
* Resolves a human-readable label for one yielded test case (e.g. email subject). The
|
|
61
|
-
* orchestrator calls this once per yielded item, persists the result on the run, and the
|
|
62
|
-
* Tests-tab UI uses it to render the case row instead of the opaque runId. Return
|
|
63
|
-
* `undefined` to fall back to "Case #N".
|
|
64
|
-
*/
|
|
65
22
|
caseLabel?(item: Item<TOutputJson>): string | undefined;
|
|
66
23
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Items, TriggerNodeConfig } from "./workflowTypes";
|
|
2
|
+
import type { TriggerInstanceId } from "./webhookTypes";
|
|
3
|
+
|
|
4
|
+
export interface TriggerInvoker {
|
|
5
|
+
invoke(trigger: TriggerInstanceId, config: TriggerNodeConfig, lastRanAt: string | undefined): Promise<Items>;
|
|
6
|
+
}
|
|
@@ -11,7 +11,6 @@ export interface WebhookControlSignal {
|
|
|
11
11
|
|
|
12
12
|
export interface WebhookTriggerRoutingDiagnostics {
|
|
13
13
|
warn(message: string): void;
|
|
14
|
-
/** Inactive workflows omitted from the webhook route index (optional; host should wire for clarity at boot/reload). */
|
|
15
14
|
info?(message: string): void;
|
|
16
15
|
}
|
|
17
16
|
|
|
@@ -20,9 +19,7 @@ export interface TriggerInstanceId {
|
|
|
20
19
|
nodeId: NodeId;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
/** Match for an incoming HTTP request: user-defined URL segment + workflow trigger node. */
|
|
24
22
|
export interface WebhookInvocationMatch {
|
|
25
|
-
/** Same value as the webhook trigger's configured endpoint key (URL segment under the webhook base path). */
|
|
26
23
|
endpointPath: string;
|
|
27
24
|
workflowId: WorkflowId;
|
|
28
25
|
nodeId: NodeId;
|
|
@@ -30,20 +27,15 @@ export interface WebhookInvocationMatch {
|
|
|
30
27
|
parseJsonBody?: (body: unknown) => unknown;
|
|
31
28
|
}
|
|
32
29
|
|
|
33
|
-
/** Result of resolving an HTTP method + endpoint path against the catalog webhook index (404 vs 405 vs match). */
|
|
34
30
|
export type WebhookTriggerResolution =
|
|
35
31
|
| { status: "notFound" }
|
|
36
32
|
| { status: "methodNotAllowed"; match: WebhookInvocationMatch }
|
|
37
33
|
| { status: "ok"; match: WebhookInvocationMatch };
|
|
38
34
|
|
|
39
|
-
/**
|
|
40
|
-
* Resolves webhook routes from workflow definitions (catalog-backed index, no registration at trigger setup).
|
|
41
|
-
*/
|
|
42
35
|
export interface WebhookTriggerMatcher {
|
|
43
36
|
match(args: { endpointPath: string; method: HttpMethod }): WebhookInvocationMatch | undefined;
|
|
44
37
|
lookup(endpointPath: string): WebhookInvocationMatch | undefined;
|
|
45
38
|
onEngineWorkflowsLoaded?(): void;
|
|
46
39
|
onEngineStopped?(): void;
|
|
47
|
-
/** Rebuild route index after activation changes without stopping the engine. */
|
|
48
40
|
reloadWebhookRoutes?(): void;
|
|
49
41
|
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import type { WorkflowId } from "./workflowTypes";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Host-controlled policy: when false, trigger {@link TriggerNode} setup is skipped and webhook routes
|
|
5
|
-
* for that workflow are not registered (see engine trigger runtime + webhook matcher).
|
|
6
|
-
*/
|
|
7
3
|
export interface WorkflowActivationPolicy {
|
|
8
4
|
isActive(workflowId: WorkflowId): boolean;
|
|
9
5
|
}
|
|
10
6
|
|
|
11
|
-
/** Default for tests and harnesses: every workflow is treated as active (legacy behavior). */
|
|
12
7
|
export class AllWorkflowsActiveWorkflowActivationPolicy implements WorkflowActivationPolicy {
|
|
13
8
|
isActive(_workflowId: WorkflowId): boolean {
|
|
14
9
|
return true;
|
|
@@ -23,7 +23,6 @@ export interface JsonObject {
|
|
|
23
23
|
}
|
|
24
24
|
export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
25
25
|
export type JsonArray = ReadonlyArray<JsonValue>;
|
|
26
|
-
/** JSON value that is not a top-level array (nested arrays inside objects are allowed). */
|
|
27
26
|
export type JsonNonArray = JsonPrimitive | JsonObject;
|
|
28
27
|
|
|
29
28
|
export interface Edge {
|
|
@@ -31,11 +30,6 @@ export interface Edge {
|
|
|
31
30
|
to: { nodeId: NodeId; input: InputPortKey };
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
/**
|
|
35
|
-
* Named connection from a parent node to child nodes that exist in {@link WorkflowDefinition.nodes}
|
|
36
|
-
* but are not traversed by the main execution graph. Parents are commonly executable nodes, but may
|
|
37
|
-
* also be connection-owned nodes for recursive agent attachments.
|
|
38
|
-
*/
|
|
39
33
|
export interface WorkflowNodeConnection {
|
|
40
34
|
readonly parentNodeId: NodeId;
|
|
41
35
|
readonly connectionName: NodeConnectionName;
|
|
@@ -47,18 +41,10 @@ export interface WorkflowDefinition {
|
|
|
47
41
|
name: string;
|
|
48
42
|
nodes: NodeDefinition[];
|
|
49
43
|
edges: Edge[];
|
|
50
|
-
/**
|
|
51
|
-
* Optional metadata: which nodes are connection-owned children (e.g. AI agent `llm` / `tools` slots).
|
|
52
|
-
* When omitted, all nodes in {@link nodes} are treated as executable for topology.
|
|
53
|
-
*/
|
|
54
44
|
readonly connections?: ReadonlyArray<WorkflowNodeConnection>;
|
|
55
|
-
/** Directory + file-stem path under a workflow discovery root (for UI grouping only). */
|
|
56
45
|
discoveryPathSegments?: readonly string[];
|
|
57
|
-
/** Retention for run JSON and binaries (seconds). Host/env may supply defaults when omitted. */
|
|
58
46
|
readonly prunePolicy?: WorkflowPrunePolicySpec;
|
|
59
|
-
/** Whether to keep run data after completion. Host/env may supply defaults when omitted. */
|
|
60
47
|
readonly storagePolicy?: WorkflowStoragePolicySpec;
|
|
61
|
-
/** Invoked after a node fails permanently (retries exhausted) and node error handler did not recover. */
|
|
62
48
|
readonly workflowErrorHandler?: WorkflowErrorHandlerSpec;
|
|
63
49
|
}
|
|
64
50
|
|
|
@@ -76,57 +62,22 @@ export interface NodeConfigBase {
|
|
|
76
62
|
readonly name?: string;
|
|
77
63
|
readonly id?: NodeId;
|
|
78
64
|
readonly icon?: string;
|
|
79
|
-
/**
|
|
80
|
-
* Plain-language, non-technical explanation of what this node does, surfaced in the workflow
|
|
81
|
-
* inspector / node properties sidebar. A first-class config option every authorable node accepts
|
|
82
|
-
* directly (alongside `id`), so it flows into the persisted config the mappers read. Distinct from
|
|
83
|
-
* {@link inspectorSummary} (config-derived label/value rows).
|
|
84
|
-
*/
|
|
85
65
|
readonly description?: string;
|
|
86
66
|
readonly execution?: Readonly<{ hint?: "local" | "worker"; queue?: string }>;
|
|
87
|
-
/** In-process execute retries (runnable nodes). Triggers typically omit this. */
|
|
88
67
|
readonly retryPolicy?: RetryPolicySpec;
|
|
89
|
-
/** Recover from execute failures; return outputs to continue, or rethrow to fail the node. */
|
|
90
68
|
readonly nodeErrorHandler?: NodeErrorHandlerSpec;
|
|
91
|
-
/**
|
|
92
|
-
* When true, edges carrying zero items on an output port still schedule single-input downstream nodes.
|
|
93
|
-
* Decided from the **source** node that produced the (empty) output. Default (false/undefined): empty
|
|
94
|
-
* main batches skip downstream execution and propagate the empty path.
|
|
95
|
-
*/
|
|
96
69
|
readonly continueWhenEmptyOutput?: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Declared I/O port names for canvas authoring (unioned with ports inferred from edges).
|
|
99
|
-
* Use for dynamic routers (Switch) and future error ports.
|
|
100
|
-
*/
|
|
101
70
|
readonly declaredOutputPorts?: ReadonlyArray<OutputPortKey>;
|
|
102
71
|
readonly declaredInputPorts?: ReadonlyArray<InputPortKey>;
|
|
103
72
|
getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
|
|
104
|
-
/**
|
|
105
|
-
* Marker: this node emits {@link import("./assertionTypes").AssertionResult}-shaped items on its
|
|
106
|
-
* `main` port. The TestSuiteOrchestrator (and host-side TestAssertionPersister) listen for
|
|
107
|
-
* `nodeCompleted` events from nodes with this flag set, and persist their output items as
|
|
108
|
-
* TestAssertion records (only when the run carries a `testContext`). Set on assertion node
|
|
109
|
-
* configs (e.g. `AssertionNodeConfig`, `StringEqualsAssertionNodeConfig`).
|
|
110
|
-
*/
|
|
111
73
|
readonly emitsAssertions?: true;
|
|
112
|
-
/**
|
|
113
|
-
* Static configuration summary surfaced in the workflow inspector — the design-time
|
|
114
|
-
* "what does this node do" panel that renders before any run telemetry exists.
|
|
115
|
-
*
|
|
116
|
-
* Return 2–6 short label/value pairs derived from this config (method + url for an HTTP
|
|
117
|
-
* call, model + tool list for an agent, schedule + timezone for a cron trigger, etc.).
|
|
118
|
-
* Values are truncated by the UI; aim for one line each. Return `undefined` to opt out
|
|
119
|
-
* — the inspector hides the section when no rows are produced.
|
|
120
|
-
*
|
|
121
|
-
* Implement on the config class instance so the function can read sibling config fields.
|
|
122
|
-
* `defineNode({ inspectorSummary })` plumbs through to this.
|
|
123
|
-
*/
|
|
124
74
|
inspectorSummary?(): ReadonlyArray<NodeInspectorSummaryRow> | undefined;
|
|
125
75
|
}
|
|
126
76
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
77
|
+
export interface PollingTriggerConfig {
|
|
78
|
+
getTriggerPollConfig(): Readonly<{ config: JsonObject; pollIntervalMs?: number }>;
|
|
79
|
+
}
|
|
80
|
+
|
|
130
81
|
export interface NodeInspectorSummaryRow {
|
|
131
82
|
readonly label: string;
|
|
132
83
|
readonly value: string;
|
|
@@ -136,24 +87,11 @@ export declare const runnableNodeInputType: unique symbol;
|
|
|
136
87
|
export declare const runnableNodeOutputType: unique symbol;
|
|
137
88
|
export declare const triggerNodeOutputType: unique symbol;
|
|
138
89
|
|
|
139
|
-
/**
|
|
140
|
-
* Runnable node: **`TInputJson`** is what **`inputSchema`** validates on **`item.json`** (the wire payload).
|
|
141
|
-
* **`TOutputJson`** is emitted `item.json` on outputs.
|
|
142
|
-
*/
|
|
143
90
|
export interface RunnableNodeConfig<TInputJson = unknown, TOutputJson = unknown> extends NodeConfigBase {
|
|
144
91
|
readonly kind: "node";
|
|
145
92
|
readonly [runnableNodeInputType]?: TInputJson;
|
|
146
93
|
readonly [runnableNodeOutputType]?: TOutputJson;
|
|
147
|
-
/**
|
|
148
|
-
* Optional Zod input contract for {@link RunnableNode} when not set on the node class.
|
|
149
|
-
* Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
|
|
150
|
-
*/
|
|
151
94
|
readonly inputSchema?: ZodType<TInputJson>;
|
|
152
|
-
/**
|
|
153
|
-
* When an activation receives **zero** input items, the engine normally runs `execute` zero times.
|
|
154
|
-
* Set to **`runOnce`** to run `execute` once with an empty `items` batch (and a synthetic wire item for schema parsing).
|
|
155
|
-
* Used by batch-style callback nodes (built-in `Callback`) so `callback([], ctx)` still runs.
|
|
156
|
-
*/
|
|
157
95
|
readonly emptyBatchExecution?: "skip" | "runOnce";
|
|
158
96
|
}
|
|
159
97
|
|
|
@@ -166,11 +104,6 @@ export interface TriggerNodeConfig<
|
|
|
166
104
|
readonly kind: "trigger";
|
|
167
105
|
readonly [triggerNodeOutputType]?: TOutputJson;
|
|
168
106
|
readonly [triggerNodeSetupStateType]?: TSetupState;
|
|
169
|
-
/**
|
|
170
|
-
* Distinguishes triggers driven by the live activation policy (webhooks, cron, polling) from
|
|
171
|
-
* triggers driven only by the {@link TestSuiteOrchestrator}. `WorkflowActivation` skips
|
|
172
|
-
* `"test"` triggers; the orchestrator skips `"live"` triggers. Defaults to `"live"` when omitted.
|
|
173
|
-
*/
|
|
174
107
|
readonly triggerKind?: "live" | "test";
|
|
175
108
|
}
|
|
176
109
|
|
|
@@ -239,28 +172,15 @@ export type NodeOutputs = Partial<Record<OutputPortKey, Items>>;
|
|
|
239
172
|
|
|
240
173
|
export type RunId = string;
|
|
241
174
|
export type NodeActivationId = string;
|
|
242
|
-
/**
|
|
243
|
-
* One per-item iteration of a runnable node's execute loop. Refines `NodeActivationId` for
|
|
244
|
-
* per-item connection invocations and telemetry. Undefined when the executing node is a batch
|
|
245
|
-
* node or trigger that does not iterate items.
|
|
246
|
-
*/
|
|
247
175
|
export type NodeIterationId = string;
|
|
248
176
|
|
|
249
177
|
export interface ParentExecutionRef {
|
|
250
178
|
runId: RunId;
|
|
251
179
|
workflowId: WorkflowId;
|
|
252
180
|
nodeId: NodeId;
|
|
253
|
-
/** Subworkflow depth of the **spawning** run (0 = root). Passed when starting a child run. */
|
|
254
181
|
subworkflowDepth?: number;
|
|
255
|
-
/** Effective max node activations from the parent run (propagated to child policy merge). */
|
|
256
182
|
engineMaxNodeActivations?: number;
|
|
257
|
-
/** Effective max subworkflow depth from the parent run (propagated to child policy merge). */
|
|
258
183
|
engineMaxSubworkflowDepth?: number;
|
|
259
|
-
/**
|
|
260
|
-
* Test-suite linkage inherited by the child subworkflow run. Set by whichever node
|
|
261
|
-
* spawns the subworkflow when its own `ctx.testContext` is present, so assertions
|
|
262
|
-
* emitted inside a subworkflow land under the correct parent test case.
|
|
263
|
-
*/
|
|
264
184
|
testContext?: import("./runTypes").RunTestContext;
|
|
265
185
|
}
|
|
266
186
|
|
|
@@ -305,7 +225,6 @@ export interface NodeOffloadPolicy {
|
|
|
305
225
|
decide(args: { workflowId: WorkflowId; nodeId: NodeId; config: NodeConfigBase }): NodeSchedulerDecision;
|
|
306
226
|
}
|
|
307
227
|
|
|
308
|
-
/** Whether to persist run execution data after the workflow finishes. */
|
|
309
228
|
export type WorkflowStoragePolicyMode = "ALL" | "SUCCESS" | "ERROR" | "NEVER";
|
|
310
229
|
|
|
311
230
|
export type WorkflowStoragePolicySpec = WorkflowStoragePolicyMode | TypeToken<WorkflowStoragePolicyResolver>;
|
|
@@ -370,7 +289,6 @@ export interface NodeErrorHandler {
|
|
|
370
289
|
|
|
371
290
|
export type NodeErrorHandlerSpec = TypeToken<NodeErrorHandler> | NodeErrorHandler;
|
|
372
291
|
|
|
373
|
-
/** Runtime defaults when workflow omits prune/storage fields (typically from host env). */
|
|
374
292
|
export interface WorkflowPolicyRuntimeDefaults {
|
|
375
293
|
readonly retentionSeconds?: number;
|
|
376
294
|
readonly binaryRetentionSeconds?: number;
|