@oomol-lab/open-flow 0.1.0-beta.65 → 0.1.0-beta.66

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 (49) hide show
  1. package/dist/browser/{createResourceDialog-BAJXbzNH.js → createResourceDialog-C-Si_cYs.js} +2 -2
  2. package/dist/browser/flow-authoring-node.d.ts +12 -3
  3. package/dist/browser/flow-authoring.js +114 -19
  4. package/dist/browser/flow-change-schema.d.ts +3 -1
  5. package/dist/browser/flow-change.d.ts +15 -3
  6. package/dist/browser/flow-change.js +111 -16
  7. package/dist/browser/{flowChanges-DkvG5uDq.js → flowChanges-T4_R5p1f.js} +2654 -1858
  8. package/dist/browser/{flowRunInputEditorStore-B2Rw4VsT.js → flowRunInputEditorStore-DJqmR6Qh.js} +3 -2
  9. package/dist/browser/{flowWorkspace-BEp-lxqF.js → flowWorkspace-C0J5C0oM.js} +700 -224
  10. package/dist/browser/{icons-Db2Jb2iX.js → icons-BD3m0RQq.js} +4484 -4370
  11. package/dist/browser/preview.css +152 -64
  12. package/dist/browser/preview.js +4460 -3412
  13. package/dist/browser/ui.css +85 -3
  14. package/dist/browser/ui.js +8 -5
  15. package/dist/browser/workbench.css +152 -64
  16. package/dist/browser/workbench.js +146 -57
  17. package/dist/browser/{workbenchSelect-C-jf6NIM.js → workbenchSelect-B-PFpF_Q.js} +1 -1
  18. package/dist/command/index.js +49 -49
  19. package/dist/common/authoring.d.ts +7 -5
  20. package/dist/common/authoringExamples.d.ts +3 -3
  21. package/dist/common/authoringFields.d.ts +20 -0
  22. package/dist/common/authoringSchema.d.ts +404 -15
  23. package/dist/common/control-api-conformance.js +384 -137
  24. package/dist/common/control-api.d.ts +63 -7
  25. package/dist/common/control-api.js +3562 -3428
  26. package/dist/common/control-requests.d.ts +10 -3
  27. package/dist/common/control-requests.js +418 -43
  28. package/dist/common/decision.js +28 -3
  29. package/dist/common/flow-encoding.d.ts +4 -2
  30. package/dist/common/flow-encoding.js +144 -10
  31. package/dist/common/flow-graph.d.ts +1 -1
  32. package/dist/common/flow-semantics.d.ts +12 -2
  33. package/dist/common/flow-semantics.js +146 -33
  34. package/dist/common/integration-trigger.js +28 -3
  35. package/dist/common/liveDetails.d.ts +26 -11
  36. package/dist/common/mcp.d.ts +6 -3
  37. package/dist/common/mcp.js +203 -84
  38. package/dist/common/openapi.js +28 -3
  39. package/dist/common/poll-trigger.js +28 -3
  40. package/dist/common/run-events.d.ts +2 -0
  41. package/dist/common/run-events.js +9 -3
  42. package/dist/common/scheduler.d.ts +10 -1
  43. package/dist/common/scheduler.js +167 -45
  44. package/dist/common/trigger-contract.d.ts +2 -0
  45. package/dist/common/webhook-trigger.js +28 -3
  46. package/dist/common/workflow.d.ts +93 -0
  47. package/dist/common/workflow.js +10491 -0
  48. package/package.json +5 -1
  49. package/skills/open-flow/references/flow-authoring.md +26 -16
@@ -6045,6 +6045,7 @@ var port$1 = object({
6045
6045
  nullable: boolean(),
6046
6046
  handle: text
6047
6047
  });
6048
+ var workflowInputDefs = array(port$1.strict());
6048
6049
  var input = port$1.extend({ value: json$3.optional() });
6049
6050
  var group = object({
6050
6051
  collapsed: boolean().optional(),
@@ -6202,6 +6203,11 @@ var managedFields = object({
6202
6203
  messageHandle: text,
6203
6204
  inputs: record$2(text, agentValue)
6204
6205
  }).optional()
6206
+ }),
6207
+ strictObject({
6208
+ kind: literal("workflow"),
6209
+ flowId: text,
6210
+ revisionId: text
6205
6211
  })
6206
6212
  ])
6207
6213
  });
@@ -6310,6 +6316,12 @@ var base = {
6310
6316
  timeoutMs: number().optional()
6311
6317
  };
6312
6318
  var node = union([
6319
+ strictObject({
6320
+ ...base,
6321
+ kind: literal("outputs"),
6322
+ outputDefs: array(port$1.strict()),
6323
+ outputMappings: inputs
6324
+ }).omit({ inputs: true }),
6313
6325
  object({
6314
6326
  ...base,
6315
6327
  inputs: record$2(text, never()),
@@ -6342,6 +6354,11 @@ var node = union([
6342
6354
  ...trigger,
6343
6355
  kind: literal("manual")
6344
6356
  }),
6357
+ strictObject({
6358
+ ...trigger,
6359
+ kind: literal("start"),
6360
+ inputDefs: workflowInputDefs
6361
+ }),
6345
6362
  strictObject({
6346
6363
  ...trigger,
6347
6364
  kind: literal("error"),
@@ -6421,7 +6438,7 @@ var module = object({
6421
6438
  imports: strings$1,
6422
6439
  source: text
6423
6440
  });
6424
- var document = preprocess(rejectRetiredDefinitions, object({
6441
+ var document = preprocess(normalizeDocument, object({
6425
6442
  bindings: record$2(text, binding$1),
6426
6443
  graph
6427
6444
  }));
@@ -6430,7 +6447,9 @@ var revision = object({
6430
6447
  literal(2),
6431
6448
  literal(4),
6432
6449
  literal(5),
6433
- literal(6)
6450
+ literal(6),
6451
+ literal(7),
6452
+ literal(8)
6434
6453
  ]),
6435
6454
  document,
6436
6455
  modules: record$2(text, module)
@@ -6439,13 +6458,19 @@ revision.extend({
6439
6458
  kind: literal("open-flow-flow-revision"),
6440
6459
  version: literal(1)
6441
6460
  });
6442
- function rejectRetiredDefinitions(value) {
6461
+ function normalizeDocument(value) {
6443
6462
  const candidate = record$1(value);
6444
6463
  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.");
6445
6464
  if (Object.values(record$1(record$1(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record$1(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
6446
6465
  const subflows = candidate.subflows;
6447
6466
  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.");
6448
6467
  if (Object.values(record$1(record$1(candidate.graph).nodes)).some((candidateNode) => record$1(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
6468
+ if ([
6469
+ "inputDefs",
6470
+ "outputDefs",
6471
+ "outputMappings"
6472
+ ].some((field) => Object.hasOwn(candidate, field))) throw new TypeError("Workflow interface configuration must belong to Start and Outputs nodes.");
6473
+ if (Object.values(record$1(record$1(candidate.graph).nodes)).some((candidateNode) => record$1(candidateNode).kind == "start" && Object.hasOwn(record$1(candidateNode), "parameters"))) throw new TypeError("Legacy Start.parameters is unsupported; configure node.inputDefs.");
6449
6474
  return value;
6450
6475
  }
6451
6476
  function record$1(value) {
@@ -6611,6 +6636,8 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
6611
6636
  ...shape
6612
6637
  })])).values()])).min(1);
6613
6638
  function checkModelVersion(content) {
6639
+ if (content.modelVersion < 8 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "outputs")) throw new TypeError("Workflow outputs require Flow model version 8.");
6640
+ if (content.modelVersion < 7 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "start")) throw new TypeError("Start Triggers require Flow model version 7.");
6614
6641
  if (content.modelVersion < 6 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task)) throw new TypeError("Node-owned managed Tasks require Flow model version 6.");
6615
6642
  if (content.modelVersion < 5 && Object.values(content.document.graph.nodes).some((itemNode) => itemNode.kind == "error")) throw new TypeError("Error workflows require Flow model version 5.");
6616
6643
  }
@@ -9440,7 +9467,9 @@ var id$2 = string$1().min(1);
9440
9467
  var json$2 = json$4();
9441
9468
  var patch = record$2(id$2, json$2);
9442
9469
  var type = _enum([
9443
- "manual",
9470
+ "start",
9471
+ "outputs",
9472
+ "workflow",
9444
9473
  "webhook",
9445
9474
  "cron",
9446
9475
  "error",
@@ -9512,6 +9541,12 @@ var field = strictObject({
9512
9541
  description: string$1().optional()
9513
9542
  });
9514
9543
  var inputFields = record$2(id$2, field.extend({ default: json$2.optional() })).describe("Optional business input constraints by name. A binding to a new Code, Agent, LLM, Wait or Approval input automatically declares an input accepting any JSON. Existing constraints are preserved. Omitted schema accepts any JSON; omitted nullable is true. Use default for inherited values; input.set supplies data.");
9544
+ var flowInputFields = record$2(id$2, field).describe("Workflow input definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Supply call values as trigger.outputs.");
9545
+ var flowOutputFields = flowInputFields.describe("Workflow output definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Set values on the Outputs node with input.set or node.add.inputs.");
9546
+ var flowInputFieldsView = record$2(id$2, field.extend({
9547
+ schema: json$2,
9548
+ nullable: boolean()
9549
+ }));
9515
9550
  var outputFields = record$2(id$2, field).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true.");
9516
9551
  var expression = strictObject({
9517
9552
  left: operand,
@@ -9525,7 +9560,9 @@ var when = union([
9525
9560
  strictObject({ any: array(union([expression, all])) })
9526
9561
  ]);
9527
9562
  var authoringConfigurations = {
9528
- manual: strictObject({}),
9563
+ workflow: strictObject({ flowId: id$2 }),
9564
+ start: strictObject({ inputDefs: flowInputFields.default({}) }),
9565
+ outputs: strictObject({ outputDefs: flowOutputFields.default({}) }),
9529
9566
  error: strictObject({ sourceFlowIds: array(id$2).optional() }),
9530
9567
  webhook: authoringDefinitionSchemas.webhook.omit({ bodyFields: true }).extend({ body: inputFields }).strict(),
9531
9568
  cron: strictObject({ schedule: authoringDefinitionSchemas.schedule }),
@@ -9596,6 +9633,10 @@ var authoringEditSchema = discriminatedUnion("op", [
9596
9633
  set: updates.optional(),
9597
9634
  clear: array(array(id$2).min(1)).optional()
9598
9635
  }),
9636
+ strictObject({
9637
+ op: literal("node.refresh"),
9638
+ node: referenceSchema
9639
+ }),
9599
9640
  strictObject({
9600
9641
  op: literal("node.remove"),
9601
9642
  node: referenceSchema
@@ -9706,7 +9747,7 @@ var authoringSearchResponse = object({
9706
9747
  revision: id$2,
9707
9748
  data: object({
9708
9749
  matches: array(object({
9709
- node: id$2,
9750
+ node: id$2.optional(),
9710
9751
  field: id$2,
9711
9752
  line: int().optional(),
9712
9753
  excerpt: string$1()
@@ -9725,6 +9766,43 @@ var resultQuerySchema = strictObject({
9725
9766
  maxBytes: number().int().min(1).max(1048576).default(15e3)
9726
9767
  });
9727
9768
  //#endregion
9769
+ //#region src/workflow/common/workflow.ts
9770
+ var portSchema = object({
9771
+ handle: string$1().min(1),
9772
+ jsonSchema: json$4(),
9773
+ nullable: boolean(),
9774
+ description: string$1().optional()
9775
+ });
9776
+ strictObject({
9777
+ inputs: array(portSchema).nullable(),
9778
+ outputs: array(portSchema).nullable()
9779
+ });
9780
+ var workflowContractSchema = object({
9781
+ version: literal(1),
9782
+ flowId: string$1().min(1),
9783
+ name: string$1(),
9784
+ revisionId: string$1().min(1),
9785
+ publicationId: string$1().min(1),
9786
+ inputs: array(portSchema),
9787
+ outputs: array(portSchema).nullable()
9788
+ });
9789
+ var workflowReferencesSchema = object({
9790
+ version: literal(1),
9791
+ direction: _enum(["incoming", "outgoing"]),
9792
+ total: int().nonnegative(),
9793
+ nextOffset: int().nonnegative().optional(),
9794
+ references: array(object({
9795
+ flowId: string$1(),
9796
+ name: string$1().nullable(),
9797
+ available: boolean(),
9798
+ draft: boolean(),
9799
+ live: object({
9800
+ publicationId: string$1(),
9801
+ enabled: boolean()
9802
+ }).nullable()
9803
+ }))
9804
+ });
9805
+ //#endregion
9728
9806
  //#region src/control/common/errors.ts
9729
9807
  var controlErrorCode = {
9730
9808
  authenticationRequired: "authentication.required",
@@ -9802,6 +9880,10 @@ function record(value) {
9802
9880
  function string(value) {
9803
9881
  return typeof value == "string" && value.length > 0 ? value : invalidResponse("Expected a non-empty string.");
9804
9882
  }
9883
+ function requiredFields(value, keys) {
9884
+ const missing = keys.filter((key) => !Object.hasOwn(value, key));
9885
+ if (missing.length > 0) invalidResponse(`Missing fields: ${missing.join(", ")}.`);
9886
+ }
9805
9887
  function exact(value, keys) {
9806
9888
  const actual = Object.keys(value);
9807
9889
  if (actual.length != keys.length || actual.some((key) => !keys.includes(key))) {
@@ -9869,7 +9951,7 @@ function publishOperation(value) {
9869
9951
  if (source.version != 1) return invalidResponse();
9870
9952
  switch (status) {
9871
9953
  case "pending":
9872
- exact(source, [
9954
+ requiredFields(source, [
9873
9955
  "createdAt",
9874
9956
  "flowId",
9875
9957
  "operationId",
@@ -9883,7 +9965,7 @@ function publishOperation(value) {
9883
9965
  status
9884
9966
  };
9885
9967
  case "succeeded":
9886
- exact(source, [
9968
+ requiredFields(source, [
9887
9969
  "createdAt",
9888
9970
  "flowId",
9889
9971
  "operationId",
@@ -9899,7 +9981,7 @@ function publishOperation(value) {
9899
9981
  status
9900
9982
  };
9901
9983
  case "failed": {
9902
- exact(source, [
9984
+ requiredFields(source, [
9903
9985
  "createdAt",
9904
9986
  "flowId",
9905
9987
  "issue",
@@ -9911,7 +9993,7 @@ function publishOperation(value) {
9911
9993
  ]);
9912
9994
  const issue = record(source.issue);
9913
9995
  const nodeId = issue.nodeId;
9914
- exact(issue, [
9996
+ requiredFields(issue, [
9915
9997
  "code",
9916
9998
  "message",
9917
9999
  ...nodeId == null ? [] : ["nodeId"]
@@ -10152,43 +10234,48 @@ var metadata = {
10152
10234
  var binding = unknown().transform(triggerBinding);
10153
10235
  var provider = {
10154
10236
  provider: string$1().min(1),
10155
- inputs: record$2(string$1(), discriminatedUnion("kind", [strictObject({
10237
+ inputs: record$2(string$1(), discriminatedUnion("kind", [object({
10156
10238
  kind: literal("value"),
10157
10239
  value: json$4()
10158
- }), strictObject({ kind: literal("unset") })]))
10240
+ }), object({ kind: literal("unset") })]))
10159
10241
  };
10160
10242
  var entrySchema = discriminatedUnion("type", [
10161
- strictObject({
10243
+ object({
10244
+ ...metadata,
10245
+ type: literal("start"),
10246
+ config: authoringConfigurations.start
10247
+ }),
10248
+ object({
10162
10249
  ...metadata,
10163
10250
  type: literal("manual"),
10164
- config: authoringConfigurations.manual
10251
+ config: object({})
10165
10252
  }),
10166
- strictObject({
10253
+ object({
10167
10254
  ...metadata,
10168
10255
  type: literal("webhook"),
10169
10256
  config: authoringConfigurations.webhook,
10170
10257
  binding
10171
10258
  }),
10172
- strictObject({
10259
+ object({
10173
10260
  ...metadata,
10174
10261
  type: literal("cron"),
10175
10262
  config: authoringConfigurations.cron,
10176
10263
  binding
10177
10264
  }),
10178
- strictObject({
10265
+ object({
10179
10266
  ...metadata,
10180
10267
  type: literal("error"),
10181
10268
  config: authoringConfigurations.error,
10182
10269
  binding
10183
10270
  }),
10184
- strictObject({
10271
+ object({
10185
10272
  ...metadata,
10186
10273
  ...provider,
10187
10274
  type: literal("poll"),
10188
10275
  config: authoringConfigurations.poll,
10189
10276
  binding
10190
10277
  }),
10191
- strictObject({
10278
+ object({
10192
10279
  ...metadata,
10193
10280
  ...provider,
10194
10281
  type: literal("integration"),
@@ -10201,9 +10288,10 @@ function decodeLiveDetails(value) {
10201
10288
  const flowId = string(source.flowId);
10202
10289
  if (source.version != 1 || !Array.isArray(source.entries)) return invalidResponse();
10203
10290
  if (source.publication === null) {
10204
- if (source.status != "not-published" || source.entries.length != 0 || Object.hasOwn(source, "enabled")) return invalidResponse();
10291
+ if (source.inputDefs !== null || source.status != "not-published" || source.entries.length != 0 || Object.hasOwn(source, "enabled")) return invalidResponse();
10205
10292
  return {
10206
10293
  flowId,
10294
+ inputDefs: null,
10207
10295
  publication: null,
10208
10296
  status: "not-published",
10209
10297
  entries: [],
@@ -10215,8 +10303,11 @@ function decodeLiveDetails(value) {
10215
10303
  if (current.flowId != flowId || typeof source.enabled != "boolean") return invalidResponse();
10216
10304
  if (status != "runnable" && status != "suspended") return invalidResponse();
10217
10305
  if (!source.enabled && source.status == "runnable") return invalidResponse();
10306
+ const inputDefs = flowInputFieldsView.safeParse(source.inputDefs);
10307
+ if (!inputDefs.success) return invalidResponse();
10218
10308
  return {
10219
10309
  flowId,
10310
+ inputDefs: inputDefs.data,
10220
10311
  publication: current,
10221
10312
  status,
10222
10313
  enabled: source.enabled,
@@ -10232,7 +10323,7 @@ function decodeEntries(values, current) {
10232
10323
  for (const entry of parsed.data) {
10233
10324
  if (ids.has(entry.nodeId)) return invalidResponse();
10234
10325
  ids.add(entry.nodeId);
10235
- if (entry.type != "manual" && (entry.binding.flowId != current.flowId || entry.binding.triggerNodeId != entry.nodeId || entry.binding.kind != entry.type || entry.binding.currentPublicationId != current.publicationId || entry.binding.currentRevisionId != current.revisionId)) return invalidResponse();
10326
+ if (entry.type != "start" && entry.type != "manual" && (entry.binding.flowId != current.flowId || entry.binding.triggerNodeId != entry.nodeId || entry.binding.kind != entry.type || entry.binding.currentPublicationId != current.publicationId || entry.binding.currentRevisionId != current.revisionId)) return invalidResponse();
10236
10327
  if (entry.type == "webhook" && (!entry.binding.endpointUrl || !webhookSupportsBody(entry.config.method) && Object.keys(entry.config.body).length > 0)) return invalidResponse();
10237
10328
  }
10238
10329
  return parsed.data;
@@ -10545,7 +10636,7 @@ function connectorAccessCandidatesBatch(value, providerIds) {
10545
10636
  }
10546
10637
  function connection(value) {
10547
10638
  const source = record(value);
10548
- exact(source, [
10639
+ requiredFields(source, [
10549
10640
  ...Object.hasOwn(source, "providerAccountId") ? ["providerAccountId"] : [],
10550
10641
  ...Object.hasOwn(source, "alias") ? ["alias"] : [],
10551
10642
  ...Object.hasOwn(source, "builtInAccount") ? ["builtInAccount"] : [],
@@ -10574,7 +10665,7 @@ function port(value, input = false) {
10574
10665
  const source = record(value);
10575
10666
  const description = source.description;
10576
10667
  const hasValue = input && Object.hasOwn(source, "value");
10577
- exact(source, [
10668
+ requiredFields(source, [
10578
10669
  "jsonSchema",
10579
10670
  "nullable",
10580
10671
  ...description == null ? [] : ["description"],
@@ -10599,7 +10690,7 @@ function connectorActionMetadata(value) {
10599
10690
  const source = record(value);
10600
10691
  const homepageUrl = source.homepageUrl;
10601
10692
  const icon = source.icon;
10602
- exact(source, [
10693
+ requiredFields(source, [
10603
10694
  "actionId",
10604
10695
  ...Object.hasOwn(source, "operationType") ? ["operationType"] : [],
10605
10696
  ...Object.hasOwn(source, "inputSchema") ? ["inputSchema"] : [],
@@ -10650,7 +10741,7 @@ function connectorProvider(value) {
10650
10741
  const homepageUrl = source.homepageUrl;
10651
10742
  const icon = source.icon;
10652
10743
  if (source.noSetup !== void 0 && typeof source.noSetup != "boolean") return invalidResponse();
10653
- exact(source, [
10744
+ requiredFields(source, [
10654
10745
  ...Object.hasOwn(source, "noSetup") ? ["noSetup"] : [],
10655
10746
  "serviceId",
10656
10747
  "serviceName",
@@ -10674,7 +10765,7 @@ function connectorProvider(value) {
10674
10765
  var id$1 = string$1().min(1).max(256);
10675
10766
  var eventType = string$1().regex(/^[a-z][a-z0-9_.]{0,127}$/);
10676
10767
  var name = string$1().trim().min(1).max(128);
10677
- var eventSourceSchema = strictObject({
10768
+ var eventSourceSchema = object({
10678
10769
  version: literal(1),
10679
10770
  sourceId: id$1,
10680
10771
  revision: int().positive(),
@@ -10692,7 +10783,7 @@ var eventSourceSchema = strictObject({
10692
10783
  verifiedAt: string$1().nullable(),
10693
10784
  lastReceivedAt: string$1().nullable(),
10694
10785
  updatedAt: string$1(),
10695
- consumers: array(strictObject({
10786
+ consumers: array(object({
10696
10787
  flowId: id$1,
10697
10788
  flowName: string$1(),
10698
10789
  triggerNodeId: id$1
@@ -10702,7 +10793,7 @@ function decodeEventSource(value) {
10702
10793
  return eventSourceSchema.parse(value);
10703
10794
  }
10704
10795
  function decodeEventSources(value) {
10705
- return strictObject({
10796
+ return object({
10706
10797
  version: literal(1),
10707
10798
  sources: array(eventSourceSchema),
10708
10799
  teamId: id$1.nullable().optional()
@@ -10724,7 +10815,7 @@ function isUiLanguage(value) {
10724
10815
  //#region src/control/common/triggerCatalog.ts
10725
10816
  function decodeTriggerCatalog(value) {
10726
10817
  const source = record(value);
10727
- exact(source, [
10818
+ requiredFields(source, [
10728
10819
  "version",
10729
10820
  "locale",
10730
10821
  "definitions",
@@ -10738,7 +10829,7 @@ function decodeTriggerCatalog(value) {
10738
10829
  const display = Object.fromEntries(definitions.map((definition) => {
10739
10830
  const { key } = definition;
10740
10831
  const copy = record(entries[key]);
10741
- exact(copy, [
10832
+ requiredFields(copy, [
10742
10833
  "configInputs",
10743
10834
  "configInputLabels",
10744
10835
  "displayName",
@@ -10776,7 +10867,7 @@ function labels(value, handles) {
10776
10867
  //#endregion
10777
10868
  //#region src/control/common/results.ts
10778
10869
  var json$1 = json$4();
10779
- var entry = strictObject({
10870
+ var entry = object({
10780
10871
  pointer: string$1(),
10781
10872
  type: _enum([
10782
10873
  "object",
@@ -10795,25 +10886,25 @@ var page = entry.extend({
10795
10886
  nextOffset: number().int().positive().optional(),
10796
10887
  entries: array(entry).optional()
10797
10888
  });
10798
- var result = strictObject({
10889
+ var result = object({
10799
10890
  resultId: string$1().min(1),
10800
10891
  callId: string$1().min(1),
10801
10892
  toolId: string$1().min(1),
10802
- source: discriminatedUnion("kind", [strictObject({
10893
+ source: discriminatedUnion("kind", [object({
10803
10894
  kind: literal("connector"),
10804
10895
  action: string$1().min(1)
10805
- }), strictObject({ kind: literal("code") })]),
10896
+ }), object({ kind: literal("code") })]),
10806
10897
  bytes: number().int().nonnegative(),
10807
10898
  digest: string$1().regex(/^[a-f0-9]{64}$/),
10808
10899
  createdAt: string$1().datetime()
10809
10900
  });
10810
- var listSchema = strictObject({
10901
+ var listSchema = object({
10811
10902
  version: literal(1),
10812
10903
  runId: string$1(),
10813
10904
  results: array(result),
10814
10905
  nextAfter: string$1().optional()
10815
10906
  });
10816
- var readSchema = strictObject({
10907
+ var readSchema = object({
10817
10908
  version: literal(1),
10818
10909
  runId: string$1(),
10819
10910
  result,
@@ -10890,7 +10981,7 @@ function connectorProvidersQuery(flowId, locale) {
10890
10981
  path: `/v1/connector/providers${parameters ? `?${parameters}` : ""}`,
10891
10982
  decode: (value) => {
10892
10983
  const source = record(value);
10893
- exact(source, ["providers", "version"]);
10984
+ requiredFields(source, ["providers", "version"]);
10894
10985
  if (source.version != 1 || !Array.isArray(source.providers)) return invalidResponse();
10895
10986
  return source.providers.map(connectorProvider);
10896
10987
  }
@@ -10905,7 +10996,7 @@ function connectorActionQuery(actionId, flowId, locale) {
10905
10996
  path: `/v1/connector/actions/${encodeURIComponent(actionId)}${parameters ? `?${parameters}` : ""}`,
10906
10997
  decode: (value) => {
10907
10998
  const source = record(value);
10908
- exact(source, ["action", "version"]);
10999
+ requiredFields(source, ["action", "version"]);
10909
11000
  if (source.version != 1) return invalidResponse();
10910
11001
  return connectorAction(source.action);
10911
11002
  }
@@ -10916,7 +11007,7 @@ function allConnectorConnectionsQuery(flowId) {
10916
11007
  path: `/v1/connector/connections${scope(flowId)}`,
10917
11008
  decode: (value) => {
10918
11009
  const source = record(value);
10919
- exact(source, ["connections", "version"]);
11010
+ requiredFields(source, ["connections", "version"]);
10920
11011
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
10921
11012
  return source.connections.map(connection);
10922
11013
  }
@@ -10927,7 +11018,7 @@ function connectorConnectionsQuery(serviceId, flowId) {
10927
11018
  path: `/v1/connector/connections/${encodeURIComponent(serviceId)}${scope(flowId)}`,
10928
11019
  decode: (value) => {
10929
11020
  const source = record(value);
10930
- exact(source, [
11021
+ requiredFields(source, [
10931
11022
  "connections",
10932
11023
  "serviceId",
10933
11024
  "version"
@@ -10952,6 +11043,7 @@ function resourceReferences(input) {
10952
11043
  if (accessRevision < 0) return invalidResponse();
10953
11044
  return {
10954
11045
  draft: draft == null ? null : {
11046
+ ...draft.calledFlowIds === void 0 ? {} : { calledFlowIds: strings(draft.calledFlowIds) },
10955
11047
  variableNames: strings(draft.variableNames),
10956
11048
  errorSourceFlowIds: strings(draft.errorSourceFlowIds),
10957
11049
  connections: draft.connections.map((value) => {
@@ -10982,10 +11074,11 @@ function flow$1(value) {
10982
11074
  if (source.version != 1) return invalidResponse();
10983
11075
  if (status != "active" && status != "retiring") return invalidResponse();
10984
11076
  const target = source.live == null ? void 0 : record(source.live);
10985
- if (target != null && typeof target.enabled != "boolean") return invalidResponse();
11077
+ if (target != null && (typeof target.enabled != "boolean" || typeof target.hasStart != "boolean")) return invalidResponse();
10986
11078
  return {
10987
11079
  ...target == null ? {} : { live: {
10988
11080
  enabled: target.enabled,
11081
+ hasStart: target.hasStart,
10989
11082
  publicationId: string(target.publicationId),
10990
11083
  revisionId: string(target.revisionId)
10991
11084
  } },
@@ -11016,7 +11109,7 @@ function flowPage(value) {
11016
11109
  }
11017
11110
  function variable(value) {
11018
11111
  const source = record(value);
11019
- exact(source, [
11112
+ requiredFields(source, [
11020
11113
  "name",
11021
11114
  "updatedAt",
11022
11115
  "value",
@@ -11036,6 +11129,15 @@ function variable(value) {
11036
11129
  version: 1
11037
11130
  };
11038
11131
  }
11132
+ function variableListItem(value) {
11133
+ const { referenceCount, ...fields } = record(value);
11134
+ const count = integer(referenceCount);
11135
+ if (count < 0) return invalidResponse();
11136
+ return {
11137
+ ...variable(fields),
11138
+ referenceCount: count
11139
+ };
11140
+ }
11039
11141
  function errorListener(value) {
11040
11142
  const source = record(value);
11041
11143
  if (typeof source.enabled != "boolean") return invalidResponse();
@@ -11049,17 +11151,13 @@ function errorListener(value) {
11049
11151
  }
11050
11152
  function variableReferences(input) {
11051
11153
  const source = record(input);
11052
- exact(source, [
11053
- "version",
11054
- "references",
11055
- "unknown"
11056
- ]);
11057
- if (source.version != 1 || !Array.isArray(source.references) || !Array.isArray(source.unknown)) return invalidResponse();
11154
+ requiredFields(source, ["version", "references"]);
11155
+ if (source.version != 1 || !Array.isArray(source.references)) return invalidResponse();
11058
11156
  return {
11059
11157
  version: 1,
11060
11158
  references: source.references.map((value) => {
11061
11159
  const item = record(value);
11062
- exact(item, [
11160
+ requiredFields(item, [
11063
11161
  "flowId",
11064
11162
  "flowName",
11065
11163
  "draft",
@@ -11068,7 +11166,7 @@ function variableReferences(input) {
11068
11166
  if (typeof item.draft != "boolean") return invalidResponse();
11069
11167
  const live = item.live === null ? null : record(item.live);
11070
11168
  if (live != null) {
11071
- exact(live, ["publicationId", "enabled"]);
11169
+ requiredFields(live, ["publicationId", "enabled"]);
11072
11170
  if (typeof live.enabled != "boolean") return invalidResponse();
11073
11171
  }
11074
11172
  return {
@@ -11080,20 +11178,6 @@ function variableReferences(input) {
11080
11178
  enabled: live.enabled
11081
11179
  }
11082
11180
  };
11083
- }),
11084
- unknown: source.unknown.map((value) => {
11085
- const item = record(value);
11086
- exact(item, [
11087
- "flowId",
11088
- "flowName",
11089
- "scope"
11090
- ]);
11091
- if (item.scope !== "draft" && item.scope !== "live") return invalidResponse();
11092
- return {
11093
- flowId: string(item.flowId),
11094
- flowName: string(item.flowName),
11095
- scope: item.scope
11096
- };
11097
11181
  })
11098
11182
  };
11099
11183
  }
@@ -11180,7 +11264,7 @@ function run$1(value) {
11180
11264
  }
11181
11265
  function runWaiting(value) {
11182
11266
  const source = record(value);
11183
- exact(source, [
11267
+ requiredFields(source, [
11184
11268
  "actions",
11185
11269
  "expiresAt",
11186
11270
  "nodeId",
@@ -11199,6 +11283,15 @@ function runWaiting(value) {
11199
11283
  waitingSince: string(source.waitingSince)
11200
11284
  };
11201
11285
  }
11286
+ function workflowIdentity(value) {
11287
+ const ref = record(value);
11288
+ return {
11289
+ flowId: string(ref.flowId),
11290
+ runId: string(ref.runId),
11291
+ nodeId: string(ref.nodeId),
11292
+ executionId: string(ref.executionId)
11293
+ };
11294
+ }
11202
11295
  function runDetails(value) {
11203
11296
  const source = record(value);
11204
11297
  const summary = run$1(source);
@@ -11206,20 +11299,24 @@ function runDetails(value) {
11206
11299
  if (eventsExpiresAt != null && typeof eventsExpiresAt != "string") return invalidResponse();
11207
11300
  if (source.waiting !== void 0 || !Array.isArray(source.waits)) return invalidResponse();
11208
11301
  const waits = source.waits.map(runWaiting);
11209
- if (new Set(waits.map((wait) => wait.waitId)).size != waits.length || summary.status == "waiting" && waits.length == 0 || [
11302
+ if (new Set(waits.map((wait) => wait.waitId)).size != waits.length || summary.status == "waiting" && waits.length == 0 && (!Array.isArray(source.calls) || source.calls.length == 0) || [
11210
11303
  "completed",
11211
11304
  "failed",
11212
11305
  "canceled",
11213
11306
  "indeterminate"
11214
11307
  ].includes(summary.status) && waits.length > 0) return invalidResponse();
11215
- if (source.occurrenceId === void 0 != (source.triggerNodeId === void 0)) return invalidResponse();
11308
+ if (source.occurrenceId !== void 0 && source.triggerNodeId === void 0) return invalidResponse();
11216
11309
  const state = {
11217
11310
  status: summary.status,
11218
11311
  waits
11219
11312
  };
11313
+ if (source.calls !== void 0 && !Array.isArray(source.calls)) return invalidResponse();
11220
11314
  const details = {
11221
11315
  ...summary,
11222
11316
  ...errorHandling(source),
11317
+ ...source.triggerNodeId === void 0 ? {} : { triggerNodeId: string(source.triggerNodeId) },
11318
+ ...source.caller === void 0 ? {} : { caller: workflowIdentity(source.caller) },
11319
+ ...source.calls === void 0 ? {} : { calls: source.calls.map((item) => Object.assign(workflowIdentity(item), { status: record(item).status === null ? null : runStatus(record(item).status) })) },
11223
11320
  closureDigest: string(source.closureDigest),
11224
11321
  engineContract: string(source.engineContract),
11225
11322
  engineDigest: string(source.engineDigest),
@@ -11270,7 +11367,7 @@ function runCancellation(value) {
11270
11367
  }
11271
11368
  function waitResolution(value) {
11272
11369
  const source = record(value);
11273
- exact(source, [
11370
+ requiredFields(source, [
11274
11371
  "action",
11275
11372
  "comment",
11276
11373
  "resolutionAccepted",
@@ -11487,7 +11584,7 @@ function decodeRunEvent(value) {
11487
11584
  switch (kind) {
11488
11585
  case "node.started": {
11489
11586
  const nodeKind = payload.nodeKind;
11490
- if (nodeKind !== void 0 && nodeKind !== "approval" && nodeKind !== "condition" && nodeKind !== "connector" && nodeKind !== "javascript" && nodeKind !== "decision" && nodeKind !== "openapi" && nodeKind !== "llm" && nodeKind !== "agent" && nodeKind !== "value" && nodeKind !== "wait") return invalidResponse();
11587
+ if (nodeKind !== void 0 && nodeKind !== "approval" && nodeKind !== "condition" && nodeKind !== "connector" && nodeKind !== "javascript" && nodeKind !== "decision" && nodeKind !== "openapi" && nodeKind !== "llm" && nodeKind !== "agent" && nodeKind !== "value" && nodeKind !== "outputs" && nodeKind !== "workflow" && nodeKind !== "wait") return invalidResponse();
11491
11588
  return {
11492
11589
  ...base,
11493
11590
  kind,
@@ -11614,14 +11711,14 @@ var ControlClient = class {
11614
11711
  if (options.limit != null) parameters.set("limit", String(options.limit));
11615
11712
  if (options.includeTotal != null) parameters.set("includeTotal", String(options.includeTotal));
11616
11713
  const query = parameters.size == 0 ? "" : `?${parameters}`;
11617
- return flowPage(await this.request(`/v1/flows${query}`));
11714
+ return flowPage(await this.request(`/v1/flows${query}`, options.signal == null ? void 0 : { signal: options.signal }));
11618
11715
  }
11619
11716
  async listEventSources(flowId, signal) {
11620
11717
  return decodeEventSources(await this.request("/v1/event-sources" + (flowId == null ? "" : `?flowId=${segment(flowId)}`), { signal }));
11621
11718
  }
11622
11719
  async listEventSourceConnections(teamId, signal) {
11623
11720
  const source = record(await this.request(`/v1/event-sources/connections${teamId == null ? "" : `?teamId=${segment(teamId)}`}`, { signal }));
11624
- exact(source, ["version", "connections"]);
11721
+ requiredFields(source, ["version", "connections"]);
11625
11722
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
11626
11723
  return source.connections.map(connection);
11627
11724
  }
@@ -11648,13 +11745,24 @@ var ControlClient = class {
11648
11745
  }
11649
11746
  async listVariables() {
11650
11747
  const source = record(await this.request("/v1/variables"));
11651
- exact(source, ["variables", "version"]);
11748
+ requiredFields(source, ["variables", "version"]);
11652
11749
  if (source.version != 1 || !Array.isArray(source.variables)) return invalidResponse();
11653
11750
  return {
11654
- variables: source.variables.map(variable),
11751
+ variables: source.variables.map(variableListItem),
11655
11752
  version: 1
11656
11753
  };
11657
11754
  }
11755
+ async getFlowReferences(flowId, options = {}) {
11756
+ const query = new URLSearchParams({
11757
+ direction: options.direction ?? "incoming",
11758
+ offset: String(options.offset ?? 0),
11759
+ limit: String(options.limit ?? 50)
11760
+ });
11761
+ return workflowReferencesSchema.parse(await this.request(`/v1/flows/${segment(flowId)}/references?${query}`, { signal: options.signal }));
11762
+ }
11763
+ async getWorkflowContract(flowId, signal) {
11764
+ return workflowContractSchema.parse(await this.request(`/v1/flows/${segment(flowId)}/call-contract`, { signal }));
11765
+ }
11658
11766
  async getVariableReferences(name, signal) {
11659
11767
  return variableReferences(await this.request(`/v1/variables/${segment(name)}/references`, { signal }));
11660
11768
  }
@@ -11669,7 +11777,7 @@ var ControlClient = class {
11669
11777
  }
11670
11778
  async deleteVariable(name) {
11671
11779
  const source = record(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
11672
- exact(source, ["version"]);
11780
+ requiredFields(source, ["version"]);
11673
11781
  if (source.version != 1) return invalidResponse();
11674
11782
  }
11675
11783
  async exportFlow(flowId) {
@@ -11711,7 +11819,7 @@ var ControlClient = class {
11711
11819
  command
11712
11820
  })
11713
11821
  }));
11714
- exact(source, [
11822
+ requiredFields(source, [
11715
11823
  "version",
11716
11824
  "flowId",
11717
11825
  "broadcast"
@@ -11851,11 +11959,11 @@ var ControlClient = class {
11851
11959
  }
11852
11960
  async listTriggerConfigOptions(flowId, nodeId, field, signal) {
11853
11961
  const source = record(await this.request(`/v1/flows/${segment(flowId)}/triggers/${segment(nodeId)}/options/${segment(field)}`, { signal }));
11854
- exact(source, ["options", "version"]);
11962
+ requiredFields(source, ["options", "version"]);
11855
11963
  if (source.version != 1 || !Array.isArray(source.options) || source.options.length > 1e3) return invalidResponse();
11856
11964
  return source.options.map((value) => {
11857
11965
  const item = record(value);
11858
- exact(item, [
11966
+ requiredFields(item, [
11859
11967
  "value",
11860
11968
  "label",
11861
11969
  ...item.color == null ? [] : ["color"]
@@ -11874,7 +11982,7 @@ var ControlClient = class {
11874
11982
  }
11875
11983
  async listConnectorTeams(signal) {
11876
11984
  const source = record(await this.request("/v1/connector/teams", { signal }));
11877
- exact(source, [
11985
+ requiredFields(source, [
11878
11986
  "enabled",
11879
11987
  "teams",
11880
11988
  "version"
@@ -11884,7 +11992,7 @@ var ControlClient = class {
11884
11992
  enabled: source.enabled,
11885
11993
  teams: source.teams.map((value) => {
11886
11994
  const team = record(value);
11887
- exact(team, [
11995
+ requiredFields(team, [
11888
11996
  "id",
11889
11997
  "name",
11890
11998
  "systemCreated"
@@ -11997,7 +12105,7 @@ var ControlClient = class {
11997
12105
  body: JSON.stringify({ version: 1 }),
11998
12106
  method: "POST"
11999
12107
  }));
12000
- exact(source, ["url", "version"]);
12108
+ requiredFields(source, ["url", "version"]);
12001
12109
  if (source.version != 1) return invalidResponse();
12002
12110
  try {
12003
12111
  const url = new URL(string(source.url));
@@ -12059,6 +12167,16 @@ var ControlClient = class {
12059
12167
  method: "POST"
12060
12168
  }));
12061
12169
  }
12170
+ async upgradeDraft(flowId, expectedRevisionId, options = {}) {
12171
+ return draftChange(await this.request(`/v1/flows/${segment(flowId)}/draft/upgrade`, {
12172
+ body: JSON.stringify({
12173
+ expectedRevisionId,
12174
+ version: 1
12175
+ }),
12176
+ headers: { "idempotency-key": options.idempotencyKey ?? operationKey("upgrade") },
12177
+ method: "POST"
12178
+ }));
12179
+ }
12062
12180
  async checkFlow(flowId, revisionId) {
12063
12181
  return flowCheck(await this.request(`/v1/flows/${segment(flowId)}/revisions/${segment(revisionId)}/check`, {
12064
12182
  body: JSON.stringify({
@@ -12201,7 +12319,7 @@ var ControlClient = class {
12201
12319
  const suffix = query == "" ? "" : `?${query}`;
12202
12320
  return this.connectorRequest(`/v1/connector/actions${suffix}`, "actions", signal, (value) => {
12203
12321
  const source = record(value);
12204
- exact(source, ["actions", "version"]);
12322
+ requiredFields(source, ["actions", "version"]);
12205
12323
  if (source.version != 1 || !Array.isArray(source.actions)) return invalidResponse();
12206
12324
  return source.actions.map(connectorAction);
12207
12325
  });
@@ -12337,7 +12455,8 @@ var mcpConformanceCases = [
12337
12455
  kind: "graph.node.create",
12338
12456
  nodeId: "start",
12339
12457
  node: {
12340
- kind: "manual",
12458
+ inputDefs: [],
12459
+ kind: "start",
12341
12460
  name: "Start"
12342
12461
  }
12343
12462
  }]);
@@ -12518,7 +12637,7 @@ var mcpTools = {
12518
12637
  expectedPublicationId: id,
12519
12638
  enabled: boolean()
12520
12639
  }), false),
12521
- flow_run: tool("Start a Run and return its runId. For draft supply flowId and revisionId; for live supply publicationId. Always fix the source, Trigger and idempotencyKey. Poll run_get for completion.", discriminatedUnion("source", [strictObject({
12640
+ flow_run: tool("Start a Run and return its runId. For draft supply flowId and revisionId; for live supply publicationId and select a Start node. Only draft Runs may simulate other Triggers. Always fix the source, Trigger and idempotencyKey. Start parameters come from the Start node’s flow_read config.inputDefs and are supplied in trigger.outputs; required parameters must be present, omitted nullable parameters become null, and unknown parameters are rejected. Poll run_get for completion.", discriminatedUnion("source", [strictObject({
12522
12641
  source: literal("draft"),
12523
12642
  flowId: flow,
12524
12643
  revisionId: id,
@@ -12608,7 +12727,7 @@ var mcpTools = {
12608
12727
  flowId: flow.optional()
12609
12728
  }), true),
12610
12729
  event_source_list: tool("List independent Feishu event sources, including Team, Connection, event types, enabled and verification status. Inspect consumers for Flows actually using each source.", strictObject({}), true),
12611
- trigger_search: tool("Search provider Trigger summaries; omit query to list all. Flow trigger instances are in flow_read. Manual, Webhook and Cron are built-in node kinds described by flow_schema.", strictObject({ query: string$1().trim().min(1).max(256).optional() }), true),
12730
+ trigger_search: tool("Search provider Trigger summaries; omit query to list all. Flow trigger instances are in flow_read. Start, Webhook and Cron are built-in node kinds described by flow_schema.", strictObject({ query: string$1().trim().min(1).max(256).optional() }), true),
12612
12731
  trigger_get: tool("Read a provider Trigger definition before creating its node.", strictObject({ key: id }), true)
12613
12732
  };
12614
12733
  //#endregion