@oomol-lab/open-flow 0.1.0-beta.55 → 0.1.0-beta.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/{createResourceDialog-4H5_lZ6s.js → createResourceDialog-Btjes3wD.js} +2 -2
  3. package/dist/browser/flow-authoring-edge.d.ts +3 -3
  4. package/dist/browser/flow-authoring-node.d.ts +26 -46
  5. package/dist/browser/flow-authoring.js +9155 -21002
  6. package/dist/browser/flow-change-schema.d.ts +1 -1
  7. package/dist/browser/flow-change.d.ts +14 -104
  8. package/dist/browser/flow-change.js +121 -296
  9. package/dist/browser/{flowChanges-ZzG-f9cg.js → flowChanges-BxutPLYO.js} +1494 -1830
  10. package/dist/browser/{flowWorkspace-ChpRaTMX.js → flowWorkspace-Dg4mqfa6.js} +118 -293
  11. package/dist/browser/{icons-CdAB9wyS.js → icons-p2A9zs8t.js} +126 -317
  12. package/dist/browser/lib-DrKav3HG.js +11403 -0
  13. package/dist/browser/preview.css +1 -1
  14. package/dist/browser/preview.js +9308 -9565
  15. package/dist/browser/ui-idTooltip.d.ts +11 -0
  16. package/dist/browser/ui.d.ts +5 -0
  17. package/dist/browser/ui.js +83 -1
  18. package/dist/browser/workbench.css +1 -1
  19. package/dist/browser/workbench.js +210 -411
  20. package/dist/browser/{workbenchSelect-BRZN4ish.js → workbenchSelect-LRp_Xjeq.js} +1 -1
  21. package/dist/common/control-api-conformance.js +212 -245
  22. package/dist/common/control-api.d.ts +6 -6
  23. package/dist/common/control-api.js +216 -250
  24. package/dist/common/control-requests.js +468 -1476
  25. package/dist/common/decision.js +6325 -6369
  26. package/dist/common/flow-agent.d.ts +1 -1
  27. package/dist/common/flow-connectionUsage.d.ts +1 -2
  28. package/dist/common/flow-encoding.d.ts +2 -4
  29. package/dist/common/flow-encoding.js +119 -180
  30. package/dist/common/flow-graph.d.ts +10 -10
  31. package/dist/common/flow-semantics.d.ts +4 -9
  32. package/dist/common/flow-semantics.js +9024 -9230
  33. package/dist/common/flowInspection.d.ts +3 -21
  34. package/dist/common/integration-trigger.js +8642 -8686
  35. package/dist/common/mcp.d.ts +0 -1
  36. package/dist/common/mcp.js +117 -140
  37. package/dist/common/openapi.js +6325 -6369
  38. package/dist/common/poll-trigger.js +8642 -8686
  39. package/dist/common/run-events.js +0 -1
  40. package/dist/common/scheduler.d.ts +3 -9
  41. package/dist/common/scheduler.js +116 -207
  42. package/dist/common/webhook-trigger.js +6325 -6369
  43. package/package.json +1 -1
@@ -2780,6 +2780,9 @@ function handlePipeResult(left, next, ctx) {
2780
2780
  issues: left.issues
2781
2781
  }, ctx);
2782
2782
  }
2783
+ var $ZodPreprocess = /*@__PURE__*/ $constructor("$ZodPreprocess", (inst, def) => {
2784
+ $ZodPipe.init(inst, def);
2785
+ });
2783
2786
  var $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2784
2787
  $ZodType.init(inst, def);
2785
2788
  defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
@@ -5581,7 +5584,7 @@ var ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
5581
5584
  inst.keyType = def.keyType;
5582
5585
  inst.valueType = def.valueType;
5583
5586
  });
5584
- function record(keyType, valueType, params) {
5587
+ function record$1(keyType, valueType, params) {
5585
5588
  if (!valueType || !valueType._zod) return new ZodRecord({
5586
5589
  type: "record",
5587
5590
  keyType: string(),
@@ -5790,6 +5793,10 @@ function pipe(in_, out) {
5790
5793
  out
5791
5794
  });
5792
5795
  }
5796
+ var ZodPreprocess = /*@__PURE__*/ $constructor("ZodPreprocess", (inst, def) => {
5797
+ ZodPipe.init(inst, def);
5798
+ $ZodPreprocess.init(inst, def);
5799
+ });
5793
5800
  var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
5794
5801
  $ZodReadonly.init(inst, def);
5795
5802
  ZodType.init(inst, def);
@@ -5833,11 +5840,18 @@ function json$3(params) {
5833
5840
  boolean(),
5834
5841
  _null(),
5835
5842
  array(jsonSchema),
5836
- record(string(), jsonSchema)
5843
+ record$1(string(), jsonSchema)
5837
5844
  ]);
5838
5845
  });
5839
5846
  return jsonSchema;
5840
5847
  }
5848
+ function preprocess(fn, schema) {
5849
+ return new ZodPreprocess({
5850
+ type: "pipe",
5851
+ in: transform(fn),
5852
+ out: schema
5853
+ });
5854
+ }
5841
5855
  //#endregion
5842
5856
  //#region src/execution/common/wait.ts
5843
5857
  /** Shared by decision entry points, the editor, and durable decision storage. */
@@ -9402,7 +9416,7 @@ var isObject = (x) => x !== null && typeof x === "object";
9402
9416
  var isPlainObject = (x) => isObject(x) && !isArray(x);
9403
9417
  var toPlainObject = (x) => isPlainObject(x) ? x : void 0;
9404
9418
  //#endregion
9405
- //#region src/manifest/common/schemaComparer.ts
9419
+ //#region src/flow/common/schemaComparer.ts
9406
9420
  function isStringLikeSchema(value) {
9407
9421
  return toPlainObject(value)?.type === "string";
9408
9422
  }
@@ -9705,24 +9719,15 @@ var group = object$1({
9705
9719
  collapsed: boolean().optional(),
9706
9720
  group: text$1
9707
9721
  });
9708
- var nodeSource = object$1({
9722
+ var source = union([object$1({
9709
9723
  kind: literal("node"),
9710
9724
  nodeId: text$1,
9711
9725
  output: text$1,
9712
9726
  field: text$1.optional()
9713
- });
9714
- var flowSource = object$1({
9715
- kind: literal("flow"),
9716
- input: text$1
9717
- });
9718
- var source = union([
9719
- nodeSource,
9720
- flowSource,
9721
- object$1({
9722
- kind: literal("binding"),
9723
- bindingId: text$1
9724
- })
9725
- ]);
9727
+ }), object$1({
9728
+ kind: literal("binding"),
9729
+ bindingId: text$1
9730
+ })]);
9726
9731
  var fixedInput = union([object$1({ kind: literal("unset") }), object$1({
9727
9732
  kind: literal("value"),
9728
9733
  value: json$2
@@ -9731,7 +9736,7 @@ var mapping = union([fixedInput, object$1({
9731
9736
  kind: literal("sources"),
9732
9737
  sources: array(source)
9733
9738
  })]);
9734
- var inputs$1 = record(text$1, mapping);
9739
+ var inputs$1 = record$1(text$1, mapping);
9735
9740
  var ports = {
9736
9741
  inputs: array(union([input, group])),
9737
9742
  outputs: array(union([port, group]))
@@ -9859,9 +9864,11 @@ var managed = object$1({
9859
9864
  inputs: array(input.extend({ source: agentInput }))
9860
9865
  })),
9861
9866
  notification: object$1({
9862
- taskId: text$1,
9867
+ action: text$1,
9868
+ connectionId: text$1.optional(),
9869
+ inputDefinitions: array(input),
9863
9870
  messageHandle: text$1,
9864
- inputs: record(text$1, agentValue)
9871
+ inputs: record$1(text$1, agentValue)
9865
9872
  }).optional()
9866
9873
  })
9867
9874
  ])
@@ -9916,7 +9923,7 @@ var webhookOptions = object$1({
9916
9923
  allowedOrigins: strings.optional(),
9917
9924
  noResponseBody: never().optional(),
9918
9925
  responseData: text$1.optional(),
9919
- responseHeaders: record(text$1, text$1).optional(),
9926
+ responseHeaders: record$1(text$1, text$1).optional(),
9920
9927
  responseStatusCode: number().int().min(200).max(599).optional()
9921
9928
  });
9922
9929
  var webhook = {
@@ -9972,7 +9979,7 @@ var base = {
9972
9979
  var node = union([
9973
9980
  object$1({
9974
9981
  ...base,
9975
- inputs: record(text$1, never()),
9982
+ inputs: record$1(text$1, never()),
9976
9983
  kind: literal("condition"),
9977
9984
  ...condition
9978
9985
  }),
@@ -9982,21 +9989,10 @@ var node = union([
9982
9989
  kind: literal("value"),
9983
9990
  values: array(input)
9984
9991
  }),
9985
- object$1({
9986
- ...base,
9987
- kind: literal("subflow"),
9988
- subflowId: text$1
9989
- }),
9990
- object$1({
9991
- ...base,
9992
- kind: literal("task"),
9993
- task: inline,
9994
- additionalInputs: array(input).optional()
9995
- }),
9996
9992
  object$1({
9997
9993
  ...base,
9998
9994
  kind: literal("task"),
9999
- taskId: text$1,
9995
+ task: union([inline, managed]),
10000
9996
  additionalInputs: array(input).optional()
10001
9997
  }),
10002
9998
  strictObject({
@@ -10032,7 +10028,7 @@ var node = union([
10032
10028
  ...trigger$1,
10033
10029
  kind: literal("poll"),
10034
10030
  connectionId: text$1.min(1).optional(),
10035
- config: record(text$1, fixedInput),
10031
+ config: record$1(text$1, fixedInput),
10036
10032
  definition: object$1({
10037
10033
  ...definition,
10038
10034
  type: literal("poll")
@@ -10043,7 +10039,7 @@ var node = union([
10043
10039
  ...trigger$1,
10044
10040
  kind: literal("integration"),
10045
10041
  connectionId: text$1.min(1).optional(),
10046
- config: record(text$1, fixedInput),
10042
+ config: record$1(text$1, fixedInput),
10047
10043
  definition: object$1({
10048
10044
  ...definition,
10049
10045
  type: literal("integration"),
@@ -10051,10 +10047,6 @@ var node = union([
10051
10047
  })
10052
10048
  })
10053
10049
  ]);
10054
- var target$1 = union([object$1({ kind: literal("flow") }), object$1({
10055
- kind: literal("subflow"),
10056
- id: text$1
10057
- })]);
10058
10050
  var edge = object$1({
10059
10051
  source: text$1,
10060
10052
  target: text$1,
@@ -10062,15 +10054,10 @@ var edge = object$1({
10062
10054
  });
10063
10055
  var at = {
10064
10056
  nodeId: text$1,
10065
- target: target$1
10057
+ target: never().optional()
10066
10058
  };
10067
- var subflow = object$1({
10068
- name: text$1,
10069
- inputs: array(input),
10070
- outputs: array(port.extend({ sources: array(union([nodeSource, flowSource])) }))
10071
- });
10072
10059
  var graph = object$1({
10073
- nodes: record(text$1, node),
10060
+ nodes: record$1(text$1, node),
10074
10061
  edges: array(edge).default([])
10075
10062
  });
10076
10063
  var binding = object$1({
@@ -10082,24 +10069,35 @@ var module = object$1({
10082
10069
  imports: strings,
10083
10070
  source: text$1
10084
10071
  });
10085
- var document = object$1({
10086
- bindings: record(text$1, binding),
10087
- graph,
10088
- subflows: record(text$1, subflow.extend({ graph })),
10089
- tasks: record(text$1, managed)
10090
- });
10072
+ var document = preprocess(rejectRetiredDefinitions, object$1({
10073
+ bindings: record$1(text$1, binding),
10074
+ graph
10075
+ }));
10091
10076
  object$1({
10092
10077
  modelVersion: union([
10093
10078
  literal(2),
10094
10079
  literal(4),
10095
- literal(5)
10080
+ literal(5),
10081
+ literal(6)
10096
10082
  ]),
10097
10083
  document,
10098
- modules: record(text$1, module)
10084
+ modules: record$1(text$1, module)
10099
10085
  }).extend({
10100
10086
  kind: literal("open-flow-flow-revision"),
10101
10087
  version: literal(1)
10102
10088
  });
10089
+ function rejectRetiredDefinitions(value) {
10090
+ const candidate = record(value);
10091
+ if (candidate.tasks !== void 0 && (candidate.tasks === null || typeof candidate.tasks !== "object" || Array.isArray(candidate.tasks) || Object.keys(candidate.tasks).length > 0)) throw new TypeError("Independent Task definitions are no longer supported.");
10092
+ if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
10093
+ const subflows = candidate.subflows;
10094
+ if (subflows !== void 0 && (subflows === null || typeof subflows !== "object" || Array.isArray(subflows) || Object.keys(subflows).length > 0)) throw new TypeError("Subflows are no longer supported.");
10095
+ if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => record(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
10096
+ return value;
10097
+ }
10098
+ function record(value) {
10099
+ return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
10100
+ }
10103
10101
  var shapes = {
10104
10102
  "graph.trigger.sources.set": {
10105
10103
  nodeId: text$1,
@@ -10117,12 +10115,12 @@ var shapes = {
10117
10115
  value: text$1
10118
10116
  },
10119
10117
  "graph.edge.connect": {
10120
- target: target$1,
10121
- edge
10118
+ edge,
10119
+ target: never().optional()
10122
10120
  },
10123
10121
  "graph.edge.disconnect": {
10124
- target: target$1,
10125
- edge
10122
+ edge,
10123
+ target: never().optional()
10126
10124
  },
10127
10125
  "graph.node.create": {
10128
10126
  ...at,
@@ -10186,13 +10184,11 @@ var shapes = {
10186
10184
  },
10187
10185
  "graph.node.resolution.set": {
10188
10186
  ...at,
10189
- target: object$1({ kind: literal("flow") }),
10190
10187
  before: object$1(wait),
10191
10188
  value: object$1(wait)
10192
10189
  },
10193
10190
  "graph.node.webhook.set": {
10194
10191
  ...at,
10195
- target: object$1({ kind: literal("flow") }),
10196
10192
  before: object$1(webhook),
10197
10193
  value: object$1(webhook)
10198
10194
  },
@@ -10239,50 +10235,10 @@ var shapes = {
10239
10235
  imports: strings,
10240
10236
  source: text$1
10241
10237
  },
10242
- "subflow.create": {
10243
- subflowId: text$1,
10244
- subflow: subflow.extend({ graph })
10245
- },
10246
- "subflow.definition.set": {
10247
- subflowId: text$1,
10248
- before: subflow,
10249
- definition: subflow
10250
- },
10251
- "subflow.delete": { subflowId: text$1 },
10252
- "task.create": {
10253
- taskId: text$1,
10254
- task: managed
10255
- },
10256
- "task.delete": { taskId: text$1 },
10257
- "task.connector.connection.set": {
10258
- taskId: text$1,
10259
- before: text$1.optional(),
10260
- value: text$1.optional()
10261
- },
10262
- "task.decision.set": {
10263
- taskId: text$1,
10264
- before: managed,
10265
- value: managed
10266
- },
10267
- "task.openapi.set": {
10268
- taskId: text$1,
10269
- before: managed,
10270
- value: managed
10271
- },
10272
- "task.agent.set": {
10273
- taskId: text$1,
10274
- before: managed,
10275
- value: managed
10276
- },
10277
- "task.llm.mode.set": {
10278
- taskId: text$1,
10279
- before: _enum(["chat", "json"]),
10280
- value: _enum(["chat", "json"])
10281
- },
10282
- "task.name.set": {
10283
- taskId: text$1,
10284
- before: text$1,
10285
- value: text$1
10238
+ "graph.node.task.set": {
10239
+ ...at,
10240
+ before: union([inline, managed]),
10241
+ value: union([inline, managed])
10286
10242
  }
10287
10243
  };
10288
10244
  var variants = new Map(Object.entries(shapes).map(([kind, shape]) => [kind, shape instanceof ZodType ? shape : object$1({
@@ -10320,81 +10276,370 @@ function resourceNameIssue(value) {
10320
10276
  if (!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(name)) return "specialCharacter";
10321
10277
  }
10322
10278
  //#endregion
10323
- //#region src/openapi/common/openapi.ts
10324
- var methods = [
10325
- "get",
10326
- "put",
10327
- "post",
10328
- "delete",
10329
- "options",
10330
- "head",
10331
- "patch",
10332
- "trace"
10333
- ];
10334
- function object(value) {
10335
- if (value == null || typeof value != "object" || Array.isArray(value)) throw new Error("Expected an OpenAPI object.");
10336
- return value;
10279
+ //#region src/flow/common/nodeChanges.ts
10280
+ var codeTaskTemplate = `export default async function (inputs, context) {
10281
+ return { result: inputs.value }
10337
10282
  }
10338
- function httpUrl(value, base) {
10339
- const url = new URL(value, base);
10340
- if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.hash) throw new Error("An HTTP(S) URL without credentials or fragment is required.");
10341
- return url.href;
10283
+ `;
10284
+ function createCodeTask(identity, name, module = void 0, ports = {
10285
+ inputs: [{
10286
+ handle: "value",
10287
+ jsonSchema: { type: "string" },
10288
+ nullable: true,
10289
+ value: "foo"
10290
+ }],
10291
+ outputs: [{
10292
+ handle: "result",
10293
+ jsonSchema: {},
10294
+ nullable: true
10295
+ }]
10296
+ }) {
10297
+ return [{
10298
+ kind: "module.create",
10299
+ module: {
10300
+ ...module ?? {
10301
+ imports: [],
10302
+ source: codeTaskTemplate
10303
+ },
10304
+ name
10305
+ },
10306
+ moduleId: identity.moduleId
10307
+ }, {
10308
+ kind: "graph.node.create",
10309
+ node: {
10310
+ inputs: defaultInputs(ports.inputs),
10311
+ kind: "task",
10312
+ name,
10313
+ task: {
10314
+ capabilities: ports.capabilities ?? [{
10315
+ kind: "connector",
10316
+ mode: "independent",
10317
+ actions: []
10318
+ }],
10319
+ inputs: ports.inputs,
10320
+ moduleId: identity.moduleId,
10321
+ name,
10322
+ outputs: ports.outputs
10323
+ }
10324
+ },
10325
+ nodeId: identity.nodeId
10326
+ }];
10342
10327
  }
10343
- function parseOpenApi(value) {
10344
- const doc = object(value);
10345
- if (typeof doc.openapi != "string" || !/^3\.[01]\.\d+$/.test(doc.openapi)) throw new Error("Only OpenAPI 3.0 and 3.1 JSON documents are supported.");
10346
- object(doc.paths);
10347
- return doc;
10328
+ function createManagedTask(identity, task) {
10329
+ return [{
10330
+ kind: "graph.node.create",
10331
+ node: {
10332
+ inputs: defaultInputs(task.inputs),
10333
+ kind: "task",
10334
+ name: task.name,
10335
+ task
10336
+ },
10337
+ nodeId: identity.nodeId
10338
+ }];
10348
10339
  }
10349
- function pointer(doc, ref) {
10350
- if (!ref.startsWith("#/")) throw new Error("External OpenAPI references are not supported.");
10351
- let value = doc;
10352
- for (const key of decodeURIComponent(ref.slice(2)).split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~"))) {
10353
- const source = object(value);
10354
- if (!Object.hasOwn(source, key)) throw new Error("An OpenAPI reference is missing.");
10355
- value = source[key];
10356
- }
10357
- return value;
10340
+ function createLlmTask(identity, name, mode, outputDescription, options = {}) {
10341
+ const values = options.inputs ?? {};
10342
+ return createManagedTask(identity, {
10343
+ executor: {
10344
+ kind: "llm",
10345
+ mode
10346
+ },
10347
+ inputs: [
10348
+ {
10349
+ handle: "messages",
10350
+ jsonSchema: {
10351
+ items: { type: "object" },
10352
+ type: "array"
10353
+ },
10354
+ nullable: true,
10355
+ value: llmInputValue(values, "messages", null)
10356
+ },
10357
+ {
10358
+ handle: "input",
10359
+ jsonSchema: { type: "string" },
10360
+ nullable: false,
10361
+ value: llmInputValue(values, "input", "Alex")
10362
+ },
10363
+ {
10364
+ handle: "template",
10365
+ jsonSchema: {
10366
+ items: { type: "object" },
10367
+ minItems: 1,
10368
+ type: "array"
10369
+ },
10370
+ nullable: false,
10371
+ value: llmInputValue(values, "template", [{
10372
+ content: "Hello, I'm {{input}}",
10373
+ role: "user"
10374
+ }])
10375
+ },
10376
+ {
10377
+ handle: "model",
10378
+ jsonSchema: { type: "object" },
10379
+ nullable: false,
10380
+ value: llmInputValue(values, "model", { model: "deepseek-v4-flash" })
10381
+ }
10382
+ ],
10383
+ name,
10384
+ outputs: [{
10385
+ ...options.output,
10386
+ description: options.output?.description ?? outputDescription,
10387
+ handle: "output",
10388
+ jsonSchema: options.output?.jsonSchema ?? (mode == "chat" ? { type: "string" } : {}),
10389
+ nullable: options.output?.nullable ?? false
10390
+ }]
10391
+ });
10358
10392
  }
10359
- function resolved(doc, value) {
10360
- let result = object(value);
10361
- const seen = /* @__PURE__ */ new Set();
10362
- while (typeof result.$ref == "string") {
10363
- if (seen.has(result.$ref)) throw new Error("Circular non-schema reference is unsupported.");
10364
- seen.add(result.$ref);
10365
- const { $ref, ...siblings } = result;
10366
- result = {
10367
- ...object(pointer(doc, $ref)),
10368
- ...siblings
10369
- };
10370
- }
10371
- return result;
10393
+ function createCondition(nodeId, name) {
10394
+ return [{
10395
+ kind: "graph.node.create",
10396
+ node: {
10397
+ cases: [{
10398
+ groups: [{ expressions: [{
10399
+ left: { kind: "value" },
10400
+ operator: "==",
10401
+ right: { kind: "value" }
10402
+ }] }],
10403
+ output: "case"
10404
+ }],
10405
+ matchMode: "first",
10406
+ inputs: {},
10407
+ kind: "condition",
10408
+ name
10409
+ },
10410
+ nodeId
10411
+ }];
10372
10412
  }
10373
- function operation(doc, path, method) {
10374
- const item = resolved(doc, object(doc.paths)[path]);
10375
- if (!methods.includes(method) || item[method] == null) throw new Error("The selected operation is no longer available.");
10376
- return {
10377
- item,
10378
- op: object(item[method])
10379
- };
10413
+ function createValue(nodeId, name) {
10414
+ return [{
10415
+ kind: "graph.node.create",
10416
+ node: {
10417
+ inputs: {},
10418
+ kind: "value",
10419
+ name,
10420
+ values: [{
10421
+ handle: "value",
10422
+ jsonSchema: {},
10423
+ nullable: true,
10424
+ value: null
10425
+ }]
10426
+ },
10427
+ nodeId
10428
+ }];
10380
10429
  }
10381
- function servers(value, path, method) {
10382
- const doc = parseOpenApi(value);
10383
- const { item, op } = operation(doc, path, method);
10384
- const entries = op.servers ?? item.servers ?? doc.servers;
10385
- if (!Array.isArray(entries) || entries.length == 0) return [{ url: "/" }];
10386
- return entries.map(object);
10430
+ function createWait(nodeId, name) {
10431
+ return [{
10432
+ kind: "graph.node.create",
10433
+ node: {
10434
+ inputDefinitions: [],
10435
+ inputs: {},
10436
+ kind: "wait",
10437
+ name,
10438
+ prompt: name
10439
+ },
10440
+ nodeId
10441
+ }];
10387
10442
  }
10388
- function serverAddress(server, sourceUrl, variables = {}) {
10389
- return httpUrl(String(server.url).replace(/\{([^}]+)\}/g, (_, name) => {
10390
- const definition = object(object(server.variables)[name]);
10391
- const value = variables[name] ?? definition.default;
10392
- if (typeof value != "string" || Array.isArray(definition.enum) && !definition.enum.includes(value)) throw new Error("A server variable is invalid.");
10393
- return value;
10394
- }), sourceUrl);
10443
+ function createApproval(nodeId, name) {
10444
+ return [{
10445
+ kind: "graph.node.create",
10446
+ node: {
10447
+ inputDefinitions: [],
10448
+ inputs: {},
10449
+ kind: "approval",
10450
+ name,
10451
+ prompt: name
10452
+ },
10453
+ nodeId
10454
+ }];
10395
10455
  }
10396
- function securityOptions(value, path, method) {
10397
- const doc = parseOpenApi(value);
10456
+ function createBuiltinTrigger(nodeId, node) {
10457
+ return [{
10458
+ kind: "graph.node.create",
10459
+ node,
10460
+ nodeId
10461
+ }];
10462
+ }
10463
+ function createProviderTrigger(nodeId, definition, options) {
10464
+ const name = options.name ?? definition.displayName;
10465
+ return [{
10466
+ kind: "graph.node.create",
10467
+ node: definition.type == "poll" ? {
10468
+ ...options.connectionId == null ? {} : { connectionId: options.connectionId },
10469
+ config: inputValues(options.config),
10470
+ definition,
10471
+ kind: "poll",
10472
+ name,
10473
+ pollTimes: options.schedule ?? [{
10474
+ type: "every",
10475
+ unit: "minute",
10476
+ value: 5
10477
+ }]
10478
+ } : {
10479
+ ...options.connectionId == null ? {} : { connectionId: options.connectionId },
10480
+ config: inputValues(options.config),
10481
+ definition,
10482
+ kind: "integration",
10483
+ name
10484
+ },
10485
+ nodeId
10486
+ }];
10487
+ }
10488
+ function defaultInputs(ports) {
10489
+ return Object.fromEntries(ports.flatMap((port) => "handle" in port && Object.hasOwn(port, "value") ? [[port.handle, {
10490
+ kind: "value",
10491
+ value: port.value
10492
+ }]] : []));
10493
+ }
10494
+ function llmInputValue(values, handle, fallback) {
10495
+ return values != null && Object.hasOwn(values, handle) ? values[handle] : fallback;
10496
+ }
10497
+ function createDecisionTask(identity, name = "AI Decision", questions) {
10498
+ return createManagedTask(identity, decisionTask(questions, name));
10499
+ }
10500
+ //#endregion
10501
+ //#region src/control/common/draftOperations.ts
10502
+ var text = string().min(1);
10503
+ var json$1 = json$3();
10504
+ var triggerCreate = strictObject({
10505
+ kind: literal("graph.trigger.create"),
10506
+ nodeId: text,
10507
+ key: text,
10508
+ connectionId: text.optional(),
10509
+ name: text.optional(),
10510
+ config: record$1(text, json$1),
10511
+ schedule: triggerScheduleSchema.readonly().optional()
10512
+ });
10513
+ function decodeDraftOperations(value) {
10514
+ checkJsonDepth(value);
10515
+ return array(unknown()).min(1).parse(value).map((candidate, index) => {
10516
+ const { kind } = parseOperation(candidate, index, object$1({ kind: text }).parse);
10517
+ return kind == "graph.trigger.create" ? parseOperation(candidate, index, triggerCreate.parse) : decodeChangeOperation(candidate, index);
10518
+ });
10519
+ }
10520
+ function draftOperationsSchema(kind) {
10521
+ if (kind != null && kind != "graph.trigger.create") return changeOperationsSchema(kind);
10522
+ const trigger = toJSONSchema(triggerCreate);
10523
+ if (kind == "graph.trigger.create") return trigger;
10524
+ const schema = changeOperationsSchema();
10525
+ return {
10526
+ ...schema,
10527
+ items: { anyOf: [schema.items, trigger] }
10528
+ };
10529
+ }
10530
+ function resolveDraftOperations(operations, definition) {
10531
+ return operations.flatMap((operation) => {
10532
+ if (operation.kind != "graph.trigger.create") return [operation];
10533
+ const snapshot = definition(operation.key);
10534
+ if (snapshot.type != "poll" && operation.schedule != null) throw new Error("Only Poll triggers accept a schedule.");
10535
+ return createProviderTrigger(operation.nodeId, snapshot, operation);
10536
+ });
10537
+ }
10538
+ //#endregion
10539
+ //#region src/control/common/eventSourceSchemas.ts
10540
+ var id$1 = string().min(1).max(256);
10541
+ var eventType = string().regex(/^[a-z][a-z0-9_.]{0,127}$/);
10542
+ var name = string().trim().min(1).max(128);
10543
+ var secret = string().min(1).max(256);
10544
+ var createEventSourceSchema = strictObject({
10545
+ version: literal(1),
10546
+ name,
10547
+ connectionId: id$1,
10548
+ teamId: id$1.nullable(),
10549
+ verificationToken: secret,
10550
+ encryptKey: secret,
10551
+ eventTypes: array(eventType).min(1).max(200).refine((values) => new Set(values).size == values.length),
10552
+ manageSubscriptions: boolean()
10553
+ });
10554
+ var updateEventSourceSchema = strictObject({
10555
+ version: literal(1),
10556
+ expectedRevision: int().positive(),
10557
+ name,
10558
+ enabled: boolean(),
10559
+ eventTypes: array(eventType).min(1).max(200).refine((values) => new Set(values).size == values.length),
10560
+ verificationToken: secret.optional(),
10561
+ encryptKey: secret.optional()
10562
+ });
10563
+ var eventSourceRevisionSchema = strictObject({
10564
+ version: literal(1),
10565
+ expectedRevision: int().positive()
10566
+ });
10567
+ //#endregion
10568
+ //#region src/openapi/common/openapi.ts
10569
+ var methods = [
10570
+ "get",
10571
+ "put",
10572
+ "post",
10573
+ "delete",
10574
+ "options",
10575
+ "head",
10576
+ "patch",
10577
+ "trace"
10578
+ ];
10579
+ function object(value) {
10580
+ if (value == null || typeof value != "object" || Array.isArray(value)) throw new Error("Expected an OpenAPI object.");
10581
+ return value;
10582
+ }
10583
+ function httpUrl(value, base) {
10584
+ const url = new URL(value, base);
10585
+ if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.hash) throw new Error("An HTTP(S) URL without credentials or fragment is required.");
10586
+ return url.href;
10587
+ }
10588
+ function parseOpenApi(value) {
10589
+ const doc = object(value);
10590
+ if (typeof doc.openapi != "string" || !/^3\.[01]\.\d+$/.test(doc.openapi)) throw new Error("Only OpenAPI 3.0 and 3.1 JSON documents are supported.");
10591
+ object(doc.paths);
10592
+ return doc;
10593
+ }
10594
+ function pointer(doc, ref) {
10595
+ if (!ref.startsWith("#/")) throw new Error("External OpenAPI references are not supported.");
10596
+ let value = doc;
10597
+ for (const key of decodeURIComponent(ref.slice(2)).split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~"))) {
10598
+ const source = object(value);
10599
+ if (!Object.hasOwn(source, key)) throw new Error("An OpenAPI reference is missing.");
10600
+ value = source[key];
10601
+ }
10602
+ return value;
10603
+ }
10604
+ function resolved(doc, value) {
10605
+ let result = object(value);
10606
+ const seen = /* @__PURE__ */ new Set();
10607
+ while (typeof result.$ref == "string") {
10608
+ if (seen.has(result.$ref)) throw new Error("Circular non-schema reference is unsupported.");
10609
+ seen.add(result.$ref);
10610
+ const { $ref, ...siblings } = result;
10611
+ result = {
10612
+ ...object(pointer(doc, $ref)),
10613
+ ...siblings
10614
+ };
10615
+ }
10616
+ return result;
10617
+ }
10618
+ function operation(doc, path, method) {
10619
+ const item = resolved(doc, object(doc.paths)[path]);
10620
+ if (!methods.includes(method) || item[method] == null) throw new Error("The selected operation is no longer available.");
10621
+ return {
10622
+ item,
10623
+ op: object(item[method])
10624
+ };
10625
+ }
10626
+ function servers(value, path, method) {
10627
+ const doc = parseOpenApi(value);
10628
+ const { item, op } = operation(doc, path, method);
10629
+ const entries = op.servers ?? item.servers ?? doc.servers;
10630
+ if (!Array.isArray(entries) || entries.length == 0) return [{ url: "/" }];
10631
+ return entries.map(object);
10632
+ }
10633
+ function serverAddress(server, sourceUrl, variables = {}) {
10634
+ return httpUrl(String(server.url).replace(/\{([^}]+)\}/g, (_, name) => {
10635
+ const definition = object(object(server.variables)[name]);
10636
+ const value = variables[name] ?? definition.default;
10637
+ if (typeof value != "string" || Array.isArray(definition.enum) && !definition.enum.includes(value)) throw new Error("A server variable is invalid.");
10638
+ return value;
10639
+ }), sourceUrl);
10640
+ }
10641
+ function securityOptions(value, path, method) {
10642
+ const doc = parseOpenApi(value);
10398
10643
  const { op } = operation(doc, path, method);
10399
10644
  const requirements = op.security ?? doc.security ?? [];
10400
10645
  if (!Array.isArray(requirements)) throw new Error("Invalid security requirements.");
@@ -10485,7 +10730,7 @@ function snapshot(documentValue, path, method) {
10485
10730
  for (const entry of security) for (const name of Object.keys(object(entry))) copy(`#/components/securitySchemes/${name.replace(/~/g, "~0").replace(/\//g, "~1")}`);
10486
10731
  return structuredClone(result);
10487
10732
  }
10488
- function schema$1(doc, schemaValue) {
10733
+ function schema(doc, schemaValue) {
10489
10734
  const defs = {};
10490
10735
  const ids = /* @__PURE__ */ new Map();
10491
10736
  function convert(value) {
@@ -10590,7 +10835,7 @@ function jsonContent(doc, value) {
10590
10835
  const json = mediaType == null ? void 0 : media[mediaType];
10591
10836
  if (json == null) throw new Error("Only JSON request and response bodies are supported.");
10592
10837
  return {
10593
- schema: schema$1(doc, object(json).schema ?? {}),
10838
+ schema: schema(doc, object(json).schema ?? {}),
10594
10839
  required: content.required === true,
10595
10840
  mediaType
10596
10841
  };
@@ -10609,7 +10854,7 @@ function openApiTask(config, name = "OpenAPI") {
10609
10854
  const { op } = operation(doc, config.path, config.method);
10610
10855
  const params = parameters(config);
10611
10856
  const inputs = params.map((p) => {
10612
- const jsonSchema = schema$1(doc, p.schema ?? {});
10857
+ const jsonSchema = schema(doc, p.schema ?? {});
10613
10858
  const defaultValue = typeof jsonSchema == "boolean" ? void 0 : object(jsonSchema).default;
10614
10859
  return {
10615
10860
  handle: `${p.in}.${p.name}`,
@@ -10647,7 +10892,7 @@ function openApiTask(config, name = "OpenAPI") {
10647
10892
  if (r.content == null) schemas.push({ type: "null" });
10648
10893
  else {
10649
10894
  jsonContent(doc, r);
10650
- for (const [mediaType, media] of Object.entries(object(r.content))) if (/^application\/(json|.+\+json)$/.test(mediaType)) schemas.push(schema$1(doc, object(media).schema ?? {}));
10895
+ for (const [mediaType, media] of Object.entries(object(r.content))) if (/^application\/(json|.+\+json)$/.test(mediaType)) schemas.push(schema(doc, object(media).schema ?? {}));
10651
10896
  }
10652
10897
  }
10653
10898
  if (!schemas.length) throw new Error("A successful JSON response definition is required.");
@@ -10702,1288 +10947,50 @@ function selectOperation(value, sourceUrl, path, method) {
10702
10947
  openApiTask(config);
10703
10948
  return config;
10704
10949
  }
10705
- `${JSON.stringify("open-flow-engine/v5")}`, new Set([
10706
- "assert",
10707
- "assert/strict",
10708
- "buffer",
10709
- "console",
10710
- "constants",
10711
- "crypto",
10712
- "events",
10713
- "fs",
10714
- "fs/promises",
10715
- "os",
10716
- "path",
10717
- "path/posix",
10718
- "process",
10719
- "punycode",
10720
- "querystring",
10721
- "stream",
10722
- "stream/promises",
10723
- "stream/web",
10724
- "string_decoder",
10725
- "timers",
10726
- "timers/promises",
10727
- "url",
10728
- "util",
10729
- "zlib"
10730
- ].flatMap((name) => [name, `node:${name}`])), `${JSON.stringify("open-flow-engine/v5/nodejs-compat-v1")}`;
10731
- //#endregion
10732
- //#region src/flow/common/agent.ts
10733
- var schema = lazy(() => union([boolean(), strictObject({
10734
- type: union([_enum([
10735
- "array",
10736
- "boolean",
10737
- "integer",
10738
- "null",
10739
- "number",
10740
- "object",
10741
- "string"
10742
- ]), array(_enum([
10743
- "array",
10744
- "boolean",
10745
- "integer",
10746
- "null",
10747
- "number",
10748
- "object",
10749
- "string"
10750
- ])).min(1)]).optional(),
10751
- const: json$3().optional(),
10752
- allOf: array(schema).min(1).optional(),
10753
- anyOf: array(schema).min(1).optional(),
10754
- oneOf: array(schema).min(1).optional(),
10755
- not: schema.optional(),
10756
- if: schema.optional(),
10757
- then: schema.optional(),
10758
- else: schema.optional(),
10759
- $ref: string().optional(),
10760
- $schema: _enum([
10761
- "http://json-schema.org/draft-07/schema#",
10762
- "https://json-schema.org/draft-07/schema",
10763
- "https://json-schema.org/draft/2019-09/schema",
10764
- "https://json-schema.org/draft/2020-12/schema"
10765
- ]).optional(),
10766
- $defs: record(string(), schema).optional(),
10767
- definitions: record(string(), schema).optional(),
10768
- pattern: string().refine((value) => {
10769
- try {
10770
- return new RegExp(value, "u").source.length > 0;
10771
- } catch {
10772
- return false;
10773
- }
10774
- }, "Invalid regular expression.").optional(),
10775
- format: string().refine((value) => Object.hasOwn(format, value), "Unsupported string format.").optional(),
10776
- multipleOf: number().positive().optional(),
10777
- uniqueItems: boolean().optional(),
10778
- contains: schema.optional(),
10779
- minContains: number().int().nonnegative().optional(),
10780
- maxContains: number().int().nonnegative().optional(),
10781
- minProperties: number().int().nonnegative().optional(),
10782
- maxProperties: number().int().nonnegative().optional(),
10783
- propertyNames: schema.optional(),
10784
- patternProperties: record(string().refine((value) => {
10785
- try {
10786
- return new RegExp(value, "u").source.length > 0;
10787
- } catch {
10788
- return false;
10789
- }
10790
- }, "Invalid regular expression."), schema).optional(),
10791
- dependentRequired: record(string(), array(string())).optional(),
10792
- dependentSchemas: record(string(), schema).optional(),
10793
- dependencies: record(string(), union([schema, array(string())])).optional(),
10794
- prefixItems: array(schema).optional(),
10795
- additionalItems: schema.optional(),
10796
- unevaluatedItems: schema.optional(),
10797
- unevaluatedProperties: schema.optional(),
10798
- description: string().optional(),
10799
- title: string().optional(),
10800
- default: json$3().optional(),
10801
- examples: array(json$3()).optional(),
10802
- readOnly: boolean().optional(),
10803
- writeOnly: boolean().optional(),
10804
- deprecated: boolean().optional(),
10805
- $comment: string().optional(),
10806
- enum: array(json$3()).min(1).optional(),
10807
- properties: record(string(), schema).optional(),
10808
- required: array(string()).optional(),
10809
- additionalProperties: schema.optional(),
10810
- items: union([schema, array(schema)]).optional(),
10811
- minItems: number().int().nonnegative().optional(),
10812
- maxItems: number().int().nonnegative().optional(),
10813
- minLength: number().int().nonnegative().optional(),
10814
- maxLength: number().int().nonnegative().optional(),
10815
- minimum: number().optional(),
10816
- maximum: number().optional(),
10817
- exclusiveMinimum: number().optional(),
10818
- exclusiveMaximum: number().optional()
10819
- }).transform(({ title: _title, default: _default, examples: _examples, readOnly: _readOnly, writeOnly: _writeOnly, deprecated: _deprecated, $comment: _comment, ...value }) => value)]));
10820
- new TextEncoder();
10821
10950
  //#endregion
10822
- //#region ../../node_modules/.bun/@babel+parser@8.0.4/node_modules/@babel/parser/lib/index.js
10823
- var Position = class {
10824
- constructor(line, col, index) {
10825
- this.line = void 0;
10826
- this.column = void 0;
10827
- if (index !== void 0) this.index = void 0;
10828
- this.line = line;
10829
- this.column = col;
10830
- if (index !== void 0) this.index = index;
10831
- }
10832
- };
10833
- var SourceLocation = class {
10834
- start;
10835
- end;
10836
- filename;
10837
- identifierName;
10838
- constructor(start, end) {
10839
- this.start = start;
10840
- this.end = end;
10841
- }
10842
- };
10843
- var code = "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";
10844
- var ModuleErrors = {
10845
- ImportMetaOutsideModule: {
10846
- message: `import.meta may appear only with 'sourceType: "module"'`,
10847
- code
10848
- },
10849
- ImportOutsideModule: {
10850
- message: `'import' and 'export' may appear only with 'sourceType: "module"'`,
10851
- code
10852
- }
10853
- };
10854
- var NodeDescriptions = {
10855
- ArrayPattern: "array destructuring pattern",
10856
- AssignmentExpression: "assignment expression",
10857
- AssignmentPattern: "assignment expression",
10858
- ArrowFunctionExpression: "arrow function expression",
10859
- ConditionalExpression: "conditional expression",
10860
- CatchClause: "catch clause",
10861
- ForOfStatement: "for-of statement",
10862
- ForInStatement: "for-in statement",
10863
- ForStatement: "for-loop",
10864
- FormalParameters: "function parameter list",
10865
- Identifier: "identifier",
10866
- ImportSpecifier: "import specifier",
10867
- ImportDefaultSpecifier: "import default specifier",
10868
- ImportNamespaceSpecifier: "import namespace specifier",
10869
- ObjectPattern: "object destructuring pattern",
10870
- ParenthesizedExpression: "parenthesized expression",
10871
- RestElement: "rest element",
10872
- UpdateExpression: {
10873
- true: "prefix operation",
10874
- false: "postfix operation"
10875
- },
10876
- VariableDeclarator: "variable declaration",
10877
- YieldExpression: "yield expression"
10878
- };
10879
- var toNodeDescription = (node) => node.type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[`${node.prefix}`] : NodeDescriptions[node.type];
10880
- var StandardErrors = {
10881
- AccessorIsGenerator: ({ kind }) => `A ${kind}ter cannot be a generator.`,
10882
- ArgumentsInClass: "'arguments' is only allowed in functions and class methods.",
10883
- AsyncFunctionInSingleStatementContext: "Async functions can only be declared at the top level or inside a block.",
10884
- AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function.",
10885
- AwaitBindingIdentifierInStaticBlock: "Can not use 'await' as identifier inside a static block.",
10886
- AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.",
10887
- AwaitUsingNotInAsyncContext: "'await using' is only allowed within async functions and at the top levels of modules.",
10888
- AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.",
10889
- BadGetterArity: "A 'get' accessor must not have any formal parameters.",
10890
- BadSetterArity: "A 'set' accessor must have exactly one formal parameter.",
10891
- BadSetterRestParameter: "A 'set' accessor function argument must not be a rest parameter.",
10892
- ConstructorClassField: "Classes may not have a field named 'constructor'.",
10893
- ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'.",
10894
- ConstructorIsAccessor: "Class constructor may not be an accessor.",
10895
- ConstructorIsAsync: "Constructor can't be an async function.",
10896
- ConstructorIsGenerator: "Constructor can't be a generator.",
10897
- DeclarationMissingInitializer: ({ kind }) => `Missing initializer in ${kind} declaration.`,
10898
- DecoratorArgumentsOutsideParentheses: "Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",
10899
- DecoratorsBeforeAfterExport: "Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",
10900
- DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
10901
- DecoratorSemicolon: "Decorators must not be followed by a semicolon.",
10902
- DecoratorStaticBlock: "Decorators can't be used with a static block.",
10903
- DeferImportRequiresNamespace: "Only `import defer * as x from \"./module\"` is valid.",
10904
- DeletePrivateField: "Deleting a private field is not allowed.",
10905
- DestructureNamedImport: "ES2015 named imports do not destructure. Use another statement for destructuring after the import.",
10906
- DuplicateConstructor: "Duplicate constructor in the same class.",
10907
- DuplicateDefaultExport: "Only one default export allowed per module.",
10908
- DuplicateExport: ({ exportName }) => `\`${exportName}\` has already been exported. Exported identifiers must be unique.`,
10909
- DuplicateProto: "Redefinition of __proto__ property.",
10910
- DuplicateRegExpFlags: "Duplicate regular expression flag.",
10911
- ElementAfterRest: "Rest element must be last element.",
10912
- EscapedCharNotAnIdentifier: "Invalid Unicode escape.",
10913
- ExportBindingIsString: ({ localName, exportName }) => `A string literal cannot be used as an exported binding without \`from\`.\n- Did you mean \`export { '${localName}' as '${exportName}' } from 'some-module'\`?`,
10914
- ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.",
10915
- ForInOfLoopInitializer: ({ type }) => `'${type === "ForInStatement" ? "for-in" : "for-of"}' loop variable declaration may not have an initializer.`,
10916
- ForInUsing: "For-in loop may not start with 'using' declaration.",
10917
- ForOfAsync: "The left-hand side of a for-of loop may not be 'async'.",
10918
- ForOfLet: "The left-hand side of a for-of loop may not start with 'let'.",
10919
- GeneratorInSingleStatementContext: "Generators can only be declared at the top level or inside a block.",
10920
- IllegalBreakContinue: ({ type }) => `Unsyntactic ${type === "BreakStatement" ? "break" : "continue"}.`,
10921
- IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.",
10922
- IllegalReturn: "'return' outside of function.",
10923
- ImportBindingIsString: ({ importName }) => `A string literal cannot be used as an imported binding.\n- Did you mean \`import { "${importName}" as foo }\`?`,
10924
- ImportCallArity: ({ phase }) => `\`import${phase ? `.${phase}` : ""}()\` requires exactly one or two arguments.`,
10925
- ImportCallNotNewExpression: ({ phase }) => `Cannot use new with import${phase ? `.${phase}` : ""}().`,
10926
- ImportCallSpreadArgument: ({ phase }) => `\`...\` is not allowed in \`import${phase ? `.${phase}` : ""}()\`.`,
10927
- IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
10928
- InvalidBigIntLiteral: "Invalid BigIntLiteral.",
10929
- InvalidCodePoint: "Code point out of bounds.",
10930
- InvalidCoverDiscardElement: "'void' must be followed by an expression when not used in a binding position.",
10931
- InvalidCoverInitializedName: "Invalid shorthand property initializer.",
10932
- InvalidDigit: ({ radix }) => `Expected number in radix ${radix}.`,
10933
- InvalidEscapeSequence: "Bad character escape sequence.",
10934
- InvalidEscapeSequenceTemplate: "Invalid escape sequence in template.",
10935
- InvalidEscapedReservedWord: ({ reservedWord }) => `Escape sequence in keyword ${reservedWord}.`,
10936
- InvalidIdentifier: ({ identifierName }) => `Invalid identifier ${identifierName}.`,
10937
- InvalidLhs: ({ ancestor }) => `Invalid left-hand side in ${toNodeDescription(ancestor)}.`,
10938
- InvalidLhsBinding: ({ ancestor }) => `Binding invalid left-hand side in ${toNodeDescription(ancestor)}.`,
10939
- InvalidLhsOptionalChaining: ({ ancestor }) => `Invalid optional chaining in the left-hand side of ${toNodeDescription(ancestor)}.`,
10940
- InvalidNumber: "Invalid number.",
10941
- InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.",
10942
- InvalidOrUnexpectedToken: ({ unexpected }) => `Unexpected character '${unexpected}'.`,
10943
- InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern.",
10944
- InvalidPrivateFieldResolution: ({ identifierName }) => `Private name #${identifierName} is not defined.`,
10945
- InvalidPropertyBindingPattern: "Binding member expression.",
10946
- InvalidRestAssignmentPattern: "Invalid rest operator's argument.",
10947
- LabelRedeclaration: ({ labelName }) => `Label '${labelName}' is already declared.`,
10948
- LetInLexicalBinding: "'let' is disallowed as a lexically bound name.",
10949
- LineTerminatorBeforeArrow: "No line break is allowed before '=>'.",
10950
- MalformedRegExpFlags: "Invalid regular expression flag.",
10951
- MissingClassName: "A class name is required.",
10952
- MissingEqInAssignment: "Only '=' operator can be used for specifying default value.",
10953
- MissingSemicolon: "Missing semicolon.",
10954
- MissingPlugin: ({ missingPlugin }) => `This experimental syntax requires enabling the parser plugin: ${missingPlugin.map((name) => JSON.stringify(name)).join(", ")}.`,
10955
- MissingOneOfPlugins: ({ missingPlugin }) => `This experimental syntax requires enabling one of the following parser plugin(s): ${missingPlugin.map((name) => JSON.stringify(name)).join(", ")}.`,
10956
- MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX.",
10957
- MixingCoalesceWithLogical: "Nullish coalescing operator(??) requires parens when mixing with logical operators.",
10958
- ModuleAttributeInvalidValue: "Only string literals are allowed as module attribute values.",
10959
- ModuleAttributesWithDuplicateKeys: ({ key }) => `Duplicate key "${key}" is not allowed in module attributes.`,
10960
- ModuleExportNameHasLoneSurrogate: ({ surrogateCharCode }) => `An export name cannot include a lone surrogate, found '\\u${surrogateCharCode.toString(16)}'.`,
10961
- ModuleExportUndefined: ({ localName }) => `Export '${localName}' is not defined.`,
10962
- MultipleDefaultsInSwitch: "Multiple default clauses.",
10963
- NewlineAfterThrow: "Illegal newline after throw.",
10964
- NoCatchOrFinally: "Missing catch or finally clause.",
10965
- NumberIdentifier: "Identifier directly after number.",
10966
- NumericSeparatorInEscapeSequence: "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",
10967
- ObsoleteAwaitStar: "'await*' has been removed from the async functions proposal. Use Promise.all() instead.",
10968
- OptionalChainingNoNew: "Constructors in/after an Optional Chain are not allowed.",
10969
- OptionalChainingNoTemplate: "Tagged Template Literals are not allowed in optionalChain.",
10970
- OverrideOnConstructor: "'override' modifier cannot appear on a constructor declaration.",
10971
- ParamDupe: "Argument name clash.",
10972
- PatternHasAccessor: "Object pattern can't contain getter or setter.",
10973
- PatternHasMethod: "Object pattern can't contain methods.",
10974
- PrivateInExpectedIn: ({ identifierName }) => `Private names are only allowed in property accesses (\`obj.#${identifierName}\`) or in \`in\` expressions (\`#${identifierName} in obj\`).`,
10975
- PrivateNameRedeclaration: ({ identifierName }) => `Duplicate private name #${identifierName}.`,
10976
- RestTrailingComma: "Unexpected trailing comma after rest element.",
10977
- SloppyFunction: "In non-strict mode code, functions can only be declared at top level or inside a block.",
10978
- SloppyFunctionAnnexB: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",
10979
- SourcePhaseImportRequiresDefault: "Only `import source x from \"./module\"` is valid.",
10980
- StaticPrototype: "Classes may not have static property named prototype.",
10981
- SuperCallNotNewExpression: "Cannot use new with super(...).",
10982
- SuperNotAllowed: "`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",
10983
- SuperPrivateField: "Private fields can't be accessed on super.",
10984
- TrailingDecorator: "Decorators must be attached to a class element.",
10985
- UnexpectedArgumentPlaceholder: "Unexpected argument placeholder.",
10986
- UnexpectedDigitAfterHash: "Unexpected digit after hash token.",
10987
- UnexpectedImportExport: "'import' and 'export' may only appear at the top level.",
10988
- UnexpectedKeyword: ({ keyword }) => `Unexpected keyword '${keyword}'.`,
10989
- UnexpectedLeadingDecorator: "Leading decorators must be attached to a class declaration.",
10990
- UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context.",
10991
- UnexpectedNewTarget: "`new.target` can only be used in functions or class properties.",
10992
- UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits.",
10993
- UnexpectedPrivateField: "Unexpected private name.",
10994
- UnexpectedReservedWord: ({ reservedWord }) => `Unexpected reserved word '${reservedWord}'.`,
10995
- UnexpectedSuper: "'super' is only allowed in object methods and classes.",
10996
- UnexpectedToken: ({ expected, unexpected }) => `Unexpected token${unexpected ? ` '${unexpected}'.` : ""}${expected ? `, expected "${expected}"` : ""}`,
10997
- UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
10998
- UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",
10999
- UnexpectedVoidPattern: "Unexpected void binding.",
11000
- UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
11001
- UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
11002
- UnsupportedImport: "`import` can only be used in `import()` or `import.meta`.",
11003
- UnsupportedMetaProperty: ({ target, onlyValidPropertyName }) => `The only valid meta property for ${target} is ${target}.${onlyValidPropertyName}.`,
11004
- UnsupportedParameterDecorator: "Decorators cannot be used to decorate parameters.",
11005
- UnsupportedPropertyDecorator: "Decorators cannot be used to decorate object literal properties.",
11006
- UnsupportedSuper: "'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",
11007
- UnterminatedComment: "Unterminated comment.",
11008
- UnterminatedRegExp: "Unterminated regular expression.",
11009
- UnterminatedString: "Unterminated string constant.",
11010
- UnterminatedTemplate: "Unterminated template.",
11011
- UsingDeclarationExport: "Using declaration cannot be exported.",
11012
- UsingDeclarationHasBindingPattern: "Using declaration cannot have destructuring patterns.",
11013
- VarRedeclaration: ({ identifierName }) => `Identifier '${identifierName}' has already been declared.`,
11014
- VoidPatternCatchClauseParam: "A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",
11015
- VoidPatternInitializer: "A void binding may not have an initializer.",
11016
- YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.",
11017
- YieldInParameter: "Yield expression is not allowed in formal parameters.",
11018
- YieldNotInGeneratorFunction: "'yield' is only allowed within generator functions.",
11019
- ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0."
11020
- };
11021
- var StrictModeErrors = {
11022
- StrictDelete: "Deleting local variable in strict mode.",
11023
- StrictEvalArguments: ({ referenceName }) => `Assigning to '${referenceName}' in strict mode.`,
11024
- StrictEvalArgumentsBinding: ({ bindingName }) => `Binding '${bindingName}' in strict mode.`,
11025
- StrictFunction: "In strict mode code, functions can only be declared at top level or inside a block.",
11026
- StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'.",
11027
- StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.",
11028
- StrictWith: "'with' in strict mode."
11029
- };
11030
- var ParseExpressionErrors = {
11031
- ParseExpressionEmptyInput: "Unexpected parseExpression() input: The input is empty or contains only comments.",
11032
- ParseExpressionExpectsEOF: ({ unexpected }) => `Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(unexpected)}\`.`
11033
- };
11034
- var PipelineOperatorErrors = {
11035
- PipeTopicRequiresHackPipes: "Topic references are only supported when using the `\"proposal\": \"hack\"` version of the pipeline proposal.",
11036
- PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
11037
- PipeTopicUnconfiguredToken: ({ token }) => `Invalid topic token ${token}. In order to use ${token} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${token}" }.`,
11038
- PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",
11039
- PipeUnparenthesizedBody: ({ type }) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({ type })}; please wrap it in parentheses.`,
11040
- PipelineUnparenthesized: "Cannot mix binary operator with solo-await F#-style pipeline. Please wrap the pipeline in parentheses."
11041
- };
11042
- var FunctionBindErrors = {
11043
- UnsupportedBind: "Binding should be performed on object property.",
11044
- UnsupportedBindRHS: "The right-hand side of binding can not be super or import."
10951
+ //#region src/control/common/authoringExamples.ts
10952
+ var descriptions = {
10953
+ "manual": "A Manual start node.",
10954
+ "error": "A Flow Error node. Select upstream Flows, then publish and enable this Flow to listen for failures in their automatic runs.",
10955
+ "webhook": "A Webhook start node.",
10956
+ "cron": "An hourly scheduled start node.",
10957
+ "poll": "Gmail polling by key; replace CONNECTION_ID with an active Gmail connection.",
10958
+ "integration": "Telegram webhook integration by key; replace CONNECTION_ID with an active Telegram connection.",
10959
+ "decision": "AI Decision evaluates named questions against target and returns a complete answer object per output. Configure target before running.",
10960
+ "openapi": "A fixed JSON API operation. Replace the example document and URL before running.",
10961
+ "connector": "A Connector Task and its node. Replace ACTION_ID, CONNECTION_ID and port definitions using connector_get / connector show.",
10962
+ "code": "A JavaScript module and its node. Use Code for custom computation; use Connector Tasks for existing actions.",
10963
+ "condition": "A condition with true and false execution branches.",
10964
+ "value": "A fixed value node.",
10965
+ "approval": "An Approval with approve and reject decision branches and a built-in notification output.",
10966
+ "wait": "A Wait with a continue action and a built-in notification output.",
10967
+ "agent": "An Agent with code computation enabled. Configure a model available in the deployment.",
10968
+ "llm-chat": "An LLM chat Task and its node; configure a model available in the deployment.",
10969
+ "llm-json": "An LLM JSON Task and its node; configure a model available in the deployment.",
10970
+ "poll-notification": "Gmail events → JavaScript text formatting → Connector notification. Replace connection/action IDs and match the notification input ports."
11045
10971
  };
11046
- function defineHidden(obj, key, value) {
11047
- Object.defineProperty(obj, key, {
11048
- enumerable: false,
11049
- configurable: true,
11050
- value
11051
- });
11052
- }
11053
- function toParseErrorConstructor({ toMessage, code, reasonCode, syntaxPlugin }) {
11054
- const hasMissingPlugin = reasonCode === "MissingPlugin" || reasonCode === "MissingOneOfPlugins";
11055
- return function constructor(loc, pos, details) {
11056
- const error = /* @__PURE__ */ new SyntaxError();
11057
- error.code = code;
11058
- error.reasonCode = reasonCode;
11059
- error.loc = loc;
11060
- error.pos = pos;
11061
- error.syntaxPlugin = syntaxPlugin;
11062
- if (hasMissingPlugin) error.missingPlugin = details.missingPlugin;
11063
- defineHidden(error, "clone", function clone(overrides = {}) {
11064
- const { line, column, index = pos } = overrides.loc ?? loc;
11065
- return constructor(new Position(line, column), index, {
11066
- ...details,
11067
- ...overrides.details
11068
- });
11069
- });
11070
- defineHidden(error, "details", details);
11071
- Object.defineProperty(error, "message", {
11072
- configurable: true,
11073
- get() {
11074
- const message = `${toMessage(details)} (${loc.line}:${loc.column})`;
11075
- this.message = message;
11076
- return message;
11077
- },
11078
- set(value) {
11079
- Object.defineProperty(this, "message", {
11080
- value,
11081
- writable: true
11082
- });
11083
- }
11084
- });
11085
- return error;
11086
- };
11087
- }
11088
- function ParseErrorEnum(argument, syntaxPlugin) {
11089
- if (Array.isArray(argument)) return (parseErrorTemplates) => ParseErrorEnum(parseErrorTemplates, argument[0]);
11090
- const ParseErrorConstructors = {};
11091
- for (const reasonCode of Object.keys(argument)) {
11092
- const template = argument[reasonCode];
11093
- const { message, ...rest } = typeof template === "string" ? { message: () => template } : typeof template === "function" ? { message: template } : template;
11094
- ParseErrorConstructors[reasonCode] = toParseErrorConstructor({
11095
- code: "BABEL_PARSER_SYNTAX_ERROR",
11096
- reasonCode,
11097
- toMessage: typeof message === "string" ? () => message : message,
11098
- ...syntaxPlugin ? { syntaxPlugin } : {},
11099
- ...rest
11100
- });
11101
- }
11102
- return ParseErrorConstructors;
11103
- }
11104
- ({
11105
- ...ParseErrorEnum(ModuleErrors),
11106
- ...ParseErrorEnum(StandardErrors),
11107
- ...ParseErrorEnum(StrictModeErrors),
11108
- ...ParseErrorEnum(ParseExpressionErrors),
11109
- ...ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors),
11110
- ...ParseErrorEnum`functionBind`(FunctionBindErrors)
11111
- });
11112
- var beforeExpr = true;
11113
- var startsExpr = true;
11114
- var isLoop = true;
11115
- var isAssign = true;
11116
- var prefix = true;
11117
- var postfix = true;
11118
- var ExportedTokenType = class {
11119
- label;
11120
- keyword;
11121
- beforeExpr;
11122
- startsExpr;
11123
- rightAssociative;
11124
- isLoop;
11125
- isAssign;
11126
- prefix;
11127
- postfix;
11128
- binop;
11129
- constructor(label, conf = {}) {
11130
- this.label = label;
11131
- this.keyword = conf.keyword;
11132
- this.beforeExpr = !!conf.beforeExpr;
11133
- this.startsExpr = !!conf.startsExpr;
11134
- this.rightAssociative = !!conf.rightAssociative;
11135
- this.isLoop = !!conf.isLoop;
11136
- this.isAssign = !!conf.isAssign;
11137
- this.prefix = !!conf.prefix;
11138
- this.postfix = !!conf.postfix;
11139
- this.binop = conf.binop != null ? conf.binop : null;
11140
- }
11141
- };
11142
- var keywords$1 = /* @__PURE__ */ new Map();
11143
- function createKeyword(name, options = {}) {
11144
- options.keyword = name;
11145
- const token = createToken(name, options);
11146
- keywords$1.set(name, token);
11147
- return token;
11148
- }
11149
- function createBinop(name, binop) {
11150
- return createToken(name, {
11151
- beforeExpr,
11152
- binop
11153
- });
11154
- }
11155
- var tokenTypeCounter = -1;
11156
- var tokenTypes = [];
11157
- var tokenLabels = [];
11158
- var tokenBinops = [];
11159
- var tokenBeforeExprs = [];
11160
- var tokenStartsExprs = [];
11161
- var tokenPrefixes = [];
11162
- function createToken(name, options = {}) {
11163
- ++tokenTypeCounter;
11164
- tokenLabels.push(name);
11165
- tokenBinops.push(options.binop ?? -1);
11166
- tokenBeforeExprs.push(options.beforeExpr ?? false);
11167
- tokenStartsExprs.push(options.startsExpr ?? false);
11168
- tokenPrefixes.push(options.prefix ?? false);
11169
- tokenTypes.push(new ExportedTokenType(name, options));
11170
- return tokenTypeCounter;
11171
- }
11172
- function createKeywordLike(name, options = {}) {
11173
- ++tokenTypeCounter;
11174
- keywords$1.set(name, tokenTypeCounter);
11175
- tokenLabels.push(name);
11176
- tokenBinops.push(options.binop ?? -1);
11177
- tokenBeforeExprs.push(options.beforeExpr ?? false);
11178
- tokenStartsExprs.push(options.startsExpr ?? false);
11179
- tokenPrefixes.push(options.prefix ?? false);
11180
- tokenTypes.push(new ExportedTokenType("name", options));
11181
- return tokenTypeCounter;
11182
- }
11183
- var tt = {
11184
- bracketL: createToken("[", {
11185
- beforeExpr,
11186
- startsExpr
11187
- }),
11188
- bracketR: createToken("]"),
11189
- braceL: createToken("{", {
11190
- beforeExpr,
11191
- startsExpr
11192
- }),
11193
- braceBarL: createToken("{|", {
11194
- beforeExpr,
11195
- startsExpr
11196
- }),
11197
- braceR: createToken("}"),
11198
- braceBarR: createToken("|}"),
11199
- parenL: createToken("(", {
11200
- beforeExpr,
11201
- startsExpr
11202
- }),
11203
- parenR: createToken(")"),
11204
- comma: createToken(",", { beforeExpr }),
11205
- semi: createToken(";", { beforeExpr }),
11206
- colon: createToken(":", { beforeExpr }),
11207
- doubleColon: createToken("::", { beforeExpr }),
11208
- dot: createToken("."),
11209
- question: createToken("?", { beforeExpr }),
11210
- questionDot: createToken("?."),
11211
- arrow: createToken("=>", { beforeExpr }),
11212
- template: createToken("template"),
11213
- ellipsis: createToken("...", { beforeExpr }),
11214
- backQuote: createToken("`", { startsExpr }),
11215
- dollarBraceL: createToken("${", {
11216
- beforeExpr,
11217
- startsExpr
11218
- }),
11219
- templateTail: createToken("...`", { startsExpr }),
11220
- templateNonTail: createToken("...${", {
11221
- beforeExpr,
11222
- startsExpr
11223
- }),
11224
- at: createToken("@"),
11225
- hash: createToken("#", { startsExpr }),
11226
- interpreterDirective: createToken("#!..."),
11227
- eq: createToken("=", {
11228
- beforeExpr,
11229
- isAssign
11230
- }),
11231
- assign: createToken("_=", {
11232
- beforeExpr,
11233
- isAssign
11234
- }),
11235
- slashAssign: createToken("_=", {
11236
- beforeExpr,
11237
- isAssign
11238
- }),
11239
- xorAssign: createToken("_=", {
11240
- beforeExpr,
11241
- isAssign
11242
- }),
11243
- moduloAssign: createToken("_=", {
11244
- beforeExpr,
11245
- isAssign
11246
- }),
11247
- incDec: createToken("++/--", {
11248
- prefix,
11249
- postfix,
11250
- startsExpr
11251
- }),
11252
- bang: createToken("!", {
11253
- beforeExpr,
11254
- prefix,
11255
- startsExpr
11256
- }),
11257
- tilde: createToken("~", {
11258
- beforeExpr,
11259
- prefix,
11260
- startsExpr
11261
- }),
11262
- doubleCaret: createToken("^^", { startsExpr }),
11263
- doubleAt: createToken("@@", { startsExpr }),
11264
- pipeline: createBinop("|>", 0),
11265
- nullishCoalescing: createBinop("??", 1),
11266
- logicalOR: createBinop("||", 1),
11267
- logicalAND: createBinop("&&", 2),
11268
- bitwiseOR: createBinop("|", 3),
11269
- bitwiseXOR: createBinop("^", 4),
11270
- bitwiseAND: createBinop("&", 5),
11271
- equality: createBinop("==/!=/===/!==", 6),
11272
- lt: createBinop("</>/<=/>=", 7),
11273
- gt: createBinop("</>/<=/>=", 7),
11274
- relational: createBinop("</>/<=/>=", 7),
11275
- bitShift: createBinop("<</>>/>>>", 8),
11276
- bitShiftL: createBinop("<</>>/>>>", 8),
11277
- bitShiftR: createBinop("<</>>/>>>", 8),
11278
- plusMin: createToken("+/-", {
11279
- beforeExpr,
11280
- binop: 9,
11281
- prefix,
11282
- startsExpr
11283
- }),
11284
- modulo: createToken("%", {
11285
- binop: 10,
11286
- startsExpr
11287
- }),
11288
- star: createToken("*", { binop: 10 }),
11289
- slash: createBinop("/", 10),
11290
- exponent: createToken("**", {
11291
- beforeExpr,
11292
- binop: 11,
11293
- rightAssociative: true
11294
- }),
11295
- _in: createKeyword("in", {
11296
- beforeExpr,
11297
- binop: 7
11298
- }),
11299
- _instanceof: createKeyword("instanceof", {
11300
- beforeExpr,
11301
- binop: 7
11302
- }),
11303
- _break: createKeyword("break"),
11304
- _case: createKeyword("case", { beforeExpr }),
11305
- _catch: createKeyword("catch"),
11306
- _continue: createKeyword("continue"),
11307
- _debugger: createKeyword("debugger"),
11308
- _default: createKeyword("default", { beforeExpr }),
11309
- _else: createKeyword("else", { beforeExpr }),
11310
- _finally: createKeyword("finally"),
11311
- _function: createKeyword("function", { startsExpr }),
11312
- _if: createKeyword("if"),
11313
- _return: createKeyword("return", { beforeExpr }),
11314
- _switch: createKeyword("switch"),
11315
- _throw: createKeyword("throw", {
11316
- beforeExpr,
11317
- prefix,
11318
- startsExpr
11319
- }),
11320
- _try: createKeyword("try"),
11321
- _var: createKeyword("var"),
11322
- _const: createKeyword("const"),
11323
- _with: createKeyword("with"),
11324
- _new: createKeyword("new", {
11325
- beforeExpr,
11326
- startsExpr
11327
- }),
11328
- _this: createKeyword("this", { startsExpr }),
11329
- _super: createKeyword("super", { startsExpr }),
11330
- _class: createKeyword("class", { startsExpr }),
11331
- _extends: createKeyword("extends", { beforeExpr }),
11332
- _export: createKeyword("export"),
11333
- _import: createKeyword("import", { startsExpr }),
11334
- _null: createKeyword("null", { startsExpr }),
11335
- _true: createKeyword("true", { startsExpr }),
11336
- _false: createKeyword("false", { startsExpr }),
11337
- _typeof: createKeyword("typeof", {
11338
- beforeExpr,
11339
- prefix,
11340
- startsExpr
11341
- }),
11342
- _void: createKeyword("void", {
11343
- beforeExpr,
11344
- prefix,
11345
- startsExpr
11346
- }),
11347
- _delete: createKeyword("delete", {
11348
- beforeExpr,
11349
- prefix,
11350
- startsExpr
11351
- }),
11352
- _do: createKeyword("do", {
11353
- isLoop,
11354
- beforeExpr
11355
- }),
11356
- _for: createKeyword("for", { isLoop }),
11357
- _while: createKeyword("while", { isLoop }),
11358
- _as: createKeywordLike("as", { startsExpr }),
11359
- _assert: createKeywordLike("assert", { startsExpr }),
11360
- _async: createKeywordLike("async", { startsExpr }),
11361
- _await: createKeywordLike("await", { startsExpr }),
11362
- _defer: createKeywordLike("defer", { startsExpr }),
11363
- _from: createKeywordLike("from", { startsExpr }),
11364
- _get: createKeywordLike("get", { startsExpr }),
11365
- _let: createKeywordLike("let", { startsExpr }),
11366
- _meta: createKeywordLike("meta", { startsExpr }),
11367
- _of: createKeywordLike("of", { startsExpr }),
11368
- _sent: createKeywordLike("sent", { startsExpr }),
11369
- _set: createKeywordLike("set", { startsExpr }),
11370
- _source: createKeywordLike("source", { startsExpr }),
11371
- _static: createKeywordLike("static", { startsExpr }),
11372
- _using: createKeywordLike("using", { startsExpr }),
11373
- _yield: createKeywordLike("yield", { startsExpr }),
11374
- _asserts: createKeywordLike("asserts", { startsExpr }),
11375
- _checks: createKeywordLike("checks", { startsExpr }),
11376
- _exports: createKeywordLike("exports", { startsExpr }),
11377
- _global: createKeywordLike("global", { startsExpr }),
11378
- _implements: createKeywordLike("implements", { startsExpr }),
11379
- _intrinsic: createKeywordLike("intrinsic", { startsExpr }),
11380
- _infer: createKeywordLike("infer", { startsExpr }),
11381
- _is: createKeywordLike("is", { startsExpr }),
11382
- _mixins: createKeywordLike("mixins", { startsExpr }),
11383
- _proto: createKeywordLike("proto", { startsExpr }),
11384
- _require: createKeywordLike("require", { startsExpr }),
11385
- _satisfies: createKeywordLike("satisfies", { startsExpr }),
11386
- _keyof: createKeywordLike("keyof", { startsExpr }),
11387
- _readonly: createKeywordLike("readonly", { startsExpr }),
11388
- _unique: createKeywordLike("unique", { startsExpr }),
11389
- _abstract: createKeywordLike("abstract", { startsExpr }),
11390
- _declare: createKeywordLike("declare", { startsExpr }),
11391
- _enum: createKeywordLike("enum", { startsExpr }),
11392
- _module: createKeywordLike("module", { startsExpr }),
11393
- _namespace: createKeywordLike("namespace", { startsExpr }),
11394
- _interface: createKeywordLike("interface", { startsExpr }),
11395
- _type: createKeywordLike("type", { startsExpr }),
11396
- _opaque: createKeywordLike("opaque", { startsExpr }),
11397
- name: createToken("name", { startsExpr }),
11398
- placeholder: createToken("%%", { startsExpr }),
11399
- string: createToken("string", { startsExpr }),
11400
- num: createToken("num", { startsExpr }),
11401
- bigint: createToken("bigint", { startsExpr }),
11402
- regexp: createToken("regexp", { startsExpr }),
11403
- privateName: createToken("#name", { startsExpr }),
11404
- eof: createToken("eof"),
11405
- jsxName: createToken("jsxName"),
11406
- jsxText: createToken("jsxText", { beforeExpr }),
11407
- jsxTagStart: createToken("jsxTagStart", { startsExpr }),
11408
- jsxTagEnd: createToken("jsxTagEnd")
11409
- };
11410
- function getExportedToken(token) {
11411
- return tokenTypes[token];
11412
- }
11413
- var TokContext = class {
11414
- constructor(token, preserveSpace) {
11415
- this.token = token;
11416
- this.preserveSpace = !!preserveSpace;
11417
- }
11418
- token;
11419
- preserveSpace;
11420
- };
11421
- new TokContext("{"), new TokContext("<tag"), new TokContext("</tag"), new TokContext("<tag>...</tag>", true);
11422
- var reservedWords = {
11423
- keyword: [
11424
- "break",
11425
- "case",
11426
- "catch",
11427
- "continue",
11428
- "debugger",
11429
- "default",
11430
- "do",
11431
- "else",
11432
- "finally",
11433
- "for",
11434
- "function",
11435
- "if",
11436
- "return",
11437
- "switch",
11438
- "throw",
11439
- "try",
11440
- "var",
11441
- "const",
11442
- "while",
11443
- "with",
11444
- "new",
11445
- "this",
11446
- "super",
11447
- "class",
11448
- "extends",
11449
- "export",
11450
- "import",
11451
- "null",
11452
- "true",
11453
- "false",
11454
- "in",
11455
- "instanceof",
11456
- "typeof",
11457
- "void",
11458
- "delete"
11459
- ],
11460
- strict: [
11461
- "implements",
11462
- "interface",
11463
- "let",
11464
- "package",
11465
- "private",
11466
- "protected",
11467
- "public",
11468
- "static",
11469
- "yield"
11470
- ],
11471
- strictBind: ["eval", "arguments"]
11472
- };
11473
- new Set(reservedWords.keyword);
11474
- new Set(reservedWords.strict);
11475
- new Set(reservedWords.strictBind);
11476
- ParseErrorEnum`flow`({
11477
- AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
11478
- AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",
11479
- AssignReservedType: ({ reservedType }) => `Cannot overwrite reserved type ${reservedType}.`,
11480
- DeclareClassElement: "The `declare` modifier can only appear on class fields.",
11481
- DeclareClassFieldInitializer: "Initializers are not allowed in fields with the `declare` modifier.",
11482
- DuplicateDeclareModuleExports: "Duplicate `declare module.exports` statement.",
11483
- EnumBooleanMemberNotInitialized: ({ memberName, enumName }) => `Boolean enum members need to be initialized. Use either \`${memberName} = true,\` or \`${memberName} = false,\` in enum \`${enumName}\`.`,
11484
- EnumDuplicateMemberName: ({ memberName, enumName }) => `Enum member names need to be unique, but the name \`${memberName}\` has already been used before in enum \`${enumName}\`.`,
11485
- EnumInconsistentMemberValues: ({ enumName }) => `Enum \`${enumName}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,
11486
- EnumInvalidExplicitType: ({ invalidEnumType, enumName }) => `Enum type \`${invalidEnumType}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,
11487
- EnumInvalidExplicitTypeUnknownSupplied: ({ enumName }) => `Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,
11488
- EnumInvalidMemberInitializerPrimaryType: ({ enumName, memberName, explicitType }) => `Enum \`${enumName}\` has type \`${explicitType}\`, so the initializer of \`${memberName}\` needs to be a ${explicitType} literal.`,
11489
- EnumInvalidMemberInitializerSymbolType: ({ enumName, memberName }) => `Symbol enum members cannot be initialized. Use \`${memberName},\` in enum \`${enumName}\`.`,
11490
- EnumInvalidMemberInitializerUnknownType: ({ enumName, memberName }) => `The enum member initializer for \`${memberName}\` needs to be a literal (either a boolean, number, or string) in enum \`${enumName}\`.`,
11491
- EnumInvalidMemberName: ({ enumName, memberName, suggestion }) => `Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${memberName}\`, consider using \`${suggestion}\`, in enum \`${enumName}\`.`,
11492
- EnumNumberMemberNotInitialized: ({ enumName, memberName }) => `Number enum members need to be initialized, e.g. \`${memberName} = 1\` in enum \`${enumName}\`.`,
11493
- EnumStringMemberInconsistentlyInitialized: ({ enumName }) => `String enum members need to consistently either all use initializers, or use no initializers, in enum \`${enumName}\`.`,
11494
- GetterMayNotHaveThisParam: "A getter cannot have a `this` parameter.",
11495
- ImportTypeShorthandOnlyInPureImport: "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",
11496
- InexactInsideExact: "Explicit inexact syntax cannot appear inside an explicit exact object type.",
11497
- InexactInsideNonObject: "Explicit inexact syntax cannot appear in class or interface definitions.",
11498
- InexactVariance: "Explicit inexact syntax cannot have variance.",
11499
- InvalidNonTypeImportInDeclareModule: "Imports within a `declare module` body must always be `import type` or `import typeof`.",
11500
- MissingTypeParamDefault: "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",
11501
- NestedDeclareModule: "`declare module` cannot be used inside another `declare module`.",
11502
- NestedFlowComment: "Cannot have a flow comment inside another flow comment.",
11503
- PatternIsOptional: { message: "A binding pattern parameter cannot be optional in an implementation signature." },
11504
- SetterMayNotHaveThisParam: "A setter cannot have a `this` parameter.",
11505
- SpreadVariance: "Spread properties cannot have variance.",
11506
- ThisParamAnnotationRequired: "A type annotation is required for the `this` parameter.",
11507
- ThisParamBannedInConstructor: "Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",
11508
- ThisParamMayNotBeOptional: "The `this` parameter cannot be optional.",
11509
- ThisParamMustBeFirst: "The `this` parameter must be the first function parameter.",
11510
- ThisParamNoDefault: "The `this` parameter may not have a default value.",
11511
- TypeBeforeInitializer: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
11512
- TypeCastInPattern: "The type cast expression is expected to be wrapped with parenthesis.",
11513
- UnexpectedExplicitInexactInObject: "Explicit inexact syntax must appear at the end of an inexact object.",
11514
- UnexpectedReservedType: ({ reservedType }) => `Unexpected reserved type ${reservedType}.`,
11515
- UnexpectedReservedUnderscore: "`_` is only allowed as a type argument to call or new.",
11516
- UnexpectedSpaceBetweenModuloChecks: "Spaces between `%` and `checks` are not allowed here.",
11517
- UnexpectedSpreadType: "Spread operator cannot appear in class or interface definitions.",
11518
- UnexpectedSubtractionOperand: "Unexpected token, expected \"number\" or \"bigint\".",
11519
- UnexpectedTokenAfterTypeParameter: "Expected an arrow function after this type parameter declaration.",
11520
- UnexpectedTypeParameterBeforeAsyncArrowFunction: "Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",
11521
- UnsupportedDeclareExportKind: ({ unsupportedExportKind, suggestion }) => `\`declare export ${unsupportedExportKind}\` is not supported. Use \`${suggestion}\` instead.`,
11522
- UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.",
11523
- UnterminatedFlowComment: "Unterminated flow-comment."
11524
- });
11525
- new RegExp(/\r\n|[\r\n\u2028\u2029]/.source, "g");
11526
- ParseErrorEnum`jsx`({
11527
- AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",
11528
- MissingClosingTagElement: ({ openingTagName }) => `Expected corresponding JSX closing tag for <${openingTagName}>.`,
11529
- MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.",
11530
- UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",
11531
- UnexpectedToken: ({ unexpected, HTMLEntity }) => `Unexpected token \`${unexpected}\`. Did you mean \`${HTMLEntity}\` or \`{'${unexpected}'}\`?`,
11532
- UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text.",
11533
- UnterminatedJsxContent: "Unterminated JSX contents.",
11534
- UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
11535
- });
11536
- var Node = class {
11537
- constructor(optionFlags, filename, pos, loc) {
11538
- this.start = pos;
11539
- this.end = 0;
11540
- if (loc !== void 0) this.loc = new SourceLocation(loc);
11541
- if (optionFlags & 128) this.range = [pos, 0];
11542
- if (loc !== void 0 && filename) this.loc.filename = filename;
11543
- }
11544
- type = "";
11545
- };
11546
- Node.prototype;
11547
- ParseErrorEnum`typescript`({
11548
- AbstractMethodHasImplementation: ({ methodName }) => `Method '${methodName}' cannot have an implementation because it is marked abstract.`,
11549
- AbstractPropertyHasInitializer: ({ propertyName }) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`,
11550
- AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.",
11551
- AccessorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
11552
- AccessorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
11553
- ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
11554
- ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
11555
- ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
11556
- ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
11557
- DeclaratorDefiniteAssertionRequiresTypeAnnotation: "Declarations with definite assignment assertions must also have type annotations.",
11558
- DeclaratorDefiniteAssertionWithInitializer: "Declarations with initializers cannot also have definite assignment assertions.",
11559
- DeclareAccessor: ({ kind }) => `'declare' is not allowed in ${kind}ters.`,
11560
- DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
11561
- DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
11562
- DecoratorAbstractMethod: ({ kind }) => `Decorators can't be used with ${kind.startsWith("a") ? "an" : "a"} ${kind}.`,
11563
- DuplicateAccessibilityModifier: ({ modifier }) => `Accessibility modifier already seen: '${modifier}'.`,
11564
- DuplicateModifier: ({ modifier }) => `Duplicate modifier: '${modifier}'.`,
11565
- EmptyHeritageClauseType: ({ token }) => `'${token}' list cannot be empty.`,
11566
- EmptyNamespaceName: "Namespace must be given a name.",
11567
- EmptyTypeArguments: "Type argument list cannot be empty.",
11568
- EmptyTypeParameters: "Type parameter list cannot be empty.",
11569
- ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.",
11570
- ExportAssignmentInTSNamespace: "An export assignment cannot be used in a namespace.",
11571
- ExportInTSNamespace: "Export declarations are not permitted in a namespace.",
11572
- ImportAliasHasImportType: "An import alias can not use 'import type'.",
11573
- ImportInTSNamespace: "Import declarations in a namespace cannot reference a module.",
11574
- IncompatibleModifiers: ({ modifiers }) => `'${modifiers[0]}' modifier cannot be used with '${modifiers[1]}' modifier.`,
11575
- IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.",
11576
- IndexSignatureHasAccessibility: ({ modifier }) => `Index signatures cannot have an accessibility modifier ('${modifier}').`,
11577
- IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.",
11578
- IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
11579
- IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
11580
- InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.",
11581
- InlineModuleDeclarationMustUseString: "`module ... {}` declarations must have a string name. Use `namespace ... {}` instead.",
11582
- InvalidHeritageClauseType: ({ token }) => `'${token}' list can only include identifiers or qualified-names with optional type arguments.`,
11583
- InvalidModifierOnAwaitUsingDeclaration: (modifier) => `'${modifier}' modifier cannot appear on an await using declaration.`,
11584
- InvalidModifierOnTypeMember: ({ modifier }) => `'${modifier}' modifier cannot appear on a type member.`,
11585
- InvalidModifierOnTypeParameter: ({ modifier }) => `'${modifier}' modifier cannot appear on a type parameter.`,
11586
- InvalidModifierOnTypeParameterPositions: ({ modifier }) => `'${modifier}' modifier can only appear on a type parameter of a class, interface or type alias.`,
11587
- InvalidModifierOnUsingDeclaration: (modifier) => `'${modifier}' modifier cannot appear on a using declaration.`,
11588
- InvalidModifiersOrder: ({ orderedModifiers }) => `'${orderedModifiers[0]}' modifier must precede '${orderedModifiers[1]}' modifier.`,
11589
- InvalidNamespaceName: (value) => `Namespace name cannot be '${value}'.`,
11590
- InvalidPropertyAccessAfterInstantiationExpression: "Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",
11591
- InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
11592
- MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
11593
- NamespaceExportInTSNamespace: "Global module exports may only appear at top level.",
11594
- NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
11595
- NonClassMethodPropertyHasAbstractModifier: "'abstract' modifier can only appear on a class, method, or property declaration.",
11596
- OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
11597
- OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
11598
- PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
11599
- PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.",
11600
- PrivateElementHasAccessibility: ({ modifier }) => `Private elements cannot have an accessibility modifier ('${modifier}').`,
11601
- ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
11602
- ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",
11603
- ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",
11604
- SetAccessorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
11605
- SetAccessorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
11606
- SetAccessorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
11607
- SingleTypeParameterWithoutTrailingComma: ({ typeParameterName }) => `Single type parameter ${typeParameterName} should have a trailing comma. Example usage: <${typeParameterName},>.`,
11608
- StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.",
11609
- TupleOptionalAfterType: "A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",
11610
- TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
11611
- TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.",
11612
- TypeModifierIsUsedInTypeExports: "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",
11613
- TypeModifierIsUsedInTypeImports: "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",
11614
- UnexpectedParameterInitializer: "A parameter initializer is only allowed in a function or constructor implementation.",
11615
- UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.",
11616
- UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.",
11617
- UnexpectedTypeAnnotation: "Did not expect a type annotation here.",
11618
- UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.",
11619
- UnexpectedTypeDeclaration: (type) => `'${type}' declarations can only be declared inside a block.`,
11620
- UnsupportedImportTypeArgument: "Argument in a type import must be a string literal.",
11621
- UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
11622
- UnsupportedSignatureParameterKind: ({ type }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`,
11623
- UsingDeclarationInAmbientContext: (kind) => `'${kind}' declarations are not allowed in ambient contexts.`
11624
- });
11625
- ParseErrorEnum`placeholders`({
11626
- ClassNameIsRequired: "A class name is required.",
11627
- UnexpectedSpace: "Unexpected space in placeholder."
11628
- });
11629
- function generateExportedTokenTypes(internalTokenTypes) {
11630
- const tokenTypes = {};
11631
- for (const typeName of Object.keys(internalTokenTypes)) tokenTypes[typeName] = getExportedToken(internalTokenTypes[typeName]);
11632
- return tokenTypes;
11633
- }
11634
- generateExportedTokenTypes(tt);
11635
- //#endregion
11636
- //#region src/flow/common/nodeChanges.ts
11637
- var codeTaskTemplate = `export default async function (inputs, context) {
11638
- return { result: inputs.value }
11639
- }
11640
- `;
11641
- function createCodeTask(target, identity, name, module = void 0, ports = {
11642
- inputs: [{
11643
- handle: "value",
11644
- jsonSchema: { type: "string" },
11645
- nullable: true,
11646
- value: "foo"
11647
- }],
11648
- outputs: [{
11649
- handle: "result",
11650
- jsonSchema: {},
11651
- nullable: true
11652
- }]
11653
- }) {
11654
- return [{
11655
- kind: "module.create",
11656
- module: {
11657
- ...module ?? {
11658
- imports: [],
11659
- source: codeTaskTemplate
11660
- },
11661
- name
11662
- },
11663
- moduleId: identity.moduleId
11664
- }, {
11665
- kind: "graph.node.create",
11666
- node: {
11667
- inputs: defaultInputs(ports.inputs),
11668
- kind: "task",
11669
- name,
11670
- task: {
11671
- capabilities: ports.capabilities ?? [{
11672
- kind: "connector",
11673
- mode: "independent",
11674
- actions: []
11675
- }],
11676
- inputs: ports.inputs,
11677
- moduleId: identity.moduleId,
11678
- name,
11679
- outputs: ports.outputs
11680
- }
11681
- },
11682
- nodeId: identity.nodeId,
11683
- target
11684
- }];
11685
- }
11686
- function createManagedTask(target, identity, task) {
11687
- return [{
11688
- kind: "task.create",
11689
- task,
11690
- taskId: identity.taskId
11691
- }, {
11692
- kind: "graph.node.create",
11693
- node: {
11694
- inputs: defaultInputs(task.inputs),
11695
- kind: "task",
11696
- name: task.name,
11697
- taskId: identity.taskId
11698
- },
11699
- nodeId: identity.nodeId,
11700
- target
11701
- }];
11702
- }
11703
- function createLlmTask(target, identity, name, mode, outputDescription, options = {}) {
11704
- const values = options.inputs ?? {};
11705
- return createManagedTask(target, identity, {
11706
- executor: {
11707
- kind: "llm",
11708
- mode
11709
- },
11710
- inputs: [
11711
- {
11712
- handle: "messages",
11713
- jsonSchema: {
11714
- items: { type: "object" },
11715
- type: "array"
11716
- },
11717
- nullable: true,
11718
- value: llmInputValue(values, "messages", null)
11719
- },
11720
- {
11721
- handle: "input",
11722
- jsonSchema: { type: "string" },
11723
- nullable: false,
11724
- value: llmInputValue(values, "input", "Alex")
11725
- },
11726
- {
11727
- handle: "template",
11728
- jsonSchema: {
11729
- items: { type: "object" },
11730
- minItems: 1,
11731
- type: "array"
11732
- },
11733
- nullable: false,
11734
- value: llmInputValue(values, "template", [{
11735
- content: "Hello, I'm {{input}}",
11736
- role: "user"
11737
- }])
11738
- },
11739
- {
11740
- handle: "model",
11741
- jsonSchema: { type: "object" },
11742
- nullable: false,
11743
- value: llmInputValue(values, "model", { model: "deepseek-v4-flash" })
11744
- }
11745
- ],
11746
- name,
11747
- outputs: [{
11748
- ...options.output,
11749
- description: options.output?.description ?? outputDescription,
11750
- handle: "output",
11751
- jsonSchema: options.output?.jsonSchema ?? (mode == "chat" ? { type: "string" } : {}),
11752
- nullable: options.output?.nullable ?? false
11753
- }]
11754
- });
11755
- }
11756
- function createCondition(target, nodeId, name) {
11757
- return [{
11758
- kind: "graph.node.create",
11759
- node: {
11760
- cases: [{
11761
- groups: [{ expressions: [{
11762
- left: { kind: "value" },
11763
- operator: "==",
11764
- right: { kind: "value" }
11765
- }] }],
11766
- output: "case"
11767
- }],
11768
- matchMode: "first",
11769
- inputs: {},
11770
- kind: "condition",
11771
- name
11772
- },
11773
- nodeId,
11774
- target
11775
- }];
11776
- }
11777
- function createValue(target, nodeId, name) {
11778
- return [{
11779
- kind: "graph.node.create",
11780
- node: {
11781
- inputs: {},
11782
- kind: "value",
11783
- name,
11784
- values: [{
11785
- handle: "value",
11786
- jsonSchema: {},
11787
- nullable: true,
11788
- value: null
11789
- }]
11790
- },
11791
- nodeId,
11792
- target
11793
- }];
11794
- }
11795
- function createWait(target, nodeId, name) {
11796
- return [{
11797
- kind: "graph.node.create",
11798
- node: {
11799
- inputDefinitions: [],
11800
- inputs: {},
11801
- kind: "wait",
11802
- name,
11803
- prompt: name
11804
- },
11805
- nodeId,
11806
- target
11807
- }];
11808
- }
11809
- function createApproval(target, nodeId, name) {
11810
- return [{
11811
- kind: "graph.node.create",
11812
- node: {
11813
- inputDefinitions: [],
11814
- inputs: {},
11815
- kind: "approval",
11816
- name,
11817
- prompt: name
11818
- },
11819
- nodeId,
11820
- target
11821
- }];
11822
- }
11823
- function createBuiltinTrigger(target, nodeId, node) {
11824
- return [{
11825
- kind: "graph.node.create",
11826
- node,
11827
- nodeId,
11828
- target
11829
- }];
11830
- }
11831
- function createProviderTrigger(target, nodeId, definition, options) {
11832
- const name = options.name ?? definition.displayName;
11833
- return [{
11834
- kind: "graph.node.create",
11835
- node: definition.type == "poll" ? {
11836
- ...options.connectionId == null ? {} : { connectionId: options.connectionId },
11837
- config: inputValues(options.config),
11838
- definition,
11839
- kind: "poll",
11840
- name,
11841
- pollTimes: options.schedule ?? [{
11842
- type: "every",
11843
- unit: "minute",
11844
- value: 5
11845
- }]
11846
- } : {
11847
- ...options.connectionId == null ? {} : { connectionId: options.connectionId },
11848
- config: inputValues(options.config),
11849
- definition,
11850
- kind: "integration",
11851
- name
11852
- },
11853
- nodeId,
11854
- target
11855
- }];
11856
- }
11857
- function defaultInputs(ports) {
11858
- return Object.fromEntries(ports.flatMap((port) => "handle" in port && Object.hasOwn(port, "value") ? [[port.handle, {
11859
- kind: "value",
11860
- value: port.value
11861
- }]] : []));
11862
- }
11863
- function llmInputValue(values, handle, fallback) {
11864
- return values != null && Object.hasOwn(values, handle) ? values[handle] : fallback;
11865
- }
11866
- function createDecisionTask(target, identity, name = "AI Decision", questions) {
11867
- return createManagedTask(target, identity, decisionTask(questions, name));
11868
- }
11869
- //#endregion
11870
- //#region src/control/common/draftOperations.ts
11871
- var text = string().min(1);
11872
- var json$1 = json$3();
11873
- var triggerCreate = strictObject({
11874
- kind: literal("graph.trigger.create"),
11875
- nodeId: text,
11876
- key: text,
11877
- connectionId: text.optional(),
11878
- name: text.optional(),
11879
- config: record(text, json$1),
11880
- schedule: triggerScheduleSchema.readonly().optional()
11881
- });
11882
- function decodeDraftOperations(value) {
11883
- checkJsonDepth(value);
11884
- return array(unknown()).min(1).parse(value).map((candidate, index) => {
11885
- const { kind } = parseOperation(candidate, index, object$1({ kind: text }).parse);
11886
- return kind == "graph.trigger.create" ? parseOperation(candidate, index, triggerCreate.parse) : decodeChangeOperation(candidate, index);
11887
- });
11888
- }
11889
- function draftOperationsSchema(kind) {
11890
- if (kind != null && kind != "graph.trigger.create") return changeOperationsSchema(kind);
11891
- const trigger = toJSONSchema(triggerCreate);
11892
- if (kind == "graph.trigger.create") return trigger;
11893
- const schema = changeOperationsSchema();
11894
- return {
11895
- ...schema,
11896
- items: { anyOf: [schema.items, trigger] }
11897
- };
11898
- }
11899
- function resolveDraftOperations(operations, definition) {
11900
- return operations.flatMap((operation) => {
11901
- if (operation.kind != "graph.trigger.create") return [operation];
11902
- const snapshot = definition(operation.key);
11903
- if (snapshot.type != "poll" && operation.schedule != null) throw new Error("Only Poll triggers accept a schedule.");
11904
- return createProviderTrigger({ kind: "flow" }, operation.nodeId, snapshot, operation);
11905
- });
11906
- }
11907
- //#endregion
11908
- //#region src/control/common/eventSourceSchemas.ts
11909
- var id$1 = string().min(1).max(256);
11910
- var eventType = string().regex(/^[a-z][a-z0-9_.]{0,127}$/);
11911
- var name = string().trim().min(1).max(128);
11912
- var secret = string().min(1).max(256);
11913
- var createEventSourceSchema = strictObject({
11914
- version: literal(1),
11915
- name,
11916
- connectionId: id$1,
11917
- teamId: id$1.nullable(),
11918
- verificationToken: secret,
11919
- encryptKey: secret,
11920
- eventTypes: array(eventType).min(1).max(200).refine((values) => new Set(values).size == values.length),
11921
- manageSubscriptions: boolean()
11922
- });
11923
- var updateEventSourceSchema = strictObject({
11924
- version: literal(1),
11925
- expectedRevision: int().positive(),
11926
- name,
11927
- enabled: boolean(),
11928
- eventTypes: array(eventType).min(1).max(200).refine((values) => new Set(values).size == values.length),
11929
- verificationToken: secret.optional(),
11930
- encryptKey: secret.optional()
11931
- });
11932
- var eventSourceRevisionSchema = strictObject({
11933
- version: literal(1),
11934
- expectedRevision: int().positive()
11935
- });
11936
- //#endregion
11937
- //#region src/control/common/authoringExamples.ts
11938
- var target = { kind: "flow" };
11939
- var descriptions = {
11940
- "manual": "A Manual start node.",
11941
- "error": "A Flow Error node. Select upstream Flows, then publish and enable this Flow to listen for failures in their automatic runs.",
11942
- "webhook": "A Webhook start node.",
11943
- "cron": "An hourly scheduled start node.",
11944
- "poll": "Gmail polling by key; replace CONNECTION_ID with an active Gmail connection.",
11945
- "integration": "Telegram webhook integration by key; replace CONNECTION_ID with an active Telegram connection.",
11946
- "decision": "AI Decision evaluates named questions against target and returns a complete answer object per output. Configure target before running.",
11947
- "openapi": "A fixed JSON API operation. Replace the example document and URL before running.",
11948
- "connector": "A Connector Task and its node. Replace ACTION_ID, CONNECTION_ID and port definitions using connector_get / connector show.",
11949
- "code": "A JavaScript module and its node. Use Code for custom computation; use Connector Tasks for existing actions.",
11950
- "condition": "A condition with true and false execution branches.",
11951
- "value": "A fixed value node.",
11952
- "approval": "An Approval with approve and reject decision branches and a built-in notification output.",
11953
- "wait": "A Wait with a continue action and a built-in notification output.",
11954
- "agent": "An Agent with code computation enabled. Configure a model available in the deployment.",
11955
- "llm-chat": "An LLM chat Task and its node; configure a model available in the deployment.",
11956
- "llm-json": "An LLM JSON Task and its node; configure a model available in the deployment.",
11957
- "poll-notification": "Gmail events → JavaScript text formatting → Connector notification. Replace connection/action IDs and match the notification input ports."
11958
- };
11959
- var authoringExamples = Object.keys(descriptions).map((name) => ({
11960
- name,
11961
- description: descriptions[name]
11962
- }));
11963
- function authoringExample(name) {
11964
- let operations;
11965
- switch (name) {
11966
- case "error":
11967
- operations = createBuiltinTrigger(target, "error", {
11968
- kind: "error",
11969
- name: "Flow Error"
10972
+ var authoringExamples = Object.keys(descriptions).map((name) => ({
10973
+ name,
10974
+ description: descriptions[name]
10975
+ }));
10976
+ function authoringExample(name) {
10977
+ let operations;
10978
+ switch (name) {
10979
+ case "error":
10980
+ operations = createBuiltinTrigger("error", {
10981
+ kind: "error",
10982
+ name: "Flow Error"
11970
10983
  });
11971
10984
  break;
11972
10985
  case "decision":
11973
- operations = createDecisionTask(target, {
11974
- nodeId: "decision",
11975
- taskId: "decision-task"
11976
- }, "AI Decision", [{
10986
+ operations = createDecisionTask({ nodeId: "decision" }, "AI Decision", [{
11977
10987
  name: "needs_support",
11978
10988
  type: "noul",
11979
10989
  instructions: "Does the customer need support?"
11980
10990
  }]);
11981
10991
  break;
11982
10992
  case "openapi":
11983
- operations = createManagedTask(target, {
11984
- nodeId: "api",
11985
- taskId: "api-task"
11986
- }, openApiTask(selectOperation({
10993
+ operations = createManagedTask({ nodeId: "api" }, openApiTask(selectOperation({
11987
10994
  openapi: "3.1.0",
11988
10995
  paths: { "/items": { get: { responses: { "200": { content: { "application/json": { schema: {
11989
10996
  type: "array",
@@ -11992,13 +10999,13 @@ function authoringExample(name) {
11992
10999
  }, "https://api.example.com/openapi.json", "/items", "get")));
11993
11000
  break;
11994
11001
  case "manual":
11995
- operations = createBuiltinTrigger(target, "start", {
11002
+ operations = createBuiltinTrigger("start", {
11996
11003
  kind: "manual",
11997
11004
  name: "Start"
11998
11005
  });
11999
11006
  break;
12000
11007
  case "webhook":
12001
- operations = createBuiltinTrigger(target, "start", {
11008
+ operations = createBuiltinTrigger("start", {
12002
11009
  kind: "webhook",
12003
11010
  method: "POST",
12004
11011
  name: "Webhook",
@@ -12006,7 +11013,7 @@ function authoringExample(name) {
12006
11013
  });
12007
11014
  break;
12008
11015
  case "cron":
12009
- operations = createBuiltinTrigger(target, "start", {
11016
+ operations = createBuiltinTrigger("start", {
12010
11017
  kind: "cron",
12011
11018
  name: "Schedule",
12012
11019
  cronTimes: [{
@@ -12040,10 +11047,7 @@ function authoringExample(name) {
12040
11047
  }];
12041
11048
  break;
12042
11049
  case "agent":
12043
- operations = createManagedTask(target, {
12044
- nodeId: "agent",
12045
- taskId: "agent-task"
12046
- }, {
11050
+ operations = createManagedTask({ nodeId: "agent" }, {
12047
11051
  name: "Agent",
12048
11052
  inputs: [{
12049
11053
  handle: "input",
@@ -12067,10 +11071,7 @@ function authoringExample(name) {
12067
11071
  });
12068
11072
  break;
12069
11073
  case "connector":
12070
- operations = createManagedTask(target, {
12071
- nodeId: "notify",
12072
- taskId: "notify-task"
12073
- }, {
11074
+ operations = createManagedTask({ nodeId: "notify" }, {
12074
11075
  name: "Notify",
12075
11076
  executor: {
12076
11077
  kind: "connector",
@@ -12087,7 +11088,7 @@ function authoringExample(name) {
12087
11088
  });
12088
11089
  break;
12089
11090
  case "code":
12090
- operations = createCodeTask(target, {
11091
+ operations = createCodeTask({
12091
11092
  nodeId: "format",
12092
11093
  moduleId: "format-module"
12093
11094
  }, "Format", {
@@ -12112,10 +11113,9 @@ function authoringExample(name) {
12112
11113
  break;
12113
11114
  case "condition":
12114
11115
  operations = [
12115
- ...createCondition(target, "condition", "Condition"),
11116
+ ...createCondition("condition", "Condition"),
12116
11117
  {
12117
11118
  kind: "graph.node.input.set",
12118
- target,
12119
11119
  nodeId: "condition",
12120
11120
  handle: "0/0/0/left",
12121
11121
  value: {
@@ -12125,7 +11125,6 @@ function authoringExample(name) {
12125
11125
  },
12126
11126
  {
12127
11127
  kind: "graph.node.input.set",
12128
- target,
12129
11128
  nodeId: "condition",
12130
11129
  handle: "0/0/0/right",
12131
11130
  value: {
@@ -12136,20 +11135,17 @@ function authoringExample(name) {
12136
11135
  ];
12137
11136
  break;
12138
11137
  case "value":
12139
- operations = createValue(target, "value", "Value");
11138
+ operations = createValue("value", "Value");
12140
11139
  break;
12141
11140
  case "approval":
12142
- operations = createApproval(target, "approval", "Approve?");
11141
+ operations = createApproval("approval", "Approve?");
12143
11142
  break;
12144
11143
  case "wait":
12145
- operations = createWait(target, "wait", "Continue?");
11144
+ operations = createWait("wait", "Continue?");
12146
11145
  break;
12147
11146
  case "llm-chat":
12148
11147
  case "llm-json":
12149
- operations = createLlmTask(target, {
12150
- nodeId: "llm",
12151
- taskId: "llm-task"
12152
- }, "LLM", name == "llm-chat" ? "chat" : "json", "Generated response.");
11148
+ operations = createLlmTask({ nodeId: "llm" }, "LLM", name == "llm-chat" ? "chat" : "json", "Generated response.");
12153
11149
  break;
12154
11150
  case "poll-notification":
12155
11151
  operations = [
@@ -12158,7 +11154,6 @@ function authoringExample(name) {
12158
11154
  ...authoringExample("connector").operations,
12159
11155
  {
12160
11156
  kind: "graph.edge.connect",
12161
- target,
12162
11157
  edge: {
12163
11158
  source: "mail",
12164
11159
  target: "format"
@@ -12166,7 +11161,6 @@ function authoringExample(name) {
12166
11161
  },
12167
11162
  {
12168
11163
  kind: "graph.edge.connect",
12169
- target,
12170
11164
  edge: {
12171
11165
  source: "format",
12172
11166
  target: "notify"
@@ -12174,7 +11168,6 @@ function authoringExample(name) {
12174
11168
  },
12175
11169
  {
12176
11170
  kind: "graph.node.input.set",
12177
- target,
12178
11171
  nodeId: "format",
12179
11172
  handle: "events",
12180
11173
  before: {
@@ -12192,7 +11185,6 @@ function authoringExample(name) {
12192
11185
  },
12193
11186
  {
12194
11187
  kind: "graph.node.input.set",
12195
- target,
12196
11188
  nodeId: "notify",
12197
11189
  handle: "text",
12198
11190
  before: {
@@ -12224,10 +11216,10 @@ var json = json$3();
12224
11216
  var id = string().min(1);
12225
11217
  var version = literal(1);
12226
11218
  var flowName = id.refine((value) => value == value.trim() && resourceNameIssue(value) == null, "Flow name is invalid.");
12227
- var inputs = record(string(), record(string(), json));
11219
+ var inputs = record$1(string(), record$1(string(), json));
12228
11220
  var trigger = strictObject({
12229
11221
  nodeId: id,
12230
- outputs: record(string(), json)
11222
+ outputs: record$1(string(), json)
12231
11223
  });
12232
11224
  var schemas = {
12233
11225
  loadOpenApiDocument: strictObject({
@@ -12262,7 +11254,7 @@ var schemas = {
12262
11254
  }),
12263
11255
  updatePresentation: strictObject({
12264
11256
  expectedRevision: int().positive(),
12265
- value: record(string(), json),
11257
+ value: record$1(string(), json),
12266
11258
  version
12267
11259
  }),
12268
11260
  checkFlow: strictObject({