@oomol-lab/open-flow 0.1.0-beta.55 → 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 (51) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/{createResourceDialog-4H5_lZ6s.js → createResourceDialog-C23SBjYd.js} +2 -2
  3. package/dist/browser/flow-authoring-edge.d.ts +3 -3
  4. package/dist/browser/flow-authoring-node.d.ts +30 -46
  5. package/dist/browser/flow-authoring.js +9215 -21030
  6. package/dist/browser/flow-change-schema.d.ts +267 -1
  7. package/dist/browser/flow-change.d.ts +19 -104
  8. package/dist/browser/flow-change.js +154 -298
  9. package/dist/browser/{flowChanges-ZzG-f9cg.js → flowChanges-fBiAeTzR.js} +2347 -2216
  10. package/dist/browser/{flowWorkspace-ChpRaTMX.js → flowWorkspace-MqcEfg7T.js} +118 -293
  11. package/dist/browser/{icons-CdAB9wyS.js → icons-6oQ8Q9Wm.js} +4309 -4454
  12. package/dist/browser/lib-DrKav3HG.js +11403 -0
  13. package/dist/browser/preview.css +1 -1
  14. package/dist/browser/preview.js +9609 -9548
  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 +227 -417
  20. package/dist/browser/{workbenchSelect-BRZN4ish.js → workbenchSelect-DpLbIr29.js} +1 -1
  21. package/dist/common/authoring.d.ts +207 -0
  22. package/dist/common/authoringSchema.d.ts +1293 -0
  23. package/dist/common/control-api-conformance.js +1060 -623
  24. package/dist/common/control-api-errors.d.ts +2 -1
  25. package/dist/common/control-api.d.ts +87 -6
  26. package/dist/common/control-api.js +1058 -705
  27. package/dist/common/control-requests.d.ts +128 -0
  28. package/dist/common/control-requests.js +2913 -1145
  29. package/dist/common/decision.js +6337 -6371
  30. package/dist/common/flow-agent.d.ts +1 -1
  31. package/dist/common/flow-connectionUsage.d.ts +1 -2
  32. package/dist/common/flow-encoding.d.ts +2 -4
  33. package/dist/common/flow-encoding.js +131 -182
  34. package/dist/common/flow-graph.d.ts +10 -10
  35. package/dist/common/flow-semantics.d.ts +13 -9
  36. package/dist/common/flow-semantics.js +9051 -9232
  37. package/dist/common/flowInspection.d.ts +3 -21
  38. package/dist/common/integration-trigger.js +8653 -8687
  39. package/dist/common/lib-DrKav3HG.js +11403 -0
  40. package/dist/common/mcp.d.ts +120 -12
  41. package/dist/common/mcp.js +537 -188
  42. package/dist/common/openapi.js +6337 -6371
  43. package/dist/common/poll-trigger.js +8653 -8687
  44. package/dist/common/run-events.js +0 -1
  45. package/dist/common/scheduler.d.ts +3 -9
  46. package/dist/common/scheduler.js +128 -209
  47. package/dist/common/webhook-trigger.js +6337 -6371
  48. package/package.json +7 -1
  49. package/skills/open-flow/SKILL.md +32 -0
  50. package/skills/open-flow/references/flow-authoring.md +356 -0
  51. package/skills/open-flow/references/flow-n8n-conversion.md +196 -0
@@ -22,129 +22,6 @@ function dequal(foo, bar) {
22
22
  return foo !== foo && bar !== bar;
23
23
  }
24
24
  //#endregion
25
- //#region src/control/common/providerIconSprite.ts
26
- /** Optional artwork must never make an otherwise usable catalog unavailable. */
27
- function providerIconAppearance(metadata, position) {
28
- if (!metadata || typeof metadata != "object" || !position || typeof position != "object") return {};
29
- const m = metadata;
30
- const p = position;
31
- if (typeof m.version != "string" || ![
32
- m.pixelRatio,
33
- m.iconSize,
34
- m.width,
35
- m.height
36
- ].every((v) => Number.isInteger(v) && v > 0) || ![
37
- m.bleed,
38
- p.x,
39
- p.y
40
- ].every((v) => Number.isInteger(v) && v >= 0) || p.x + m.iconSize > m.width || p.y + m.iconSize > m.height) return {};
41
- try {
42
- for (const url of [m.lightUrl, m.darkUrl]) if (typeof url != "string" || ![
43
- "https:",
44
- "http:",
45
- "data:"
46
- ].includes(new URL(url).protocol)) return {};
47
- } catch {
48
- return {};
49
- }
50
- return {
51
- iconSprite: m,
52
- iconSpritePosition: {
53
- x: p.x,
54
- y: p.y
55
- }
56
- };
57
- }
58
- //#endregion
59
- //#region src/control/common/errors.ts
60
- var controlErrorCode = {
61
- authenticationRequired: "authentication.required",
62
- authorizationDenied: "authorization.denied",
63
- bindingUnresolved: "binding.unresolved",
64
- connectorActionNotFound: "connector.action-not-found",
65
- connectorAccessConflict: "connector.access-conflict",
66
- connectorAccessInvalid: "connector.access-invalid",
67
- connectorAccessRequired: "connector.access-required",
68
- connectorAccessUnsupported: "connector.access-unsupported",
69
- connectorUnconfigured: "connector.unconfigured",
70
- connectorUnavailable: "connector.unavailable",
71
- connectorConsoleUnconfigured: "connector.console-unconfigured",
72
- engineUnavailable: "engine.unavailable",
73
- engineUnsupported: "engine.unsupported",
74
- eventSourceInvalid: "event-source.invalid",
75
- eventSourceIdentityUnavailable: "event-source.identity-unavailable",
76
- eventSourceNotFound: "event-source.not-found",
77
- eventSourceConflict: "event-source.conflict",
78
- flowInvalid: "flow.invalid",
79
- flowRepairRequired: "flow.repair-required",
80
- flowUpgradeRequired: "flow.upgrade-required",
81
- flowNotFound: "flow.not-found",
82
- flowBusy: "flow.busy",
83
- flowConflict: "flow.conflict",
84
- flowPresentationConflict: "flow.presentation-conflict",
85
- flowRevisionConflict: "flow.revision-conflict",
86
- liveConflict: "live.conflict",
87
- liveNotFound: "live.not-found",
88
- pageInvalidCursor: "page.invalid-cursor",
89
- publicationConflict: "publication.conflict",
90
- publicationNotFound: "publication.not-found",
91
- publicationUnsupported: "publication.unsupported",
92
- publishOperationNotFound: "publication.operation-not-found",
93
- routeNotFound: "route.not-found",
94
- runConflict: "run.conflict",
95
- runEventsExpired: "run.events-expired",
96
- runInvalid: "run.invalid",
97
- runNotFound: "run.not-found",
98
- runNotTerminal: "run.not-terminal",
99
- runOverloaded: "run.overloaded",
100
- runWaitNotFound: "run.wait-not-found",
101
- triggerKeyInvalid: "trigger-key.invalid",
102
- triggerKeyNotFound: "trigger-key.not-found",
103
- triggerNotFound: "trigger.not-found",
104
- variableInvalid: "variable.invalid",
105
- variableLimitReached: "variable.limit-reached",
106
- variableNotFound: "variable.not-found"
107
- };
108
- 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;
109
- var ApiError = class extends Error {
110
- constructor(status, code, message) {
111
- super(message);
112
- this.code = code;
113
- this.name = "ApiError";
114
- this.status = status;
115
- }
116
- };
117
- //#endregion
118
- //#region src/control/common/decoding.ts
119
- function invalidResponse() {
120
- throw new ApiError(502, "response.invalid", "The Control API returned an invalid response.");
121
- }
122
- function record$2(value) {
123
- if (value == null || typeof value != "object" || Array.isArray(value)) return invalidResponse();
124
- return value;
125
- }
126
- function string$1(value) {
127
- return typeof value == "string" && value.length > 0 ? value : invalidResponse();
128
- }
129
- function exact(value, keys) {
130
- const actual = Object.keys(value);
131
- if (actual.length != keys.length || actual.some((key) => !keys.includes(key))) invalidResponse();
132
- }
133
- function integer$1(value) {
134
- return Number.isSafeInteger(value) ? value : invalidResponse();
135
- }
136
- function jsonValue(value) {
137
- if (value === null || typeof value == "boolean" || typeof value == "string") return value;
138
- if (typeof value == "number" && Number.isFinite(value)) return value;
139
- if (Array.isArray(value)) return value.map(jsonValue);
140
- const source = record$2(value);
141
- return Object.fromEntries(Object.entries(source).map(([key, item]) => [key, jsonValue(item)]));
142
- }
143
- function optionalString(value) {
144
- if (value == null) return;
145
- return string$1(value);
146
- }
147
- //#endregion
148
25
  //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/util.js
149
26
  function getEnumValues(entries) {
150
27
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
@@ -1177,7 +1054,7 @@ function datetime(args) {
1177
1054
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
1178
1055
  }
1179
1056
  var anyString = /^[\s\S]{0,}$/;
1180
- var integer = /^-?\d+$/;
1057
+ var integer$1 = /^-?\d+$/;
1181
1058
  var number$1 = /^-?\d+(?:\.\d+)?$/;
1182
1059
  var boolean$1 = /^(?:true|false)$/i;
1183
1060
  var _null$2 = /^null$/i;
@@ -2927,6 +2804,9 @@ function handlePipeResult(left, next, ctx) {
2927
2804
  issues: left.issues
2928
2805
  }, ctx);
2929
2806
  }
2807
+ var $ZodPreprocess = /*@__PURE__*/ $constructor("$ZodPreprocess", (inst, def) => {
2808
+ $ZodPipe.init(inst, def);
2809
+ });
2930
2810
  var $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2931
2811
  $ZodType.init(inst, def);
2932
2812
  defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
@@ -4661,7 +4541,7 @@ function stringifyKeyNames(bySchema, json, visited) {
4661
4541
  else if (typeof rest.const === "number") rest.const = String(rest.const);
4662
4542
  if (!numericType) return rest;
4663
4543
  rest.type = "string";
4664
- if (!values) rest.pattern = (types.includes("number") ? number$1 : integer).source;
4544
+ if (!values) rest.pattern = (types.includes("number") ? number$1 : integer$1).source;
4665
4545
  return rest;
4666
4546
  }
4667
4547
  /** Every record of one conversion, so the carriers are found in a single pass rather than once per record. */
@@ -5194,7 +5074,7 @@ var ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
5194
5074
  return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
5195
5075
  }
5196
5076
  });
5197
- function string(params) {
5077
+ function string$1(params) {
5198
5078
  return /* @__PURE__ */ _string(ZodString, params);
5199
5079
  }
5200
5080
  var ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => {
@@ -5542,10 +5422,10 @@ var ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
5542
5422
  inst.keyType = def.keyType;
5543
5423
  inst.valueType = def.valueType;
5544
5424
  });
5545
- function record$1(keyType, valueType, params) {
5425
+ function record$3(keyType, valueType, params) {
5546
5426
  if (!valueType || !valueType._zod) return new ZodRecord({
5547
5427
  type: "record",
5548
- keyType: string(),
5428
+ keyType: string$1(),
5549
5429
  valueType: keyType,
5550
5430
  ...normalizeParams(valueType)
5551
5431
  });
@@ -5751,6 +5631,10 @@ function pipe(in_, out) {
5751
5631
  out
5752
5632
  });
5753
5633
  }
5634
+ var ZodPreprocess = /*@__PURE__*/ $constructor("ZodPreprocess", (inst, def) => {
5635
+ ZodPipe.init(inst, def);
5636
+ $ZodPreprocess.init(inst, def);
5637
+ });
5754
5638
  var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
5755
5639
  $ZodReadonly.init(inst, def);
5756
5640
  ZodType.init(inst, def);
@@ -5786,29 +5670,59 @@ function refine(fn, _params = {}) {
5786
5670
  function superRefine(fn, params) {
5787
5671
  return /* @__PURE__ */ _superRefine(fn, params);
5788
5672
  }
5789
- function json$3(params) {
5673
+ function json$4(params) {
5790
5674
  const jsonSchema = lazy(() => {
5791
5675
  return union([
5792
- string(params),
5676
+ string$1(params),
5793
5677
  number(),
5794
5678
  boolean(),
5795
5679
  _null(),
5796
5680
  array(jsonSchema),
5797
- record$1(string(), jsonSchema)
5681
+ record$3(string$1(), jsonSchema)
5798
5682
  ]);
5799
5683
  });
5800
5684
  return jsonSchema;
5801
5685
  }
5686
+ function preprocess(fn, schema) {
5687
+ return new ZodPreprocess({
5688
+ type: "pipe",
5689
+ in: transform(fn),
5690
+ out: schema
5691
+ });
5692
+ }
5802
5693
  //#endregion
5803
5694
  //#region src/openapi/common/authBindings.ts
5804
5695
  /** Never allow credentials to enter a Revision as literal node inputs. */
5805
5696
  function assertOpenApiAuthBindings(document) {
5806
- for (const graph of [document.graph, ...Object.values(document.subflows).map((subflow) => subflow.graph)]) for (const node of Object.values(graph.nodes)) {
5807
- if (node.kind != "task" || node.taskId == null || document.tasks[node.taskId]?.executor.kind != "openapi") continue;
5808
- for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && (mapping.kind == "value" || mapping.kind == "sources" && mapping.sources.some((source) => source.kind == "flow"))) throw new TypeError("OpenAPI authentication accepts deployment variables and upstream outputs only.");
5697
+ for (const node of Object.values(document.graph.nodes)) {
5698
+ if (node.kind != "task" || !("executor" in node.task) || node.task.executor.kind != "openapi") continue;
5699
+ for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("OpenAPI authentication accepts deployment variables and upstream outputs only.");
5809
5700
  }
5810
5701
  }
5811
5702
  //#endregion
5703
+ //#region src/flow/common/change.ts
5704
+ var schemaKeywords = /* @__PURE__ */ new Set([
5705
+ "const",
5706
+ "enum",
5707
+ "exclusiveMaximum",
5708
+ "exclusiveMinimum",
5709
+ "maximum",
5710
+ "maxItems",
5711
+ "maxLength",
5712
+ "maxProperties",
5713
+ "minimum",
5714
+ "minItems",
5715
+ "minLength",
5716
+ "minProperties",
5717
+ "multipleOf",
5718
+ "pattern",
5719
+ "required",
5720
+ "type"
5721
+ ]);
5722
+ function isSchemaKeyword(value) {
5723
+ return schemaKeywords.has(value);
5724
+ }
5725
+ //#endregion
5812
5726
  //#region src/json-schema-subset/utils.ts
5813
5727
  var nextId = 0;
5814
5728
  function createId() {
@@ -6228,7 +6142,7 @@ var ExpressionKind = Object.freeze({
6228
6142
  });
6229
6143
  //#endregion
6230
6144
  //#region src/json-schema-subset/expression/expression.ts
6231
- var expression = (delegate) => (e1, e2) => {
6145
+ var expression$1 = (delegate) => (e1, e2) => {
6232
6146
  const rootNode = {
6233
6147
  parent: null,
6234
6148
  swapped: false,
@@ -8216,7 +8130,7 @@ function checkWithResult(extendsContext, schema1, schema2) {
8216
8130
  const describe = describer();
8217
8131
  const equals = schemaEqualsChecker(extendsContext);
8218
8132
  context.isEquals = wrapEqualsCheckerWithCache(isDeepEquals);
8219
- context.calculate = expression({
8133
+ context.calculate = expression$1({
8220
8134
  describe,
8221
8135
  equals,
8222
8136
  calculate,
@@ -8455,7 +8369,7 @@ var isObject = (x) => x !== null && typeof x === "object";
8455
8369
  var isPlainObject = (x) => isObject(x) && !isArray(x);
8456
8370
  var toPlainObject = (x) => isPlainObject(x) ? x : void 0;
8457
8371
  //#endregion
8458
- //#region src/manifest/common/schemaComparer.ts
8372
+ //#region src/flow/common/schemaComparer.ts
8459
8373
  function isStringLikeSchema(value) {
8460
8374
  return toPlainObject(value)?.type === "string";
8461
8375
  }
@@ -8662,8 +8576,8 @@ function checkJsonDepth(value, depth = 0) {
8662
8576
  //#region src/flow/common/triggerScheduleSchema.ts
8663
8577
  var triggerScheduleSchema = array(union([object({
8664
8578
  type: literal("cron"),
8665
- expression: string(),
8666
- timezone: string()
8579
+ expression: string$1(),
8580
+ timezone: string$1()
8667
8581
  }), object({
8668
8582
  type: literal("every"),
8669
8583
  unit: _enum([
@@ -8684,47 +8598,38 @@ var webhookMethods = [
8684
8598
  "PATCH",
8685
8599
  "DELETE"
8686
8600
  ];
8687
- var text = string();
8688
- var json$2 = json$3();
8689
- var strings = array(text);
8601
+ var text = string$1();
8602
+ var json$3 = json$4();
8603
+ var strings$1 = array(text);
8690
8604
  var port$1 = object({
8691
8605
  description: text.optional(),
8692
- jsonSchema: json$2,
8606
+ jsonSchema: json$3,
8693
8607
  nullable: boolean(),
8694
8608
  handle: text
8695
8609
  });
8696
- var input = port$1.extend({ value: json$2.optional() });
8610
+ var input = port$1.extend({ value: json$3.optional() });
8697
8611
  var group = object({
8698
8612
  collapsed: boolean().optional(),
8699
8613
  group: text
8700
8614
  });
8701
- var nodeSource = object({
8615
+ var source = union([object({
8702
8616
  kind: literal("node"),
8703
8617
  nodeId: text,
8704
8618
  output: text,
8705
8619
  field: text.optional()
8706
- });
8707
- var flowSource = object({
8708
- kind: literal("flow"),
8709
- input: text
8710
- });
8711
- var source = union([
8712
- nodeSource,
8713
- flowSource,
8714
- object({
8715
- kind: literal("binding"),
8716
- bindingId: text
8717
- })
8718
- ]);
8620
+ }), object({
8621
+ kind: literal("binding"),
8622
+ bindingId: text
8623
+ })]);
8719
8624
  var fixedInput = union([object({ kind: literal("unset") }), object({
8720
8625
  kind: literal("value"),
8721
- value: json$2
8626
+ value: json$3
8722
8627
  })]);
8723
8628
  var mapping = union([fixedInput, object({
8724
8629
  kind: literal("sources"),
8725
8630
  sources: array(source)
8726
8631
  })]);
8727
- var inputs = record$1(text, mapping);
8632
+ var inputs = record$3(text, mapping);
8728
8633
  var ports$1 = {
8729
8634
  inputs: array(union([input, group])),
8730
8635
  outputs: array(union([port$1, group]))
@@ -8769,7 +8674,7 @@ var inline = object({
8769
8674
  });
8770
8675
  var agentValue = union([object({
8771
8676
  kind: literal("value"),
8772
- value: json$2
8677
+ value: json$3
8773
8678
  }), object({
8774
8679
  kind: literal("input"),
8775
8680
  input: text
@@ -8798,10 +8703,10 @@ var decisionQuestion = discriminatedUnion("type", [
8798
8703
  name: text,
8799
8704
  instructions: text,
8800
8705
  type: literal("score"),
8801
- criteria: strings
8706
+ criteria: strings$1
8802
8707
  })
8803
8708
  ]);
8804
- var managed = object({
8709
+ var managedFields = object({
8805
8710
  ...ports$1,
8806
8711
  name: text,
8807
8712
  executor: union([
@@ -8816,7 +8721,7 @@ var managed = object({
8816
8721
  method: text,
8817
8722
  path: text,
8818
8723
  serverUrl: text,
8819
- document: json$2,
8724
+ document: json$3,
8820
8725
  auth: array(object({
8821
8726
  id: text,
8822
8727
  type: _enum([
@@ -8852,17 +8757,20 @@ var managed = object({
8852
8757
  inputs: array(input.extend({ source: agentInput }))
8853
8758
  })),
8854
8759
  notification: object({
8855
- taskId: text,
8760
+ action: text,
8761
+ connectionId: text.optional(),
8762
+ inputDefinitions: array(input),
8856
8763
  messageHandle: text,
8857
- inputs: record$1(text, agentValue)
8764
+ inputs: record$3(text, agentValue)
8858
8765
  }).optional()
8859
8766
  })
8860
8767
  ])
8861
- }).transform(limitDecisionTask);
8862
- var operand = union([object({
8768
+ });
8769
+ var managed = managedFields.transform(limitDecisionTask);
8770
+ var operand$1 = union([object({
8863
8771
  kind: literal("value"),
8864
- value: json$2.optional(),
8865
- jsonSchema: json$2.optional()
8772
+ value: json$3.optional(),
8773
+ jsonSchema: json$3.optional()
8866
8774
  }), object({
8867
8775
  kind: literal("source"),
8868
8776
  source
@@ -8873,7 +8781,7 @@ var condition = {
8873
8781
  description: text.optional(),
8874
8782
  output: text,
8875
8783
  groups: array(object({ expressions: array(object({
8876
- left: operand,
8784
+ left: operand$1,
8877
8785
  operator: _enum([
8878
8786
  "!=",
8879
8787
  "<",
@@ -8896,7 +8804,7 @@ var condition = {
8896
8804
  "notHasValue",
8897
8805
  "startsWith"
8898
8806
  ]),
8899
- right: operand.optional()
8807
+ right: operand$1.optional()
8900
8808
  })) }))
8901
8809
  }))
8902
8810
  };
@@ -8906,10 +8814,10 @@ var wait = {
8906
8814
  };
8907
8815
  var webhookOptions = object({
8908
8816
  allowedMethods: never().optional(),
8909
- allowedOrigins: strings.optional(),
8817
+ allowedOrigins: strings$1.optional(),
8910
8818
  noResponseBody: never().optional(),
8911
8819
  responseData: text.optional(),
8912
- responseHeaders: record$1(text, text).optional(),
8820
+ responseHeaders: record$3(text, text).optional(),
8913
8821
  responseStatusCode: number().int().min(200).max(599).optional()
8914
8822
  });
8915
8823
  var webhook = {
@@ -8965,7 +8873,7 @@ var base = {
8965
8873
  var node = union([
8966
8874
  object({
8967
8875
  ...base,
8968
- inputs: record$1(text, never()),
8876
+ inputs: record$3(text, never()),
8969
8877
  kind: literal("condition"),
8970
8878
  ...condition
8971
8879
  }),
@@ -8975,21 +8883,10 @@ var node = union([
8975
8883
  kind: literal("value"),
8976
8884
  values: array(input)
8977
8885
  }),
8978
- object({
8979
- ...base,
8980
- kind: literal("subflow"),
8981
- subflowId: text
8982
- }),
8983
- object({
8984
- ...base,
8985
- kind: literal("task"),
8986
- task: inline,
8987
- additionalInputs: array(input).optional()
8988
- }),
8989
8886
  object({
8990
8887
  ...base,
8991
8888
  kind: literal("task"),
8992
- taskId: text,
8889
+ task: union([inline, managed]),
8993
8890
  additionalInputs: array(input).optional()
8994
8891
  }),
8995
8892
  strictObject({
@@ -9025,7 +8922,7 @@ var node = union([
9025
8922
  ...trigger,
9026
8923
  kind: literal("poll"),
9027
8924
  connectionId: text.min(1).optional(),
9028
- config: record$1(text, fixedInput),
8925
+ config: record$3(text, fixedInput),
9029
8926
  definition: object({
9030
8927
  ...definition,
9031
8928
  type: literal("poll")
@@ -9036,7 +8933,7 @@ var node = union([
9036
8933
  ...trigger,
9037
8934
  kind: literal("integration"),
9038
8935
  connectionId: text.min(1).optional(),
9039
- config: record$1(text, fixedInput),
8936
+ config: record$3(text, fixedInput),
9040
8937
  definition: object({
9041
8938
  ...definition,
9042
8939
  type: literal("integration"),
@@ -9044,10 +8941,25 @@ var node = union([
9044
8941
  })
9045
8942
  })
9046
8943
  ]);
9047
- var target = union([object({ kind: literal("flow") }), object({
9048
- kind: literal("subflow"),
9049
- id: text
9050
- })]);
8944
+ /** Configuration schemas shared by the node authoring boundary. */
8945
+ var authoringDefinitionSchemas = {
8946
+ input,
8947
+ port: port$1,
8948
+ ports: ports$1,
8949
+ condition: strictObject(condition),
8950
+ wait: strictObject(wait),
8951
+ webhook: strictObject(webhook),
8952
+ schedule: triggerScheduleSchema,
8953
+ capabilities: array(capability),
8954
+ connector: managedFields.shape.executor.options[0].omit({ kind: true }).strict(),
8955
+ openapi: managedFields.shape.executor.options[1].omit({ kind: true }).strict(),
8956
+ decision: managedFields.shape.executor.options[2].omit({ kind: true }).strict(),
8957
+ llm: managedFields.shape.executor.options[3].omit({ kind: true }).strict(),
8958
+ agent: managedFields.shape.executor.options[4].omit({
8959
+ kind: true,
8960
+ notification: true
8961
+ }).strict()
8962
+ };
9051
8963
  var edge = object({
9052
8964
  source: text,
9053
8965
  target: text,
@@ -9055,15 +8967,10 @@ var edge = object({
9055
8967
  });
9056
8968
  var at = {
9057
8969
  nodeId: text,
9058
- target
8970
+ target: never().optional()
9059
8971
  };
9060
- var subflow = object({
9061
- name: text,
9062
- inputs: array(input),
9063
- outputs: array(port$1.extend({ sources: array(union([nodeSource, flowSource])) }))
9064
- });
9065
8972
  var graph = object({
9066
- nodes: record$1(text, node),
8973
+ nodes: record$3(text, node),
9067
8974
  edges: array(edge).default([])
9068
8975
  });
9069
8976
  var binding = object({
@@ -9072,32 +8979,43 @@ var binding = object({
9072
8979
  });
9073
8980
  var module = object({
9074
8981
  name: text,
9075
- imports: strings,
8982
+ imports: strings$1,
9076
8983
  source: text
9077
8984
  });
9078
- var document = object({
9079
- bindings: record$1(text, binding),
9080
- graph,
9081
- subflows: record$1(text, subflow.extend({ graph })),
9082
- tasks: record$1(text, managed)
9083
- });
8985
+ var document = preprocess(rejectRetiredDefinitions, object({
8986
+ bindings: record$3(text, binding),
8987
+ graph
8988
+ }));
9084
8989
  var revision = object({
9085
8990
  modelVersion: union([
9086
8991
  literal(2),
9087
8992
  literal(4),
9088
- literal(5)
8993
+ literal(5),
8994
+ literal(6)
9089
8995
  ]),
9090
8996
  document,
9091
- modules: record$1(text, module)
8997
+ modules: record$3(text, module)
9092
8998
  });
9093
8999
  revision.extend({
9094
9000
  kind: literal("open-flow-flow-revision"),
9095
9001
  version: literal(1)
9096
9002
  });
9003
+ function rejectRetiredDefinitions(value) {
9004
+ const candidate = record$2(value);
9005
+ 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.");
9006
+ if (Object.values(record$2(record$2(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record$2(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
9007
+ const subflows = candidate.subflows;
9008
+ 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.");
9009
+ if (Object.values(record$2(record$2(candidate.graph).nodes)).some((candidateNode) => record$2(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
9010
+ return value;
9011
+ }
9012
+ function record$2(value) {
9013
+ return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
9014
+ }
9097
9015
  function decodeRevisionContent(value) {
9098
9016
  checkJsonDepth(value);
9099
9017
  const content = revision.parse(value);
9100
- checkErrorModelVersion(content);
9018
+ checkModelVersion(content);
9101
9019
  assertOpenApiAuthBindings(content.document);
9102
9020
  return content;
9103
9021
  }
@@ -9118,17 +9036,22 @@ var shapes = {
9118
9036
  value: text
9119
9037
  },
9120
9038
  "graph.edge.connect": {
9121
- target,
9122
- edge
9039
+ edge,
9040
+ target: never().optional()
9123
9041
  },
9124
9042
  "graph.edge.disconnect": {
9125
- target,
9126
- edge
9043
+ edge,
9044
+ target: never().optional()
9127
9045
  },
9128
9046
  "graph.node.create": {
9129
9047
  ...at,
9130
9048
  node
9131
9049
  },
9050
+ "graph.node.replace": {
9051
+ ...at,
9052
+ before: node,
9053
+ node
9054
+ },
9132
9055
  "graph.node.delete": at,
9133
9056
  "graph.node.field.set": union([
9134
9057
  object({
@@ -9187,13 +9110,11 @@ var shapes = {
9187
9110
  },
9188
9111
  "graph.node.resolution.set": {
9189
9112
  ...at,
9190
- target: object({ kind: literal("flow") }),
9191
9113
  before: object(wait),
9192
9114
  value: object(wait)
9193
9115
  },
9194
9116
  "graph.node.webhook.set": {
9195
9117
  ...at,
9196
- target: object({ kind: literal("flow") }),
9197
9118
  before: object(webhook),
9198
9119
  value: object(webhook)
9199
9120
  },
@@ -9235,93 +9156,457 @@ var shapes = {
9235
9156
  },
9236
9157
  "module.source.replace": {
9237
9158
  moduleId: text,
9238
- beforeImports: strings,
9159
+ beforeImports: strings$1,
9239
9160
  beforeSource: text,
9240
- imports: strings,
9161
+ imports: strings$1,
9241
9162
  source: text
9242
9163
  },
9243
- "subflow.create": {
9244
- subflowId: text,
9245
- subflow: subflow.extend({ graph })
9246
- },
9247
- "subflow.definition.set": {
9248
- subflowId: text,
9249
- before: subflow,
9250
- definition: subflow
9251
- },
9252
- "subflow.delete": { subflowId: text },
9253
- "task.create": {
9254
- taskId: text,
9255
- task: managed
9256
- },
9257
- "task.delete": { taskId: text },
9258
- "task.connector.connection.set": {
9259
- taskId: text,
9260
- before: text.optional(),
9261
- value: text.optional()
9262
- },
9263
- "task.decision.set": {
9264
- taskId: text,
9265
- before: managed,
9266
- value: managed
9267
- },
9268
- "task.openapi.set": {
9269
- taskId: text,
9270
- before: managed,
9271
- value: managed
9272
- },
9273
- "task.agent.set": {
9274
- taskId: text,
9275
- before: managed,
9276
- value: managed
9277
- },
9278
- "task.llm.mode.set": {
9279
- taskId: text,
9280
- before: _enum(["chat", "json"]),
9281
- value: _enum(["chat", "json"])
9282
- },
9283
- "task.name.set": {
9284
- taskId: text,
9285
- before: text,
9286
- value: text
9164
+ "graph.node.task.set": {
9165
+ ...at,
9166
+ before: union([inline, managed]),
9167
+ value: union([inline, managed])
9287
9168
  }
9288
9169
  };
9289
9170
  array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, shape instanceof ZodType ? shape : object({
9290
9171
  kind: literal(kind),
9291
9172
  ...shape
9292
9173
  })])).values()])).min(1);
9293
- function checkErrorModelVersion(content) {
9294
- if (content.modelVersion < 5 && [content.document.graph, ...Object.values(content.document.subflows).map((item) => item.graph)].some((item) => Object.values(item.nodes).some((itemNode) => itemNode.kind == "error"))) throw new TypeError("Error workflows require Flow model version 5.");
9174
+ function checkModelVersion(content) {
9175
+ 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.");
9176
+ 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.");
9295
9177
  }
9296
9178
  //#endregion
9297
- //#region src/flow/common/change.ts
9298
- var schemaKeywords = /* @__PURE__ */ new Set([
9299
- "const",
9300
- "enum",
9301
- "exclusiveMaximum",
9302
- "exclusiveMinimum",
9303
- "maximum",
9304
- "maxItems",
9305
- "maxLength",
9306
- "maxProperties",
9307
- "minimum",
9308
- "minItems",
9309
- "minLength",
9310
- "minProperties",
9311
- "multipleOf",
9312
- "pattern",
9313
- "required",
9314
- "type"
9179
+ //#region src/control/common/authoringLlm.ts
9180
+ var authoringLlmConfiguration = strictObject({
9181
+ mode: _enum(["chat", "json"]),
9182
+ resultSchema: json$4(),
9183
+ model: json$4().optional().describe("Default model settings: {model, temperature?, top_p?, max_tokens?}. A bound model input takes precedence."),
9184
+ template: json$4().optional().describe("Default message templates: [{role: \"system\" | \"user\" | \"assistant\", content: \"Text with {{namedInput}}\"}]."),
9185
+ messages: json$4().optional().describe("Default conversation history, prepended without template interpolation; an array of {role, content} or null.")
9186
+ });
9187
+ //#endregion
9188
+ //#region src/control/common/authoringOpenApi.ts
9189
+ var authenticationSchema = union([
9190
+ strictObject({ schemes: array(string$1().min(1)).describe("One complete security alternative advertised by this operation; [] selects no authentication.") }),
9191
+ strictObject({ type: _enum(["bearer", "basic"]) }),
9192
+ strictObject({
9193
+ type: literal("apiKey"),
9194
+ name: string$1().min(1),
9195
+ in: _enum(["header", "query"])
9196
+ })
9315
9197
  ]);
9316
- function isSchemaKeyword(value) {
9317
- return schemaKeywords.has(value);
9198
+ strictObject({
9199
+ sourceUrl: string$1().min(1),
9200
+ path: string$1().min(1),
9201
+ method: string$1().min(1),
9202
+ serverUrl: string$1().optional(),
9203
+ authentication: authenticationSchema.optional().describe("Omit to use the operation default. Bind credentials through the advertised node inputs.")
9204
+ });
9205
+ //#endregion
9206
+ //#region src/control/common/authoringSchema.ts
9207
+ var id$1 = string$1().min(1);
9208
+ var json$2 = json$4();
9209
+ var patch = record$3(id$1, json$2);
9210
+ var type = _enum([
9211
+ "manual",
9212
+ "webhook",
9213
+ "cron",
9214
+ "error",
9215
+ "poll",
9216
+ "integration",
9217
+ "code",
9218
+ "connector",
9219
+ "agent",
9220
+ "llm",
9221
+ "decision",
9222
+ "openapi",
9223
+ "condition",
9224
+ "value",
9225
+ "wait",
9226
+ "approval"
9227
+ ]);
9228
+ var referenceSchema = id$1.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.");
9229
+ var output = strictObject({
9230
+ kind: literal("output"),
9231
+ node: referenceSchema,
9232
+ port: id$1.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),
9233
+ field: string$1().optional()
9234
+ });
9235
+ var variable$1 = strictObject({
9236
+ kind: literal("variable"),
9237
+ name: id$1
9238
+ });
9239
+ var authoringSourceSchema = union([
9240
+ output,
9241
+ variable$1,
9242
+ strictObject({
9243
+ kind: literal("value"),
9244
+ value: json$2
9245
+ }),
9246
+ strictObject({ kind: literal("unset") }),
9247
+ strictObject({ kind: literal("default") }),
9248
+ strictObject({
9249
+ kind: literal("sources"),
9250
+ sources: array(union([output, variable$1])).min(1)
9251
+ })
9252
+ ]);
9253
+ var operand = union([
9254
+ strictObject({
9255
+ kind: literal("value"),
9256
+ value: json$2.optional(),
9257
+ schema: json$2.optional()
9258
+ }),
9259
+ output,
9260
+ variable$1
9261
+ ]);
9262
+ var agentTool = authoringDefinitionSchemas.agent.shape.tools.element.omit({
9263
+ id: true,
9264
+ inputs: true
9265
+ }).extend({ inputs: record$3(id$1, 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();
9266
+ var notification = strictObject({
9267
+ ...authoringDefinitionSchemas.connector.shape,
9268
+ messageHandle: id$1,
9269
+ inputs: record$3(id$1, union([strictObject({
9270
+ kind: literal("value"),
9271
+ value: json$2
9272
+ }), strictObject({
9273
+ kind: literal("input"),
9274
+ input: id$1
9275
+ })]))
9276
+ });
9277
+ var field = strictObject({
9278
+ schema: json$2.optional(),
9279
+ nullable: boolean().optional(),
9280
+ description: string$1().optional()
9281
+ });
9282
+ var inputFields = record$3(id$1, 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.");
9283
+ var outputFields = record$3(id$1, field).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true.");
9284
+ var expression = strictObject({
9285
+ left: operand,
9286
+ operator: authoringDefinitionSchemas.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,
9287
+ right: operand.optional()
9288
+ });
9289
+ var all = strictObject({ all: array(expression) });
9290
+ var when = union([
9291
+ expression,
9292
+ all,
9293
+ strictObject({ any: array(union([expression, all])) })
9294
+ ]);
9295
+ strictObject({}), strictObject({ sourceFlowIds: array(id$1).optional() }), authoringDefinitionSchemas.webhook.omit({ bodyFields: true }).extend({ body: inputFields }).strict(), strictObject({ schedule: authoringDefinitionSchemas.schedule }), strictObject({
9296
+ key: id$1,
9297
+ connectionId: id$1.optional(),
9298
+ schedule: authoringDefinitionSchemas.schedule
9299
+ }), strictObject({
9300
+ key: id$1,
9301
+ connectionId: id$1.optional()
9302
+ }), strictObject({
9303
+ inputs: inputFields,
9304
+ outputs: outputFields,
9305
+ capabilities: authoringDefinitionSchemas.capabilities.optional()
9306
+ }), authoringDefinitionSchemas.connector.strict(), authoringDefinitionSchemas.agent.omit({
9307
+ prompt: true,
9308
+ tools: true
9309
+ }).extend({
9310
+ inputs: inputFields,
9311
+ resultSchema: json$2.describe("JSON schema of the final result. Defaults to text. The tool manages the output definition; references can omit port."),
9312
+ tools: array(agentTool),
9313
+ notification: notification.optional()
9314
+ }).strict(), authoringLlmConfiguration.extend({ inputs: inputFields }), authoringDefinitionSchemas.decision, strictObject({
9315
+ match: _enum(["first", "all"]),
9316
+ branches: array(strictObject({
9317
+ name: id$1,
9318
+ description: string$1().optional(),
9319
+ when
9320
+ }))
9321
+ }), strictObject({
9322
+ values: patch,
9323
+ outputs: outputFields
9324
+ }), strictObject({ inputs: inputFields }), strictObject({ inputs: inputFields });
9325
+ var updates = strictObject({
9326
+ name: id$1.optional(),
9327
+ description: string$1().optional(),
9328
+ icon: string$1().optional(),
9329
+ maxExecutions: int().positive().optional(),
9330
+ timeoutMs: number().nonnegative().optional(),
9331
+ 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\"].")
9332
+ });
9333
+ var authoringEditSchema = discriminatedUnion("op", [
9334
+ strictObject({
9335
+ op: literal("node.add"),
9336
+ as: id$1.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."),
9337
+ type,
9338
+ name: id$1,
9339
+ config: patch.optional(),
9340
+ inputs: record$3(id$1, authoringSourceSchema).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),
9341
+ code: string$1().optional(),
9342
+ prompt: string$1().optional()
9343
+ }),
9344
+ strictObject({
9345
+ op: literal("node.update"),
9346
+ node: referenceSchema,
9347
+ set: updates.optional(),
9348
+ clear: array(array(id$1).min(1)).optional()
9349
+ }),
9350
+ strictObject({
9351
+ op: literal("node.remove"),
9352
+ node: referenceSchema
9353
+ }),
9354
+ strictObject({
9355
+ op: literal("input.set"),
9356
+ node: referenceSchema,
9357
+ input: id$1,
9358
+ source: authoringSourceSchema
9359
+ }),
9360
+ strictObject({
9361
+ op: _enum(["edge.connect", "edge.disconnect"]),
9362
+ source: referenceSchema,
9363
+ target: referenceSchema,
9364
+ branch: id$1.optional()
9365
+ }),
9366
+ strictObject({
9367
+ op: literal("text.edit"),
9368
+ node: referenceSchema,
9369
+ field: _enum(["code", "prompt"]),
9370
+ oldText: id$1,
9371
+ newText: string$1()
9372
+ }),
9373
+ strictObject({
9374
+ op: literal("text.set"),
9375
+ node: referenceSchema,
9376
+ field: _enum(["code", "prompt"]),
9377
+ text: string$1()
9378
+ })
9379
+ ]);
9380
+ strictObject({
9381
+ baseRevision: id$1,
9382
+ requestId: id$1.max(256),
9383
+ edits: array(authoringEditSchema).min(1).max(1e3)
9384
+ });
9385
+ strictObject({
9386
+ revision: id$1.optional().describe("Fixed revision from a previous read; omit to read the current draft."),
9387
+ nodes: array(id$1).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),
9388
+ text: strictObject({
9389
+ node: id$1,
9390
+ field: _enum(["code", "prompt"]),
9391
+ start: int().positive().default(1),
9392
+ lines: int().min(1).max(200).default(80)
9393
+ }).optional().describe("Read code or prompt by line (1-based). Mutually exclusive with nodes. Follow nextStart at the same revision until truncated is false.")
9394
+ }).refine((v) => v.nodes == null || v.text == null, "Choose nodes or text.").meta({
9395
+ not: { required: ["nodes", "text"] },
9396
+ description: "Omit nodes and text for an outline; provide nodes for details, or text for an excerpt."
9397
+ });
9398
+ strictObject({ revisionId: id$1 });
9399
+ strictObject({
9400
+ revision: id$1.optional(),
9401
+ query: id$1.max(1e3),
9402
+ type: type.optional(),
9403
+ offset: int().nonnegative().default(0),
9404
+ limit: int().min(1).max(100).default(20)
9405
+ });
9406
+ strictObject({
9407
+ type: type.optional(),
9408
+ action: id$1.optional()
9409
+ }).refine((v) => v.type == null || v.action == null, "Choose type or action.");
9410
+ var authoringDiagnosticSchema = object({
9411
+ code: id$1,
9412
+ message: string$1(),
9413
+ nodes: array(id$1),
9414
+ field: string$1().optional(),
9415
+ line: number().optional(),
9416
+ column: number().optional()
9417
+ });
9418
+ var authoringCheckResponse = object({
9419
+ flowId: id$1,
9420
+ revisionId: id$1,
9421
+ valid: boolean(),
9422
+ diagnostics: array(authoringDiagnosticSchema),
9423
+ version: literal(1)
9424
+ });
9425
+ var authoringEditResponse = object({
9426
+ flowId: id$1,
9427
+ saved: literal(true),
9428
+ revision: id$1,
9429
+ nodes: record$3(id$1, id$1),
9430
+ changes: array(object({
9431
+ index: int(),
9432
+ op: id$1,
9433
+ node: id$1.optional()
9434
+ })),
9435
+ validation: object({
9436
+ status: _enum([
9437
+ "valid",
9438
+ "invalid",
9439
+ "unavailable"
9440
+ ]),
9441
+ diagnostics: array(authoringDiagnosticSchema).optional()
9442
+ }),
9443
+ version: literal(1)
9444
+ });
9445
+ var authoringReadResponse = object({
9446
+ flowId: id$1,
9447
+ revision: id$1,
9448
+ data: object({
9449
+ nodes: array(record$3(string$1(), json$2)).optional(),
9450
+ edges: array(json$2).optional(),
9451
+ text: record$3(string$1(), json$2).optional()
9452
+ }),
9453
+ version: literal(1)
9454
+ });
9455
+ var authoringSearchResponse = object({
9456
+ flowId: id$1,
9457
+ revision: id$1,
9458
+ data: object({
9459
+ matches: array(object({
9460
+ node: id$1,
9461
+ field: id$1,
9462
+ line: int().optional(),
9463
+ excerpt: string$1()
9464
+ })),
9465
+ total: int(),
9466
+ nextOffset: int().optional()
9467
+ }),
9468
+ version: literal(1)
9469
+ });
9470
+ //#endregion
9471
+ //#region src/control/common/providerIconSprite.ts
9472
+ /** Optional artwork must never make an otherwise usable catalog unavailable. */
9473
+ function providerIconAppearance(metadata, position) {
9474
+ if (!metadata || typeof metadata != "object" || !position || typeof position != "object") return {};
9475
+ const m = metadata;
9476
+ const p = position;
9477
+ if (typeof m.version != "string" || ![
9478
+ m.pixelRatio,
9479
+ m.iconSize,
9480
+ m.width,
9481
+ m.height
9482
+ ].every((v) => Number.isInteger(v) && v > 0) || ![
9483
+ m.bleed,
9484
+ p.x,
9485
+ p.y
9486
+ ].every((v) => Number.isInteger(v) && v >= 0) || p.x + m.iconSize > m.width || p.y + m.iconSize > m.height) return {};
9487
+ try {
9488
+ for (const url of [m.lightUrl, m.darkUrl]) if (typeof url != "string" || ![
9489
+ "https:",
9490
+ "http:",
9491
+ "data:"
9492
+ ].includes(new URL(url).protocol)) return {};
9493
+ } catch {
9494
+ return {};
9495
+ }
9496
+ return {
9497
+ iconSprite: m,
9498
+ iconSpritePosition: {
9499
+ x: p.x,
9500
+ y: p.y
9501
+ }
9502
+ };
9503
+ }
9504
+ //#endregion
9505
+ //#region src/control/common/errors.ts
9506
+ var controlErrorCode = {
9507
+ authenticationRequired: "authentication.required",
9508
+ authorizationDenied: "authorization.denied",
9509
+ bindingUnresolved: "binding.unresolved",
9510
+ connectorActionNotFound: "connector.action-not-found",
9511
+ connectorAccessConflict: "connector.access-conflict",
9512
+ connectorAccessInvalid: "connector.access-invalid",
9513
+ connectorAccessRequired: "connector.access-required",
9514
+ connectorAccessUnsupported: "connector.access-unsupported",
9515
+ connectorUnconfigured: "connector.unconfigured",
9516
+ connectorUnavailable: "connector.unavailable",
9517
+ connectorConsoleUnconfigured: "connector.console-unconfigured",
9518
+ engineUnavailable: "engine.unavailable",
9519
+ engineUnsupported: "engine.unsupported",
9520
+ eventSourceInvalid: "event-source.invalid",
9521
+ eventSourceIdentityUnavailable: "event-source.identity-unavailable",
9522
+ eventSourceNotFound: "event-source.not-found",
9523
+ eventSourceConflict: "event-source.conflict",
9524
+ flowInvalid: "flow.invalid",
9525
+ flowRepairRequired: "flow.repair-required",
9526
+ flowUpgradeRequired: "flow.upgrade-required",
9527
+ flowNotFound: "flow.not-found",
9528
+ flowBusy: "flow.busy",
9529
+ flowConflict: "flow.conflict",
9530
+ flowPresentationConflict: "flow.presentation-conflict",
9531
+ flowRevisionConflict: "flow.revision-conflict",
9532
+ liveConflict: "live.conflict",
9533
+ liveNotFound: "live.not-found",
9534
+ pageInvalidCursor: "page.invalid-cursor",
9535
+ publicationConflict: "publication.conflict",
9536
+ publicationNotFound: "publication.not-found",
9537
+ publicationUnsupported: "publication.unsupported",
9538
+ publishOperationNotFound: "publication.operation-not-found",
9539
+ routeNotFound: "route.not-found",
9540
+ runConflict: "run.conflict",
9541
+ runEventsExpired: "run.events-expired",
9542
+ runInvalid: "run.invalid",
9543
+ runNotFound: "run.not-found",
9544
+ runNotTerminal: "run.not-terminal",
9545
+ runOverloaded: "run.overloaded",
9546
+ runWaitNotFound: "run.wait-not-found",
9547
+ triggerKeyInvalid: "trigger-key.invalid",
9548
+ triggerKeyNotFound: "trigger-key.not-found",
9549
+ triggerNotFound: "trigger.not-found",
9550
+ variableInvalid: "variable.invalid",
9551
+ variableLimitReached: "variable.limit-reached",
9552
+ variableNotFound: "variable.not-found"
9553
+ };
9554
+ 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;
9555
+ var ApiError = class extends Error {
9556
+ constructor(status, code, message, details) {
9557
+ super(message);
9558
+ this.code = code;
9559
+ this.details = details;
9560
+ this.name = "ApiError";
9561
+ this.status = status;
9562
+ }
9563
+ };
9564
+ //#endregion
9565
+ //#region src/control/common/decoding.ts
9566
+ var InvalidResponseError = class extends ApiError {
9567
+ constructor(detail) {
9568
+ super(502, "response.invalid", `The Control API returned an invalid response.${detail == null ? "" : ` ${detail}`}`);
9569
+ this.detail = detail;
9570
+ }
9571
+ };
9572
+ function invalidResponse(detail) {
9573
+ throw new InvalidResponseError(detail);
9574
+ }
9575
+ function record$1(value) {
9576
+ if (value == null || typeof value != "object" || Array.isArray(value)) return invalidResponse("Expected an object.");
9577
+ return value;
9578
+ }
9579
+ function string(value) {
9580
+ return typeof value == "string" && value.length > 0 ? value : invalidResponse("Expected a non-empty string.");
9581
+ }
9582
+ function exact(value, keys) {
9583
+ const actual = Object.keys(value);
9584
+ if (actual.length != keys.length || actual.some((key) => !keys.includes(key))) {
9585
+ const missing = keys.filter((key) => !Object.hasOwn(value, key));
9586
+ const unexpected = actual.filter((key) => !keys.includes(key));
9587
+ invalidResponse([missing.length > 0 ? `Missing fields: ${missing.join(", ")}.` : "", unexpected.length > 0 ? `Unexpected fields: ${unexpected.join(", ")}.` : ""].filter(Boolean).join(" "));
9588
+ }
9589
+ }
9590
+ function integer(value) {
9591
+ return Number.isSafeInteger(value) ? value : invalidResponse("Expected a safe integer.");
9592
+ }
9593
+ function jsonValue(value) {
9594
+ if (value === null || typeof value == "boolean" || typeof value == "string") return value;
9595
+ if (typeof value == "number" && Number.isFinite(value)) return value;
9596
+ if (Array.isArray(value)) return value.map(jsonValue);
9597
+ const source = record$1(value);
9598
+ return Object.fromEntries(Object.entries(source).map(([key, item]) => [key, jsonValue(item)]));
9599
+ }
9600
+ function optionalString(value) {
9601
+ if (value == null) return;
9602
+ return string(value);
9318
9603
  }
9319
9604
  new TextEncoder();
9320
9605
  //#endregion
9321
9606
  //#region src/control/common/providerAccess.ts
9322
9607
  var sourceSchema = discriminatedUnion("kind", [strictObject({ kind: literal("admin-delegation") }), strictObject({
9323
9608
  kind: literal("policy"),
9324
- ruleId: string().min(1).nullable()
9609
+ ruleId: string$1().min(1).nullable()
9325
9610
  })]);
9326
9611
  function parseProviderAccessSource(value) {
9327
9612
  return sourceSchema.parse(value);
@@ -9329,7 +9614,7 @@ function parseProviderAccessSource(value) {
9329
9614
  //#endregion
9330
9615
  //#region src/control/common/connectorDecoders.ts
9331
9616
  function accessPermissions(value) {
9332
- const source = record$2(value);
9617
+ const source = record$1(value);
9333
9618
  exact(source, [
9334
9619
  "actionIds",
9335
9620
  "allActions",
@@ -9338,10 +9623,19 @@ function accessPermissions(value) {
9338
9623
  "configured",
9339
9624
  "proxy"
9340
9625
  ]);
9341
- if (!Array.isArray(source.triggerIds) || typeof source.allTriggers != "boolean" || !Array.isArray(source.actionIds) || typeof source.allActions != "boolean" || typeof source.configured != "boolean" || typeof source.proxy != "boolean") return invalidResponse();
9342
- const actionIds = source.actionIds.map(string$1);
9343
- const triggerIds = source.triggerIds.map(string$1);
9344
- if (new Set(actionIds).size != actionIds.length || source.allActions && actionIds.length != 0 || new Set(triggerIds).size != triggerIds.length || source.allTriggers && triggerIds.length != 0 || source.proxy && (!source.allActions || !source.allTriggers || source.configured)) return invalidResponse();
9626
+ if (!Array.isArray(source.actionIds)) return invalidResponse("permissions.actionIds: expected an array.");
9627
+ if (!Array.isArray(source.triggerIds)) return invalidResponse("permissions.triggerIds: expected an array.");
9628
+ if (typeof source.allActions != "boolean") return invalidResponse("permissions.allActions: expected a boolean.");
9629
+ if (typeof source.allTriggers != "boolean") return invalidResponse("permissions.allTriggers: expected a boolean.");
9630
+ if (typeof source.configured != "boolean") return invalidResponse("permissions.configured: expected a boolean.");
9631
+ if (typeof source.proxy != "boolean") return invalidResponse("permissions.proxy: expected a boolean.");
9632
+ const actionIds = source.actionIds.map(string);
9633
+ const triggerIds = source.triggerIds.map(string);
9634
+ if (new Set(actionIds).size != actionIds.length) return invalidResponse("permissions.actionIds: duplicate IDs.");
9635
+ if (source.allActions && actionIds.length != 0) return invalidResponse("permissions.actionIds: must be empty when allActions is true.");
9636
+ if (new Set(triggerIds).size != triggerIds.length) return invalidResponse("permissions.triggerIds: duplicate IDs.");
9637
+ if (source.allTriggers && triggerIds.length != 0) return invalidResponse("permissions.triggerIds: must be empty when allTriggers is true.");
9638
+ if (source.proxy && (!source.allActions || !source.allTriggers || source.configured)) return invalidResponse("permissions.proxy: requires allActions=true, allTriggers=true and configured=false.");
9345
9639
  return {
9346
9640
  actionIds,
9347
9641
  triggerIds,
@@ -9352,7 +9646,7 @@ function accessPermissions(value) {
9352
9646
  };
9353
9647
  }
9354
9648
  function accessBinding(value, candidate) {
9355
- const source = record$2(value);
9649
+ const source = record$1(value);
9356
9650
  const policyRevision = source.policyRevision;
9357
9651
  const status = source.status;
9358
9652
  const isDefault = source.isDefault;
@@ -9371,35 +9665,35 @@ function accessBinding(value, candidate) {
9371
9665
  "providerId",
9372
9666
  ...candidate ? [] : ["status"]
9373
9667
  ]);
9374
- if (policyRevision != null && typeof policyRevision != "string") return invalidResponse();
9375
- if (candidate && isDefault !== void 0 && typeof isDefault != "boolean") return invalidResponse();
9376
- if (permissionGroupName !== void 0 && permissionGroupName !== null && typeof permissionGroupName != "string") return invalidResponse();
9668
+ if (policyRevision != null && typeof policyRevision != "string") return invalidResponse("policyRevision: expected a string.");
9669
+ if (candidate && isDefault !== void 0 && typeof isDefault != "boolean") return invalidResponse("isDefault: expected a boolean.");
9670
+ if (permissionGroupName !== void 0 && permissionGroupName !== null && typeof permissionGroupName != "string") return invalidResponse("permissionGroupName: expected a string or null.");
9377
9671
  if (!candidate && status != "active" && status != "forbidden" && status != "invalid" && status != "missing") return invalidResponse();
9378
9672
  let bindingSource;
9379
9673
  try {
9380
9674
  bindingSource = parseProviderAccessSource(source.source);
9381
9675
  } catch {
9382
- return invalidResponse();
9676
+ return invalidResponse("source: expected { kind: 'admin-delegation' } or { kind: 'policy', ruleId: string | null }.");
9383
9677
  }
9384
9678
  return {
9385
- accessBindingId: string$1(source.accessBindingId),
9386
- connectionId: string$1(source.connectionId),
9679
+ accessBindingId: string(source.accessBindingId),
9680
+ connectionId: string(source.connectionId),
9387
9681
  source: bindingSource,
9388
- connectionDisplayName: string$1(legacy ? source.displayName : source.connectionDisplayName),
9682
+ connectionDisplayName: string(legacy ? source.displayName : source.connectionDisplayName),
9389
9683
  ...candidate && typeof isDefault == "boolean" ? { isDefault } : {},
9390
9684
  ...permissions == null ? {} : { permissions },
9391
9685
  ...permissionGroupName === void 0 ? {} : { permissionGroupName },
9392
9686
  ...policyRevision == null ? {} : { policyRevision },
9393
- providerId: string$1(source.providerId),
9687
+ providerId: string(source.providerId),
9394
9688
  ...candidate ? {} : { status }
9395
9689
  };
9396
9690
  }
9397
9691
  function accessMode(value) {
9398
- if (value != "implicit" && value != "selectable") return invalidResponse();
9692
+ if (value != "implicit" && value != "selectable") return invalidResponse("mode: expected implicit or selectable.");
9399
9693
  return value;
9400
9694
  }
9401
9695
  function connectorAccess(value) {
9402
- const source = record$2(value);
9696
+ const source = record$1(value);
9403
9697
  exact(source, [
9404
9698
  "accessRevision",
9405
9699
  "bindings",
@@ -9409,12 +9703,12 @@ function connectorAccess(value) {
9409
9703
  ..."discardedBindingCount" in source ? ["discardedBindingCount"] : [],
9410
9704
  "version"
9411
9705
  ]);
9412
- const accessRevision = integer$1(source.accessRevision);
9706
+ const accessRevision = integer(source.accessRevision);
9413
9707
  if (source.version != 1 || accessRevision < 0 || !Array.isArray(source.bindings)) return invalidResponse();
9414
9708
  if ("providerIds" in source && !Array.isArray(source.providerIds)) return invalidResponse();
9415
- const providerIds = source.providerIds == null ? void 0 : source.providerIds.map((id) => string$1(id));
9709
+ const providerIds = source.providerIds == null ? void 0 : source.providerIds.map((id) => string(id));
9416
9710
  if (providerIds != null && new Set(providerIds).size != providerIds.length) return invalidResponse();
9417
- let discardedBindingCount = source.discardedBindingCount == null ? 0 : integer$1(source.discardedBindingCount);
9711
+ let discardedBindingCount = source.discardedBindingCount == null ? 0 : integer(source.discardedBindingCount);
9418
9712
  if (discardedBindingCount < 0) return invalidResponse();
9419
9713
  const bindings = [];
9420
9714
  for (const entry of source.bindings) try {
@@ -9439,14 +9733,14 @@ function connectorAccess(value) {
9439
9733
  ...providerIds == null ? {} : { providerIds },
9440
9734
  bindings,
9441
9735
  mode: accessMode(source.mode),
9442
- sharedAccessDigest: string$1(source.sharedAccessDigest),
9736
+ sharedAccessDigest: string(source.sharedAccessDigest),
9443
9737
  version: 1
9444
9738
  };
9445
9739
  }
9446
9740
  function accessGrants(value) {
9447
9741
  if (!Array.isArray(value)) return invalidResponse();
9448
9742
  const bindings = value.map((candidate) => {
9449
- const entry = record$2(candidate);
9743
+ const entry = record$1(candidate);
9450
9744
  exact(entry, [
9451
9745
  "accessBindingId",
9452
9746
  "connectionId",
@@ -9463,11 +9757,11 @@ function accessGrants(value) {
9463
9757
  }
9464
9758
  if (entry.permissionGroupName != null && typeof entry.permissionGroupName != "string") return invalidResponse();
9465
9759
  return {
9466
- accessBindingId: string$1(entry.accessBindingId),
9467
- connectionId: string$1(entry.connectionId),
9468
- providerId: string$1(entry.providerId),
9760
+ accessBindingId: string(entry.accessBindingId),
9761
+ connectionId: string(entry.connectionId),
9762
+ providerId: string(entry.providerId),
9469
9763
  source: identity,
9470
- connectionDisplayName: string$1(entry.connectionDisplayName),
9764
+ connectionDisplayName: string(entry.connectionDisplayName),
9471
9765
  ..."permissionGroupName" in entry ? { permissionGroupName: entry.permissionGroupName } : {}
9472
9766
  };
9473
9767
  });
@@ -9475,7 +9769,7 @@ function accessGrants(value) {
9475
9769
  return bindings;
9476
9770
  }
9477
9771
  function connectorAccessSnapshot(value) {
9478
- const source = record$2(value);
9772
+ const source = record$1(value);
9479
9773
  exact(source, [
9480
9774
  "mode",
9481
9775
  "sharedAccessDigest",
@@ -9490,24 +9784,26 @@ function connectorAccessSnapshot(value) {
9490
9784
  if (mode == "implicit" && (sharedBindings.length > 0 || selectedBindings.length > 0)) return invalidResponse();
9491
9785
  return {
9492
9786
  mode,
9493
- sharedAccessDigest: string$1(source.sharedAccessDigest),
9787
+ sharedAccessDigest: string(source.sharedAccessDigest),
9494
9788
  sharedBindings,
9495
9789
  selectedBindings,
9496
9790
  version: 2
9497
9791
  };
9498
9792
  }
9499
9793
  function connectorAccessCandidates(value, providerId) {
9500
- const source = record$2(value);
9794
+ const source = record$1(value);
9501
9795
  exact(source, [
9502
9796
  "candidates",
9503
9797
  "mode",
9504
9798
  "providerId",
9505
9799
  "version"
9506
9800
  ]);
9507
- if (source.version != 1 || string$1(source.providerId) != providerId || !Array.isArray(source.candidates)) return invalidResponse();
9801
+ if (source.version != 1) return invalidResponse("version: expected 1.");
9802
+ if (string(source.providerId) != providerId) return invalidResponse("providerId: does not match the requested provider.");
9803
+ if (!Array.isArray(source.candidates)) return invalidResponse("candidates: expected an array.");
9508
9804
  const candidates = source.candidates.map((candidate) => accessBinding(candidate, true));
9509
- if (candidates.some((candidate) => candidate.providerId != providerId)) return invalidResponse();
9510
- if (new Set(candidates.map((candidate) => candidate.accessBindingId)).size != candidates.length) return invalidResponse();
9805
+ if (candidates.some((candidate) => candidate.providerId != providerId)) return invalidResponse("candidates[].providerId: does not match the requested provider.");
9806
+ if (new Set(candidates.map((candidate) => candidate.accessBindingId)).size != candidates.length) return invalidResponse("candidates[].accessBindingId: duplicate IDs.");
9511
9807
  return {
9512
9808
  candidates,
9513
9809
  mode: accessMode(source.mode),
@@ -9516,34 +9812,35 @@ function connectorAccessCandidates(value, providerId) {
9516
9812
  };
9517
9813
  }
9518
9814
  function connectorAccessCandidatesBatch(value, providerIds) {
9519
- const source = record$2(value);
9815
+ const source = record$1(value);
9520
9816
  exact(source, ["results", "version"]);
9521
- if (source.version != 1 || !Array.isArray(source.results)) return invalidResponse();
9817
+ if (source.version != 1) return invalidResponse("version: expected 1.");
9818
+ if (!Array.isArray(source.results)) return invalidResponse("results: expected an array.");
9522
9819
  const remaining = new Set(providerIds);
9523
9820
  const results = source.results.map((entry) => {
9524
- const item = record$2(entry);
9525
- const providerId = string$1(item.providerId);
9526
- if (!remaining.delete(providerId)) return invalidResponse();
9821
+ const item = record$1(entry);
9822
+ const providerId = string(item.providerId);
9823
+ if (!remaining.delete(providerId)) return invalidResponse("results[].providerId: duplicate or unrequested provider.");
9527
9824
  if (!Object.hasOwn(item, "error")) return connectorAccessCandidates(item, providerId);
9528
9825
  exact(item, ["providerId", "error"]);
9529
- const error = record$2(item.error);
9826
+ const error = record$1(item.error);
9530
9827
  exact(error, ["code", "message"]);
9531
9828
  return {
9532
9829
  providerId,
9533
9830
  error: {
9534
- code: string$1(error.code),
9535
- message: string$1(error.message)
9831
+ code: string(error.code),
9832
+ message: string(error.message)
9536
9833
  }
9537
9834
  };
9538
9835
  });
9539
- if (remaining.size != 0) return invalidResponse();
9836
+ if (remaining.size != 0) return invalidResponse("results: missing requested providers.");
9540
9837
  return {
9541
9838
  results,
9542
9839
  version: 1
9543
9840
  };
9544
9841
  }
9545
9842
  function connection(value) {
9546
- const source = record$2(value);
9843
+ const source = record$1(value);
9547
9844
  exact(source, [
9548
9845
  ...Object.hasOwn(source, "providerAccountId") ? ["providerAccountId"] : [],
9549
9846
  ...Object.hasOwn(source, "alias") ? ["alias"] : [],
@@ -9559,18 +9856,18 @@ function connection(value) {
9559
9856
  if (status != "active" && status != "disconnected" && status != "error" && status != "reauth_required") return invalidResponse();
9560
9857
  if (typeof source.isDefault != "boolean") return invalidResponse();
9561
9858
  return {
9562
- ...source.providerAccountId === void 0 ? {} : { providerAccountId: string$1(source.providerAccountId) },
9563
- ...source.alias === void 0 ? {} : { alias: string$1(source.alias) },
9859
+ ...source.providerAccountId === void 0 ? {} : { providerAccountId: string(source.providerAccountId) },
9860
+ ...source.alias === void 0 ? {} : { alias: string(source.alias) },
9564
9861
  ...source.builtInAccount === void 0 ? {} : { builtInAccount: source.builtInAccount },
9565
- connectionId: string$1(source.connectionId),
9566
- displayName: string$1(source.displayName),
9862
+ connectionId: string(source.connectionId),
9863
+ displayName: string(source.displayName),
9567
9864
  isDefault: source.isDefault,
9568
- serviceId: string$1(source.serviceId),
9865
+ serviceId: string(source.serviceId),
9569
9866
  status
9570
9867
  };
9571
9868
  }
9572
9869
  function port(value, input = false) {
9573
- const source = record$2(value);
9870
+ const source = record$1(value);
9574
9871
  const description = source.description;
9575
9872
  const hasValue = input && Object.hasOwn(source, "value");
9576
9873
  exact(source, [
@@ -9592,10 +9889,10 @@ function inputPort(value) {
9592
9889
  return port(value, true);
9593
9890
  }
9594
9891
  function ports(value, decode) {
9595
- return Object.fromEntries(Object.entries(record$2(value)).map(([handle, candidate]) => [handle, decode(candidate)]));
9892
+ return Object.fromEntries(Object.entries(record$1(value)).map(([handle, candidate]) => [handle, decode(candidate)]));
9596
9893
  }
9597
9894
  function connectorActionMetadata(value) {
9598
- const source = record$2(value);
9895
+ const source = record$1(value);
9599
9896
  const homepageUrl = source.homepageUrl;
9600
9897
  const icon = source.icon;
9601
9898
  exact(source, [
@@ -9619,22 +9916,22 @@ function connectorActionMetadata(value) {
9619
9916
  return {
9620
9917
  ...source.inputSchema === void 0 ? {} : { inputSchema: jsonValue(source.inputSchema) },
9621
9918
  ...source.outputSchema === void 0 ? {} : { outputSchema: jsonValue(source.outputSchema) },
9622
- actionId: string$1(source.actionId),
9623
- ...source.operationType == null ? {} : { operationType: string$1(source.operationType) },
9919
+ actionId: string(source.actionId),
9920
+ ...source.operationType == null ? {} : { operationType: string(source.operationType) },
9624
9921
  authenticated: typeof source.authenticated == "boolean" ? source.authenticated : invalidResponse(),
9625
9922
  description: typeof source.description == "string" ? source.description : invalidResponse(),
9626
9923
  ...homepageUrl == null ? {} : { homepageUrl },
9627
9924
  ...icon == null ? {} : { icon },
9628
9925
  ...providerIconAppearance(source.iconSprite, source.iconSpritePosition),
9629
9926
  inputs: ports(source.inputs, inputPort),
9630
- name: string$1(source.name),
9927
+ name: string(source.name),
9631
9928
  outputs: ports(source.outputs, port),
9632
- serviceId: string$1(source.serviceId),
9633
- serviceName: string$1(source.serviceName)
9929
+ serviceId: string(source.serviceId),
9930
+ serviceName: string(source.serviceName)
9634
9931
  };
9635
9932
  }
9636
9933
  function connectorAction(value) {
9637
- const { defaultConnection, ...metadata } = record$2(value);
9934
+ const { defaultConnection, ...metadata } = record$1(value);
9638
9935
  const action = connectorActionMetadata(metadata);
9639
9936
  if (defaultConnection == null) return action;
9640
9937
  const preferred = connection(defaultConnection);
@@ -9645,7 +9942,7 @@ function connectorAction(value) {
9645
9942
  };
9646
9943
  }
9647
9944
  function connectorProvider(value) {
9648
- const source = record$2(value);
9945
+ const source = record$1(value);
9649
9946
  const homepageUrl = source.homepageUrl;
9650
9947
  const icon = source.icon;
9651
9948
  if (source.noSetup !== void 0 && typeof source.noSetup != "boolean") return invalidResponse();
@@ -9663,16 +9960,16 @@ function connectorProvider(value) {
9663
9960
  ...homepageUrl == null ? {} : { homepageUrl },
9664
9961
  ...icon == null ? {} : { icon },
9665
9962
  ...providerIconAppearance(source.iconSprite, source.iconSpritePosition),
9666
- serviceId: string$1(source.serviceId),
9667
- serviceName: string$1(source.serviceName),
9963
+ serviceId: string(source.serviceId),
9964
+ serviceName: string(source.serviceName),
9668
9965
  ...source.noSetup === void 0 ? {} : { noSetup: source.noSetup }
9669
9966
  };
9670
9967
  }
9671
9968
  //#endregion
9672
9969
  //#region src/control/common/eventSources.ts
9673
- var id = string().min(1).max(256);
9674
- var eventType = string().regex(/^[a-z][a-z0-9_.]{0,127}$/);
9675
- var name = string().trim().min(1).max(128);
9970
+ var id = string$1().min(1).max(256);
9971
+ var eventType = string$1().regex(/^[a-z][a-z0-9_.]{0,127}$/);
9972
+ var name = string$1().trim().min(1).max(128);
9676
9973
  var eventSourceSchema = strictObject({
9677
9974
  version: literal(1),
9678
9975
  sourceId: id,
@@ -9687,13 +9984,13 @@ var eventSourceSchema = strictObject({
9687
9984
  manageSubscriptions: boolean(),
9688
9985
  verificationTokenConfigured: boolean(),
9689
9986
  encryptKeyConfigured: boolean(),
9690
- endpointUrl: string().nullable(),
9691
- verifiedAt: string().nullable(),
9692
- lastReceivedAt: string().nullable(),
9693
- updatedAt: string(),
9987
+ endpointUrl: string$1().nullable(),
9988
+ verifiedAt: string$1().nullable(),
9989
+ lastReceivedAt: string$1().nullable(),
9990
+ updatedAt: string$1(),
9694
9991
  consumers: array(strictObject({
9695
9992
  flowId: id,
9696
- flowName: string(),
9993
+ flowName: string$1(),
9697
9994
  triggerNodeId: id
9698
9995
  }))
9699
9996
  });
@@ -9722,32 +10019,32 @@ function isUiLanguage(value) {
9722
10019
  //#endregion
9723
10020
  //#region src/trigger/common/configSchema.ts
9724
10021
  var configInputsSchema = array(union([strictObject({
9725
- handle: string().min(1),
9726
- description: string().optional(),
9727
- jsonSchema: json$3(),
10022
+ handle: string$1().min(1),
10023
+ description: string$1().optional(),
10024
+ jsonSchema: json$4(),
9728
10025
  nullable: boolean(),
9729
- value: json$3().optional()
10026
+ value: json$4().optional()
9730
10027
  }), strictObject({
9731
- group: string(),
10028
+ group: string$1(),
9732
10029
  collapsed: boolean().optional()
9733
10030
  })]));
9734
10031
  //#endregion
9735
10032
  //#region src/control/common/triggerDecoders.ts
9736
10033
  function triggerKeySummary(value) {
9737
- const source = record$2(value);
10034
+ const source = record$1(value);
9738
10035
  const type = source.type;
9739
10036
  if (type != "integration" && type != "poll") return invalidResponse();
9740
10037
  return {
9741
10038
  description: typeof source.description == "string" ? source.description : invalidResponse(),
9742
- displayName: string$1(source.displayName),
9743
- key: string$1(source.key),
9744
- name: string$1(source.name),
9745
- provider: string$1(source.provider),
10039
+ displayName: string(source.displayName),
10040
+ key: string(source.key),
10041
+ name: string(source.name),
10042
+ provider: string(source.provider),
9746
10043
  type
9747
10044
  };
9748
10045
  }
9749
10046
  function triggerKey(value) {
9750
- const source = record$2(value);
10047
+ const source = record$1(value);
9751
10048
  const summary = triggerKeySummary(source);
9752
10049
  const base = {
9753
10050
  configInputs: configInputsSchema.parse(source.configInputs),
@@ -9757,12 +10054,12 @@ function triggerKey(value) {
9757
10054
  key: summary.key,
9758
10055
  name: summary.name,
9759
10056
  outputs: (Array.isArray(source.outputs) ? source.outputs : invalidResponse()).map((entry) => {
9760
- const port = record$2(entry);
10057
+ const port = record$1(entry);
9761
10058
  return Object.assign({
9762
- handle: string$1(port.handle),
10059
+ handle: string(port.handle),
9763
10060
  jsonSchema: jsonValue(port.jsonSchema),
9764
10061
  nullable: typeof port.nullable === "boolean" ? port.nullable : invalidResponse()
9765
- }, port.description == null ? {} : { description: string$1(port.description) });
10062
+ }, port.description == null ? {} : { description: string(port.description) });
9766
10063
  }),
9767
10064
  provider: summary.provider
9768
10065
  };
@@ -9770,12 +10067,12 @@ function triggerKey(value) {
9770
10067
  ...base,
9771
10068
  type: "poll"
9772
10069
  };
9773
- const endpoint = record$2(source.endpoint);
9774
- const body = record$2(endpoint.body);
10070
+ const endpoint = record$1(source.endpoint);
10071
+ const body = record$1(endpoint.body);
9775
10072
  if (!Array.isArray(endpoint.methods) || !Array.isArray(body.formats) || typeof body.allowArray != "boolean" || typeof body.allowEmpty != "boolean") return invalidResponse();
9776
- const methods = endpoint.methods.map(string$1);
9777
- const formats = body.formats.map(string$1);
9778
- const successStatus = integer$1(endpoint.successStatus);
10073
+ const methods = endpoint.methods.map(string);
10074
+ const formats = body.formats.map(string);
10075
+ const successStatus = integer(endpoint.successStatus);
9779
10076
  if (methods.some((method) => ![
9780
10077
  "DELETE",
9781
10078
  "GET",
@@ -9827,38 +10124,38 @@ var triggerActivityKinds = /* @__PURE__ */ new Set([
9827
10124
  "operator.resumed"
9828
10125
  ]);
9829
10126
  function triggerBinding(value) {
9830
- const source = record$2(value);
10127
+ const source = record$1(value);
9831
10128
  const health = source.health;
9832
- const listener = source.listener == null ? void 0 : record$2(source.listener);
10129
+ const listener = source.listener == null ? void 0 : record$1(source.listener);
9833
10130
  if (listener != null && listener.health != "healthy" && listener.health != "failed" && listener.health != "needs_reauth") return invalidResponse();
9834
10131
  const kind = source.kind;
9835
10132
  const operatorState = source.operatorState;
9836
- const runtimeVersion = integer$1(source.runtimeVersion);
10133
+ const runtimeVersion = integer(source.runtimeVersion);
9837
10134
  if (source.version != 1 || typeof health != "string" || !triggerHealth.has(health)) return invalidResponse();
9838
10135
  if (typeof kind != "string" || !triggerKinds.has(kind)) return invalidResponse();
9839
10136
  if (operatorState != "active" && operatorState != "paused") return invalidResponse();
9840
10137
  if (runtimeVersion <= 0) return invalidResponse();
9841
10138
  return {
9842
- ...source.currentPublicationId == null ? {} : { currentPublicationId: string$1(source.currentPublicationId) },
9843
- ...source.currentRevisionId == null ? {} : { currentRevisionId: string$1(source.currentRevisionId) },
9844
- ...source.endpointUrl == null ? {} : { endpointUrl: string$1(source.endpointUrl) },
10139
+ ...source.currentPublicationId == null ? {} : { currentPublicationId: string(source.currentPublicationId) },
10140
+ ...source.currentRevisionId == null ? {} : { currentRevisionId: string(source.currentRevisionId) },
10141
+ ...source.endpointUrl == null ? {} : { endpointUrl: string(source.endpointUrl) },
9845
10142
  ...listener == null ? {} : { listener: {
9846
10143
  health: listener.health,
9847
- ...listener.lastErrorCode == null ? {} : { lastErrorCode: string$1(listener.lastErrorCode) }
10144
+ ...listener.lastErrorCode == null ? {} : { lastErrorCode: string(listener.lastErrorCode) }
9848
10145
  } },
9849
- flowId: string$1(source.flowId),
10146
+ flowId: string(source.flowId),
9850
10147
  health,
9851
10148
  kind,
9852
- ...source.lastErrorCode == null ? {} : { lastErrorCode: string$1(source.lastErrorCode) },
10149
+ ...source.lastErrorCode == null ? {} : { lastErrorCode: string(source.lastErrorCode) },
9853
10150
  operatorState,
9854
10151
  runtimeVersion,
9855
- triggerNodeId: string$1(source.triggerNodeId),
9856
- updatedAt: string$1(source.updatedAt),
10152
+ triggerNodeId: string(source.triggerNodeId),
10153
+ updatedAt: string(source.updatedAt),
9857
10154
  version: 1
9858
10155
  };
9859
10156
  }
9860
10157
  function triggerBindingDetail(value) {
9861
- const source = record$2(value);
10158
+ const source = record$1(value);
9862
10159
  if (source.version != 1) return invalidResponse();
9863
10160
  return {
9864
10161
  binding: triggerBinding(source.binding),
@@ -9866,22 +10163,22 @@ function triggerBindingDetail(value) {
9866
10163
  };
9867
10164
  }
9868
10165
  function triggerActivity(value) {
9869
- const source = record$2(value);
10166
+ const source = record$1(value);
9870
10167
  const kind = source.kind;
9871
10168
  if (typeof kind != "string" || !triggerActivityKinds.has(kind)) return invalidResponse();
9872
10169
  const errorCode = optionalString(source.errorCode);
9873
10170
  const errorMessage = optionalString(source.errorMessage);
9874
10171
  if (errorMessage != null && errorMessage.length > 512) return invalidResponse();
9875
10172
  return {
9876
- activityId: string$1(source.activityId),
9877
- createdAt: string$1(source.createdAt),
10173
+ activityId: string(source.activityId),
10174
+ createdAt: string(source.createdAt),
9878
10175
  ...errorCode == null ? {} : { errorCode },
9879
10176
  ...errorMessage == null ? {} : { errorMessage },
9880
10177
  kind
9881
10178
  };
9882
10179
  }
9883
10180
  function triggerActivityPage(value) {
9884
- const source = record$2(value);
10181
+ const source = record$1(value);
9885
10182
  const nextCursor = optionalString(source.nextCursor);
9886
10183
  if (source.version != 1 || !Array.isArray(source.activities)) return invalidResponse();
9887
10184
  return {
@@ -9891,12 +10188,12 @@ function triggerActivityPage(value) {
9891
10188
  };
9892
10189
  }
9893
10190
  function pollTriggerTestResult(value) {
9894
- const source = record$2(value);
9895
- const filtered = integer$1(source.filtered);
10191
+ const source = record$1(value);
10192
+ const filtered = integer(source.filtered);
9896
10193
  if (source.version != 1 || !Array.isArray(source.events) || typeof source.hasMore != "boolean" || filtered < 0) return invalidResponse();
9897
10194
  return {
9898
10195
  events: source.events.map((event) => {
9899
- const object = record$2(event);
10196
+ const object = record$1(event);
9900
10197
  return Object.fromEntries(Object.entries(object).map(([key, item]) => [key, jsonValue(item)]));
9901
10198
  }),
9902
10199
  filtered,
@@ -9907,7 +10204,7 @@ function pollTriggerTestResult(value) {
9907
10204
  //#endregion
9908
10205
  //#region src/control/common/triggerCatalog.ts
9909
10206
  function decodeTriggerCatalog(value) {
9910
- const source = record$2(value);
10207
+ const source = record$1(value);
9911
10208
  exact(source, [
9912
10209
  "version",
9913
10210
  "locale",
@@ -9916,12 +10213,12 @@ function decodeTriggerCatalog(value) {
9916
10213
  ]);
9917
10214
  if (source.version != 3 || !isUiLanguage(source.locale) || !Array.isArray(source.definitions)) return invalidResponse();
9918
10215
  const definitions = source.definitions.map(triggerKey);
9919
- const entries = record$2(source.display);
10216
+ const entries = record$1(source.display);
9920
10217
  const keys = new Set(definitions.map((definition) => definition.key));
9921
10218
  if (keys.size != definitions.length || Object.keys(entries).length != keys.size) return invalidResponse();
9922
10219
  const display = Object.fromEntries(definitions.map((definition) => {
9923
10220
  const { key } = definition;
9924
- const copy = record$2(entries[key]);
10221
+ const copy = record$1(entries[key]);
9925
10222
  exact(copy, [
9926
10223
  "configInputs",
9927
10224
  "configInputLabels",
@@ -9932,8 +10229,8 @@ function decodeTriggerCatalog(value) {
9932
10229
  return [key, {
9933
10230
  configInputs: descriptions(copy.configInputs, definition.configInputs.flatMap((field) => "handle" in field ? [field.handle] : [])),
9934
10231
  configInputLabels: labels(copy.configInputLabels, definition.configInputs.flatMap((field) => "handle" in field ? [field.handle] : [])),
9935
- displayName: string$1(copy.displayName),
9936
- description: string$1(copy.description),
10232
+ displayName: string(copy.displayName),
10233
+ description: string(copy.description),
9937
10234
  outputs: descriptions(copy.outputs, definition.outputs.map((field) => field.handle))
9938
10235
  }];
9939
10236
  }));
@@ -9945,29 +10242,29 @@ function decodeTriggerCatalog(value) {
9945
10242
  };
9946
10243
  }
9947
10244
  function descriptions(value, handles) {
9948
- const source = record$2(value);
10245
+ const source = record$1(value);
9949
10246
  exact(source, handles);
9950
- return Object.fromEntries(Object.entries(source).map(([handle, description]) => [handle, string$1(description)]));
10247
+ return Object.fromEntries(Object.entries(source).map(([handle, description]) => [handle, string(description)]));
9951
10248
  }
9952
10249
  function labels(value, handles) {
9953
- const source = record$2(value);
10250
+ const source = record$1(value);
9954
10251
  if (Object.keys(source).some((handle) => !handles.includes(handle))) return invalidResponse();
9955
10252
  return Object.fromEntries(Object.entries(source).map(([handle, label]) => {
9956
- const text = string$1(label);
10253
+ const text = string(label);
9957
10254
  return text.trim().length == 0 ? invalidResponse() : [handle, text];
9958
10255
  }));
9959
10256
  }
9960
10257
  strictObject({
9961
- pointer: string().max(4096).default(""),
10258
+ pointer: string$1().max(4096).default(""),
9962
10259
  offset: number().int().nonnegative().default(0),
9963
10260
  limit: number().int().min(1).max(100).default(20),
9964
10261
  maxBytes: number().int().min(1).max(1048576).default(15e3)
9965
10262
  });
9966
10263
  //#endregion
9967
10264
  //#region src/control/common/results.ts
9968
- var json$1 = json$3();
10265
+ var json$1 = json$4();
9969
10266
  var entry = strictObject({
9970
- pointer: string(),
10267
+ pointer: string$1(),
9971
10268
  type: _enum([
9972
10269
  "object",
9973
10270
  "array",
@@ -9986,26 +10283,26 @@ var page = entry.extend({
9986
10283
  entries: array(entry).optional()
9987
10284
  });
9988
10285
  var result = strictObject({
9989
- resultId: string().min(1),
9990
- callId: string().min(1),
9991
- toolId: string().min(1),
10286
+ resultId: string$1().min(1),
10287
+ callId: string$1().min(1),
10288
+ toolId: string$1().min(1),
9992
10289
  source: discriminatedUnion("kind", [strictObject({
9993
10290
  kind: literal("connector"),
9994
- action: string().min(1)
10291
+ action: string$1().min(1)
9995
10292
  }), strictObject({ kind: literal("code") })]),
9996
10293
  bytes: number().int().nonnegative(),
9997
- digest: string().regex(/^[a-f0-9]{64}$/),
9998
- createdAt: string().datetime()
10294
+ digest: string$1().regex(/^[a-f0-9]{64}$/),
10295
+ createdAt: string$1().datetime()
9999
10296
  });
10000
10297
  var listSchema = strictObject({
10001
10298
  version: literal(1),
10002
- runId: string(),
10299
+ runId: string$1(),
10003
10300
  results: array(result),
10004
- nextAfter: string().optional()
10301
+ nextAfter: string$1().optional()
10005
10302
  });
10006
10303
  var readSchema = strictObject({
10007
10304
  version: literal(1),
10008
- runId: string(),
10305
+ runId: string$1(),
10009
10306
  result,
10010
10307
  page
10011
10308
  });
@@ -10023,8 +10320,8 @@ function schemaPath(value) {
10023
10320
  return value.map((part) => typeof part == "string" || Number.isSafeInteger(part) ? part : invalidResponse());
10024
10321
  }
10025
10322
  function schemaMismatch(value) {
10026
- const source = record$2(value);
10027
- const kind = string$1(source.kind);
10323
+ const source = record$1(value);
10324
+ const kind = string(source.kind);
10028
10325
  if (kind == "artifact" || kind == "binary" || kind == "nullable") return { kind };
10029
10326
  if (kind == "schema") return {
10030
10327
  kind,
@@ -10040,30 +10337,30 @@ function schemaMismatch(value) {
10040
10337
  };
10041
10338
  }
10042
10339
  function diagnostic(value) {
10043
- const source = record$2(value);
10044
- const values = source.values == null ? void 0 : record$2(source.values);
10340
+ const source = record$1(value);
10341
+ const values = source.values == null ? void 0 : record$1(source.values);
10045
10342
  return {
10046
- code: string$1(source.code),
10047
- column: integer$1(source.column),
10048
- ...source.fields === void 0 ? {} : { fields: Array.isArray(source.fields) ? source.fields.map(string$1) : invalidResponse() },
10049
- line: integer$1(source.line),
10050
- message: string$1(source.message),
10343
+ code: string(source.code),
10344
+ column: integer(source.column),
10345
+ ...source.fields === void 0 ? {} : { fields: Array.isArray(source.fields) ? source.fields.map(string) : invalidResponse() },
10346
+ line: integer(source.line),
10347
+ message: string(source.message),
10051
10348
  mismatch: source.mismatch == null ? void 0 : schemaMismatch(source.mismatch),
10052
10349
  path: typeof source.path == "string" ? source.path : invalidResponse(),
10053
10350
  ...values == null ? {} : { values: Object.fromEntries(Object.entries(values).map(([key, candidate]) => [key, typeof candidate == "string" || typeof candidate == "number" ? candidate : invalidResponse()])) }
10054
10351
  };
10055
10352
  }
10056
10353
  function flowCheck(value) {
10057
- const source = record$2(value);
10354
+ const source = record$1(value);
10058
10355
  if (source.version != 1 || typeof source.valid != "boolean" || !Array.isArray(source.diagnostics)) return invalidResponse();
10059
10356
  return {
10060
- closureDigest: string$1(source.closureDigest),
10357
+ closureDigest: string(source.closureDigest),
10061
10358
  diagnostics: source.diagnostics.map(diagnostic),
10062
- engineContract: string$1(source.engineContract),
10063
- flowId: string$1(source.flowId),
10064
- modelVersion: integer$1(source.modelVersion),
10065
- revisionDigest: string$1(source.revisionDigest),
10066
- revisionId: string$1(source.revisionId),
10359
+ engineContract: string(source.engineContract),
10360
+ flowId: string(source.flowId),
10361
+ modelVersion: integer(source.modelVersion),
10362
+ revisionDigest: string(source.revisionDigest),
10363
+ revisionId: string(source.revisionId),
10067
10364
  valid: source.valid,
10068
10365
  version: 1
10069
10366
  };
@@ -10079,7 +10376,7 @@ function connectorProvidersQuery(flowId, locale) {
10079
10376
  return {
10080
10377
  path: `/v1/connector/providers${parameters ? `?${parameters}` : ""}`,
10081
10378
  decode: (value) => {
10082
- const source = record$2(value);
10379
+ const source = record$1(value);
10083
10380
  exact(source, ["providers", "version"]);
10084
10381
  if (source.version != 1 || !Array.isArray(source.providers)) return invalidResponse();
10085
10382
  return source.providers.map(connectorProvider);
@@ -10094,7 +10391,7 @@ function connectorActionQuery(actionId, flowId, locale) {
10094
10391
  return {
10095
10392
  path: `/v1/connector/actions/${encodeURIComponent(actionId)}${parameters ? `?${parameters}` : ""}`,
10096
10393
  decode: (value) => {
10097
- const source = record$2(value);
10394
+ const source = record$1(value);
10098
10395
  exact(source, ["action", "version"]);
10099
10396
  if (source.version != 1) return invalidResponse();
10100
10397
  return connectorAction(source.action);
@@ -10105,7 +10402,7 @@ function allConnectorConnectionsQuery(flowId) {
10105
10402
  return {
10106
10403
  path: `/v1/connector/connections${scope(flowId)}`,
10107
10404
  decode: (value) => {
10108
- const source = record$2(value);
10405
+ const source = record$1(value);
10109
10406
  exact(source, ["connections", "version"]);
10110
10407
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
10111
10408
  return source.connections.map(connection);
@@ -10116,44 +10413,82 @@ function connectorConnectionsQuery(serviceId, flowId) {
10116
10413
  return {
10117
10414
  path: `/v1/connector/connections/${encodeURIComponent(serviceId)}${scope(flowId)}`,
10118
10415
  decode: (value) => {
10119
- const source = record$2(value);
10416
+ const source = record$1(value);
10120
10417
  exact(source, [
10121
10418
  "connections",
10122
10419
  "serviceId",
10123
10420
  "version"
10124
10421
  ]);
10125
- if (source.version != 1 || string$1(source.serviceId) != serviceId || !Array.isArray(source.connections)) return invalidResponse();
10422
+ if (source.version != 1 || string(source.serviceId) != serviceId || !Array.isArray(source.connections)) return invalidResponse();
10126
10423
  return source.connections.map(connection);
10127
10424
  }
10128
10425
  };
10129
10426
  }
10130
10427
  //#endregion
10131
10428
  //#region src/control/common/flowDecoders.ts
10429
+ function strings(value) {
10430
+ return Array.isArray(value) ? value.map(string) : invalidResponse();
10431
+ }
10432
+ function resourceReferences(input) {
10433
+ const source = record$1(input);
10434
+ const draft = source.draft === null ? null : record$1(source.draft);
10435
+ const shared = record$1(source.sharedAccess);
10436
+ if (draft != null && !Array.isArray(draft.connections)) return invalidResponse();
10437
+ if (!Array.isArray(shared.bindings)) return invalidResponse();
10438
+ const accessRevision = integer(shared.accessRevision);
10439
+ if (accessRevision < 0) return invalidResponse();
10440
+ return {
10441
+ draft: draft == null ? null : {
10442
+ variableNames: strings(draft.variableNames),
10443
+ errorSourceFlowIds: strings(draft.errorSourceFlowIds),
10444
+ connections: draft.connections.map((value) => {
10445
+ const connection = record$1(value);
10446
+ return {
10447
+ providerId: string(connection.providerId),
10448
+ connectionId: string(connection.connectionId)
10449
+ };
10450
+ })
10451
+ },
10452
+ sharedAccess: {
10453
+ accessRevision,
10454
+ providerIds: strings(shared.providerIds),
10455
+ bindings: shared.bindings.map((value) => {
10456
+ const binding = record$1(value);
10457
+ return {
10458
+ providerId: string(binding.providerId),
10459
+ connectionId: binding.connectionId === null ? null : string(binding.connectionId),
10460
+ accessBindingId: string(binding.accessBindingId)
10461
+ };
10462
+ })
10463
+ }
10464
+ };
10465
+ }
10132
10466
  function flow(value) {
10133
- const source = record$2(value);
10467
+ const source = record$1(value);
10134
10468
  const status = source.status;
10135
10469
  if (source.version != 1) return invalidResponse();
10136
10470
  if (status != "active" && status != "retiring") return invalidResponse();
10137
- const target = source.live == null ? void 0 : record$2(source.live);
10471
+ const target = source.live == null ? void 0 : record$1(source.live);
10138
10472
  if (target != null && typeof target.enabled != "boolean") return invalidResponse();
10139
10473
  return {
10140
10474
  ...target == null ? {} : { live: {
10141
10475
  enabled: target.enabled,
10142
- publicationId: string$1(target.publicationId),
10143
- revisionId: string$1(target.revisionId)
10476
+ publicationId: string(target.publicationId),
10477
+ revisionId: string(target.revisionId)
10144
10478
  } },
10145
- createdAt: string$1(source.createdAt),
10146
- ...source.connectorTeamId == null ? {} : { connectorTeamId: string$1(source.connectorTeamId) },
10147
- draftRevisionId: string$1(source.draftRevisionId),
10148
- flowId: string$1(source.flowId),
10149
- name: string$1(source.name),
10479
+ createdAt: string(source.createdAt),
10480
+ ...source.connectorTeamId == null ? {} : { connectorTeamId: string(source.connectorTeamId) },
10481
+ draftRevisionId: string(source.draftRevisionId),
10482
+ resourceReferences: resourceReferences(source.resourceReferences),
10483
+ flowId: string(source.flowId),
10484
+ name: string(source.name),
10150
10485
  status,
10151
- updatedAt: string$1(source.updatedAt),
10486
+ updatedAt: string(source.updatedAt),
10152
10487
  version: 1
10153
10488
  };
10154
10489
  }
10155
10490
  function flowPage(value) {
10156
- const source = record$2(value);
10491
+ const source = record$1(value);
10157
10492
  if (source.version != 1 || !Array.isArray(source.flows)) return invalidResponse();
10158
10493
  const nextCursor = source.nextCursor;
10159
10494
  const total = source.total;
@@ -10167,7 +10502,7 @@ function flowPage(value) {
10167
10502
  };
10168
10503
  }
10169
10504
  function variable(value) {
10170
- const source = record$2(value);
10505
+ const source = record$1(value);
10171
10506
  exact(source, [
10172
10507
  "name",
10173
10508
  "updatedAt",
@@ -10175,35 +10510,35 @@ function variable(value) {
10175
10510
  "version"
10176
10511
  ]);
10177
10512
  if (source.version != 1 || typeof source.value != "string") return invalidResponse();
10178
- const updatedAt = string$1(source.updatedAt);
10513
+ const updatedAt = string(source.updatedAt);
10179
10514
  try {
10180
10515
  if (new Date(updatedAt).toISOString() != updatedAt) return invalidResponse();
10181
10516
  } catch {
10182
10517
  return invalidResponse();
10183
10518
  }
10184
10519
  return {
10185
- name: string$1(source.name),
10520
+ name: string(source.name),
10186
10521
  updatedAt,
10187
10522
  value: source.value,
10188
10523
  version: 1
10189
10524
  };
10190
10525
  }
10191
10526
  function errorListener(value) {
10192
- const source = record$2(value);
10527
+ const source = record$1(value);
10193
10528
  if (typeof source.enabled != "boolean") return invalidResponse();
10194
10529
  return {
10195
- flowId: string$1(source.flowId),
10196
- flowName: string$1(source.flowName),
10197
- nodeId: string$1(source.nodeId),
10198
- nodeName: string$1(source.nodeName),
10530
+ flowId: string(source.flowId),
10531
+ flowName: string(source.flowName),
10532
+ nodeId: string(source.nodeId),
10533
+ nodeName: string(source.nodeName),
10199
10534
  enabled: source.enabled
10200
10535
  };
10201
10536
  }
10202
10537
  //#endregion
10203
10538
  //#region src/control/common/publicationDecoders.ts
10204
10539
  function publication(value) {
10205
- const source = record$2(value);
10206
- const liveEnd = source.liveEnd == null ? void 0 : record$2(source.liveEnd);
10540
+ const source = record$1(value);
10541
+ const liveEnd = source.liveEnd == null ? void 0 : record$1(source.liveEnd);
10207
10542
  if (liveEnd != null && typeof liveEnd.enabled != "boolean") return invalidResponse();
10208
10543
  const operation = source.operation;
10209
10544
  const sourcePublicationId = source.sourcePublicationId;
@@ -10213,32 +10548,32 @@ function publication(value) {
10213
10548
  return {
10214
10549
  ...liveEnd == null ? {} : { liveEnd: {
10215
10550
  enabled: liveEnd.enabled,
10216
- endedAt: string$1(liveEnd.endedAt)
10551
+ endedAt: string(liveEnd.endedAt)
10217
10552
  } },
10218
- actorId: string$1(source.actorId),
10219
- closureDigest: string$1(source.closureDigest),
10220
- createdAt: string$1(source.createdAt),
10221
- engineContract: string$1(source.engineContract),
10222
- flowId: string$1(source.flowId),
10223
- modelVersion: integer$1(source.modelVersion),
10553
+ actorId: string(source.actorId),
10554
+ closureDigest: string(source.closureDigest),
10555
+ createdAt: string(source.createdAt),
10556
+ engineContract: string(source.engineContract),
10557
+ flowId: string(source.flowId),
10558
+ modelVersion: integer(source.modelVersion),
10224
10559
  operation,
10225
- publicationId: string$1(source.publicationId),
10226
- sharedAccessDigest: string$1(source.sharedAccessDigest),
10227
- revisionDigest: string$1(source.revisionDigest),
10228
- revisionId: string$1(source.revisionId),
10560
+ publicationId: string(source.publicationId),
10561
+ sharedAccessDigest: string(source.sharedAccessDigest),
10562
+ revisionDigest: string(source.revisionDigest),
10563
+ revisionId: string(source.revisionId),
10229
10564
  ...sourcePublicationId == null ? {} : { sourcePublicationId },
10230
10565
  version: 1
10231
10566
  };
10232
10567
  }
10233
10568
  function publishOperation(value) {
10234
- const source = record$2(value);
10569
+ const source = record$1(value);
10235
10570
  const status = source.status;
10236
10571
  const common = {
10237
- createdAt: string$1(source.createdAt),
10238
- flowId: string$1(source.flowId),
10239
- operationId: string$1(source.operationId),
10240
- revisionId: string$1(source.revisionId),
10241
- updatedAt: string$1(source.updatedAt),
10572
+ createdAt: string(source.createdAt),
10573
+ flowId: string(source.flowId),
10574
+ operationId: string(source.operationId),
10575
+ revisionId: string(source.revisionId),
10576
+ updatedAt: string(source.updatedAt),
10242
10577
  version: 1
10243
10578
  };
10244
10579
  if (source.version != 1) return invalidResponse();
@@ -10270,7 +10605,7 @@ function publishOperation(value) {
10270
10605
  ]);
10271
10606
  return {
10272
10607
  ...common,
10273
- publicationId: string$1(source.publicationId),
10608
+ publicationId: string(source.publicationId),
10274
10609
  status
10275
10610
  };
10276
10611
  case "failed": {
@@ -10284,7 +10619,7 @@ function publishOperation(value) {
10284
10619
  "updatedAt",
10285
10620
  "version"
10286
10621
  ]);
10287
- const issue = record$2(source.issue);
10622
+ const issue = record$1(source.issue);
10288
10623
  const nodeId = issue.nodeId;
10289
10624
  exact(issue, [
10290
10625
  "code",
@@ -10294,9 +10629,9 @@ function publishOperation(value) {
10294
10629
  return {
10295
10630
  ...common,
10296
10631
  issue: {
10297
- code: string$1(issue.code),
10298
- message: string$1(issue.message),
10299
- ...nodeId == null ? {} : { nodeId: string$1(nodeId) }
10632
+ code: string(issue.code),
10633
+ message: string(issue.message),
10634
+ ...nodeId == null ? {} : { nodeId: string(nodeId) }
10300
10635
  },
10301
10636
  status
10302
10637
  };
@@ -10305,7 +10640,7 @@ function publishOperation(value) {
10305
10640
  }
10306
10641
  }
10307
10642
  function live(value) {
10308
- const source = record$2(value);
10643
+ const source = record$1(value);
10309
10644
  const status = source.status;
10310
10645
  const candidate = source.publication;
10311
10646
  if (source.version != 1 || typeof source.hasUnpublishedChanges != "boolean") return invalidResponse();
@@ -10313,16 +10648,16 @@ function live(value) {
10313
10648
  if (status == "not-published" && candidate !== null) return invalidResponse();
10314
10649
  if (status != "not-published" && candidate === null) return invalidResponse();
10315
10650
  return {
10316
- flowId: string$1(source.flowId),
10651
+ flowId: string(source.flowId),
10317
10652
  hasUnpublishedChanges: source.hasUnpublishedChanges,
10318
10653
  publication: candidate === null ? null : publication(candidate),
10319
- revision: integer$1(source.revision),
10654
+ revision: integer(source.revision),
10320
10655
  status,
10321
10656
  version: 1
10322
10657
  };
10323
10658
  }
10324
10659
  function publicationPage(value) {
10325
- const source = record$2(value);
10660
+ const source = record$1(value);
10326
10661
  const nextCursor = source.nextCursor;
10327
10662
  const total = source.total;
10328
10663
  if (source.version != 1 || !Array.isArray(source.publications)) return invalidResponse();
@@ -10338,22 +10673,22 @@ function publicationPage(value) {
10338
10673
  //#endregion
10339
10674
  //#region src/control/common/revisionDecoders.ts
10340
10675
  function revisionMetadata(value) {
10341
- const source = record$2(value);
10676
+ const source = record$1(value);
10342
10677
  const parentRevisionId = source.parentRevisionId;
10343
10678
  if (source.version != 1 || parentRevisionId !== null && typeof parentRevisionId != "string") return invalidResponse();
10344
10679
  return {
10345
- actorId: string$1(source.actorId),
10346
- createdAt: string$1(source.createdAt),
10347
- digest: string$1(source.digest),
10348
- flowId: string$1(source.flowId),
10349
- modelVersion: integer$1(source.modelVersion),
10680
+ actorId: string(source.actorId),
10681
+ createdAt: string(source.createdAt),
10682
+ digest: string(source.digest),
10683
+ flowId: string(source.flowId),
10684
+ modelVersion: integer(source.modelVersion),
10350
10685
  parentRevisionId,
10351
- revisionId: string$1(source.revisionId),
10686
+ revisionId: string(source.revisionId),
10352
10687
  version: 1
10353
10688
  };
10354
10689
  }
10355
10690
  function draft(value) {
10356
- const source = record$2(value);
10691
+ const source = record$1(value);
10357
10692
  try {
10358
10693
  return {
10359
10694
  ...revisionMetadata(source),
@@ -10364,17 +10699,17 @@ function draft(value) {
10364
10699
  }
10365
10700
  }
10366
10701
  function presentation(value) {
10367
- const source = record$2(value);
10368
- if (source.version != 1 || integer$1(source.revision) < 1) return invalidResponse();
10702
+ const source = record$1(value);
10703
+ if (source.version != 1 || integer(source.revision) < 1) return invalidResponse();
10369
10704
  return {
10370
- revision: integer$1(source.revision),
10371
- updatedAt: string$1(source.updatedAt),
10372
- value: Object.fromEntries(Object.entries(record$2(source.value)).map(([key, item]) => [key, jsonValue(item)])),
10705
+ revision: integer(source.revision),
10706
+ updatedAt: string(source.updatedAt),
10707
+ value: Object.fromEntries(Object.entries(record$1(source.value)).map(([key, item]) => [key, jsonValue(item)])),
10373
10708
  version: 1
10374
10709
  };
10375
10710
  }
10376
10711
  function draftChange(value) {
10377
- const source = record$2(value);
10712
+ const source = record$1(value);
10378
10713
  if (source.version != 1) return invalidResponse();
10379
10714
  return {
10380
10715
  revision: revisionMetadata(source.revision),
@@ -10382,7 +10717,7 @@ function draftChange(value) {
10382
10717
  };
10383
10718
  }
10384
10719
  function draftSync(value) {
10385
- const source = record$2(value);
10720
+ const source = record$1(value);
10386
10721
  if (source.version != 1 || source.kind != "snapshot") return invalidResponse();
10387
10722
  return {
10388
10723
  draft: draft(source.draft),
@@ -10408,7 +10743,7 @@ function runStatus(value) {
10408
10743
  return typeof value == "string" && runStatusSet.has(value) ? value : invalidResponse();
10409
10744
  }
10410
10745
  function run(value) {
10411
- const source = record$2(value);
10746
+ const source = record$1(value);
10412
10747
  const kind = source.source;
10413
10748
  const startedAt = source.startedAt;
10414
10749
  const finishedAt = source.finishedAt;
@@ -10416,11 +10751,11 @@ function run(value) {
10416
10751
  if (startedAt != null && typeof startedAt != "string") return invalidResponse();
10417
10752
  if (finishedAt != null && typeof finishedAt != "string") return invalidResponse();
10418
10753
  return {
10419
- createdAt: string$1(source.createdAt),
10754
+ createdAt: string(source.createdAt),
10420
10755
  ...finishedAt == null ? {} : { finishedAt },
10421
- flowId: string$1(source.flowId),
10422
- revisionId: string$1(source.revisionId),
10423
- runId: string$1(source.runId),
10756
+ flowId: string(source.flowId),
10757
+ revisionId: string(source.revisionId),
10758
+ runId: string(source.runId),
10424
10759
  source: kind,
10425
10760
  ...startedAt == null ? {} : { startedAt },
10426
10761
  status: runStatus(source.status),
@@ -10428,7 +10763,7 @@ function run(value) {
10428
10763
  };
10429
10764
  }
10430
10765
  function runWaiting(value) {
10431
- const source = record$2(value);
10766
+ const source = record$1(value);
10432
10767
  exact(source, [
10433
10768
  "actions",
10434
10769
  "expiresAt",
@@ -10441,15 +10776,15 @@ function runWaiting(value) {
10441
10776
  if (!Array.isArray(actions) || !(actions.length == 1 && actions[0] == "continue" || actions.length == 2 && actions[0] == "approve" && actions[1] == "reject")) return invalidResponse();
10442
10777
  return {
10443
10778
  actions,
10444
- expiresAt: string$1(source.expiresAt),
10445
- nodeId: string$1(source.nodeId),
10446
- prompt: string$1(source.prompt),
10447
- waitId: string$1(source.waitId),
10448
- waitingSince: string$1(source.waitingSince)
10779
+ expiresAt: string(source.expiresAt),
10780
+ nodeId: string(source.nodeId),
10781
+ prompt: string(source.prompt),
10782
+ waitId: string(source.waitId),
10783
+ waitingSince: string(source.waitingSince)
10449
10784
  };
10450
10785
  }
10451
10786
  function runDetails(value) {
10452
- const source = record$2(value);
10787
+ const source = record$1(value);
10453
10788
  const summary = run(source);
10454
10789
  const eventsExpiresAt = source.eventsExpiresAt;
10455
10790
  if (eventsExpiresAt != null && typeof eventsExpiresAt != "string") return invalidResponse();
@@ -10469,13 +10804,13 @@ function runDetails(value) {
10469
10804
  const details = {
10470
10805
  ...summary,
10471
10806
  ...errorHandling(source),
10472
- closureDigest: string$1(source.closureDigest),
10473
- engineContract: string$1(source.engineContract),
10474
- engineDigest: string$1(source.engineDigest),
10807
+ closureDigest: string(source.closureDigest),
10808
+ engineContract: string(source.engineContract),
10809
+ engineDigest: string(source.engineDigest),
10475
10810
  ...eventsExpiresAt == null ? {} : { eventsExpiresAt },
10476
- modelVersion: integer$1(source.modelVersion),
10477
- sharedAccessDigest: string$1(source.sharedAccessDigest),
10478
- revisionDigest: string$1(source.revisionDigest),
10811
+ modelVersion: integer(source.modelVersion),
10812
+ sharedAccessDigest: string(source.sharedAccessDigest),
10813
+ revisionDigest: string(source.revisionDigest),
10479
10814
  ...state
10480
10815
  };
10481
10816
  switch (summary.source) {
@@ -10485,40 +10820,40 @@ function runDetails(value) {
10485
10820
  };
10486
10821
  case "live": return {
10487
10822
  ...details,
10488
- publicationId: string$1(source.publicationId),
10823
+ publicationId: string(source.publicationId),
10489
10824
  source: "live",
10490
10825
  ...source.occurrenceId === void 0 ? {} : {
10491
- occurrenceId: string$1(source.occurrenceId),
10492
- triggerNodeId: string$1(source.triggerNodeId)
10826
+ occurrenceId: string(source.occurrenceId),
10827
+ triggerNodeId: string(source.triggerNodeId)
10493
10828
  }
10494
10829
  };
10495
10830
  }
10496
10831
  }
10497
10832
  function runPage(value) {
10498
- const source = record$2(value);
10833
+ const source = record$1(value);
10499
10834
  const nextCursor = source.nextCursor;
10500
10835
  if (source.version != 1 || !Array.isArray(source.runs)) return invalidResponse();
10501
10836
  if (nextCursor != null && typeof nextCursor != "string") return invalidResponse();
10502
10837
  return {
10503
- flowId: string$1(source.flowId),
10838
+ flowId: string(source.flowId),
10504
10839
  ...nextCursor == null ? {} : { nextCursor },
10505
10840
  runs: source.runs.map(run),
10506
10841
  version: 1
10507
10842
  };
10508
10843
  }
10509
10844
  function runCancellation(value) {
10510
- const source = record$2(value);
10845
+ const source = record$1(value);
10511
10846
  const status = runStatus(source.status);
10512
10847
  if (source.version != 1 || typeof source.cancelAccepted != "boolean" || status == "queued" || status == "starting" || status == "running" || status == "waiting") return invalidResponse();
10513
10848
  return {
10514
10849
  cancelAccepted: source.cancelAccepted,
10515
- runId: string$1(source.runId),
10850
+ runId: string(source.runId),
10516
10851
  status,
10517
10852
  version: 1
10518
10853
  };
10519
10854
  }
10520
10855
  function waitResolution(value) {
10521
- const source = record$2(value);
10856
+ const source = record$1(value);
10522
10857
  exact(source, [
10523
10858
  "action",
10524
10859
  "comment",
@@ -10537,19 +10872,19 @@ function waitResolution(value) {
10537
10872
  comment: source.comment,
10538
10873
  resolutionAccepted: source.resolutionAccepted,
10539
10874
  resolvedAt,
10540
- runId: string$1(source.runId),
10875
+ runId: string(source.runId),
10541
10876
  status: runStatus(source.status),
10542
10877
  version: 1,
10543
- waitId: string$1(source.waitId)
10878
+ waitId: string(source.waitId)
10544
10879
  };
10545
10880
  }
10546
10881
  function runResult(value) {
10547
- const source = record$2(value);
10882
+ const source = record$1(value);
10548
10883
  const status = source.status;
10549
10884
  if (source.version != 1) return invalidResponse();
10550
10885
  const base = {
10551
- finishedAt: string$1(source.finishedAt),
10552
- runId: string$1(source.runId),
10886
+ finishedAt: string(source.finishedAt),
10887
+ runId: string(source.runId),
10553
10888
  version: 1
10554
10889
  };
10555
10890
  if (status == "completed") {
@@ -10565,7 +10900,7 @@ function runResult(value) {
10565
10900
  status: "canceled"
10566
10901
  };
10567
10902
  if (status == "failed") {
10568
- const error = record$2(source.error);
10903
+ const error = record$1(source.error);
10569
10904
  return {
10570
10905
  ...base,
10571
10906
  error: runFailure(error),
@@ -10573,7 +10908,7 @@ function runResult(value) {
10573
10908
  };
10574
10909
  }
10575
10910
  if (status == "indeterminate") {
10576
- const error = record$2(source.error);
10911
+ const error = record$1(source.error);
10577
10912
  return {
10578
10913
  ...base,
10579
10914
  error: runFailure(error),
@@ -10583,16 +10918,16 @@ function runResult(value) {
10583
10918
  return invalidResponse();
10584
10919
  }
10585
10920
  function errorHandling(source) {
10586
- const errorSource = source.errorSource == null ? void 0 : record$2(source.errorSource);
10921
+ const errorSource = source.errorSource == null ? void 0 : record$1(source.errorSource);
10587
10922
  if (source.errorDispatches != null && !Array.isArray(source.errorDispatches)) return invalidResponse();
10588
10923
  return {
10589
10924
  ...errorSource == null ? {} : { errorSource: {
10590
- flowId: string$1(errorSource.flowId),
10591
- runId: string$1(errorSource.runId)
10925
+ flowId: string(errorSource.flowId),
10926
+ runId: string(errorSource.runId)
10592
10927
  } },
10593
10928
  ...source.errorDispatches == null ? {} : { errorDispatches: source.errorDispatches.map((value) => {
10594
- const dispatch = record$2(value);
10595
- const flowId = string$1(dispatch.flowId);
10929
+ const dispatch = record$1(value);
10930
+ const flowId = string(dispatch.flowId);
10596
10931
  switch (dispatch.status) {
10597
10932
  case "pending": return {
10598
10933
  status: "pending",
@@ -10601,12 +10936,12 @@ function errorHandling(source) {
10601
10936
  case "dispatched": return {
10602
10937
  status: "dispatched",
10603
10938
  flowId,
10604
- runId: string$1(dispatch.runId)
10939
+ runId: string(dispatch.runId)
10605
10940
  };
10606
10941
  case "failed": return {
10607
10942
  status: "failed",
10608
10943
  flowId,
10609
- message: string$1(dispatch.message)
10944
+ message: string(dispatch.message)
10610
10945
  };
10611
10946
  default: return invalidResponse();
10612
10947
  }
@@ -10615,11 +10950,11 @@ function errorHandling(source) {
10615
10950
  }
10616
10951
  function runFailure(error) {
10617
10952
  return {
10618
- code: string$1(error.code),
10619
- message: string$1(error.message),
10620
- ...error.nodeId === void 0 ? {} : { nodeId: string$1(error.nodeId) },
10621
- ...error.jobId === void 0 ? {} : { jobId: string$1(error.jobId) },
10622
- ...error.path === void 0 ? {} : { path: (Array.isArray(error.path) ? error.path : invalidResponse()).map(string$1) }
10953
+ code: string(error.code),
10954
+ message: string(error.message),
10955
+ ...error.nodeId === void 0 ? {} : { nodeId: string(error.nodeId) },
10956
+ ...error.jobId === void 0 ? {} : { jobId: string(error.jobId) },
10957
+ ...error.path === void 0 ? {} : { path: (Array.isArray(error.path) ? error.path : invalidResponse()).map(string) }
10623
10958
  };
10624
10959
  }
10625
10960
  //#endregion
@@ -10643,14 +10978,14 @@ function randomId() {
10643
10978
  //#endregion
10644
10979
  //#region src/control/common/api.ts
10645
10980
  function decodeRunEvent(value) {
10646
- const source = record$2(value);
10647
- const sequence = integer$1(source.sequence);
10981
+ const source = record$1(value);
10982
+ const sequence = integer(source.sequence);
10648
10983
  if (sequence < 0) return invalidResponse();
10649
10984
  const base = {
10650
- createdAt: string$1(source.createdAt),
10985
+ createdAt: string(source.createdAt),
10651
10986
  sequence
10652
10987
  };
10653
- const payload = record$2(source.payload);
10988
+ const payload = record$1(source.payload);
10654
10989
  const kind = source.kind;
10655
10990
  switch (kind) {
10656
10991
  case "run.queued": return {
@@ -10662,17 +10997,17 @@ function decodeRunEvent(value) {
10662
10997
  ...base,
10663
10998
  kind,
10664
10999
  payload: {
10665
- flowId: string$1(payload.flowId),
10666
- scopeId: string$1(payload.scopeId),
10667
- ...payload.parentScopeId === void 0 ? {} : { parentScopeId: string$1(payload.parentScopeId) }
11000
+ flowId: string(payload.flowId),
11001
+ scopeId: string(payload.scopeId),
11002
+ ...payload.parentScopeId === void 0 ? {} : { parentScopeId: string(payload.parentScopeId) }
10668
11003
  }
10669
11004
  };
10670
11005
  case "run.progress": return {
10671
11006
  ...base,
10672
11007
  kind,
10673
11008
  payload: {
10674
- flowId: string$1(payload.flowId),
10675
- scopeId: string$1(payload.scopeId),
11009
+ flowId: string(payload.flowId),
11010
+ scopeId: string(payload.scopeId),
10676
11011
  progress: eventProgress(payload.progress)
10677
11012
  }
10678
11013
  };
@@ -10681,16 +11016,16 @@ function decodeRunEvent(value) {
10681
11016
  return {
10682
11017
  ...base,
10683
11018
  kind,
10684
- payload: { waitIds: payload.waitIds.map((id) => string$1(id)) }
11019
+ payload: { waitIds: payload.waitIds.map((id) => string(id)) }
10685
11020
  };
10686
11021
  case "wait.created": return {
10687
11022
  ...base,
10688
11023
  kind,
10689
11024
  payload: {
10690
- expiresAt: string$1(payload.expiresAt),
10691
- nodeId: string$1(payload.nodeId),
10692
- waitId: string$1(payload.waitId),
10693
- waitingSince: string$1(payload.waitingSince)
11025
+ expiresAt: string(payload.expiresAt),
11026
+ nodeId: string(payload.nodeId),
11027
+ waitId: string(payload.waitId),
11028
+ waitingSince: string(payload.waitingSince)
10694
11029
  }
10695
11030
  };
10696
11031
  case "run.resolved": {
@@ -10703,8 +11038,8 @@ function decodeRunEvent(value) {
10703
11038
  payload: {
10704
11039
  action,
10705
11040
  comment: payload.comment,
10706
- resolvedAt: string$1(payload.resolvedAt),
10707
- waitId: string$1(payload.waitId)
11041
+ resolvedAt: string(payload.resolvedAt),
11042
+ waitId: string(payload.waitId)
10708
11043
  }
10709
11044
  };
10710
11045
  }
@@ -10728,23 +11063,23 @@ function decodeRunEvent(value) {
10728
11063
  case "node.progress":
10729
11064
  case "node.artifact": {
10730
11065
  const node = {
10731
- flowId: string$1(payload.flowId),
10732
- scopeId: string$1(payload.scopeId),
10733
- nodeId: string$1(payload.nodeId),
10734
- executionId: string$1(payload.executionId)
11066
+ flowId: string(payload.flowId),
11067
+ scopeId: string(payload.scopeId),
11068
+ nodeId: string(payload.nodeId),
11069
+ executionId: string(payload.executionId)
10735
11070
  };
10736
11071
  switch (kind) {
10737
11072
  case "node.started": {
10738
11073
  const nodeKind = payload.nodeKind;
10739
- if (nodeKind !== void 0 && nodeKind !== "approval" && nodeKind !== "condition" && nodeKind !== "connector" && nodeKind !== "javascript" && nodeKind !== "decision" && nodeKind !== "openapi" && nodeKind !== "llm" && nodeKind !== "agent" && nodeKind !== "subflow" && nodeKind !== "value" && nodeKind !== "wait") return invalidResponse();
11074
+ 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();
10740
11075
  return {
10741
11076
  ...base,
10742
11077
  kind,
10743
11078
  payload: {
10744
11079
  ...node,
10745
11080
  ...nodeKind === void 0 ? {} : { nodeKind },
10746
- ...payload.nodeTitle === void 0 ? {} : { nodeTitle: string$1(payload.nodeTitle) },
10747
- ...payload.operation === void 0 ? {} : { operation: string$1(payload.operation) }
11081
+ ...payload.nodeTitle === void 0 ? {} : { nodeTitle: string(payload.nodeTitle) },
11082
+ ...payload.operation === void 0 ? {} : { operation: string(payload.operation) }
10748
11083
  }
10749
11084
  };
10750
11085
  }
@@ -10753,19 +11088,19 @@ function decodeRunEvent(value) {
10753
11088
  kind,
10754
11089
  payload: {
10755
11090
  ...node,
10756
- outputs: Object.fromEntries(Object.entries(record$2(payload.outputs)).map(([key, item]) => [key, jsonValue(item)]))
11091
+ outputs: Object.fromEntries(Object.entries(record$1(payload.outputs)).map(([key, item]) => [key, jsonValue(item)]))
10757
11092
  }
10758
11093
  };
10759
11094
  case "node.failed": {
10760
- const error = record$2(payload.error);
11095
+ const error = record$1(payload.error);
10761
11096
  return {
10762
11097
  ...base,
10763
11098
  kind,
10764
11099
  payload: {
10765
11100
  ...node,
10766
11101
  error: {
10767
- code: string$1(error.code),
10768
- message: string$1(error.message)
11102
+ code: string(error.code),
11103
+ message: string(error.message)
10769
11104
  }
10770
11105
  }
10771
11106
  };
@@ -10779,7 +11114,7 @@ function decodeRunEvent(value) {
10779
11114
  payload: {
10780
11115
  ...node,
10781
11116
  level,
10782
- message: string$1(payload.message)
11117
+ message: string(payload.message)
10783
11118
  }
10784
11119
  };
10785
11120
  }
@@ -10792,9 +11127,9 @@ function decodeRunEvent(value) {
10792
11127
  }
10793
11128
  };
10794
11129
  case "node.artifact": {
10795
- const artifact = record$2(payload.artifact);
10796
- const size = integer$1(artifact.size);
10797
- const digest = string$1(artifact.digest);
11130
+ const artifact = record$1(payload.artifact);
11131
+ const size = integer(artifact.size);
11132
+ const digest = string(artifact.digest);
10798
11133
  if (artifact.kind != "artifact" || size < 0 || !/^sha256:[0-9a-f]{64}$/.test(digest)) return invalidResponse();
10799
11134
  return {
10800
11135
  ...base,
@@ -10803,11 +11138,11 @@ function decodeRunEvent(value) {
10803
11138
  ...node,
10804
11139
  artifact: {
10805
11140
  kind: "artifact",
10806
- id: string$1(artifact.id),
10807
- name: string$1(artifact.name),
11141
+ id: string(artifact.id),
11142
+ name: string(artifact.name),
10808
11143
  size,
10809
11144
  digest,
10810
- ...artifact.mediaType === void 0 ? {} : { mediaType: string$1(artifact.mediaType) }
11145
+ ...artifact.mediaType === void 0 ? {} : { mediaType: string(artifact.mediaType) }
10811
11146
  }
10812
11147
  }
10813
11148
  };
@@ -10821,9 +11156,9 @@ function eventProgress(value) {
10821
11156
  return typeof value == "number" && Number.isFinite(value) && value >= 0 && value <= 100 ? value : invalidResponse();
10822
11157
  }
10823
11158
  function runEvents(value) {
10824
- const source = record$2(value);
11159
+ const source = record$1(value);
10825
11160
  const eventsExpiresAt = source.eventsExpiresAt;
10826
- const nextAfter = integer$1(source.nextAfter);
11161
+ const nextAfter = integer(source.nextAfter);
10827
11162
  if (source.version != 1 || !Array.isArray(source.events) || typeof source.done != "boolean" || typeof source.historyComplete != "boolean") return invalidResponse();
10828
11163
  if (eventsExpiresAt != null && typeof eventsExpiresAt != "string") return invalidResponse();
10829
11164
  if (nextAfter < 0) return invalidResponse();
@@ -10833,7 +11168,7 @@ function runEvents(value) {
10833
11168
  ...eventsExpiresAt == null ? {} : { eventsExpiresAt },
10834
11169
  historyComplete: source.historyComplete,
10835
11170
  nextAfter,
10836
- runId: string$1(source.runId),
11171
+ runId: string(source.runId),
10837
11172
  version: 1
10838
11173
  };
10839
11174
  }
@@ -10846,7 +11181,7 @@ var ControlClient = class {
10846
11181
  this.requestControl = requestControl;
10847
11182
  }
10848
11183
  async loadOpenApiDocument(url, signal) {
10849
- const result = record$2(await this.request("/v1/openapi/document", {
11184
+ const result = record$1(await this.request("/v1/openapi/document", {
10850
11185
  method: "POST",
10851
11186
  body: JSON.stringify({
10852
11187
  url,
@@ -10869,7 +11204,7 @@ var ControlClient = class {
10869
11204
  return decodeEventSources(await this.request("/v1/event-sources" + (flowId == null ? "" : `?flowId=${segment(flowId)}`), { signal }));
10870
11205
  }
10871
11206
  async listEventSourceConnections(teamId, signal) {
10872
- const source = record$2(await this.request(`/v1/event-sources/connections${teamId == null ? "" : `?teamId=${segment(teamId)}`}`, { signal }));
11207
+ const source = record$1(await this.request(`/v1/event-sources/connections${teamId == null ? "" : `?teamId=${segment(teamId)}`}`, { signal }));
10873
11208
  exact(source, ["version", "connections"]);
10874
11209
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
10875
11210
  return source.connections.map(connection);
@@ -10896,7 +11231,7 @@ var ControlClient = class {
10896
11231
  });
10897
11232
  }
10898
11233
  async listVariables() {
10899
- const source = record$2(await this.request("/v1/variables"));
11234
+ const source = record$1(await this.request("/v1/variables"));
10900
11235
  exact(source, ["variables", "version"]);
10901
11236
  if (source.version != 1 || !Array.isArray(source.variables)) return invalidResponse();
10902
11237
  return {
@@ -10914,7 +11249,7 @@ var ControlClient = class {
10914
11249
  }));
10915
11250
  }
10916
11251
  async deleteVariable(name) {
10917
- const source = record$2(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
11252
+ const source = record$1(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
10918
11253
  exact(source, ["version"]);
10919
11254
  if (source.version != 1) return invalidResponse();
10920
11255
  }
@@ -10933,7 +11268,7 @@ var ControlClient = class {
10933
11268
  return flow(await this.request(`/v1/flows/${segment(flowId)}`));
10934
11269
  }
10935
11270
  async getErrorListeners(flowId, signal) {
10936
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/error-listeners`, { signal }));
11271
+ const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/error-listeners`, { signal }));
10937
11272
  if (source.version != 1 || !Array.isArray(source.listeners)) return invalidResponse();
10938
11273
  return source.listeners.map(errorListener);
10939
11274
  }
@@ -10950,12 +11285,12 @@ var ControlClient = class {
10950
11285
  return flow(await this.request(`/v1/flows/${segment(flowId)}`, { method: "DELETE" }));
10951
11286
  }
10952
11287
  async listTriggerKeys(signal, locale) {
10953
- const source = record$2(await this.request(`/v1/trigger-keys${locale == null ? "" : `?locale=${encodeURIComponent(locale)}`}`, { signal }));
11288
+ const source = record$1(await this.request(`/v1/trigger-keys${locale == null ? "" : `?locale=${encodeURIComponent(locale)}`}`, { signal }));
10954
11289
  if (source.version != 1 || !Array.isArray(source.keys)) return invalidResponse();
10955
11290
  return source.keys.map(triggerKeySummary);
10956
11291
  }
10957
11292
  async listTriggerDefinitions(signal) {
10958
- const source = record$2(await this.request("/v1/trigger-keys/catalog", { signal }));
11293
+ const source = record$1(await this.request("/v1/trigger-keys/catalog", { signal }));
10959
11294
  if (source.version != 2 || !Array.isArray(source.definitions)) return invalidResponse();
10960
11295
  return source.definitions.map(triggerKey);
10961
11296
  }
@@ -10997,13 +11332,13 @@ var ControlClient = class {
10997
11332
  };
10998
11333
  }
10999
11334
  async getTriggerKey(key, signal) {
11000
- const source = record$2(await this.request(`/v1/trigger-keys/${segment(key)}`, { signal }));
11335
+ const source = record$1(await this.request(`/v1/trigger-keys/${segment(key)}`, { signal }));
11001
11336
  if (source.version != 1) return invalidResponse();
11002
11337
  return triggerKey(source.definition);
11003
11338
  }
11004
11339
  async listFlowTriggerBindings(flowId, signal) {
11005
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/triggers`, { signal }));
11006
- if (source.version != 1 || string$1(source.flowId) != flowId || !Array.isArray(source.bindings)) return invalidResponse();
11340
+ const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/triggers`, { signal }));
11341
+ if (source.version != 1 || string(source.flowId) != flowId || !Array.isArray(source.bindings)) return invalidResponse();
11007
11342
  return source.bindings.map(triggerBinding);
11008
11343
  }
11009
11344
  async getFlowTriggerBinding(flowId, triggerNodeId) {
@@ -11035,7 +11370,7 @@ var ControlClient = class {
11035
11370
  }));
11036
11371
  }
11037
11372
  async getEditor(flowId) {
11038
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/editor`));
11373
+ const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/editor`));
11039
11374
  if (source.version != 1) return invalidResponse();
11040
11375
  const result = {
11041
11376
  flow: flow(source.flow),
@@ -11048,7 +11383,7 @@ var ControlClient = class {
11048
11383
  return result;
11049
11384
  }
11050
11385
  async getPublicationPresentation(flowId, publicationId, signal) {
11051
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/publications/${segment(publicationId)}/presentation`, { signal }));
11386
+ const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/publications/${segment(publicationId)}/presentation`, { signal }));
11052
11387
  if (source.version != 1) return invalidResponse();
11053
11388
  return {
11054
11389
  version: 1,
@@ -11068,30 +11403,30 @@ var ControlClient = class {
11068
11403
  return draft(await this.request(`/v1/flows/${segment(flowId)}/revisions/${segment(revisionId)}`, { signal }));
11069
11404
  }
11070
11405
  async listTriggerConfigOptions(flowId, nodeId, field, signal) {
11071
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/triggers/${segment(nodeId)}/options/${segment(field)}`, { signal }));
11406
+ const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/triggers/${segment(nodeId)}/options/${segment(field)}`, { signal }));
11072
11407
  exact(source, ["options", "version"]);
11073
11408
  if (source.version != 1 || !Array.isArray(source.options) || source.options.length > 1e3) return invalidResponse();
11074
11409
  return source.options.map((value) => {
11075
- const item = record$2(value);
11410
+ const item = record$1(value);
11076
11411
  exact(item, [
11077
11412
  "value",
11078
11413
  "label",
11079
11414
  ...item.color == null ? [] : ["color"]
11080
11415
  ]);
11081
- const color = item.color == null ? void 0 : string$1(item.color);
11416
+ const color = item.color == null ? void 0 : string(item.color);
11082
11417
  if (color != null && !/^#[0-9a-fA-F]{6}$/.test(color)) return invalidResponse();
11083
11418
  return color == null ? {
11084
- value: string$1(item.value),
11085
- label: string$1(item.label)
11419
+ value: string(item.value),
11420
+ label: string(item.label)
11086
11421
  } : {
11087
- value: string$1(item.value),
11088
- label: string$1(item.label),
11422
+ value: string(item.value),
11423
+ label: string(item.label),
11089
11424
  color
11090
11425
  };
11091
11426
  });
11092
11427
  }
11093
11428
  async listConnectorTeams(signal) {
11094
- const source = record$2(await this.request("/v1/connector/teams", { signal }));
11429
+ const source = record$1(await this.request("/v1/connector/teams", { signal }));
11095
11430
  exact(source, [
11096
11431
  "enabled",
11097
11432
  "teams",
@@ -11101,7 +11436,7 @@ var ControlClient = class {
11101
11436
  return {
11102
11437
  enabled: source.enabled,
11103
11438
  teams: source.teams.map((value) => {
11104
- const team = record$2(value);
11439
+ const team = record$1(value);
11105
11440
  exact(team, [
11106
11441
  "id",
11107
11442
  "name",
@@ -11109,8 +11444,8 @@ var ControlClient = class {
11109
11444
  ]);
11110
11445
  if (typeof team.systemCreated != "boolean") return invalidResponse();
11111
11446
  return {
11112
- id: string$1(team.id),
11113
- name: string$1(team.name),
11447
+ id: string(team.id),
11448
+ name: string(team.name),
11114
11449
  systemCreated: team.systemCreated
11115
11450
  };
11116
11451
  }),
@@ -11208,20 +11543,51 @@ var ControlClient = class {
11208
11543
  const parameters = new URLSearchParams();
11209
11544
  if (flowId != null) parameters.set("flowId", flowId);
11210
11545
  if (teamId != null) parameters.set("teamId", teamId);
11211
- const source = record$2(await this.request(`/v1/connector/connections/${segment(serviceId)}/page${parameters.size == 0 ? "" : `?${parameters}`}`, {
11546
+ const source = record$1(await this.request(`/v1/connector/connections/${segment(serviceId)}/page${parameters.size == 0 ? "" : `?${parameters}`}`, {
11212
11547
  body: JSON.stringify({ version: 1 }),
11213
11548
  method: "POST"
11214
11549
  }));
11215
11550
  exact(source, ["url", "version"]);
11216
11551
  if (source.version != 1) return invalidResponse();
11217
11552
  try {
11218
- const url = new URL(string$1(source.url));
11553
+ const url = new URL(string(source.url));
11219
11554
  if (url.protocol != "http:" && url.protocol != "https:") return invalidResponse();
11220
11555
  return url.href;
11221
11556
  } catch {
11222
11557
  return invalidResponse();
11223
11558
  }
11224
11559
  }
11560
+ async readAuthoring(flowId, query = {}) {
11561
+ return authoringReadResponse.parse(await this.request(`/v1/flows/${segment(flowId)}/authoring/read`, {
11562
+ method: "POST",
11563
+ body: JSON.stringify(query)
11564
+ }));
11565
+ }
11566
+ async searchAuthoring(flowId, query) {
11567
+ return authoringSearchResponse.parse(await this.request(`/v1/flows/${segment(flowId)}/authoring/search`, {
11568
+ method: "POST",
11569
+ body: JSON.stringify(query)
11570
+ }));
11571
+ }
11572
+ async authoringSchema(flowId, query) {
11573
+ return record$1(await this.request(`/v1/flows/${segment(flowId)}/authoring/schema`, {
11574
+ method: "POST",
11575
+ body: JSON.stringify(query)
11576
+ }));
11577
+ }
11578
+ async editAuthoring(flowId, request) {
11579
+ return authoringEditResponse.parse(await this.request(`/v1/flows/${segment(flowId)}/authoring/edit`, {
11580
+ method: "POST",
11581
+ headers: { "idempotency-key": request.requestId },
11582
+ body: JSON.stringify(request)
11583
+ }));
11584
+ }
11585
+ async checkAuthoring(flowId, revisionId) {
11586
+ return authoringCheckResponse.parse(await this.request(`/v1/flows/${segment(flowId)}/authoring/check`, {
11587
+ method: "POST",
11588
+ body: JSON.stringify({ revisionId })
11589
+ }));
11590
+ }
11225
11591
  async changeDraft(flowId, expectedRevisionId, operations, changeId = operationKey("change")) {
11226
11592
  return draftChange(await this.request(`/v1/flows/${segment(flowId)}/draft/changes`, {
11227
11593
  body: JSON.stringify({
@@ -11379,7 +11745,7 @@ var ControlClient = class {
11379
11745
  const query = Object.entries(parameters).map(([key, value]) => `${segment(key)}=${segment(value)}`).join("&");
11380
11746
  const suffix = query == "" ? "" : `?${query}`;
11381
11747
  return this.connectorRequest(`/v1/connector/actions${suffix}`, "actions", signal, (value) => {
11382
- const source = record$2(value);
11748
+ const source = record$1(value);
11383
11749
  exact(source, ["actions", "version"]);
11384
11750
  if (source.version != 1 || !Array.isArray(source.actions)) return invalidResponse();
11385
11751
  return source.actions.map(connectorAction);
@@ -11402,9 +11768,9 @@ var ControlClient = class {
11402
11768
  } catch {
11403
11769
  return invalidResponse();
11404
11770
  }
11405
- const error = record$2(value).error;
11406
- const source = error == null ? void 0 : record$2(error);
11407
- 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}.`);
11771
+ const error = record$1(value).error;
11772
+ const source = error == null ? void 0 : record$1(error);
11773
+ 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$1(source.details));
11408
11774
  }
11409
11775
  return response;
11410
11776
  }
@@ -11514,8 +11880,7 @@ function addValueNode(harness, flowId, revisionId, nodeId = "marker", changeId)
11514
11880
  value: true
11515
11881
  }]
11516
11882
  },
11517
- nodeId,
11518
- target: { kind: "flow" }
11883
+ nodeId
11519
11884
  }], changeId);
11520
11885
  }
11521
11886
  async function addManualTrigger(harness, flowId, revisionId) {
@@ -11525,8 +11890,7 @@ async function addManualTrigger(harness, flowId, revisionId) {
11525
11890
  kind: "manual",
11526
11891
  name: "Start"
11527
11892
  },
11528
- nodeId: "start",
11529
- target: { kind: "flow" }
11893
+ nodeId: "start"
11530
11894
  }]), 200, "Add manual trigger"), "Manual trigger Revision");
11531
11895
  }
11532
11896
  function changedRevisionId(change, message) {
@@ -11585,6 +11949,84 @@ function liveRunRequest(harness, publicationId, key) {
11585
11949
  });
11586
11950
  }
11587
11951
  var controlApiConformanceCases = [
11952
+ {
11953
+ name: "authors nodes atomically with public views, fixed reads and replay before CAS",
11954
+ async verify(harness) {
11955
+ const api = client(harness), flow = await api.createFlow("Node authoring");
11956
+ const input = {
11957
+ baseRevision: flow.draftRevisionId,
11958
+ requestId: "semantic-create",
11959
+ edits: [{
11960
+ op: "node.add",
11961
+ type: "code",
11962
+ as: "code",
11963
+ name: "Format",
11964
+ code: "export default () => ({value:1})"
11965
+ }]
11966
+ };
11967
+ const first = await api.editAuthoring(flow.flowId, input), ref = first.nodes.code;
11968
+ const detail = await api.readAuthoring(flow.flowId, {
11969
+ nodes: [ref],
11970
+ revision: first.revision
11971
+ });
11972
+ if (/"(?:taskId|moduleId|bindingId)"/.test(JSON.stringify(detail))) fail("Public node view leaked storage identities");
11973
+ equal((await api.searchAuthoring(flow.flowId, { query: "Format" })).data.matches[0]?.node, ref, "Search reference");
11974
+ const changed = await api.editAuthoring(flow.flowId, {
11975
+ baseRevision: first.revision,
11976
+ requestId: "semantic-text",
11977
+ edits: [{
11978
+ op: "text.edit",
11979
+ node: ref,
11980
+ field: "code",
11981
+ oldText: "value:1",
11982
+ newText: "value:2"
11983
+ }]
11984
+ });
11985
+ equal((await api.readAuthoring(flow.flowId, {
11986
+ revision: first.revision,
11987
+ text: {
11988
+ node: ref,
11989
+ field: "code"
11990
+ }
11991
+ })).data.text?.content, "export default () => ({value:1})", "Immutable text");
11992
+ const replay = await api.editAuthoring(flow.flowId, input);
11993
+ equal(replay.revision, first.revision, "Replay receipt after head advances");
11994
+ equal(replay.nodes, first.nodes, "Stable alias identities");
11995
+ const post = (value) => request(harness, `/v1/flows/${flow.flowId}/authoring/edit`, {
11996
+ method: "POST",
11997
+ body: JSON.stringify(value)
11998
+ });
11999
+ await error(await post({
12000
+ ...input,
12001
+ requestId: "stale"
12002
+ }), 412, "flow.revision-conflict", "Stale semantic edit");
12003
+ await error(await post({
12004
+ ...input,
12005
+ edits: [{
12006
+ op: "node.remove",
12007
+ node: ref
12008
+ }]
12009
+ }), 409, "flow.conflict", "Request identity conflict");
12010
+ await error(await post({
12011
+ baseRevision: changed.revision,
12012
+ requestId: "partial",
12013
+ edits: [{
12014
+ op: "node.update",
12015
+ node: ref,
12016
+ set: { name: "Changed" }
12017
+ }, {
12018
+ op: "text.edit",
12019
+ node: ref,
12020
+ field: "code",
12021
+ oldText: "absent",
12022
+ newText: "new"
12023
+ }]
12024
+ }), 400, "flow.invalid", "Atomic text failure");
12025
+ equal((await api.getFlow(flow.flowId)).draftRevisionId, changed.revision, "Rejected batch preserves head");
12026
+ equal((await api.getDraft(flow.flowId)).content.document.graph.nodes[ref]?.name, "Format", "Workbench node identity");
12027
+ equal((await api.checkAuthoring(flow.flowId, changed.revision)).revisionId, changed.revision, "Fixed check identity");
12028
+ }
12029
+ },
11588
12030
  {
11589
12031
  name: "admits simultaneous retries as one Run and preserves its Trigger identity",
11590
12032
  async verify(harness) {
@@ -11719,6 +12161,11 @@ var controlApiConformanceCases = [
11719
12161
  const draftRevisionId = requiredString(created.draftRevisionId, "Created Flow draftRevisionId");
11720
12162
  equal(created.name, "Control flow", "Created Flow name");
11721
12163
  equal(created.status, "active", "Created Flow status");
12164
+ equal(record(created.resourceReferences, "Flow resource references").draft, {
12165
+ variableNames: [],
12166
+ connections: [],
12167
+ errorSourceFlowIds: []
12168
+ }, "Empty draft resources");
11722
12169
  equal(await json(await createFlowRequest(harness, "Control flow", "flow-lifecycle"), 200, "Replay Flow"), created, "Replayed Flow");
11723
12170
  await error(await createFlowRequest(harness, "Different flow", "flow-lifecycle"), 409, "flow.conflict", "Conflicting Flow");
11724
12171
  equal(await json(await request(harness, `/v1/flows/${flowId}`), 200, "Read Flow"), created, "Read Flow");
@@ -11762,7 +12209,6 @@ var controlApiConformanceCases = [
11762
12209
  }],
11763
12210
  kind: "graph.node.values.set",
11764
12211
  nodeId: "marker",
11765
- target: { kind: "flow" },
11766
12212
  value: [{
11767
12213
  handle: "ready",
11768
12214
  jsonSchema: { type: "boolean" },
@@ -11891,7 +12337,6 @@ var controlApiConformanceCases = [
11891
12337
  {
11892
12338
  kind: "graph.node.create",
11893
12339
  nodeId: "other",
11894
- target: { kind: "flow" },
11895
12340
  node: {
11896
12341
  kind: "webhook",
11897
12342
  method: "POST",
@@ -11902,7 +12347,6 @@ var controlApiConformanceCases = [
11902
12347
  {
11903
12348
  kind: "graph.node.create",
11904
12349
  nodeId: "broken",
11905
- target: { kind: "flow" },
11906
12350
  node: {
11907
12351
  kind: "task",
11908
12352
  name: "Broken",
@@ -11917,7 +12361,6 @@ var controlApiConformanceCases = [
11917
12361
  },
11918
12362
  {
11919
12363
  kind: "graph.edge.connect",
11920
- target: { kind: "flow" },
11921
12364
  edge: {
11922
12365
  source: "other",
11923
12366
  target: "broken"
@@ -12101,15 +12544,13 @@ var controlApiConformanceCases = [
12101
12544
  name: "Approval",
12102
12545
  prompt: "Approve request 1?"
12103
12546
  },
12104
- nodeId: "approval",
12105
- target: { kind: "flow" }
12547
+ nodeId: "approval"
12106
12548
  }, {
12107
12549
  kind: "graph.edge.connect",
12108
12550
  edge: {
12109
12551
  source: "start",
12110
12552
  target: "approval"
12111
- },
12112
- target: { kind: "flow" }
12553
+ }
12113
12554
  }]), 200, "Create Wait"), "Wait Revision")}/runs`;
12114
12555
  const create = async (key, message) => json(await request(harness, runPath, {
12115
12556
  body: JSON.stringify({
@@ -12445,8 +12886,7 @@ var triggerControlApiConformanceCases = [{
12445
12886
  kind: "cron",
12446
12887
  name: "Scheduled"
12447
12888
  },
12448
- nodeId: "cron",
12449
- target: { kind: "flow" }
12889
+ nodeId: "cron"
12450
12890
  }, {
12451
12891
  kind: "graph.node.create",
12452
12892
  node: {
@@ -12455,8 +12895,7 @@ var triggerControlApiConformanceCases = [{
12455
12895
  method: "POST",
12456
12896
  name: "Incoming"
12457
12897
  },
12458
- nodeId: "webhook",
12459
- target: { kind: "flow" }
12898
+ nodeId: "webhook"
12460
12899
  }]), 200, "Create Trigger nodes"), "Trigger Revision");
12461
12900
  const publication = (await completePublish(harness, await publishRequest(harness, flowId, triggerRevisionId, null, "trigger-publication"), 202, "Publish Trigger Flow")).publication;
12462
12901
  const publicationId = requiredString(publication.publicationId, "Trigger Publication");
@@ -12499,8 +12938,7 @@ var triggerControlApiConformanceCases = [{
12499
12938
  await error(await request(harness, `${base}/cron/activities?cursor=${encodeURIComponent(cursor)}`), 400, "page.invalid-cursor", "Activity cursor belongs to one Trigger");
12500
12939
  await completePublish(harness, await publishRequest(harness, flowId, changedRevisionId(await json(await changeRequest(harness, flowId, triggerRevisionId, [{
12501
12940
  kind: "graph.node.delete",
12502
- nodeId: "webhook",
12503
- target: { kind: "flow" }
12941
+ nodeId: "webhook"
12504
12942
  }]), 200, "Delete Webhook"), "Retired Trigger Revision"), publicationId, "retire-trigger"), 202, "Publish retired Trigger");
12505
12943
  equal(record((await json(await request(harness, webhookPath), 200, "Read retired Webhook")).binding, "Retired Webhook").currentPublicationId, void 0, "Retired Publication");
12506
12944
  }
@@ -12899,7 +13337,6 @@ function pollControlApiConformanceCases(fixture) {
12899
13337
  const changed = await json(await changeRequest(harness, flow.flowId, flow.draftRevisionId, [{
12900
13338
  kind: "graph.node.create",
12901
13339
  nodeId: "poll",
12902
- target: { kind: "flow" },
12903
13340
  node: {
12904
13341
  kind: "poll",
12905
13342
  name: "Poll",