@codemation/core-nodes 1.0.2 → 1.1.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 +108 -0
- package/dist/index.cjs +2851 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1556 -684
- package/dist/index.d.ts +1556 -684
- package/dist/index.js +2796 -49
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
- package/src/authoring/defineRestNode.types.ts +204 -0
- package/src/credentials/ApiKeyCredentialType.ts +60 -0
- package/src/credentials/BasicAuthCredentialType.ts +51 -0
- package/src/credentials/BearerTokenCredentialType.ts +40 -0
- package/src/credentials/OAuth2ClientCredentialsTypeFactory.ts +117 -0
- package/src/credentials/OAuth2TokenExchangeFactory.ts +52 -0
- package/src/credentials/index.ts +4 -0
- package/src/http/HttpBodyBuilder.ts +90 -0
- package/src/http/HttpRequestExecutor.ts +150 -0
- package/src/http/HttpUrlBuilder.ts +22 -0
- package/src/http/httpRequest.types.ts +69 -0
- package/src/index.ts +9 -0
- package/src/nodes/AssertionNode.ts +42 -0
- package/src/nodes/CronTriggerFactory.ts +45 -0
- package/src/nodes/CronTriggerNode.ts +40 -0
- package/src/nodes/HttpRequestNodeFactory.ts +99 -23
- package/src/nodes/IsTestRunNode.ts +25 -0
- package/src/nodes/TestTriggerNode.ts +33 -0
- package/src/nodes/assertion.ts +42 -0
- package/src/nodes/collections/collectionDeleteNode.types.ts +23 -0
- package/src/nodes/collections/collectionFindOneNode.types.ts +26 -0
- package/src/nodes/collections/collectionGetNode.types.ts +26 -0
- package/src/nodes/collections/collectionInsertNode.types.ts +22 -0
- package/src/nodes/collections/collectionListNode.types.ts +30 -0
- package/src/nodes/collections/collectionUpdateNode.types.ts +23 -0
- package/src/nodes/collections/index.ts +6 -0
- package/src/nodes/httpRequest.ts +61 -1
- package/src/nodes/isTestRun.ts +24 -0
- package/src/nodes/testTrigger.ts +72 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ReadableStream } from "node:stream/web";
|
|
2
|
-
import { DependencyContainer as Container, InjectionToken as TypeToken } from "tsyringe";
|
|
3
2
|
import { ZodType, input, output, z } from "zod";
|
|
3
|
+
import { DependencyContainer as Container, InjectionToken as TypeToken } from "tsyringe";
|
|
4
4
|
import { AssistantModelMessage, ModelMessage, ToolModelMessage } from "ai";
|
|
5
|
+
import { Cron, CronCallback } from "croner";
|
|
5
6
|
|
|
6
7
|
//#region src/canvasIconName.d.ts
|
|
7
|
-
|
|
8
8
|
/**
|
|
9
9
|
* Canvas / agent presentation:
|
|
10
10
|
* - Lucide: `lucide:<kebab-name>` or legacy kebab name
|
|
@@ -14,8 +14,216 @@ import { AssistantModelMessage, ModelMessage, ToolModelMessage } from "ai";
|
|
|
14
14
|
*/
|
|
15
15
|
type CanvasIconName = string;
|
|
16
16
|
//#endregion
|
|
17
|
+
//#region ../core/src/contracts/baseTypes.d.ts
|
|
18
|
+
/**
|
|
19
|
+
* Minimal base types that have no dependencies on other contracts.
|
|
20
|
+
* Used by credentialTypes, workflowTypes, and other contract layers
|
|
21
|
+
* to avoid circular dependencies.
|
|
22
|
+
*/
|
|
23
|
+
type WorkflowId = string;
|
|
24
|
+
type NodeId = string;
|
|
25
|
+
type OutputPortKey = string;
|
|
26
|
+
type InputPortKey = string;
|
|
27
|
+
type NodeConnectionName = string;
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region ../core/src/contracts/credentialTypes.d.ts
|
|
30
|
+
type CredentialTypeId = string;
|
|
31
|
+
type CredentialInstanceId = string;
|
|
32
|
+
type CredentialMaterialSourceKind = "db" | "env" | "code";
|
|
33
|
+
type CredentialSetupStatus = "draft" | "ready";
|
|
34
|
+
type CredentialHealthStatus = "unknown" | "healthy" | "failing";
|
|
35
|
+
type CredentialFieldSchema = Readonly<{
|
|
36
|
+
key: string;
|
|
37
|
+
label: string;
|
|
38
|
+
type: "string" | "password" | "textarea" | "json" | "boolean";
|
|
39
|
+
required?: true;
|
|
40
|
+
order?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Where this field appears in the credential dialog. Use `"advanced"` for optional or
|
|
43
|
+
* power-user fields; they render inside a collapsible section (see `CredentialTypeDefinition.advancedSection`).
|
|
44
|
+
* Defaults to `"default"` when omitted.
|
|
45
|
+
*/
|
|
46
|
+
visibility?: "default" | "advanced";
|
|
47
|
+
placeholder?: string;
|
|
48
|
+
helpText?: string;
|
|
49
|
+
/** When set, host resolves this field from process.env at runtime; env wins over stored values. */
|
|
50
|
+
envVarName?: string;
|
|
51
|
+
/**
|
|
52
|
+
* When set, the dialog shows a copy action for this exact string (e.g. a static OAuth redirect URI
|
|
53
|
+
* pattern or documentation URL). Do not use for secret values.
|
|
54
|
+
*/
|
|
55
|
+
copyValue?: string;
|
|
56
|
+
/** Accessible label for the copy control (default: Copy). */
|
|
57
|
+
copyButtonLabel?: string;
|
|
58
|
+
}>;
|
|
59
|
+
type CredentialRequirement = Readonly<{
|
|
60
|
+
slotKey: string;
|
|
61
|
+
label: string;
|
|
62
|
+
acceptedTypes: ReadonlyArray<CredentialTypeId>;
|
|
63
|
+
optional?: true;
|
|
64
|
+
helpText?: string;
|
|
65
|
+
helpUrl?: string;
|
|
66
|
+
}>;
|
|
67
|
+
type CredentialHealth = Readonly<{
|
|
68
|
+
status: CredentialHealthStatus;
|
|
69
|
+
message?: string;
|
|
70
|
+
testedAt?: string;
|
|
71
|
+
expiresAt?: string;
|
|
72
|
+
details?: Readonly<Record<string, unknown>>;
|
|
73
|
+
}>;
|
|
74
|
+
type OAuth2ProviderFromPublicConfig = Readonly<{
|
|
75
|
+
authorizeUrlFieldKey: string;
|
|
76
|
+
tokenUrlFieldKey: string;
|
|
77
|
+
userInfoUrlFieldKey?: string;
|
|
78
|
+
}>;
|
|
79
|
+
type CredentialOAuth2ScopesFromPublicConfig = Readonly<{
|
|
80
|
+
presetFieldKey: string;
|
|
81
|
+
presetScopes: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
82
|
+
customPresetKey?: string;
|
|
83
|
+
customScopesFieldKey?: string;
|
|
84
|
+
}>;
|
|
85
|
+
type CredentialOAuth2AuthDefinition = Readonly<{
|
|
86
|
+
kind: "oauth2";
|
|
87
|
+
providerId: string;
|
|
88
|
+
scopes: ReadonlyArray<string>;
|
|
89
|
+
scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig;
|
|
90
|
+
clientIdFieldKey?: string;
|
|
91
|
+
clientSecretFieldKey?: string;
|
|
92
|
+
} | {
|
|
93
|
+
kind: "oauth2";
|
|
94
|
+
providerFromPublicConfig: OAuth2ProviderFromPublicConfig;
|
|
95
|
+
scopes: ReadonlyArray<string>;
|
|
96
|
+
scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig;
|
|
97
|
+
clientIdFieldKey?: string;
|
|
98
|
+
clientSecretFieldKey?: string;
|
|
99
|
+
} | {
|
|
100
|
+
kind: "oauth2";
|
|
101
|
+
/**
|
|
102
|
+
* Free-form provider identifier for telemetry, DB rows, and Better Auth provider naming.
|
|
103
|
+
* Not used for any registry lookup — URLs come from {@link authorizeUrl} / {@link tokenUrl}.
|
|
104
|
+
*/
|
|
105
|
+
providerId: string;
|
|
106
|
+
/**
|
|
107
|
+
* Authorization endpoint. May contain `{publicFieldKey}` placeholders that the runtime
|
|
108
|
+
* substitutes from the credential's resolved public config (URL-encoded).
|
|
109
|
+
* Example: `https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/authorize`
|
|
110
|
+
*/
|
|
111
|
+
authorizeUrl: string;
|
|
112
|
+
/** Token endpoint. Same templating rules as {@link authorizeUrl}. */
|
|
113
|
+
tokenUrl: string;
|
|
114
|
+
/** Optional userinfo endpoint. Same templating rules as {@link authorizeUrl}. */
|
|
115
|
+
userInfoUrl?: string;
|
|
116
|
+
scopes: ReadonlyArray<string>;
|
|
117
|
+
scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig;
|
|
118
|
+
clientIdFieldKey?: string;
|
|
119
|
+
clientSecretFieldKey?: string;
|
|
120
|
+
}>;
|
|
121
|
+
type CredentialAuthDefinition = CredentialOAuth2AuthDefinition;
|
|
122
|
+
type CredentialAdvancedSectionPresentation = Readonly<{
|
|
123
|
+
/** Collapsible section title (default: "Advanced"). */
|
|
124
|
+
title?: string;
|
|
125
|
+
/** Optional short helper text shown inside the section (above the fields). */
|
|
126
|
+
description?: string;
|
|
127
|
+
/** When true, the advanced section starts expanded. Default: false (collapsed). */
|
|
128
|
+
defaultOpen?: boolean;
|
|
129
|
+
}>;
|
|
130
|
+
type CredentialTypeDefinition = Readonly<{
|
|
131
|
+
typeId: CredentialTypeId;
|
|
132
|
+
displayName: string;
|
|
133
|
+
description?: string;
|
|
134
|
+
publicFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
135
|
+
secretFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
136
|
+
/**
|
|
137
|
+
* Optional labels for the collapsible block that contains every field with `visibility: "advanced"`.
|
|
138
|
+
* If omitted, the UI still shows that block with defaults (title "Advanced", collapsed).
|
|
139
|
+
*/
|
|
140
|
+
advancedSection?: CredentialAdvancedSectionPresentation;
|
|
141
|
+
supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
|
|
142
|
+
auth?: CredentialAuthDefinition;
|
|
143
|
+
}>;
|
|
144
|
+
/**
|
|
145
|
+
* JSON-shaped credential field bag (public config, resolved secret material, etc.).
|
|
146
|
+
*/
|
|
147
|
+
type CredentialJsonRecord = Readonly<Record<string, unknown>>;
|
|
148
|
+
/**
|
|
149
|
+
* Persisted credential instance with typed `publicConfig`.
|
|
150
|
+
* Hosts may specialize `secretRef` with a stricter union while remaining
|
|
151
|
+
* assignable here for session/test callbacks.
|
|
152
|
+
*/
|
|
153
|
+
type CredentialInstanceRecord<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
|
|
154
|
+
instanceId: CredentialInstanceId;
|
|
155
|
+
typeId: CredentialTypeId;
|
|
156
|
+
displayName: string;
|
|
157
|
+
sourceKind: CredentialMaterialSourceKind;
|
|
158
|
+
publicConfig: TPublicConfig;
|
|
159
|
+
secretRef: CredentialJsonRecord;
|
|
160
|
+
tags: ReadonlyArray<string>;
|
|
161
|
+
setupStatus: CredentialSetupStatus;
|
|
162
|
+
createdAt: string;
|
|
163
|
+
updatedAt: string;
|
|
164
|
+
}>;
|
|
165
|
+
/**
|
|
166
|
+
* Arguments passed to `CredentialType.createSession` and `CredentialType.test`.
|
|
167
|
+
* Declare `TPublicConfig` / `TMaterial` on `CredentialType` so implementations are checked
|
|
168
|
+
* against your credential shapes (similar to `NodeExecutionContext.config` for nodes).
|
|
169
|
+
*/
|
|
170
|
+
type CredentialSessionFactoryArgs<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
|
|
171
|
+
instance: CredentialInstanceRecord<TPublicConfig>;
|
|
172
|
+
material: TMaterial;
|
|
173
|
+
publicConfig: TPublicConfig;
|
|
174
|
+
}>;
|
|
175
|
+
type CredentialSessionFactory<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord, TSession = unknown> = (args: CredentialSessionFactoryArgs<TPublicConfig, TMaterial>) => Promise<TSession>;
|
|
176
|
+
type CredentialHealthTester<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord> = (args: CredentialSessionFactoryArgs<TPublicConfig, TMaterial>) => Promise<CredentialHealth>;
|
|
177
|
+
/**
|
|
178
|
+
* Full credential type implementation: `definition` (UI/schema), `createSession`, and `test`.
|
|
179
|
+
* Use this at registration and config boundaries; `CredentialTypeDefinition` is only the schema slice.
|
|
180
|
+
*/
|
|
181
|
+
type CredentialType<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord, TSession = unknown> = Readonly<{
|
|
182
|
+
definition: CredentialTypeDefinition;
|
|
183
|
+
createSession: CredentialSessionFactory<TPublicConfig, TMaterial, TSession>;
|
|
184
|
+
test: CredentialHealthTester<TPublicConfig, TMaterial>;
|
|
185
|
+
}>;
|
|
186
|
+
/**
|
|
187
|
+
* Credential type with unspecified generics — used for `CodemationConfig.credentialTypes`, the host registry,
|
|
188
|
+
* and anywhere a concrete `CredentialType<YourPublic, YourMaterial, YourSession>` is placed in a heterogeneous list.
|
|
189
|
+
* Using `any` here avoids unsafe `as` casts while keeping typed `satisfies CredentialType<…>` definitions.
|
|
190
|
+
*/
|
|
191
|
+
type AnyCredentialType = CredentialType<any, any, unknown>;
|
|
192
|
+
interface CredentialSessionService {
|
|
193
|
+
getSession<TSession = unknown>(args: Readonly<{
|
|
194
|
+
workflowId: WorkflowId;
|
|
195
|
+
nodeId: NodeId;
|
|
196
|
+
slotKey: string;
|
|
197
|
+
}>): Promise<TSession>;
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region ../core/src/triggers/polling/PollingTriggerDedupWindow.d.ts
|
|
201
|
+
/**
|
|
202
|
+
* Merges processed-ID windows for polling triggers, capping the total to avoid unbounded growth.
|
|
203
|
+
* Plugin code receives an instance of this class via {@link PollingTriggerHandle.dedup}.
|
|
204
|
+
*/
|
|
205
|
+
declare class PollingTriggerDedupWindow {
|
|
206
|
+
static readonly defaultCapN = 2000;
|
|
207
|
+
merge(previous: ReadonlyArray<string>, incoming: ReadonlyArray<string>, capN?: number): ReadonlyArray<string>;
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
17
210
|
//#region ../core/src/contracts/runTypes.d.ts
|
|
18
|
-
|
|
211
|
+
/**
|
|
212
|
+
* Test-suite linkage for a run. When set, this run was started by a TestSuiteOrchestrator
|
|
213
|
+
* as one test case inside a TestSuiteRun. The `IsTestRun` node and host-side persisters key
|
|
214
|
+
* off the presence of this field. Subworkflow runs inherit it from their parent run.
|
|
215
|
+
*/
|
|
216
|
+
interface RunTestContext {
|
|
217
|
+
readonly testSuiteRunId: string;
|
|
218
|
+
readonly testCaseIndex: number;
|
|
219
|
+
/**
|
|
220
|
+
* Optional human-friendly label for this test case (e.g. an email subject when fixtures
|
|
221
|
+
* are loaded from a mailbox). Resolved per item by `TestTrigger.caseLabel(item)` if set,
|
|
222
|
+
* persisted on `Run.test_case_label` so the Tests-tab tree-table can show "RFQ for batch 14"
|
|
223
|
+
* instead of "run_1777755971399_bbb86beac1396".
|
|
224
|
+
*/
|
|
225
|
+
readonly testCaseLabel?: string;
|
|
226
|
+
}
|
|
19
227
|
type NodeInputsByPort = Readonly<Record<InputPortKey, Items>>;
|
|
20
228
|
type NodeExecutionStatus = "pending" | "queued" | "running" | "completed" | "failed" | "skipped";
|
|
21
229
|
interface NodeExecutionError {
|
|
@@ -77,42 +285,6 @@ type RunResult = {
|
|
|
77
285
|
};
|
|
78
286
|
};
|
|
79
287
|
//#endregion
|
|
80
|
-
//#region ../core/src/contracts/emitPorts.d.ts
|
|
81
|
-
declare const EMIT_PORTS_BRAND: unique symbol;
|
|
82
|
-
type PortsEmission = Readonly<{
|
|
83
|
-
readonly [EMIT_PORTS_BRAND]: true;
|
|
84
|
-
readonly ports: Readonly<Partial<Record<OutputPortKey, Items | ReadonlyArray<JsonNonArray>>>>;
|
|
85
|
-
}>;
|
|
86
|
-
//#endregion
|
|
87
|
-
//#region ../core/src/contracts/itemExpr.d.ts
|
|
88
|
-
declare const ITEM_EXPR_BRAND: unique symbol;
|
|
89
|
-
type ItemExprResolvedContext = Readonly<{
|
|
90
|
-
runId: RunId;
|
|
91
|
-
workflowId: WorkflowId;
|
|
92
|
-
nodeId: NodeId;
|
|
93
|
-
activationId: NodeActivationId;
|
|
94
|
-
data: RunDataSnapshot;
|
|
95
|
-
}>;
|
|
96
|
-
/**
|
|
97
|
-
* Context aligned with former {@link ItemInputMapperContext} — use **`data`** to read any completed upstream node.
|
|
98
|
-
*/
|
|
99
|
-
type ItemExprContext = ItemExprResolvedContext;
|
|
100
|
-
type ItemExprArgs<TItemJson = unknown> = Readonly<{
|
|
101
|
-
item: Item<TItemJson>;
|
|
102
|
-
itemIndex: number;
|
|
103
|
-
items: Items<TItemJson>;
|
|
104
|
-
ctx: ItemExprContext;
|
|
105
|
-
}>;
|
|
106
|
-
type ItemExprCallback<T, TItemJson = unknown> = (args: ItemExprArgs<TItemJson>) => T | Promise<T>;
|
|
107
|
-
type ItemExpr<T, TItemJson = unknown> = Readonly<{
|
|
108
|
-
readonly [ITEM_EXPR_BRAND]: true;
|
|
109
|
-
readonly fn: ItemExprCallback<T, TItemJson>;
|
|
110
|
-
}>;
|
|
111
|
-
//#endregion
|
|
112
|
-
//#region ../core/src/contracts/params.d.ts
|
|
113
|
-
type Expr<T, TItemJson = unknown> = ItemExpr<T, TItemJson>;
|
|
114
|
-
type ParamDeep<T, TItemJson = unknown> = Expr<T, TItemJson> | (T extends readonly (infer U)[] ? ReadonlyArray<ParamDeep<U, TItemJson>> : never) | (T extends object ? { [K in keyof T]: ParamDeep<T[K], TItemJson> } : T);
|
|
115
|
-
//#endregion
|
|
116
288
|
//#region ../core/src/contracts/retryPolicySpec.types.d.ts
|
|
117
289
|
/**
|
|
118
290
|
* In-process retry policy for runnable nodes. Serialized configs use the same
|
|
@@ -141,727 +313,813 @@ interface ExponentialRetryPolicySpec {
|
|
|
141
313
|
readonly jitter?: boolean;
|
|
142
314
|
}
|
|
143
315
|
//#endregion
|
|
144
|
-
//#region ../core/src/contracts/
|
|
145
|
-
type
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
readonly
|
|
152
|
-
readonly unit?: string;
|
|
153
|
-
readonly attributes?: TelemetryAttributes;
|
|
316
|
+
//#region ../core/src/contracts/workflowTypes.d.ts
|
|
317
|
+
type NodeIdRef<TJson = unknown> = NodeId & Readonly<{
|
|
318
|
+
__codemationNodeJson?: TJson;
|
|
319
|
+
}>;
|
|
320
|
+
type NodeKind = "trigger" | "node";
|
|
321
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
322
|
+
interface JsonObject {
|
|
323
|
+
readonly [key: string]: JsonValue;
|
|
154
324
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
325
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
326
|
+
type JsonArray = ReadonlyArray<JsonValue>;
|
|
327
|
+
/** JSON value that is not a top-level array (nested arrays inside objects are allowed). */
|
|
328
|
+
type JsonNonArray = JsonPrimitive | JsonObject;
|
|
329
|
+
interface Edge {
|
|
330
|
+
from: {
|
|
331
|
+
nodeId: NodeId;
|
|
332
|
+
output: OutputPortKey;
|
|
333
|
+
};
|
|
334
|
+
to: {
|
|
335
|
+
nodeId: NodeId;
|
|
336
|
+
input: InputPortKey;
|
|
337
|
+
};
|
|
159
338
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
readonly
|
|
167
|
-
readonly
|
|
168
|
-
readonly
|
|
169
|
-
readonly expiresAt?: Date;
|
|
170
|
-
}
|
|
171
|
-
interface TelemetryArtifactReference {
|
|
172
|
-
readonly artifactId: string;
|
|
173
|
-
readonly traceId?: string;
|
|
174
|
-
readonly spanId?: string;
|
|
175
|
-
}
|
|
176
|
-
interface TelemetrySpanEnd {
|
|
177
|
-
readonly status?: "ok" | "error";
|
|
178
|
-
readonly statusMessage?: string;
|
|
179
|
-
readonly endedAt?: Date;
|
|
180
|
-
readonly attributes?: TelemetryAttributes;
|
|
181
|
-
}
|
|
182
|
-
interface TelemetryChildSpanStart {
|
|
183
|
-
readonly name: string;
|
|
184
|
-
readonly kind?: "internal" | "client";
|
|
185
|
-
readonly startedAt?: Date;
|
|
186
|
-
readonly attributes?: TelemetryAttributes;
|
|
187
|
-
}
|
|
188
|
-
interface TelemetryScope {
|
|
189
|
-
readonly traceId?: string;
|
|
190
|
-
readonly spanId?: string;
|
|
191
|
-
readonly costTracking?: CostTrackingTelemetry;
|
|
192
|
-
addSpanEvent(args: TelemetrySpanEventRecord): Promise<void> | void;
|
|
193
|
-
recordMetric(args: TelemetryMetricRecord): Promise<void> | void;
|
|
194
|
-
attachArtifact(args: TelemetryArtifactAttachment): Promise<TelemetryArtifactReference> | TelemetryArtifactReference;
|
|
339
|
+
/**
|
|
340
|
+
* Named connection from a parent node to child nodes that exist in {@link WorkflowDefinition.nodes}
|
|
341
|
+
* but are not traversed by the main execution graph. Parents are commonly executable nodes, but may
|
|
342
|
+
* also be connection-owned nodes for recursive agent attachments.
|
|
343
|
+
*/
|
|
344
|
+
interface WorkflowNodeConnection {
|
|
345
|
+
readonly parentNodeId: NodeId;
|
|
346
|
+
readonly connectionName: NodeConnectionName;
|
|
347
|
+
readonly childNodeIds: ReadonlyArray<NodeId>;
|
|
195
348
|
}
|
|
196
|
-
interface
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
349
|
+
interface WorkflowDefinition {
|
|
350
|
+
id: WorkflowId;
|
|
351
|
+
name: string;
|
|
352
|
+
nodes: NodeDefinition[];
|
|
353
|
+
edges: Edge[];
|
|
200
354
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* Used at the sub-agent boundary so that nested runtime telemetry parents under the agent.tool.call
|
|
205
|
-
* span instead of the orchestrator's node-level span.
|
|
355
|
+
* Optional metadata: which nodes are connection-owned children (e.g. AI agent `llm` / `tools` slots).
|
|
356
|
+
* When omitted, all nodes in {@link nodes} are treated as executable for topology.
|
|
206
357
|
*/
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
358
|
+
readonly connections?: ReadonlyArray<WorkflowNodeConnection>;
|
|
359
|
+
/** Directory + file-stem path under a workflow discovery root (for UI grouping only). */
|
|
360
|
+
discoveryPathSegments?: readonly string[];
|
|
361
|
+
/** Retention for run JSON and binaries (seconds). Host/env may supply defaults when omitted. */
|
|
362
|
+
readonly prunePolicy?: WorkflowPrunePolicySpec;
|
|
363
|
+
/** Whether to keep run data after completion. Host/env may supply defaults when omitted. */
|
|
364
|
+
readonly storagePolicy?: WorkflowStoragePolicySpec;
|
|
365
|
+
/** Invoked after a node fails permanently (retries exhausted) and node error handler did not recover. */
|
|
366
|
+
readonly workflowErrorHandler?: WorkflowErrorHandlerSpec;
|
|
214
367
|
}
|
|
215
|
-
interface
|
|
216
|
-
readonly
|
|
217
|
-
readonly
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
368
|
+
interface NodeConfigBase {
|
|
369
|
+
readonly kind: NodeKind;
|
|
370
|
+
readonly type: TypeToken<unknown>;
|
|
371
|
+
readonly name?: string;
|
|
372
|
+
readonly id?: NodeId;
|
|
373
|
+
readonly icon?: string;
|
|
374
|
+
readonly execution?: Readonly<{
|
|
375
|
+
hint?: "local" | "worker";
|
|
376
|
+
queue?: string;
|
|
377
|
+
}>;
|
|
378
|
+
/** In-process execute retries (runnable nodes). Triggers typically omit this. */
|
|
379
|
+
readonly retryPolicy?: RetryPolicySpec;
|
|
380
|
+
/** Recover from execute failures; return outputs to continue, or rethrow to fail the node. */
|
|
381
|
+
readonly nodeErrorHandler?: NodeErrorHandlerSpec;
|
|
382
|
+
/**
|
|
383
|
+
* When true, edges carrying zero items on an output port still schedule single-input downstream nodes.
|
|
384
|
+
* Decided from the **source** node that produced the (empty) output. Default (false/undefined): empty
|
|
385
|
+
* main batches skip downstream execution and propagate the empty path.
|
|
386
|
+
*/
|
|
387
|
+
readonly continueWhenEmptyOutput?: boolean;
|
|
388
|
+
/**
|
|
389
|
+
* Declared I/O port names for canvas authoring (unioned with ports inferred from edges).
|
|
390
|
+
* Use for dynamic routers (Switch) and future error ports.
|
|
391
|
+
*/
|
|
392
|
+
readonly declaredOutputPorts?: ReadonlyArray<OutputPortKey>;
|
|
393
|
+
readonly declaredInputPorts?: ReadonlyArray<InputPortKey>;
|
|
394
|
+
getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
|
|
395
|
+
/**
|
|
396
|
+
* Marker: this node emits {@link import("./assertionTypes").AssertionResult}-shaped items on its
|
|
397
|
+
* `main` port. The TestSuiteOrchestrator (and host-side TestAssertionPersister) listen for
|
|
398
|
+
* `nodeCompleted` events from nodes with this flag set, and persist their output items as
|
|
399
|
+
* TestAssertion records (only when the run carries a `testContext`). Set on assertion node
|
|
400
|
+
* configs (e.g. `AssertionNodeConfig`, `StringEqualsAssertionNodeConfig`).
|
|
401
|
+
*/
|
|
402
|
+
readonly emitsAssertions?: true;
|
|
222
403
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
readonly
|
|
232
|
-
readonly
|
|
233
|
-
readonly
|
|
234
|
-
|
|
404
|
+
declare const runnableNodeInputType: unique symbol;
|
|
405
|
+
declare const runnableNodeOutputType: unique symbol;
|
|
406
|
+
declare const triggerNodeOutputType: unique symbol;
|
|
407
|
+
/**
|
|
408
|
+
* Runnable node: **`TInputJson`** is what **`inputSchema`** validates on **`item.json`** (the wire payload).
|
|
409
|
+
* **`TOutputJson`** is emitted `item.json` on outputs.
|
|
410
|
+
*/
|
|
411
|
+
interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends NodeConfigBase {
|
|
412
|
+
readonly kind: "node";
|
|
413
|
+
readonly [runnableNodeInputType]?: TInputJson$1;
|
|
414
|
+
readonly [runnableNodeOutputType]?: TOutputJson$1;
|
|
415
|
+
/**
|
|
416
|
+
* Optional Zod input contract for {@link RunnableNode} when not set on the node class.
|
|
417
|
+
* Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
|
|
418
|
+
*/
|
|
419
|
+
readonly inputSchema?: ZodType<TInputJson$1>;
|
|
420
|
+
/**
|
|
421
|
+
* When an activation receives **zero** input items, the engine normally runs `execute` zero times.
|
|
422
|
+
* Set to **`runOnce`** to run `execute` once with an empty `items` batch (and a synthetic wire item for schema parsing).
|
|
423
|
+
* Used by batch-style callback nodes (built-in `Callback`) so `callback([], ctx)` still runs.
|
|
424
|
+
*/
|
|
425
|
+
readonly emptyBatchExecution?: "skip" | "runOnce";
|
|
235
426
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
readonly
|
|
239
|
-
readonly
|
|
240
|
-
readonly
|
|
427
|
+
declare const triggerNodeSetupStateType: unique symbol;
|
|
428
|
+
interface TriggerNodeConfig<TOutputJson$1 = unknown, TSetupState$1 extends JsonValue | undefined = undefined> extends NodeConfigBase {
|
|
429
|
+
readonly kind: "trigger";
|
|
430
|
+
readonly [triggerNodeOutputType]?: TOutputJson$1;
|
|
431
|
+
readonly [triggerNodeSetupStateType]?: TSetupState$1;
|
|
432
|
+
/**
|
|
433
|
+
* Distinguishes triggers driven by the live activation policy (webhooks, cron, polling) from
|
|
434
|
+
* triggers driven only by the {@link TestSuiteOrchestrator}. `WorkflowActivation` skips
|
|
435
|
+
* `"test"` triggers; the orchestrator skips `"live"` triggers. Defaults to `"live"` when omitted.
|
|
436
|
+
*/
|
|
437
|
+
readonly triggerKind?: "live" | "test";
|
|
241
438
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
439
|
+
type RunnableNodeInputJson<TConfig extends RunnableNodeConfig<any, any>> = TConfig extends RunnableNodeConfig<infer TInputJson, any> ? TInputJson : never;
|
|
440
|
+
type RunnableNodeOutputJson<TConfig extends RunnableNodeConfig<any, any>> = TConfig extends RunnableNodeConfig<any, infer TOutputJson> ? TOutputJson : never;
|
|
441
|
+
type TriggerNodeOutputJson<TConfig extends TriggerNodeConfig<any, any>> = TConfig extends TriggerNodeConfig<infer TOutputJson, any> ? TOutputJson : never;
|
|
442
|
+
type TriggerNodeSetupState<TConfig extends TriggerNodeConfig<any, any>> = TConfig extends TriggerNodeConfig<any, infer TSetupState> ? TSetupState : never;
|
|
443
|
+
interface NodeDefinition {
|
|
444
|
+
id: NodeId;
|
|
445
|
+
kind: NodeKind;
|
|
446
|
+
type: TypeToken<unknown>;
|
|
447
|
+
name?: string;
|
|
448
|
+
config: NodeConfigBase;
|
|
245
449
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
readonly __webhookControl: true;
|
|
251
|
-
readonly kind: "respondNow" | "respondNowAndContinue";
|
|
252
|
-
readonly responseItems: Items;
|
|
253
|
-
readonly continueItems?: Items;
|
|
450
|
+
interface NodeRef {
|
|
451
|
+
id: NodeId;
|
|
452
|
+
kind: NodeKind;
|
|
453
|
+
name?: string;
|
|
254
454
|
}
|
|
255
|
-
|
|
256
|
-
workflowId: WorkflowId;
|
|
455
|
+
type PairedItemRef = Readonly<{
|
|
257
456
|
nodeId: NodeId;
|
|
258
|
-
}
|
|
259
|
-
//#endregion
|
|
260
|
-
//#region ../core/src/workflow/dsl/workflowBuilderTypes.d.ts
|
|
261
|
-
type AnyRunnableNodeConfig = RunnableNodeConfig<any, any>;
|
|
262
|
-
type AnyTriggerNodeConfig = TriggerNodeConfig<any>;
|
|
263
|
-
type ValidStepSequence<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps extends readonly [] ? readonly [] : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<TCurrentJson, infer TNextJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? readonly [TFirst, ...ValidStepSequence<TNextJson, TRest>] : never : never : TSteps;
|
|
264
|
-
type StepSequenceOutput<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? TSteps extends readonly [] ? TCurrentJson : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<TCurrentJson, infer TNextJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? StepSequenceOutput<TNextJson, TRest> : never : never : TCurrentJson : TCurrentJson;
|
|
265
|
-
type TypesMatch<TLeft, TRight> = [TLeft] extends [TRight] ? ([TRight] extends [TLeft] ? true : false) : false;
|
|
266
|
-
type BranchOutputGuard<TCurrentJson, TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined, TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TypesMatch<StepSequenceOutput<TCurrentJson, TTrueSteps>, StepSequenceOutput<TCurrentJson, TFalseSteps>> extends true ? unknown : never;
|
|
267
|
-
type BranchStepsArg<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps & ValidStepSequence<TCurrentJson, TSteps>;
|
|
268
|
-
type BranchMoreArgs<TCurrentJson, TFirstStep extends RunnableNodeConfig<TCurrentJson, any>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TRestSteps & ValidStepSequence<RunnableNodeOutputJson<TFirstStep>, TRestSteps>;
|
|
269
|
-
type BooleanWhenOverloads<TCurrentJson, TReturn> = {
|
|
270
|
-
<TSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, steps: BranchStepsArg<TCurrentJson, TSteps>): TReturn;
|
|
271
|
-
<TFirstStep extends RunnableNodeConfig<TCurrentJson, any>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, step: TFirstStep, ...more: BranchMoreArgs<TCurrentJson, TFirstStep, TRestSteps>): TReturn;
|
|
272
|
-
};
|
|
273
|
-
//#endregion
|
|
274
|
-
//#region ../core/src/workflow/dsl/WhenBuilder.d.ts
|
|
275
|
-
declare class WhenBuilder<TCurrentJson> {
|
|
276
|
-
private readonly wf;
|
|
277
|
-
private readonly from;
|
|
278
|
-
private readonly branchPort;
|
|
279
|
-
constructor(wf: WorkflowBuilder, from: NodeRef, branchPort: OutputPortKey);
|
|
280
|
-
addBranch<TSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(steps: TSteps & ValidStepSequence<TCurrentJson, TSteps>): this;
|
|
281
|
-
readonly when: BooleanWhenOverloads<TCurrentJson, WhenBuilder<TCurrentJson>>;
|
|
282
|
-
build(): WorkflowDefinition;
|
|
283
|
-
}
|
|
284
|
-
//#endregion
|
|
285
|
-
//#region ../core/src/workflow/dsl/ChainCursorResolver.d.ts
|
|
286
|
-
type ChainCursorEndpoint = Readonly<{
|
|
287
|
-
node: NodeRef;
|
|
288
457
|
output: OutputPortKey;
|
|
289
|
-
|
|
458
|
+
itemIndex: number;
|
|
290
459
|
}>;
|
|
291
|
-
type
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}> & BranchOutputGuard<TCurrentJson, TTrueSteps, TFalseSteps>): ChainCursor<StepSequenceOutput<TCurrentJson, TTrueSteps>>;
|
|
296
|
-
};
|
|
297
|
-
declare class ChainCursor<TCurrentJson> {
|
|
298
|
-
private readonly wf;
|
|
299
|
-
private readonly endpoints;
|
|
300
|
-
constructor(wf: WorkflowBuilder, endpoints: ReadonlyArray<ChainCursorEndpoint>);
|
|
301
|
-
then<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
|
|
302
|
-
thenIntoInputHints<TOutputJson$1, TConfig extends RunnableNodeConfig<any, TOutputJson$1>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
|
|
303
|
-
readonly when: ChainCursorWhenOverloads<TCurrentJson>;
|
|
304
|
-
route<TNextJson$1>(branches: Readonly<Record<OutputPortKey, (branch: ChainCursor<TCurrentJson>) => ChainCursor<TNextJson$1> | undefined>>): ChainCursor<TNextJson$1>;
|
|
305
|
-
build(): WorkflowDefinition;
|
|
306
|
-
private resolveSharedInputPortHint;
|
|
307
|
-
}
|
|
308
|
-
//#endregion
|
|
309
|
-
//#region ../core/src/workflow/dsl/WorkflowBuilder.d.ts
|
|
310
|
-
declare class WorkflowBuilder {
|
|
311
|
-
private readonly meta;
|
|
312
|
-
private readonly options?;
|
|
313
|
-
private readonly nodes;
|
|
314
|
-
private readonly edges;
|
|
315
|
-
private seq;
|
|
316
|
-
constructor(meta: {
|
|
317
|
-
id: WorkflowId;
|
|
318
|
-
name: string;
|
|
319
|
-
}, options?: Readonly<Record<string, never>> | undefined);
|
|
320
|
-
private add;
|
|
321
|
-
private connect;
|
|
322
|
-
trigger<TConfig extends AnyTriggerNodeConfig>(config: TConfig): ChainCursor<TriggerNodeOutputJson<TConfig>>;
|
|
323
|
-
start<TConfig extends AnyRunnableNodeConfig>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
|
|
324
|
-
build(): WorkflowDefinition;
|
|
325
|
-
}
|
|
326
|
-
//#endregion
|
|
327
|
-
//#region ../core/src/contracts/runtimeTypes.d.ts
|
|
328
|
-
interface WorkflowRunnerService {
|
|
329
|
-
runById(args: {
|
|
330
|
-
workflowId: WorkflowId;
|
|
331
|
-
startAt?: NodeId;
|
|
332
|
-
items: Items;
|
|
333
|
-
parent?: ParentExecutionRef;
|
|
334
|
-
}): Promise<RunResult>;
|
|
335
|
-
}
|
|
336
|
-
interface NodeResolver {
|
|
337
|
-
resolve<T>(token: TypeToken<T>): T;
|
|
338
|
-
}
|
|
339
|
-
interface NodeExecutionStatePublisher {
|
|
340
|
-
markQueued(args: {
|
|
341
|
-
nodeId: NodeId;
|
|
342
|
-
activationId?: NodeActivationId;
|
|
343
|
-
inputsByPort?: NodeInputsByPort;
|
|
344
|
-
}): Promise<void>;
|
|
345
|
-
markRunning(args: {
|
|
346
|
-
nodeId: NodeId;
|
|
347
|
-
activationId?: NodeActivationId;
|
|
348
|
-
inputsByPort?: NodeInputsByPort;
|
|
349
|
-
}): Promise<void>;
|
|
350
|
-
markCompleted(args: {
|
|
351
|
-
nodeId: NodeId;
|
|
352
|
-
activationId?: NodeActivationId;
|
|
353
|
-
inputsByPort?: NodeInputsByPort;
|
|
354
|
-
outputs?: NodeOutputs;
|
|
355
|
-
}): Promise<void>;
|
|
356
|
-
markFailed(args: {
|
|
357
|
-
nodeId: NodeId;
|
|
358
|
-
activationId?: NodeActivationId;
|
|
359
|
-
inputsByPort?: NodeInputsByPort;
|
|
360
|
-
error: Error;
|
|
361
|
-
}): Promise<void>;
|
|
362
|
-
appendConnectionInvocation(args: ConnectionInvocationAppendArgs): Promise<void>;
|
|
363
|
-
}
|
|
364
|
-
type BinaryBody = ReadableStream<Uint8Array> | AsyncIterable<Uint8Array> | Uint8Array | ArrayBuffer;
|
|
365
|
-
interface BinaryStorageReadResult {
|
|
366
|
-
body: ReadableStream<Uint8Array>;
|
|
367
|
-
size?: number;
|
|
368
|
-
}
|
|
369
|
-
interface BinaryAttachmentCreateRequest {
|
|
370
|
-
name: string;
|
|
371
|
-
body: BinaryBody;
|
|
460
|
+
type BinaryPreviewKind = "image" | "audio" | "video" | "download";
|
|
461
|
+
type BinaryAttachment = Readonly<{
|
|
462
|
+
id: string;
|
|
463
|
+
storageKey: string;
|
|
372
464
|
mimeType: string;
|
|
465
|
+
size: number;
|
|
466
|
+
storageDriver: string;
|
|
467
|
+
previewKind: BinaryPreviewKind;
|
|
468
|
+
createdAt: string;
|
|
469
|
+
runId: RunId;
|
|
470
|
+
workflowId: WorkflowId;
|
|
471
|
+
nodeId: NodeId;
|
|
472
|
+
activationId: NodeActivationId;
|
|
373
473
|
filename?: string;
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
474
|
+
sha256?: string;
|
|
475
|
+
}>;
|
|
476
|
+
type ItemBinary = Readonly<Record<string, BinaryAttachment>>;
|
|
477
|
+
type Item<TJson = unknown> = Readonly<{
|
|
478
|
+
json: TJson;
|
|
479
|
+
binary?: ItemBinary;
|
|
480
|
+
meta?: Readonly<Record<string, unknown>>;
|
|
481
|
+
paired?: ReadonlyArray<PairedItemRef>;
|
|
482
|
+
}>;
|
|
483
|
+
type Items<TJson = unknown> = ReadonlyArray<Item<TJson>>;
|
|
484
|
+
type NodeOutputs = Partial<Record<OutputPortKey, Items>>;
|
|
485
|
+
type RunId = string;
|
|
486
|
+
type NodeActivationId = string;
|
|
487
|
+
/**
|
|
488
|
+
* One per-item iteration of a runnable node's execute loop. Refines `NodeActivationId` for
|
|
489
|
+
* per-item connection invocations and telemetry. Undefined when the executing node is a batch
|
|
490
|
+
* node or trigger that does not iterate items.
|
|
491
|
+
*/
|
|
492
|
+
type NodeIterationId = string;
|
|
493
|
+
interface ParentExecutionRef {
|
|
388
494
|
runId: RunId;
|
|
389
495
|
workflowId: WorkflowId;
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
subworkflowDepth
|
|
393
|
-
/** Effective
|
|
394
|
-
engineMaxNodeActivations
|
|
395
|
-
/** Effective subworkflow
|
|
396
|
-
engineMaxSubworkflowDepth
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
496
|
+
nodeId: NodeId;
|
|
497
|
+
/** Subworkflow depth of the **spawning** run (0 = root). Passed when starting a child run. */
|
|
498
|
+
subworkflowDepth?: number;
|
|
499
|
+
/** Effective max node activations from the parent run (propagated to child policy merge). */
|
|
500
|
+
engineMaxNodeActivations?: number;
|
|
501
|
+
/** Effective max subworkflow depth from the parent run (propagated to child policy merge). */
|
|
502
|
+
engineMaxSubworkflowDepth?: number;
|
|
503
|
+
/**
|
|
504
|
+
* Test-suite linkage inherited by the child subworkflow run. Set by whichever node
|
|
505
|
+
* spawns the subworkflow when its own `ctx.testContext` is present, so assertions
|
|
506
|
+
* emitted inside a subworkflow land under the correct parent test case.
|
|
507
|
+
*/
|
|
508
|
+
testContext?: RunTestContext;
|
|
509
|
+
}
|
|
510
|
+
interface RunDataSnapshot {
|
|
511
|
+
getOutputs(nodeId: NodeId): NodeOutputs | undefined;
|
|
512
|
+
getOutputItems<TJson = unknown>(nodeId: NodeId | NodeIdRef<TJson>, output?: OutputPortKey): Items<TJson>;
|
|
513
|
+
getOutputItem<TJson = unknown>(nodeId: NodeId | NodeIdRef<TJson>, itemIndex: number, output?: OutputPortKey): Item<TJson> | undefined;
|
|
514
|
+
}
|
|
515
|
+
interface ActivationIdFactory {
|
|
516
|
+
makeActivationId(): NodeActivationId;
|
|
409
517
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
518
|
+
type UpstreamRefPlaceholder = `$${number}`;
|
|
519
|
+
/** Whether to persist run execution data after the workflow finishes. */
|
|
520
|
+
type WorkflowStoragePolicyMode = "ALL" | "SUCCESS" | "ERROR" | "NEVER";
|
|
521
|
+
type WorkflowStoragePolicySpec = WorkflowStoragePolicyMode | TypeToken<WorkflowStoragePolicyResolver>;
|
|
522
|
+
interface WorkflowStoragePolicyResolver {
|
|
523
|
+
shouldPersist(args: WorkflowStoragePolicyDecisionArgs): boolean | Promise<boolean>;
|
|
416
524
|
}
|
|
417
|
-
interface
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
525
|
+
interface WorkflowStoragePolicyDecisionArgs {
|
|
526
|
+
readonly runId: RunId;
|
|
527
|
+
readonly workflowId: WorkflowId;
|
|
528
|
+
readonly workflow: WorkflowDefinition;
|
|
529
|
+
readonly finalStatus: "completed" | "failed";
|
|
530
|
+
readonly startedAt: string;
|
|
531
|
+
readonly finishedAt: string;
|
|
423
532
|
}
|
|
424
|
-
interface
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
533
|
+
interface WorkflowPrunePolicySpec {
|
|
534
|
+
readonly runDataRetentionSeconds?: number;
|
|
535
|
+
readonly binaryRetentionSeconds?: number;
|
|
536
|
+
readonly telemetrySpanRetentionSeconds?: number;
|
|
537
|
+
readonly telemetryArtifactRetentionSeconds?: number;
|
|
538
|
+
readonly telemetryMetricRetentionSeconds?: number;
|
|
429
539
|
}
|
|
430
|
-
interface
|
|
431
|
-
|
|
540
|
+
interface WorkflowErrorHandler {
|
|
541
|
+
onError(ctx: WorkflowErrorContext): void | Promise<void>;
|
|
432
542
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
readonly
|
|
441
|
-
|
|
442
|
-
|
|
543
|
+
interface WorkflowErrorContext {
|
|
544
|
+
readonly runId: RunId;
|
|
545
|
+
readonly workflowId: WorkflowId;
|
|
546
|
+
readonly workflow: WorkflowDefinition;
|
|
547
|
+
readonly failedNodeId: NodeId;
|
|
548
|
+
readonly error: Error;
|
|
549
|
+
readonly startedAt: string;
|
|
550
|
+
readonly finishedAt: string;
|
|
551
|
+
}
|
|
552
|
+
type WorkflowErrorHandlerSpec = TypeToken<WorkflowErrorHandler> | WorkflowErrorHandler;
|
|
553
|
+
interface NodeErrorHandlerArgs<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
554
|
+
readonly kind: "single" | "multi";
|
|
443
555
|
readonly items: Items;
|
|
556
|
+
readonly inputsByPort: Readonly<Record<InputPortKey, Items>> | undefined;
|
|
444
557
|
readonly ctx: NodeExecutionContext<TConfig>;
|
|
558
|
+
readonly error: Error;
|
|
445
559
|
}
|
|
446
|
-
interface
|
|
447
|
-
|
|
560
|
+
interface NodeErrorHandler {
|
|
561
|
+
handle<TConfig extends NodeConfigBase>(args: NodeErrorHandlerArgs<TConfig>): Promise<NodeOutputs>;
|
|
562
|
+
}
|
|
563
|
+
type NodeErrorHandlerSpec = TypeToken<NodeErrorHandler> | NodeErrorHandler;
|
|
564
|
+
//#endregion
|
|
565
|
+
//#region ../core/src/contracts/testTriggerTypes.d.ts
|
|
566
|
+
/**
|
|
567
|
+
* Identifier minted by the host (or in-memory test runner) for one execution of a test suite.
|
|
568
|
+
* One TestSuiteRun produces N child workflow runs, one per item yielded by `generateItems`.
|
|
569
|
+
*/
|
|
570
|
+
type TestSuiteRunId = string;
|
|
571
|
+
/**
|
|
572
|
+
* Setup context passed to a {@link TestTriggerNodeConfig.generateItems} callback. Distinct from
|
|
573
|
+
* {@link import("./runtimeTypes").TriggerSetupContext} on purpose: test triggers are not
|
|
574
|
+
* activated by the live trigger lifecycle (webhooks, cron, polling) and never call `emit` —
|
|
575
|
+
* the orchestrator pulls from the iterable they return and dispatches one run per item.
|
|
576
|
+
*/
|
|
577
|
+
interface TestTriggerSetupContext<TConfig extends TestTriggerNodeConfig<unknown> = TestTriggerNodeConfig<unknown>> {
|
|
578
|
+
readonly workflowId: WorkflowId;
|
|
579
|
+
readonly nodeId: NodeId;
|
|
580
|
+
readonly config: TConfig;
|
|
581
|
+
readonly testSuiteRunId: TestSuiteRunId;
|
|
448
582
|
/**
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
* via {@link NodeConfigBase.declaredOutputPorts}. Engine defaults to `["main"]` when omitted.
|
|
583
|
+
* Resolves a credential session for a slot declared on this trigger's
|
|
584
|
+
* {@link import("./workflowTypes").NodeConfigBase.getCredentialRequirements}. Same contract as
|
|
585
|
+
* {@link import("./runtimeTypes").ExecutionContext.getCredential}.
|
|
453
586
|
*/
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
readonly
|
|
457
|
-
execute(args: RunnableNodeExecuteArgs<TConfig, TInputJson$1>): Promise<unknown> | unknown;
|
|
587
|
+
getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
|
|
588
|
+
/** AbortSignal raised when the suite is cancelled — long-running pulls should bail out. */
|
|
589
|
+
readonly signal: AbortSignal;
|
|
458
590
|
}
|
|
459
|
-
|
|
460
|
-
|
|
591
|
+
/**
|
|
592
|
+
* A trigger config that emits **test cases**. Each item yielded by {@link generateItems}
|
|
593
|
+
* becomes one workflow run (with `executionOptions.testContext` set), so 10 yielded items
|
|
594
|
+
* → 10 runs marked under the same TestSuiteRun.
|
|
595
|
+
*
|
|
596
|
+
* The trigger is otherwise a normal {@link TriggerNodeConfig} (so the canvas treats it like
|
|
597
|
+
* any other trigger), but its `triggerKind` is `"test"` so the live activation policy skips it.
|
|
598
|
+
*/
|
|
599
|
+
interface TestTriggerNodeConfig<TOutputJson$1 = unknown> extends TriggerNodeConfig<TOutputJson$1, undefined> {
|
|
600
|
+
readonly triggerKind: "test";
|
|
461
601
|
/**
|
|
462
|
-
*
|
|
602
|
+
* Author-supplied async iterable of items, evaluated lazily. Implementations may fetch from
|
|
603
|
+
* credentialed APIs, read fixture files, or yield hard-coded items. The orchestrator iterates
|
|
604
|
+
* and dispatches one run per item, with concurrency capped by {@link concurrency} (default 4).
|
|
605
|
+
*/
|
|
606
|
+
generateItems(ctx: TestTriggerSetupContext<TestTriggerNodeConfig<TOutputJson$1>>): AsyncIterable<Item<TOutputJson$1>>;
|
|
607
|
+
/** Per-suite-run cap on simultaneously-executing test cases. Default: 4. */
|
|
608
|
+
readonly concurrency?: number;
|
|
609
|
+
/**
|
|
610
|
+
* Free-form description of where the test cases come from — surfaced in the node properties
|
|
611
|
+
* panel and the suite-detail header so authors revisiting the workflow six months later
|
|
612
|
+
* remember which mailbox / folder / fixture file the cases originate from.
|
|
463
613
|
*
|
|
464
|
-
*
|
|
465
|
-
* Engine defaults to `["main"]` when omitted.
|
|
614
|
+
* Example: `"All emails in the Gmail label \"test/triage-fixtures\" — 14 messages as of 2026-05-03."`
|
|
466
615
|
*/
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
execute(items: Items, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
|
|
616
|
+
readonly description?: string;
|
|
617
|
+
/**
|
|
618
|
+
* Resolves a human-readable label for one yielded test case (e.g. email subject). The
|
|
619
|
+
* orchestrator calls this once per yielded item, persists the result on the run, and the
|
|
620
|
+
* Tests-tab UI uses it to render the case row instead of the opaque runId. Return
|
|
621
|
+
* `undefined` to fall back to "Case #N".
|
|
622
|
+
*/
|
|
623
|
+
caseLabel?(item: Item<TOutputJson$1>): string | undefined;
|
|
476
624
|
}
|
|
477
|
-
|
|
478
|
-
|
|
625
|
+
//#endregion
|
|
626
|
+
//#region ../core/src/contracts/assertionTypes.d.ts
|
|
627
|
+
/**
|
|
628
|
+
* One assertion emitted by an assertion-emitting node (a node whose config sets
|
|
629
|
+
* `emitsAssertions: true`). Each emitted item on `main` carries one of these as `item.json`.
|
|
630
|
+
*
|
|
631
|
+
* Pass/fail is derived from `score >= (passThreshold ?? 0.5)` — see {@link deriveAssertionPassed}.
|
|
632
|
+
* The `errored` marker is for cases where the assertion code itself threw (distinct from
|
|
633
|
+
* "the assertion was evaluated and the score was low") and is treated as a hard fail in rollups
|
|
634
|
+
* regardless of `score`.
|
|
635
|
+
*/
|
|
636
|
+
interface AssertionResult {
|
|
637
|
+
readonly name: string;
|
|
638
|
+
/** 0..1 score. Source of truth for pass/fail (compared against `passThreshold`). */
|
|
639
|
+
readonly score: number;
|
|
640
|
+
/** 0..1 threshold for "passed". When omitted, consumers default to 0.5. */
|
|
641
|
+
readonly passThreshold?: number;
|
|
642
|
+
/** True when evaluating the assertion threw — treated as fail regardless of `score`. */
|
|
643
|
+
readonly errored?: true;
|
|
644
|
+
/** What the assertion expected. Free-form JSON; UIs render with a JSON viewer. */
|
|
645
|
+
readonly expected?: JsonValue;
|
|
646
|
+
/** What the workflow actually produced. */
|
|
647
|
+
readonly actual?: JsonValue;
|
|
648
|
+
/** Short human-readable explanation, especially for fails / errors. */
|
|
649
|
+
readonly message?: string;
|
|
650
|
+
/** Bag of supplemental fields (e.g. judge prompt, judge raw response, comparison method). */
|
|
651
|
+
readonly details?: Readonly<Record<string, JsonValue>>;
|
|
479
652
|
}
|
|
480
|
-
type ExecutableTriggerNode<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>> = TriggerNode<TConfig>;
|
|
481
653
|
//#endregion
|
|
482
|
-
//#region ../core/src/contracts/
|
|
483
|
-
type
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
__codemationNodeJson?: TJson;
|
|
487
|
-
}>;
|
|
488
|
-
type OutputPortKey = string;
|
|
489
|
-
type InputPortKey = string;
|
|
490
|
-
type NodeKind = "trigger" | "node";
|
|
491
|
-
type JsonPrimitive = string | number | boolean | null;
|
|
492
|
-
interface JsonObject {
|
|
493
|
-
readonly [key: string]: JsonValue;
|
|
654
|
+
//#region ../core/src/contracts/telemetryTypes.d.ts
|
|
655
|
+
type TelemetryAttributePrimitive = string | number | boolean | null;
|
|
656
|
+
interface TelemetryAttributes {
|
|
657
|
+
readonly [key: string]: TelemetryAttributePrimitive | undefined;
|
|
494
658
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
659
|
+
interface TelemetryMetricRecord {
|
|
660
|
+
readonly name: string;
|
|
661
|
+
readonly value: number;
|
|
662
|
+
readonly unit?: string;
|
|
663
|
+
readonly attributes?: TelemetryAttributes;
|
|
664
|
+
}
|
|
665
|
+
interface TelemetrySpanEventRecord {
|
|
666
|
+
readonly name: string;
|
|
667
|
+
readonly occurredAt?: Date;
|
|
668
|
+
readonly attributes?: TelemetryAttributes;
|
|
669
|
+
}
|
|
670
|
+
interface TelemetryArtifactAttachment {
|
|
671
|
+
readonly kind: string;
|
|
672
|
+
readonly contentType: string;
|
|
673
|
+
readonly previewText?: string;
|
|
674
|
+
readonly previewJson?: JsonValue;
|
|
675
|
+
readonly payloadText?: string;
|
|
676
|
+
readonly payloadJson?: JsonValue;
|
|
677
|
+
readonly bytes?: number;
|
|
678
|
+
readonly truncated?: boolean;
|
|
679
|
+
readonly expiresAt?: Date;
|
|
680
|
+
}
|
|
681
|
+
interface TelemetryArtifactReference {
|
|
682
|
+
readonly artifactId: string;
|
|
683
|
+
readonly traceId?: string;
|
|
684
|
+
readonly spanId?: string;
|
|
685
|
+
}
|
|
686
|
+
interface TelemetrySpanEnd {
|
|
687
|
+
readonly status?: "ok" | "error";
|
|
688
|
+
readonly statusMessage?: string;
|
|
689
|
+
readonly endedAt?: Date;
|
|
690
|
+
readonly attributes?: TelemetryAttributes;
|
|
691
|
+
}
|
|
692
|
+
interface TelemetryChildSpanStart {
|
|
693
|
+
readonly name: string;
|
|
694
|
+
readonly kind?: "internal" | "client";
|
|
695
|
+
readonly startedAt?: Date;
|
|
696
|
+
readonly attributes?: TelemetryAttributes;
|
|
697
|
+
}
|
|
698
|
+
interface TelemetryScope {
|
|
699
|
+
readonly traceId?: string;
|
|
700
|
+
readonly spanId?: string;
|
|
701
|
+
readonly costTracking?: CostTrackingTelemetry;
|
|
702
|
+
addSpanEvent(args: TelemetrySpanEventRecord): Promise<void> | void;
|
|
703
|
+
recordMetric(args: TelemetryMetricRecord): Promise<void> | void;
|
|
704
|
+
attachArtifact(args: TelemetryArtifactAttachment): Promise<TelemetryArtifactReference> | TelemetryArtifactReference;
|
|
705
|
+
}
|
|
706
|
+
interface TelemetrySpanScope extends TelemetryScope {
|
|
707
|
+
readonly traceId: string;
|
|
708
|
+
readonly spanId: string;
|
|
709
|
+
end(args?: TelemetrySpanEnd): Promise<void> | void;
|
|
710
|
+
/**
|
|
711
|
+
* Lift this span into a {@link NodeExecutionTelemetry} scoped to a different (nodeId, activationId).
|
|
712
|
+
* Children created via the returned telemetry's `startChildSpan` get this span as their parent.
|
|
713
|
+
*
|
|
714
|
+
* Used at the sub-agent boundary so that nested runtime telemetry parents under the agent.tool.call
|
|
715
|
+
* span instead of the orchestrator's node-level span.
|
|
716
|
+
*/
|
|
717
|
+
asNodeTelemetry(args: Readonly<{
|
|
501
718
|
nodeId: NodeId;
|
|
502
|
-
|
|
503
|
-
};
|
|
504
|
-
|
|
719
|
+
activationId: NodeActivationId;
|
|
720
|
+
}>): NodeExecutionTelemetry;
|
|
721
|
+
}
|
|
722
|
+
interface NodeExecutionTelemetry extends ExecutionTelemetry, TelemetrySpanScope {
|
|
723
|
+
startChildSpan(args: TelemetryChildSpanStart): TelemetrySpanScope;
|
|
724
|
+
}
|
|
725
|
+
interface ExecutionTelemetry extends TelemetryScope {
|
|
726
|
+
readonly traceId: string;
|
|
727
|
+
readonly spanId: string;
|
|
728
|
+
forNode(args: Readonly<{
|
|
505
729
|
nodeId: NodeId;
|
|
506
|
-
|
|
507
|
-
};
|
|
730
|
+
activationId: NodeActivationId;
|
|
731
|
+
}>): NodeExecutionTelemetry;
|
|
508
732
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
readonly
|
|
517
|
-
readonly
|
|
518
|
-
readonly
|
|
733
|
+
//#endregion
|
|
734
|
+
//#region ../core/src/contracts/CostTrackingTelemetryContract.d.ts
|
|
735
|
+
type CostTrackingComponent = "chat" | "ocr" | "rag";
|
|
736
|
+
interface CostTrackingUsageRecord {
|
|
737
|
+
readonly component: CostTrackingComponent;
|
|
738
|
+
readonly provider: string;
|
|
739
|
+
readonly operation: string;
|
|
740
|
+
readonly pricingKey: string;
|
|
741
|
+
readonly usageUnit: string;
|
|
742
|
+
readonly quantity: number;
|
|
743
|
+
readonly modelName?: string;
|
|
744
|
+
readonly attributes?: TelemetryAttributes;
|
|
745
|
+
}
|
|
746
|
+
interface CostTrackingPriceQuote {
|
|
747
|
+
readonly currency: string;
|
|
748
|
+
readonly currencyScale: number;
|
|
749
|
+
readonly estimatedAmountMinor: number;
|
|
750
|
+
readonly estimateKind: "catalog";
|
|
751
|
+
}
|
|
752
|
+
interface CostTrackingTelemetry {
|
|
753
|
+
captureUsage(args: CostTrackingUsageRecord): Promise<CostTrackingPriceQuote | undefined>;
|
|
754
|
+
forScope(scope: TelemetryScope): CostTrackingTelemetry;
|
|
755
|
+
}
|
|
756
|
+
//#endregion
|
|
757
|
+
//#region ../core/src/contracts/webhookTypes.d.ts
|
|
758
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
759
|
+
interface WebhookControlSignal {
|
|
760
|
+
readonly __webhookControl: true;
|
|
761
|
+
readonly kind: "respondNow" | "respondNowAndContinue";
|
|
762
|
+
readonly responseItems: Items;
|
|
763
|
+
readonly continueItems?: Items;
|
|
764
|
+
}
|
|
765
|
+
interface TriggerInstanceId {
|
|
766
|
+
workflowId: WorkflowId;
|
|
767
|
+
nodeId: NodeId;
|
|
519
768
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
769
|
+
//#endregion
|
|
770
|
+
//#region ../core/src/contracts/collectionTypes.d.ts
|
|
771
|
+
/**
|
|
772
|
+
* Represents a typed store for a single collection.
|
|
773
|
+
* All rows include auto-managed id, created_at, and updated_at fields.
|
|
774
|
+
*/
|
|
775
|
+
interface CollectionStore<TRow extends Record<string, unknown> = Record<string, unknown>> {
|
|
525
776
|
/**
|
|
526
|
-
*
|
|
527
|
-
* When omitted, all nodes in {@link nodes} are treated as executable for topology.
|
|
777
|
+
* Insert a new row. id, created_at, and updated_at are auto-populated.
|
|
528
778
|
*/
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
readonly prunePolicy?: WorkflowPrunePolicySpec;
|
|
534
|
-
/** Whether to keep run data after completion. Host/env may supply defaults when omitted. */
|
|
535
|
-
readonly storagePolicy?: WorkflowStoragePolicySpec;
|
|
536
|
-
/** Invoked after a node fails permanently (retries exhausted) and node error handler did not recover. */
|
|
537
|
-
readonly workflowErrorHandler?: WorkflowErrorHandlerSpec;
|
|
538
|
-
}
|
|
539
|
-
interface NodeConfigBase {
|
|
540
|
-
readonly kind: NodeKind;
|
|
541
|
-
readonly type: TypeToken<unknown>;
|
|
542
|
-
readonly name?: string;
|
|
543
|
-
readonly id?: NodeId;
|
|
544
|
-
readonly icon?: string;
|
|
545
|
-
readonly execution?: Readonly<{
|
|
546
|
-
hint?: "local" | "worker";
|
|
547
|
-
queue?: string;
|
|
779
|
+
insert(row: TRow): Promise<TRow & {
|
|
780
|
+
id: string;
|
|
781
|
+
created_at: Date;
|
|
782
|
+
updated_at: Date;
|
|
548
783
|
}>;
|
|
549
|
-
/** In-process execute retries (runnable nodes). Triggers typically omit this. */
|
|
550
|
-
readonly retryPolicy?: RetryPolicySpec;
|
|
551
|
-
/** Recover from execute failures; return outputs to continue, or rethrow to fail the node. */
|
|
552
|
-
readonly nodeErrorHandler?: NodeErrorHandlerSpec;
|
|
553
784
|
/**
|
|
554
|
-
*
|
|
555
|
-
* Decided from the **source** node that produced the (empty) output. Default (false/undefined): empty
|
|
556
|
-
* main batches skip downstream execution and propagate the empty path.
|
|
785
|
+
* Get a single row by id.
|
|
557
786
|
*/
|
|
558
|
-
|
|
787
|
+
get(id: string): Promise<(TRow & {
|
|
788
|
+
id: string;
|
|
789
|
+
created_at: Date;
|
|
790
|
+
updated_at: Date;
|
|
791
|
+
}) | null>;
|
|
559
792
|
/**
|
|
560
|
-
*
|
|
561
|
-
* Use for dynamic routers (Switch) and future error ports.
|
|
793
|
+
* Find a single row matching the provided filter.
|
|
562
794
|
*/
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
declare const runnableNodeOutputType: unique symbol;
|
|
569
|
-
declare const triggerNodeOutputType: unique symbol;
|
|
570
|
-
/**
|
|
571
|
-
* Runnable node: **`TInputJson`** is what **`inputSchema`** validates on **`item.json`** (the wire payload).
|
|
572
|
-
* **`TOutputJson`** is emitted `item.json` on outputs.
|
|
573
|
-
*/
|
|
574
|
-
interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends NodeConfigBase {
|
|
575
|
-
readonly kind: "node";
|
|
576
|
-
readonly [runnableNodeInputType]?: TInputJson$1;
|
|
577
|
-
readonly [runnableNodeOutputType]?: TOutputJson$1;
|
|
795
|
+
findOne(filter: Partial<TRow>): Promise<(TRow & {
|
|
796
|
+
id: string;
|
|
797
|
+
created_at: Date;
|
|
798
|
+
updated_at: Date;
|
|
799
|
+
}) | null>;
|
|
578
800
|
/**
|
|
579
|
-
*
|
|
580
|
-
* Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
|
|
801
|
+
* List rows with optional pagination and filtering.
|
|
581
802
|
*/
|
|
582
|
-
|
|
803
|
+
list(opts?: {
|
|
804
|
+
limit?: number;
|
|
805
|
+
offset?: number;
|
|
806
|
+
where?: Partial<TRow>;
|
|
807
|
+
}): Promise<{
|
|
808
|
+
rows: ReadonlyArray<TRow & {
|
|
809
|
+
id: string;
|
|
810
|
+
created_at: Date;
|
|
811
|
+
updated_at: Date;
|
|
812
|
+
}>;
|
|
813
|
+
total: number;
|
|
814
|
+
}>;
|
|
583
815
|
/**
|
|
584
|
-
*
|
|
585
|
-
* Set to **`runOnce`** to run `execute` once with an empty `items` batch (and a synthetic wire item for schema parsing).
|
|
586
|
-
* Used by batch-style callback nodes (built-in `Callback`) so `callback([], ctx)` still runs.
|
|
816
|
+
* Update a row by id with partial data.
|
|
587
817
|
*/
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
type TriggerNodeSetupState<TConfig extends TriggerNodeConfig<any, any>> = TConfig extends TriggerNodeConfig<any, infer TSetupState> ? TSetupState : never;
|
|
600
|
-
interface NodeDefinition {
|
|
601
|
-
id: NodeId;
|
|
602
|
-
kind: NodeKind;
|
|
603
|
-
type: TypeToken<unknown>;
|
|
604
|
-
name?: string;
|
|
605
|
-
config: NodeConfigBase;
|
|
818
|
+
update(id: string, patch: Partial<TRow>): Promise<TRow & {
|
|
819
|
+
id: string;
|
|
820
|
+
created_at: Date;
|
|
821
|
+
updated_at: Date;
|
|
822
|
+
}>;
|
|
823
|
+
/**
|
|
824
|
+
* Delete a row by id. Hard delete only (no soft delete).
|
|
825
|
+
*/
|
|
826
|
+
delete(id: string): Promise<{
|
|
827
|
+
deleted: boolean;
|
|
828
|
+
}>;
|
|
606
829
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
830
|
+
/**
|
|
831
|
+
* Runtime collections context: keyed by collection name.
|
|
832
|
+
*/
|
|
833
|
+
type CollectionsContext = Readonly<Record<string, CollectionStore>>;
|
|
834
|
+
//#endregion
|
|
835
|
+
//#region ../core/src/contracts/emitPorts.d.ts
|
|
836
|
+
declare const EMIT_PORTS_BRAND: unique symbol;
|
|
837
|
+
type PortsEmission = Readonly<{
|
|
838
|
+
readonly [EMIT_PORTS_BRAND]: true;
|
|
839
|
+
readonly ports: Readonly<Partial<Record<OutputPortKey, Items | ReadonlyArray<JsonNonArray>>>>;
|
|
840
|
+
}>;
|
|
841
|
+
//#endregion
|
|
842
|
+
//#region ../core/src/workflow/dsl/workflowBuilderTypes.d.ts
|
|
843
|
+
type AnyRunnableNodeConfig = RunnableNodeConfig<any, any>;
|
|
844
|
+
type AnyTriggerNodeConfig = TriggerNodeConfig<any>;
|
|
845
|
+
type ValidStepSequence<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps extends readonly [] ? readonly [] : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<TCurrentJson, infer TNextJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? readonly [TFirst, ...ValidStepSequence<TNextJson, TRest>] : never : never : TSteps;
|
|
846
|
+
type StepSequenceOutput<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? TSteps extends readonly [] ? TCurrentJson : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<TCurrentJson, infer TNextJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? StepSequenceOutput<TNextJson, TRest> : never : never : TCurrentJson : TCurrentJson;
|
|
847
|
+
type TypesMatch<TLeft, TRight> = [TLeft] extends [TRight] ? ([TRight] extends [TLeft] ? true : false) : false;
|
|
848
|
+
type BranchOutputGuard<TCurrentJson, TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined, TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TypesMatch<StepSequenceOutput<TCurrentJson, TTrueSteps>, StepSequenceOutput<TCurrentJson, TFalseSteps>> extends true ? unknown : never;
|
|
849
|
+
type BranchStepsArg<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps & ValidStepSequence<TCurrentJson, TSteps>;
|
|
850
|
+
type BranchMoreArgs<TCurrentJson, TFirstStep extends RunnableNodeConfig<TCurrentJson, any>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TRestSteps & ValidStepSequence<RunnableNodeOutputJson<TFirstStep>, TRestSteps>;
|
|
851
|
+
type BooleanWhenOverloads<TCurrentJson, TReturn> = {
|
|
852
|
+
<TSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, steps: BranchStepsArg<TCurrentJson, TSteps>): TReturn;
|
|
853
|
+
<TFirstStep extends RunnableNodeConfig<TCurrentJson, any>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, step: TFirstStep, ...more: BranchMoreArgs<TCurrentJson, TFirstStep, TRestSteps>): TReturn;
|
|
854
|
+
};
|
|
855
|
+
//#endregion
|
|
856
|
+
//#region ../core/src/workflow/dsl/WhenBuilder.d.ts
|
|
857
|
+
declare class WhenBuilder<TCurrentJson> {
|
|
858
|
+
private readonly wf;
|
|
859
|
+
private readonly from;
|
|
860
|
+
private readonly branchPort;
|
|
861
|
+
constructor(wf: WorkflowBuilder, from: NodeRef, branchPort: OutputPortKey);
|
|
862
|
+
addBranch<TSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(steps: TSteps & ValidStepSequence<TCurrentJson, TSteps>): this;
|
|
863
|
+
readonly when: BooleanWhenOverloads<TCurrentJson, WhenBuilder<TCurrentJson>>;
|
|
864
|
+
build(): WorkflowDefinition;
|
|
611
865
|
}
|
|
612
|
-
|
|
613
|
-
|
|
866
|
+
//#endregion
|
|
867
|
+
//#region ../core/src/workflow/dsl/ChainCursorResolver.d.ts
|
|
868
|
+
type ChainCursorEndpoint = Readonly<{
|
|
869
|
+
node: NodeRef;
|
|
614
870
|
output: OutputPortKey;
|
|
615
|
-
|
|
871
|
+
inputPortHint?: InputPortKey;
|
|
616
872
|
}>;
|
|
617
|
-
type
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
873
|
+
type ChainCursorWhenOverloads<TCurrentJson> = BooleanWhenOverloads<TCurrentJson, WhenBuilder<TCurrentJson>> & {
|
|
874
|
+
<TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined, TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined>(branches: Readonly<{
|
|
875
|
+
true?: TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? BranchStepsArg<TCurrentJson, TTrueSteps> : never;
|
|
876
|
+
false?: TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? BranchStepsArg<TCurrentJson, TFalseSteps> : never;
|
|
877
|
+
}> & BranchOutputGuard<TCurrentJson, TTrueSteps, TFalseSteps>): ChainCursor<StepSequenceOutput<TCurrentJson, TTrueSteps>>;
|
|
878
|
+
};
|
|
879
|
+
declare class ChainCursor<TCurrentJson> {
|
|
880
|
+
private readonly wf;
|
|
881
|
+
private readonly endpoints;
|
|
882
|
+
constructor(wf: WorkflowBuilder, endpoints: ReadonlyArray<ChainCursorEndpoint>);
|
|
883
|
+
then<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
|
|
884
|
+
thenIntoInputHints<TOutputJson$1, TConfig extends RunnableNodeConfig<any, TOutputJson$1>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
|
|
885
|
+
readonly when: ChainCursorWhenOverloads<TCurrentJson>;
|
|
886
|
+
route<TNextJson$1>(branches: Readonly<Record<OutputPortKey, (branch: ChainCursor<TCurrentJson>) => ChainCursor<TNextJson$1> | undefined>>): ChainCursor<TNextJson$1>;
|
|
887
|
+
build(): WorkflowDefinition;
|
|
888
|
+
private resolveSharedInputPortHint;
|
|
889
|
+
}
|
|
890
|
+
//#endregion
|
|
891
|
+
//#region ../core/src/workflow/dsl/WorkflowBuilder.d.ts
|
|
892
|
+
declare class WorkflowBuilder {
|
|
893
|
+
private readonly meta;
|
|
894
|
+
private readonly options?;
|
|
895
|
+
private readonly nodes;
|
|
896
|
+
private readonly edges;
|
|
897
|
+
constructor(meta: {
|
|
898
|
+
id: WorkflowId;
|
|
899
|
+
name: string;
|
|
900
|
+
}, options?: Readonly<Record<string, never>> | undefined);
|
|
901
|
+
private add;
|
|
902
|
+
private connect;
|
|
903
|
+
trigger<TConfig extends AnyTriggerNodeConfig>(config: TConfig): ChainCursor<TriggerNodeOutputJson<TConfig>>;
|
|
904
|
+
start<TConfig extends AnyRunnableNodeConfig>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
|
|
905
|
+
build(): WorkflowDefinition;
|
|
906
|
+
private validateNodeIds;
|
|
907
|
+
}
|
|
908
|
+
//#endregion
|
|
909
|
+
//#region ../core/src/contracts/runtimeTypes.d.ts
|
|
910
|
+
interface WorkflowRunnerService {
|
|
911
|
+
runById(args: {
|
|
912
|
+
workflowId: WorkflowId;
|
|
913
|
+
startAt?: NodeId;
|
|
914
|
+
items: Items;
|
|
915
|
+
parent?: ParentExecutionRef;
|
|
916
|
+
}): Promise<RunResult>;
|
|
917
|
+
}
|
|
918
|
+
interface NodeResolver {
|
|
919
|
+
resolve<T>(token: TypeToken<T>): T;
|
|
920
|
+
}
|
|
921
|
+
interface NodeExecutionStatePublisher {
|
|
922
|
+
markQueued(args: {
|
|
923
|
+
nodeId: NodeId;
|
|
924
|
+
activationId?: NodeActivationId;
|
|
925
|
+
inputsByPort?: NodeInputsByPort;
|
|
926
|
+
}): Promise<void>;
|
|
927
|
+
markRunning(args: {
|
|
928
|
+
nodeId: NodeId;
|
|
929
|
+
activationId?: NodeActivationId;
|
|
930
|
+
inputsByPort?: NodeInputsByPort;
|
|
931
|
+
}): Promise<void>;
|
|
932
|
+
markCompleted(args: {
|
|
933
|
+
nodeId: NodeId;
|
|
934
|
+
activationId?: NodeActivationId;
|
|
935
|
+
inputsByPort?: NodeInputsByPort;
|
|
936
|
+
outputs?: NodeOutputs;
|
|
937
|
+
}): Promise<void>;
|
|
938
|
+
markFailed(args: {
|
|
939
|
+
nodeId: NodeId;
|
|
940
|
+
activationId?: NodeActivationId;
|
|
941
|
+
inputsByPort?: NodeInputsByPort;
|
|
942
|
+
error: Error;
|
|
943
|
+
}): Promise<void>;
|
|
944
|
+
appendConnectionInvocation(args: ConnectionInvocationAppendArgs): Promise<void>;
|
|
945
|
+
}
|
|
946
|
+
type BinaryBody = ReadableStream<Uint8Array> | AsyncIterable<Uint8Array> | Uint8Array | ArrayBuffer;
|
|
947
|
+
interface BinaryStorageReadResult {
|
|
948
|
+
body: ReadableStream<Uint8Array>;
|
|
949
|
+
size?: number;
|
|
950
|
+
}
|
|
951
|
+
interface BinaryAttachmentCreateRequest {
|
|
952
|
+
name: string;
|
|
953
|
+
body: BinaryBody;
|
|
621
954
|
mimeType: string;
|
|
622
|
-
size: number;
|
|
623
|
-
storageDriver: string;
|
|
624
|
-
previewKind: BinaryPreviewKind;
|
|
625
|
-
createdAt: string;
|
|
626
|
-
runId: RunId;
|
|
627
|
-
workflowId: WorkflowId;
|
|
628
|
-
nodeId: NodeId;
|
|
629
|
-
activationId: NodeActivationId;
|
|
630
955
|
filename?: string;
|
|
631
|
-
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
binary?: ItemBinary;
|
|
637
|
-
meta?: Readonly<Record<string, unknown>>;
|
|
638
|
-
paired?: ReadonlyArray<PairedItemRef>;
|
|
639
|
-
}>;
|
|
640
|
-
type Items<TJson = unknown> = ReadonlyArray<Item<TJson>>;
|
|
641
|
-
type NodeOutputs = Partial<Record<OutputPortKey, Items>>;
|
|
642
|
-
type RunId = string;
|
|
643
|
-
type NodeActivationId = string;
|
|
644
|
-
/**
|
|
645
|
-
* One per-item iteration of a runnable node's execute loop. Refines `NodeActivationId` for
|
|
646
|
-
* per-item connection invocations and telemetry. Undefined when the executing node is a batch
|
|
647
|
-
* node or trigger that does not iterate items.
|
|
648
|
-
*/
|
|
649
|
-
type NodeIterationId = string;
|
|
650
|
-
interface ParentExecutionRef {
|
|
651
|
-
runId: RunId;
|
|
652
|
-
workflowId: WorkflowId;
|
|
653
|
-
nodeId: NodeId;
|
|
654
|
-
/** Subworkflow depth of the **spawning** run (0 = root). Passed when starting a child run. */
|
|
655
|
-
subworkflowDepth?: number;
|
|
656
|
-
/** Effective max node activations from the parent run (propagated to child policy merge). */
|
|
657
|
-
engineMaxNodeActivations?: number;
|
|
658
|
-
/** Effective max subworkflow depth from the parent run (propagated to child policy merge). */
|
|
659
|
-
engineMaxSubworkflowDepth?: number;
|
|
956
|
+
previewKind?: BinaryAttachment["previewKind"];
|
|
957
|
+
}
|
|
958
|
+
interface NodeBinaryAttachmentService extends ExecutionBinaryService {
|
|
959
|
+
attach(args: BinaryAttachmentCreateRequest): Promise<BinaryAttachment>;
|
|
960
|
+
withAttachment<TJson>(item: Item<TJson>, name: string, attachment: BinaryAttachment): Item<TJson>;
|
|
660
961
|
}
|
|
661
|
-
interface
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
962
|
+
interface ExecutionBinaryService {
|
|
963
|
+
forNode(args: {
|
|
964
|
+
nodeId: NodeId;
|
|
965
|
+
activationId: NodeActivationId;
|
|
966
|
+
}): NodeBinaryAttachmentService;
|
|
967
|
+
openReadStream(attachment: BinaryAttachment): Promise<BinaryStorageReadResult | undefined>;
|
|
665
968
|
}
|
|
666
|
-
interface
|
|
667
|
-
|
|
969
|
+
interface ExecutionContext {
|
|
970
|
+
runId: RunId;
|
|
971
|
+
workflowId: WorkflowId;
|
|
972
|
+
parent?: ParentExecutionRef;
|
|
973
|
+
/** This run's subworkflow depth (0 = root). */
|
|
974
|
+
subworkflowDepth: number;
|
|
975
|
+
/** Effective activation budget cap for this run (after policy merge). */
|
|
976
|
+
engineMaxNodeActivations: number;
|
|
977
|
+
/** Effective subworkflow nesting cap for this run (after policy merge). */
|
|
978
|
+
engineMaxSubworkflowDepth: number;
|
|
979
|
+
now: () => Date;
|
|
980
|
+
data: RunDataSnapshot;
|
|
981
|
+
nodeState?: NodeExecutionStatePublisher;
|
|
982
|
+
telemetry: ExecutionTelemetry;
|
|
983
|
+
binary: ExecutionBinaryService;
|
|
984
|
+
getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
|
|
985
|
+
/** Per-item iteration id, set by {@link NodeExecutor} on the ctx passed into runnable `execute`. */
|
|
986
|
+
iterationId?: NodeIterationId;
|
|
987
|
+
/** Item index (0-based) within the current activation's batch; set alongside {@link iterationId}. */
|
|
988
|
+
itemIndex?: number;
|
|
989
|
+
/** When set, this ctx is executing inside a sub-agent triggered by the named parent invocation. */
|
|
990
|
+
parentInvocationId?: ConnectionInvocationId;
|
|
991
|
+
/**
|
|
992
|
+
* Present iff the run was started by a TestSuiteOrchestrator. The {@link IsTestRunNode}
|
|
993
|
+
* branches on this; assertion-emitting nodes use it to decide whether to record results.
|
|
994
|
+
*/
|
|
995
|
+
testContext?: RunTestContext;
|
|
996
|
+
/**
|
|
997
|
+
* Collections registered in the codemation config, keyed by collection name.
|
|
998
|
+
*/
|
|
999
|
+
readonly collections?: CollectionsContext;
|
|
668
1000
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
1001
|
+
interface NodeExecutionContext<TConfig extends NodeConfigBase = NodeConfigBase> extends ExecutionContext {
|
|
1002
|
+
nodeId: NodeId;
|
|
1003
|
+
activationId: NodeActivationId;
|
|
1004
|
+
config: TConfig;
|
|
1005
|
+
telemetry: NodeExecutionTelemetry;
|
|
1006
|
+
binary: NodeBinaryAttachmentService;
|
|
675
1007
|
}
|
|
676
|
-
interface
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
1008
|
+
interface PollingTriggerHandle {
|
|
1009
|
+
/**
|
|
1010
|
+
* Start the polling loop. The runtime registers its own cleanup handle so callers do not need to
|
|
1011
|
+
* call {@link TriggerSetupContext.registerCleanup} for the loop.
|
|
1012
|
+
* @returns The state returned by the first cycle (or `undefined` when the overlap guard fired).
|
|
1013
|
+
*/
|
|
1014
|
+
start<TState, TItem>(args: {
|
|
1015
|
+
intervalMs: number;
|
|
1016
|
+
seedState?: TState;
|
|
1017
|
+
runCycle: (cycleCtx: {
|
|
1018
|
+
previousState: TState | undefined;
|
|
1019
|
+
signal: AbortSignal;
|
|
1020
|
+
}) => Promise<{
|
|
1021
|
+
items: Items<TItem>;
|
|
1022
|
+
nextState: TState;
|
|
1023
|
+
}>;
|
|
1024
|
+
}): Promise<TState | undefined>;
|
|
1025
|
+
/** Convenience dedup-window helper. */
|
|
1026
|
+
readonly dedup: PollingTriggerDedupWindow;
|
|
683
1027
|
}
|
|
684
|
-
interface
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
1028
|
+
interface TriggerSetupContext<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>, TSetupState$1 extends JsonValue | undefined = TriggerNodeSetupState<TConfig>> extends ExecutionContext {
|
|
1029
|
+
trigger: TriggerInstanceId;
|
|
1030
|
+
config: TConfig;
|
|
1031
|
+
previousState: TSetupState$1;
|
|
1032
|
+
registerCleanup(cleanup: TriggerCleanupHandle): void;
|
|
1033
|
+
emit(items: Items): Promise<void>;
|
|
1034
|
+
/** Generic polling-trigger surface. Pre-binds trigger id, emit, and registerCleanup. */
|
|
1035
|
+
readonly polling: PollingTriggerHandle;
|
|
690
1036
|
}
|
|
691
|
-
interface
|
|
692
|
-
|
|
1037
|
+
interface TriggerTestItemsContext<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>, TSetupState$1 extends JsonValue | undefined = TriggerNodeSetupState<TConfig>> extends ExecutionContext {
|
|
1038
|
+
trigger: TriggerInstanceId;
|
|
1039
|
+
nodeId: NodeId;
|
|
1040
|
+
config: TConfig;
|
|
1041
|
+
previousState: TSetupState$1;
|
|
693
1042
|
}
|
|
694
|
-
interface
|
|
695
|
-
|
|
696
|
-
readonly workflowId: WorkflowId;
|
|
697
|
-
readonly workflow: WorkflowDefinition;
|
|
698
|
-
readonly failedNodeId: NodeId;
|
|
699
|
-
readonly error: Error;
|
|
700
|
-
readonly startedAt: string;
|
|
701
|
-
readonly finishedAt: string;
|
|
1043
|
+
interface TriggerCleanupHandle {
|
|
1044
|
+
stop(): Promise<void> | void;
|
|
702
1045
|
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
1046
|
+
/**
|
|
1047
|
+
* Per-item runnable node: return JSON, an array to fan-out on `main`, an explicit `Item`, or {@link emitPorts}
|
|
1048
|
+
* for multi-port emission. Engine applies `inputSchema.parse(item.json)` and passes the result as `args.input`
|
|
1049
|
+
* (wire `item.json` is unchanged). Transform helpers may opt into binary preservation, while routers and
|
|
1050
|
+
* pass-through nodes should return explicit items when they need to preserve full item state.
|
|
1051
|
+
*/
|
|
1052
|
+
interface RunnableNodeExecuteArgs<TConfig extends RunnableNodeConfig<any, any> = RunnableNodeConfig<any, any>, TInputJson$1 = unknown> {
|
|
1053
|
+
readonly input: TInputJson$1;
|
|
1054
|
+
readonly item: Item;
|
|
1055
|
+
readonly itemIndex: number;
|
|
706
1056
|
readonly items: Items;
|
|
707
|
-
readonly inputsByPort: Readonly<Record<InputPortKey, Items>> | undefined;
|
|
708
1057
|
readonly ctx: NodeExecutionContext<TConfig>;
|
|
709
|
-
readonly error: Error;
|
|
710
|
-
}
|
|
711
|
-
interface NodeErrorHandler {
|
|
712
|
-
handle<TConfig extends NodeConfigBase>(args: NodeErrorHandlerArgs<TConfig>): Promise<NodeOutputs>;
|
|
713
1058
|
}
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
//#region ../core/src/contracts/credentialTypes.d.ts
|
|
717
|
-
type CredentialTypeId = string;
|
|
718
|
-
type CredentialInstanceId = string;
|
|
719
|
-
type CredentialMaterialSourceKind = "db" | "env" | "code";
|
|
720
|
-
type CredentialSetupStatus = "draft" | "ready";
|
|
721
|
-
type CredentialHealthStatus = "unknown" | "healthy" | "failing";
|
|
722
|
-
type CredentialFieldSchema = Readonly<{
|
|
723
|
-
key: string;
|
|
724
|
-
label: string;
|
|
725
|
-
type: "string" | "password" | "textarea" | "json" | "boolean";
|
|
726
|
-
required?: true;
|
|
727
|
-
order?: number;
|
|
728
|
-
/**
|
|
729
|
-
* Where this field appears in the credential dialog. Use `"advanced"` for optional or
|
|
730
|
-
* power-user fields; they render inside a collapsible section (see `CredentialTypeDefinition.advancedSection`).
|
|
731
|
-
* Defaults to `"default"` when omitted.
|
|
732
|
-
*/
|
|
733
|
-
visibility?: "default" | "advanced";
|
|
734
|
-
placeholder?: string;
|
|
735
|
-
helpText?: string;
|
|
736
|
-
/** When set, host resolves this field from process.env at runtime; env wins over stored values. */
|
|
737
|
-
envVarName?: string;
|
|
1059
|
+
interface RunnableNode<TConfig extends RunnableNodeConfig<any, any> = RunnableNodeConfig<any, any>, TInputJson$1 = unknown, _TOutputJson = unknown> {
|
|
1060
|
+
readonly kind: "node";
|
|
738
1061
|
/**
|
|
739
|
-
*
|
|
740
|
-
*
|
|
1062
|
+
* Declared output ports (e.g. `["main"]`).
|
|
1063
|
+
*
|
|
1064
|
+
* Prefer describing dynamic router ports (Switch) and fixed multi-ports (If true/false)
|
|
1065
|
+
* via {@link NodeConfigBase.declaredOutputPorts}. Engine defaults to `["main"]` when omitted.
|
|
741
1066
|
*/
|
|
742
|
-
|
|
743
|
-
/**
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
acceptedTypes: ReadonlyArray<CredentialTypeId>;
|
|
750
|
-
optional?: true;
|
|
751
|
-
helpText?: string;
|
|
752
|
-
helpUrl?: string;
|
|
753
|
-
}>;
|
|
754
|
-
type CredentialHealth = Readonly<{
|
|
755
|
-
status: CredentialHealthStatus;
|
|
756
|
-
message?: string;
|
|
757
|
-
testedAt?: string;
|
|
758
|
-
expiresAt?: string;
|
|
759
|
-
details?: Readonly<Record<string, unknown>>;
|
|
760
|
-
}>;
|
|
761
|
-
type OAuth2ProviderFromPublicConfig = Readonly<{
|
|
762
|
-
authorizeUrlFieldKey: string;
|
|
763
|
-
tokenUrlFieldKey: string;
|
|
764
|
-
userInfoUrlFieldKey?: string;
|
|
765
|
-
}>;
|
|
766
|
-
type CredentialOAuth2ScopesFromPublicConfig = Readonly<{
|
|
767
|
-
presetFieldKey: string;
|
|
768
|
-
presetScopes: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
769
|
-
customPresetKey?: string;
|
|
770
|
-
customScopesFieldKey?: string;
|
|
771
|
-
}>;
|
|
772
|
-
type CredentialOAuth2AuthDefinition = Readonly<{
|
|
773
|
-
kind: "oauth2";
|
|
774
|
-
providerId: string;
|
|
775
|
-
scopes: ReadonlyArray<string>;
|
|
776
|
-
scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig;
|
|
777
|
-
clientIdFieldKey?: string;
|
|
778
|
-
clientSecretFieldKey?: string;
|
|
779
|
-
} | {
|
|
780
|
-
kind: "oauth2";
|
|
781
|
-
providerFromPublicConfig: OAuth2ProviderFromPublicConfig;
|
|
782
|
-
scopes: ReadonlyArray<string>;
|
|
783
|
-
scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig;
|
|
784
|
-
clientIdFieldKey?: string;
|
|
785
|
-
clientSecretFieldKey?: string;
|
|
786
|
-
}>;
|
|
787
|
-
type CredentialAuthDefinition = CredentialOAuth2AuthDefinition;
|
|
788
|
-
type CredentialAdvancedSectionPresentation = Readonly<{
|
|
789
|
-
/** Collapsible section title (default: "Advanced"). */
|
|
790
|
-
title?: string;
|
|
791
|
-
/** Optional short helper text shown inside the section (above the fields). */
|
|
792
|
-
description?: string;
|
|
793
|
-
/** When true, the advanced section starts expanded. Default: false (collapsed). */
|
|
794
|
-
defaultOpen?: boolean;
|
|
795
|
-
}>;
|
|
796
|
-
type CredentialTypeDefinition = Readonly<{
|
|
797
|
-
typeId: CredentialTypeId;
|
|
798
|
-
displayName: string;
|
|
799
|
-
description?: string;
|
|
800
|
-
publicFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
801
|
-
secretFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1067
|
+
readonly outputPorts?: ReadonlyArray<OutputPortKey>;
|
|
1068
|
+
/** When omitted, engine uses {@link RunnableNodeConfig.inputSchema} or `z.unknown()`. */
|
|
1069
|
+
readonly inputSchema?: ZodType<TInputJson$1>;
|
|
1070
|
+
execute(args: RunnableNodeExecuteArgs<TConfig, TInputJson$1>): Promise<unknown> | unknown;
|
|
1071
|
+
}
|
|
1072
|
+
interface MultiInputNode<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
1073
|
+
kind: "node";
|
|
802
1074
|
/**
|
|
803
|
-
*
|
|
804
|
-
*
|
|
1075
|
+
* Declared output ports (typically `["main"]`).
|
|
1076
|
+
*
|
|
1077
|
+
* Prefer describing ports for authoring/canvas via {@link NodeConfigBase.declaredOutputPorts}.
|
|
1078
|
+
* Engine defaults to `["main"]` when omitted.
|
|
805
1079
|
*/
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
type
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
updatedAt: string;
|
|
1080
|
+
outputPorts?: ReadonlyArray<OutputPortKey>;
|
|
1081
|
+
executeMulti(inputsByPort: NodeInputsByPort, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
|
|
1082
|
+
}
|
|
1083
|
+
type TriggerSetupStateFor<TConfig extends TriggerNodeConfig<any, any>> = TriggerNodeSetupState<TConfig>;
|
|
1084
|
+
interface TriggerNode<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>> {
|
|
1085
|
+
kind: "trigger";
|
|
1086
|
+
outputPorts: readonly ["main"];
|
|
1087
|
+
setup(ctx: TriggerSetupContext<TConfig>): Promise<TriggerSetupStateFor<TConfig>>;
|
|
1088
|
+
execute(items: Items, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
|
|
1089
|
+
}
|
|
1090
|
+
interface TestableTriggerNode<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>> extends TriggerNode<TConfig> {
|
|
1091
|
+
getTestItems(ctx: TriggerTestItemsContext<TConfig>): Promise<Items>;
|
|
1092
|
+
}
|
|
1093
|
+
type ExecutableTriggerNode<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>> = TriggerNode<TConfig>;
|
|
1094
|
+
//#endregion
|
|
1095
|
+
//#region ../core/src/contracts/itemExpr.d.ts
|
|
1096
|
+
declare const ITEM_EXPR_BRAND: unique symbol;
|
|
1097
|
+
type ItemExprResolvedContext = Readonly<{
|
|
1098
|
+
runId: RunId;
|
|
1099
|
+
workflowId: WorkflowId;
|
|
1100
|
+
nodeId: NodeId;
|
|
1101
|
+
activationId: NodeActivationId;
|
|
1102
|
+
data: RunDataSnapshot;
|
|
830
1103
|
}>;
|
|
831
1104
|
/**
|
|
832
|
-
*
|
|
833
|
-
* Declare `TPublicConfig` / `TMaterial` on `CredentialType` so implementations are checked
|
|
834
|
-
* against your credential shapes (similar to `NodeExecutionContext.config` for nodes).
|
|
1105
|
+
* Context aligned with former {@link ItemInputMapperContext} — use **`data`** to read any completed upstream node.
|
|
835
1106
|
*/
|
|
836
|
-
type
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
1107
|
+
type ItemExprContext = ItemExprResolvedContext;
|
|
1108
|
+
type ItemExprArgs<TItemJson = unknown> = Readonly<{
|
|
1109
|
+
item: Item<TItemJson>;
|
|
1110
|
+
itemIndex: number;
|
|
1111
|
+
items: Items<TItemJson>;
|
|
1112
|
+
ctx: ItemExprContext;
|
|
840
1113
|
}>;
|
|
841
|
-
type
|
|
842
|
-
type
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
* Use this at registration and config boundaries; `CredentialTypeDefinition` is only the schema slice.
|
|
846
|
-
*/
|
|
847
|
-
type CredentialType<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord, TSession = unknown> = Readonly<{
|
|
848
|
-
definition: CredentialTypeDefinition;
|
|
849
|
-
createSession: CredentialSessionFactory<TPublicConfig, TMaterial, TSession>;
|
|
850
|
-
test: CredentialHealthTester<TPublicConfig, TMaterial>;
|
|
1114
|
+
type ItemExprCallback<T, TItemJson = unknown> = (args: ItemExprArgs<TItemJson>) => T | Promise<T>;
|
|
1115
|
+
type ItemExpr<T, TItemJson = unknown> = Readonly<{
|
|
1116
|
+
readonly [ITEM_EXPR_BRAND]: true;
|
|
1117
|
+
readonly fn: ItemExprCallback<T, TItemJson>;
|
|
851
1118
|
}>;
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
*/
|
|
857
|
-
type AnyCredentialType = CredentialType<any, any, unknown>;
|
|
858
|
-
interface CredentialSessionService {
|
|
859
|
-
getSession<TSession = unknown>(args: Readonly<{
|
|
860
|
-
workflowId: WorkflowId;
|
|
861
|
-
nodeId: NodeId;
|
|
862
|
-
slotKey: string;
|
|
863
|
-
}>): Promise<TSession>;
|
|
864
|
-
}
|
|
1119
|
+
//#endregion
|
|
1120
|
+
//#region ../core/src/contracts/params.d.ts
|
|
1121
|
+
type Expr<T, TItemJson = unknown> = ItemExpr<T, TItemJson>;
|
|
1122
|
+
type ParamDeep<T, TItemJson = unknown> = Expr<T, TItemJson> | (T extends readonly (infer U)[] ? ReadonlyArray<ParamDeep<U, TItemJson>> : never) | (T extends object ? { [K in keyof T]: ParamDeep<T[K], TItemJson> } : T);
|
|
865
1123
|
//#endregion
|
|
866
1124
|
//#region ../core/src/authoring/defineNode.types.d.ts
|
|
867
1125
|
type ResolvableCredentialType = AnyCredentialType | CredentialTypeId;
|
|
@@ -1073,6 +1331,9 @@ interface AgentNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> exten
|
|
|
1073
1331
|
* - `telemetry` parents children under the tool-call span (not the orchestrator's node span),
|
|
1074
1332
|
* - `binary` is scoped to the new (nodeId, activationId),
|
|
1075
1333
|
* - `parentInvocationId` points back to the tool-call invocation for downstream lineage.
|
|
1334
|
+
*
|
|
1335
|
+
* Registered via factory in {@link EngineRuntimeRegistrar} so constructors stay free of parameter
|
|
1336
|
+
* decorators (Next/SWC and coverage tooling cannot parse them on in-repo sources).
|
|
1076
1337
|
*/
|
|
1077
1338
|
declare class ChildExecutionScopeFactory {
|
|
1078
1339
|
private readonly activationIdFactory;
|
|
@@ -1117,6 +1378,325 @@ declare class NodeOutputNormalizer {
|
|
|
1117
1378
|
private applyOutput;
|
|
1118
1379
|
}
|
|
1119
1380
|
//#endregion
|
|
1381
|
+
//#region src/http/httpRequest.types.d.ts
|
|
1382
|
+
/**
|
|
1383
|
+
* Binary reference key into `item.binary`.
|
|
1384
|
+
*/
|
|
1385
|
+
type BinaryRef = string;
|
|
1386
|
+
/**
|
|
1387
|
+
* Discriminated union for the HTTP request body.
|
|
1388
|
+
*/
|
|
1389
|
+
type HttpBodySpec = Readonly<{
|
|
1390
|
+
kind: "none";
|
|
1391
|
+
}> | Readonly<{
|
|
1392
|
+
kind: "json";
|
|
1393
|
+
data: unknown;
|
|
1394
|
+
}> | Readonly<{
|
|
1395
|
+
kind: "form";
|
|
1396
|
+
data: Readonly<Record<string, string>>;
|
|
1397
|
+
}> | Readonly<{
|
|
1398
|
+
kind: "multipart";
|
|
1399
|
+
fields: Readonly<Record<string, string>>;
|
|
1400
|
+
binaries?: Readonly<Record<string, BinaryRef>>;
|
|
1401
|
+
}>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Session interface that credential types implement.
|
|
1404
|
+
* Returns header/query deltas so the executor can merge them without
|
|
1405
|
+
* mutating the immutable HttpRequestSpec.
|
|
1406
|
+
*/
|
|
1407
|
+
interface CredentialSession {
|
|
1408
|
+
applyToRequest(spec: HttpRequestSpec): HttpCredentialDelta;
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Mutations the credential session wants to apply to the outgoing request.
|
|
1412
|
+
*/
|
|
1413
|
+
type HttpCredentialDelta = Readonly<{
|
|
1414
|
+
headers?: Readonly<Record<string, string>>;
|
|
1415
|
+
query?: Readonly<Record<string, string>>;
|
|
1416
|
+
}>;
|
|
1417
|
+
/**
|
|
1418
|
+
* Full specification of one HTTP request. All URLs are fully resolved before
|
|
1419
|
+
* being passed here (template substitution already applied by the caller).
|
|
1420
|
+
*/
|
|
1421
|
+
type HttpRequestSpec = Readonly<{
|
|
1422
|
+
url: string;
|
|
1423
|
+
method: string;
|
|
1424
|
+
headers?: Readonly<Record<string, string>>;
|
|
1425
|
+
query?: Readonly<Record<string, string | string[]>>;
|
|
1426
|
+
body?: HttpBodySpec;
|
|
1427
|
+
credential?: CredentialSession;
|
|
1428
|
+
download?: Readonly<{
|
|
1429
|
+
mode: "auto" | "always" | "never";
|
|
1430
|
+
binaryName: string;
|
|
1431
|
+
}>;
|
|
1432
|
+
/** Execution context — needed for binary attach. */
|
|
1433
|
+
ctx: NodeExecutionContext<RunnableNodeConfig<unknown, unknown>>;
|
|
1434
|
+
}>;
|
|
1435
|
+
/**
|
|
1436
|
+
* Result of executing an HTTP request.
|
|
1437
|
+
*/
|
|
1438
|
+
type HttpRequestResult = Readonly<{
|
|
1439
|
+
url: string;
|
|
1440
|
+
method: string;
|
|
1441
|
+
status: number;
|
|
1442
|
+
ok: boolean;
|
|
1443
|
+
statusText: string;
|
|
1444
|
+
mimeType: string;
|
|
1445
|
+
headers: Readonly<Record<string, string>>;
|
|
1446
|
+
json?: unknown;
|
|
1447
|
+
text?: string;
|
|
1448
|
+
bodyBinaryName?: string;
|
|
1449
|
+
}>;
|
|
1450
|
+
//#endregion
|
|
1451
|
+
//#region src/credentials/ApiKeyCredentialType.d.ts
|
|
1452
|
+
/**
|
|
1453
|
+
* API key credential that injects a key either as an HTTP header or a query parameter.
|
|
1454
|
+
*/
|
|
1455
|
+
declare const apiKeyCredentialType: Readonly<{
|
|
1456
|
+
definition: Readonly<{
|
|
1457
|
+
typeId: CredentialTypeId;
|
|
1458
|
+
displayName: string;
|
|
1459
|
+
description?: string;
|
|
1460
|
+
publicFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1461
|
+
secretFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1462
|
+
advancedSection?: CredentialAdvancedSectionPresentation;
|
|
1463
|
+
supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
|
|
1464
|
+
auth?: CredentialAuthDefinition;
|
|
1465
|
+
}>;
|
|
1466
|
+
createSession: CredentialSessionFactory<{
|
|
1467
|
+
placement: unknown;
|
|
1468
|
+
name: unknown;
|
|
1469
|
+
}, {
|
|
1470
|
+
apiKey: unknown;
|
|
1471
|
+
}, CredentialSession>;
|
|
1472
|
+
test: CredentialHealthTester<{
|
|
1473
|
+
placement: unknown;
|
|
1474
|
+
name: unknown;
|
|
1475
|
+
}, {
|
|
1476
|
+
apiKey: unknown;
|
|
1477
|
+
}>;
|
|
1478
|
+
}> & {
|
|
1479
|
+
readonly key: string;
|
|
1480
|
+
};
|
|
1481
|
+
//#endregion
|
|
1482
|
+
//#region src/credentials/BasicAuthCredentialType.d.ts
|
|
1483
|
+
/**
|
|
1484
|
+
* HTTP Basic authentication credential.
|
|
1485
|
+
* Session sets `Authorization: Basic <base64(username:password)>`.
|
|
1486
|
+
*/
|
|
1487
|
+
declare const basicAuthCredentialType: Readonly<{
|
|
1488
|
+
definition: Readonly<{
|
|
1489
|
+
typeId: CredentialTypeId;
|
|
1490
|
+
displayName: string;
|
|
1491
|
+
description?: string;
|
|
1492
|
+
publicFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1493
|
+
secretFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1494
|
+
advancedSection?: CredentialAdvancedSectionPresentation;
|
|
1495
|
+
supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
|
|
1496
|
+
auth?: CredentialAuthDefinition;
|
|
1497
|
+
}>;
|
|
1498
|
+
createSession: CredentialSessionFactory<{
|
|
1499
|
+
username: unknown;
|
|
1500
|
+
}, {
|
|
1501
|
+
password: unknown;
|
|
1502
|
+
}, CredentialSession>;
|
|
1503
|
+
test: CredentialHealthTester<{
|
|
1504
|
+
username: unknown;
|
|
1505
|
+
}, {
|
|
1506
|
+
password: unknown;
|
|
1507
|
+
}>;
|
|
1508
|
+
}> & {
|
|
1509
|
+
readonly key: string;
|
|
1510
|
+
};
|
|
1511
|
+
//#endregion
|
|
1512
|
+
//#region src/credentials/BearerTokenCredentialType.d.ts
|
|
1513
|
+
/**
|
|
1514
|
+
* Simple Bearer token credential.
|
|
1515
|
+
* Session sets `Authorization: Bearer <token>` on every request.
|
|
1516
|
+
*/
|
|
1517
|
+
declare const bearerTokenCredentialType: Readonly<{
|
|
1518
|
+
definition: Readonly<{
|
|
1519
|
+
typeId: CredentialTypeId;
|
|
1520
|
+
displayName: string;
|
|
1521
|
+
description?: string;
|
|
1522
|
+
publicFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1523
|
+
secretFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1524
|
+
advancedSection?: CredentialAdvancedSectionPresentation;
|
|
1525
|
+
supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
|
|
1526
|
+
auth?: CredentialAuthDefinition;
|
|
1527
|
+
}>;
|
|
1528
|
+
createSession: CredentialSessionFactory<Readonly<Record<string, unknown>>, {
|
|
1529
|
+
token: unknown;
|
|
1530
|
+
}, CredentialSession>;
|
|
1531
|
+
test: CredentialHealthTester<Readonly<Record<string, unknown>>, {
|
|
1532
|
+
token: unknown;
|
|
1533
|
+
}>;
|
|
1534
|
+
}> & {
|
|
1535
|
+
readonly key: string;
|
|
1536
|
+
};
|
|
1537
|
+
//#endregion
|
|
1538
|
+
//#region src/credentials/OAuth2ClientCredentialsTypeFactory.d.ts
|
|
1539
|
+
/**
|
|
1540
|
+
* OAuth2 client-credentials flow credential.
|
|
1541
|
+
*
|
|
1542
|
+
* This is a machine-to-machine flow: no user redirect occurs. The session
|
|
1543
|
+
* POSTs to the configured `tokenUrl` with `client_credentials` grant, caches
|
|
1544
|
+
* the resulting access token for the duration of the session, and injects it
|
|
1545
|
+
* as `Authorization: Bearer <token>` on each request.
|
|
1546
|
+
*
|
|
1547
|
+
* Token caching is per-session only (one createSession call = one token fetch
|
|
1548
|
+
* at most). Cross-session caching would require host-level state and is out of
|
|
1549
|
+
* scope here. Because the engine creates a fresh session per execution, a new
|
|
1550
|
+
* token is fetched once per node activation.
|
|
1551
|
+
*
|
|
1552
|
+
* NOTE: `auth` is intentionally omitted from the definition. The OAuth2
|
|
1553
|
+
* `auth: { kind: "oauth2" }` shape signals an authorization-code / user-redirect
|
|
1554
|
+
* flow; using it here would cause the host UI to render an OAuth consent button
|
|
1555
|
+
* that goes nowhere. Client-credentials is a purely server-side flow.
|
|
1556
|
+
*/
|
|
1557
|
+
declare const oauth2ClientCredentialsType: Readonly<{
|
|
1558
|
+
definition: Readonly<{
|
|
1559
|
+
typeId: CredentialTypeId;
|
|
1560
|
+
displayName: string;
|
|
1561
|
+
description?: string;
|
|
1562
|
+
publicFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1563
|
+
secretFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1564
|
+
advancedSection?: CredentialAdvancedSectionPresentation;
|
|
1565
|
+
supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
|
|
1566
|
+
auth?: CredentialAuthDefinition;
|
|
1567
|
+
}>;
|
|
1568
|
+
createSession: CredentialSessionFactory<{
|
|
1569
|
+
tokenUrl: unknown;
|
|
1570
|
+
scopes: unknown;
|
|
1571
|
+
audience: unknown;
|
|
1572
|
+
}, {
|
|
1573
|
+
clientId: unknown;
|
|
1574
|
+
clientSecret: unknown;
|
|
1575
|
+
}, CredentialSession>;
|
|
1576
|
+
test: CredentialHealthTester<{
|
|
1577
|
+
tokenUrl: unknown;
|
|
1578
|
+
scopes: unknown;
|
|
1579
|
+
audience: unknown;
|
|
1580
|
+
}, {
|
|
1581
|
+
clientId: unknown;
|
|
1582
|
+
clientSecret: unknown;
|
|
1583
|
+
}>;
|
|
1584
|
+
}> & {
|
|
1585
|
+
readonly key: string;
|
|
1586
|
+
};
|
|
1587
|
+
//#endregion
|
|
1588
|
+
//#region src/authoring/defineRestNode.types.d.ts
|
|
1589
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
1590
|
+
/**
|
|
1591
|
+
* API endpoint descriptor.
|
|
1592
|
+
*/
|
|
1593
|
+
type RestNodeApi = Readonly<{
|
|
1594
|
+
/**
|
|
1595
|
+
* Base URL, e.g. `"https://api.slack.com"`.
|
|
1596
|
+
*/
|
|
1597
|
+
baseUrl: string;
|
|
1598
|
+
/**
|
|
1599
|
+
* Path relative to `baseUrl`. May contain `{paramName}` placeholders that
|
|
1600
|
+
* are substituted from `input` keys before the request is made.
|
|
1601
|
+
* Example: `"/users/{userId}/profile"`
|
|
1602
|
+
*/
|
|
1603
|
+
path: string;
|
|
1604
|
+
/** HTTP method (default: GET). */
|
|
1605
|
+
method?: string;
|
|
1606
|
+
}>;
|
|
1607
|
+
/**
|
|
1608
|
+
* The HTTP result shape passed into the `response` mapper.
|
|
1609
|
+
*/
|
|
1610
|
+
type RestNodeResponseContext = Readonly<{
|
|
1611
|
+
status: number;
|
|
1612
|
+
ok: boolean;
|
|
1613
|
+
statusText: string;
|
|
1614
|
+
mimeType: string;
|
|
1615
|
+
headers: Readonly<Record<string, string>>;
|
|
1616
|
+
json?: unknown;
|
|
1617
|
+
text?: string;
|
|
1618
|
+
}>;
|
|
1619
|
+
/**
|
|
1620
|
+
* What the `request` callback may return to customise the request.
|
|
1621
|
+
*/
|
|
1622
|
+
type RestNodeRequestShape = Readonly<{
|
|
1623
|
+
/** Additional path parameters to substitute (merged with `input`). */
|
|
1624
|
+
pathParams?: Readonly<Record<string, string>>;
|
|
1625
|
+
/** Extra query params. */
|
|
1626
|
+
query?: Readonly<Record<string, string>>;
|
|
1627
|
+
/** Extra headers. */
|
|
1628
|
+
headers?: Readonly<Record<string, string>>;
|
|
1629
|
+
/** Request body. */
|
|
1630
|
+
body?: HttpBodySpec;
|
|
1631
|
+
}>;
|
|
1632
|
+
/**
|
|
1633
|
+
* Error handling policy for non-2xx responses.
|
|
1634
|
+
* - `"throw"` (default) — throws an `Error` for non-2xx responses.
|
|
1635
|
+
* - `"passthrough"` — returns the result regardless of status.
|
|
1636
|
+
*/
|
|
1637
|
+
type RestNodeErrorPolicy = "throw" | "passthrough";
|
|
1638
|
+
interface DefineRestNodeOptions<TKey$1 extends string, TCredentials extends DefinedNodeCredentialBindings | undefined, TInputJson$1, TOutputJson$1> {
|
|
1639
|
+
readonly key: TKey$1;
|
|
1640
|
+
readonly title: string;
|
|
1641
|
+
readonly description?: string;
|
|
1642
|
+
readonly icon?: string;
|
|
1643
|
+
readonly api: RestNodeApi;
|
|
1644
|
+
/**
|
|
1645
|
+
* Credential bindings keyed by slot. Use the built-in credential types from
|
|
1646
|
+
* `@codemation/core-nodes` (e.g. `bearerTokenCredentialType`) or any custom one.
|
|
1647
|
+
* The slot key must match what the `request` callback's context uses.
|
|
1648
|
+
*/
|
|
1649
|
+
readonly credentials?: TCredentials;
|
|
1650
|
+
/**
|
|
1651
|
+
* Zod schema for per-item input. Validated before `execute`.
|
|
1652
|
+
*/
|
|
1653
|
+
readonly inputSchema?: ZodType<TInputJson$1>;
|
|
1654
|
+
/**
|
|
1655
|
+
* Builds the per-request customisations from the item input.
|
|
1656
|
+
* Return `body`, `query`, `headers`, and/or `pathParams`.
|
|
1657
|
+
*/
|
|
1658
|
+
request?(context: Readonly<{
|
|
1659
|
+
input: TInputJson$1;
|
|
1660
|
+
}>): MaybePromise<RestNodeRequestShape>;
|
|
1661
|
+
/**
|
|
1662
|
+
* Maps the HTTP response to the node's output JSON.
|
|
1663
|
+
* When omitted, the output is `{ status, ok, statusText, mimeType, headers, json, text }`.
|
|
1664
|
+
*/
|
|
1665
|
+
response?(context: RestNodeResponseContext & Readonly<{
|
|
1666
|
+
input: TInputJson$1;
|
|
1667
|
+
}>): MaybePromise<TOutputJson$1>;
|
|
1668
|
+
/**
|
|
1669
|
+
* How to handle non-2xx responses.
|
|
1670
|
+
* @default "throw"
|
|
1671
|
+
*/
|
|
1672
|
+
readonly errorPolicy?: RestNodeErrorPolicy;
|
|
1673
|
+
}
|
|
1674
|
+
/**
|
|
1675
|
+
* Declarative helper for creating thin API-wrapper nodes.
|
|
1676
|
+
*
|
|
1677
|
+
* Usage:
|
|
1678
|
+
* ```ts
|
|
1679
|
+
* export const postMessage = defineRestNode({
|
|
1680
|
+
* key: "slack.post-message",
|
|
1681
|
+
* title: "Send Slack message",
|
|
1682
|
+
* icon: "si:slack",
|
|
1683
|
+
* api: { baseUrl: "https://slack.com/api", path: "/chat.postMessage", method: "POST" },
|
|
1684
|
+
* credentials: { auth: bearerTokenCredentialType },
|
|
1685
|
+
* inputSchema: z.object({ channel: z.string(), text: z.string() }),
|
|
1686
|
+
* request: ({ input }) => ({
|
|
1687
|
+
* body: { kind: "json", data: { channel: input.channel, text: input.text } },
|
|
1688
|
+
* }),
|
|
1689
|
+
* response: ({ json }) => ({ messageTs: (json as any).ts }),
|
|
1690
|
+
* });
|
|
1691
|
+
* ```
|
|
1692
|
+
*
|
|
1693
|
+
* - `defineRestNode` is a thin wrapper over `defineNode`; it does not introduce a new runtime kind.
|
|
1694
|
+
* - Credential sessions are resolved via the `credentials` binding map (same as `defineNode`).
|
|
1695
|
+
* - Path `{placeholder}` substitution is applied from `input` keys before the request is made.
|
|
1696
|
+
* - Non-2xx responses throw an `Error` by default (`errorPolicy: "throw"`).
|
|
1697
|
+
*/
|
|
1698
|
+
declare function defineRestNode<TKey$1 extends string, TCredentials extends DefinedNodeCredentialBindings | undefined, TInputJson$1, TOutputJson$1 = RestNodeResponseContext>(options: DefineRestNodeOptions<TKey$1, TCredentials, TInputJson$1, TOutputJson$1>): DefinedNode<TKey$1, Record<string, never>, TInputJson$1, TOutputJson$1, TCredentials>;
|
|
1699
|
+
//#endregion
|
|
1120
1700
|
//#region src/chatModels/openAiChatModelConfig.d.ts
|
|
1121
1701
|
declare class OpenAIChatModelConfig implements ChatModelConfig {
|
|
1122
1702
|
readonly name: string;
|
|
@@ -1630,6 +2210,52 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
|
|
|
1630
2210
|
private extractErrorDetails;
|
|
1631
2211
|
}
|
|
1632
2212
|
//#endregion
|
|
2213
|
+
//#region src/nodes/AssertionNode.d.ts
|
|
2214
|
+
/**
|
|
2215
|
+
* Runs the author's `assertions` callback for each input item and emits one workflow `Item` per
|
|
2216
|
+
* returned {@link AssertionResult} on `main`. Persistence is handled by a host-side subscriber
|
|
2217
|
+
* to `nodeCompleted` events that filters on `config.emitsAssertions === true`; this node does
|
|
2218
|
+
* not write to any store on its own.
|
|
2219
|
+
*
|
|
2220
|
+
* If the author callback throws, we emit a single synthetic AssertionResult with `errored: true`
|
|
2221
|
+
* and `score: 0`. Without this catch the whole node would fail and no assertion row would be
|
|
2222
|
+
* persisted — making the rollup blind to "the assertion code itself is broken." The synthetic
|
|
2223
|
+
* row keeps `failedAssertionsByRunId` consistent and gives the UI something to surface.
|
|
2224
|
+
*/
|
|
2225
|
+
declare class AssertionNode implements RunnableNode<Assertion<any>> {
|
|
2226
|
+
kind: "node";
|
|
2227
|
+
outputPorts: readonly ["main"];
|
|
2228
|
+
execute(args: RunnableNodeExecuteArgs<Assertion<any>>): Promise<unknown>;
|
|
2229
|
+
}
|
|
2230
|
+
//#endregion
|
|
2231
|
+
//#region src/nodes/assertion.d.ts
|
|
2232
|
+
interface AssertionOptions<TInputJson$1> {
|
|
2233
|
+
readonly name?: string;
|
|
2234
|
+
readonly id?: string;
|
|
2235
|
+
readonly icon?: string;
|
|
2236
|
+
/**
|
|
2237
|
+
* Author callback. Returns one or more {@link AssertionResult}s per input item. Each becomes
|
|
2238
|
+
* one emitted output item — useful for per-row reporting in the Tests tab. Return `[]` to
|
|
2239
|
+
* emit nothing for this case (rare; usually you want at least a "no-op" pass).
|
|
2240
|
+
*/
|
|
2241
|
+
assertions(item: Item<TInputJson$1>, ctx: NodeExecutionContext<Assertion<TInputJson$1>>): Promise<ReadonlyArray<AssertionResult>> | ReadonlyArray<AssertionResult>;
|
|
2242
|
+
}
|
|
2243
|
+
/**
|
|
2244
|
+
* Generic assertion node — the "callback" form. For declarative shorthands (StringEquals,
|
|
2245
|
+
* JudgeByAgent) compose this with helpers added in later phases. Sets `emitsAssertions: true`
|
|
2246
|
+
* so host-side persisters know to record its outputs as `TestAssertion` rows.
|
|
2247
|
+
*/
|
|
2248
|
+
declare class Assertion<TInputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, AssertionResult> {
|
|
2249
|
+
readonly kind: "node";
|
|
2250
|
+
readonly type: TypeToken<unknown>;
|
|
2251
|
+
readonly icon: string;
|
|
2252
|
+
readonly name: string;
|
|
2253
|
+
readonly id?: string;
|
|
2254
|
+
readonly emitsAssertions: true;
|
|
2255
|
+
readonly assertions: AssertionOptions<TInputJson$1>["assertions"];
|
|
2256
|
+
constructor(options: AssertionOptions<TInputJson$1>);
|
|
2257
|
+
}
|
|
2258
|
+
//#endregion
|
|
1633
2259
|
//#region src/nodes/CallbackNode.d.ts
|
|
1634
2260
|
declare class CallbackNode implements RunnableNode<Callback<any, any>> {
|
|
1635
2261
|
kind: "node";
|
|
@@ -1674,10 +2300,12 @@ declare class HttpRequestNode implements RunnableNode<HttpRequest<any, any>> {
|
|
|
1674
2300
|
readonly outputPorts: readonly ["main"];
|
|
1675
2301
|
execute(args: RunnableNodeExecuteArgs<HttpRequest<any, any>>): Promise<unknown>;
|
|
1676
2302
|
private executeItem;
|
|
2303
|
+
private resolveCredential;
|
|
1677
2304
|
private resolveUrl;
|
|
1678
2305
|
private asRecord;
|
|
1679
2306
|
private readHeaders;
|
|
1680
2307
|
private resolveMimeType;
|
|
2308
|
+
private isJsonMimeType;
|
|
1681
2309
|
private shouldAttachBody;
|
|
1682
2310
|
private resolveFilename;
|
|
1683
2311
|
private readFilenameFromContentDisposition;
|
|
@@ -1694,15 +2322,41 @@ type HttpRequestOutputJson = Readonly<{
|
|
|
1694
2322
|
statusText: string;
|
|
1695
2323
|
mimeType: string;
|
|
1696
2324
|
headers: Readonly<Record<string, string>>;
|
|
2325
|
+
json?: unknown;
|
|
2326
|
+
text?: string;
|
|
1697
2327
|
bodyBinaryName?: string;
|
|
1698
2328
|
}>;
|
|
2329
|
+
/**
|
|
2330
|
+
* The built-in HTTP request credential type IDs accepted by the `HttpRequest` node.
|
|
2331
|
+
* These match the four generic credential types shipped with `@codemation/core-nodes`.
|
|
2332
|
+
*/
|
|
2333
|
+
declare const HTTP_REQUEST_ACCEPTED_CREDENTIAL_TYPES: ReadonlyArray<string>;
|
|
1699
2334
|
declare class HttpRequest<TInputJson$1 = Readonly<{
|
|
1700
2335
|
url?: string;
|
|
1701
2336
|
}>, TOutputJson$1 = HttpRequestOutputJson> implements RunnableNodeConfig<TInputJson$1, TOutputJson$1> {
|
|
1702
2337
|
readonly name: string;
|
|
1703
2338
|
readonly args: Readonly<{
|
|
2339
|
+
/** HTTP method (default: GET). */
|
|
1704
2340
|
method?: string;
|
|
2341
|
+
/**
|
|
2342
|
+
* Legacy: field name on item.json to read the URL from.
|
|
2343
|
+
* Use `url` for a literal/templated URL instead.
|
|
2344
|
+
*/
|
|
1705
2345
|
urlField?: string;
|
|
2346
|
+
/** Literal or templated URL. When present, takes precedence over `urlField`. */
|
|
2347
|
+
url?: string;
|
|
2348
|
+
/** Extra headers to add to every request. */
|
|
2349
|
+
headers?: Readonly<Record<string, string>>;
|
|
2350
|
+
/** Query parameters to append to the URL. */
|
|
2351
|
+
query?: Readonly<Record<string, string>>;
|
|
2352
|
+
/** Request body specification. For canvas use, pass a JSON string in `body.data`. */
|
|
2353
|
+
body?: HttpBodySpec;
|
|
2354
|
+
/**
|
|
2355
|
+
* Credential slot key. When set, the node resolves a credential via
|
|
2356
|
+
* `ctx.getCredential(credentialSlot)` and applies it to the request.
|
|
2357
|
+
* The slot must be declared in `getCredentialRequirements()`.
|
|
2358
|
+
*/
|
|
2359
|
+
credentialSlot?: string;
|
|
1706
2360
|
binaryName?: string;
|
|
1707
2361
|
downloadMode?: HttpRequestDownloadMode;
|
|
1708
2362
|
id?: string;
|
|
@@ -1715,8 +2369,27 @@ declare class HttpRequest<TInputJson$1 = Readonly<{
|
|
|
1715
2369
|
};
|
|
1716
2370
|
readonly icon: "lucide:globe";
|
|
1717
2371
|
constructor(name: string, args?: Readonly<{
|
|
2372
|
+
/** HTTP method (default: GET). */
|
|
1718
2373
|
method?: string;
|
|
2374
|
+
/**
|
|
2375
|
+
* Legacy: field name on item.json to read the URL from.
|
|
2376
|
+
* Use `url` for a literal/templated URL instead.
|
|
2377
|
+
*/
|
|
1719
2378
|
urlField?: string;
|
|
2379
|
+
/** Literal or templated URL. When present, takes precedence over `urlField`. */
|
|
2380
|
+
url?: string;
|
|
2381
|
+
/** Extra headers to add to every request. */
|
|
2382
|
+
headers?: Readonly<Record<string, string>>;
|
|
2383
|
+
/** Query parameters to append to the URL. */
|
|
2384
|
+
query?: Readonly<Record<string, string>>;
|
|
2385
|
+
/** Request body specification. For canvas use, pass a JSON string in `body.data`. */
|
|
2386
|
+
body?: HttpBodySpec;
|
|
2387
|
+
/**
|
|
2388
|
+
* Credential slot key. When set, the node resolves a credential via
|
|
2389
|
+
* `ctx.getCredential(credentialSlot)` and applies it to the request.
|
|
2390
|
+
* The slot must be declared in `getCredentialRequirements()`.
|
|
2391
|
+
*/
|
|
2392
|
+
credentialSlot?: string;
|
|
1720
2393
|
binaryName?: string;
|
|
1721
2394
|
downloadMode?: HttpRequestDownloadMode;
|
|
1722
2395
|
id?: string;
|
|
@@ -1726,6 +2399,7 @@ declare class HttpRequest<TInputJson$1 = Readonly<{
|
|
|
1726
2399
|
get urlField(): string;
|
|
1727
2400
|
get binaryName(): string;
|
|
1728
2401
|
get downloadMode(): HttpRequestDownloadMode;
|
|
2402
|
+
getCredentialRequirements(): ReadonlyArray<CredentialRequirement>;
|
|
1729
2403
|
}
|
|
1730
2404
|
//#endregion
|
|
1731
2405
|
//#region src/nodes/AggregateNode.d.ts
|
|
@@ -1792,6 +2466,38 @@ declare class If<TInputJson$1 = unknown> implements RunnableNodeConfig<TInputJso
|
|
|
1792
2466
|
constructor(name: string, predicate: (item: Item<TInputJson$1>, index: number, items: Items<TInputJson$1>, ctx: NodeExecutionContext<If<TInputJson$1>>) => boolean, id?: string | undefined);
|
|
1793
2467
|
}
|
|
1794
2468
|
//#endregion
|
|
2469
|
+
//#region src/nodes/IsTestRunNode.d.ts
|
|
2470
|
+
/**
|
|
2471
|
+
* Routes each item to the `true` port if `ctx.testContext` is set (the run was started by the
|
|
2472
|
+
* TestSuiteOrchestrator), else to `false`. Lets workflow authors guard real side-effects:
|
|
2473
|
+
*
|
|
2474
|
+
* GmailTrigger / TestTrigger → ClassifyAgent → IsTestRun
|
|
2475
|
+
* ├── true → AssertionNode
|
|
2476
|
+
* └── false → SendReply
|
|
2477
|
+
*/
|
|
2478
|
+
declare class IsTestRunNode implements RunnableNode<IsTestRun<unknown>> {
|
|
2479
|
+
kind: "node";
|
|
2480
|
+
execute(args: RunnableNodeExecuteArgs<IsTestRun<unknown>>): unknown;
|
|
2481
|
+
}
|
|
2482
|
+
//#endregion
|
|
2483
|
+
//#region src/nodes/isTestRun.d.ts
|
|
2484
|
+
/**
|
|
2485
|
+
* Branches per-item on whether the current run is a test run. Output ports: `true`, `false`.
|
|
2486
|
+
* The wire payload is unchanged — this is a router, not a transform.
|
|
2487
|
+
*/
|
|
2488
|
+
declare class IsTestRun<TInputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, TInputJson$1> {
|
|
2489
|
+
readonly kind: "node";
|
|
2490
|
+
readonly type: TypeToken<unknown>;
|
|
2491
|
+
readonly execution: {
|
|
2492
|
+
readonly hint: "local";
|
|
2493
|
+
};
|
|
2494
|
+
readonly icon: "lucide:flask-conical";
|
|
2495
|
+
readonly declaredOutputPorts: readonly ["true", "false"];
|
|
2496
|
+
readonly name: string;
|
|
2497
|
+
readonly id?: string;
|
|
2498
|
+
constructor(name?: string, id?: string);
|
|
2499
|
+
}
|
|
2500
|
+
//#endregion
|
|
1795
2501
|
//#region src/nodes/SwitchNode.d.ts
|
|
1796
2502
|
/**
|
|
1797
2503
|
* Routes each item to exactly one output port. Port names must match workflow edges (see {@link Switch} config).
|
|
@@ -1852,6 +2558,45 @@ declare class Split<TIn = unknown, TElem = unknown> implements RunnableNodeConfi
|
|
|
1852
2558
|
constructor(name: string, getElements: (item: Item<TIn>, ctx: NodeExecutionContext<Split<TIn, TElem>>) => readonly TElem[], id?: string | undefined);
|
|
1853
2559
|
}
|
|
1854
2560
|
//#endregion
|
|
2561
|
+
//#region src/nodes/CronTriggerFactory.d.ts
|
|
2562
|
+
type CronTickJson = {
|
|
2563
|
+
firedAt: string;
|
|
2564
|
+
scheduledFor: string;
|
|
2565
|
+
};
|
|
2566
|
+
/**
|
|
2567
|
+
* Schedules a workflow on a standard cron expression.
|
|
2568
|
+
*
|
|
2569
|
+
* Each tick emits one item: `{ firedAt: string, scheduledFor: string }` — both ISO-8601 timestamps.
|
|
2570
|
+
* `firedAt` is the wall-clock moment the callback ran; `scheduledFor` is the cron-computed
|
|
2571
|
+
* firing instant (these differ when the job was delayed).
|
|
2572
|
+
*
|
|
2573
|
+
* Timezone defaults to UTC when omitted — cron without an explicit TZ is a DST footgun.
|
|
2574
|
+
*/
|
|
2575
|
+
declare class CronTrigger implements TriggerNodeConfig<CronTickJson> {
|
|
2576
|
+
readonly name: string;
|
|
2577
|
+
private readonly args;
|
|
2578
|
+
readonly kind: "trigger";
|
|
2579
|
+
readonly type: TypeToken<unknown>;
|
|
2580
|
+
readonly icon: "lucide:clock";
|
|
2581
|
+
readonly id?: string;
|
|
2582
|
+
constructor(name: string, args: Readonly<{
|
|
2583
|
+
schedule: string;
|
|
2584
|
+
timezone?: string;
|
|
2585
|
+
}>, id?: string);
|
|
2586
|
+
get schedule(): string;
|
|
2587
|
+
get timezone(): string | undefined;
|
|
2588
|
+
createJob(callback: CronCallback): Cron;
|
|
2589
|
+
}
|
|
2590
|
+
//#endregion
|
|
2591
|
+
//#region src/nodes/CronTriggerNode.d.ts
|
|
2592
|
+
declare class CronTriggerNode implements TestableTriggerNode<CronTrigger> {
|
|
2593
|
+
readonly kind: "trigger";
|
|
2594
|
+
readonly outputPorts: readonly ["main"];
|
|
2595
|
+
setup(ctx: TriggerSetupContext<CronTrigger>): Promise<undefined>;
|
|
2596
|
+
execute(items: Items, _ctx: NodeExecutionContext<CronTrigger>): Promise<NodeOutputs>;
|
|
2597
|
+
getTestItems(ctx: TriggerTestItemsContext<CronTrigger>): Promise<Items>;
|
|
2598
|
+
}
|
|
2599
|
+
//#endregion
|
|
1855
2600
|
//#region src/nodes/ManualTriggerNode.d.ts
|
|
1856
2601
|
/**
|
|
1857
2602
|
* Setup is intentionally a no-op: the engine host can run workflows manually
|
|
@@ -1992,6 +2737,71 @@ declare class SubWorkflow<TInputJson$1 = unknown, TOutputJson$1 = unknown> imple
|
|
|
1992
2737
|
} | UpstreamRefPlaceholder> | undefined, startAt?: NodeId | undefined, id?: string | undefined);
|
|
1993
2738
|
}
|
|
1994
2739
|
//#endregion
|
|
2740
|
+
//#region src/nodes/TestTriggerNode.d.ts
|
|
2741
|
+
/**
|
|
2742
|
+
* Author-defined test-fixture trigger. Live activation skips this trigger (filtered by
|
|
2743
|
+
* `triggerKind === "test"` in `TriggerRuntimeService`); the `TestSuiteOrchestrator` drives its
|
|
2744
|
+
* `generateItems` callback during a TestSuiteRun and dispatches one workflow run per yielded item.
|
|
2745
|
+
*
|
|
2746
|
+
* `setup` is intentionally a no-op for symmetry with other trigger nodes — the real work happens
|
|
2747
|
+
* in the orchestrator. `execute` is a passthrough so items provided to `engine.runWorkflow(...)`
|
|
2748
|
+
* (one per case) flow downstream unchanged on `main`.
|
|
2749
|
+
*/
|
|
2750
|
+
declare class TestTriggerNode implements TriggerNode<TestTriggerNodeConfig<any>> {
|
|
2751
|
+
kind: "trigger";
|
|
2752
|
+
outputPorts: readonly ["main"];
|
|
2753
|
+
setup(_ctx: TriggerSetupContext<TestTriggerNodeConfig<any>>): Promise<undefined>;
|
|
2754
|
+
execute(items: Items, _ctx: NodeExecutionContext<TestTriggerNodeConfig<any>>): Promise<NodeOutputs>;
|
|
2755
|
+
}
|
|
2756
|
+
//#endregion
|
|
2757
|
+
//#region src/nodes/testTrigger.d.ts
|
|
2758
|
+
interface TestTriggerOptions<TOutputJson$1> {
|
|
2759
|
+
readonly name?: string;
|
|
2760
|
+
readonly id?: string;
|
|
2761
|
+
readonly icon?: string;
|
|
2762
|
+
/** Cap on simultaneous in-flight test cases for one suite run. Default: 4 (orchestrator). */
|
|
2763
|
+
readonly concurrency?: number;
|
|
2764
|
+
readonly credentialRequirements?: ReadonlyArray<CredentialRequirement>;
|
|
2765
|
+
/**
|
|
2766
|
+
* Free-form description of where the test cases come from. Shown in the node properties
|
|
2767
|
+
* panel and the Tests-tab suite-detail header so authors revisiting the workflow six months
|
|
2768
|
+
* later remember which mailbox / folder / fixture file the cases originate from.
|
|
2769
|
+
*/
|
|
2770
|
+
readonly description?: string;
|
|
2771
|
+
/**
|
|
2772
|
+
* Author callback that yields one item per test case. Items are dispatched as separate
|
|
2773
|
+
* workflow runs by the TestSuiteOrchestrator, with `executionOptions.testContext` set.
|
|
2774
|
+
* The provided context exposes credential resolution and an AbortSignal for cancellation.
|
|
2775
|
+
*/
|
|
2776
|
+
generateItems(ctx: TestTriggerSetupContext<TestTrigger<TOutputJson$1>>): AsyncIterable<Item<TOutputJson$1>>;
|
|
2777
|
+
/**
|
|
2778
|
+
* Optional resolver: extract a human-readable label from a yielded item. The orchestrator
|
|
2779
|
+
* persists this on the run, so the Tests-tab tree-table shows e.g. "RFQ for batch 14"
|
|
2780
|
+
* instead of an opaque runId. Typical use: `(item) => item.json.subject` for mailbox tests.
|
|
2781
|
+
*/
|
|
2782
|
+
caseLabel?(item: Item<TOutputJson$1>): string | undefined;
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* Trigger config for a test fixture source. Drop one (or more) of these on the canvas alongside
|
|
2786
|
+
* a workflow's live triggers; clicking "Run tests" on the Tests tab invokes
|
|
2787
|
+
* {@link TestTriggerOptions.generateItems} via the TestSuiteOrchestrator.
|
|
2788
|
+
*/
|
|
2789
|
+
declare class TestTrigger<TOutputJson$1 = unknown> implements TestTriggerNodeConfig<TOutputJson$1> {
|
|
2790
|
+
readonly kind: "trigger";
|
|
2791
|
+
readonly triggerKind: "test";
|
|
2792
|
+
readonly type: TypeToken<unknown>;
|
|
2793
|
+
readonly icon: string;
|
|
2794
|
+
readonly name: string;
|
|
2795
|
+
readonly id?: string;
|
|
2796
|
+
readonly concurrency?: number;
|
|
2797
|
+
readonly description?: string;
|
|
2798
|
+
readonly generateItems: TestTriggerOptions<TOutputJson$1>["generateItems"];
|
|
2799
|
+
readonly caseLabel?: TestTriggerOptions<TOutputJson$1>["caseLabel"];
|
|
2800
|
+
private readonly credentialRequirements;
|
|
2801
|
+
constructor(options: TestTriggerOptions<TOutputJson$1>);
|
|
2802
|
+
getCredentialRequirements(): ReadonlyArray<CredentialRequirement>;
|
|
2803
|
+
}
|
|
2804
|
+
//#endregion
|
|
1995
2805
|
//#region src/nodes/WaitDurationFactory.d.ts
|
|
1996
2806
|
declare class WaitDuration {
|
|
1997
2807
|
static normalize(milliseconds: number): number;
|
|
@@ -2236,5 +3046,67 @@ declare class AIAgentConnectionWorkflowExpander {
|
|
|
2236
3046
|
private assertNoIdCollision;
|
|
2237
3047
|
}
|
|
2238
3048
|
//#endregion
|
|
2239
|
-
|
|
3049
|
+
//#region src/nodes/collections/collectionInsertNode.types.d.ts
|
|
3050
|
+
declare const collectionInsertNode: DefinedNode<"collection-insert", {
|
|
3051
|
+
collectionName: string;
|
|
3052
|
+
data: Record<string, unknown>;
|
|
3053
|
+
}, unknown, Record<string, unknown> & {
|
|
3054
|
+
id: string;
|
|
3055
|
+
created_at: Date;
|
|
3056
|
+
updated_at: Date;
|
|
3057
|
+
}, undefined>;
|
|
3058
|
+
//#endregion
|
|
3059
|
+
//#region src/nodes/collections/collectionGetNode.types.d.ts
|
|
3060
|
+
declare const collectionGetNode: DefinedNode<"collection-get", {
|
|
3061
|
+
collectionName: string;
|
|
3062
|
+
id: string;
|
|
3063
|
+
}, unknown, never[] | (Record<string, unknown> & {
|
|
3064
|
+
id: string;
|
|
3065
|
+
created_at: Date;
|
|
3066
|
+
updated_at: Date;
|
|
3067
|
+
}), undefined>;
|
|
3068
|
+
//#endregion
|
|
3069
|
+
//#region src/nodes/collections/collectionFindOneNode.types.d.ts
|
|
3070
|
+
declare const collectionFindOneNode: DefinedNode<"collection-find-one", {
|
|
3071
|
+
collectionName: string;
|
|
3072
|
+
where: Record<string, unknown>;
|
|
3073
|
+
}, unknown, never[] | (Record<string, unknown> & {
|
|
3074
|
+
id: string;
|
|
3075
|
+
created_at: Date;
|
|
3076
|
+
updated_at: Date;
|
|
3077
|
+
}), undefined>;
|
|
3078
|
+
//#endregion
|
|
3079
|
+
//#region src/nodes/collections/collectionListNode.types.d.ts
|
|
3080
|
+
declare const collectionListNode: DefinedNode<"collection-list", {
|
|
3081
|
+
collectionName: string;
|
|
3082
|
+
limit?: number | undefined;
|
|
3083
|
+
offset?: number | undefined;
|
|
3084
|
+
where?: Record<string, unknown> | undefined;
|
|
3085
|
+
}, unknown, (Record<string, unknown> & {
|
|
3086
|
+
id: string;
|
|
3087
|
+
created_at: Date;
|
|
3088
|
+
updated_at: Date;
|
|
3089
|
+
})[], undefined>;
|
|
3090
|
+
//#endregion
|
|
3091
|
+
//#region src/nodes/collections/collectionUpdateNode.types.d.ts
|
|
3092
|
+
declare const collectionUpdateNode: DefinedNode<"collection-update", {
|
|
3093
|
+
collectionName: string;
|
|
3094
|
+
id: string;
|
|
3095
|
+
patch: Record<string, unknown>;
|
|
3096
|
+
}, unknown, Record<string, unknown> & {
|
|
3097
|
+
id: string;
|
|
3098
|
+
created_at: Date;
|
|
3099
|
+
updated_at: Date;
|
|
3100
|
+
}, undefined>;
|
|
3101
|
+
//#endregion
|
|
3102
|
+
//#region src/nodes/collections/collectionDeleteNode.types.d.ts
|
|
3103
|
+
declare const collectionDeleteNode: DefinedNode<"collection-delete", {
|
|
3104
|
+
collectionName: string;
|
|
3105
|
+
id: string;
|
|
3106
|
+
}, unknown, {
|
|
3107
|
+
deleted: boolean;
|
|
3108
|
+
id: string;
|
|
3109
|
+
}, undefined>;
|
|
3110
|
+
//#endregion
|
|
3111
|
+
export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentStructuredOutputRepairPromptFactory, AgentStructuredOutputRunner, AgentToolCallPortMap, AgentToolErrorClassifier, AgentToolExecutionCoordinator, AgentToolRepairExhaustedError, AgentToolRepairPolicy, Aggregate, AggregateNode, Assertion, AssertionNode, AssertionOptions, BinaryRef, Callback, CallbackHandler, CallbackNode, CallbackOptions, CallbackResultNormalizer, CanvasIconName, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, CredentialSession, CronTickJson, CronTrigger, CronTriggerNode, DefineRestNodeOptions, ExecutedToolCall, Filter, FilterNode, HTTP_REQUEST_ACCEPTED_CREDENTIAL_TYPES, HttpBodySpec, HttpCredentialDelta, HttpRequest, HttpRequestDownloadMode, HttpRequestNode, HttpRequestOutputJson, HttpRequestResult, HttpRequestSpec, If, IfNode, IsTestRun, IsTestRunNode, ItemScopedToolBinding, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, MapDataOptions, Merge, MergeMode, MergeNode, NoOp, NoOpNode, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAiChatModelPresets, OpenAiCredentialSession, OpenAiStrictJsonSchemaFactory, PlannedToolCall, ResolvedTool, RestNodeApi, RestNodeErrorPolicy, RestNodeRequestShape, RestNodeResponseContext, Split, SplitNode, SubWorkflow, SubWorkflowNode, Switch, SwitchCaseKeyResolver, SwitchNode, TestTrigger, TestTriggerNode, TestTriggerOptions, Wait, WaitDuration, WaitNode, WebhookRespondNowAndContinueError, WebhookRespondNowError, WebhookTrigger, WebhookTriggerNode, type WorkflowAgentMessages, type WorkflowAgentOptions, WorkflowAuthoringBuilder, WorkflowBranchBuilder, WorkflowChain, apiKeyCredentialType, basicAuthCredentialType, bearerTokenCredentialType, collectionDeleteNode, collectionFindOneNode, collectionGetNode, collectionInsertNode, collectionListNode, collectionUpdateNode, createWorkflowBuilder, defineRestNode, oauth2ClientCredentialsType, openAiChatModelPresets, registerCoreNodes, workflow };
|
|
2240
3112
|
//# sourceMappingURL=index.d.cts.map
|