@oomol-lab/open-flow 0.1.0-beta.69 → 0.1.0-beta.70
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/dist/browser/{ContentIcon-CsECY5id.js → ContentIcon-CUQHjQIw.js} +16 -8
- package/dist/browser/{FlowCanvas-C5X22xQ7.js → FlowCanvas-CqtUDPGj.js} +11 -26
- package/dist/browser/{createResourceDialog-Di5BBrQv.js → createResourceDialog-BAHYW9yu.js} +3 -3
- package/dist/browser/{dialog-Bjo-r9B0.js → dialog-DcGOzUP2.js} +162 -12
- package/dist/browser/{exportSvg-Cj6Spxx-.js → exportSvg-Dv5Qgrq7.js} +2 -2
- package/dist/browser/flow-authoring.js +95 -12
- package/dist/browser/flow-change-schema.d.ts +24 -1
- package/dist/browser/flow-change.d.ts +33 -4
- package/dist/browser/flow-change.js +96 -13
- package/dist/browser/{flowChanges-Dp-rcEJ6.js → flowChanges-CYyehKer.js} +2593 -2254
- package/dist/browser/{flowWorkspace-CB1QACku.js → flowWorkspace-qYUZPJHR.js} +1114 -392
- package/dist/browser/preview.css +225 -221
- package/dist/browser/preview.js +3781 -2655
- package/dist/browser/{tooltip-CJjYs_2I.js → tooltip-wZJRB9oP.js} +28 -1
- package/dist/browser/ui.css +8 -20
- package/dist/browser/workbench.css +225 -221
- package/dist/browser/workbench.js +31 -10
- package/dist/browser/{workbenchSelect-C3hxUcYm.js → workbenchSelect-D8_vP2p5.js} +2 -2
- package/dist/command/index.js +45 -45
- package/dist/common/authoring.d.ts +3 -3
- package/dist/common/authoringExamples.d.ts +3 -2
- package/dist/common/authoringSchema.d.ts +37 -374
- package/dist/common/control-api-conformance.js +151 -55
- package/dist/common/control-api.d.ts +12 -78
- package/dist/common/control-api.js +162 -39
- package/dist/common/control-requests.d.ts +3 -3
- package/dist/common/control-requests.js +221 -35
- package/dist/common/decision.js +85 -7
- package/dist/common/engine-contract.d.ts +4 -2
- package/dist/common/flow-encoding.js +110 -14
- package/dist/common/flow-graph.d.ts +3 -0
- package/dist/common/flow-semantics.js +273 -14
- package/dist/common/integration-trigger.js +85 -7
- package/dist/common/liveDetails.d.ts +15 -0
- package/dist/common/mcp.d.ts +3 -3
- package/dist/common/mcp.js +134 -38
- package/dist/common/openapi.js +85 -7
- package/dist/common/poll-trigger.js +85 -7
- package/dist/common/run-events.d.ts +2 -0
- package/dist/common/run-events.js +59 -2
- package/dist/common/runtime-contract.js +14 -4
- package/dist/common/scheduler.d.ts +6 -2
- package/dist/common/scheduler.js +178 -11
- package/dist/common/webhook-response.d.ts +43 -0
- package/dist/common/webhook-trigger.d.ts +12 -0
- package/dist/common/webhook-trigger.js +236 -9
- package/dist/common/workflow.js +85 -7
- package/package.json +1 -1
- package/skills/open-flow/references/flow-authoring.md +15 -10
|
@@ -1175,7 +1175,7 @@ function timeSource(args) {
|
|
|
1175
1175
|
function time(args) {
|
|
1176
1176
|
return new RegExp(`^${timeSource(args)}$`);
|
|
1177
1177
|
}
|
|
1178
|
-
function datetime(args) {
|
|
1178
|
+
function datetime$1(args) {
|
|
1179
1179
|
const opts = ["Z"];
|
|
1180
1180
|
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
1181
1181
|
const qualified = `${timeSource({
|
|
@@ -1826,7 +1826,7 @@ var $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
|
|
|
1826
1826
|
$ZodStringFormat.init(inst, def);
|
|
1827
1827
|
});
|
|
1828
1828
|
var $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1829
|
-
def.pattern ?? (def.pattern = datetime(def));
|
|
1829
|
+
def.pattern ?? (def.pattern = datetime$1(def));
|
|
1830
1830
|
$ZodStringFormat.init(inst, def);
|
|
1831
1831
|
});
|
|
1832
1832
|
var $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
@@ -5822,6 +5822,11 @@ function preprocess(fn, schema) {
|
|
|
5822
5822
|
out: schema
|
|
5823
5823
|
});
|
|
5824
5824
|
}
|
|
5825
|
+
//#endregion
|
|
5826
|
+
//#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/iso.js
|
|
5827
|
+
function datetime(params) {
|
|
5828
|
+
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
5829
|
+
}
|
|
5825
5830
|
function checkJsonDepth(value, depth = 0) {
|
|
5826
5831
|
if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
|
|
5827
5832
|
if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
|
|
@@ -5866,6 +5871,32 @@ var triggerScheduleSchema = array(union([object({
|
|
|
5866
5871
|
value: number()
|
|
5867
5872
|
})]));
|
|
5868
5873
|
//#endregion
|
|
5874
|
+
//#region src/localization/common/timeZone.ts
|
|
5875
|
+
/** Validate a named timezone using the same runtime data used for date conversion. */
|
|
5876
|
+
function isTimeZone(value) {
|
|
5877
|
+
try {
|
|
5878
|
+
Intl.DateTimeFormat("en", { timeZone: value });
|
|
5879
|
+
return true;
|
|
5880
|
+
} catch {
|
|
5881
|
+
return false;
|
|
5882
|
+
}
|
|
5883
|
+
}
|
|
5884
|
+
//#endregion
|
|
5885
|
+
//#region src/flow/common/wait.ts
|
|
5886
|
+
/** Drafts retain incomplete values; semantic validation gates publication and execution. */
|
|
5887
|
+
var waitAutoContinueDraftSchema = discriminatedUnion("kind", [strictObject({
|
|
5888
|
+
kind: literal("after"),
|
|
5889
|
+
durationMs: number().nullable()
|
|
5890
|
+
}), strictObject({
|
|
5891
|
+
kind: literal("at"),
|
|
5892
|
+
at: string(),
|
|
5893
|
+
timezone: string().optional()
|
|
5894
|
+
})]);
|
|
5895
|
+
discriminatedUnion("kind", [waitAutoContinueDraftSchema.options[0].extend({ durationMs: number().int().positive().max(Number.MAX_SAFE_INTEGER) }), waitAutoContinueDraftSchema.options[1].extend({
|
|
5896
|
+
at: datetime({ offset: true }),
|
|
5897
|
+
timezone: string().refine(isTimeZone, "Select a valid IANA timezone.").optional()
|
|
5898
|
+
})]);
|
|
5899
|
+
//#endregion
|
|
5869
5900
|
//#region src/flow/common/webhookMethod.ts
|
|
5870
5901
|
var webhookMethods = [
|
|
5871
5902
|
"GET",
|
|
@@ -5874,6 +5905,24 @@ var webhookMethods = [
|
|
|
5874
5905
|
"PATCH",
|
|
5875
5906
|
"DELETE"
|
|
5876
5907
|
];
|
|
5908
|
+
//#endregion
|
|
5909
|
+
//#region src/flow/common/webhookResponse.ts
|
|
5910
|
+
var webhookResponseTimeout = {
|
|
5911
|
+
defaultMs: 3e4,
|
|
5912
|
+
minMs: 1e3,
|
|
5913
|
+
maxMs: 6e4
|
|
5914
|
+
};
|
|
5915
|
+
({
|
|
5916
|
+
jsonSchema: {
|
|
5917
|
+
type: "object",
|
|
5918
|
+
additionalProperties: { type: [
|
|
5919
|
+
"string",
|
|
5920
|
+
"number",
|
|
5921
|
+
"boolean"
|
|
5922
|
+
] }
|
|
5923
|
+
},
|
|
5924
|
+
nullable: true
|
|
5925
|
+
}).jsonSchema;
|
|
5877
5926
|
var text = string();
|
|
5878
5927
|
var actionConnection = text.describe("Account selection: omit while unconfigured; use an account ID to select it; use \"\" to explicitly defer configuration. Deferred Actions fail if called; deferred Agent tools are excluded from the callable tool set. Not supported by Triggers.");
|
|
5879
5928
|
var json = json$1();
|
|
@@ -6101,9 +6150,24 @@ var webhookOptions = object({
|
|
|
6101
6150
|
allowedMethods: never().optional(),
|
|
6102
6151
|
allowedOrigins: strings.optional(),
|
|
6103
6152
|
noResponseBody: never().optional(),
|
|
6153
|
+
responseBody: discriminatedUnion("kind", [strictObject({
|
|
6154
|
+
kind: literal("workflow-outputs"),
|
|
6155
|
+
output: text.optional(),
|
|
6156
|
+
timeoutMs: number().int().min(webhookResponseTimeout.minMs).max(webhookResponseTimeout.maxMs).optional()
|
|
6157
|
+
}), strictObject({
|
|
6158
|
+
kind: literal("webhook-response"),
|
|
6159
|
+
nodeId: text.optional(),
|
|
6160
|
+
timeoutMs: number().int().min(webhookResponseTimeout.minMs).max(webhookResponseTimeout.maxMs).optional()
|
|
6161
|
+
})]).optional(),
|
|
6104
6162
|
responseData: text.optional(),
|
|
6105
6163
|
responseHeaders: record$1(text, text).optional(),
|
|
6106
|
-
|
|
6164
|
+
responseHeadersSource: strictObject({
|
|
6165
|
+
kind: literal("workflow-outputs"),
|
|
6166
|
+
output: text.optional()
|
|
6167
|
+
}).optional(),
|
|
6168
|
+
responseHeaderOutputs: record$1(text, text).optional(),
|
|
6169
|
+
responseStatusCode: number().int().min(200).max(599).optional(),
|
|
6170
|
+
responseStatusCodeOutput: text.optional()
|
|
6107
6171
|
});
|
|
6108
6172
|
var webhook = {
|
|
6109
6173
|
bodyFields: array(input),
|
|
@@ -6158,6 +6222,12 @@ var base = {
|
|
|
6158
6222
|
onError: _enum(["stop", "error"]).optional()
|
|
6159
6223
|
};
|
|
6160
6224
|
var node = union([
|
|
6225
|
+
strictObject({
|
|
6226
|
+
...base,
|
|
6227
|
+
kind: literal("webhook-response"),
|
|
6228
|
+
retry: never().optional(),
|
|
6229
|
+
onError: never().optional()
|
|
6230
|
+
}),
|
|
6161
6231
|
strictObject({
|
|
6162
6232
|
...base,
|
|
6163
6233
|
kind: literal("outputs"),
|
|
@@ -6190,7 +6260,8 @@ var node = union([
|
|
|
6190
6260
|
strictObject({
|
|
6191
6261
|
...base,
|
|
6192
6262
|
kind: literal("wait"),
|
|
6193
|
-
...wait
|
|
6263
|
+
...wait,
|
|
6264
|
+
autoContinue: waitAutoContinueDraftSchema.optional()
|
|
6194
6265
|
}).omit({ timeoutMs: true }),
|
|
6195
6266
|
object({
|
|
6196
6267
|
...trigger,
|
|
@@ -6277,7 +6348,8 @@ var revision = object({
|
|
|
6277
6348
|
literal(6),
|
|
6278
6349
|
literal(7),
|
|
6279
6350
|
literal(8),
|
|
6280
|
-
literal(9)
|
|
6351
|
+
literal(9),
|
|
6352
|
+
literal(10)
|
|
6281
6353
|
]),
|
|
6282
6354
|
document,
|
|
6283
6355
|
modules: record$1(text, module)
|
|
@@ -6410,8 +6482,14 @@ var shapes = {
|
|
|
6410
6482
|
},
|
|
6411
6483
|
"graph.node.resolution.set": {
|
|
6412
6484
|
...at,
|
|
6413
|
-
before:
|
|
6414
|
-
|
|
6485
|
+
before: strictObject({
|
|
6486
|
+
...wait,
|
|
6487
|
+
autoContinue: waitAutoContinueDraftSchema.optional()
|
|
6488
|
+
}),
|
|
6489
|
+
value: strictObject({
|
|
6490
|
+
...wait,
|
|
6491
|
+
autoContinue: waitAutoContinueDraftSchema.optional()
|
|
6492
|
+
})
|
|
6415
6493
|
},
|
|
6416
6494
|
"graph.node.webhook.set": {
|
|
6417
6495
|
...at,
|
|
@@ -6472,12 +6550,14 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
|
|
|
6472
6550
|
...shape
|
|
6473
6551
|
})])).values()])).min(1);
|
|
6474
6552
|
function checkModelVersion(content) {
|
|
6553
|
+
if (content.modelVersion < 10 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "webhook" && (candidateNode.options?.responseBody != null || candidateNode.options?.responseStatusCodeOutput != null || candidateNode.options?.responseHeadersSource != null || candidateNode.options?.responseHeaderOutputs != null))) throw new TypeError("Dynamic Webhook responses require Flow model version 10.");
|
|
6475
6554
|
if (content.modelVersion < 9 && Object.values(content.document.graph.nodes).some((candidateNode) => "retry" in candidateNode && candidateNode.retry != null)) throw new TypeError("Node retries require Flow model version 9.");
|
|
6476
6555
|
if (content.modelVersion < 9 && Object.values(content.document.graph.nodes).some((candidateNode) => {
|
|
6477
6556
|
if (candidateNode.onError != null) return true;
|
|
6478
6557
|
if ([...Object.values("inputs" in candidateNode ? candidateNode.inputs : {}), ...Object.values(candidateNode.kind == "outputs" ? candidateNode.outputMappings : {})].some((candidateMapping) => candidateMapping.kind == "sources" && candidateMapping.sources.some((candidateSource) => candidateSource.kind == "node" && candidateSource.system))) return true;
|
|
6479
6558
|
return candidateNode.kind == "condition" && candidateNode.cases.some((item) => item.groups.some((candidateGroup) => candidateGroup.expressions.some((expression) => [expression.left, expression.right].some((candidateOperand) => candidateOperand?.kind == "source" && candidateOperand.source.kind == "node" && candidateOperand.source.system))));
|
|
6480
6559
|
})) throw new TypeError("Node error handling requires Flow model version 9.");
|
|
6560
|
+
if (content.modelVersion < 10 && Object.values(content.document.graph.nodes).some((candidate) => candidate.kind === "webhook-response")) throw new TypeError("Webhook response nodes require Flow model version 10.");
|
|
6481
6561
|
if (content.modelVersion < 8 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "outputs")) throw new TypeError("Workflow outputs require Flow model version 8.");
|
|
6482
6562
|
if (content.modelVersion < 7 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "start")) throw new TypeError("Start Triggers require Flow model version 7.");
|
|
6483
6563
|
if (content.modelVersion < 6 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task)) throw new TypeError("Node-owned managed Tasks require Flow model version 6.");
|
|
@@ -6673,10 +6753,10 @@ function isTriggerNode(node) {
|
|
|
6673
6753
|
function upgradeDecodedRevisionContent(content) {
|
|
6674
6754
|
const graph = content.document.graph;
|
|
6675
6755
|
const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
|
|
6676
|
-
if (!hasManual && content.modelVersion ==
|
|
6756
|
+
if (!hasManual && content.modelVersion == 10) return content;
|
|
6677
6757
|
return {
|
|
6678
6758
|
...content,
|
|
6679
|
-
modelVersion:
|
|
6759
|
+
modelVersion: 10,
|
|
6680
6760
|
document: {
|
|
6681
6761
|
...content.document,
|
|
6682
6762
|
graph: hasManual ? {
|
|
@@ -6711,7 +6791,7 @@ function invalid(message) {
|
|
|
6711
6791
|
throw new FlowChangeError(message);
|
|
6712
6792
|
}
|
|
6713
6793
|
function applyFlowChanges(content, operations) {
|
|
6714
|
-
const source = content.modelVersion !=
|
|
6794
|
+
const source = content.modelVersion != 10 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
|
|
6715
6795
|
const document = { ...source.document };
|
|
6716
6796
|
const modules = { ...source.modules };
|
|
6717
6797
|
for (const operation of operations) switch (operation.kind) {
|
|
@@ -7027,12 +7107,15 @@ function applyFlowChanges(content, operations) {
|
|
|
7027
7107
|
const node = graph.nodes[operation.nodeId];
|
|
7028
7108
|
if (node?.kind != "wait" && node?.kind != "approval" || !dequal({
|
|
7029
7109
|
inputDefinitions: node.inputDefinitions,
|
|
7030
|
-
prompt: node.prompt
|
|
7110
|
+
prompt: node.prompt,
|
|
7111
|
+
...node.kind == "wait" && node.autoContinue != null ? { autoContinue: node.autoContinue } : {}
|
|
7031
7112
|
}, operation.before)) invalid("The resolution node changed before this operation was applied.");
|
|
7113
|
+
if (node.kind == "approval" && operation.value.autoContinue != null) invalid("Approval does not support automatic continuation.");
|
|
7032
7114
|
const updated = {
|
|
7033
7115
|
...node,
|
|
7034
7116
|
...operation.value
|
|
7035
7117
|
};
|
|
7118
|
+
if (updated.kind == "wait" && operation.value.autoContinue == null) Reflect.deleteProperty(updated, "autoContinue");
|
|
7036
7119
|
document.graph = {
|
|
7037
7120
|
...graph,
|
|
7038
7121
|
nodes: {
|
|
@@ -7156,7 +7239,7 @@ function applyFlowChanges(content, operations) {
|
|
|
7156
7239
|
assertOpenApiAuthBindings(document);
|
|
7157
7240
|
return upgradeDecodedRevisionContent({
|
|
7158
7241
|
document,
|
|
7159
|
-
modelVersion:
|
|
7242
|
+
modelVersion: 10,
|
|
7160
7243
|
modules
|
|
7161
7244
|
});
|
|
7162
7245
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChangeOperation, FlowDocument, JsonValue, RevisionContent } from './flow-change.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
export declare const currentFlowModelVersion =
|
|
3
|
+
export declare const currentFlowModelVersion = 10;
|
|
4
4
|
/** Configuration schemas shared by the node authoring boundary. */
|
|
5
5
|
export declare const authoringDefinitionSchemas: {
|
|
6
6
|
input: z.ZodObject<{
|
|
@@ -117,6 +117,14 @@ export declare const authoringDefinitionSchemas: {
|
|
|
117
117
|
}, z.core.$strip>>;
|
|
118
118
|
prompt: z.ZodString;
|
|
119
119
|
}, z.core.$strict>;
|
|
120
|
+
waitAutoContinue: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
121
|
+
kind: z.ZodLiteral<"after">;
|
|
122
|
+
durationMs: z.ZodNumber;
|
|
123
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
124
|
+
kind: z.ZodLiteral<"at">;
|
|
125
|
+
at: z.ZodISODateTime;
|
|
126
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, z.core.$strict>], "kind">;
|
|
120
128
|
webhook: z.ZodObject<{
|
|
121
129
|
bodyFields: z.ZodArray<z.ZodObject<{
|
|
122
130
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -136,9 +144,24 @@ export declare const authoringDefinitionSchemas: {
|
|
|
136
144
|
allowedMethods: z.ZodOptional<z.ZodNever>;
|
|
137
145
|
allowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
138
146
|
noResponseBody: z.ZodOptional<z.ZodNever>;
|
|
147
|
+
responseBody: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
148
|
+
kind: z.ZodLiteral<"workflow-outputs">;
|
|
149
|
+
output: z.ZodOptional<z.ZodString>;
|
|
150
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
152
|
+
kind: z.ZodLiteral<"webhook-response">;
|
|
153
|
+
nodeId: z.ZodOptional<z.ZodString>;
|
|
154
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
}, z.core.$strict>], "kind">>;
|
|
139
156
|
responseData: z.ZodOptional<z.ZodString>;
|
|
140
157
|
responseHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
158
|
+
responseHeadersSource: z.ZodOptional<z.ZodObject<{
|
|
159
|
+
kind: z.ZodLiteral<"workflow-outputs">;
|
|
160
|
+
output: z.ZodOptional<z.ZodString>;
|
|
161
|
+
}, z.core.$strict>>;
|
|
162
|
+
responseHeaderOutputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
141
163
|
responseStatusCode: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
responseStatusCodeOutput: z.ZodOptional<z.ZodString>;
|
|
142
165
|
}, z.core.$strip>>;
|
|
143
166
|
}, z.core.$strict>;
|
|
144
167
|
schedule: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -81,7 +81,16 @@ interface ResolutionNodeBase extends GraphNodeBase {
|
|
|
81
81
|
readonly prompt: string;
|
|
82
82
|
readonly timeoutMs?: never;
|
|
83
83
|
}
|
|
84
|
+
export type WaitAutoContinue = {
|
|
85
|
+
readonly kind: 'after';
|
|
86
|
+
readonly durationMs: number | null;
|
|
87
|
+
} | {
|
|
88
|
+
readonly kind: 'at';
|
|
89
|
+
readonly at: string;
|
|
90
|
+
readonly timezone?: string;
|
|
91
|
+
};
|
|
84
92
|
export interface WaitNode extends ResolutionNodeBase {
|
|
93
|
+
readonly autoContinue?: WaitAutoContinue;
|
|
85
94
|
readonly kind: 'wait';
|
|
86
95
|
}
|
|
87
96
|
export interface ApprovalNode extends ResolutionNodeBase {
|
|
@@ -254,9 +263,24 @@ export interface WebhookBodyField extends InputPort {
|
|
|
254
263
|
}
|
|
255
264
|
export interface WebhookOptions {
|
|
256
265
|
readonly allowedOrigins?: readonly string[];
|
|
266
|
+
readonly responseBody?: {
|
|
267
|
+
readonly kind: 'workflow-outputs';
|
|
268
|
+
readonly output?: string;
|
|
269
|
+
readonly timeoutMs?: number;
|
|
270
|
+
} | {
|
|
271
|
+
readonly kind: 'webhook-response';
|
|
272
|
+
readonly nodeId?: string;
|
|
273
|
+
readonly timeoutMs?: number;
|
|
274
|
+
};
|
|
257
275
|
readonly responseData?: string;
|
|
258
276
|
readonly responseHeaders?: Readonly<Record<string, string>>;
|
|
277
|
+
readonly responseHeadersSource?: {
|
|
278
|
+
readonly kind: 'workflow-outputs';
|
|
279
|
+
readonly output?: string;
|
|
280
|
+
};
|
|
281
|
+
readonly responseHeaderOutputs?: Readonly<Record<string, string>>;
|
|
259
282
|
readonly responseStatusCode?: number;
|
|
283
|
+
readonly responseStatusCodeOutput?: string;
|
|
260
284
|
}
|
|
261
285
|
interface TriggerNodeBase {
|
|
262
286
|
readonly onError?: never;
|
|
@@ -302,7 +326,12 @@ export interface OutputsNode extends Omit<GraphNodeBase, 'inputs'> {
|
|
|
302
326
|
readonly outputMappings: Readonly<Record<string, InputMapping>>;
|
|
303
327
|
}
|
|
304
328
|
export declare function isTriggerNode(node: GraphNode): node is TriggerNode;
|
|
305
|
-
export
|
|
329
|
+
export interface WebhookResponseNode extends GraphNodeBase {
|
|
330
|
+
readonly kind: 'webhook-response';
|
|
331
|
+
readonly retry?: never;
|
|
332
|
+
readonly onError?: never;
|
|
333
|
+
}
|
|
334
|
+
export type GraphNode = WebhookResponseNode | OutputsNode | ApprovalNode | ConditionNode | TaskNode | TriggerNode | ValueNode | WaitNode;
|
|
306
335
|
export interface FlowDocument {
|
|
307
336
|
readonly bindings: Readonly<Record<string, {
|
|
308
337
|
readonly kind: 'variable';
|
|
@@ -317,7 +346,7 @@ export interface CodeModule {
|
|
|
317
346
|
}
|
|
318
347
|
export interface RevisionContent {
|
|
319
348
|
readonly document: FlowDocument;
|
|
320
|
-
readonly modelVersion: 2 | 4 | 5 | 6 | 7 | 8 | typeof currentFlowModelVersion;
|
|
349
|
+
readonly modelVersion: 2 | 4 | 5 | 6 | 7 | 8 | 9 | typeof currentFlowModelVersion;
|
|
321
350
|
readonly modules: Readonly<Record<string, CodeModule>>;
|
|
322
351
|
}
|
|
323
352
|
export interface GraphEdge {
|
|
@@ -415,10 +444,10 @@ export type ChangeOperation = {
|
|
|
415
444
|
readonly nodeId: string;
|
|
416
445
|
readonly value: readonly InputPort[];
|
|
417
446
|
} | {
|
|
418
|
-
readonly before: Pick<
|
|
447
|
+
readonly before: Pick<WaitNode, 'inputDefinitions' | 'prompt' | 'autoContinue'>;
|
|
419
448
|
readonly kind: 'graph.node.resolution.set';
|
|
420
449
|
readonly nodeId: string;
|
|
421
|
-
readonly value: Pick<
|
|
450
|
+
readonly value: Pick<WaitNode, 'inputDefinitions' | 'prompt' | 'autoContinue'>;
|
|
422
451
|
} | {
|
|
423
452
|
readonly before: Pick<Extract<TriggerNode, {
|
|
424
453
|
readonly kind: 'webhook';
|
|
@@ -1072,7 +1072,7 @@ function timeSource(args) {
|
|
|
1072
1072
|
function time(args) {
|
|
1073
1073
|
return new RegExp(`^${timeSource(args)}$`);
|
|
1074
1074
|
}
|
|
1075
|
-
function datetime(args) {
|
|
1075
|
+
function datetime$1(args) {
|
|
1076
1076
|
const opts = ["Z"];
|
|
1077
1077
|
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
1078
1078
|
const qualified = `${timeSource({
|
|
@@ -1723,7 +1723,7 @@ var $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
|
|
|
1723
1723
|
$ZodStringFormat.init(inst, def);
|
|
1724
1724
|
});
|
|
1725
1725
|
var $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1726
|
-
def.pattern ?? (def.pattern = datetime(def));
|
|
1726
|
+
def.pattern ?? (def.pattern = datetime$1(def));
|
|
1727
1727
|
$ZodStringFormat.init(inst, def);
|
|
1728
1728
|
});
|
|
1729
1729
|
var $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
@@ -5906,6 +5906,11 @@ function preprocess(fn, schema) {
|
|
|
5906
5906
|
});
|
|
5907
5907
|
}
|
|
5908
5908
|
//#endregion
|
|
5909
|
+
//#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/iso.js
|
|
5910
|
+
function datetime(params) {
|
|
5911
|
+
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
5912
|
+
}
|
|
5913
|
+
//#endregion
|
|
5909
5914
|
//#region src/json-schema-subset/utils.ts
|
|
5910
5915
|
var nextId = 0;
|
|
5911
5916
|
function createId() {
|
|
@@ -8795,6 +8800,32 @@ var triggerScheduleSchema = array(union([object({
|
|
|
8795
8800
|
value: number()
|
|
8796
8801
|
})]));
|
|
8797
8802
|
//#endregion
|
|
8803
|
+
//#region src/localization/common/timeZone.ts
|
|
8804
|
+
/** Validate a named timezone using the same runtime data used for date conversion. */
|
|
8805
|
+
function isTimeZone(value) {
|
|
8806
|
+
try {
|
|
8807
|
+
Intl.DateTimeFormat("en", { timeZone: value });
|
|
8808
|
+
return true;
|
|
8809
|
+
} catch {
|
|
8810
|
+
return false;
|
|
8811
|
+
}
|
|
8812
|
+
}
|
|
8813
|
+
//#endregion
|
|
8814
|
+
//#region src/flow/common/wait.ts
|
|
8815
|
+
/** Drafts retain incomplete values; semantic validation gates publication and execution. */
|
|
8816
|
+
var waitAutoContinueDraftSchema = discriminatedUnion("kind", [strictObject({
|
|
8817
|
+
kind: literal("after"),
|
|
8818
|
+
durationMs: number().nullable()
|
|
8819
|
+
}), strictObject({
|
|
8820
|
+
kind: literal("at"),
|
|
8821
|
+
at: string(),
|
|
8822
|
+
timezone: string().optional()
|
|
8823
|
+
})]);
|
|
8824
|
+
discriminatedUnion("kind", [waitAutoContinueDraftSchema.options[0].extend({ durationMs: number().int().positive().max(Number.MAX_SAFE_INTEGER) }), waitAutoContinueDraftSchema.options[1].extend({
|
|
8825
|
+
at: datetime({ offset: true }),
|
|
8826
|
+
timezone: string().refine(isTimeZone, "Select a valid IANA timezone.").optional()
|
|
8827
|
+
})]);
|
|
8828
|
+
//#endregion
|
|
8798
8829
|
//#region src/flow/common/webhookMethod.ts
|
|
8799
8830
|
var webhookMethods = [
|
|
8800
8831
|
"GET",
|
|
@@ -8804,8 +8835,26 @@ var webhookMethods = [
|
|
|
8804
8835
|
"DELETE"
|
|
8805
8836
|
];
|
|
8806
8837
|
//#endregion
|
|
8838
|
+
//#region src/flow/common/webhookResponse.ts
|
|
8839
|
+
var webhookResponseTimeout = {
|
|
8840
|
+
defaultMs: 3e4,
|
|
8841
|
+
minMs: 1e3,
|
|
8842
|
+
maxMs: 6e4
|
|
8843
|
+
};
|
|
8844
|
+
({
|
|
8845
|
+
jsonSchema: {
|
|
8846
|
+
type: "object",
|
|
8847
|
+
additionalProperties: { type: [
|
|
8848
|
+
"string",
|
|
8849
|
+
"number",
|
|
8850
|
+
"boolean"
|
|
8851
|
+
] }
|
|
8852
|
+
},
|
|
8853
|
+
nullable: true
|
|
8854
|
+
}).jsonSchema;
|
|
8855
|
+
//#endregion
|
|
8807
8856
|
//#region src/flow/common/changeSchema.ts
|
|
8808
|
-
var currentFlowModelVersion =
|
|
8857
|
+
var currentFlowModelVersion = 10;
|
|
8809
8858
|
var text = string();
|
|
8810
8859
|
var actionConnection = text.describe("Account selection: omit while unconfigured; use an account ID to select it; use \"\" to explicitly defer configuration. Deferred Actions fail if called; deferred Agent tools are excluded from the callable tool set. Not supported by Triggers.");
|
|
8811
8860
|
var json = json$1();
|
|
@@ -9033,9 +9082,24 @@ var webhookOptions = object({
|
|
|
9033
9082
|
allowedMethods: never().optional(),
|
|
9034
9083
|
allowedOrigins: strings.optional(),
|
|
9035
9084
|
noResponseBody: never().optional(),
|
|
9085
|
+
responseBody: discriminatedUnion("kind", [strictObject({
|
|
9086
|
+
kind: literal("workflow-outputs"),
|
|
9087
|
+
output: text.optional(),
|
|
9088
|
+
timeoutMs: number().int().min(webhookResponseTimeout.minMs).max(webhookResponseTimeout.maxMs).optional()
|
|
9089
|
+
}), strictObject({
|
|
9090
|
+
kind: literal("webhook-response"),
|
|
9091
|
+
nodeId: text.optional(),
|
|
9092
|
+
timeoutMs: number().int().min(webhookResponseTimeout.minMs).max(webhookResponseTimeout.maxMs).optional()
|
|
9093
|
+
})]).optional(),
|
|
9036
9094
|
responseData: text.optional(),
|
|
9037
9095
|
responseHeaders: record$1(text, text).optional(),
|
|
9038
|
-
|
|
9096
|
+
responseHeadersSource: strictObject({
|
|
9097
|
+
kind: literal("workflow-outputs"),
|
|
9098
|
+
output: text.optional()
|
|
9099
|
+
}).optional(),
|
|
9100
|
+
responseHeaderOutputs: record$1(text, text).optional(),
|
|
9101
|
+
responseStatusCode: number().int().min(200).max(599).optional(),
|
|
9102
|
+
responseStatusCodeOutput: text.optional()
|
|
9039
9103
|
});
|
|
9040
9104
|
var webhook = {
|
|
9041
9105
|
bodyFields: array(input),
|
|
@@ -9090,6 +9154,12 @@ var base = {
|
|
|
9090
9154
|
onError: _enum(["stop", "error"]).optional()
|
|
9091
9155
|
};
|
|
9092
9156
|
var node = union([
|
|
9157
|
+
strictObject({
|
|
9158
|
+
...base,
|
|
9159
|
+
kind: literal("webhook-response"),
|
|
9160
|
+
retry: never().optional(),
|
|
9161
|
+
onError: never().optional()
|
|
9162
|
+
}),
|
|
9093
9163
|
strictObject({
|
|
9094
9164
|
...base,
|
|
9095
9165
|
kind: literal("outputs"),
|
|
@@ -9122,7 +9192,8 @@ var node = union([
|
|
|
9122
9192
|
strictObject({
|
|
9123
9193
|
...base,
|
|
9124
9194
|
kind: literal("wait"),
|
|
9125
|
-
...wait
|
|
9195
|
+
...wait,
|
|
9196
|
+
autoContinue: waitAutoContinueDraftSchema.optional()
|
|
9126
9197
|
}).omit({ timeoutMs: true }),
|
|
9127
9198
|
object({
|
|
9128
9199
|
...trigger,
|
|
@@ -9209,7 +9280,8 @@ var revision = object({
|
|
|
9209
9280
|
literal(6),
|
|
9210
9281
|
literal(7),
|
|
9211
9282
|
literal(8),
|
|
9212
|
-
literal(9)
|
|
9283
|
+
literal(9),
|
|
9284
|
+
literal(10)
|
|
9213
9285
|
]),
|
|
9214
9286
|
document,
|
|
9215
9287
|
modules: record$1(text, module)
|
|
@@ -9342,8 +9414,14 @@ var shapes = {
|
|
|
9342
9414
|
},
|
|
9343
9415
|
"graph.node.resolution.set": {
|
|
9344
9416
|
...at,
|
|
9345
|
-
before:
|
|
9346
|
-
|
|
9417
|
+
before: strictObject({
|
|
9418
|
+
...wait,
|
|
9419
|
+
autoContinue: waitAutoContinueDraftSchema.optional()
|
|
9420
|
+
}),
|
|
9421
|
+
value: strictObject({
|
|
9422
|
+
...wait,
|
|
9423
|
+
autoContinue: waitAutoContinueDraftSchema.optional()
|
|
9424
|
+
})
|
|
9347
9425
|
},
|
|
9348
9426
|
"graph.node.webhook.set": {
|
|
9349
9427
|
...at,
|
|
@@ -9428,12 +9506,14 @@ function changeOperationsSchema(kind) {
|
|
|
9428
9506
|
return toJSONSchema(schema, { io: "input" });
|
|
9429
9507
|
}
|
|
9430
9508
|
function checkModelVersion(content) {
|
|
9509
|
+
if (content.modelVersion < 10 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "webhook" && (candidateNode.options?.responseBody != null || candidateNode.options?.responseStatusCodeOutput != null || candidateNode.options?.responseHeadersSource != null || candidateNode.options?.responseHeaderOutputs != null))) throw new TypeError("Dynamic Webhook responses require Flow model version 10.");
|
|
9431
9510
|
if (content.modelVersion < 9 && Object.values(content.document.graph.nodes).some((candidateNode) => "retry" in candidateNode && candidateNode.retry != null)) throw new TypeError("Node retries require Flow model version 9.");
|
|
9432
9511
|
if (content.modelVersion < 9 && Object.values(content.document.graph.nodes).some((candidateNode) => {
|
|
9433
9512
|
if (candidateNode.onError != null) return true;
|
|
9434
9513
|
if ([...Object.values("inputs" in candidateNode ? candidateNode.inputs : {}), ...Object.values(candidateNode.kind == "outputs" ? candidateNode.outputMappings : {})].some((candidateMapping) => candidateMapping.kind == "sources" && candidateMapping.sources.some((candidateSource) => candidateSource.kind == "node" && candidateSource.system))) return true;
|
|
9435
9514
|
return candidateNode.kind == "condition" && candidateNode.cases.some((item) => item.groups.some((candidateGroup) => candidateGroup.expressions.some((expression) => [expression.left, expression.right].some((candidateOperand) => candidateOperand?.kind == "source" && candidateOperand.source.kind == "node" && candidateOperand.source.system))));
|
|
9436
9515
|
})) throw new TypeError("Node error handling requires Flow model version 9.");
|
|
9516
|
+
if (content.modelVersion < 10 && Object.values(content.document.graph.nodes).some((candidate) => candidate.kind === "webhook-response")) throw new TypeError("Webhook response nodes require Flow model version 10.");
|
|
9437
9517
|
if (content.modelVersion < 8 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "outputs")) throw new TypeError("Workflow outputs require Flow model version 8.");
|
|
9438
9518
|
if (content.modelVersion < 7 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "start")) throw new TypeError("Start Triggers require Flow model version 7.");
|
|
9439
9519
|
if (content.modelVersion < 6 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task)) throw new TypeError("Node-owned managed Tasks require Flow model version 6.");
|
|
@@ -9698,10 +9778,10 @@ function upgradeRevisionContent(content) {
|
|
|
9698
9778
|
function upgradeDecodedRevisionContent(content) {
|
|
9699
9779
|
const graph = content.document.graph;
|
|
9700
9780
|
const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
|
|
9701
|
-
if (!hasManual && content.modelVersion ==
|
|
9781
|
+
if (!hasManual && content.modelVersion == 10) return content;
|
|
9702
9782
|
return {
|
|
9703
9783
|
...content,
|
|
9704
|
-
modelVersion:
|
|
9784
|
+
modelVersion: 10,
|
|
9705
9785
|
document: {
|
|
9706
9786
|
...content.document,
|
|
9707
9787
|
graph: hasManual ? {
|
|
@@ -9748,7 +9828,7 @@ function invalid(message) {
|
|
|
9748
9828
|
throw new FlowChangeError(message);
|
|
9749
9829
|
}
|
|
9750
9830
|
function applyFlowChanges(content, operations) {
|
|
9751
|
-
const source = content.modelVersion !=
|
|
9831
|
+
const source = content.modelVersion != 10 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
|
|
9752
9832
|
const document = { ...source.document };
|
|
9753
9833
|
const modules = { ...source.modules };
|
|
9754
9834
|
for (const operation of operations) switch (operation.kind) {
|
|
@@ -10064,12 +10144,15 @@ function applyFlowChanges(content, operations) {
|
|
|
10064
10144
|
const node = graph.nodes[operation.nodeId];
|
|
10065
10145
|
if (node?.kind != "wait" && node?.kind != "approval" || !dequal({
|
|
10066
10146
|
inputDefinitions: node.inputDefinitions,
|
|
10067
|
-
prompt: node.prompt
|
|
10147
|
+
prompt: node.prompt,
|
|
10148
|
+
...node.kind == "wait" && node.autoContinue != null ? { autoContinue: node.autoContinue } : {}
|
|
10068
10149
|
}, operation.before)) invalid("The resolution node changed before this operation was applied.");
|
|
10150
|
+
if (node.kind == "approval" && operation.value.autoContinue != null) invalid("Approval does not support automatic continuation.");
|
|
10069
10151
|
const updated = {
|
|
10070
10152
|
...node,
|
|
10071
10153
|
...operation.value
|
|
10072
10154
|
};
|
|
10155
|
+
if (updated.kind == "wait" && operation.value.autoContinue == null) Reflect.deleteProperty(updated, "autoContinue");
|
|
10073
10156
|
document.graph = {
|
|
10074
10157
|
...graph,
|
|
10075
10158
|
nodes: {
|
|
@@ -10193,7 +10276,7 @@ function applyFlowChanges(content, operations) {
|
|
|
10193
10276
|
assertOpenApiAuthBindings(document);
|
|
10194
10277
|
return upgradeDecodedRevisionContent({
|
|
10195
10278
|
document,
|
|
10196
|
-
modelVersion:
|
|
10279
|
+
modelVersion: 10,
|
|
10197
10280
|
modules
|
|
10198
10281
|
});
|
|
10199
10282
|
}
|