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

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 (36) hide show
  1. package/dist/browser/{createResourceDialog-Btjes3wD.js → createResourceDialog-C23SBjYd.js} +2 -2
  2. package/dist/browser/flow-authoring-node.d.ts +6 -2
  3. package/dist/browser/flow-authoring.js +44 -12
  4. package/dist/browser/flow-change-schema.d.ts +266 -0
  5. package/dist/browser/flow-change.d.ts +5 -0
  6. package/dist/browser/flow-change.js +33 -2
  7. package/dist/browser/{flowChanges-BxutPLYO.js → flowChanges-fBiAeTzR.js} +954 -487
  8. package/dist/browser/{flowWorkspace-Dg4mqfa6.js → flowWorkspace-MqcEfg7T.js} +3 -3
  9. package/dist/browser/{icons-p2A9zs8t.js → icons-6oQ8Q9Wm.js} +4298 -4252
  10. package/dist/browser/preview.js +354 -36
  11. package/dist/browser/workbench.js +21 -10
  12. package/dist/browser/{workbenchSelect-LRp_Xjeq.js → workbenchSelect-DpLbIr29.js} +1 -1
  13. package/dist/common/authoring.d.ts +207 -0
  14. package/dist/common/authoringSchema.d.ts +1293 -0
  15. package/dist/common/control-api-conformance.js +975 -505
  16. package/dist/common/control-api-errors.d.ts +2 -1
  17. package/dist/common/control-api.d.ts +81 -0
  18. package/dist/common/control-api.js +973 -586
  19. package/dist/common/control-requests.d.ts +128 -0
  20. package/dist/common/control-requests.js +3122 -346
  21. package/dist/common/decision.js +12 -2
  22. package/dist/common/flow-encoding.js +12 -2
  23. package/dist/common/flow-semantics.d.ts +9 -0
  24. package/dist/common/flow-semantics.js +28 -3
  25. package/dist/common/integration-trigger.js +12 -2
  26. package/dist/common/lib-DrKav3HG.js +11403 -0
  27. package/dist/common/mcp.d.ts +120 -11
  28. package/dist/common/mcp.js +423 -51
  29. package/dist/common/openapi.js +12 -2
  30. package/dist/common/poll-trigger.js +12 -2
  31. package/dist/common/scheduler.js +12 -2
  32. package/dist/common/webhook-trigger.js +12 -2
  33. package/package.json +7 -1
  34. package/skills/open-flow/SKILL.md +32 -0
  35. package/skills/open-flow/references/flow-authoring.md +356 -0
  36. package/skills/open-flow/references/flow-n8n-conversion.md +196 -0
@@ -5831,7 +5831,7 @@ function refine(fn, _params = {}) {
5831
5831
  function superRefine(fn, params) {
5832
5832
  return /* @__PURE__ */ _superRefine(fn, params);
5833
5833
  }
5834
- function json$3(params) {
5834
+ function json$4(params) {
5835
5835
  const jsonSchema = lazy(() => {
5836
5836
  return union([
5837
5837
  string$1(params),
@@ -6320,7 +6320,7 @@ var ExpressionKind = Object.freeze({
6320
6320
  });
6321
6321
  //#endregion
6322
6322
  //#region src/json-schema-subset/expression/expression.ts
6323
- var expression = (delegate) => (e1, e2) => {
6323
+ var expression$1 = (delegate) => (e1, e2) => {
6324
6324
  const rootNode = {
6325
6325
  parent: null,
6326
6326
  swapped: false,
@@ -8308,7 +8308,7 @@ function checkWithResult(extendsContext, schema1, schema2) {
8308
8308
  const describe = describer();
8309
8309
  const equals = schemaEqualsChecker(extendsContext);
8310
8310
  context.isEquals = wrapEqualsCheckerWithCache(isDeepEquals);
8311
- context.calculate = expression({
8311
+ context.calculate = expression$1({
8312
8312
  describe,
8313
8313
  equals,
8314
8314
  calculate,
@@ -8777,15 +8777,15 @@ var webhookMethods = [
8777
8777
  "DELETE"
8778
8778
  ];
8779
8779
  var text = string$1();
8780
- var json$2 = json$3();
8781
- var strings = array(text);
8780
+ var json$3 = json$4();
8781
+ var strings$1 = array(text);
8782
8782
  var port$1 = object({
8783
8783
  description: text.optional(),
8784
- jsonSchema: json$2,
8784
+ jsonSchema: json$3,
8785
8785
  nullable: boolean(),
8786
8786
  handle: text
8787
8787
  });
8788
- var input = port$1.extend({ value: json$2.optional() });
8788
+ var input = port$1.extend({ value: json$3.optional() });
8789
8789
  var group = object({
8790
8790
  collapsed: boolean().optional(),
8791
8791
  group: text
@@ -8801,7 +8801,7 @@ var source = union([object({
8801
8801
  })]);
8802
8802
  var fixedInput = union([object({ kind: literal("unset") }), object({
8803
8803
  kind: literal("value"),
8804
- value: json$2
8804
+ value: json$3
8805
8805
  })]);
8806
8806
  var mapping = union([fixedInput, object({
8807
8807
  kind: literal("sources"),
@@ -8852,7 +8852,7 @@ var inline = object({
8852
8852
  });
8853
8853
  var agentValue = union([object({
8854
8854
  kind: literal("value"),
8855
- value: json$2
8855
+ value: json$3
8856
8856
  }), object({
8857
8857
  kind: literal("input"),
8858
8858
  input: text
@@ -8881,10 +8881,10 @@ var decisionQuestion = discriminatedUnion("type", [
8881
8881
  name: text,
8882
8882
  instructions: text,
8883
8883
  type: literal("score"),
8884
- criteria: strings
8884
+ criteria: strings$1
8885
8885
  })
8886
8886
  ]);
8887
- var managed = object({
8887
+ var managedFields = object({
8888
8888
  ...ports$1,
8889
8889
  name: text,
8890
8890
  executor: union([
@@ -8899,7 +8899,7 @@ var managed = object({
8899
8899
  method: text,
8900
8900
  path: text,
8901
8901
  serverUrl: text,
8902
- document: json$2,
8902
+ document: json$3,
8903
8903
  auth: array(object({
8904
8904
  id: text,
8905
8905
  type: _enum([
@@ -8943,11 +8943,12 @@ var managed = object({
8943
8943
  }).optional()
8944
8944
  })
8945
8945
  ])
8946
- }).transform(limitDecisionTask);
8947
- var operand = union([object({
8946
+ });
8947
+ var managed = managedFields.transform(limitDecisionTask);
8948
+ var operand$1 = union([object({
8948
8949
  kind: literal("value"),
8949
- value: json$2.optional(),
8950
- jsonSchema: json$2.optional()
8950
+ value: json$3.optional(),
8951
+ jsonSchema: json$3.optional()
8951
8952
  }), object({
8952
8953
  kind: literal("source"),
8953
8954
  source
@@ -8958,7 +8959,7 @@ var condition = {
8958
8959
  description: text.optional(),
8959
8960
  output: text,
8960
8961
  groups: array(object({ expressions: array(object({
8961
- left: operand,
8962
+ left: operand$1,
8962
8963
  operator: _enum([
8963
8964
  "!=",
8964
8965
  "<",
@@ -8981,7 +8982,7 @@ var condition = {
8981
8982
  "notHasValue",
8982
8983
  "startsWith"
8983
8984
  ]),
8984
- right: operand.optional()
8985
+ right: operand$1.optional()
8985
8986
  })) }))
8986
8987
  }))
8987
8988
  };
@@ -8991,7 +8992,7 @@ var wait = {
8991
8992
  };
8992
8993
  var webhookOptions = object({
8993
8994
  allowedMethods: never().optional(),
8994
- allowedOrigins: strings.optional(),
8995
+ allowedOrigins: strings$1.optional(),
8995
8996
  noResponseBody: never().optional(),
8996
8997
  responseData: text.optional(),
8997
8998
  responseHeaders: record$2(text, text).optional(),
@@ -9118,6 +9119,25 @@ var node = union([
9118
9119
  })
9119
9120
  })
9120
9121
  ]);
9122
+ /** Configuration schemas shared by the node authoring boundary. */
9123
+ var authoringDefinitionSchemas = {
9124
+ input,
9125
+ port: port$1,
9126
+ ports: ports$1,
9127
+ condition: strictObject(condition),
9128
+ wait: strictObject(wait),
9129
+ webhook: strictObject(webhook),
9130
+ schedule: triggerScheduleSchema,
9131
+ capabilities: array(capability),
9132
+ connector: managedFields.shape.executor.options[0].omit({ kind: true }).strict(),
9133
+ openapi: managedFields.shape.executor.options[1].omit({ kind: true }).strict(),
9134
+ decision: managedFields.shape.executor.options[2].omit({ kind: true }).strict(),
9135
+ llm: managedFields.shape.executor.options[3].omit({ kind: true }).strict(),
9136
+ agent: managedFields.shape.executor.options[4].omit({
9137
+ kind: true,
9138
+ notification: true
9139
+ }).strict()
9140
+ };
9121
9141
  var edge = object({
9122
9142
  source: text,
9123
9143
  target: text,
@@ -9137,7 +9157,7 @@ var binding = object({
9137
9157
  });
9138
9158
  var module = object({
9139
9159
  name: text,
9140
- imports: strings,
9160
+ imports: strings$1,
9141
9161
  source: text
9142
9162
  });
9143
9163
  var document = preprocess(rejectRetiredDefinitions, object({
@@ -9205,6 +9225,11 @@ var shapes = {
9205
9225
  ...at,
9206
9226
  node
9207
9227
  },
9228
+ "graph.node.replace": {
9229
+ ...at,
9230
+ before: node,
9231
+ node
9232
+ },
9208
9233
  "graph.node.delete": at,
9209
9234
  "graph.node.field.set": union([
9210
9235
  object({
@@ -9309,9 +9334,9 @@ var shapes = {
9309
9334
  },
9310
9335
  "module.source.replace": {
9311
9336
  moduleId: text,
9312
- beforeImports: strings,
9337
+ beforeImports: strings$1,
9313
9338
  beforeSource: text,
9314
- imports: strings,
9339
+ imports: strings$1,
9315
9340
  source: text
9316
9341
  },
9317
9342
  "graph.node.task.set": {
@@ -9362,6 +9387,298 @@ function resourceNameIssue(value) {
9362
9387
  if (!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(name)) return "specialCharacter";
9363
9388
  }
9364
9389
  //#endregion
9390
+ //#region src/control/common/authoringLlm.ts
9391
+ var authoringLlmConfiguration = strictObject({
9392
+ mode: _enum(["chat", "json"]),
9393
+ resultSchema: json$4(),
9394
+ model: json$4().optional().describe("Default model settings: {model, temperature?, top_p?, max_tokens?}. A bound model input takes precedence."),
9395
+ template: json$4().optional().describe("Default message templates: [{role: \"system\" | \"user\" | \"assistant\", content: \"Text with {{namedInput}}\"}]."),
9396
+ messages: json$4().optional().describe("Default conversation history, prepended without template interpolation; an array of {role, content} or null.")
9397
+ });
9398
+ //#endregion
9399
+ //#region src/control/common/authoringOpenApi.ts
9400
+ var authenticationSchema = union([
9401
+ strictObject({ schemes: array(string$1().min(1)).describe("One complete security alternative advertised by this operation; [] selects no authentication.") }),
9402
+ strictObject({ type: _enum(["bearer", "basic"]) }),
9403
+ strictObject({
9404
+ type: literal("apiKey"),
9405
+ name: string$1().min(1),
9406
+ in: _enum(["header", "query"])
9407
+ })
9408
+ ]);
9409
+ strictObject({
9410
+ sourceUrl: string$1().min(1),
9411
+ path: string$1().min(1),
9412
+ method: string$1().min(1),
9413
+ serverUrl: string$1().optional(),
9414
+ authentication: authenticationSchema.optional().describe("Omit to use the operation default. Bind credentials through the advertised node inputs.")
9415
+ });
9416
+ //#endregion
9417
+ //#region src/control/common/authoringSchema.ts
9418
+ var id$2 = string$1().min(1);
9419
+ var json$2 = json$4();
9420
+ var patch = record$2(id$2, json$2);
9421
+ var type = _enum([
9422
+ "manual",
9423
+ "webhook",
9424
+ "cron",
9425
+ "error",
9426
+ "poll",
9427
+ "integration",
9428
+ "code",
9429
+ "connector",
9430
+ "agent",
9431
+ "llm",
9432
+ "decision",
9433
+ "openapi",
9434
+ "condition",
9435
+ "value",
9436
+ "wait",
9437
+ "approval"
9438
+ ]);
9439
+ var referenceSchema = id$2.describe("An existing node reference returned by read/search, or $alias for a preceding node.add in this edit batch. For node.add.as \"step\", reference \"$step\", never bare \"step\". Aliases are local to one batch.");
9440
+ var output = strictObject({
9441
+ kind: literal("output"),
9442
+ node: referenceSchema,
9443
+ port: id$2.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),
9444
+ field: string$1().optional()
9445
+ });
9446
+ var variable$1 = strictObject({
9447
+ kind: literal("variable"),
9448
+ name: id$2
9449
+ });
9450
+ var authoringSourceSchema = union([
9451
+ output,
9452
+ variable$1,
9453
+ strictObject({
9454
+ kind: literal("value"),
9455
+ value: json$2
9456
+ }),
9457
+ strictObject({ kind: literal("unset") }),
9458
+ strictObject({ kind: literal("default") }),
9459
+ strictObject({
9460
+ kind: literal("sources"),
9461
+ sources: array(union([output, variable$1])).min(1)
9462
+ })
9463
+ ]);
9464
+ var operand = union([
9465
+ strictObject({
9466
+ kind: literal("value"),
9467
+ value: json$2.optional(),
9468
+ schema: json$2.optional()
9469
+ }),
9470
+ output,
9471
+ variable$1
9472
+ ]);
9473
+ var agentTool = authoringDefinitionSchemas.agent.shape.tools.element.omit({
9474
+ id: true,
9475
+ inputs: true
9476
+ }).extend({ inputs: record$2(id$2, authoringDefinitionSchemas.agent.shape.tools.element.shape.inputs.element.shape.source).optional().describe("Action input sources by name. The tool resolves types from the Action. New inputs default to model-provided; existing sources are preserved when omitted.") }).strict();
9477
+ var notification = strictObject({
9478
+ ...authoringDefinitionSchemas.connector.shape,
9479
+ messageHandle: id$2,
9480
+ inputs: record$2(id$2, union([strictObject({
9481
+ kind: literal("value"),
9482
+ value: json$2
9483
+ }), strictObject({
9484
+ kind: literal("input"),
9485
+ input: id$2
9486
+ })]))
9487
+ });
9488
+ var field = strictObject({
9489
+ schema: json$2.optional(),
9490
+ nullable: boolean().optional(),
9491
+ description: string$1().optional()
9492
+ });
9493
+ 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.");
9494
+ var outputFields = record$2(id$2, field).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true.");
9495
+ var expression = strictObject({
9496
+ left: operand,
9497
+ operator: authoringDefinitionSchemas.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,
9498
+ right: operand.optional()
9499
+ });
9500
+ var all = strictObject({ all: array(expression) });
9501
+ var when = union([
9502
+ expression,
9503
+ all,
9504
+ strictObject({ any: array(union([expression, all])) })
9505
+ ]);
9506
+ strictObject({}), strictObject({ sourceFlowIds: array(id$2).optional() }), authoringDefinitionSchemas.webhook.omit({ bodyFields: true }).extend({ body: inputFields }).strict(), strictObject({ schedule: authoringDefinitionSchemas.schedule }), strictObject({
9507
+ key: id$2,
9508
+ connectionId: id$2.optional(),
9509
+ schedule: authoringDefinitionSchemas.schedule
9510
+ }), strictObject({
9511
+ key: id$2,
9512
+ connectionId: id$2.optional()
9513
+ }), strictObject({
9514
+ inputs: inputFields,
9515
+ outputs: outputFields,
9516
+ capabilities: authoringDefinitionSchemas.capabilities.optional()
9517
+ }), authoringDefinitionSchemas.connector.strict(), authoringDefinitionSchemas.agent.omit({
9518
+ prompt: true,
9519
+ tools: true
9520
+ }).extend({
9521
+ inputs: inputFields,
9522
+ resultSchema: json$2.describe("JSON schema of the final result. Defaults to text. The tool manages the output definition; references can omit port."),
9523
+ tools: array(agentTool),
9524
+ notification: notification.optional()
9525
+ }).strict(), authoringLlmConfiguration.extend({ inputs: inputFields }), authoringDefinitionSchemas.decision, strictObject({
9526
+ match: _enum(["first", "all"]),
9527
+ branches: array(strictObject({
9528
+ name: id$2,
9529
+ description: string$1().optional(),
9530
+ when
9531
+ }))
9532
+ }), strictObject({
9533
+ values: patch,
9534
+ outputs: outputFields
9535
+ }), strictObject({ inputs: inputFields }), strictObject({ inputs: inputFields });
9536
+ var updates = strictObject({
9537
+ name: id$2.optional(),
9538
+ description: string$1().optional(),
9539
+ icon: string$1().optional(),
9540
+ maxExecutions: int().positive().optional(),
9541
+ timeoutMs: number().nonnegative().optional(),
9542
+ config: patch.optional().describe("Recursively merge configuration; omitted fields remain unchanged and arrays replace as a whole. This includes schema objects: {} does not clear an existing schema. Use clear paths to remove fields, e.g. [\"config\",\"inputs\",\"amount\",\"schema\",\"type\"].")
9543
+ });
9544
+ var authoringEditSchema = discriminatedUnion("op", [
9545
+ strictObject({
9546
+ op: literal("node.add"),
9547
+ as: id$2.regex(/^[A-Za-z][\w-]*$/).describe("Unique batch-local alias without the $ prefix. Later edits must reference this new node as $alias; the bare alias is not its node ID."),
9548
+ type,
9549
+ name: id$2,
9550
+ config: patch.optional(),
9551
+ inputs: record$2(id$2, authoringSourceSchema).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),
9552
+ code: string$1().optional(),
9553
+ prompt: string$1().optional()
9554
+ }),
9555
+ strictObject({
9556
+ op: literal("node.update"),
9557
+ node: referenceSchema,
9558
+ set: updates.optional(),
9559
+ clear: array(array(id$2).min(1)).optional()
9560
+ }),
9561
+ strictObject({
9562
+ op: literal("node.remove"),
9563
+ node: referenceSchema
9564
+ }),
9565
+ strictObject({
9566
+ op: literal("input.set"),
9567
+ node: referenceSchema,
9568
+ input: id$2,
9569
+ source: authoringSourceSchema
9570
+ }),
9571
+ strictObject({
9572
+ op: _enum(["edge.connect", "edge.disconnect"]),
9573
+ source: referenceSchema,
9574
+ target: referenceSchema,
9575
+ branch: id$2.optional()
9576
+ }),
9577
+ strictObject({
9578
+ op: literal("text.edit"),
9579
+ node: referenceSchema,
9580
+ field: _enum(["code", "prompt"]),
9581
+ oldText: id$2,
9582
+ newText: string$1()
9583
+ }),
9584
+ strictObject({
9585
+ op: literal("text.set"),
9586
+ node: referenceSchema,
9587
+ field: _enum(["code", "prompt"]),
9588
+ text: string$1()
9589
+ })
9590
+ ]);
9591
+ var authoringRequestSchema = strictObject({
9592
+ baseRevision: id$2,
9593
+ requestId: id$2.max(256),
9594
+ edits: array(authoringEditSchema).min(1).max(1e3)
9595
+ });
9596
+ var authoringReadSchema = strictObject({
9597
+ revision: id$2.optional().describe("Fixed revision from a previous read; omit to read the current draft."),
9598
+ nodes: array(id$2).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),
9599
+ text: strictObject({
9600
+ node: id$2,
9601
+ field: _enum(["code", "prompt"]),
9602
+ start: int().positive().default(1),
9603
+ lines: int().min(1).max(200).default(80)
9604
+ }).optional().describe("Read code or prompt by line (1-based). Mutually exclusive with nodes. Follow nextStart at the same revision until truncated is false.")
9605
+ }).refine((v) => v.nodes == null || v.text == null, "Choose nodes or text.").meta({
9606
+ not: { required: ["nodes", "text"] },
9607
+ description: "Omit nodes and text for an outline; provide nodes for details, or text for an excerpt."
9608
+ });
9609
+ strictObject({ revisionId: id$2 });
9610
+ var authoringSearchSchema = strictObject({
9611
+ revision: id$2.optional(),
9612
+ query: id$2.max(1e3),
9613
+ type: type.optional(),
9614
+ offset: int().nonnegative().default(0),
9615
+ limit: int().min(1).max(100).default(20)
9616
+ });
9617
+ var authoringSchemaQuery = strictObject({
9618
+ type: type.optional(),
9619
+ action: id$2.optional()
9620
+ }).refine((v) => v.type == null || v.action == null, "Choose type or action.");
9621
+ var authoringDiagnosticSchema = object({
9622
+ code: id$2,
9623
+ message: string$1(),
9624
+ nodes: array(id$2),
9625
+ field: string$1().optional(),
9626
+ line: number().optional(),
9627
+ column: number().optional()
9628
+ });
9629
+ var authoringCheckResponse = object({
9630
+ flowId: id$2,
9631
+ revisionId: id$2,
9632
+ valid: boolean(),
9633
+ diagnostics: array(authoringDiagnosticSchema),
9634
+ version: literal(1)
9635
+ });
9636
+ var authoringEditResponse = object({
9637
+ flowId: id$2,
9638
+ saved: literal(true),
9639
+ revision: id$2,
9640
+ nodes: record$2(id$2, id$2),
9641
+ changes: array(object({
9642
+ index: int(),
9643
+ op: id$2,
9644
+ node: id$2.optional()
9645
+ })),
9646
+ validation: object({
9647
+ status: _enum([
9648
+ "valid",
9649
+ "invalid",
9650
+ "unavailable"
9651
+ ]),
9652
+ diagnostics: array(authoringDiagnosticSchema).optional()
9653
+ }),
9654
+ version: literal(1)
9655
+ });
9656
+ var authoringReadResponse = object({
9657
+ flowId: id$2,
9658
+ revision: id$2,
9659
+ data: object({
9660
+ nodes: array(record$2(string$1(), json$2)).optional(),
9661
+ edges: array(json$2).optional(),
9662
+ text: record$2(string$1(), json$2).optional()
9663
+ }),
9664
+ version: literal(1)
9665
+ });
9666
+ var authoringSearchResponse = object({
9667
+ flowId: id$2,
9668
+ revision: id$2,
9669
+ data: object({
9670
+ matches: array(object({
9671
+ node: id$2,
9672
+ field: id$2,
9673
+ line: int().optional(),
9674
+ excerpt: string$1()
9675
+ })),
9676
+ total: int(),
9677
+ nextOffset: int().optional()
9678
+ }),
9679
+ version: literal(1)
9680
+ });
9681
+ //#endregion
9365
9682
  //#region src/control/common/resultQuery.ts
9366
9683
  var resultQuerySchema = strictObject({
9367
9684
  pointer: string$1().max(4096).default(""),
@@ -9455,9 +9772,10 @@ var controlErrorCode = {
9455
9772
  };
9456
9773
  controlErrorCode.eventSourceInvalid, controlErrorCode.eventSourceIdentityUnavailable, controlErrorCode.eventSourceNotFound, controlErrorCode.eventSourceConflict, controlErrorCode.authenticationRequired, controlErrorCode.authorizationDenied, controlErrorCode.bindingUnresolved, controlErrorCode.connectorActionNotFound, controlErrorCode.connectorAccessConflict, controlErrorCode.connectorAccessInvalid, controlErrorCode.connectorAccessRequired, controlErrorCode.connectorAccessUnsupported, controlErrorCode.connectorUnconfigured, controlErrorCode.connectorUnavailable, controlErrorCode.connectorConsoleUnconfigured, controlErrorCode.engineUnavailable, controlErrorCode.engineUnsupported, controlErrorCode.flowInvalid, controlErrorCode.flowRepairRequired, controlErrorCode.flowUpgradeRequired, controlErrorCode.flowNotFound, controlErrorCode.flowBusy, controlErrorCode.flowConflict, controlErrorCode.flowPresentationConflict, controlErrorCode.flowRevisionConflict, controlErrorCode.liveConflict, controlErrorCode.liveNotFound, controlErrorCode.pageInvalidCursor, controlErrorCode.publicationConflict, controlErrorCode.publicationNotFound, controlErrorCode.publicationUnsupported, controlErrorCode.publishOperationNotFound, controlErrorCode.routeNotFound, controlErrorCode.runConflict, controlErrorCode.runEventsExpired, controlErrorCode.runInvalid, controlErrorCode.runNotFound, controlErrorCode.runNotTerminal, controlErrorCode.runOverloaded, controlErrorCode.runWaitNotFound, controlErrorCode.triggerKeyInvalid, controlErrorCode.triggerKeyNotFound, controlErrorCode.triggerNotFound, controlErrorCode.variableInvalid, controlErrorCode.variableLimitReached, controlErrorCode.variableNotFound;
9457
9774
  var ApiError = class extends Error {
9458
- constructor(status, code, message) {
9775
+ constructor(status, code, message, details) {
9459
9776
  super(message);
9460
9777
  this.code = code;
9778
+ this.details = details;
9461
9779
  this.name = "ApiError";
9462
9780
  this.status = status;
9463
9781
  }
@@ -9922,9 +10240,9 @@ function isUiLanguage(value) {
9922
10240
  var configInputsSchema = array(union([strictObject({
9923
10241
  handle: string$1().min(1),
9924
10242
  description: string$1().optional(),
9925
- jsonSchema: json$3(),
10243
+ jsonSchema: json$4(),
9926
10244
  nullable: boolean(),
9927
- value: json$3().optional()
10245
+ value: json$4().optional()
9928
10246
  }), strictObject({
9929
10247
  group: string$1(),
9930
10248
  collapsed: boolean().optional()
@@ -10157,7 +10475,7 @@ function labels(value, handles) {
10157
10475
  }
10158
10476
  //#endregion
10159
10477
  //#region src/control/common/results.ts
10160
- var json$1 = json$3();
10478
+ var json$1 = json$4();
10161
10479
  var entry = strictObject({
10162
10480
  pointer: string$1(),
10163
10481
  type: _enum([
@@ -10321,6 +10639,43 @@ function connectorConnectionsQuery(serviceId, flowId) {
10321
10639
  }
10322
10640
  //#endregion
10323
10641
  //#region src/control/common/flowDecoders.ts
10642
+ function strings(value) {
10643
+ return Array.isArray(value) ? value.map(string) : invalidResponse();
10644
+ }
10645
+ function resourceReferences(input) {
10646
+ const source = record(input);
10647
+ const draft = source.draft === null ? null : record(source.draft);
10648
+ const shared = record(source.sharedAccess);
10649
+ if (draft != null && !Array.isArray(draft.connections)) return invalidResponse();
10650
+ if (!Array.isArray(shared.bindings)) return invalidResponse();
10651
+ const accessRevision = integer(shared.accessRevision);
10652
+ if (accessRevision < 0) return invalidResponse();
10653
+ return {
10654
+ draft: draft == null ? null : {
10655
+ variableNames: strings(draft.variableNames),
10656
+ errorSourceFlowIds: strings(draft.errorSourceFlowIds),
10657
+ connections: draft.connections.map((value) => {
10658
+ const connection = record(value);
10659
+ return {
10660
+ providerId: string(connection.providerId),
10661
+ connectionId: string(connection.connectionId)
10662
+ };
10663
+ })
10664
+ },
10665
+ sharedAccess: {
10666
+ accessRevision,
10667
+ providerIds: strings(shared.providerIds),
10668
+ bindings: shared.bindings.map((value) => {
10669
+ const binding = record(value);
10670
+ return {
10671
+ providerId: string(binding.providerId),
10672
+ connectionId: binding.connectionId === null ? null : string(binding.connectionId),
10673
+ accessBindingId: string(binding.accessBindingId)
10674
+ };
10675
+ })
10676
+ }
10677
+ };
10678
+ }
10324
10679
  function flow$1(value) {
10325
10680
  const source = record(value);
10326
10681
  const status = source.status;
@@ -10337,6 +10692,7 @@ function flow$1(value) {
10337
10692
  createdAt: string(source.createdAt),
10338
10693
  ...source.connectorTeamId == null ? {} : { connectorTeamId: string(source.connectorTeamId) },
10339
10694
  draftRevisionId: string(source.draftRevisionId),
10695
+ resourceReferences: resourceReferences(source.resourceReferences),
10340
10696
  flowId: string(source.flowId),
10341
10697
  name: string(source.name),
10342
10698
  status,
@@ -11403,6 +11759,37 @@ var ControlClient = class {
11403
11759
  return invalidResponse();
11404
11760
  }
11405
11761
  }
11762
+ async readAuthoring(flowId, query = {}) {
11763
+ return authoringReadResponse.parse(await this.request(`/v1/flows/${segment(flowId)}/authoring/read`, {
11764
+ method: "POST",
11765
+ body: JSON.stringify(query)
11766
+ }));
11767
+ }
11768
+ async searchAuthoring(flowId, query) {
11769
+ return authoringSearchResponse.parse(await this.request(`/v1/flows/${segment(flowId)}/authoring/search`, {
11770
+ method: "POST",
11771
+ body: JSON.stringify(query)
11772
+ }));
11773
+ }
11774
+ async authoringSchema(flowId, query) {
11775
+ return record(await this.request(`/v1/flows/${segment(flowId)}/authoring/schema`, {
11776
+ method: "POST",
11777
+ body: JSON.stringify(query)
11778
+ }));
11779
+ }
11780
+ async editAuthoring(flowId, request) {
11781
+ return authoringEditResponse.parse(await this.request(`/v1/flows/${segment(flowId)}/authoring/edit`, {
11782
+ method: "POST",
11783
+ headers: { "idempotency-key": request.requestId },
11784
+ body: JSON.stringify(request)
11785
+ }));
11786
+ }
11787
+ async checkAuthoring(flowId, revisionId) {
11788
+ return authoringCheckResponse.parse(await this.request(`/v1/flows/${segment(flowId)}/authoring/check`, {
11789
+ method: "POST",
11790
+ body: JSON.stringify({ revisionId })
11791
+ }));
11792
+ }
11406
11793
  async changeDraft(flowId, expectedRevisionId, operations, changeId = operationKey("change")) {
11407
11794
  return draftChange(await this.request(`/v1/flows/${segment(flowId)}/draft/changes`, {
11408
11795
  body: JSON.stringify({
@@ -11585,7 +11972,7 @@ var ControlClient = class {
11585
11972
  }
11586
11973
  const error = record(value).error;
11587
11974
  const source = error == null ? void 0 : record(error);
11588
- throw new ApiError(response.status, typeof source?.code == "string" ? source.code : "request.failed", typeof source?.message == "string" ? source.message : `Request failed with status ${response.status}.`);
11975
+ throw new ApiError(response.status, typeof source?.code == "string" ? source.code : "request.failed", typeof source?.message == "string" ? source.message : `Request failed with status ${response.status}.`, source?.details == null ? void 0 : record(source.details));
11589
11976
  }
11590
11977
  return response;
11591
11978
  }
@@ -11763,13 +12150,13 @@ var mcpConformanceCases = [
11763
12150
  //#endregion
11764
12151
  //#region src/control/common/mcp.ts
11765
12152
  var mcpProtocolVersion = "2026-07-28";
11766
- var json = json$3();
12153
+ var json = json$4();
11767
12154
  var id = string$1().min(1);
11768
12155
  var mutationKey = id.max(256).describe("Stable identity for this mutation. Retry with the same key and identical arguments, even after a lost response.");
11769
12156
  var pageLimit = int().min(1).max(100).default(50);
11770
12157
  var flow = id.describe("Exact Flow ID returned by flow_list or flow_create.");
11771
12158
  var run = id.describe("Exact Run ID returned by flow_run or run_list.");
11772
- var mcpInstructions = "Use flow_list and flow_get to inspect a Flow. Use flow_node_get with the observed revisionId for individual node schemas or code. Use flow_schema to learn atomic edit operations, then flow_apply with the observed expectedRevisionId and a stable idempotencyKey. Use flow_check before flow_run. Select an explicit Trigger node ID and fixed revision or publication. A new Flow has no Trigger until you add one. Before adding a Feishu Trigger, use event_source_list and compare its Connection IDs with connector_connections in the Flow scope. If no source is available, create and verify one in Workbench. Use flow_publish to publish a fixed Revision, then poll flow_publish_status until succeeded or failed. Use flow_set_enabled to enable or disable the observed Live publication. flow_run returns an accepted Run, not its final result. Find Runs with run_list, poll run_get and use run_result after terminal. Resolve a waiting Run only with an explicit run_resolve_wait action allowed by run_get. Use run_results and run_result_read to inspect stored Agent tool results; these are separate from the terminal Run result. Retry flow_create, flow_apply, flow_publish and flow_run only with identical arguments and the same idempotencyKey; a new key can execute the Flow again. Other mutations use the same resource identity and arguments when retrying. Cancel a Run explicitly with run_cancel. Use nextCursor and nextAfter to read subsequent pages. Connector-backed deployments may require a Team; inspect connector_teams before creating a Flow.";
12159
+ var mcpInstructions = "Use flow_list, flow_read and flow_search to inspect root workflows. Read node type schemas with flow_schema. Use flow_edit with the observed baseRevision and a stable requestId. Node edits affect only the selected node. Text edits require exactly one match. Execution edges and input sources are independent. Legacy Subflow content is unsupported. Edits can save incomplete drafts; inspect returned diagnostics and use flow_check before running. Use flow_check before flow_run. Select an explicit Trigger node ID and fixed revision or publication. A new Flow has no Trigger until you add one. Before adding a Feishu Trigger, use event_source_list and compare its Connection IDs with connector_connections in the Flow scope. If no source is available, create and verify one in Workbench. Use flow_publish to publish a fixed Revision, then poll flow_publish_status until succeeded or failed. Use flow_set_enabled to enable or disable the observed Live publication. flow_run returns an accepted Run, not its final result. Find Runs with run_list, poll run_get and use run_result after terminal. Resolve a waiting Run only with an explicit run_resolve_wait action allowed by run_get. Use run_results and run_result_read to inspect stored Agent tool results; these are separate from the terminal Run result. Retry flow_edit with identical arguments and the same requestId. Retry flow_create, flow_publish and flow_run only with identical arguments and the same idempotencyKey; a new key can execute the Flow again. Other mutations use the same resource identity and arguments when retrying. Cancel a Run explicitly with run_cancel. Use nextCursor and nextAfter to read subsequent pages. Connector-backed deployments may require a Team; inspect connector_teams before creating a Flow.";
11773
12160
  function tool(description, schema, readOnly) {
11774
12161
  return {
11775
12162
  description,
@@ -11801,31 +12188,16 @@ var mcpTools = {
11801
12188
  cursor: id.optional(),
11802
12189
  limit: pageLimit
11803
12190
  }), true),
11804
- flow_get: tool("Read a compact Draft graph with input bindings, port handles and Live status. Use full=true for complete Revision content, schemas, source code and exact before values required by complex edits. Unreadable Drafts return draft=null and draftIssue; flow.live still identifies the published version. Use draft.revisionId as the base of an edit.", strictObject({
11805
- flowId: flow,
11806
- full: boolean().optional()
11807
- }), true),
11808
- flow_node_get: tool("Read one node and its Task definition or code module from a fixed Revision. Use revisionId from flow_get; the returned node contains exact before values for edits.", strictObject({
11809
- flowId: flow,
11810
- revisionId: id,
11811
- nodeId: id
11812
- }), true),
11813
- flow_schema: tool("Get an operation schema by kind, or a complete apply batch by example (connector, poll, poll-notification, code, wait). Use example=index to list examples. graph.trigger.create resolves a provider key into a fixed definition at commit.", strictObject({
11814
- kind: id.optional(),
11815
- example: id.optional()
11816
- }).refine((value) => value.kind == null || value.example == null, "Choose kind or example, not both."), true),
12191
+ flow_read: tool("Read an outline, selected node details, or a bounded code/prompt excerpt. Carry the returned revision into subsequent reads and edits.", authoringReadSchema.safeExtend({ flowId: flow }).meta({ ...authoringReadSchema.meta() }), true),
12192
+ flow_search: tool("Find nodes by name, configuration or source text in a fixed Revision. Follow nextOffset for more matches.", authoringSearchSchema.extend({ flowId: flow }), true),
12193
+ flow_schema: tool("Read node configuration schemas and the edit grammar, or an Action contract. Action lookup requires a flowId.", authoringSchemaQuery.safeExtend({ flowId: flow.optional() }), true),
11817
12194
  flow_create: tool("Create an empty Flow. If this deployment uses OOMOL Connector, choose a teamId from connector_teams. Keep the key and arguments stable when retrying.", strictObject({
11818
12195
  name: id.refine((name) => name == name.trim() && resourceNameIssue(name) == null, "Flow name is invalid."),
11819
12196
  idempotencyKey: mutationKey,
11820
12197
  teamId: id.optional()
11821
12198
  }), false),
11822
- flow_apply: tool("Apply ordered atomic changes. Read flow_schema first. A stale expectedRevisionId is a conflict; reread the Draft before deciding on a new edit.", strictObject({
11823
- flowId: flow,
11824
- expectedRevisionId: id,
11825
- idempotencyKey: mutationKey,
11826
- operations: array(json).min(1).describe("Change operations defined by flow_schema. Explicit IDs and before values refer to the base Revision.")
11827
- }), false),
11828
- flow_check: tool("Validate a fixed Revision and return diagnostics. Get its revisionId from flow_get or flow_apply.", strictObject({
12199
+ flow_edit: tool("Atomically edit root nodes, input sources, execution edges and text. Use $alias for preceding creations. Preserve baseRevision and requestId when retrying. A saved draft may have validation diagnostics.", authoringRequestSchema.extend({ flowId: flow }), false),
12200
+ flow_check: tool("Validate a fixed Revision and return diagnostics. Use the revision returned by flow_read or flow_edit as revisionId.", strictObject({
11829
12201
  flowId: flow,
11830
12202
  revisionId: id
11831
12203
  }), true),
@@ -11839,7 +12211,7 @@ var mcpTools = {
11839
12211
  flowId: flow,
11840
12212
  operationId: id
11841
12213
  }), true),
11842
- flow_set_enabled: tool("Enable or disable a published Flow. Supply expectedPublicationId from flow_get; a changed Live publication is a conflict. This does not cancel accepted Runs; use run_cancel for those.", strictObject({
12214
+ flow_set_enabled: tool("Enable or disable a published Flow. Supply expectedPublicationId from flow_list; a changed Live publication is a conflict. This does not cancel accepted Runs; use run_cancel for those.", strictObject({
11843
12215
  flowId: flow,
11844
12216
  expectedPublicationId: id,
11845
12217
  enabled: boolean()
@@ -11934,7 +12306,7 @@ var mcpTools = {
11934
12306
  flowId: flow.optional()
11935
12307
  }), true),
11936
12308
  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),
11937
- trigger_search: tool("Search provider Trigger summaries; omit query to list all. Flow trigger instances are in flow_get. Manual, Webhook and Cron are built-in node kinds described by flow_schema.", strictObject({ query: string$1().trim().min(1).max(256).optional() }), true),
12309
+ 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),
11938
12310
  trigger_get: tool("Read a provider Trigger definition before creating its node.", strictObject({ key: id }), true)
11939
12311
  };
11940
12312
  //#endregion